1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef DBACCESS_IMAGEPROVIDER_HXX 29 #define DBACCESS_IMAGEPROVIDER_HXX 30 31 #ifndef _SV_IMAGE_HXX 32 #include <vcl/image.hxx> 33 #endif 34 35 /** === begin UNO includes === **/ 36 #ifndef _COM_SUN_STAR_SDBC_XCONNECTION_HPP_ 37 #include <com/sun/star/sdbc/XConnection.hpp> 38 #endif 39 #ifndef _COM_SUN_STAR_SDB_APPLICATION_DATABASEOBJECT_HPP_ 40 #include <com/sun/star/sdb/application/DatabaseObject.hpp> 41 #endif 42 /** === end UNO includes === **/ 43 44 #include <boost/shared_ptr.hpp> 45 46 //........................................................................ 47 namespace dbaui 48 { 49 //........................................................................ 50 51 // for convenience of our clients 52 namespace DatabaseObject = ::com::sun::star::sdb::application::DatabaseObject; 53 54 //==================================================================== 55 //= ImageProvider 56 //==================================================================== 57 struct ImageProvider_Data; 58 /** provides images for database objects such as tables, queries, forms, reports ... 59 60 At the moment, this class cares for small icons only, that is, icons which can be used 61 in a tree control. On the medium term, we should extend it with support for different-sized 62 icons. 63 */ 64 class ImageProvider 65 { 66 private: 67 ::boost::shared_ptr< ImageProvider_Data > m_pData; 68 69 public: 70 /** creates a semi-functional ImageProvider instance 71 72 The resulting instance is not able to provide any concrete object images, 73 but only default images. 74 */ 75 ImageProvider(); 76 77 /** creates an ImageProvider instance 78 79 @param _rxConnection 80 denotes the connection to work for. Must not be <NULL/>. 81 */ 82 ImageProvider( 83 const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XConnection >& _rxConnection 84 ); 85 86 /** returns the image to be used for a database object with the given name 87 88 @param _nDatabaseObjectType 89 the type of the object. Must be one of the css.sdb.application.DatabaseObject 90 constants. 91 @param _rName 92 the name of the object 93 @param _out_rImage 94 the normal image to use for the object 95 @param _out_rImageHC 96 the high-contrast version of the image to use for the object 97 @return 98 the image to be used for the object. 99 */ 100 void getImages( 101 const String& _rName, 102 const sal_Int32 _nDatabaseObjectType, 103 Image& _out_rImage, 104 Image& _out_rImageHC 105 ); 106 107 /** returns the default image to be used for a database object 108 109 In opposite to getImages, this method does not check the concrete object 110 for its image, but returns a default image to be used for all objects of the given 111 type. 112 113 @param _nDatabaseObjectType 114 the type of the object. Must be one of the css.sdb.application.DatabaseObject 115 constants. 116 @param _bHighContrast 117 indicates whether High-Contrast icons should be used. 118 Note that normally, this would be some application-wide setting. However, 119 in current OOo, HC support is decided on a per-control basis, means every 120 control decides itself whether its images must be HC versions or not. 121 Thus callers need to specify this flag. 122 @return 123 the image to be used for the object type. 124 */ 125 Image getDefaultImage( 126 sal_Int32 _nDatabaseObjectType, 127 bool _bHighContrast 128 ); 129 130 /** returns the resource ID for the default image to be used for a database object 131 132 In opposite to getImages, this method does not check the concrete object 133 for its image, but returns a default image to be used for all objects of the given 134 type. 135 136 @param _nDatabaseObjectType 137 the type of the object. Must be one of the css.sdb.application.DatabaseObject 138 constants. 139 @param _bHighContrast 140 indicates whether High-Contrast icons should be used. 141 Note that normally, this would be some application-wide setting. However, 142 in current OOo, HC support is decided on a per-control basis, means every 143 control decides itself whether its images must be HC versions or not. 144 Thus callers need to specify this flag. 145 @return 146 the resource ID image to be used for the object type. Must be fed into a 147 ModuleRes instance to actually load the image. 148 */ 149 sal_uInt16 getDefaultImageResourceID( 150 sal_Int32 _nDatabaseObjectType, 151 bool _bHighContrast 152 ); 153 154 /** retrieves the image to be used for folders of database objects 155 @param _nDatabaseObjectType 156 the type of the object. Must be one of the css.sdb.application.DatabaseObject 157 constants. 158 @param _rName 159 the name of the object 160 @param _bHighContrast 161 indicates whether High-Contrast icons should be used. 162 Note that normally, this would be some application-wide setting. However, 163 in current OOo, HC support is decided on a per-control basis, means every 164 control decides itself whether its images must be HC versions or not. 165 Thus callers need to specify this flag. 166 @return 167 the image to be used for folders of the given type 168 */ 169 Image getFolderImage( 170 sal_Int32 _nDatabaseObjectType, 171 bool _bHighContrast 172 ); 173 174 /** retrieves the image to be used for a database as a whole. 175 @param _bHighContrast 176 indicates whether High-Contrast icons should be used. 177 Note that normally, this would be some application-wide setting. However, 178 in current OOo, HC support is decided on a per-control basis, means every 179 control decides itself whether its images must be HC versions or not. 180 Thus callers need to specify this flag. 181 @return 182 the image to be used for folders of this type 183 */ 184 Image getDatabaseImage( bool _bHighContrast ); 185 }; 186 187 //........................................................................ 188 } // namespace dbaui 189 //........................................................................ 190 191 #endif // DBACCESS_IMAGEPROVIDER_HXX 192 193