merge the formfield patch from ooo-build
[ooovba.git] / reportdesign / inc / RptDef.hxx
blobce8cb8dc2a14a4572b90d424b7f5287636d746d5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: RptDef.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _REPORT_RPTUIDEF_HXX
32 #define _REPORT_RPTUIDEF_HXX
34 #include "dllapi.h"
35 #include <tools/solar.h>
36 #include <svx/svdobj.hxx>
37 #include <comphelper/stl_types.hxx>
38 #include <comphelper/uno3.hxx>
39 #include <svx/fmglob.hxx>
40 #include <boost/shared_ptr.hpp>
43 FORWARD_DECLARE_INTERFACE(report,XReportComponent)
44 FORWARD_DECLARE_INTERFACE(report,XReportDefinition)
45 FORWARD_DECLARE_INTERFACE(style,XStyle)
46 FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
48 namespace rptui
50 // not all used at the moment
51 #define RPT_LAYER_FRONT 0
52 #define RPT_LAYER_BACK 1
53 #define RPT_LAYER_HIDDEN 2
56 const UINT32 ReportInventor = UINT32('R')*0x00000001+
57 UINT32('P')*0x00000100+
58 UINT32('T')*0x00010000+
59 UINT32('1')*0x01000000;
62 #define OBJ_DLG_FIXEDTEXT ((UINT16) OBJ_MAXI + 1)
63 #define OBJ_DLG_IMAGECONTROL OBJ_FM_IMAGECONTROL
64 #define OBJ_DLG_FORMATTEDFIELD ((UINT16) OBJ_MAXI + 3)
65 #define OBJ_DLG_HFIXEDLINE ((UINT16) OBJ_MAXI + 4)
66 #define OBJ_DLG_VFIXEDLINE ((UINT16) OBJ_MAXI + 5)
67 #define OBJ_DLG_SUBREPORT ((UINT16) OBJ_MAXI + 6)
69 // allows the alignment and resizing of controls
70 namespace ControlModification
72 static const ::sal_Int32 NONE = (sal_Int32)0;
73 static const ::sal_Int32 LEFT = (sal_Int32)1;
74 static const ::sal_Int32 RIGHT = (sal_Int32)2;
75 static const ::sal_Int32 TOP = (sal_Int32)3;
76 static const ::sal_Int32 BOTTOM = (sal_Int32)4;
77 static const ::sal_Int32 CENTER_HORIZONTAL = (sal_Int32)5;
78 static const ::sal_Int32 CENTER_VERTICAL = (sal_Int32)6;
79 static const ::sal_Int32 WIDTH_SMALLEST = (sal_Int32)7;
80 static const ::sal_Int32 HEIGHT_SMALLEST = (sal_Int32)8;
81 static const ::sal_Int32 WIDTH_GREATEST = (sal_Int32)9;
82 static const ::sal_Int32 HEIGHT_GREATEST = (sal_Int32)10;
85 class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any >
87 public:
88 virtual ~AnyConverter(){}
89 virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const
91 return lhs;
94 /** returns teh object type depending on the service name
95 @param _xComponent the report component
97 REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
98 typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter;
99 DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair);
100 /** returns the property name map for the givern property id
101 @param _nObjectId the object id
103 REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId);
104 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);
106 // -----------------------------------------------------------------------------
107 template < typename T> T getStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName)
109 T nReturn = T();
110 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY_THROW);
111 xProp->getPropertyValue(_sPropertyName) >>= nReturn;
112 return nReturn;
114 // -----------------------------------------------------------------------------
115 template<typename T> void setStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName,const T& _aValue)
117 ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY);
118 if ( xProp.is() )
119 xProp->setPropertyValue(_sPropertyName,::com::sun::star::uno::makeAny(_aValue));
123 #endif // _REPORT_RPTUIDEF_HXX