21#include <unonames.hxx>
23#include <com/sun/star/beans/XMultiPropertySet.hpp>
24#include <com/sun/star/beans/XPropertySet.hpp>
25#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
26#include <com/sun/star/drawing/TextHorizontalAdjust.hpp>
27#include <com/sun/star/drawing/LineJoint.hpp>
28#include <com/sun/star/style/ParagraphAdjust.hpp>
38 ,
const uno::Reference< beans::XPropertySet >& xSource
44 sal_Int32 nPropertyCount = rMap.size();
47 auto pNames = aNames.getArray();
48 auto pValues = aValues.getArray();
51 for (
auto const& elem : rMap)
53 const OUString &
rTarget = elem.first;
54 const OUString & rSource = elem.second;
57 uno::Any aAny( xSource->getPropertyValue(rSource) );
66 catch(
const uno::Exception& )
77 uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY_THROW );
80 xShapeMultiProp->setPropertyValues( aNames, aValues );
82 catch(
const uno::Exception& )
89 const uno::Reference< beans::XPropertySet >& xTarget
90 ,
const uno::Reference< beans::XPropertySet >& xSource
93 if( !
xTarget.is() || !xSource.is() )
99 sal_Int32 nPropertyCount = rMap.size();
100 aNames.realloc(nPropertyCount);
101 auto pNames = aNames.getArray();
102 aValues.realloc(nPropertyCount);
103 auto pValues = aValues.getArray();
105 for (
auto const& elem : rMap)
107 const OUString &
rTarget = elem.first;
108 const OUString & rSource = elem.second;
111 uno::Any aAny( xSource->getPropertyValue(rSource) );
112 if( aAny.hasValue() )
120 catch(
const uno::Exception& )
128 uno::Reference< beans::XMultiPropertySet > xShapeMultiProp( xTarget, uno::UNO_QUERY );
135 xShapeMultiProp->setPropertyValues( aNames, aValues );
138 catch(
const uno::Exception& )
146 for( sal_Int32 i = 0;
i < nN;
i++ )
150 xTarget->setPropertyValue( aNames[i], aValues[i] );
152 catch(
const uno::Exception& )
158 catch(
const uno::Exception& )
171 if((
false) && xMultiPropSet.is())
174 auto aPropSourceNamesRange = asNonConstRange(aPropSourceNames);
176 auto aPropTargetNamesRange = asNonConstRange(aPropTargetNames);
178 for (
auto const& elem : rNameMap)
180 aPropTargetNamesRange[
i] = elem.first;
181 aPropSourceNamesRange[
i] = elem.second;
186 sal_Int32
n = rNameMap.size();
187 for(
i = 0;
i <
n; ++
i)
189 if( xValues[
i].hasValue() )
190 rValueMap.emplace( aPropTargetNames[
i], xValues[
i] );
195 for (
auto const& elem : rNameMap)
197 const OUString &
rTarget = elem.first;
198 const OUString & rSource = elem.second;
201 uno::Any aAny( xSourceProp->getPropertyValue(rSource) );
203 rValueMap.emplace(
rTarget, aAny );
205 catch(
const uno::Exception& )
219 sal_Int32 nPropertyCount = rValueMap.size();
220 rNames.realloc(nPropertyCount);
221 auto pNames = rNames.getArray();
222 rValues.realloc(nPropertyCount);
223 auto pValues = rValues.getArray();
227 for (
auto const& elem : rValueMap)
233 pNames[nN] = elem.first;
245 , std::u16string_view rPropName )
247 sal_Int32
nCount = rPropNames.getLength();
248 for( sal_Int32 nN = 0; nN <
nCount; nN++ )
250 if(rPropNames[nN] == rPropName)
251 return &rPropValues.getArray()[nN];
258 ,
bool bLimitedHeight)
261 , bLimitedHeight ? OUString(
"TextMaximumFrameHeight") : OUString(
"TextMaximumFrameWidth") );
268 {
"CharColor",
"CharColor"},
269 {
"CharContoured",
"CharContoured"},
270 {
"CharEmphasis",
"CharEmphasis"},
272 {
"CharFontFamily",
"CharFontFamily"},
273 {
"CharFontFamilyAsian",
"CharFontFamilyAsian"},
274 {
"CharFontFamilyComplex",
"CharFontFamilyComplex"},
275 {
"CharFontCharSet",
"CharFontCharSet"},
276 {
"CharFontCharSetAsian",
"CharFontCharSetAsian"},
277 {
"CharFontCharSetComplex",
"CharFontCharSetComplex"},
278 {
"CharFontName",
"CharFontName"},
279 {
"CharFontNameAsian",
"CharFontNameAsian"},
280 {
"CharFontNameComplex",
"CharFontNameComplex"},
281 {
"CharFontPitch",
"CharFontPitch"},
282 {
"CharFontPitchAsian",
"CharFontPitchAsian"},
283 {
"CharFontPitchComplex",
"CharFontPitchComplex"},
284 {
"CharFontStyleName",
"CharFontStyleName"},
285 {
"CharFontStyleNameAsian",
"CharFontStyleNameAsian"},
286 {
"CharFontStyleNameComplex",
"CharFontStyleNameComplex"},
288 {
"CharHeight",
"CharHeight"},
289 {
"CharHeightAsian",
"CharHeightAsian"},
290 {
"CharHeightComplex",
"CharHeightComplex"},
291 {
"CharKerning",
"CharKerning"},
292 {
"CharLocale",
"CharLocale"},
293 {
"CharLocaleAsian",
"CharLocaleAsian"},
294 {
"CharLocaleComplex",
"CharLocaleComplex"},
295 {
"CharPosture",
"CharPosture"},
296 {
"CharPostureAsian",
"CharPostureAsian"},
297 {
"CharPostureComplex",
"CharPostureComplex"},
298 {
"CharRelief",
"CharRelief"},
299 {
"CharShadowed",
"CharShadowed"},
300 {
"CharStrikeout",
"CharStrikeout"},
301 {
"CharUnderline",
"CharUnderline"},
302 {
"CharUnderlineColor",
"CharUnderlineColor"},
303 {
"CharUnderlineHasColor",
"CharUnderlineHasColor"},
304 {
"CharOverline",
"CharOverline"},
305 {
"CharOverlineColor",
"CharOverlineColor"},
306 {
"CharOverlineHasColor",
"CharOverlineHasColor"},
307 {
"CharWeight",
"CharWeight"},
308 {
"CharWeightAsian",
"CharWeightAsian"},
309 {
"CharWeightComplex",
"CharWeightComplex"},
310 {
"CharWordMode",
"CharWordMode"},
312 {
"WritingMode",
"WritingMode"},
314 {
"ParaIsCharacterDistance",
"ParaIsCharacterDistance"}};
316 return s_aShapePropertyMapForCharacterProperties;
323 {
"ParaAdjust",
"ParaAdjust"},
324 {
"ParaBottomMargin",
"ParaBottomMargin"},
325 {
"ParaIsHyphenation",
"ParaIsHyphenation"},
326 {
"ParaLastLineAdjust",
"ParaLastLineAdjust"},
327 {
"ParaLeftMargin",
"ParaLeftMargin"},
328 {
"ParaRightMargin",
"ParaRightMargin"},
329 {
"ParaTopMargin",
"ParaTopMargin"}};
330 return s_aShapePropertyMapForParagraphProperties;
337 {
"FillBackground",
"FillBackground"},
338 {
"FillBitmapName",
"FillBitmapName"},
339 {
"FillColor",
"FillColor"},
340 {
"FillGradientName",
"FillGradientName"},
341 {
"FillGradientStepCount",
"FillGradientStepCount"},
342 {
"FillHatchName",
"FillHatchName"},
343 {
"FillStyle",
"FillStyle"},
344 {
"FillTransparence",
"FillTransparence"},
345 {
"FillTransparenceGradientName",
"FillTransparenceGradientName"},
347 {
"FillBitmapMode",
"FillBitmapMode"},
348 {
"FillBitmapSizeX",
"FillBitmapSizeX"},
349 {
"FillBitmapSizeY",
"FillBitmapSizeY"},
350 {
"FillBitmapLogicalSize",
"FillBitmapLogicalSize"},
351 {
"FillBitmapOffsetX",
"FillBitmapOffsetX"},
352 {
"FillBitmapOffsetY",
"FillBitmapOffsetY"},
353 {
"FillBitmapRectanglePoint",
"FillBitmapRectanglePoint"},
354 {
"FillBitmapPositionOffsetX",
"FillBitmapPositionOffsetX"},
355 {
"FillBitmapPositionOffsetY",
"FillBitmapPositionOffsetY"}};
356 return s_aShapePropertyMapForFillProperties;
363 {
"LineColor",
"LineColor"},
364 {
"LineDashName",
"LineDashName"},
365 {
"LineJoint",
"LineJoint"},
366 {
"LineStyle",
"LineStyle"},
367 {
"LineTransparence",
"LineTransparence"},
368 {
"LineWidth",
"LineWidth"},
369 {
"LineCap",
"LineCap"}};
370 return s_aShapePropertyMapForLineProperties;
378 map.insert(add.begin(), add.end());
385 = getPropertyNameMapForFillAndLineProperties_();
386 return s_aShapePropertyMapForFillAndLineProperties;
394 map.insert(add1.begin(), add1.end());
397 map.insert(add2.begin(), add2.end());
404 = getPropertyNameMapForTextShapeProperties_();
405 return s_aShapePropertyMapForTextShapeProperties;
412 {
"LineColor",
"Color"},
413 {
"LineDashName",
"LineDashName"},
414 {
"LineStyle",
"LineStyle"},
415 {
"LineTransparence",
"Transparency"},
416 {
"LineWidth",
"LineWidth"},
417 {
"LineCap",
"LineCap"}};
418 return s_aShapePropertyMapForLineSeriesProperties;
449 {
"FillBackground",
"FillBackground"},
450 {
"FillBitmapName",
"FillBitmapName"},
451 {
"FillColor",
"Color"},
452 {
"FillGradientName",
"GradientName"},
453 {
"FillGradientStepCount",
"GradientStepCount"},
454 {
"FillHatchName",
"HatchName"},
455 {
"FillStyle",
"FillStyle"},
456 {
"FillTransparence",
"Transparency"},
457 {
"FillTransparenceGradientName",
"TransparencyGradientName"},
459 {
"FillBitmapMode",
"FillBitmapMode"},
460 {
"FillBitmapSizeX",
"FillBitmapSizeX"},
461 {
"FillBitmapSizeY",
"FillBitmapSizeY"},
462 {
"FillBitmapLogicalSize",
"FillBitmapLogicalSize"},
463 {
"FillBitmapOffsetX",
"FillBitmapOffsetX"},
464 {
"FillBitmapOffsetY",
"FillBitmapOffsetY"},
465 {
"FillBitmapRectanglePoint",
"FillBitmapRectanglePoint"},
466 {
"FillBitmapPositionOffsetX",
"FillBitmapPositionOffsetX"},
467 {
"FillBitmapPositionOffsetY",
"FillBitmapPositionOffsetY"},
469 {
"LineColor",
"BorderColor"},
470 {
"LineDashName",
"BorderDashName"},
471 {
"LineStyle",
"BorderStyle"},
472 {
"LineTransparence",
"BorderTransparency"},
473 {
"LineWidth",
"BorderWidth"},
474 {
"LineCap",
"LineCap"}};
475 return s_aShapePropertyMapForFilledSeriesProperties;
485 xTarget.setPropertyValues( rNames, rValues );
487 catch(
const uno::Exception& )
497 , sal_Int32 nLimitedSpace
498 ,
bool bLimitedHeight
499 ,
bool bSupportsLabelBorder)
508 aValueMap.emplace(
"TextHorizontalAdjust",
uno::Any(drawing::TextHorizontalAdjust_CENTER) );
509 aValueMap.emplace(
"TextVerticalAdjust",
uno::Any(drawing::TextVerticalAdjust_CENTER) );
510 aValueMap.emplace(
"TextAutoGrowHeight",
uno::Any(
true) );
511 aValueMap.emplace(
"TextAutoGrowWidth",
uno::Any(
true) );
512 aValueMap.emplace(
"ParaAdjust",
uno::Any(style::ParagraphAdjust_CENTER) );
514 aValueMap.emplace(
"Name",
uno::Any( OUString() ) );
516 if( nLimitedSpace > 0 )
519 aValueMap.emplace(
"TextMaximumFrameHeight",
uno::Any(nLimitedSpace) );
521 aValueMap.emplace(
"TextMaximumFrameWidth",
uno::Any(nLimitedSpace) );
522 aValueMap.emplace(
"ParaIsHyphenation",
uno::Any(
true) );
539 aValueMap.emplace(
"TextHorizontalAdjust",
uno::Any( drawing::TextHorizontalAdjust_CENTER ));
540 aValueMap.emplace(
"TextVerticalAdjust",
uno::Any( drawing::TextVerticalAdjust_CENTER ));
541 aValueMap.emplace(
"TextAutoGrowHeight",
uno::Any(
true ));
542 aValueMap.emplace(
"TextAutoGrowWidth",
uno::Any(
true ));
545 const sal_Int32 nWidthDist = 250;
546 const sal_Int32 nHeightDist = 125;
547 aValueMap.emplace(
"TextLeftDistance",
uno::Any( nWidthDist ));
548 aValueMap.emplace(
"TextRightDistance",
uno::Any( nWidthDist ));
549 aValueMap.emplace(
"TextUpperDistance",
uno::Any( nHeightDist ));
550 aValueMap.emplace(
"TextLowerDistance",
uno::Any( nHeightDist ));
554 aValueMap[
"LineJoint"] <<= drawing::LineJoint_ROUND;
const PropertyValue * pValues
static const tPropertyNameMap & getPropertyNameMapForFillAndLineProperties()
static css::uno::Any * getValuePointerForLimitedSpace(tAnySequence &rPropValues, const tNameSequence &rPropNames, bool bLimitedHeight)
static const tPropertyNameMap & getPropertyNameMapForTextShapeProperties()
static css::uno::Any * getValuePointer(tAnySequence &rPropValues, const tNameSequence &rPropNames, std::u16string_view rPropName)
static void setMultiProperties(const tNameSequence &rNames, const tAnySequence &rValues, SvxShape &xTarget)
static const tPropertyNameMap & getPropertyNameMapForLineProperties()
static const tPropertyNameMap & getPropertyNameMapForFilledSeriesProperties()
static const tPropertyNameMap & getPropertyNameMapForTextLabelProperties()
static const tPropertyNameMap & getPropertyNameMapForCharacterProperties()
static void getMultiPropertyListsFromValueMap(tNameSequence &rNames, tAnySequence &rValues, const tPropertyNameValueMap &rValueMap)
static const tPropertyNameMap & getPropertyNameMapForFillProperties()
static const tPropertyNameMap & getPropertyNameMapForLineSeriesProperties()
static void getPreparedTextShapePropertyLists(const css::uno::Reference< css::beans::XPropertySet > &xSourceProp, tNameSequence &rPropNames, tAnySequence &rPropValues)
adds line-, fill- and character properties and sets some suitable defaults for auto-grow properties
static void getTextLabelMultiPropertyLists(const css::uno::Reference< css::beans::XPropertySet > &xSourceProp, tNameSequence &rPropNames, tAnySequence &rPropValues, bool bName=true, sal_Int32 nLimitedSpace=-1, bool bLimitedHeight=false, bool bSupportsLabelBorder=true)
static void getValueMap(tPropertyNameValueMap &rValueMap, const tPropertyNameMap &rNameMap, const css::uno::Reference< css::beans::XPropertySet > &xSourceProp)
Fetch property values from the source object and map it to the destination container.
static const tPropertyNameMap & getPropertyNameMapForParagraphProperties()
static void setMappedProperties(const css::uno::Reference< css::beans::XPropertySet > &xTarget, const css::uno::Reference< css::beans::XPropertySet > &xSource, const tPropertyNameMap &rMap)
#define TOOLS_WARN_EXCEPTION(area, stream)
Reference< XInterface > xTarget
css::uno::Sequence< OUString > tNameSequence
std::unordered_map< OUString, OUString > tPropertyNameMap
css::uno::Sequence< css::uno::Any > tAnySequence
std::unordered_map< OUString, css::uno::Any > tPropertyNameValueMap
HashMap_OWString_Interface aMap
std::map< OUString, rtl::Reference< Entity > > map
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_WIDTH
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_TRANS
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_COLOR
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_STYLE
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_BACKGROUND
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_COLOR
constexpr OUStringLiteral CHART_UNONAME_LABEL_BORDER_STYLE
constexpr OUStringLiteral CHART_UNONAME_LABEL_FILL_HATCH_NAME