1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CHART2_SOURCE_VIEW_INC_PROPERTYMAPPER_HXX
20 #define INCLUDED_CHART2_SOURCE_VIEW_INC_PROPERTYMAPPER_HXX
22 #include <comphelper/InlineContainer.hxx>
23 #include <com/sun/star/beans/XPropertySet.hpp>
24 #include <com/sun/star/drawing/XShape.hpp>
26 #include "charttoolsdllapi.hxx"
34 typedef ::std::map
< OUString
, OUString
> tPropertyNameMap
;
35 typedef ::comphelper::MakeMap
< OUString
, OUString
> tMakePropertyNameMap
;
37 typedef ::std::map
< OUString
, ::com::sun::star::uno::Any
> tPropertyNameValueMap
;
38 typedef ::comphelper::MakeMap
< OUString
, ::com::sun::star::uno::Any
> tMakePropertyNameValueMap
;
40 typedef ::com::sun::star::uno::Sequence
< OUString
> tNameSequence
;
41 typedef ::comphelper::MakeSequence
< OUString
> tMakeNameSequence
;
43 typedef ::com::sun::star::uno::Sequence
< ::com::sun::star::uno::Any
> tAnySequence
;
44 typedef ::comphelper::MakeSequence
< ::com::sun::star::uno::Any
> tMakeAnySequence
;
47 * PropertyMapper provides easy mapping of the property names of various
48 * objects in the chart model, to the property names of the destination
49 * shape objects (those whose service names begin with
50 * com.sun.star.drawing.).
52 class OOO_DLLPUBLIC_CHARTTOOLS PropertyMapper
55 static void setMappedProperties(
56 const ::com::sun::star::uno::Reference
<
57 ::com::sun::star::beans::XPropertySet
>& xTarget
58 , const ::com::sun::star::uno::Reference
<
59 ::com::sun::star::beans::XPropertySet
>& xSource
60 , const tPropertyNameMap
& rMap
61 , tPropertyNameValueMap
* pOverwriteMap
=0 );
64 * Fetch property values from the source object and map it to the
65 * destination container. Only those properties that are explicitly set
66 * will be inserted into the destination container.
68 * @param rValueMap destination container
69 * @param rNameMap property name mapping rule
70 * @param xSourceProp source object from which the property values are
73 static void getValueMap(
74 tPropertyNameValueMap
& rValueMap
75 , const tPropertyNameMap
& rNameMap
76 , const ::com::sun::star::uno::Reference
<
77 ::com::sun::star::beans::XPropertySet
>& xSourceProp
80 static void getMultiPropertyLists(
82 , tAnySequence
& rValues
83 , const ::com::sun::star::uno::Reference
< ::com::sun::star::beans::XPropertySet
>& xProp
84 , const tPropertyNameMap
& rMap
87 static void getMultiPropertyListsFromValueMap(
89 , tAnySequence
& rValues
90 , const tPropertyNameValueMap
& rValueMap
93 static ::com::sun::star::uno::Any
*
94 getValuePointer( tAnySequence
& rPropValues
95 , const tNameSequence
& rPropNames
96 , const OUString
& rPropName
);
98 static ::com::sun::star::uno::Any
*
99 getValuePointerForLimitedSpace( tAnySequence
& rPropValues
100 , const tNameSequence
& rPropNames
101 , bool bLimitedHeight
);
103 static void setMultiProperties(
104 const tNameSequence
& rNames
105 , const tAnySequence
& rValues
106 , const ::com::sun::star::uno::Reference
<
107 ::com::sun::star::beans::XPropertySet
>& xTarget
);
109 static const tMakePropertyNameMap
& getPropertyNameMapForCharacterProperties();
110 static const tMakePropertyNameMap
& getPropertyNameMapForParagraphProperties();
111 static const tMakePropertyNameMap
& getPropertyNameMapForFillProperties();
112 static const tMakePropertyNameMap
& getPropertyNameMapForLineProperties();
113 static const tMakePropertyNameMap
& getPropertyNameMapForFillAndLineProperties();
114 static const tMakePropertyNameMap
& getPropertyNameMapForTextShapeProperties();
116 static const tMakePropertyNameMap
& getPropertyNameMapForFilledSeriesProperties();
117 static const tMakePropertyNameMap
& getPropertyNameMapForLineSeriesProperties();
118 static const tMakePropertyNameMap
& getPropertyNameMapForTextLabelProperties();
120 static void getTextLabelMultiPropertyLists(
121 const ::com::sun::star::uno::Reference
<
122 ::com::sun::star::beans::XPropertySet
>& xSourceProp
123 , tNameSequence
& rPropNames
, tAnySequence
& rPropValues
125 , sal_Int32 nLimitedSpace
=-1
126 , bool bLimitedHeight
=false );
128 /** adds line-, fill- and character properties and sets some suitable
129 defaults for auto-grow properties
131 static void getPreparedTextShapePropertyLists(
132 const ::com::sun::star::uno::Reference
<
133 ::com::sun::star::beans::XPropertySet
>& xSourceProp
134 , tNameSequence
& rPropNames
135 , tAnySequence
& rPropValues
);
141 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */