Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / svx / dataaccessdescriptor.hxx
blob9449d8fbd051eea46b1fce0acfd6b9fbc332f6b7
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 <com/sun/star/beans/PropertyValue.hpp>
24 #include <com/sun/star/beans/XPropertySet.hpp>
25 #include <svx/svxdllapi.h>
26 #include <memory>
28 namespace svx
30 class ODADescriptorImpl;
32 //= DataAccessDescriptorProperty
33 enum class DataAccessDescriptorProperty
35 DataSource, /// data source name (string)
36 DatabaseLocation, /// database file URL (string)
37 ConnectionResource, /// database driver URL (string)
38 Connection, /// connection (XConnection)
40 Command, /// command (string)
41 CommandType, /// command type (long)
42 EscapeProcessing, /// escape processing (boolean)
43 Filter, /// additional filter (string)
44 Cursor, /// the cursor (XResultSet)
46 ColumnName, /// column name (string)
47 ColumnObject, /// column object (XPropertySet)
49 Selection, /// selection (sequence< any >)
50 BookmarkSelection, /// selection are bookmarks? (boolean)
52 Component /// component name (XContent)
55 //= ODataAccessDescriptor
57 /** class encapsulating the css::sdb::DataAccessDescriptor service.
59 class SAL_WARN_UNUSED SVX_DLLPUBLIC ODataAccessDescriptor
61 protected:
62 std::unique_ptr<ODADescriptorImpl> m_pImpl;
64 public:
65 ODataAccessDescriptor();
66 ODataAccessDescriptor( const ODataAccessDescriptor& _rSource );
67 ODataAccessDescriptor( ODataAccessDescriptor&& _rSource );
68 ODataAccessDescriptor( const css::uno::Reference< css::beans::XPropertySet >& _rValues );
69 ODataAccessDescriptor( const css::uno::Sequence< css::beans::PropertyValue >& _rValues );
71 // allows to construct a descriptor from an Any containing either an XPropertySet or a property value sequence
72 ODataAccessDescriptor( const css::uno::Any& _rValues );
74 ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource);
75 ODataAccessDescriptor& operator=(ODataAccessDescriptor&& _rSource);
77 ~ODataAccessDescriptor();
79 /** returns the descriptor as property value sequence
80 <p>If you call this method more than once, without writing any values between both calls, the same object
81 is returned. If you wrote values, a new object is returned.</p>
83 css::uno::Sequence< css::beans::PropertyValue >
84 createPropertyValueSequence();
86 /** initialized the descriptor from the property values given
87 The descriptor will clear all its current settings before
88 initializing with the new ones.
90 void initializeFrom(
91 const css::uno::Sequence< css::beans::PropertyValue >& _rValues);
93 /// checks whether or not a given property is present in the descriptor
94 bool has(DataAccessDescriptorProperty _eWhich) const;
96 /** erases the given property from the descriptor
98 void erase(DataAccessDescriptorProperty _eWhich);
100 /** empties the descriptor
102 void clear();
104 /// return the value of a given property
105 const css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich ) const;
107 /** return the (modifiable) value of a given property
108 <p>This operator is not allowed to be called if the descriptor is readonly.</p>
110 css::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich );
112 /** returns either the data source name if given or the database location
114 OUString getDataSource() const;
116 /** set the data source name, if it is not file URL
117 @param _sDataSourceNameOrLocation
118 the data source name or database location
120 void setDataSource(const OUString& _sDataSourceNameOrLocation);
125 #endif // INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */