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