Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / dbaccess / source / ui / inc / imageprovider.hxx
blob0d779f01aa959e115e1ecf2ace16625e0ec48d02
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_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
21 #define INCLUDED_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
23 #include <vcl/image.hxx>
25 #include <com/sun/star/sdbc/XConnection.hpp>
26 #include <com/sun/star/sdb/application/DatabaseObject.hpp>
28 #include <memory>
30 namespace dbaui
32 // ImageProvider
33 struct ImageProvider_Data;
34 /** provides images for database objects such as tables, queries, forms, reports ...
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.
40 class ImageProvider
42 private:
43 std::shared_ptr< ImageProvider_Data > m_pData;
45 public:
46 /** creates a semi-functional ImageProvider instance
48 The resulting instance is not able to provide any concrete object images,
49 but only default images.
51 ImageProvider();
53 /** creates an ImageProvider instance
55 @param _rxConnection
56 denotes the connection to work for. Must not be <NULL/>.
58 ImageProvider(
59 const css::uno::Reference< css::sdbc::XConnection >& _rxConnection
62 /** returns the image to be used for a database object with the given name
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.
74 void getImages(
75 const OUString& _rName,
76 const sal_Int32 _nDatabaseObjectType,
77 Image& _out_rImage
80 /** returns the default image to be used for a database object
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.
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.
92 static Image getDefaultImage(
93 sal_Int32 _nDatabaseObjectType
96 /** returns the resource ID for the default image to be used for a database object
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.
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.
109 static sal_uInt16 getDefaultImageResourceID(
110 sal_Int32 _nDatabaseObjectType
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
122 static Image getFolderImage(
123 sal_Int32 _nDatabaseObjectType
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
130 static Image getDatabaseImage();
133 } // namespace dbaui
135 #endif // INCLUDED_DBACCESS_SOURCE_UI_INC_IMAGEPROVIDER_HXX
137 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */