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