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