LibreOffice Module svx (master)  1
xattr.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #include <sal/config.h>
21 
22 #include <utility>
23 
24 #include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp>
25 #include <com/sun/star/drawing/Hatch.hpp>
26 #include <com/sun/star/drawing/LineStyle.hpp>
27 #include <com/sun/star/drawing/LineDash.hpp>
28 #include <com/sun/star/drawing/DashStyle.hpp>
29 #include <com/sun/star/drawing/FillStyle.hpp>
30 #include <com/sun/star/awt/Gradient.hpp>
31 #include <com/sun/star/uno/Sequence.hxx>
32 #include <com/sun/star/beans/PropertyValue.hpp>
33 
35 #include <o3tl/string_view.hxx>
36 #include <o3tl/any.hxx>
37 #include <svl/itempool.hxx>
38 #include <editeng/memberids.h>
39 #include <tools/mapunit.hxx>
40 #include <tools/UnitConversion.hxx>
41 #include <osl/diagnose.h>
42 
43 #include <svx/unoapi.hxx>
44 #include <svl/style.hxx>
45 
46 #include <tools/bigint.hxx>
47 #include <svl/itemset.hxx>
48 #include <svx/strings.hrc>
49 #include <svx/xfillit0.hxx>
50 #include <svx/xflasit.hxx>
51 #include <svx/xlineit0.hxx>
52 #include <svx/xlnasit.hxx>
53 #include <svx/xtextit0.hxx>
54 #include <svx/xtable.hxx>
55 #include <svx/dialmgr.hxx>
56 #include <svx/xflclit.hxx>
57 #include <svx/xflgrit.hxx>
58 #include <svx/xflftrit.hxx>
59 #include <svx/xsflclit.hxx>
60 #include <svx/xflhtit.hxx>
61 #include <svx/xbtmpit.hxx>
62 #include <svx/xlndsit.hxx>
63 #include <svx/xlnwtit.hxx>
64 #include <svx/xlnclit.hxx>
65 #include <svx/xlnstit.hxx>
66 #include <svx/xlnedit.hxx>
67 #include <svx/xlnstwit.hxx>
68 #include <svx/xlnedwit.hxx>
69 #include <svx/xlnstcit.hxx>
70 #include <svx/xlnedcit.hxx>
71 #include <editeng/itemtype.hxx>
72 #include <editeng/eerdll.hxx>
73 #include <svx/xdef.hxx>
74 #include <svx/unomid.hxx>
75 #include <svx/svdmodel.hxx>
76 #include <svx/xftdiit.hxx>
77 #include <svx/xftstit.hxx>
78 #include <svx/xftmrit.hxx>
79 #include <svx/xftouit.hxx>
80 #include <svx/xftshit.hxx>
81 #include <svx/xftshcit.hxx>
82 #include <svx/xftshxy.hxx>
83 #include <svx/xftadit.hxx>
84 #include <svx/svddef.hxx>
86 #include <unotools/intlwrapper.hxx>
87 #include <unotools/syslocale.hxx>
88 #include <string>
89 
90 #include <boost/property_tree/json_parser.hpp>
91 #include <libxml/xmlwriter.h>
92 
93 using namespace ::com::sun::star;
94 
95 typedef std::map<OUString, OUString> StringMap;
96 
98  SfxStringItem(_nWhich, OUString()),
99  nPalIndex(nIndex)
100 {
101 }
102 
103 NameOrIndex::NameOrIndex(TypedWhichId<NameOrIndex> _nWhich, const OUString& rName) :
104  SfxStringItem(_nWhich, rName),
105  nPalIndex(-1)
106 {
107 }
108 
109 NameOrIndex::NameOrIndex(const NameOrIndex& rNameOrIndex) :
110  SfxStringItem(rNameOrIndex),
111  nPalIndex(rNameOrIndex.nPalIndex)
112 {
113 }
114 
115 bool NameOrIndex::operator==(const SfxPoolItem& rItem) const
116 {
117  return ( SfxStringItem::operator==(rItem) &&
118  static_cast<const NameOrIndex&>(rItem).nPalIndex == nPalIndex );
119 }
120 
122 {
123  return new NameOrIndex(*this);
124 }
125 
131 OUString NameOrIndex::CheckNamedItem( const NameOrIndex* pCheckItem, const sal_uInt16 nWhich, const SfxItemPool* pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults )
132 {
133  bool bForceNew = false;
134 
135  OUString aUniqueName = SvxUnogetInternalNameForItem(nWhich, pCheckItem->GetName());
136 
137  // 2. if we have a name check if there is already an item with the
138  // same name in the documents pool with a different line end or start
139 
140  if (!aUniqueName.isEmpty() && pPool1)
141  {
142  for (const SfxPoolItem* pItem : pPool1->GetItemSurrogates(nWhich))
143  {
144  const NameOrIndex *pNameOrIndex = static_cast<const NameOrIndex*>(pItem);
145 
146  if( pNameOrIndex->GetName() == pCheckItem->GetName() )
147  {
148  // if there is already an item with the same name and the same
149  // value it's ok to set it
150  if( !pCompareValueFunc( pNameOrIndex, pCheckItem ) )
151  {
152  // same name but different value, we need a new name for this item
153  aUniqueName.clear();
154  bForceNew = true;
155  }
156  break;
157  }
158  }
159  }
160 
161  // if we have no name yet, find existing item with same content or
162  // create a unique name
163  if (aUniqueName.isEmpty())
164  {
165  sal_Int32 nUserIndex = 1;
166  const OUString aUser(SvxResId(pPrefixResId) + " ");
167 
168  if( pDefaults )
169  {
170  const int nCount = pDefaults->Count();
171  int nIndex;
172  for( nIndex = 0; nIndex < nCount; nIndex++ )
173  {
174  const XPropertyEntry* pEntry = pDefaults->Get(nIndex);
175  if( pEntry )
176  {
177  bool bFound = false;
178 
179  switch( nWhich )
180  {
181  case XATTR_FILLBITMAP:
182  {
183  const GraphicObject& rGraphicObjectA(static_cast<const XFillBitmapItem*>(pCheckItem)->GetGraphicObject());
184  const GraphicObject& rGraphicObjectB(static_cast<const XBitmapEntry*>(pEntry)->GetGraphicObject());
185 
186  bFound = (rGraphicObjectA == rGraphicObjectB);
187  break;
188  }
189  case XATTR_LINEDASH:
190  bFound = static_cast<const XLineDashItem*>(pCheckItem)->GetDashValue() == static_cast<const XDashEntry*>(pEntry)->GetDash();
191  break;
192  case XATTR_LINESTART:
193  bFound = static_cast<const XLineStartItem*>(pCheckItem)->GetLineStartValue() == static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd();
194  break;
195  case XATTR_LINEEND:
196  bFound = static_cast<const XLineEndItem*>(pCheckItem)->GetLineEndValue() == static_cast<const XLineEndEntry*>(pEntry)->GetLineEnd();
197  break;
198  case XATTR_FILLGRADIENT:
199  bFound = static_cast<const XFillGradientItem*>(pCheckItem)->GetGradientValue() == static_cast<const XGradientEntry*>(pEntry)->GetGradient();
200  break;
201  case XATTR_FILLHATCH:
202  bFound = static_cast<const XFillHatchItem*>(pCheckItem)->GetHatchValue() == static_cast<const XHatchEntry*>(pEntry)->GetHatch();
203  break;
204  }
205 
206  if( bFound )
207  {
208  aUniqueName = pEntry->GetName();
209  break;
210  }
211  else
212  {
213  const OUString& aEntryName = pEntry->GetName();
214  if(aEntryName.getLength() >= aUser.getLength())
215  {
216  sal_Int32 nThisIndex = o3tl::toInt32(aEntryName.subView( aUser.getLength() ));
217  if( nThisIndex >= nUserIndex )
218  nUserIndex = nThisIndex + 1;
219  }
220  }
221  }
222  }
223  }
224 
225  if (aUniqueName.isEmpty() && pPool1)
226  {
227  for (const SfxPoolItem* pItem : pPool1->GetItemSurrogates(nWhich))
228  {
229  const NameOrIndex *pNameOrIndex = static_cast<const NameOrIndex*>(pItem);
230 
231  if( !pNameOrIndex->GetName().isEmpty() )
232  {
233  if( !bForceNew && pCompareValueFunc( pNameOrIndex, pCheckItem ) )
234  return pNameOrIndex->GetName();
235 
236  if( pNameOrIndex->GetName().startsWith( aUser ) )
237  {
238  sal_Int32 nThisIndex = o3tl::toInt32(pNameOrIndex->GetName().subView( aUser.getLength() ));
239  if( nThisIndex >= nUserIndex )
240  nUserIndex = nThisIndex + 1;
241  }
242  }
243  }
244  aUniqueName = aUser + OUString::number( nUserIndex );
245  }
246  }
247 
248  return aUniqueName;
249 }
250 
252 {
253  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("NameOrIndex"));
254  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
255  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("isIndex"), BAD_CAST(OString::boolean(IsIndex()).getStr()));
256  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
257  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("index"), BAD_CAST(OString::number(nPalIndex).getStr()));
258  (void)xmlTextWriterEndElement(pWriter);
259 }
260 
262 
263 XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, sal_Int32 nIndex, const Color& rTheColor) :
264  NameOrIndex(_nWhich, nIndex),
265  aColor(rTheColor)
266 {
267 }
268 
269 XColorItem::XColorItem(TypedWhichId<XColorItem> _nWhich, const OUString& rName, const Color& rTheColor) :
270  NameOrIndex(_nWhich, rName),
271  aColor(rTheColor)
272 {
273 }
274 
276  : NameOrIndex(_nWhich, OUString())
277  , aColor(rTheColor)
278 {
279 }
280 
282  NameOrIndex(rItem),
283  aColor(rItem.aColor),
284  maThemeColor(rItem.maThemeColor)
285 {
286 }
287 
289 {
290  return new XColorItem(*this);
291 }
292 
293 bool XColorItem::operator==(const SfxPoolItem& rItem) const
294 {
295  return ( NameOrIndex::operator==(rItem) &&
296  static_cast<const XColorItem&>(rItem).aColor == aColor ) &&
297  static_cast<const XColorItem&>(rItem).maThemeColor == maThemeColor;
298 }
299 
301 {
302  assert(!IsIndex());
303  return aColor;
304 
305 }
306 
307 bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
308 {
309  rVal <<= GetColorValue().GetRGBColor();
310  return true;
311 }
312 
313 bool XColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
314 {
315  Color nValue;
316  rVal >>= nValue;
317  SetColorValue( nValue );
318 
319  return true;
320 }
321 
323 {
324  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("XColorItem"));
325  if (Which() == SDRATTR_SHADOWCOLOR)
326  {
327  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("SDRATTR_SHADOWCOLOR"));
328  }
329  else if (Which() == XATTR_FILLCOLOR)
330  {
331  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST("XATTR_FILLCOLOR"));
332  }
333  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aColor"),
334  BAD_CAST(aColor.AsRGBHexString().toUtf8().getStr()));
335 
336  NameOrIndex::dumpAsXml(pWriter);
337 
338  maThemeColor.dumpAsXml(pWriter);
339 
340  (void)xmlTextWriterEndElement(pWriter);
341 }
342 
343 // --- line attributes ---
344 
345 
347 
348 XLineStyleItem::XLineStyleItem(css::drawing::LineStyle eTheLineStyle) :
349  SfxEnumItem(XATTR_LINESTYLE, eTheLineStyle)
350 {
351 }
352 
354 {
355  return new XLineStyleItem( *this );
356 }
357 
359 (
360  SfxItemPresentation /*ePres*/,
361  MapUnit /*eCoreUnit*/,
362  MapUnit /*ePresUnit*/,
363  OUString& rText, const IntlWrapper&
364 ) const
365 {
366  rText.clear();
367 
368  TranslateId pId;
369 
370  switch( GetValue() )
371  {
372  case css::drawing::LineStyle_NONE:
373  pId = RID_SVXSTR_INVISIBLE;
374  break;
375  case css::drawing::LineStyle_SOLID:
376  pId = RID_SVXSTR_SOLID;
377  break;
378  default: break;
379  }
380 
381  if (pId)
382  rText = SvxResId(pId);
383  return true;
384 }
385 
386 bool XLineStyleItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
387 {
388  css::drawing::LineStyle eLS = GetValue();
389  rVal <<= eLS;
390  return true;
391 }
392 
393 bool XLineStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
394 {
395  css::drawing::LineStyle eLS;
396  if(!(rVal >>= eLS ))
397  {
398  // also try an int (for Basic)
399  sal_Int32 nLS = 0;
400  if(!(rVal >>= nLS))
401  return false;
402  eLS = static_cast<css::drawing::LineStyle>(nLS);
403  }
404 
405  SetValue( eLS );
406  return true;
407 }
408 
410 {
411  return 3;
412 }
413 
414 XDash::XDash(css::drawing::DashStyle eTheDash, sal_uInt16 nTheDots, double nTheDotLen,
415  sal_uInt16 nTheDashes, double nTheDashLen, double nTheDistance) :
416  eDash(eTheDash),
417  nDots(nTheDots),
418  nDashes(nTheDashes),
419  nDotLen(nTheDotLen),
420  nDashLen(nTheDashLen),
421  nDistance(nTheDistance)
422 {
423 }
424 
425 bool XDash::operator==(const XDash& rDash) const
426 {
427  return ( eDash == rDash.eDash &&
428  nDots == rDash.nDots &&
429  nDotLen == rDash.nDotLen &&
430  nDashes == rDash.nDashes &&
431  nDashLen == rDash.nDashLen &&
432  nDistance == rDash.nDistance );
433 }
434 
435 // XDash is translated into an array of doubles which describe the lengths of the
436 // dashes, dots and empty passages. It returns the complete length of the full DashDot
437 // sequence and fills the given vetor of doubles accordingly (also resizing, so deleting it).
438 const double SMALLEST_DASH_WIDTH(26.95);
439 
440 double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double fLineWidth) const
441 {
442  double fFullDotDashLen(0.0);
443  const sal_uInt16 nNumDotDashArray = (GetDots() + GetDashes()) * 2;
444  rDotDashArray.resize( nNumDotDashArray, 0.0 );
445  sal_uInt16 a;
446  sal_uInt16 nIns(0);
447  double fDashDotDistance = GetDistance();
448  double fSingleDashLen = GetDashLen();
449  double fSingleDotLen = GetDotLen();
450 
451  if (fLineWidth == 0.0)
452  fLineWidth = SMALLEST_DASH_WIDTH;
453 
454  if(GetDashStyle() == css::drawing::DashStyle_RECTRELATIVE || GetDashStyle() == css::drawing::DashStyle_ROUNDRELATIVE)
455  {
456  double fFactor = fLineWidth / 100.0;
457 
458  if(GetDashes())
459  {
460  if(GetDashLen())
461  {
462  // is a dash
463  fSingleDashLen *= fFactor;
464  }
465  else
466  {
467  // is a dot
468  fSingleDashLen = fLineWidth;
469  }
470  }
471 
472  if(GetDots())
473  {
474  if(GetDotLen())
475  {
476  // is a dash
477  fSingleDotLen *= fFactor;
478  }
479  else
480  {
481  // is a dot
482  fSingleDotLen = fLineWidth;
483  }
484  }
485 
486  if(GetDashes() || GetDots())
487  {
488  if(GetDistance())
489  {
490  // dash as distance
491  fDashDotDistance *= fFactor;
492  }
493  else
494  {
495  // dot as distance
496  fDashDotDistance = fLineWidth;
497  }
498  }
499  }
500  else
501  {
502  // absolute values
503  if(GetDashes())
504  {
505  if(GetDashLen())
506  {
507  // is a dash
508  if(fSingleDashLen < SMALLEST_DASH_WIDTH)
509  {
510  fSingleDashLen = SMALLEST_DASH_WIDTH;
511  }
512  }
513  else
514  {
515  // is a dot
516  if(fSingleDashLen < fLineWidth)
517  {
518  fSingleDashLen = fLineWidth;
519  }
520  }
521  }
522 
523  if(GetDots())
524  {
525  if(GetDotLen())
526  {
527  // is a dash
528  if(fSingleDotLen < SMALLEST_DASH_WIDTH)
529  {
530  fSingleDotLen = SMALLEST_DASH_WIDTH;
531  }
532  }
533  else
534  {
535  // is a dot
536  if(fSingleDotLen < fLineWidth)
537  {
538  fSingleDotLen = fLineWidth;
539  }
540  }
541  }
542 
543  if(GetDashes() || GetDots())
544  {
545  if(GetDistance())
546  {
547  // dash as distance
548  if(fDashDotDistance < SMALLEST_DASH_WIDTH)
549  {
550  fDashDotDistance = SMALLEST_DASH_WIDTH;
551  }
552  }
553  else
554  {
555  // dot as distance
556  if(fDashDotDistance < fLineWidth)
557  {
558  fDashDotDistance = fLineWidth;
559  }
560  }
561  }
562  }
563 
564  for(a=0;a<GetDots();a++)
565  {
566  rDotDashArray[nIns++] = fSingleDotLen;
567  fFullDotDashLen += fSingleDotLen;
568  rDotDashArray[nIns++] = fDashDotDistance;
569  fFullDotDashLen += fDashDotDistance;
570  }
571 
572  for(a=0;a<GetDashes();a++)
573  {
574  rDotDashArray[nIns++] = fSingleDashLen;
575  fFullDotDashLen += fSingleDashLen;
576  rDotDashArray[nIns++] = fDashDotDistance;
577  fFullDotDashLen += fDashDotDistance;
578  }
579 
580  return fFullDotDashLen;
581 }
582 
584 
585 XLineDashItem::XLineDashItem(const OUString& rName, const XDash& rTheDash) :
586  NameOrIndex(XATTR_LINEDASH, rName),
587  aDash(rTheDash)
588 {
589 }
590 
592  NameOrIndex(rItem),
593  aDash(rItem.aDash)
594 {
595 }
596 
598 : NameOrIndex( XATTR_LINEDASH, -1 ),
599  aDash(rTheDash)
600 {
601 }
602 
604 {
605  return new XLineDashItem(*this);
606 }
607 
608 bool XLineDashItem::operator==(const SfxPoolItem& rItem) const
609 {
610  return ( NameOrIndex::operator==(rItem) &&
611  aDash == static_cast<const XLineDashItem&>(rItem).aDash );
612 }
613 
615 (
616  SfxItemPresentation /*ePres*/,
617  MapUnit /*eCoreUnit*/,
618  MapUnit /*ePresUnit*/,
619  OUString& rText, const IntlWrapper&
620 ) const
621 {
622  rText = GetName();
623  return true;
624 }
625 
627 {
628  return true;
629 }
630 
632 {
633  aDash.SetDotLen( BigInt::Scale( aDash.GetDotLen(), nMul, nDiv ) );
634  aDash.SetDashLen( BigInt::Scale( aDash.GetDashLen(), nMul, nDiv ) );
635  aDash.SetDistance( BigInt::Scale( aDash.GetDistance(), nMul, nDiv ) );
636 }
637 
638 bool XLineDashItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
639 {
640  nMemberId &= ~CONVERT_TWIPS;
641 
642  switch ( nMemberId )
643  {
644  case 0:
645  {
646  css::drawing::LineDash aLineDash;
647 
648  const XDash& rXD = GetDashValue();
649  aLineDash.Style = static_cast<css::drawing::DashStyle>(static_cast<sal_uInt16>(rXD.GetDashStyle()));
650  aLineDash.Dots = rXD.GetDots();
651  aLineDash.DotLen = rXD.GetDotLen();
652  aLineDash.Dashes = rXD.GetDashes();
653  aLineDash.DashLen = rXD.GetDashLen();
654  aLineDash.Distance = rXD.GetDistance();
655 
656  uno::Sequence< beans::PropertyValue > aPropSeq{
658  comphelper::makePropertyValue("LineDash", aLineDash)
659  };
660  rVal <<= aPropSeq;
661  break;
662  }
663 
664  case MID_NAME:
665  {
666  rVal <<= SvxUnogetApiNameForItem(Which(), GetName());
667  break;
668  }
669 
670  case MID_LINEDASH:
671  {
672  const XDash& rXD = GetDashValue();
673 
674  css::drawing::LineDash aLineDash;
675 
676  aLineDash.Style = static_cast<css::drawing::DashStyle>(static_cast<sal_uInt16>(rXD.GetDashStyle()));
677  aLineDash.Dots = rXD.GetDots();
678  aLineDash.DotLen = rXD.GetDotLen();
679  aLineDash.Dashes = rXD.GetDashes();
680  aLineDash.DashLen = rXD.GetDashLen();
681  aLineDash.Distance = rXD.GetDistance();
682 
683  rVal <<= aLineDash;
684  break;
685  }
686 
687  case MID_LINEDASH_STYLE:
688  {
689  const XDash& rXD = GetDashValue();
690  rVal <<= static_cast<css::drawing::DashStyle>(static_cast<sal_Int16>(rXD.GetDashStyle()));
691  break;
692  }
693 
694  case MID_LINEDASH_DOTS:
695  {
696  const XDash& rXD = GetDashValue();
697  rVal <<= rXD.GetDots();
698  break;
699  }
700 
701  case MID_LINEDASH_DOTLEN:
702  {
703  const XDash& rXD = GetDashValue();
704  rVal <<= rXD.GetDotLen();
705  break;
706  }
707 
708  case MID_LINEDASH_DASHES:
709  {
710  const XDash& rXD = GetDashValue();
711  rVal <<= rXD.GetDashes();
712  break;
713  }
714 
716  {
717  const XDash& rXD = GetDashValue();
718  rVal <<= rXD.GetDashLen();
719  break;
720  }
721 
723  {
724  const XDash& rXD = GetDashValue();
725  rVal <<= rXD.GetDistance();
726  break;
727  }
728 
729  default: OSL_FAIL("Wrong MemberId!"); return false;
730  }
731 
732  return true;
733 }
734 
735 bool XLineDashItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
736 {
737  nMemberId &= ~CONVERT_TWIPS;
738 
739  switch ( nMemberId )
740  {
741  case 0:
742  {
743  uno::Sequence< beans::PropertyValue > aPropSeq;
744 
745  if ( rVal >>= aPropSeq )
746  {
747  css::drawing::LineDash aLineDash;
748  OUString aName;
749  bool bLineDash( false );
750  for ( const auto& rProp : std::as_const(aPropSeq) )
751  {
752  if ( rProp.Name == "Name" )
753  rProp.Value >>= aName;
754  else if ( rProp.Name == "LineDash" )
755  {
756  if ( rProp.Value >>= aLineDash )
757  bLineDash = true;
758  }
759  }
760 
761  SetName( aName );
762  if ( bLineDash )
763  {
764  XDash aXDash;
765 
766  aXDash.SetDashStyle(static_cast<css::drawing::DashStyle>(static_cast<sal_uInt16>(aLineDash.Style)));
767  aXDash.SetDots(aLineDash.Dots);
768  aXDash.SetDotLen(aLineDash.DotLen);
769  aXDash.SetDashes(aLineDash.Dashes);
770  aXDash.SetDashLen(aLineDash.DashLen);
771  aXDash.SetDistance(aLineDash.Distance);
772 
773  if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
774  aXDash.SetDots(1);
775 
776  SetDashValue( aXDash );
777  }
778 
779  return true;
780  }
781 
782  return false;
783  }
784 
785  case MID_NAME:
786  {
787  OUString aName;
788  if (!(rVal >>= aName))
789  return false;
790  SetName( aName );
791  break;
792  }
793 
794  case MID_LINEDASH:
795  {
796  css::drawing::LineDash aLineDash;
797  if(!(rVal >>= aLineDash))
798  return false;
799 
800  XDash aXDash;
801 
802  aXDash.SetDashStyle(static_cast<css::drawing::DashStyle>(static_cast<sal_uInt16>(aLineDash.Style)));
803  aXDash.SetDots(aLineDash.Dots);
804  aXDash.SetDotLen(aLineDash.DotLen);
805  aXDash.SetDashes(aLineDash.Dashes);
806  aXDash.SetDashLen(aLineDash.DashLen);
807  aXDash.SetDistance(aLineDash.Distance);
808 
809  if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
810  aXDash.SetDots(1);
811 
812  SetDashValue( aXDash );
813  break;
814  }
815 
816  case MID_LINEDASH_STYLE:
817  {
818  sal_Int16 nVal = sal_Int16();
819  if(!(rVal >>= nVal))
820  return false;
821 
822  XDash aXDash = GetDashValue();
823  aXDash.SetDashStyle(static_cast<css::drawing::DashStyle>(static_cast<sal_uInt16>(nVal)));
824 
825  if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
826  aXDash.SetDots(1);
827 
828  SetDashValue( aXDash );
829 
830  break;
831  }
832 
833  case MID_LINEDASH_DOTS:
834  case MID_LINEDASH_DASHES:
835  {
836  sal_Int16 nVal = sal_Int16();
837  if(!(rVal >>= nVal))
838  return false;
839 
840  XDash aXDash = GetDashValue();
841  if ( nMemberId == MID_LINEDASH_DOTS )
842  aXDash.SetDots( nVal );
843  else
844  aXDash.SetDashes( nVal );
845 
846  if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
847  aXDash.SetDots(1);
848 
849  SetDashValue( aXDash );
850  break;
851  }
852 
853  case MID_LINEDASH_DOTLEN:
856  {
857  sal_uInt32 nVal = 0;
858  if(!(rVal >>= nVal))
859  return false;
860 
861  XDash aXDash = GetDashValue();
862  if ( nMemberId == MID_LINEDASH_DOTLEN )
863  aXDash.SetDotLen( nVal );
864  else if ( nMemberId == MID_LINEDASH_DASHLEN )
865  aXDash.SetDashLen( nVal );
866  else
867  aXDash.SetDistance( nVal );
868 
869  if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes()))
870  aXDash.SetDots(1);
871 
872  SetDashValue( aXDash );
873  break;
874  }
875  }
876 
877  return true;
878 }
879 
881 {
882  return static_cast<const XLineDashItem*>(p1)->GetDashValue() == static_cast<const XLineDashItem*>(p2)->GetDashValue();
883 }
884 
885 std::unique_ptr<XLineDashItem> XLineDashItem::checkForUniqueItem( SdrModel* pModel ) const
886 {
887  if( pModel )
888  {
889  const OUString aUniqueName = NameOrIndex::CheckNamedItem(
890  this, XATTR_LINEDASH, &pModel->GetItemPool(),
891  XLineDashItem::CompareValueFunc, RID_SVXSTR_DASH20,
893 
894  // if the given name is not valid, replace it!
895  if( aUniqueName != GetName() )
896  return std::make_unique<XLineDashItem>( aUniqueName, aDash );
897  }
898 
899  return nullptr;
900 }
901 
903 
906 {
907 }
908 
910 {
911  return new XLineWidthItem(*this);
912 }
913 
915 (
916  SfxItemPresentation /*ePres*/,
917  MapUnit eCoreUnit,
918  MapUnit ePresUnit,
919  OUString& rText, const IntlWrapper& rIntl
920 ) const
921 {
922  rText = GetMetricText( static_cast<tools::Long>(GetValue()),
923  eCoreUnit, ePresUnit, &rIntl) +
924  " " + EditResId( GetMetricId( ePresUnit) );
925  return true;
926 }
927 
928 bool XLineWidthItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
929 {
930  sal_Int32 nValue = GetValue();
931  if( 0 != (nMemberId&CONVERT_TWIPS) )
932  nValue = convertTwipToMm100(nValue);
933 
934  rVal <<= nValue;
935  return true;
936 }
937 
938 bool XLineWidthItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
939 {
940  sal_Int32 nValue = 0;
941  rVal >>= nValue;
942  if( 0 != (nMemberId&CONVERT_TWIPS) )
943  nValue = o3tl::toTwips(nValue, o3tl::Length::mm100);
944 
945  SetValue( nValue );
946  return true;
947 }
948 
950 
951 XLineColorItem::XLineColorItem(sal_Int32 nIndex, const Color& rTheColor) :
952  XColorItem(XATTR_LINECOLOR, nIndex, rTheColor)
953 {
954 }
955 
956 XLineColorItem::XLineColorItem(const OUString& rName, const Color& rTheColor) :
957  XColorItem(XATTR_LINECOLOR, rName, rTheColor)
958 {
959 }
960 
962 {
963  return new XLineColorItem(*this);
964 }
965 
967 (
968  SfxItemPresentation /*ePres*/,
969  MapUnit /*eCoreUnit*/,
970  MapUnit /*ePresUnit*/,
971  OUString& rText, const IntlWrapper&
972 ) const
973 {
974  rText = GetName();
975  return true;
976 }
977 
978 bool XLineColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
979 {
980  rVal <<= GetColorValue().GetRGBColor();
981  return true;
982 }
983 
984 bool XLineColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
985 {
986  sal_Int32 nValue = 0;
987  if(!(rVal >>= nValue))
988  return false;
989 
991  return true;
992 }
993 
994 
996 
998 : NameOrIndex(XATTR_LINESTART, nIndex)
999 {
1000 }
1001 
1002 XLineStartItem::XLineStartItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1003 : NameOrIndex(XATTR_LINESTART, rName),
1004  maPolyPolygon(rPolyPolygon)
1005 {
1006 }
1007 
1009 : NameOrIndex(rItem),
1011 {
1012 }
1013 
1015 : NameOrIndex( XATTR_LINESTART, -1 ),
1016  maPolyPolygon(rPolyPolygon)
1017 {
1018 }
1019 
1021 {
1022  return new XLineStartItem(*this);
1023 }
1024 
1025 bool XLineStartItem::operator==(const SfxPoolItem& rItem) const
1026 {
1027  return ( NameOrIndex::operator==(rItem) && static_cast<const XLineStartItem&>(rItem).maPolyPolygon == maPolyPolygon );
1028 }
1029 
1032  SfxItemPresentation /*ePres*/,
1033  MapUnit /*eCoreUnit*/,
1034  MapUnit /*ePresUnit*/,
1035  OUString& rText, const IntlWrapper&
1036 ) const
1037 {
1038  rText = GetName();
1039  return true;
1040 }
1041 
1042 bool XLineStartItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
1043 {
1044  nMemberId &= ~CONVERT_TWIPS;
1045  if( nMemberId == MID_NAME )
1046  {
1047  rVal <<= SvxUnogetApiNameForItem(Which(), GetName());
1048  }
1049  else
1050  {
1051  css::drawing::PolyPolygonBezierCoords aBezier;
1053  rVal <<= aBezier;
1054  }
1055 
1056  return true;
1057 }
1058 
1059 bool XLineStartItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
1060 {
1061  nMemberId &= ~CONVERT_TWIPS;
1062  if( nMemberId == MID_NAME )
1063  {
1064  return false;
1065  }
1066  else
1067  {
1068  maPolyPolygon.clear();
1069 
1070  if( rVal.hasValue() )
1071  {
1072  auto pCoords = o3tl::tryAccess<css::drawing::PolyPolygonBezierCoords>(
1073  rVal);
1074  if( !pCoords )
1075  return false;
1076 
1077  if( pCoords->Coordinates.getLength() > 0 )
1078  {
1080  // #i72807# close line start/end polygons hard
1081  // maPolyPolygon.setClosed(true);
1082  }
1083  }
1084  }
1085 
1086  return true;
1087 }
1088 
1092 std::unique_ptr<XLineStartItem> XLineStartItem::checkForUniqueItem( SdrModel* pModel ) const
1093 {
1094  if( pModel )
1095  {
1096  std::unique_ptr<XLineStartItem> pTempItem;
1097  const XLineStartItem* pLineStartItem = this;
1098 
1099  OUString aUniqueName( GetName() );
1100 
1101  if( !maPolyPolygon.count() )
1102  {
1103  // if the polygon is empty, check if the name is empty
1104  if( aUniqueName.isEmpty() )
1105  return nullptr;
1106 
1107  // force empty name for empty polygons
1108  return std::make_unique<XLineStartItem>( "", maPolyPolygon );
1109  }
1110 
1111  if( maPolyPolygon.count() > 1 )
1112  {
1113  // check if the polygon is closed
1114  if(!maPolyPolygon.isClosed())
1115  {
1116  // force a closed polygon
1118  aNew.setClosed(true);
1119  pTempItem.reset(new XLineStartItem( aUniqueName, aNew ));
1120  pLineStartItem = pTempItem.get();
1121  }
1122  }
1123 
1124  bool bForceNew = false;
1125 
1126  // 2. if we have a name check if there is already an item with the
1127  // same name in the documents pool with a different line end or start
1128 
1129  const SfxItemPool& rPool1 = pModel->GetItemPool();
1130  if (!aUniqueName.isEmpty())
1131  {
1132  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINESTART))
1133  {
1134  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1135 
1136  if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1137  {
1138  // if there is already an item with the same name and the same
1139  // value it's ok to set it
1140  if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
1141  {
1142  // same name but different value, we need a new name for this item
1143  aUniqueName.clear();
1144  bForceNew = true;
1145  }
1146  break;
1147  }
1148  }
1149 
1150  if( !bForceNew )
1151  {
1152  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINEEND))
1153  {
1154  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1155 
1156  if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1157  {
1158  // if there is already an item with the same name and the same
1159  // value it's ok to set it
1160  if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
1161  {
1162  // same name but different value, we need a new name for this item
1163  aUniqueName.clear();
1164  bForceNew = true;
1165  }
1166  break;
1167  }
1168  }
1169  }
1170  }
1171 
1172  const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : nullptr;
1173  if( !aUniqueName.isEmpty() && pPool2)
1174  {
1175  for (const SfxPoolItem* p : pPool2->GetItemSurrogates(XATTR_LINESTART))
1176  {
1177  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1178 
1179  if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1180  {
1181  // if there is already an item with the same name and the same
1182  // value it's ok to set it
1183  if( pItem->GetLineStartValue() != pLineStartItem->GetLineStartValue() )
1184  {
1185  // same name but different value, we need a new name for this item
1186  aUniqueName.clear();
1187  bForceNew = true;
1188  }
1189  break;
1190  }
1191  }
1192 
1193  if( !bForceNew )
1194  {
1195  for (const SfxPoolItem* p : pPool2->GetItemSurrogates(XATTR_LINEEND))
1196  {
1197  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1198 
1199  if( pItem && ( pItem->GetName() == pLineStartItem->GetName() ) )
1200  {
1201  // if there is already an item with the same name and the same
1202  // value it's ok to set it
1203  if( pItem->GetLineEndValue() != pLineStartItem->GetLineStartValue() )
1204  {
1205  // same name but different value, we need a new name for this item
1206  aUniqueName.clear();
1207  bForceNew = true;
1208  }
1209  break;
1210  }
1211  }
1212  }
1213  }
1214 
1215  // if we have no name yet, find existing item with same content or
1216  // create a unique name
1217  if( aUniqueName.isEmpty() )
1218  {
1219  bool bFoundExisting = false;
1220 
1221  sal_Int32 nUserIndex = 1;
1222  const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));
1223 
1224  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINESTART))
1225  {
1226  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1227 
1228  if (pItem && !pItem->GetName().isEmpty())
1229  {
1230  if (!bForceNew && pItem->GetLineStartValue() == pLineStartItem->GetLineStartValue())
1231  {
1232  aUniqueName = pItem->GetName();
1233  bFoundExisting = true;
1234  break;
1235  }
1236 
1237  if (pItem->GetName().startsWith(aUser))
1238  {
1239  sal_Int32 nThisIndex = o3tl::toInt32(pItem->GetName().subView(aUser.getLength()));
1240  if (nThisIndex >= nUserIndex)
1241  nUserIndex = nThisIndex + 1;
1242  }
1243  }
1244  }
1245 
1246  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINEEND))
1247  {
1248  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1249 
1250  if (pItem && !pItem->GetName().isEmpty())
1251  {
1252  if (!bForceNew && pItem->GetLineEndValue() == pLineStartItem->GetLineStartValue())
1253  {
1254  aUniqueName = pItem->GetName();
1255  bFoundExisting = true;
1256  break;
1257  }
1258 
1259  if (pItem->GetName().startsWith(aUser))
1260  {
1261  sal_Int32 nThisIndex = o3tl::toInt32(pItem->GetName().subView(aUser.getLength()));
1262  if (nThisIndex >= nUserIndex)
1263  nUserIndex = nThisIndex + 1;
1264  }
1265  }
1266  }
1267 
1268  if( !bFoundExisting )
1269  {
1270  aUniqueName = aUser + " " + OUString::number( nUserIndex );
1271  }
1272  }
1273 
1274  // if the given name is not valid, replace it!
1275  if( aUniqueName != GetName() || pTempItem )
1276  {
1277  if( pTempItem )
1278  {
1279  pTempItem->SetName( aUniqueName );
1280  return pTempItem;
1281  }
1282  else
1283  {
1284  return std::make_unique<XLineStartItem>( aUniqueName, maPolyPolygon );
1285  }
1286  }
1287  }
1288 
1289  return nullptr;
1290 }
1291 
1293 
1295 : NameOrIndex(XATTR_LINEEND, nIndex)
1296 {
1297 }
1298 
1299 XLineEndItem::XLineEndItem(const OUString& rName, const basegfx::B2DPolyPolygon& rPolyPolygon)
1300 : NameOrIndex(XATTR_LINEEND, rName),
1301  maPolyPolygon(rPolyPolygon)
1302 {
1303 }
1304 
1306 : NameOrIndex(rItem),
1308 {
1309 }
1310 
1312 : NameOrIndex( XATTR_LINEEND, -1 ),
1313  maPolyPolygon(rPolyPolygon)
1314 {
1315 }
1316 
1318 {
1319  return new XLineEndItem(*this);
1320 }
1321 
1322 bool XLineEndItem::operator==(const SfxPoolItem& rItem) const
1323 {
1324  return ( NameOrIndex::operator==(rItem) && static_cast<const XLineEndItem&>(rItem).maPolyPolygon == maPolyPolygon );
1325 }
1326 
1327 
1331 std::unique_ptr<XLineEndItem> XLineEndItem::checkForUniqueItem( SdrModel* pModel ) const
1332 {
1333  if( pModel )
1334  {
1335  std::unique_ptr<XLineEndItem> pTempItem;
1336  const XLineEndItem* pLineEndItem = this;
1337 
1338  OUString aUniqueName( GetName() );
1339 
1340  if( !maPolyPolygon.count() )
1341  {
1342  // if the polygon is empty, check if the name is empty
1343  if( aUniqueName.isEmpty() )
1344  return nullptr;
1345 
1346  // force empty name for empty polygons
1347  return std::make_unique<XLineEndItem>( "", maPolyPolygon );
1348  }
1349 
1350  if( maPolyPolygon.count() > 1 )
1351  {
1352  // check if the polygon is closed
1353  if(!maPolyPolygon.isClosed())
1354  {
1355  // force a closed polygon
1357  aNew.setClosed(true);
1358  pTempItem.reset(new XLineEndItem( aUniqueName, aNew ));
1359  pLineEndItem = pTempItem.get();
1360  }
1361  }
1362 
1363  bool bForceNew = false;
1364 
1365  // 2. if we have a name check if there is already an item with the
1366  // same name in the documents pool with a different line end or start
1367 
1368  const SfxItemPool& rPool1 = pModel->GetItemPool();
1369  if (!aUniqueName.isEmpty())
1370  {
1371  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINESTART))
1372  {
1373  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1374 
1375  if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
1376  {
1377  // if there is already an item with the same name and the same
1378  // value it's ok to set it
1379  if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
1380  {
1381  // same name but different value, we need a new name for this item
1382  aUniqueName.clear();
1383  bForceNew = true;
1384  }
1385  break;
1386  }
1387  }
1388 
1389  if( !bForceNew )
1390  {
1391  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINEEND))
1392  {
1393  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1394 
1395  if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
1396  {
1397  // if there is already an item with the same name and the same
1398  // value it's ok to set it
1399  if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
1400  {
1401  // same name but different value, we need a new name for this item
1402  aUniqueName.clear();
1403  bForceNew = true;
1404  }
1405  break;
1406  }
1407  }
1408  }
1409  }
1410 
1411  const SfxItemPool* pPool2 = pModel->GetStyleSheetPool() ? &pModel->GetStyleSheetPool()->GetPool() : nullptr;
1412  if( !aUniqueName.isEmpty() && pPool2)
1413  {
1414  for (const SfxPoolItem* p : pPool2->GetItemSurrogates(XATTR_LINESTART))
1415  {
1416  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1417 
1418  if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
1419  {
1420  // if there is already an item with the same name and the same
1421  // value it's ok to set it
1422  if( pItem->GetLineStartValue() != pLineEndItem->GetLineEndValue() )
1423  {
1424  // same name but different value, we need a new name for this item
1425  aUniqueName.clear();
1426  bForceNew = true;
1427  }
1428  break;
1429  }
1430  }
1431 
1432  if( !bForceNew )
1433  {
1434  for (const SfxPoolItem* p : pPool2->GetItemSurrogates(XATTR_LINEEND))
1435  {
1436  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1437 
1438  if( pItem && ( pItem->GetName() == pLineEndItem->GetName() ) )
1439  {
1440  // if there is already an item with the same name and the same
1441  // value it's ok to set it
1442  if( pItem->GetLineEndValue() != pLineEndItem->GetLineEndValue() )
1443  {
1444  // same name but different value, we need a new name for this item
1445  aUniqueName.clear();
1446  bForceNew = true;
1447  }
1448  break;
1449  }
1450  }
1451  }
1452  }
1453 
1454  // if we have no name yet, find existing item with same content or
1455  // create a unique name
1456  if( aUniqueName.isEmpty() )
1457  {
1458  bool bFoundExisting = false;
1459 
1460  sal_Int32 nUserIndex = 1;
1461  const OUString aUser(SvxResId(RID_SVXSTR_LINEEND));
1462 
1463  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINESTART))
1464  {
1465  auto pItem = dynamic_cast<const XLineStartItem*>(p);
1466 
1467  if (pItem && !pItem->GetName().isEmpty())
1468  {
1469  if (!bForceNew && pItem->GetLineStartValue() == pLineEndItem->GetLineEndValue())
1470  {
1471  aUniqueName = pItem->GetName();
1472  bFoundExisting = true;
1473  break;
1474  }
1475 
1476  if (pItem->GetName().startsWith(aUser))
1477  {
1478  sal_Int32 nThisIndex = o3tl::toInt32(pItem->GetName().subView(aUser.getLength()));
1479  if (nThisIndex >= nUserIndex)
1480  nUserIndex = nThisIndex + 1;
1481  }
1482  }
1483  }
1484 
1485  for (const SfxPoolItem* p : rPool1.GetItemSurrogates(XATTR_LINEEND))
1486  {
1487  auto pItem = dynamic_cast<const XLineEndItem*>(p);
1488 
1489  if (pItem && !pItem->GetName().isEmpty())
1490  {
1491  if (!bForceNew && pItem->GetLineEndValue() == pLineEndItem->GetLineEndValue())
1492  {
1493  aUniqueName = pItem->GetName();
1494  bFoundExisting = true;
1495  break;
1496  }
1497 
1498  if (pItem->GetName().startsWith(aUser))
1499  {
1500  sal_Int32 nThisIndex = o3tl::toInt32(pItem->GetName().subView(aUser.getLength()));
1501  if (nThisIndex >= nUserIndex)
1502  nUserIndex = nThisIndex + 1;
1503  }
1504  }
1505  }
1506 
1507  if( !bFoundExisting )
1508  {
1509  aUniqueName = aUser + " " + OUString::number( nUserIndex );
1510  }
1511  }
1512 
1513  // if the given name is not valid, replace it!
1514  if( aUniqueName != GetName() || pTempItem )
1515  {
1516  if( pTempItem )
1517  {
1518  pTempItem->SetName( aUniqueName );
1519  return pTempItem;
1520  }
1521  else
1522  {
1523  return std::make_unique<XLineEndItem>( aUniqueName, maPolyPolygon );
1524  }
1525  }
1526  }
1527 
1528  return nullptr;
1529 }
1530 
1533  SfxItemPresentation /*ePres*/,
1534  MapUnit /*eCoreUnit*/,
1535  MapUnit /*ePresUnit*/,
1536  OUString& rText, const IntlWrapper&
1537 ) const
1538 {
1539  rText = GetName();
1540  return true;
1541 }
1542 
1543 bool XLineEndItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
1544 {
1545  nMemberId &= ~CONVERT_TWIPS;
1546  if( nMemberId == MID_NAME )
1547  {
1548  rVal <<= SvxUnogetApiNameForItem(Which(), GetName());
1549  }
1550  else
1551  {
1552  css::drawing::PolyPolygonBezierCoords aBezier;
1554  rVal <<= aBezier;
1555  }
1556  return true;
1557 }
1558 
1559 bool XLineEndItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
1560 {
1561  nMemberId &= ~CONVERT_TWIPS;
1562  if( nMemberId == MID_NAME )
1563  {
1564  return false;
1565  }
1566  else
1567  {
1568  maPolyPolygon.clear();
1569 
1570  if( rVal.hasValue() )
1571  {
1572  auto pCoords = o3tl::tryAccess<css::drawing::PolyPolygonBezierCoords>(
1573  rVal);
1574  if( !pCoords )
1575  return false;
1576 
1577  if( pCoords->Coordinates.getLength() > 0 )
1578  {
1580  // #i72807# close line start/end polygons hard
1581  // maPolyPolygon.setClosed(true);
1582  }
1583  }
1584  }
1585 
1586  return true;
1587 }
1588 
1591 {
1592 }
1593 
1595 {
1596  return new XLineStartWidthItem(*this);
1597 }
1598 
1601  SfxItemPresentation /*ePres*/,
1602  MapUnit eCoreUnit,
1603  MapUnit ePresUnit,
1604  OUString& rText, const IntlWrapper& rIntl
1605 ) const
1606 {
1607  rText = GetMetricText( static_cast<tools::Long>(GetValue()),
1608  eCoreUnit, ePresUnit, &rIntl) +
1609  " " + EditResId( GetMetricId( ePresUnit) );
1610  return true;
1611 }
1612 
1613 bool XLineStartWidthItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1614 {
1615  rVal <<= GetValue();
1616  return true;
1617 }
1618 
1619 bool XLineStartWidthItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1620 {
1621  sal_Int32 nValue = 0;
1622  rVal >>= nValue;
1623  SetValue( nValue );
1624  return true;
1625 }
1626 
1629 {
1630 }
1631 
1633 {
1634  return new XLineEndWidthItem(*this);
1635 }
1636 
1639  SfxItemPresentation /*ePres*/,
1640  MapUnit eCoreUnit,
1641  MapUnit ePresUnit,
1642  OUString& rText, const IntlWrapper& rIntl
1643 ) const
1644 {
1645  rText = GetMetricText( static_cast<tools::Long>(GetValue()),
1646  eCoreUnit, ePresUnit, &rIntl) +
1647  " " + EditResId( GetMetricId( ePresUnit) );
1648  return true;
1649 }
1650 
1651 bool XLineEndWidthItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1652 {
1653  rVal <<= GetValue();
1654  return true;
1655 }
1656 
1657 bool XLineEndWidthItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1658 {
1659  sal_Int32 nValue = 0;
1660  rVal >>= nValue;
1661  SetValue( nValue );
1662  return true;
1663 }
1664 
1666  SfxBoolItem(XATTR_LINESTARTCENTER, bStartCenter)
1667 {
1668 }
1669 
1671 {
1672  return new XLineStartCenterItem(*this);
1673 }
1674 
1677  SfxItemPresentation /*ePres*/,
1678  MapUnit /*eCoreUnit*/,
1679  MapUnit /*ePresUnit*/,
1680  OUString& rText, const IntlWrapper&
1681 ) const
1682 {
1683  rText = SvxResId(GetValue() ? RID_SVXSTR_CENTERED : RID_SVXSTR_NOTCENTERED);
1684  return true;
1685 }
1686 
1687 bool XLineStartCenterItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1688 {
1689  bool bValue = GetValue();
1690  rVal <<= bValue;
1691  return true;
1692 }
1693 
1694 bool XLineStartCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1695 {
1696  auto b = o3tl::tryAccess<bool>(rVal);
1697  if( !b )
1698  return false;
1699 
1700  SetValue( *b );
1701  return true;
1702 }
1703 
1705  SfxBoolItem(XATTR_LINEENDCENTER, bEndCenter)
1706 {
1707 }
1708 
1710 {
1711  return new XLineEndCenterItem(*this);
1712 }
1713 
1716  SfxItemPresentation /*ePres*/,
1717  MapUnit /*eCoreUnit*/,
1718  MapUnit /*ePresUnit*/,
1719  OUString& rText, const IntlWrapper&
1720 ) const
1721 {
1722  rText = SvxResId(GetValue() ? RID_SVXSTR_CENTERED : RID_SVXSTR_NOTCENTERED);
1723  return true;
1724 }
1725 
1726 bool XLineEndCenterItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1727 {
1728  bool bValue = GetValue();
1729  rVal <<= bValue;
1730  return true;
1731 }
1732 
1733 bool XLineEndCenterItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1734 {
1735  auto b = o3tl::tryAccess<bool>(rVal);
1736  if( !b )
1737  return false;
1738 
1739  SetValue( *b );
1740  return true;
1741 }
1742 
1743 // --- fill attributes ---
1744 
1745 
1747 
1749  SfxEnumItem(XATTR_FILLSTYLE, eFillStyle)
1750 {
1751 }
1752 
1754 {
1755  return new XFillStyleItem( *this );
1756 }
1757 
1760  SfxItemPresentation /*ePres*/,
1761  MapUnit /*eCoreUnit*/,
1762  MapUnit /*ePresUnit*/,
1763  OUString& rText, const IntlWrapper&
1764 ) const
1765 {
1766  rText.clear();
1767 
1768  TranslateId pId;
1769 
1770  switch( GetValue() )
1771  {
1772  case drawing::FillStyle_NONE:
1773  pId = RID_SVXSTR_INVISIBLE;
1774  break;
1775  case drawing::FillStyle_SOLID:
1776  pId = RID_SVXSTR_SOLID;
1777  break;
1778  case drawing::FillStyle_GRADIENT:
1779  pId = RID_SVXSTR_GRADIENT;
1780  break;
1781  case drawing::FillStyle_HATCH:
1782  pId = RID_SVXSTR_HATCH;
1783  break;
1784  case drawing::FillStyle_BITMAP:
1785  pId = RID_SVXSTR_BITMAP;
1786  break;
1787  default: break;
1788  }
1789 
1790  if (pId)
1791  rText = SvxResId(pId);
1792  return true;
1793 }
1794 
1796 {
1797  return 5;
1798 }
1799 
1800 bool XFillStyleItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
1801 {
1802  css::drawing::FillStyle eFS = GetValue();
1803 
1804  rVal <<= eFS;
1805 
1806  return true;
1807 }
1808 
1809 bool XFillStyleItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/)
1810 {
1811  css::drawing::FillStyle eFS;
1812  if(!(rVal >>= eFS))
1813  {
1814  // also try an int (for Basic)
1815  sal_Int32 nFS = 0;
1816  if(!(rVal >>= nFS))
1817  return false;
1818  eFS = static_cast<css::drawing::FillStyle>(nFS);
1819  }
1820 
1821  SetValue( eFS );
1822 
1823  return true;
1824 }
1825 
1827 {
1828  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("XFillStyleItem"));
1829  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1830  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::number(static_cast<sal_Int16>(GetValue())).getStr()));
1831 
1832  OUString aPresentation;
1833  IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag());
1834  GetPresentation(SfxItemPresentation::Nameless, MapUnit::Map100thMM, MapUnit::Map100thMM, aPresentation, aIntlWrapper);
1835  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(aPresentation.toUtf8().getStr()));
1836 
1837  (void)xmlTextWriterEndElement(pWriter);
1838 }
1839 
1840 boost::property_tree::ptree XFillStyleItem::dumpAsJSON() const
1841 {
1842  boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1843 
1844  if (Which() == XATTR_FILLSTYLE)
1845  aTree.put("commandName", ".uno:FillStyle");
1846 
1847  OUString sValue;
1848 
1849  switch( GetValue() )
1850  {
1851  case drawing::FillStyle_NONE:
1852  sValue = "NONE";
1853  break;
1854  case drawing::FillStyle_SOLID:
1855  sValue = "SOLID";
1856  break;
1857  case drawing::FillStyle_GRADIENT:
1858  sValue = "GRADIENT";
1859  break;
1860  case drawing::FillStyle_HATCH:
1861  sValue = "HATCH";
1862  break;
1863  case drawing::FillStyle_BITMAP:
1864  sValue = "BITMAP";
1865  break;
1866  default: break;
1867  }
1868 
1869  aTree.put("state", sValue);
1870 
1871  return aTree;
1872 }
1873 
1874 
1876 
1877 XFillColorItem::XFillColorItem(sal_Int32 nIndex, const Color& rTheColor) :
1878  XColorItem(XATTR_FILLCOLOR, nIndex, rTheColor)
1879 {
1880 }
1881 
1882 XFillColorItem::XFillColorItem(const OUString& rName, const Color& rTheColor) :
1883  XColorItem(XATTR_FILLCOLOR, rName, rTheColor)
1884 {
1885 }
1886 
1888 {
1889  return new XFillColorItem(*this);
1890 }
1891 
1894  SfxItemPresentation /*ePres*/,
1895  MapUnit /*eCoreUnit*/,
1896  MapUnit /*ePresUnit*/,
1897  OUString& rText, const IntlWrapper&
1898 ) const
1899 {
1900  rText = GetName();
1901  return true;
1902 }
1903 
1904 bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
1905 {
1906  nMemberId &= ~CONVERT_TWIPS;
1907  switch (nMemberId)
1908  {
1909  case MID_COLOR_THEME_INDEX:
1910  {
1911  rVal <<= GetThemeColor().GetThemeIndex();
1912  break;
1913  }
1914  case MID_COLOR_LUM_MOD:
1915  {
1916  rVal <<= GetThemeColor().GetLumMod();
1917  break;
1918  }
1919  case MID_COLOR_LUM_OFF:
1920  {
1921  rVal <<= GetThemeColor().GetLumOff();
1922  break;
1923  }
1924  default:
1925  {
1926  rVal <<= GetColorValue().GetRGBColor();
1927  break;
1928  }
1929  }
1930 
1931  return true;
1932 }
1933 
1934 bool XFillColorItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
1935 {
1936  nMemberId &= ~CONVERT_TWIPS;
1937  switch(nMemberId)
1938  {
1939  case MID_COLOR_THEME_INDEX:
1940  {
1941  sal_Int16 nIndex = -1;
1942  if (!(rVal >>= nIndex))
1943  return false;
1944  GetThemeColor().SetThemeIndex(nIndex);
1945  break;
1946  }
1947  case MID_COLOR_LUM_MOD:
1948  {
1949  sal_Int16 nLumMod = -1;
1950  if (!(rVal >>= nLumMod))
1951  return false;
1952  GetThemeColor().SetLumMod(nLumMod);
1953  }
1954  break;
1955  case MID_COLOR_LUM_OFF:
1956  {
1957  sal_Int16 nLumOff = -1;
1958  if (!(rVal >>= nLumOff))
1959  return false;
1960  GetThemeColor().SetLumOff(nLumOff);
1961  }
1962  break;
1963  default:
1964  {
1965  Color nValue;
1966  if(!(rVal >>= nValue ))
1967  return false;
1968 
1969  SetColorValue( nValue );
1970  break;
1971  }
1972  }
1973  return true;
1974 }
1975 
1977 {
1978  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("XFillColorItem"));
1979  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1980 
1981  XColorItem::dumpAsXml(pWriter);
1982 
1983  (void)xmlTextWriterEndElement(pWriter);
1984 }
1985 
1986 boost::property_tree::ptree XFillColorItem::dumpAsJSON() const
1987 {
1988  boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1989 
1990  if (Which() == XATTR_FILLCOLOR)
1991  aTree.put("commandName", ".uno:FillPageColor");
1992 
1993  aTree.put("state", GetColorValue().AsRGBHexString());
1994 
1995  return aTree;
1996 }
1997 
1998 XSecondaryFillColorItem::XSecondaryFillColorItem(const OUString& rName, const Color& rTheColor) :
1999  XColorItem(XATTR_SECONDARYFILLCOLOR, rName, rTheColor)
2000 {
2001 }
2002 
2004 {
2005  return new XSecondaryFillColorItem(*this);
2006 }
2007 
2010  SfxItemPresentation /*ePres*/,
2011  MapUnit /*eCoreUnit*/,
2012  MapUnit /*ePresUnit*/,
2013  OUString& rText, const IntlWrapper&
2014 ) const
2015 {
2016  rText = GetName();
2017  return true;
2018 }
2019 
2020 std::string XGradient::GradientStyleToString(css::awt::GradientStyle eStyle)
2021 {
2022  switch (eStyle)
2023  {
2024  case css::awt::GradientStyle::GradientStyle_LINEAR:
2025  return "LINEAR";
2026 
2027  case css::awt::GradientStyle::GradientStyle_AXIAL:
2028  return "AXIAL";
2029 
2030  case css::awt::GradientStyle::GradientStyle_RADIAL:
2031  return "RADIAL";
2032 
2033  case css::awt::GradientStyle::GradientStyle_ELLIPTICAL:
2034  return "ELLIPTICAL";
2035 
2036  case css::awt::GradientStyle::GradientStyle_SQUARE:
2037  return "SQUARE";
2038 
2039  case css::awt::GradientStyle::GradientStyle_RECT:
2040  return "RECT";
2041 
2042  case css::awt::GradientStyle::GradientStyle_MAKE_FIXED_SIZE:
2043  return "MAKE_FIXED_SIZE";
2044  }
2045 
2046  return "";
2047 }
2048 
2049 namespace
2050 {
2051  css::awt::GradientStyle lcl_getStyleFromString(std::u16string_view rStyle)
2052  {
2053  if (rStyle == u"LINEAR")
2054  return css::awt::GradientStyle_LINEAR;
2055  else if (rStyle == u"AXIAL")
2056  return css::awt::GradientStyle_AXIAL;
2057  else if (rStyle == u"RADIAL")
2058  return css::awt::GradientStyle_RADIAL;
2059  else if (rStyle == u"ELLIPTICAL")
2060  return css::awt::GradientStyle_ELLIPTICAL;
2061  else if (rStyle == u"SQUARE")
2062  return css::awt::GradientStyle_SQUARE;
2063  else if (rStyle == u"RECT")
2064  return css::awt::GradientStyle_RECT;
2065 
2066  return css::awt::GradientStyle_LINEAR;
2067  }
2068 
2069  StringMap lcl_jsonToStringMap(const OUString& rJSON)
2070  {
2071  StringMap aArgs;
2072  if (rJSON.getLength() && rJSON[0] != '\0')
2073  {
2074  std::stringstream aStream(OUStringToOString(rJSON, RTL_TEXTENCODING_ASCII_US).getStr());
2075  boost::property_tree::ptree aTree;
2076  boost::property_tree::read_json(aStream, aTree);
2077 
2078  for (const auto& rPair : aTree)
2079  {
2080  aArgs[OUString::fromUtf8(rPair.first.c_str())] = OUString::fromUtf8(rPair.second.get_value<std::string>(".").c_str());
2081  }
2082  }
2083  return aArgs;
2084  }
2085 
2086  XGradient lcl_buildGradientFromStringMap(StringMap& rMap)
2087  {
2088  XGradient aGradient;
2089 
2090  aGradient.SetStartColor(Color(ColorTransparency, rMap["startcolor"].toInt32(16)));
2091  aGradient.SetEndColor(Color(ColorTransparency, rMap["endcolor"].toInt32(16)));
2092  aGradient.SetGradientStyle(lcl_getStyleFromString(rMap["style"]));
2093  aGradient.SetAngle(Degree10(rMap["angle"].toInt32()));
2094 
2095  return aGradient;
2096  }
2097 }
2098 
2099 XGradient XGradient::fromJSON(const OUString& rJSON)
2100 {
2101  StringMap aMap(lcl_jsonToStringMap(rJSON));
2102  return lcl_buildGradientFromStringMap(aMap);
2103 }
2104 
2105 css::awt::Gradient XGradient::toGradientUNO() const
2106 {
2107  css::awt::Gradient aGradient;
2108 
2109  aGradient.Style = this->GetGradientStyle();
2110  aGradient.StartColor = static_cast<sal_Int32>(this->GetStartColor());
2111  aGradient.EndColor = static_cast<sal_Int32>(this->GetEndColor());
2112  aGradient.Angle = static_cast<short>(this->GetAngle());
2113  aGradient.Border = this->GetBorder();
2114  aGradient.XOffset = this->GetXOffset();
2115  aGradient.YOffset = this->GetYOffset();
2116  aGradient.StartIntensity = this->GetStartIntens();
2117  aGradient.EndIntensity = this->GetEndIntens();
2118  aGradient.StepCount = this->GetSteps();
2119 
2120  return aGradient;
2121 }
2122 
2124  eStyle( css::awt::GradientStyle_LINEAR ),
2125  aStartColor( COL_BLACK ),
2126  aEndColor( COL_WHITE ),
2127  nAngle( 0 ),
2128  nBorder( 0 ),
2129  nOfsX( 50 ),
2130  nOfsY( 50 ),
2131  nIntensStart( 100 ),
2132  nIntensEnd( 100 ),
2133  nStepCount( 0 )
2134 {
2135 }
2136 
2137 XGradient::XGradient(const Color& rStart, const Color& rEnd,
2138  css::awt::GradientStyle eTheStyle, Degree10 nTheAngle, sal_uInt16 nXOfs,
2139  sal_uInt16 nYOfs, sal_uInt16 nTheBorder,
2140  sal_uInt16 nStartIntens, sal_uInt16 nEndIntens,
2141  sal_uInt16 nSteps) :
2142  eStyle(eTheStyle),
2143  aStartColor(rStart),
2144  aEndColor(rEnd),
2145  nAngle(nTheAngle),
2146  nBorder(nTheBorder),
2147  nOfsX(nXOfs),
2148  nOfsY(nYOfs),
2149  nIntensStart(nStartIntens),
2150  nIntensEnd(nEndIntens),
2151  nStepCount(nSteps)
2152 {
2153 }
2154 
2155 bool XGradient::operator==(const XGradient& rGradient) const
2156 {
2157  return ( eStyle == rGradient.eStyle &&
2158  aStartColor == rGradient.aStartColor &&
2159  aEndColor == rGradient.aEndColor &&
2160  nAngle == rGradient.nAngle &&
2161  nBorder == rGradient.nBorder &&
2162  nOfsX == rGradient.nOfsX &&
2163  nOfsY == rGradient.nOfsY &&
2164  nIntensStart == rGradient.nIntensStart &&
2165  nIntensEnd == rGradient.nIntensEnd &&
2166  nStepCount == rGradient.nStepCount );
2167 }
2168 
2169 boost::property_tree::ptree XGradient::dumpAsJSON() const
2170 {
2171  boost::property_tree::ptree aTree;
2172 
2173  aTree.put("style", XGradient::GradientStyleToString(eStyle));
2174  aTree.put("startcolor",aStartColor.AsRGBHexString());
2175  aTree.put("endcolor", aEndColor.AsRGBHexString());
2176  aTree.put("angle", std::to_string(nAngle.get()));
2177  aTree.put("border", std::to_string(nBorder));
2178  aTree.put("x", std::to_string(nOfsX));
2179  aTree.put("y", std::to_string(nOfsY));
2180  aTree.put("intensstart", std::to_string(nIntensStart));
2181  aTree.put("intensend", std::to_string(nIntensEnd));
2182  aTree.put("stepcount", std::to_string(nStepCount));
2183 
2184  return aTree;
2185 }
2186 
2188 
2190  const XGradient& rTheGradient) :
2192  aGradient(rTheGradient)
2193 {
2194 }
2195 
2197  const XGradient& rTheGradient, TypedWhichId<XFillGradientItem> nWhich)
2198  : NameOrIndex(nWhich, rName)
2199  , aGradient(rTheGradient)
2200 {
2201 }
2202 
2204  NameOrIndex(rItem),
2205  aGradient(rItem.aGradient)
2206 {
2207 }
2208 
2211  aGradient(rTheGradient)
2212 {
2213 }
2214 
2216 {
2217  return new XFillGradientItem(*this);
2218 }
2219 
2221 {
2222  return ( NameOrIndex::operator==(rItem) &&
2223  aGradient == static_cast<const XFillGradientItem&>(rItem).aGradient );
2224 }
2225 
2226 const XGradient& XFillGradientItem::GetGradientValue() const // GetValue -> GetGradientValue
2227 {
2228  if (!IsIndex())
2229  return aGradient;
2230  // ToDo: This should fail. We never called this code with a table so this should always
2231  // have failed. Thus, I'm thinking that XFillGradientItem can't be an Index.
2232  return aGradient;
2233 }
2234 
2237  SfxItemPresentation /*ePres*/,
2238  MapUnit /*eCoreUnit*/,
2239  MapUnit /*ePresUnit*/,
2240  OUString& rText, const IntlWrapper&
2241 ) const
2242 {
2243  rText = GetName();
2244  return true;
2245 }
2246 
2247 bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
2248 {
2249  nMemberId &= ~CONVERT_TWIPS;
2250  switch ( nMemberId )
2251  {
2252  case 0:
2253  {
2254  css::awt::Gradient aGradient2;
2255 
2256  const XGradient& aXGradient = GetGradientValue();
2257  aGradient2.Style = aXGradient.GetGradientStyle();
2258  aGradient2.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor());
2259  aGradient2.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor());
2260  aGradient2.Angle = static_cast<short>(aXGradient.GetAngle());
2261  aGradient2.Border = aXGradient.GetBorder();
2262  aGradient2.XOffset = aXGradient.GetXOffset();
2263  aGradient2.YOffset = aXGradient.GetYOffset();
2264  aGradient2.StartIntensity = aXGradient.GetStartIntens();
2265  aGradient2.EndIntensity = aXGradient.GetEndIntens();
2266  aGradient2.StepCount = aXGradient.GetSteps();
2267 
2268  uno::Sequence< beans::PropertyValue > aPropSeq{
2270  comphelper::makePropertyValue("FillGradient", aGradient2)
2271  };
2272  rVal <<= aPropSeq;
2273  break;
2274  }
2275 
2276  case MID_FILLGRADIENT:
2277  {
2278  const XGradient& aXGradient = GetGradientValue();
2279  css::awt::Gradient aGradient2;
2280 
2281  aGradient2.Style = aXGradient.GetGradientStyle();
2282  aGradient2.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor());
2283  aGradient2.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor());
2284  aGradient2.Angle = static_cast<short>(aXGradient.GetAngle());
2285  aGradient2.Border = aXGradient.GetBorder();
2286  aGradient2.XOffset = aXGradient.GetXOffset();
2287  aGradient2.YOffset = aXGradient.GetYOffset();
2288  aGradient2.StartIntensity = aXGradient.GetStartIntens();
2289  aGradient2.EndIntensity = aXGradient.GetEndIntens();
2290  aGradient2.StepCount = aXGradient.GetSteps();
2291 
2292  rVal <<= aGradient2;
2293  break;
2294  }
2295 
2296  case MID_NAME:
2297  {
2298  rVal <<= SvxUnogetApiNameForItem(Which(), GetName());
2299  break;
2300  }
2301 
2302  case MID_GRADIENT_STYLE: rVal <<= static_cast<sal_Int16>(GetGradientValue().GetGradientStyle()); break;
2303  case MID_GRADIENT_STARTCOLOR: rVal <<= GetGradientValue().GetStartColor(); break;
2304  case MID_GRADIENT_ENDCOLOR: rVal <<= GetGradientValue().GetEndColor(); break;
2305  case MID_GRADIENT_ANGLE: rVal <<= static_cast<sal_Int16>(GetGradientValue().GetAngle()); break;
2306  case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break;
2307  case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break;
2308  case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break;
2310  case MID_GRADIENT_ENDINTENSITY: rVal <<= GetGradientValue().GetEndIntens(); break;
2311  case MID_GRADIENT_STEPCOUNT: rVal <<= GetGradientValue().GetSteps(); break;
2312 
2313  default: OSL_FAIL("Wrong MemberId!"); return false;
2314  }
2315 
2316  return true;
2317 }
2318 
2319 bool XFillGradientItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
2320 {
2321  nMemberId &= ~CONVERT_TWIPS;
2322 
2323  switch ( nMemberId )
2324  {
2325  case 0:
2326  {
2327  uno::Sequence< beans::PropertyValue > aPropSeq;
2328 
2329  if ( rVal >>= aPropSeq )
2330  {
2331  css::awt::Gradient aGradient2;
2332  OUString aName;
2333  bool bGradient( false );
2334  for ( const auto& rProp : std::as_const(aPropSeq) )
2335  {
2336  if ( rProp.Name == "Name" )
2337  rProp.Value >>= aName;
2338  else if ( rProp.Name == "FillGradient" )
2339  {
2340  if ( rProp.Value >>= aGradient2 )
2341  bGradient = true;
2342  }
2343  }
2344 
2345  SetName( aName );
2346  if ( bGradient )
2347  {
2348  XGradient aXGradient;
2349 
2350  aXGradient.SetGradientStyle( aGradient2.Style );
2351  aXGradient.SetStartColor( Color(ColorTransparency, aGradient2.StartColor) );
2352  aXGradient.SetEndColor( Color(ColorTransparency, aGradient2.EndColor) );
2353  aXGradient.SetAngle( Degree10(aGradient2.Angle) );
2354  aXGradient.SetBorder( aGradient2.Border );
2355  aXGradient.SetXOffset( aGradient2.XOffset );
2356  aXGradient.SetYOffset( aGradient2.YOffset );
2357  aXGradient.SetStartIntens( aGradient2.StartIntensity );
2358  aXGradient.SetEndIntens( aGradient2.EndIntensity );
2359  aXGradient.SetSteps( aGradient2.StepCount );
2360 
2361  SetGradientValue( aXGradient );
2362  }
2363 
2364  return true;
2365  }
2366 
2367  return false;
2368  }
2369 
2370  case MID_NAME:
2371  {
2372  OUString aName;
2373  if (!(rVal >>= aName ))
2374  return false;
2375  SetName( aName );
2376  break;
2377  }
2378 
2379  case MID_FILLGRADIENT:
2380  {
2381  css::awt::Gradient aGradient2;
2382  if(!(rVal >>= aGradient2))
2383  return false;
2384 
2385  XGradient aXGradient;
2386 
2387  aXGradient.SetGradientStyle( aGradient2.Style );
2388  aXGradient.SetStartColor( Color(ColorTransparency, aGradient2.StartColor) );
2389  aXGradient.SetEndColor( Color(ColorTransparency, aGradient2.EndColor) );
2390  aXGradient.SetAngle( Degree10(aGradient2.Angle) );
2391  aXGradient.SetBorder( aGradient2.Border );
2392  aXGradient.SetXOffset( aGradient2.XOffset );
2393  aXGradient.SetYOffset( aGradient2.YOffset );
2394  aXGradient.SetStartIntens( aGradient2.StartIntensity );
2395  aXGradient.SetEndIntens( aGradient2.EndIntensity );
2396  aXGradient.SetSteps( aGradient2.StepCount );
2397 
2398  SetGradientValue( aXGradient );
2399  break;
2400  }
2401 
2403  case MID_GRADIENT_ENDCOLOR:
2404  {
2405  Color nVal;
2406  if(!(rVal >>= nVal ))
2407  return false;
2408 
2409  XGradient aXGradient = GetGradientValue();
2410 
2411  if ( nMemberId == MID_GRADIENT_STARTCOLOR )
2412  aXGradient.SetStartColor( nVal );
2413  else
2414  aXGradient.SetEndColor( nVal );
2415  SetGradientValue( aXGradient );
2416  break;
2417  }
2418 
2419  case MID_GRADIENT_STYLE:
2420  case MID_GRADIENT_ANGLE:
2421  case MID_GRADIENT_BORDER:
2425  case MID_GRADIENT_XOFFSET:
2426  case MID_GRADIENT_YOFFSET:
2427  {
2428  sal_Int16 nVal = sal_Int16();
2429  if(!(rVal >>= nVal ))
2430  return false;
2431 
2432  XGradient aXGradient = GetGradientValue();
2433 
2434  switch ( nMemberId )
2435  {
2436  case MID_GRADIENT_STYLE:
2437  aXGradient.SetGradientStyle( static_cast<css::awt::GradientStyle>(nVal) ); break;
2438  case MID_GRADIENT_ANGLE:
2439  aXGradient.SetAngle( Degree10(nVal) ); break;
2440  case MID_GRADIENT_BORDER:
2441  aXGradient.SetBorder( nVal ); break;
2443  aXGradient.SetStartIntens( nVal ); break;
2445  aXGradient.SetEndIntens( nVal ); break;
2447  aXGradient.SetSteps( nVal ); break;
2448  case MID_GRADIENT_XOFFSET:
2449  aXGradient.SetXOffset( nVal ); break;
2450  case MID_GRADIENT_YOFFSET:
2451  aXGradient.SetYOffset( nVal ); break;
2452  }
2453 
2454  SetGradientValue( aXGradient );
2455  break;
2456  }
2457  }
2458 
2459  return true;
2460 }
2461 
2463 {
2464  return static_cast<const XFillGradientItem*>(p1)->GetGradientValue() == static_cast<const XFillGradientItem*>(p2)->GetGradientValue();
2465 }
2466 
2467 std::unique_ptr<XFillGradientItem> XFillGradientItem::checkForUniqueItem( SdrModel* pModel ) const
2468 {
2469  if( pModel )
2470  {
2471  const OUString aUniqueName = NameOrIndex::CheckNamedItem(
2472  this, Which(), &pModel->GetItemPool(),
2473  XFillGradientItem::CompareValueFunc, RID_SVXSTR_GRADIENT,
2475 
2476  // if the given name is not valid, replace it!
2477  if( aUniqueName != GetName() )
2478  return std::make_unique<XFillGradientItem>( aUniqueName, aGradient, TypedWhichId<XFillGradientItem>(Which()) );
2479  }
2480 
2481  return nullptr;
2482 }
2483 
2484 boost::property_tree::ptree XFillGradientItem::dumpAsJSON() const
2485 {
2486  boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
2487 
2488  if (Which() == XATTR_FILLGRADIENT)
2489  aTree.put("commandName", ".uno:FillGradient");
2490 
2491  aTree.push_back(std::make_pair("state", GetGradientValue().dumpAsJSON()));
2492 
2493  return aTree;
2494 }
2495 
2496 
2498 
2500  bEnabled( false )
2501 {
2503 }
2504 
2505 XFillFloatTransparenceItem::XFillFloatTransparenceItem(const OUString& rName, const XGradient& rGradient, bool bEnable ) :
2506  XFillGradientItem ( rName, rGradient ),
2507  bEnabled ( bEnable )
2508 {
2510 }
2511 
2513  XFillGradientItem ( rItem ),
2514  bEnabled ( rItem.bEnabled )
2515 {
2517 }
2518 
2520 : XFillGradientItem ( -1, rTheGradient ),
2521  bEnabled ( bEnable )
2522 {
2524 }
2525 
2527 {
2528  return ( NameOrIndex::operator==(rItem) ) &&
2529  ( GetGradientValue() == static_cast<const XFillGradientItem&>(rItem).GetGradientValue() ) &&
2530  ( bEnabled == static_cast<const XFillFloatTransparenceItem&>(rItem).bEnabled );
2531 }
2532 
2534 {
2535  return new XFillFloatTransparenceItem( *this );
2536 }
2537 
2538 bool XFillFloatTransparenceItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
2539 {
2540  return XFillGradientItem::QueryValue( rVal, nMemberId );
2541 }
2542 
2543 bool XFillFloatTransparenceItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
2544 {
2545  return XFillGradientItem::PutValue( rVal, nMemberId );
2546 }
2547 
2549  MapUnit eCoreUnit, MapUnit ePresUnit,
2550  OUString& rText,
2551  const IntlWrapper& rIntlWrapper ) const
2552 {
2553  return XFillGradientItem::GetPresentation( ePres, eCoreUnit, ePresUnit, rText, rIntlWrapper );
2554 }
2555 
2557 {
2558  return static_cast<const XFillFloatTransparenceItem*>(p1)->IsEnabled() == static_cast<const XFillFloatTransparenceItem*>(p2)->IsEnabled() &&
2559  static_cast<const XFillFloatTransparenceItem*>(p1)->GetGradientValue() == static_cast<const XFillFloatTransparenceItem*>(p2)->GetGradientValue();
2560 }
2561 
2562 std::unique_ptr<XFillFloatTransparenceItem> XFillFloatTransparenceItem::checkForUniqueItem( SdrModel* pModel ) const
2563 {
2564  // #85953# unique name only necessary when enabled
2565  if(IsEnabled())
2566  {
2567  if( pModel )
2568  {
2569  const OUString aUniqueName = NameOrIndex::CheckNamedItem( this,
2571  &pModel->GetItemPool(),
2573  RID_SVXSTR_TRASNGR0,
2574  XPropertyListRef() );
2575 
2576  // if the given name is not valid, replace it!
2577  if( aUniqueName != GetName() )
2578  {
2579  return std::make_unique<XFillFloatTransparenceItem>( aUniqueName, GetGradientValue(), true );
2580  }
2581  }
2582  }
2583  else
2584  {
2585  // #85953# if disabled, force name to empty string
2586  if( !GetName().isEmpty() )
2587  {
2588  return std::make_unique<XFillFloatTransparenceItem>(OUString(), GetGradientValue(), false);
2589  }
2590  }
2591 
2592  return nullptr;
2593 }
2594 
2595 boost::property_tree::ptree XFillFloatTransparenceItem::dumpAsJSON() const
2596 {
2597  boost::property_tree::ptree aTree = XFillGradientItem::dumpAsJSON();
2598  aTree.put("commandName", ".uno:FillFloatTransparence");
2599 
2600  if (!bEnabled)
2601  {
2602  boost::property_tree::ptree& rState = aTree.get_child("state");
2603  // When gradient fill is disabled, the intensity fields contain the
2604  // constant encoded percent-transparency. However we use that here to just
2605  // distinguish between 'None' and 'Solid' types and correct the 'style'
2606  // property appropriately.
2607  if (GetGradientValue().GetStartIntens() == 100)
2608  rState.put("style", "NONE");
2609  else
2610  rState.put("style", "SOLID");
2611  }
2612 
2613  return aTree;
2614 }
2615 
2616 XHatch::XHatch(const Color& rCol, css::drawing::HatchStyle eTheStyle, tools::Long nTheDistance,
2617  Degree10 nTheAngle) :
2618  eStyle(eTheStyle),
2619  aColor(rCol),
2620  nDistance(nTheDistance),
2621  nAngle(nTheAngle)
2622 {
2623 }
2624 
2625 bool XHatch::operator==(const XHatch& rHatch) const
2626 {
2627  return ( eStyle == rHatch.eStyle &&
2628  aColor == rHatch.aColor &&
2629  nDistance == rHatch.nDistance &&
2630  nAngle == rHatch.nAngle );
2631 }
2632 
2633 
2635 
2636 XFillHatchItem::XFillHatchItem(const OUString& rName,
2637  const XHatch& rTheHatch) :
2638  NameOrIndex(XATTR_FILLHATCH, rName),
2639  aHatch(rTheHatch)
2640 {
2641 }
2642 
2644  NameOrIndex(rItem),
2645  aHatch(rItem.aHatch)
2646 {
2647 }
2648 
2650 : NameOrIndex( XATTR_FILLHATCH, -1 ),
2651  aHatch(rTheHatch)
2652 {
2653 }
2654 
2656 {
2657  return new XFillHatchItem(*this);
2658 }
2659 
2660 bool XFillHatchItem::operator==(const SfxPoolItem& rItem) const
2661 {
2662  return ( NameOrIndex::operator==(rItem) &&
2663  aHatch == static_cast<const XFillHatchItem&>(rItem).aHatch );
2664 }
2665 
2668  SfxItemPresentation /*ePres*/,
2669  MapUnit /*eCoreUnit*/,
2670  MapUnit /*ePresUnit*/,
2671  OUString& rText, const IntlWrapper&
2672 ) const
2673 {
2674  rText = GetName();
2675  return true;
2676 }
2677 
2679 {
2680  return true;
2681 }
2682 
2684 {
2685  aHatch.SetDistance( BigInt::Scale( aHatch.GetDistance(), nMul, nDiv ) );
2686 }
2687 
2688 bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
2689 {
2690  nMemberId &= ~CONVERT_TWIPS;
2691 
2692  switch ( nMemberId )
2693  {
2694  case 0:
2695  {
2696  css::drawing::Hatch aUnoHatch;
2697 
2698  aUnoHatch.Style = aHatch.GetHatchStyle();
2699  aUnoHatch.Color = sal_Int32(aHatch.GetColor());
2700  aUnoHatch.Distance = aHatch.GetDistance();
2701  aUnoHatch.Angle = aHatch.GetAngle().get();
2702 
2703  uno::Sequence< beans::PropertyValue > aPropSeq{
2705  comphelper::makePropertyValue("FillHatch", aUnoHatch)
2706  };
2707  rVal <<= aPropSeq;
2708  break;
2709  }
2710 
2711  case MID_FILLHATCH:
2712  {
2713  css::drawing::Hatch aUnoHatch;
2714 
2715  aUnoHatch.Style = aHatch.GetHatchStyle();
2716  aUnoHatch.Color = sal_Int32(aHatch.GetColor());
2717  aUnoHatch.Distance = aHatch.GetDistance();
2718  aUnoHatch.Angle = aHatch.GetAngle().get();
2719  rVal <<= aUnoHatch;
2720  break;
2721  }
2722 
2723  case MID_NAME:
2724  {
2725  rVal <<= SvxUnogetApiNameForItem(Which(), GetName());
2726  break;
2727  }
2728 
2729  case MID_HATCH_STYLE:
2730  rVal <<= aHatch.GetHatchStyle(); break;
2731  case MID_HATCH_COLOR:
2732  rVal <<= aHatch.GetColor(); break;
2733  case MID_HATCH_DISTANCE:
2734  rVal <<= aHatch.GetDistance(); break;
2735  case MID_HATCH_ANGLE:
2736  rVal <<= aHatch.GetAngle().get(); break;
2737 
2738  default: OSL_FAIL("Wrong MemberId!"); return false;
2739  }
2740 
2741  return true;
2742 }
2743 
2744 bool XFillHatchItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
2745 {
2746  nMemberId &= ~CONVERT_TWIPS;
2747 
2748  switch ( nMemberId )
2749  {
2750  case 0:
2751  {
2752  uno::Sequence< beans::PropertyValue > aPropSeq;
2753  if ( rVal >>= aPropSeq )
2754  {
2755  css::drawing::Hatch aUnoHatch;
2756  OUString aName;
2757  bool bHatch( false );
2758  for ( const auto& rProp : std::as_const(aPropSeq) )
2759  {
2760  if ( rProp.Name == "Name" )
2761  rProp.Value >>= aName;
2762  else if ( rProp.Name == "FillHatch" )
2763  {
2764  if ( rProp.Value >>= aUnoHatch )
2765  bHatch = true;
2766  }
2767  }
2768 
2769  SetName( aName );
2770  if ( bHatch )
2771  {
2772  aHatch.SetHatchStyle( aUnoHatch.Style );
2773  aHatch.SetColor( Color(ColorTransparency, aUnoHatch.Color) );
2774  aHatch.SetDistance( aUnoHatch.Distance );
2775  aHatch.SetAngle( Degree10(aUnoHatch.Angle) );
2776  }
2777 
2778  return true;
2779  }
2780 
2781  return false;
2782  }
2783 
2784  case MID_FILLHATCH:
2785  {
2786  css::drawing::Hatch aUnoHatch;
2787  if(!(rVal >>= aUnoHatch))
2788  return false;
2789 
2790  aHatch.SetHatchStyle( aUnoHatch.Style );
2791  aHatch.SetColor( Color(ColorTransparency, aUnoHatch.Color) );
2792  aHatch.SetDistance( aUnoHatch.Distance );
2793  aHatch.SetAngle( Degree10(aUnoHatch.Angle) );
2794  break;
2795  }
2796 
2797  case MID_NAME:
2798  {
2799  OUString aName;
2800  if (!(rVal >>= aName ))
2801  return false;
2802  SetName( aName );
2803  break;
2804  }
2805 
2806  case MID_HATCH_STYLE:
2807  {
2808  sal_Int16 nVal = sal_Int16();
2809  if (!(rVal >>= nVal ))
2810  return false;
2811  aHatch.SetHatchStyle( static_cast<css::drawing::HatchStyle>(nVal) );
2812  break;
2813  }
2814 
2815  case MID_HATCH_COLOR:
2816  case MID_HATCH_DISTANCE:
2817  case MID_HATCH_ANGLE:
2818  {
2819  sal_Int32 nVal = 0;
2820  if (!(rVal >>= nVal ))
2821  return false;
2822 
2823  if ( nMemberId == MID_HATCH_COLOR )
2825  else if ( nMemberId == MID_HATCH_DISTANCE )
2826  aHatch.SetDistance( nVal );
2827  else
2828  aHatch.SetAngle( Degree10(nVal) );
2829  break;
2830  }
2831 
2832  default: OSL_FAIL("Wrong MemberId!"); return false;
2833  }
2834 
2835  return true;
2836 }
2837 
2839 {
2840  return static_cast<const XFillHatchItem*>(p1)->GetHatchValue() == static_cast<const XFillHatchItem*>(p2)->GetHatchValue();
2841 }
2842 
2843 std::unique_ptr<XFillHatchItem> XFillHatchItem::checkForUniqueItem( SdrModel* pModel ) const
2844 {
2845  if( pModel )
2846  {
2847  const OUString aUniqueName = NameOrIndex::CheckNamedItem(
2848  this, XATTR_FILLHATCH, &pModel->GetItemPool(),
2849  XFillHatchItem::CompareValueFunc, RID_SVXSTR_HATCH10,
2851 
2852  // if the given name is not valid, replace it!
2853  if( aUniqueName != GetName() )
2854  return std::make_unique<XFillHatchItem>( aUniqueName, aHatch );
2855  }
2856 
2857  return nullptr;
2858 }
2859 
2860 // --- form text attributes ---
2861 
2862 
2864 
2866  SfxEnumItem(XATTR_FORMTXTSTYLE, eTheStyle)
2867 {
2868 }
2869 
2871 {
2872  return new XFormTextStyleItem( *this );
2873 }
2874 
2876 {
2877  return 5;
2878 }
2879 
2880 bool XFormTextStyleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2881 {
2882  rVal <<= static_cast<sal_Int32>(GetValue());
2883  return true;
2884 }
2885 
2886 bool XFormTextStyleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2887 {
2888  sal_Int32 nValue = 0;
2889  rVal >>= nValue;
2890  SetValue(static_cast<XFormTextStyle>(nValue));
2891 
2892  return true;
2893 }
2894 
2895 
2897 
2899  SfxEnumItem(XATTR_FORMTXTADJUST, eTheAdjust)
2900 {
2901 }
2902 
2904 {
2905  return new XFormTextAdjustItem( *this );
2906 }
2907 
2909 {
2910  return 4;
2911 }
2912 
2913 bool XFormTextAdjustItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2914 {
2915  rVal <<= static_cast<sal_Int32>(GetValue());
2916  return true;
2917 }
2918 
2919 bool XFormTextAdjustItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
2920 {
2921  sal_Int32 nValue = 0;
2922  rVal >>= nValue;
2923  SetValue(static_cast<XFormTextAdjust>(nValue));
2924 
2925  return true;
2926 }
2927 
2928 
2930 
2933 {
2934 }
2935 
2937 {
2938  return new XFormTextDistanceItem(*this);
2939 }
2940 
2942 
2945 {
2946 }
2947 
2949 {
2950  return new XFormTextStartItem(*this);
2951 }
2952 
2954 
2957 {
2958 }
2959 
2961 {
2962  return new XFormTextMirrorItem(*this);
2963 }
2964 
2966 
2969 {
2970 }
2971 
2973 {
2974  return new XFormTextOutlineItem(*this);
2975 }
2976 
2978 
2980  SfxEnumItem(XATTR_FORMTXTSHADOW, eFormTextShadow)
2981 {
2982 }
2983 
2985 {
2986  return new XFormTextShadowItem( *this );
2987 }
2988 
2990 {
2991  return 3;
2992 }
2993 
2994 bool XFormTextShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const
2995 {
2996  rVal <<= static_cast<sal_Int32>(GetValue());
2997  return true;
2998 }
2999 
3000 bool XFormTextShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/)
3001 {
3002  sal_Int32 nValue = 0;
3003  rVal >>= nValue;
3004  SetValue(static_cast<XFormTextShadow>(nValue));
3005 
3006  return true;
3007 }
3008 
3009 
3011 
3013  const Color& rTheColor) :
3014  XColorItem(XATTR_FORMTXTSHDWCOLOR, rName, rTheColor)
3015 {
3016 }
3017 
3019 {
3020  return new XFormTextShadowColorItem(*this);
3021 }
3022 
3024 
3027 {
3028 }
3029 
3031 {
3032  return new XFormTextShadowXValItem(*this);
3033 }
3034 
3036 
3039 {
3040 }
3041 
3043 {
3044  return new XFormTextShadowYValItem(*this);
3045 }
3046 
3048 
3051 {
3052 }
3053 
3055 {
3056  return new XFormTextHideFormItem(*this);
3057 }
3058 
3059 // --- SetItems ---
3060 
3061 
3064  SfxSetItem( XATTRSET_LINE, std::move(pItemSet))
3065 {
3066 }
3067 
3071 {
3072 }
3073 
3075  SfxSetItem( rLineAttr )
3076 {
3077 }
3078 
3080  SfxItemPool* pItemPool) :
3081  SfxSetItem( rLineAttr, pItemPool )
3082 {
3083 }
3084 
3086 {
3087  return new XLineAttrSetItem( *this, pPool );
3088 }
3089 
3092  SfxSetItem( XATTRSET_FILL, std::move(pItemSet))
3093 {
3094 }
3095 
3099 {
3100 }
3101 
3103  SfxSetItem( rFillAttr )
3104 {
3105 }
3106 
3108  SfxItemPool* pItemPool ) :
3109  SfxSetItem( rFillAttr, pItemPool )
3110 {
3111 }
3112 
3114 {
3115  return new XFillAttrSetItem( *this, pPool );
3116 }
3117 
3118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString AsRGBHexString() const
#define MID_FILLGRADIENT
Definition: unomid.hxx:63
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:938
XLineEndWidthItem(tools::Long nWidth=LINE_END_WIDTH_DEFAULT)
Definition: xattr.cxx:1627
bool GetValue() const
constexpr TypedWhichId< XFormTextHideFormItem > XATTR_FORMTXTHIDEFORM(XATTR_TEXT_FIRST+10)
std::unique_ptr< XLineStartItem > checkForUniqueItem(SdrModel *pModel) const
this function searches in both the models pool and the styles pool for XLineStartItem and XLineEndIte...
Definition: xattr.cxx:1092
#define MID_GRADIENT_YOFFSET
Definition: unomid.hxx:70
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:313
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1600
sal_Int32 GetValue() const
virtual XFormTextMirrorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2960
XHatch()
Definition: xhatch.hxx:40
constexpr sal_uInt16 XATTR_LINE_LAST(XATTR_LINECAP)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:2919
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:638
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: xattr.cxx:1826
sal_Int32 nIndex
XFillAttrSetItem(SfxItemSet &&pItemSet)
fill attribute set item
Definition: xattr.cxx:3091
constexpr TypedWhichId< XLineEndItem > XATTR_LINEEND(XATTR_LINE_FIRST+5)
virtual SVX_DLLPRIVATE bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:2009
XLineEndCenterItem(bool bEndCenter=false)
Definition: xattr.cxx:1704
constexpr TypedWhichId< XLineEndCenterItem > XATTR_LINEENDCENTER(XATTR_LINE_FIRST+9)
void SetDotLen(double nNewDotLen)
Definition: xdash.hxx:49
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:583
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:1875
XFormTextStyle
Definition: xenum.hxx:24
constexpr TypedWhichId< XLineStartItem > XATTR_LINESTART(XATTR_LINE_FIRST+4)
void SetHatchStyle(css::drawing::HatchStyle eNewStyle)
Definition: xhatch.hxx:46
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:615
const XPropertyListRef & GetPropertyList(XPropertyListType t) const
Definition: svdmodel.hxx:527
SfxItemPool & GetPool()
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: xattr.cxx:1976
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2913
Degree10 GetAngle() const
Definition: xgrad.hxx:71
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:2236
constexpr auto toTwips(N number, Length from)
struct _xmlTextWriter * xmlTextWriterPtr
const basegfx::B2DPolyPolygon & GetLineStartValue() const
Definition: xlnstit.hxx:53
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2965
void SetValue(sal_Int32 nTheValue)
XLineStartItem(sal_Int32 nIndex=-1)
Definition: xattr.cxx:997
basegfx::B2DPolyPolygon maPolyPolygon
Definition: xlnedit.hxx:33
Degree10 nAngle
Definition: xhatch.hxx:37
virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override
Definition: xattr.cxx:631
std::string GetValue
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1031
void SetBorder(sal_uInt16 nNewBorder)
Definition: xgrad.hxx:61
#define MID_NAME
Degree10 GetAngle() const
Definition: xhatch.hxx:54
static XGradient fromJSON(const OUString &rJSON)
Definition: xattr.cxx:2099
void setClosed(bool bNew)
static bool CompareValueFunc(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xattr.cxx:880
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2247
constexpr TypedWhichId< XFormTextOutlineItem > XATTR_FORMTXTOUTLINE(XATTR_TEXT_FIRST+5)
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:995
void SetDots(sal_uInt16 nNewDots)
Definition: xdash.hxx:48
long Long
css::beans::PropertyValue makePropertyValue(const OUString &rName, T &&rValue)
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: xattr.cxx:1986
sal_Int32 toInt32(OUString const &rStr)
constexpr TypedWhichId< XLineWidthItem > XATTR_LINEWIDTH(XATTR_LINE_FIRST+2)
sal_uInt16 nIntensEnd
Definition: xgrad.hxx:42
const basegfx::B2DPolyPolygon & GetLineEndValue() const
Definition: xlnedit.hxx:53
#define MID_HATCH_STYLE
Definition: unomid.hxx:78
virtual bool HasMetrics() const override
Definition: xattr.cxx:2678
XLineStartWidthItem(tools::Long nWidth=LINE_START_WIDTH_DEFAULT)
Definition: xattr.cxx:1589
exports com.sun.star. awt
#define MID_LINEDASH_DOTS
Definition: unomid.hxx:87
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:2220
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:3023
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:3047
XFormTextStartItem(tools::Long nStart=0)
Definition: xattr.cxx:2943
boost::property_tree::ptree dumpAsJSON() const
Definition: xattr.cxx:2169
std::unique_ptr< XFillHatchItem > checkForUniqueItem(SdrModel *pModel) const
Definition: xattr.cxx:2843
double GetDotLen() const
Definition: xdash.hxx:56
void SetEndColor(const Color &rColor)
Definition: xgrad.hxx:59
constexpr sal_uInt16 XATTR_LINE_FIRST(XATTR_START)
#define MID_GRADIENT_STARTINTENSITY
Definition: unomid.hxx:71
static bool CompareValueFunc(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xattr.cxx:2838
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2497
constexpr TypedWhichId< XLineStyleItem > XATTR_LINESTYLE(XATTR_LINE_FIRST)
Color aColor
Definition: xcolit.hxx:35
bool(* SvxCompareValueFunc)(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xit.hxx:33
virtual XFormTextShadowXValItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:3030
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:1292
OUString SvxUnogetApiNameForItem(const sal_uInt16 nWhich, const OUString &rInternalName)
if the given name is a predefined name for the current language it is replaced by the corresponding a...
Definition: unoprov.cxx:2012
constexpr TypedWhichId< XLineDashItem > XATTR_LINEDASH(XATTR_LINE_FIRST+1)
constexpr TypedWhichId< XFillHatchItem > XATTR_FILLHATCH(XATTR_FILL_FIRST+3)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1638
XFormTextMirrorItem(bool bMirror=false)
Definition: xattr.cxx:2955
#define MID_GRADIENT_STARTCOLOR
Definition: unomid.hxx:65
#define MID_GRADIENT_ENDCOLOR
Definition: unomid.hxx:66
void SetThemeIndex(sal_Int16 nIndex)
sal_Int16 GetLumOff() const
bool operator==(const XHatch &rHatch) const
Definition: xattr.cxx:2625
virtual sal_uInt16 GetValueCount() const override
Definition: xattr.cxx:1795
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2187
sal_uInt16 nOfsY
Definition: xgrad.hxx:40
Color GetRGBColor() const
constexpr TypedWhichId< XFormTextDistanceItem > XATTR_FORMTXTDISTANCE(XATTR_TEXT_FIRST+2)
sal_uInt16 GetStartIntens() const
Definition: xgrad.hxx:75
virtual sal_uInt16 GetValueCount() const override
Definition: xattr.cxx:2908
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1726
virtual XFormTextDistanceItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2936
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:608
XFormTextStyleItem(XFormTextStyle=XFormTextStyle::NONE)
Definition: xattr.cxx:2865
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:2667
#define MID_LINEDASH_DASHES
Definition: unomid.hxx:89
css::drawing::DashStyle eDash
Definition: xdash.hxx:33
std::map< OUString, OUString > StringMap
XFormTextAdjustItem(XFormTextAdjust=XFormTextAdjust::Center)
Definition: xattr.cxx:2898
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1559
constexpr auto convertTwipToMm100(N n)
virtual XFormTextHideFormItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:3054
const Color & GetStartColor() const
Definition: xgrad.hxx:69
HashMap_OWString_Interface aMap
void SetColor(const Color &rColor)
Definition: xhatch.hxx:47
#define MID_HATCH_COLOR
Definition: unomid.hxx:79
std::unique_ptr< XFillFloatTransparenceItem > checkForUniqueItem(SdrModel *pModel) const
Definition: xattr.cxx:2562
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1619
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1532
virtual XLineStartCenterItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1670
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:2543
sal_uInt16 GetYOffset() const
Definition: xgrad.hxx:74
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1657
Definition: xdash.hxx:31
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2880
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:393
#define MID_GRADIENT_BORDER
Definition: unomid.hxx:68
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1042
sal_Int32 nPalIndex
Definition: xit.hxx:39
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2538
SvxThemeColor & GetThemeColor()
Definition: xcolit.hxx:54
XLineEndItem(sal_Int32 nIndex=-1)
Definition: xattr.cxx:1294
tools::Long nDistance
Definition: xhatch.hxx:36
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1694
OUString SvxUnogetInternalNameForItem(const sal_uInt16 nWhich, const OUString &rApiName)
if the given name is a predefined api name it is replaced by the predefined name for the current lang...
Definition: unoprov.cxx:2045
#define MID_COLOR_THEME_INDEX
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:346
virtual XFillFloatTransparenceItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2533
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:2526
int nCount
OUString SvxResId(TranslateId aId)
Definition: dialmgr.cxx:24
TranslateId GetMetricId(MapUnit eUnit)
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2941
std::unique_ptr< XLineDashItem > checkForUniqueItem(SdrModel *pModel) const
Definition: xattr.cxx:885
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1715
virtual XFillHatchItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2655
constexpr TypedWhichId< XColorItem > SDRATTR_SHADOWCOLOR(SDRATTR_SHADOW_FIRST+1)
sal_uInt16 nBorder
Definition: xgrad.hxx:38
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:902
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:1746
virtual NameOrIndex * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:121
#define MID_FILLHATCH
Definition: unomid.hxx:77
css::drawing::DashStyle GetDashStyle() const
Definition: xdash.hxx:54
sal_uInt16 GetDots() const
Definition: xdash.hxx:55
sal_uInt16 GetXOffset() const
Definition: xgrad.hxx:73
sal_uInt16 nIntensStart
Definition: xgrad.hxx:41
virtual OUString GetName() const override
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1676
double GetDistance() const
Definition: xdash.hxx:59
void SetColorValue(const Color &rNew)
Definition: xcolit.hxx:52
virtual XColorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:288
constexpr TypedWhichId< XLineAttrSetItem > XATTRSET_LINE(XATTR_LINE_LAST+1)
const Color & GetColorValue() const
Definition: xattr.cxx:300
constexpr TypedWhichId< XFormTextStyleItem > XATTR_FORMTXTSTYLE(XATTR_TEXT_FIRST)
virtual XLineEndCenterItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1709
sal_uInt16 nDots
Definition: xdash.hxx:34
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: xattr.cxx:322
const XHatch & GetHatchValue() const
Definition: xflhtit.hxx:55
virtual XLineEndItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1317
XFormTextShadowItem(XFormTextShadow=XFormTextShadow::NONE)
Definition: xattr.cxx:2979
#define MID_LINEDASH_DASHLEN
Definition: unomid.hxx:90
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2896
void SetEndIntens(sal_uInt16 nNewIntens)
Definition: xgrad.hxx:65
static bool CompareValueFunc(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xattr.cxx:2556
const OUString & GetName() const
void SetAngle(Degree10 nNewAngle)
Definition: xhatch.hxx:49
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1059
XFormTextShadowYValItem(tools::Long nVal=0)
Definition: xattr.cxx:3037
virtual XFillColorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1887
XLineAttrSetItem(SfxItemSet &&pItemSet)
a line attribute set item
Definition: xattr.cxx:3063
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2688
UNDERLYING_TYPE get() const
sal_uInt16 GetBorder() const
Definition: xgrad.hxx:72
SfxItemPresentation
virtual boost::property_tree::ptree dumpAsJSON() const
XHatch aHatch
Definition: xflhtit.hxx:34
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:2886
void SetStartColor(const Color &rColor)
Definition: xgrad.hxx:58
constexpr TypedWhichId< XLineStartWidthItem > XATTR_LINESTARTWIDTH(XATTR_LINE_FIRST+6)
bool isClosed() const
constexpr TypedWhichId< XFillGradientItem > XATTR_FILLGRADIENT(XATTR_FILL_FIRST+2)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:307
virtual XFormTextStyleItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2870
const XGradient & GetGradientValue() const
Definition: xattr.cxx:2226
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:3035
css::drawing::HatchStyle GetHatchStyle() const
Definition: xhatch.hxx:51
uno_Any a
void SetDistance(double nNewDistance)
Definition: xdash.hxx:52
XFormTextDistanceItem(tools::Long nDist=0)
Definition: xattr.cxx:2931
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: xattr.cxx:251
constexpr TypedWhichId< XSecondaryFillColorItem > XATTR_SECONDARYFILLCOLOR(XATTR_FILL_FIRST+12)
XGradient()
Definition: xattr.cxx:2123
constexpr TypedWhichId< XFillBitmapItem > XATTR_FILLBITMAP(XATTR_FILL_FIRST+4)
virtual XFormTextOutlineItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2972
void SetSteps(sal_uInt16 nSteps)
Definition: xgrad.hxx:66
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1904
virtual XFormTextShadowItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2984
void SetYOffset(sal_uInt16 nNewOffset)
Definition: xgrad.hxx:63
Color aStartColor
Definition: xgrad.hxx:35
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1613
XLineStyleItem(css::drawing::LineStyle=css::drawing::LineStyle_SOLID)
Definition: xattr.cxx:348
void SetGradientValue(const XGradient &rNew)
Definition: xflgrit.hxx:54
B2DPolyPolygon UnoPolyPolygonBezierCoordsToB2DPolyPolygon(const css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsSource)
XGradient aGradient
Definition: xflgrit.hxx:34
constexpr TypedWhichId< XLineEndWidthItem > XATTR_LINEENDWIDTH(XATTR_LINE_FIRST+7)
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:1025
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:3010
virtual XFormTextShadowYValItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:3042
void SetGradientStyle(css::awt::GradientStyle eNewStyle)
Definition: xgrad.hxx:57
css::awt::GradientStyle eStyle
Definition: xgrad.hxx:34
sal_uInt16 GetSteps() const
Definition: xgrad.hxx:77
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:949
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
std::unique_ptr< XFillGradientItem > checkForUniqueItem(SdrModel *pModel) const
Definition: xattr.cxx:2467
const double SMALLEST_DASH_WIDTH(26.95)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1934
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
css::awt::Gradient toGradientUNO() const
Definition: xattr.cxx:2105
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &rIntlWrapper) const override
Definition: xattr.cxx:2548
bool IsIndex() const
Definition: xit.hxx:55
virtual sal_uInt16 GetValueCount() const override
Definition: xattr.cxx:2875
XFormTextOutlineItem(bool bOutline=false)
Definition: xattr.cxx:2967
void SetDashStyle(css::drawing::DashStyle eNewStyle)
Definition: xdash.hxx:47
XFormTextHideFormItem(bool bHide=false)
Definition: xattr.cxx:3049
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:386
basegfx::B2DPolyPolygon maPolyPolygon
Definition: xlnstit.hxx:33
XFormTextShadow
Definition: xenum.hxx:26
const XDash & GetDashValue() const
Definition: xlndsit.hxx:57
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:978
virtual XLineEndWidthItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1632
ColorTransparency
double GetDashLen() const
Definition: xdash.hxx:58
constexpr TypedWhichId< XFormTextShadowXValItem > XATTR_FORMTXTSHDWXVAL(XATTR_TEXT_FIRST+8)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
rtl::Reference< class XPropertyList > XPropertyListRef
Definition: xtable.hxx:143
constexpr TypedWhichId< XFormTextShadowItem > XATTR_FORMTXTSHADOW(XATTR_TEXT_FIRST+6)
#define MID_HATCH_DISTANCE
Definition: unomid.hxx:80
sal_uInt16 nStepCount
Definition: xgrad.hxx:43
constexpr TypedWhichId< XFormTextAdjustItem > XATTR_FORMTXTADJUST(XATTR_TEXT_FIRST+1)
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:3000
double CreateDotDashArray(::std::vector< double > &rDotDashArray, double fLineWidth) const
Definition: xattr.cxx:440
#define MID_LINEDASH_DOTLEN
Definition: unomid.hxx:88
tools::Long GetDistance() const
Definition: xhatch.hxx:53
constexpr TypedWhichId< XLineStartCenterItem > XATTR_LINESTARTCENTER(XATTR_LINE_FIRST+8)
virtual sal_uInt16 GetValueCount() const override
Definition: xattr.cxx:2989
virtual XLineColorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:961
XLineStartCenterItem(bool bStartCenter=false)
Definition: xattr.cxx:1665
virtual XLineStyleItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:353
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1809
virtual void ScaleMetrics(tools::Long nMul, tools::Long nDiv) override
Definition: xattr.cxx:2683
bool operator==(const XDash &rDash) const
Definition: xattr.cxx:425
#define MID_LINEDASH
Definition: unomid.hxx:85
const Color & GetColor() const
Definition: xhatch.hxx:52
void SetValue(bool const bTheValue)
virtual XFillGradientItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2215
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1800
#define MID_COLOR_LUM_OFF
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:115
css::drawing::HatchStyle eStyle
Definition: xhatch.hxx:34
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:928
#define MID_LINEDASH_STYLE
Definition: unomid.hxx:86
tools::Long const nBorder
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:1733
void SetDashValue(const XDash &rNew)
Definition: xlndsit.hxx:58
virtual XFillAttrSetItem * Clone(SfxItemPool *pToPool=nullptr) const override
Definition: xattr.cxx:3113
#define MID_GRADIENT_ANGLE
Definition: unomid.hxx:67
XFormTextShadowXValItem(tools::Long nVal=0)
Definition: xattr.cxx:3025
void SetStartIntens(sal_uInt16 nNewIntens)
Definition: xgrad.hxx:64
css::awt::GradientStyle GetGradientStyle() const
Definition: xgrad.hxx:68
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1651
static bool CompareValueFunc(const NameOrIndex *p1, const NameOrIndex *p2)
Definition: xattr.cxx:2462
constexpr TypedWhichId< XFillColorItem > XATTR_FILLCOLOR(XATTR_FILL_FIRST+1)
void SetDashes(sal_uInt16 nNewDashes)
Definition: xdash.hxx:50
static std::string GradientStyleToString(css::awt::GradientStyle eStyle)
Definition: xattr.cxx:2020
constexpr TypedWhichId< XFillAttrSetItem > XATTRSET_FILL(XATTR_FILL_LAST+1)
void SetName(const OUString &rName)
Definition: xit.hxx:54
sal_uInt16 nOfsX
Definition: xgrad.hxx:39
constexpr TypedWhichId< XFormTextStartItem > XATTR_FORMTXTSTART(XATTR_TEXT_FIRST+3)
constexpr TypedWhichId< XFillFloatTransparenceItem > XATTR_FILLFLOATTRANSPARENCE(XATTR_FILL_FIRST+11)
sal_uInt32 count() const
virtual XFormTextAdjustItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2903
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:359
double nDistance
Definition: xdash.hxx:38
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1687
Color aColor
Definition: xhatch.hxx:35
XDash aDash
Definition: xlndsit.hxx:35
#define MID_GRADIENT_XOFFSET
Definition: unomid.hxx:69
bool operator==(const XGradient &rGradient) const
Definition: xattr.cxx:2155
virtual bool HasMetrics() const override
Definition: xattr.cxx:626
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:967
void SetLumOff(sal_Int16 nLumOff)
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:261
XLineWidthItem(tools::Long nWidth=0)
Definition: xattr.cxx:904
void SetLumMod(sal_Int16 nLumMod)
unsigned char sal_uInt8
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:915
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1759
constexpr TypedWhichId< XFormTextShadowYValItem > XATTR_FORMTXTSHDWYVAL(XATTR_TEXT_FIRST+9)
void SetXOffset(sal_uInt16 nNewOffset)
Definition: xgrad.hxx:62
SfxStyleSheetBasePool * GetStyleSheetPool() const
Definition: svdmodel.hxx:541
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: xattr.cxx:1893
eFillStyle
Definition: fillctrl.cxx:53
#define MID_GRADIENT_ENDINTENSITY
Definition: unomid.hxx:72
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_WHITE
OUString aName
void SetWhich(sal_uInt16 nId)
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: xattr.cxx:1840
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: xattr.cxx:2595
std::map< OUString, OUString > StringMap
Definition: xattr.cxx:95
double nDashLen
Definition: xdash.hxx:37
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2929
#define MID_LINEDASH_DISTANCE
Definition: unomid.hxx:91
basegfx::B2DPolyPolygon maPolyPolygon
bool IsEnabled() const
Definition: xflftrit.hxx:52
void * p
const ::std::vector< Color > ImpSvNumberformatScan::StandardColor COL_BLACK
virtual XLineWidthItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:909
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2953
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:2744
NameOrIndex()
Definition: xit.hxx:45
virtual XLineDashItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:603
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:293
virtual XLineStartWidthItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1594
static tools::Long Scale(tools::Long nVal, tools::Long nMult, tools::Long nDiv)
virtual XFormTextShadowColorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:3018
char aEntryName[20]
void SetDashLen(double nNewDashLen)
Definition: xdash.hxx:51
sal_Int16 GetThemeIndex() const
virtual XFormTextStartItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2948
OUString const & GetName() const
Definition: xit.hxx:53
MapUnit
void B2DPolyPolygonToUnoPolyPolygonBezierCoords(const B2DPolyPolygon &rPolyPolygon, css::drawing::PolyPolygonBezierCoords &rPolyPolygonBezierCoordsRetval)
#define MID_COLOR_LUM_MOD
XFillStyleItem(css::drawing::FillStyle=css::drawing::FillStyle_SOLID)
Definition: xattr.cxx:1748
const SfxItemPool & GetItemPool() const
Definition: svdmodel.hxx:317
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2634
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
XSecondaryFillColorItem(const OUString &rName, const Color &rTheColor)
Definition: xattr.cxx:1998
#define MID_HATCH_ANGLE
Definition: unomid.hxx:81
virtual sal_uInt16 GetValueCount() const override
Definition: xattr.cxx:409
detail::Optional< bool >::type tryAccess< bool >(css::uno::Any const &any)
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:1322
constexpr TypedWhichId< XFormTextMirrorItem > XATTR_FORMTXTMIRROR(XATTR_TEXT_FIRST+4)
XDash(css::drawing::DashStyle eDash=css::drawing::DashStyle_RECT, sal_uInt16 nDots=1, double nDotLen=20, sal_uInt16 nDashes=1, double nDashLen=20, double nDistance=20)
Definition: xattr.cxx:414
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:1543
Color aEndColor
Definition: xgrad.hxx:36
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2977
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:735
virtual XLineAttrSetItem * Clone(SfxItemPool *pToPool=nullptr) const override
Definition: xattr.cxx:3085
constexpr TypedWhichId< XLineColorItem > XATTR_LINECOLOR(XATTR_LINE_FIRST+3)
virtual bool operator==(const SfxPoolItem &rItem) const override
Definition: xattr.cxx:2660
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: xattr.cxx:2994
#define MID_GRADIENT_STYLE
Definition: unomid.hxx:64
sal_uInt16 GetEndIntens() const
Definition: xgrad.hxx:76
double nDotLen
Definition: xdash.hxx:36
virtual SVX_DLLPRIVATE XSecondaryFillColorItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:2003
void SetDistance(tools::Long nNewDistance)
Definition: xhatch.hxx:48
static OUString CheckNamedItem(const NameOrIndex *pCheckItem, const sal_uInt16 nWhich, const SfxItemPool *pPool1, SvxCompareValueFunc pCompareValueFunc, TranslateId pPrefixResId, const XPropertyListRef &pDefaults)
this static checks if the given NameOrIndex item has a unique name for its value. ...
Definition: xattr.cxx:131
void SetAngle(Degree10 nNewAngle)
Definition: xgrad.hxx:60
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:2319
std::unique_ptr< XLineEndItem > checkForUniqueItem(SdrModel *pModel) const
this function searches in both the models pool and the styles pool for XLineStartItem and XLineEndIte...
Definition: xattr.cxx:1331
sal_Int16 GetLumMod() const
sal_uInt16 Which() const
SvxThemeColor maThemeColor
Definition: xcolit.hxx:36
static SfxPoolItem * CreateDefault()
Definition: xattr.cxx:2863
sal_uInt16 nDashes
Definition: xdash.hxx:35
XColorItem()
Definition: xcolit.hxx:40
XFormTextAdjust
Definition: xenum.hxx:25
const Color & GetEndColor() const
Definition: xgrad.hxx:70
virtual XFillStyleItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1753
void dumpAsXml(xmlTextWriterPtr pWriter) const
constexpr TypedWhichId< XFormTextShadowColorItem > XATTR_FORMTXTSHDWCOLOR(XATTR_TEXT_FIRST+7)
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: xattr.cxx:2484
sal_Int16 nValue
Definition: fmsrccfg.cxx:81
sal_uInt16 GetDashes() const
Definition: xdash.hxx:57
#define MID_GRADIENT_STEPCOUNT
Definition: unomid.hxx:73
bool m_bDetectedRangeSegmentation false
#define CONVERT_TWIPS
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: xattr.cxx:984
Degree10 nAngle
Definition: xgrad.hxx:37
OUString EditResId(TranslateId aId)
virtual XLineStartItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: xattr.cxx:1020
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo