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