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 _REPORT_RPTUIDEF_HXX 29*cdf0e10cSrcweir #define _REPORT_RPTUIDEF_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include "dllapi.h" 32*cdf0e10cSrcweir #include <tools/solar.h> 33*cdf0e10cSrcweir #include <svx/svdobj.hxx> 34*cdf0e10cSrcweir #include <comphelper/stl_types.hxx> 35*cdf0e10cSrcweir #include <comphelper/uno3.hxx> 36*cdf0e10cSrcweir #include <svx/fmglob.hxx> 37*cdf0e10cSrcweir #include <boost/shared_ptr.hpp> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir 40*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(report,XReportComponent) 41*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(report,XReportDefinition) 42*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(style,XStyle) 43*cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(beans,XPropertySet) 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir namespace rptui 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir // not all used at the moment 48*cdf0e10cSrcweir #define RPT_LAYER_FRONT 0 49*cdf0e10cSrcweir #define RPT_LAYER_BACK 1 50*cdf0e10cSrcweir #define RPT_LAYER_HIDDEN 2 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir 53*cdf0e10cSrcweir const sal_uInt32 ReportInventor = sal_uInt32('R')*0x00000001+ 54*cdf0e10cSrcweir sal_uInt32('P')*0x00000100+ 55*cdf0e10cSrcweir sal_uInt32('T')*0x00010000+ 56*cdf0e10cSrcweir sal_uInt32('1')*0x01000000; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir #define OBJ_DLG_FIXEDTEXT ((sal_uInt16) OBJ_MAXI + 1) 60*cdf0e10cSrcweir #define OBJ_DLG_IMAGECONTROL OBJ_FM_IMAGECONTROL 61*cdf0e10cSrcweir #define OBJ_DLG_FORMATTEDFIELD ((sal_uInt16) OBJ_MAXI + 3) 62*cdf0e10cSrcweir #define OBJ_DLG_HFIXEDLINE ((sal_uInt16) OBJ_MAXI + 4) 63*cdf0e10cSrcweir #define OBJ_DLG_VFIXEDLINE ((sal_uInt16) OBJ_MAXI + 5) 64*cdf0e10cSrcweir #define OBJ_DLG_SUBREPORT ((sal_uInt16) OBJ_MAXI + 6) 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir // allows the alignment and resizing of controls 67*cdf0e10cSrcweir namespace ControlModification 68*cdf0e10cSrcweir { 69*cdf0e10cSrcweir static const ::sal_Int32 NONE = (sal_Int32)0; 70*cdf0e10cSrcweir static const ::sal_Int32 LEFT = (sal_Int32)1; 71*cdf0e10cSrcweir static const ::sal_Int32 RIGHT = (sal_Int32)2; 72*cdf0e10cSrcweir static const ::sal_Int32 TOP = (sal_Int32)3; 73*cdf0e10cSrcweir static const ::sal_Int32 BOTTOM = (sal_Int32)4; 74*cdf0e10cSrcweir static const ::sal_Int32 CENTER_HORIZONTAL = (sal_Int32)5; 75*cdf0e10cSrcweir static const ::sal_Int32 CENTER_VERTICAL = (sal_Int32)6; 76*cdf0e10cSrcweir static const ::sal_Int32 WIDTH_SMALLEST = (sal_Int32)7; 77*cdf0e10cSrcweir static const ::sal_Int32 HEIGHT_SMALLEST = (sal_Int32)8; 78*cdf0e10cSrcweir static const ::sal_Int32 WIDTH_GREATEST = (sal_Int32)9; 79*cdf0e10cSrcweir static const ::sal_Int32 HEIGHT_GREATEST = (sal_Int32)10; 80*cdf0e10cSrcweir } 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any > 83*cdf0e10cSrcweir { 84*cdf0e10cSrcweir public: 85*cdf0e10cSrcweir virtual ~AnyConverter(){} 86*cdf0e10cSrcweir virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const 87*cdf0e10cSrcweir { 88*cdf0e10cSrcweir return lhs; 89*cdf0e10cSrcweir } 90*cdf0e10cSrcweir }; 91*cdf0e10cSrcweir /** returns teh object type depending on the service name 92*cdf0e10cSrcweir @param _xComponent the report component 93*cdf0e10cSrcweir */ 94*cdf0e10cSrcweir REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent); 95*cdf0e10cSrcweir typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter; 96*cdf0e10cSrcweir DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair); 97*cdf0e10cSrcweir /** returns the property name map for the givern property id 98*cdf0e10cSrcweir @param _nObjectId the object id 99*cdf0e10cSrcweir */ 100*cdf0e10cSrcweir REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId); 101*cdf0e10cSrcweir REPORTDESIGN_DLLPUBLIC ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle> getUsedStyle(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport); 102*cdf0e10cSrcweir 103*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 104*cdf0e10cSrcweir template < typename T> T getStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName) 105*cdf0e10cSrcweir { 106*cdf0e10cSrcweir T nReturn = T(); 107*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY_THROW); 108*cdf0e10cSrcweir xProp->getPropertyValue(_sPropertyName) >>= nReturn; 109*cdf0e10cSrcweir return nReturn; 110*cdf0e10cSrcweir } 111*cdf0e10cSrcweir // ----------------------------------------------------------------------------- 112*cdf0e10cSrcweir template<typename T> void setStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName,const T& _aValue) 113*cdf0e10cSrcweir { 114*cdf0e10cSrcweir ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY); 115*cdf0e10cSrcweir if ( xProp.is() ) 116*cdf0e10cSrcweir xProp->setPropertyValue(_sPropertyName,::com::sun::star::uno::makeAny(_aValue)); 117*cdf0e10cSrcweir } 118*cdf0e10cSrcweir } 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir #endif // _REPORT_RPTUIDEF_HXX 121