bump product version to 4.2.0.1
[LibreOffice.git] / include / svx / dataaccessdescriptor.hxx
blob4fb5b0cdd49f0cbfb43cfabaa19c260c6d442985
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>
27 //........................................................................
28 namespace svx
30 //........................................................................
32 class ODADescriptorImpl;
34 //====================================================================
35 //= DataAccessDescriptorProperty
36 //====================================================================
37 enum DataAccessDescriptorProperty
39 daDataSource, /// data source name (string)
40 daDatabaseLocation, /// database file URL (string)
41 daConnectionResource, /// database driver URL (string)
42 daConnection, /// connection (XConnection)
44 daCommand, /// command (string)
45 daCommandType, /// command type (long)
46 daEscapeProcessing, /// escape processing (boolean)
47 daFilter, /// additional filter (string)
48 daCursor, /// the cursor (XResultSet)
50 daColumnName, /// column name (string)
51 daColumnObject, /// column object (XPropertySet)
53 daSelection, /// selection (sequence< any >)
54 daBookmarkSelection, /// selection are bookmarks? (boolean)
56 daComponent /// component name (XContent)
59 //====================================================================
60 //= ODataAccessDescriptor
61 //====================================================================
62 /** class encapsulating the com::sun::star::sdb::DataAccessDescriptor service.
64 class SVX_DLLPUBLIC ODataAccessDescriptor
66 protected:
67 ODADescriptorImpl* m_pImpl;
69 public:
70 ODataAccessDescriptor();
71 ODataAccessDescriptor( const ODataAccessDescriptor& _rSource );
72 ODataAccessDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& _rValues );
73 ODataAccessDescriptor( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues );
75 // allows to construct a descriptor from an Any containing either an XPropertySet or a property value sequence
76 ODataAccessDescriptor( const ::com::sun::star::uno::Any& _rValues );
78 const ODataAccessDescriptor& operator=(const ODataAccessDescriptor& _rSource);
80 ~ODataAccessDescriptor();
82 /** returns the descriptor as property value sequence
83 <p>If you call this method more than once, without writing any values between both calls, the same object
84 is returned. If you wrote values, a new object is returned.</p>
86 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >
87 createPropertyValueSequence();
89 /** initialized the descriptor from the property values given
90 <p>If <arg>_bClear</arg> is <TRUE/>, the descriptor will clear all it's current settings before
91 initializing with the new ones.</p>
93 void initializeFrom(
94 const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& _rValues,
95 sal_Bool _bClear = sal_True);
97 /// checks whether or not a given property is present in the descriptor
98 sal_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 ::com::sun::star::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 ::com::sun::star::uno::Any& operator [] ( DataAccessDescriptorProperty _eWhich );
117 /** returns either the data source name if given or the database location
119 OUString getDataSource() const;
122 /** set the data source name, if it is not file URL
123 @param _sDataSourceNameOrLocation
124 the data source name or database location
126 void setDataSource(const OUString& _sDataSourceNameOrLocation);
129 //........................................................................
130 } // namespace svx
131 //........................................................................
133 #endif // INCLUDED_SVX_DATAACCESSDESCRIPTOR_HXX
136 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */