xref: /AOO41X/main/chart2/source/view/inc/PropertyMapper.hxx (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
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 #ifndef _CHART2_PROPERTYMAPPER_HXX
28*cdf0e10cSrcweir #define _CHART2_PROPERTYMAPPER_HXX
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir #include <comphelper/InlineContainer.hxx>
31*cdf0e10cSrcweir #include <com/sun/star/beans/XPropertySet.hpp>
32*cdf0e10cSrcweir #include <com/sun/star/drawing/XShape.hpp>
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir //.............................................................................
35*cdf0e10cSrcweir namespace chart
36*cdf0e10cSrcweir {
37*cdf0e10cSrcweir //.............................................................................
38*cdf0e10cSrcweir 
39*cdf0e10cSrcweir //-----------------------------------------------------------------------------
40*cdf0e10cSrcweir /**
41*cdf0e10cSrcweir */
42*cdf0e10cSrcweir 
43*cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, ::rtl::OUString >            tPropertyNameMap;
44*cdf0e10cSrcweir typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakePropertyNameMap;
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Any >            tPropertyNameValueMap;
47*cdf0e10cSrcweir typedef ::comphelper::MakeMap< ::rtl::OUString, ::com::sun::star::uno::Any > tMakePropertyNameValueMap;
48*cdf0e10cSrcweir 
49*cdf0e10cSrcweir typedef ::com::sun::star::uno::Sequence< rtl::OUString > tNameSequence;
50*cdf0e10cSrcweir typedef ::comphelper::MakeSequence< rtl::OUString >      tMakeNameSequence;
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir typedef ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > tAnySequence;
53*cdf0e10cSrcweir typedef ::comphelper::MakeSequence< ::com::sun::star::uno::Any >      tMakeAnySequence;
54*cdf0e10cSrcweir 
55*cdf0e10cSrcweir class PropertyMapper
56*cdf0e10cSrcweir {
57*cdf0e10cSrcweir public:
58*cdf0e10cSrcweir     static void setMappedProperties(
59*cdf0e10cSrcweir           const ::com::sun::star::uno::Reference<
60*cdf0e10cSrcweir                 ::com::sun::star::beans::XPropertySet >& xTarget
61*cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference<
62*cdf0e10cSrcweir                 ::com::sun::star::beans::XPropertySet >& xSource
63*cdf0e10cSrcweir         , const tPropertyNameMap& rMap
64*cdf0e10cSrcweir         , tPropertyNameValueMap* pOverwriteMap=0 );
65*cdf0e10cSrcweir 
66*cdf0e10cSrcweir     static void getValueMap(
67*cdf0e10cSrcweir           tPropertyNameValueMap& rValueMap
68*cdf0e10cSrcweir         , const tPropertyNameMap& rNameMap
69*cdf0e10cSrcweir         , const ::com::sun::star::uno::Reference<
70*cdf0e10cSrcweir                 ::com::sun::star::beans::XPropertySet >& xSourceProp
71*cdf0e10cSrcweir         );
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir     static void getMultiPropertyLists(
74*cdf0e10cSrcweir                   tNameSequence& rNames
75*cdf0e10cSrcweir                 , tAnySequence&  rValues
76*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xProp
77*cdf0e10cSrcweir                 , const tPropertyNameMap& rMap
78*cdf0e10cSrcweir                 );
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir     static void getMultiPropertyListsFromValueMap(
81*cdf0e10cSrcweir                   tNameSequence& rNames
82*cdf0e10cSrcweir                 , tAnySequence&  rValues
83*cdf0e10cSrcweir                 , const tPropertyNameValueMap& rValueMap
84*cdf0e10cSrcweir                 );
85*cdf0e10cSrcweir 
86*cdf0e10cSrcweir     static ::com::sun::star::uno::Any*
87*cdf0e10cSrcweir                 getValuePointer( tAnySequence& rPropValues
88*cdf0e10cSrcweir                          , const tNameSequence& rPropNames
89*cdf0e10cSrcweir                          , const rtl::OUString& rPropName );
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir     static ::com::sun::star::uno::Any*
92*cdf0e10cSrcweir                 getValuePointerForLimitedSpace( tAnySequence& rPropValues
93*cdf0e10cSrcweir                          , const tNameSequence& rPropNames
94*cdf0e10cSrcweir                          , bool bLimitedHeight );
95*cdf0e10cSrcweir 
96*cdf0e10cSrcweir     static void setMultiProperties(
97*cdf0e10cSrcweir                   const tNameSequence& rNames
98*cdf0e10cSrcweir                 , const tAnySequence&  rValues
99*cdf0e10cSrcweir                 , const ::com::sun::star::uno::Reference<
100*cdf0e10cSrcweir                     ::com::sun::star::beans::XPropertySet >& xTarget );
101*cdf0e10cSrcweir 
102*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForCharacterProperties();
103*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForParagraphProperties();
104*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForFillProperties();
105*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForLineProperties();
106*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForFillAndLineProperties();
107*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForTextShapeProperties();
108*cdf0e10cSrcweir 
109*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForFilledSeriesProperties();
110*cdf0e10cSrcweir     static const tMakePropertyNameMap& getPropertyNameMapForLineSeriesProperties();
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir     static void getTextLabelMultiPropertyLists(
113*cdf0e10cSrcweir                 const ::com::sun::star::uno::Reference<
114*cdf0e10cSrcweir                       ::com::sun::star::beans::XPropertySet >& xSourceProp
115*cdf0e10cSrcweir                 , tNameSequence& rPropNames, tAnySequence& rPropValues
116*cdf0e10cSrcweir                 , bool bName=true
117*cdf0e10cSrcweir                 , sal_Int32 nLimitedSpace=-1
118*cdf0e10cSrcweir                 , bool bLimitedHeight=false );
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir     /** adds line-, fill- and character properties and sets some suitable
121*cdf0e10cSrcweir         defaults for auto-grow properties
122*cdf0e10cSrcweir      */
123*cdf0e10cSrcweir     static void getPreparedTextShapePropertyLists(
124*cdf0e10cSrcweir         const ::com::sun::star::uno::Reference<
125*cdf0e10cSrcweir               ::com::sun::star::beans::XPropertySet >& xSourceProp
126*cdf0e10cSrcweir         , tNameSequence& rPropNames
127*cdf0e10cSrcweir         , tAnySequence& rPropValues );
128*cdf0e10cSrcweir };
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir //.............................................................................
131*cdf0e10cSrcweir } //namespace chart
132*cdf0e10cSrcweir //.............................................................................
133*cdf0e10cSrcweir #endif
134