tdf#124953: Use rangelist's combined range top-left address...
[LibreOffice.git] / include / svx / dataaccessdescriptor.hxx
blob92e992c2ce74be523e1c435c5deea7440b438bff
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
21 #define INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
23 #include <rtl/ustring.hxx>
24 #include <svx/svxdllapi.h>
25 #include <memory>
27 namespace com::sun::star::beans { class XPropertySet; }
28 namespace com::sun::star::beans { struct PropertyValue; }
29 namespace com::sun::star::uno { class Any; }
30 namespace com::sun::star::uno { template <class E> class Sequence; }
31 namespace com::sun::star::uno { template <typename > class Reference; }
33 namespace svx
35 class ODADescriptorImpl;
37 //= DataAccessDescriptorProperty
38 enum class DataAccessDescriptorProperty
40 DataSource, /// data source name (string)
41 DatabaseLocation, /// database file URL (string)
42 ConnectionResource, /// database driver URL (string)
43 Connection, /// connection (XConnection)
45 Command, /// command (string)
46 CommandType, /// command type (long)
47 EscapeProcessing, /// escape processing (boolean)
48 Filter, /// additional filter (string)
49 Cursor, /// the cursor (XResultSet)
51 ColumnName, /// column name (string)
52 ColumnObject, /// column object (XPropertySet)
54 Selection, /// selection (sequence< any >)
55 BookmarkSelection, /// selection are bookmarks? (boolean)
57 Component /// component name (XContent)
60 //= ODataAccessDescriptor
62 /** class encapsulating the css::sdb::DataAccessDescriptor service.
64 class SAL_WARN_UNUSED SVX_DLLPUBLIC ODataAccessDescriptor final
66 std::unique_ptr<ODADescriptorImpl> m_pImpl;
68 public:
69 ODataAccessDescriptor();
70 ODataAccessDescriptor( const ODataAccessDescriptor& _rSource );
71 ODataAccessDescriptor( ODataAccessDescriptor&& _rSource );
72 ODataAccessDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _rValues );
73 ODataAccessDescriptor( const css::uno::Sequence< css::beans::PropertyValue >& _rValues );
75 // allows to construct a descriptor from an Any containing either an XPropertySet or a property value sequence
76 ODataAccessDescriptor( const css::uno::Any& _rValues );
78 ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource);
79 ODataAccessDescriptor& operator=(ODataAccessDescriptor&& _rSource);
81 ~ODataAccessDescriptor();
83 /** returns the descriptor as property value sequence
84 <p>If you call this method more than once, without writing any values between both calls, the same object
85 is returned. If you wrote values, a new object is returned.</p>
87 css::uno::Sequence< css::beans::PropertyValue > const &
88 createPropertyValueSequence();
90 /** initialized the descriptor from the property values given
91 The descriptor will clear all its current settings before
92 initializing with the new ones.
94 void initializeFrom(
95 const css::uno::Sequence< css::beans::PropertyValue >& _rValues);
97 /// checks whether or not a given property is present in the descriptor
98 bool has(DataAccessDescriptorProperty _eWhich) const;
100 /** erases the given property from the descriptor
102 void erase(DataAccessDescriptorProperty _eWhich);
104 /** empties the descriptor
106 void clear();
108 /// return the value of a given property
109 const css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich ) const;
111 /** return the (modifiable) value of a given property
112 <p>This operator is not allowed to be called if the descriptor is readonly.</p>
114 css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich );
116 /** returns either the data source name if given or the database location
118 OUString getDataSource() const;
120 /** set the data source name, if it is not file URL
121 @param _sDataSourceNameOrLocation
122 the data source name or database location
124 void setDataSource(const OUString& _sDataSourceNameOrLocation);
129 #endif // INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */