Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*
3 : : * This file is part of the LibreOffice project.
4 : : *
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/.
8 : : *
9 : : * This file incorporates work covered by the following license notice:
10 : : *
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 .
18 : : */
19 : :
20 : : #ifndef DBACCESS_IMAGEPROVIDER_HXX
21 : : #define DBACCESS_IMAGEPROVIDER_HXX
22 : :
23 : : #include <vcl/image.hxx>
24 : :
25 : : #include <com/sun/star/sdbc/XConnection.hpp>
26 : : #include <com/sun/star/sdb/application/DatabaseObject.hpp>
27 : :
28 : : #include <tools/string.hxx>
29 : : #include <boost/shared_ptr.hpp>
30 : :
31 : : //........................................................................
32 : : namespace dbaui
33 : : {
34 : : //........................................................................
35 : :
36 : : // for convenience of our clients
37 : : namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject;
38 : :
39 : : //====================================================================
40 : : //= ImageProvider
41 : : //====================================================================
42 : : struct ImageProvider_Data;
43 : : /** provides images for database objects such as tables, queries, forms, reports ...
44 : :
45 : : At the moment, this class cares for small icons only, that is, icons which can be used
46 : : in a tree control. On the medium term, we should extend it with support for different-sized
47 : : icons.
48 : : */
49 : 6 : class ImageProvider
50 : : {
51 : : private:
52 : : ::boost::shared_ptr< ImageProvider_Data > m_pData;
53 : :
54 : : public:
55 : : /** creates a semi-functional ImageProvider instance
56 : :
57 : : The resulting instance is not able to provide any concrete object images,
58 : : but only default images.
59 : : */
60 : : ImageProvider();
61 : :
62 : : /** creates an ImageProvider instance
63 : :
64 : : @param _rxConnection
65 : : denotes the connection to work for. Must not be <NULL/>.
66 : : */
67 : : ImageProvider(
68 : : const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection
69 : : );
70 : :
71 : : /** returns the image to be used for a database object with the given name
72 : :
73 : : @param _nDatabaseObjectType
74 : : the type of the object. Must be one of the css.sdb.application.DatabaseObject
75 : : constants.
76 : : @param _rName
77 : : the name of the object
78 : : @param _out_rImage
79 : : the normal image to use for the object
80 : : @return
81 : : the image to be used for the object.
82 : : */
83 : : void getImages(
84 : : const String& _rName,
85 : : const sal_Int32 _nDatabaseObjectType,
86 : : Image& _out_rImage
87 : : );
88 : :
89 : : /** returns the default image to be used for a database object
90 : :
91 : : In opposite to getImages, this method does not check the concrete object
92 : : for its image, but returns a default image to be used for all objects of the given
93 : : type.
94 : :
95 : : @param _nDatabaseObjectType
96 : : the type of the object. Must be one of the css.sdb.application.DatabaseObject
97 : : constants.
98 : : @return
99 : : the image to be used for the object type.
100 : : */
101 : : Image getDefaultImage(
102 : : sal_Int32 _nDatabaseObjectType
103 : : );
104 : :
105 : : /** returns the resource ID for the default image to be used for a database object
106 : :
107 : : In opposite to getImages, this method does not check the concrete object
108 : : for its image, but returns a default image to be used for all objects of the given
109 : : type.
110 : :
111 : : @param _nDatabaseObjectType
112 : : the type of the object. Must be one of the css.sdb.application.DatabaseObject
113 : : constants.
114 : : @return
115 : : the resource ID image to be used for the object type. Must be fed into a
116 : : ModuleRes instance to actually load the image.
117 : : */
118 : : sal_uInt16 getDefaultImageResourceID(
119 : : sal_Int32 _nDatabaseObjectType
120 : : );
121 : :
122 : : /** retrieves the image to be used for folders of database objects
123 : : @param _nDatabaseObjectType
124 : : the type of the object. Must be one of the css.sdb.application.DatabaseObject
125 : : constants.
126 : : @param _rName
127 : : the name of the object
128 : : @return
129 : : the image to be used for folders of the given type
130 : : */
131 : : Image getFolderImage(
132 : : sal_Int32 _nDatabaseObjectType
133 : : );
134 : :
135 : : /** retrieves the image to be used for a database as a whole.
136 : : @return
137 : : the image to be used for folders of this type
138 : : */
139 : : Image getDatabaseImage();
140 : : };
141 : :
142 : : //........................................................................
143 : : } // namespace dbaui
144 : : //........................................................................
145 : :
146 : : #endif // DBACCESS_IMAGEPROVIDER_HXX
147 : :
148 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|