xref: /aoo41x/main/reportdesign/inc/RptDef.hxx (revision 9ee13d13)
1*9ee13d13SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*9ee13d13SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*9ee13d13SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*9ee13d13SAndrew Rist  * distributed with this work for additional information
6*9ee13d13SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*9ee13d13SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*9ee13d13SAndrew Rist  * "License"); you may not use this file except in compliance
9*9ee13d13SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*9ee13d13SAndrew Rist  *
11*9ee13d13SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*9ee13d13SAndrew Rist  *
13*9ee13d13SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*9ee13d13SAndrew Rist  * software distributed under the License is distributed on an
15*9ee13d13SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*9ee13d13SAndrew Rist  * KIND, either express or implied.  See the License for the
17*9ee13d13SAndrew Rist  * specific language governing permissions and limitations
18*9ee13d13SAndrew Rist  * under the License.
19*9ee13d13SAndrew Rist  *
20*9ee13d13SAndrew Rist  *************************************************************/
21*9ee13d13SAndrew Rist 
22*9ee13d13SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir #ifndef _REPORT_RPTUIDEF_HXX
25cdf0e10cSrcweir #define _REPORT_RPTUIDEF_HXX
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "dllapi.h"
28cdf0e10cSrcweir #include <tools/solar.h>
29cdf0e10cSrcweir #include <svx/svdobj.hxx>
30cdf0e10cSrcweir #include <comphelper/stl_types.hxx>
31cdf0e10cSrcweir #include <comphelper/uno3.hxx>
32cdf0e10cSrcweir #include <svx/fmglob.hxx>
33cdf0e10cSrcweir #include <boost/shared_ptr.hpp>
34cdf0e10cSrcweir 
35cdf0e10cSrcweir 
36cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(report,XReportComponent)
37cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(report,XReportDefinition)
38cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(style,XStyle)
39cdf0e10cSrcweir FORWARD_DECLARE_INTERFACE(beans,XPropertySet)
40cdf0e10cSrcweir 
41cdf0e10cSrcweir namespace rptui
42cdf0e10cSrcweir {
43cdf0e10cSrcweir // not all used at the moment
44cdf0e10cSrcweir #define RPT_LAYER_FRONT		    0
45cdf0e10cSrcweir #define RPT_LAYER_BACK		    1
46cdf0e10cSrcweir #define RPT_LAYER_HIDDEN        2
47cdf0e10cSrcweir 
48cdf0e10cSrcweir 
49cdf0e10cSrcweir const sal_uInt32 ReportInventor = sal_uInt32('R')*0x00000001+
50cdf0e10cSrcweir 				           sal_uInt32('P')*0x00000100+
51cdf0e10cSrcweir 						   sal_uInt32('T')*0x00010000+
52cdf0e10cSrcweir 						   sal_uInt32('1')*0x01000000;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 
55cdf0e10cSrcweir #define OBJ_DLG_FIXEDTEXT       ((sal_uInt16) OBJ_MAXI + 1)
56cdf0e10cSrcweir #define OBJ_DLG_IMAGECONTROL    OBJ_FM_IMAGECONTROL
57cdf0e10cSrcweir #define OBJ_DLG_FORMATTEDFIELD  ((sal_uInt16) OBJ_MAXI + 3)
58cdf0e10cSrcweir #define OBJ_DLG_HFIXEDLINE      ((sal_uInt16) OBJ_MAXI + 4)
59cdf0e10cSrcweir #define OBJ_DLG_VFIXEDLINE      ((sal_uInt16) OBJ_MAXI + 5)
60cdf0e10cSrcweir #define OBJ_DLG_SUBREPORT       ((sal_uInt16) OBJ_MAXI + 6)
61cdf0e10cSrcweir 
62cdf0e10cSrcweir // allows the alignment and resizing of controls
63cdf0e10cSrcweir namespace ControlModification
64cdf0e10cSrcweir {
65cdf0e10cSrcweir     static const ::sal_Int32 NONE               = (sal_Int32)0;
66cdf0e10cSrcweir     static const ::sal_Int32 LEFT               = (sal_Int32)1;
67cdf0e10cSrcweir     static const ::sal_Int32 RIGHT              = (sal_Int32)2;
68cdf0e10cSrcweir     static const ::sal_Int32 TOP                = (sal_Int32)3;
69cdf0e10cSrcweir     static const ::sal_Int32 BOTTOM             = (sal_Int32)4;
70cdf0e10cSrcweir     static const ::sal_Int32 CENTER_HORIZONTAL  = (sal_Int32)5;
71cdf0e10cSrcweir     static const ::sal_Int32 CENTER_VERTICAL    = (sal_Int32)6;
72cdf0e10cSrcweir     static const ::sal_Int32 WIDTH_SMALLEST     = (sal_Int32)7;
73cdf0e10cSrcweir     static const ::sal_Int32 HEIGHT_SMALLEST    = (sal_Int32)8;
74cdf0e10cSrcweir     static const ::sal_Int32 WIDTH_GREATEST     = (sal_Int32)9;
75cdf0e10cSrcweir     static const ::sal_Int32 HEIGHT_GREATEST    = (sal_Int32)10;
76cdf0e10cSrcweir }
77cdf0e10cSrcweir 
78cdf0e10cSrcweir class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any >
79cdf0e10cSrcweir {
80cdf0e10cSrcweir public:
~AnyConverter()81cdf0e10cSrcweir     virtual ~AnyConverter(){}
operator ()(const::rtl::OUString &,const::com::sun::star::uno::Any & lhs) const82cdf0e10cSrcweir     virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const
83cdf0e10cSrcweir 	{
84cdf0e10cSrcweir 		return lhs;
85cdf0e10cSrcweir 	}
86cdf0e10cSrcweir };
87cdf0e10cSrcweir /** returns teh object type depending on the service name
88cdf0e10cSrcweir 	@param	_xComponent the report component
89cdf0e10cSrcweir */
90cdf0e10cSrcweir REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
91cdf0e10cSrcweir typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter;
92cdf0e10cSrcweir DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair);
93cdf0e10cSrcweir /** returns the property name map for the givern property id
94cdf0e10cSrcweir 	@param	_nObjectId	the object id
95cdf0e10cSrcweir */
96cdf0e10cSrcweir REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId);
97cdf0e10cSrcweir 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);
98cdf0e10cSrcweir 
99cdf0e10cSrcweir // -----------------------------------------------------------------------------
getStyleProperty(const::com::sun::star::uno::Reference<::com::sun::star::report::XReportDefinition> & _xReport,const::rtl::OUString & _sPropertyName)100cdf0e10cSrcweir template < typename T> T getStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName)
101cdf0e10cSrcweir {
102cdf0e10cSrcweir     T nReturn = T();
103cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY_THROW);
104cdf0e10cSrcweir     xProp->getPropertyValue(_sPropertyName) >>= nReturn;
105cdf0e10cSrcweir     return nReturn;
106cdf0e10cSrcweir }
107cdf0e10cSrcweir // -----------------------------------------------------------------------------
setStyleProperty(const::com::sun::star::uno::Reference<::com::sun::star::report::XReportDefinition> & _xReport,const::rtl::OUString & _sPropertyName,const T & _aValue)108cdf0e10cSrcweir template<typename T> void setStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName,const T& _aValue)
109cdf0e10cSrcweir {
110cdf0e10cSrcweir     ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY);
111cdf0e10cSrcweir     if ( xProp.is() )
112cdf0e10cSrcweir         xProp->setPropertyValue(_sPropertyName,::com::sun::star::uno::makeAny(_aValue));
113cdf0e10cSrcweir }
114cdf0e10cSrcweir }
115cdf0e10cSrcweir 
116cdf0e10cSrcweir #endif // _REPORT_RPTUIDEF_HXX
117