1*2e2212a7SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*2e2212a7SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*2e2212a7SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*2e2212a7SAndrew Rist  * distributed with this work for additional information
6*2e2212a7SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*2e2212a7SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*2e2212a7SAndrew Rist  * "License"); you may not use this file except in compliance
9*2e2212a7SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*2e2212a7SAndrew Rist  *
11*2e2212a7SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*2e2212a7SAndrew Rist  *
13*2e2212a7SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*2e2212a7SAndrew Rist  * software distributed under the License is distributed on an
15*2e2212a7SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*2e2212a7SAndrew Rist  * KIND, either express or implied.  See the License for the
17*2e2212a7SAndrew Rist  * specific language governing permissions and limitations
18*2e2212a7SAndrew Rist  * under the License.
19*2e2212a7SAndrew Rist  *
20*2e2212a7SAndrew Rist  *************************************************************/
21*2e2212a7SAndrew Rist 
22*2e2212a7SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef DBACCESS_IMAGEPROVIDER_HXX
25cdf0e10cSrcweir #define DBACCESS_IMAGEPROVIDER_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #ifndef _SV_IMAGE_HXX
28cdf0e10cSrcweir #include <vcl/image.hxx>
29cdf0e10cSrcweir #endif
30cdf0e10cSrcweir 
31cdf0e10cSrcweir /** === begin UNO includes === **/
32cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_
33cdf0e10cSrcweir #include <com/sun/star/sdbc/XConnection.hpp>
34cdf0e10cSrcweir #endif
35cdf0e10cSrcweir #ifndef _COM_SUN_STAR_SDB_APPLICATION_DATABASEOBJECT_HPP_
36cdf0e10cSrcweir #include <com/sun/star/sdb/application/DatabaseObject.hpp>
37cdf0e10cSrcweir #endif
38cdf0e10cSrcweir /** === end UNO includes === **/
39cdf0e10cSrcweir 
40cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
41cdf0e10cSrcweir 
42cdf0e10cSrcweir //........................................................................
43cdf0e10cSrcweir namespace dbaui
44cdf0e10cSrcweir {
45cdf0e10cSrcweir //........................................................................
46cdf0e10cSrcweir 
47cdf0e10cSrcweir     // for convenience of our clients
48cdf0e10cSrcweir     namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
49cdf0e10cSrcweir 
50cdf0e10cSrcweir 	//====================================================================
51cdf0e10cSrcweir 	//= ImageProvider
52cdf0e10cSrcweir 	//====================================================================
53cdf0e10cSrcweir     struct ImageProvider_Data;
54cdf0e10cSrcweir     /** provides images for database objects such as tables, queries, forms, reports ...
55cdf0e10cSrcweir 
56cdf0e10cSrcweir         At the moment, this class cares for small icons only, that is, icons which can be used
57cdf0e10cSrcweir         in a tree control. On the medium term, we should extend it with support for different-sized
58cdf0e10cSrcweir         icons.
59cdf0e10cSrcweir     */
60cdf0e10cSrcweir 	class ImageProvider
61cdf0e10cSrcweir 	{
62cdf0e10cSrcweir     private:
63cdf0e10cSrcweir         ::boost::shared_ptr< ImageProvider_Data >   m_pData;
64cdf0e10cSrcweir 
65cdf0e10cSrcweir     public:
66cdf0e10cSrcweir         /** creates a semi-functional ImageProvider instance
67cdf0e10cSrcweir 
68cdf0e10cSrcweir             The resulting instance is not able to provide any concrete object images,
69cdf0e10cSrcweir             but only default images.
70cdf0e10cSrcweir         */
71cdf0e10cSrcweir         ImageProvider();
72cdf0e10cSrcweir 
73cdf0e10cSrcweir         /** creates an ImageProvider instance
74cdf0e10cSrcweir 
75cdf0e10cSrcweir             @param  _rxConnection
76cdf0e10cSrcweir                 denotes the connection to work for. Must not be <NULL/>.
77cdf0e10cSrcweir         */
78cdf0e10cSrcweir         ImageProvider(
79cdf0e10cSrcweir             const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
80cdf0e10cSrcweir         );
81cdf0e10cSrcweir 
82cdf0e10cSrcweir         /** returns the image to be used for a database object with the given name
83cdf0e10cSrcweir 
84cdf0e10cSrcweir             @param  _nDatabaseObjectType
85cdf0e10cSrcweir                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
86cdf0e10cSrcweir                 constants.
87cdf0e10cSrcweir             @param  _rName
88cdf0e10cSrcweir                 the name of the object
89cdf0e10cSrcweir             @param  _out_rImage
90cdf0e10cSrcweir                 the normal image to use for the object
91cdf0e10cSrcweir             @param  _out_rImageHC
92cdf0e10cSrcweir                 the high-contrast version of the image to use for the object
93cdf0e10cSrcweir             @return
94cdf0e10cSrcweir                 the image to be used for the object.
95cdf0e10cSrcweir         */
96cdf0e10cSrcweir         void getImages(
97cdf0e10cSrcweir             const String& _rName,
98cdf0e10cSrcweir             const sal_Int32 _nDatabaseObjectType,
99cdf0e10cSrcweir             Image& _out_rImage,
100cdf0e10cSrcweir             Image& _out_rImageHC
101cdf0e10cSrcweir         );
102cdf0e10cSrcweir 
103cdf0e10cSrcweir         /** returns the default image to be used for a database object
104cdf0e10cSrcweir 
105cdf0e10cSrcweir             In opposite to getImages, this method does not check the concrete object
106cdf0e10cSrcweir             for its image, but returns a default image to be used for all objects of the given
107cdf0e10cSrcweir             type.
108cdf0e10cSrcweir 
109cdf0e10cSrcweir             @param  _nDatabaseObjectType
110cdf0e10cSrcweir                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
111cdf0e10cSrcweir                 constants.
112cdf0e10cSrcweir             @param  _bHighContrast
113cdf0e10cSrcweir                 indicates whether High-Contrast icons should be used.
114cdf0e10cSrcweir                 Note that normally, this would be some application-wide setting. However,
115cdf0e10cSrcweir                 in current OOo, HC support is decided on a per-control basis, means every
116cdf0e10cSrcweir                 control decides itself whether its images must be HC versions or not.
117cdf0e10cSrcweir                 Thus callers need to specify this flag.
118cdf0e10cSrcweir             @return
119cdf0e10cSrcweir                 the image to be used for the object type.
120cdf0e10cSrcweir         */
121cdf0e10cSrcweir         Image getDefaultImage(
122cdf0e10cSrcweir             sal_Int32 _nDatabaseObjectType,
123cdf0e10cSrcweir             bool _bHighContrast
124cdf0e10cSrcweir         );
125cdf0e10cSrcweir 
126cdf0e10cSrcweir         /** returns the resource ID for the default image to be used for a database object
127cdf0e10cSrcweir 
128cdf0e10cSrcweir             In opposite to getImages, this method does not check the concrete object
129cdf0e10cSrcweir             for its image, but returns a default image to be used for all objects of the given
130cdf0e10cSrcweir             type.
131cdf0e10cSrcweir 
132cdf0e10cSrcweir             @param  _nDatabaseObjectType
133cdf0e10cSrcweir                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
134cdf0e10cSrcweir                 constants.
135cdf0e10cSrcweir             @param  _bHighContrast
136cdf0e10cSrcweir                 indicates whether High-Contrast icons should be used.
137cdf0e10cSrcweir                 Note that normally, this would be some application-wide setting. However,
138cdf0e10cSrcweir                 in current OOo, HC support is decided on a per-control basis, means every
139cdf0e10cSrcweir                 control decides itself whether its images must be HC versions or not.
140cdf0e10cSrcweir                 Thus callers need to specify this flag.
141cdf0e10cSrcweir             @return
142cdf0e10cSrcweir                 the resource ID image to be used for the object type. Must be fed into a
143cdf0e10cSrcweir                 ModuleRes instance to actually load the image.
144cdf0e10cSrcweir         */
145cdf0e10cSrcweir         sal_uInt16 getDefaultImageResourceID(
146cdf0e10cSrcweir             sal_Int32 _nDatabaseObjectType,
147cdf0e10cSrcweir             bool _bHighContrast
148cdf0e10cSrcweir         );
149cdf0e10cSrcweir 
150cdf0e10cSrcweir         /** retrieves the image to be used for folders of database objects
151cdf0e10cSrcweir             @param  _nDatabaseObjectType
152cdf0e10cSrcweir                 the type of the object. Must be one of the css.sdb.application.DatabaseObject
153cdf0e10cSrcweir                 constants.
154cdf0e10cSrcweir             @param  _rName
155cdf0e10cSrcweir                 the name of the object
156cdf0e10cSrcweir             @param  _bHighContrast
157cdf0e10cSrcweir                 indicates whether High-Contrast icons should be used.
158cdf0e10cSrcweir                 Note that normally, this would be some application-wide setting. However,
159cdf0e10cSrcweir                 in current OOo, HC support is decided on a per-control basis, means every
160cdf0e10cSrcweir                 control decides itself whether its images must be HC versions or not.
161cdf0e10cSrcweir                 Thus callers need to specify this flag.
162cdf0e10cSrcweir             @return
163cdf0e10cSrcweir                 the image to be used for folders of the given type
164cdf0e10cSrcweir         */
165cdf0e10cSrcweir         Image getFolderImage(
166cdf0e10cSrcweir             sal_Int32 _nDatabaseObjectType,
167cdf0e10cSrcweir             bool _bHighContrast
168cdf0e10cSrcweir         );
169cdf0e10cSrcweir 
170cdf0e10cSrcweir         /** retrieves the image to be used for a database as a whole.
171cdf0e10cSrcweir             @param  _bHighContrast
172cdf0e10cSrcweir                 indicates whether High-Contrast icons should be used.
173cdf0e10cSrcweir                 Note that normally, this would be some application-wide setting. However,
174cdf0e10cSrcweir                 in current OOo, HC support is decided on a per-control basis, means every
175cdf0e10cSrcweir                 control decides itself whether its images must be HC versions or not.
176cdf0e10cSrcweir                 Thus callers need to specify this flag.
177cdf0e10cSrcweir             @return
178cdf0e10cSrcweir                 the image to be used for folders of this type
179cdf0e10cSrcweir         */
180cdf0e10cSrcweir         Image getDatabaseImage( bool _bHighContrast );
181cdf0e10cSrcweir 	};
182cdf0e10cSrcweir 
183cdf0e10cSrcweir //........................................................................
184cdf0e10cSrcweir } // namespace dbaui
185cdf0e10cSrcweir //........................................................................
186cdf0e10cSrcweir 
187cdf0e10cSrcweir #endif // DBACCESS_IMAGEPROVIDER_HXX
188cdf0e10cSrcweir 
189