Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #ifndef _REPORT_RPTUIDEF_HXX
30 : : #define _REPORT_RPTUIDEF_HXX
31 : :
32 : : #include "dllapi.h"
33 : : #include <tools/solar.h>
34 : : #include <svx/svdobj.hxx>
35 : : #include <comphelper/stl_types.hxx>
36 : : #include <comphelper/uno3.hxx>
37 : : #include <svx/fmglob.hxx>
38 : : #include <boost/shared_ptr.hpp>
39 : :
40 : : namespace com { namespace sun { namespace star {
41 : : namespace report {
42 : : class XReportComponent;
43 : : class XReportDefinition;
44 : : }
45 : : namespace style {
46 : : class XStyle;
47 : : }
48 : : namespace beans {
49 : : class XPropertySet;
50 : : }
51 : : }}}
52 : :
53 : : namespace rptui
54 : : {
55 : : // not all used at the moment
56 : : #define RPT_LAYER_FRONT 0
57 : : #define RPT_LAYER_BACK 1
58 : : #define RPT_LAYER_HIDDEN 2
59 : :
60 : :
61 : : const sal_uInt32 ReportInventor = sal_uInt32('R')*0x00000001+
62 : : sal_uInt32('P')*0x00000100+
63 : : sal_uInt32('T')*0x00010000+
64 : : sal_uInt32('1')*0x01000000;
65 : :
66 : :
67 : : #define OBJ_DLG_FIXEDTEXT ((sal_uInt16) OBJ_MAXI + 1)
68 : : #define OBJ_DLG_IMAGECONTROL OBJ_FM_IMAGECONTROL
69 : : #define OBJ_DLG_FORMATTEDFIELD ((sal_uInt16) OBJ_MAXI + 3)
70 : : #define OBJ_DLG_HFIXEDLINE ((sal_uInt16) OBJ_MAXI + 4)
71 : : #define OBJ_DLG_VFIXEDLINE ((sal_uInt16) OBJ_MAXI + 5)
72 : : #define OBJ_DLG_SUBREPORT ((sal_uInt16) OBJ_MAXI + 6)
73 : :
74 : : // allows the alignment and resizing of controls
75 : : namespace ControlModification
76 : : {
77 : : static const ::sal_Int32 NONE = (sal_Int32)0;
78 : : static const ::sal_Int32 LEFT = (sal_Int32)1;
79 : : static const ::sal_Int32 RIGHT = (sal_Int32)2;
80 : : static const ::sal_Int32 TOP = (sal_Int32)3;
81 : : static const ::sal_Int32 BOTTOM = (sal_Int32)4;
82 : : static const ::sal_Int32 CENTER_HORIZONTAL = (sal_Int32)5;
83 : : static const ::sal_Int32 CENTER_VERTICAL = (sal_Int32)6;
84 : : static const ::sal_Int32 WIDTH_SMALLEST = (sal_Int32)7;
85 : : static const ::sal_Int32 HEIGHT_SMALLEST = (sal_Int32)8;
86 : : static const ::sal_Int32 WIDTH_GREATEST = (sal_Int32)9;
87 : : static const ::sal_Int32 HEIGHT_GREATEST = (sal_Int32)10;
88 : : }
89 : :
90 : 0 : class AnyConverter : public ::std::binary_function< ::rtl::OUString,::com::sun::star::uno::Any,::com::sun::star::uno::Any >
91 : : {
92 : : public:
93 [ # # ]: 0 : virtual ~AnyConverter(){}
94 : 0 : virtual ::com::sun::star::uno::Any operator() (const ::rtl::OUString& /*_sPropertyName*/,const ::com::sun::star::uno::Any& lhs) const
95 : : {
96 : 0 : return lhs;
97 : : }
98 : : };
99 : : /** returns teh object type depending on the service name
100 : : @param _xComponent the report component
101 : : */
102 : : REPORTDESIGN_DLLPUBLIC sal_uInt16 getObjectType(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent>& _xComponent);
103 : : typedef ::std::pair< ::rtl::OUString, ::boost::shared_ptr<AnyConverter> > TPropertyConverter;
104 : : DECLARE_STL_USTRINGACCESS_MAP(TPropertyConverter , TPropertyNamePair);
105 : : /** returns the property name map for the givern property id
106 : : @param _nObjectId the object id
107 : : */
108 : : REPORTDESIGN_DLLPUBLIC const TPropertyNamePair& getPropertyNameMap(sal_uInt16 _nObjectId);
109 : : 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);
110 : :
111 : : // -----------------------------------------------------------------------------
112 : 0 : template < typename T> T getStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName)
113 : : {
114 : 0 : T nReturn = T();
115 [ # # ][ # # ]: 0 : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY_THROW);
[ # # ][ # # ]
116 [ # # ][ # # ]: 0 : xProp->getPropertyValue(_sPropertyName) >>= nReturn;
[ # # ][ # # ]
[ # # ]
117 : 0 : return nReturn;
118 : : }
119 : : // -----------------------------------------------------------------------------
120 : : template<typename T> void setStyleProperty(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportDefinition>& _xReport,const ::rtl::OUString& _sPropertyName,const T& _aValue)
121 : : {
122 : : ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet> xProp(getUsedStyle(_xReport),::com::sun::star::uno::UNO_QUERY);
123 : : if ( xProp.is() )
124 : : xProp->setPropertyValue(_sPropertyName,::com::sun::star::uno::makeAny(_aValue));
125 : : }
126 : : }
127 : :
128 : : #endif // _REPORT_RPTUIDEF_HXX
129 : :
130 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|