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 .
21 #include <sal/config.h>
23 #include <unordered_map>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/uno/Reference.h>
28 namespace com::sun::star::beans
{ class XPropertySet
; }
34 typedef std::unordered_map
<OUString
, OUString
> tPropertyNameMap
;
35 typedef std::unordered_map
<OUString
, css::uno::Any
> tPropertyNameValueMap
;
36 typedef css::uno::Sequence
< OUString
> tNameSequence
;
37 typedef css::uno::Sequence
< css::uno::Any
> tAnySequence
;
40 * PropertyMapper provides easy mapping of the property names of various
41 * objects in the chart model, to the property names of the destination
42 * shape objects (those whose service names begin with
43 * com.sun.star.drawing.).
48 static void setMappedProperties(
49 const css::uno::Reference
< css::beans::XPropertySet
>& xTarget
50 , const css::uno::Reference
< css::beans::XPropertySet
>& xSource
51 , const tPropertyNameMap
& rMap
);
53 static void setMappedProperties(
55 , const css::uno::Reference
< css::beans::XPropertySet
>& xSource
56 , const tPropertyNameMap
& rMap
);
59 * Fetch property values from the source object and map it to the
60 * destination container. Only those properties that are explicitly set
61 * will be inserted into the destination container.
63 * @param rValueMap destination container
64 * @param rNameMap property name mapping rule
65 * @param xSourceProp source object from which the property values are
68 static void getValueMap(
69 tPropertyNameValueMap
& rValueMap
70 , const tPropertyNameMap
& rNameMap
71 , const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
74 static void getMultiPropertyListsFromValueMap(
76 , tAnySequence
& rValues
77 , const tPropertyNameValueMap
& rValueMap
81 getValuePointer( tAnySequence
& rPropValues
82 , const tNameSequence
& rPropNames
83 , std::u16string_view rPropName
);
86 getValuePointerForLimitedSpace( tAnySequence
& rPropValues
87 , const tNameSequence
& rPropNames
88 , bool bLimitedHeight
);
90 static void setMultiProperties(
91 const tNameSequence
& rNames
92 , const tAnySequence
& rValues
93 , SvxShape
& xTarget
);
95 static const tPropertyNameMap
& getPropertyNameMapForCharacterProperties();
96 static const tPropertyNameMap
& getPropertyNameMapForParagraphProperties();
97 static const tPropertyNameMap
& getPropertyNameMapForFillProperties();
98 static const tPropertyNameMap
& getPropertyNameMapForLineProperties();
99 static const tPropertyNameMap
& getPropertyNameMapForFillAndLineProperties();
100 static const tPropertyNameMap
& getPropertyNameMapForTextShapeProperties();
102 static const tPropertyNameMap
& getPropertyNameMapForFilledSeriesProperties();
103 static const tPropertyNameMap
& getPropertyNameMapForLineSeriesProperties();
104 static const tPropertyNameMap
& getPropertyNameMapForTextLabelProperties();
106 static void getTextLabelMultiPropertyLists(
107 const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
108 , tNameSequence
& rPropNames
, tAnySequence
& rPropValues
110 , sal_Int32 nLimitedSpace
=-1
111 , bool bLimitedHeight
=false
112 , bool bSupportsLabelBorder
= true);
114 /** adds line-, fill- and character properties and sets some suitable
115 defaults for auto-grow properties
117 static void getPreparedTextShapePropertyLists(
118 const css::uno::Reference
< css::beans::XPropertySet
>& xSourceProp
119 , tNameSequence
& rPropNames
120 , tAnySequence
& rPropValues
);
125 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */