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 <sal/config.h>
26 #include <com/sun/star/uno/Sequence.h>
27 #include <com/sun/star/uno/Reference.h>
29 #include <charttoolsdllapi.hxx>
31 namespace com
{ namespace sun
{ namespace star
{ namespace beans
{ class XPropertySet
; } } } }
36 typedef std::map
< OUString
, OUString
> tPropertyNameMap
;
37 typedef std::map
< OUString
, css::uno::Any
> tPropertyNameValueMap
;
38 typedef css::uno::Sequence
< OUString
> tNameSequence
;
39 typedef css::uno::Sequence
< css::uno::Any
> tAnySequence
;
42 * PropertyMapper provides easy mapping of the property names of various
43 * objects in the chart model, to the property names of the destination
44 * shape objects (those whose service names begin with
45 * com.sun.star.drawing.).
47 class OOO_DLLPUBLIC_CHARTTOOLS PropertyMapper
50 static void setMappedProperties(
51 const css::uno::Reference
< css::beans::XPropertySet
>& xTarget
52 , const css::uno::Reference
< css::beans::XPropertySet
>& xSource
53 , const tPropertyNameMap
& rMap
54 , tPropertyNameValueMap
const * pOverwriteMap
=nullptr );
57 * Fetch property values from the source object and map it to the
58 * destination container. Only those properties that are explicitly set
59 * will be inserted into the destination container.
61 * @param rValueMap destination container
62 * @param rNameMap property name mapping rule
63 * @param xSourceProp source object from which the property values are
66 static void getValueMap(
67 tPropertyNameValueMap
& rValueMap
68 , const tPropertyNameMap
& rNameMap
69 , const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
72 static void getMultiPropertyLists(
74 , tAnySequence
& rValues
75 , const css::uno::Reference
< css::beans::XPropertySet
>& xProp
76 , const tPropertyNameMap
& rMap
79 static void getMultiPropertyListsFromValueMap(
81 , tAnySequence
& rValues
82 , const tPropertyNameValueMap
& rValueMap
86 getValuePointer( tAnySequence
& rPropValues
87 , const tNameSequence
& rPropNames
88 , const OUString
& rPropName
);
91 getValuePointerForLimitedSpace( tAnySequence
& rPropValues
92 , const tNameSequence
& rPropNames
93 , bool bLimitedHeight
);
95 static void setMultiProperties(
96 const tNameSequence
& rNames
97 , const tAnySequence
& rValues
98 , const css::uno::Reference
< css::beans::XPropertySet
>& xTarget
);
100 static const tPropertyNameMap
& getPropertyNameMapForCharacterProperties();
101 static const tPropertyNameMap
& getPropertyNameMapForParagraphProperties();
102 static const tPropertyNameMap
& getPropertyNameMapForFillProperties();
103 static const tPropertyNameMap
& getPropertyNameMapForLineProperties();
104 static const tPropertyNameMap
& getPropertyNameMapForFillAndLineProperties();
105 static const tPropertyNameMap
& getPropertyNameMapForTextShapeProperties();
107 static const tPropertyNameMap
& getPropertyNameMapForFilledSeriesProperties();
108 static const tPropertyNameMap
& getPropertyNameMapForLineSeriesProperties();
109 static const tPropertyNameMap
& getPropertyNameMapForTextLabelProperties();
111 static void getTextLabelMultiPropertyLists(
112 const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
113 , tNameSequence
& rPropNames
, tAnySequence
& rPropValues
115 , sal_Int32 nLimitedSpace
=-1
116 , bool bLimitedHeight
=false
117 , bool bSupportsLabelBorder
= true);
119 /** adds line-, fill- and character properties and sets some suitable
120 defaults for auto-grow properties
122 static void getPreparedTextShapePropertyLists(
123 const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
124 , tNameSequence
& rPropNames
125 , tAnySequence
& rPropValues
);
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */