LibreOffice Module editeng (master) 1
frmitems.cxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http: // mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http: // www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include <memory>
21#include <com/sun/star/uno/Any.hxx>
22#include <com/sun/star/drawing/LineStyle.hpp>
23#include <com/sun/star/script/Converter.hpp>
24#include <com/sun/star/table/ShadowLocation.hpp>
25#include <com/sun/star/table/ShadowFormat.hpp>
26#include <com/sun/star/table/BorderLine2.hpp>
27#include <com/sun/star/table/BorderLineStyle.hpp>
28#include <com/sun/star/style/BreakType.hpp>
29#include <com/sun/star/style/GraphicLocation.hpp>
30#include <com/sun/star/awt/Size.hpp>
31#include <com/sun/star/text/WritingMode2.hpp>
32#include <com/sun/star/frame/status/UpperLowerMarginScale.hpp>
33#include <com/sun/star/frame/status/LeftRightMarginScale.hpp>
34#include <com/sun/star/drawing/ShadingPattern.hpp>
35#include <com/sun/star/graphic/XGraphic.hpp>
36#include <com/sun/star/util/XComplexColor.hpp>
37
38#include <osl/diagnose.h>
39#include <i18nutil/unicode.hxx>
42#include <utility>
43#include <vcl/GraphicObject.hxx>
44#include <tools/urlobj.hxx>
45#include <tools/bigint.hxx>
46#include <svl/memberid.h>
47#include <rtl/math.hxx>
48#include <rtl/ustring.hxx>
49#include <tools/mapunit.hxx>
51#include <vcl/graphicfilter.hxx>
52#include <vcl/settings.hxx>
53#include <vcl/svapp.hxx>
54#include <editeng/editrids.hrc>
55#include <editeng/pbinitem.hxx>
56#include <editeng/sizeitem.hxx>
57#include <editeng/lrspitem.hxx>
58#include <editeng/ulspitem.hxx>
59#include <editeng/prntitem.hxx>
60#include <editeng/opaqitem.hxx>
61#include <editeng/protitem.hxx>
62#include <editeng/shaditem.hxx>
64#include <editeng/boxitem.hxx>
66#include <editeng/keepitem.hxx>
67#include <editeng/lineitem.hxx>
68#include <editeng/brushitem.hxx>
70#include <editeng/itemtype.hxx>
71#include <editeng/eerdll.hxx>
72#include <editeng/memberids.h>
73#include <libxml/xmlwriter.h>
74#include <o3tl/enumrange.hxx>
75#include <o3tl/safeint.hxx>
76#include <sal/log.hxx>
77#include <vcl/GraphicLoader.hxx>
80
81#include <boost/property_tree/ptree.hpp>
82
83using namespace ::editeng;
84using namespace ::com::sun::star;
85using namespace ::com::sun::star::drawing;
86using namespace ::com::sun::star::table::BorderLineStyle;
87
88
101
103{
104 return new SvxPaperBinItem( *this );
105}
106
108(
110 MapUnit /*eCoreUnit*/,
111 MapUnit /*ePresUnit*/,
112 OUString& rText, const IntlWrapper&
113) const
114{
115 switch ( ePres )
116 {
117 case SfxItemPresentation::Nameless:
118 rText = OUString::number( GetValue() );
119 return true;
120
121 case SfxItemPresentation::Complete:
122 {
124
126 rText = EditResId(RID_SVXSTR_PAPERBIN_SETTINGS);
127 else
128 {
129 rText = EditResId(RID_SVXSTR_PAPERBIN) + " " + OUString::number( nValue );
130 }
131 return true;
132 }
133 //no break necessary
134 default: ; //prevent warning
135 }
136
137 return false;
138}
139
140
141SvxSizeItem::SvxSizeItem( const sal_uInt16 nId, const Size& rSize ) :
142
143 SfxPoolItem( nId ),
144
145 m_aSize( rSize )
146{
147}
148
149
150bool SvxSizeItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
151{
152 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
153 nMemberId &= ~CONVERT_TWIPS;
154
155 awt::Size aTmp(m_aSize.Width(), m_aSize.Height());
156 if( bConvert )
157 {
158 aTmp.Height = convertTwipToMm100(aTmp.Height);
159 aTmp.Width = convertTwipToMm100(aTmp.Width);
160 }
161
162 switch( nMemberId )
163 {
164 case MID_SIZE_SIZE: rVal <<= aTmp; break;
165 case MID_SIZE_WIDTH: rVal <<= aTmp.Width; break;
166 case MID_SIZE_HEIGHT: rVal <<= aTmp.Height; break;
167 default: OSL_FAIL("Wrong MemberId!"); return false;
168 }
169
170 return true;
171}
172
173
174bool SvxSizeItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
175{
176 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
177 nMemberId &= ~CONVERT_TWIPS;
178
179 switch( nMemberId )
180 {
181 case MID_SIZE_SIZE:
182 {
183 awt::Size aTmp;
184 if( rVal >>= aTmp )
185 {
186 if(bConvert)
187 {
188 aTmp.Height = o3tl::toTwips(aTmp.Height, o3tl::Length::mm100);
189 aTmp.Width = o3tl::toTwips(aTmp.Width, o3tl::Length::mm100);
190 }
191 m_aSize = Size( aTmp.Width, aTmp.Height );
192 }
193 else
194 {
195 return false;
196 }
197 }
198 break;
199 case MID_SIZE_WIDTH:
200 {
201 sal_Int32 nVal = 0;
202 if(!(rVal >>= nVal ))
203 return false;
204
205 m_aSize.setWidth( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
206 }
207 break;
208 case MID_SIZE_HEIGHT:
209 {
210 sal_Int32 nVal = 0;
211 if(!(rVal >>= nVal))
212 return true;
213
214 m_aSize.setHeight( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
215 }
216 break;
217 default: OSL_FAIL("Wrong MemberId!");
218 return false;
219 }
220 return true;
221}
222
223
224SvxSizeItem::SvxSizeItem( const sal_uInt16 nId ) :
225
227{
228}
229
230
231bool SvxSizeItem::operator==( const SfxPoolItem& rAttr ) const
232{
233 assert(SfxPoolItem::operator==(rAttr));
234
235 return ( m_aSize == static_cast<const SvxSizeItem&>( rAttr ).GetSize() );
236}
237
239{
240 return new SvxSizeItem( *this );
241}
242
244(
246 MapUnit eCoreUnit,
247 MapUnit ePresUnit,
248 OUString& rText, const IntlWrapper& rIntl
249) const
250{
251 OUString cpDelimTmp(cpDelim);
252 switch ( ePres )
253 {
254 case SfxItemPresentation::Nameless:
255 rText = GetMetricText( m_aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) +
256 cpDelimTmp +
257 GetMetricText( m_aSize.Height(), eCoreUnit, ePresUnit, &rIntl );
258 return true;
259
260 case SfxItemPresentation::Complete:
261 rText = EditResId(RID_SVXITEMS_SIZE_WIDTH) +
262 GetMetricText( m_aSize.Width(), eCoreUnit, ePresUnit, &rIntl ) +
263 " " + EditResId(GetMetricId(ePresUnit)) +
264 cpDelimTmp +
265 EditResId(RID_SVXITEMS_SIZE_HEIGHT) +
266 GetMetricText( m_aSize.Height(), eCoreUnit, ePresUnit, &rIntl ) +
267 " " + EditResId(GetMetricId(ePresUnit));
268 return true;
269 // no break necessary
270 default: ; // prevent warning
271
272 }
273 return false;
274}
275
276
278{
279 m_aSize.setWidth( BigInt::Scale( m_aSize.Width(), nMult, nDiv ) );
280 m_aSize.setHeight( BigInt::Scale( m_aSize.Height(), nMult, nDiv ) );
281}
282
283
285{
286 return true;
287}
288
289
293 , nLeftMargin(0)
294 , nRightMargin(0)
295 , m_nGutterMargin(0)
296 , m_nRightGutterMargin(0),
297 nPropFirstLineOffset( 100 ),
298 nPropLeftMargin( 100 ),
299 nPropRightMargin( 100 ),
300 bAutoFirst ( false ),
301 bExplicitZeroMarginValRight(false),
302 bExplicitZeroMarginValLeft(false)
303{
304}
305
306
308 const short nOfset,
309 const sal_uInt16 nId )
311 , nFirstLineOffset(nOfset)
312 , nLeftMargin(nLeft)
313 , nRightMargin(nRight)
314 , m_nGutterMargin(0)
315 , m_nRightGutterMargin(0),
316 nPropFirstLineOffset( 100 ),
317 nPropLeftMargin( 100 ),
318 nPropRightMargin( 100 ),
319 bAutoFirst ( false ),
320 bExplicitZeroMarginValRight(false),
321 bExplicitZeroMarginValLeft(false)
322{
323}
324
325
326bool SvxLRSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
327{
328 bool bRet = true;
329 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
330 nMemberId &= ~CONVERT_TWIPS;
331 switch( nMemberId )
332 {
333 // now all signed
334 case 0:
335 {
336 css::frame::status::LeftRightMarginScale aLRSpace;
337 aLRSpace.Left = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin);
338 aLRSpace.TextLeft = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetTextLeft()) : GetTextLeft());
339 aLRSpace.Right = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin);
340 aLRSpace.ScaleLeft = static_cast<sal_Int16>(nPropLeftMargin);
341 aLRSpace.ScaleRight = static_cast<sal_Int16>(nPropRightMargin);
342 aLRSpace.FirstLine = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nFirstLineOffset) : nFirstLineOffset);
343 aLRSpace.ScaleFirstLine = static_cast<sal_Int16>(nPropFirstLineOffset);
344 aLRSpace.AutoFirstLine = IsAutoFirst();
345 rVal <<= aLRSpace;
346 break;
347 }
348 case MID_L_MARGIN:
349 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin);
350 break;
351
352 case MID_TXT_LMARGIN :
353 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetTextLeft()) : GetTextLeft());
354 break;
355 case MID_R_MARGIN:
356 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin);
357 break;
358 case MID_L_REL_MARGIN:
359 rVal <<= static_cast<sal_Int16>(nPropLeftMargin);
360 break;
361 case MID_R_REL_MARGIN:
362 rVal <<= static_cast<sal_Int16>(nPropRightMargin);
363 break;
364
366 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nFirstLineOffset) : nFirstLineOffset);
367 break;
368
370 rVal <<= static_cast<sal_Int16>(nPropFirstLineOffset);
371 break;
372
373 case MID_FIRST_AUTO:
374 rVal <<= IsAutoFirst();
375 break;
376
378 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nGutterMargin)
380 break;
381
382 default:
383 bRet = false;
384 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
385 OSL_FAIL("unknown MemberId");
386 }
387 return bRet;
388}
389
390
391bool SvxLRSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
392{
393 bool bConvert = 0 != (nMemberId&CONVERT_TWIPS);
394 nMemberId &= ~CONVERT_TWIPS;
395 sal_Int32 nVal = 0;
396 if( nMemberId != 0 && nMemberId != MID_FIRST_AUTO &&
397 nMemberId != MID_L_REL_MARGIN && nMemberId != MID_R_REL_MARGIN)
398 if(!(rVal >>= nVal))
399 return false;
400
401 switch( nMemberId )
402 {
403 case 0:
404 {
405 css::frame::status::LeftRightMarginScale aLRSpace;
406 if(!(rVal >>= aLRSpace))
407 return false;
408
409 SetLeft( bConvert ? o3tl::toTwips(aLRSpace.Left, o3tl::Length::mm100) : aLRSpace.Left );
410 SetTextLeft( bConvert ? o3tl::toTwips(aLRSpace.TextLeft, o3tl::Length::mm100) : aLRSpace.TextLeft );
411 SetRight(bConvert ? o3tl::toTwips(aLRSpace.Right, o3tl::Length::mm100) : aLRSpace.Right);
412 nPropLeftMargin = aLRSpace.ScaleLeft;
413 nPropRightMargin = aLRSpace.ScaleRight;
414 SetTextFirstLineOffset(bConvert ? o3tl::toTwips(aLRSpace.FirstLine, o3tl::Length::mm100) : aLRSpace.FirstLine);
415 SetPropTextFirstLineOffset ( aLRSpace.ScaleFirstLine );
416 SetAutoFirst( aLRSpace.AutoFirstLine );
417 break;
418 }
419 case MID_L_MARGIN:
420 SetLeft( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
421 break;
422
423 case MID_TXT_LMARGIN :
424 SetTextLeft( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
425 break;
426
427 case MID_R_MARGIN:
428 SetRight(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
429 break;
430 case MID_L_REL_MARGIN:
431 case MID_R_REL_MARGIN:
432 {
433 sal_Int32 nRel = 0;
434 if((rVal >>= nRel) && nRel >= 0 && nRel < SAL_MAX_UINT16)
435 {
436 if(MID_L_REL_MARGIN== nMemberId)
437 nPropLeftMargin = static_cast<sal_uInt16>(nRel);
438 else
439 nPropRightMargin = static_cast<sal_uInt16>(nRel);
440 }
441 else
442 return false;
443 }
444 break;
447 break;
448
451 break;
452
453 case MID_FIRST_AUTO:
454 SetAutoFirst( Any2Bool(rVal) );
455 break;
456
458 SetGutterMargin(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
459 break;
460
461 default:
462 OSL_FAIL("unknown MemberId");
463 return false;
464 }
465 return true;
466}
467
468void SvxLeftMarginItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp)
469{
470 m_nLeftMargin = (nL * nProp) / 100;
471 m_nPropLeftMargin = nProp;
472}
473
474void SvxLRSpaceItem::SetLeft(const tools::Long nL, const sal_uInt16 nProp)
475{
476 nLeftMargin = (nL * nProp) / 100;
477 SAL_WARN_IF(nFirstLineOffset != 0, "editeng", "probably call SetTextLeft instead? looks inconsistent otherwise");
478 nPropLeftMargin = nProp;
479}
480
481void SvxRightMarginItem::SetRight(const tools::Long nR, const sal_uInt16 nProp)
482{
483 m_nRightMargin = (nR * nProp) / 100;
484 m_nPropRightMargin = nProp;
485}
486
487void SvxLRSpaceItem::SetRight(const tools::Long nR, const sal_uInt16 nProp)
488{
489 if (0 == nR)
490 {
492 }
493 nRightMargin = (nR * nProp) / 100;
494 nPropRightMargin = nProp;
495}
496
498 const short nF, const sal_uInt16 nProp)
499{
500 m_nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100);
502}
503
504void SvxLRSpaceItem::SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp)
505{
506 // note: left margin contains any negative first line offset - preserve it!
507 if (nFirstLineOffset < 0)
508 {
510 }
511 nFirstLineOffset = short((tools::Long(nF) * nProp ) / 100);
512 nPropFirstLineOffset = nProp;
513 if (nFirstLineOffset < 0)
514 {
516 }
517}
518
519#if 0
520void SvxTextLeftMarginItem::SetLeft(SvxFirstLineIndentItem const& rFirstLine,
521 const tools::Long nL, const sal_uInt16 nProp)
522{
523 m_nTextLeftMargin = (nL * nProp) / 100;
524 m_nPropLeftMargin = nProp;
525 // note: text left margin contains any negative first line offset
526 if (rFirstLine.GetTextFirstLineOffset() < 0)
527 {
529 }
530}
531#endif
532
533void SvxTextLeftMarginItem::SetTextLeft(const tools::Long nL, const sal_uInt16 nProp)
534{
535 m_nTextLeftMargin = (nL * nProp) / 100;
536 m_nPropLeftMargin = nProp;
537}
538
539void SvxLRSpaceItem::SetTextLeft(const tools::Long nL, const sal_uInt16 nProp)
540{
541 if (0 == nL)
542 {
544 }
545 auto const nTxtLeft = (nL * nProp) / 100;
546 nPropLeftMargin = nProp;
547 // note: left margin contains any negative first line offset
548 if ( 0 > nFirstLineOffset )
549 nLeftMargin = nTxtLeft + nFirstLineOffset;
550 else
551 nLeftMargin = nTxtLeft;
552}
553
555{
556 return m_nTextLeftMargin;
557}
558
560{
561 // add any negative first line offset to text left margin to get left
562 return (rFirstLine.GetTextFirstLineOffset() < 0)
565}
566
568{
569 // remove any negative first line offset from left margin to get text-left
570 return (nFirstLineOffset < 0)
572 : nLeftMargin;
573}
574
577{
578}
579
580SvxLeftMarginItem::SvxLeftMarginItem(const tools::Long nLeft, const sal_uInt16 nId)
582 , m_nLeftMargin(nLeft)
583{
584}
585
587{
588 bool bRet = true;
589 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
590 nMemberId &= ~CONVERT_TWIPS;
591 switch (nMemberId)
592 {
593 case MID_L_MARGIN:
594 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nLeftMargin) : m_nLeftMargin);
595 break;
596 case MID_L_REL_MARGIN:
597 rVal <<= static_cast<sal_Int16>(m_nPropLeftMargin);
598 break;
599 default:
600 assert(false);
601 bRet = false;
602 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
603 OSL_FAIL("unknown MemberId");
604 }
605 return bRet;
606}
607
609{
610 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
611 nMemberId &= ~CONVERT_TWIPS;
612
613 switch (nMemberId)
614 {
615 case MID_L_MARGIN:
616 {
617 sal_Int32 nVal = 0;
618 if (!(rVal >>= nVal))
619 {
620 return false;
621 }
622 SetLeft(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
623 break;
624 }
625 case MID_L_REL_MARGIN:
626 {
627 sal_Int32 nRel = 0;
628 if ((rVal >>= nRel) && nRel >= 0 && nRel < SAL_MAX_UINT16)
629 {
630 m_nPropLeftMargin = static_cast<sal_uInt16>(nRel);
631 }
632 else
633 {
634 return false;
635 }
636 }
637 break;
638 default:
639 assert(false);
640 OSL_FAIL("unknown MemberId");
641 return false;
642 }
643 return true;
644}
645
647{
648 assert(SfxPoolItem::operator==(rAttr));
649
650 const SvxLeftMarginItem& rOther = static_cast<const SvxLeftMarginItem&>(rAttr);
651
652 return (m_nLeftMargin == rOther.GetLeft()
653 && m_nPropLeftMargin == rOther.GetPropLeft());
654}
655
657{
658 return new SvxLeftMarginItem(*this);
659}
660
662(
664 MapUnit eCoreUnit,
665 MapUnit ePresUnit,
666 OUString& rText, const IntlWrapper& rIntl
667) const
668{
669 switch (ePres)
670 {
671 case SfxItemPresentation::Nameless:
672 {
673 if (100 != m_nPropLeftMargin)
674 {
676 Application::GetSettings().GetUILanguageTag());
677 }
678 else
679 {
681 eCoreUnit, ePresUnit, &rIntl);
682 }
683 return true;
684 }
685 case SfxItemPresentation::Complete:
686 {
687 rText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);
688 if (100 != m_nPropLeftMargin)
689 {
691 Application::GetSettings().GetUILanguageTag());
692 }
693 else
694 {
695 rText += GetMetricText(m_nLeftMargin, eCoreUnit, ePresUnit, &rIntl)
696 + " " + EditResId(GetMetricId(ePresUnit));
697 }
698 return true;
699 }
700 default: ; // prevent warning
701 }
702 return false;
703}
704
706{
708}
709
711{
712 return true;
713}
714
716{
717 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxLeftMarginItem"));
718 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
719 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nLeftMargin"), BAD_CAST(OString::number(m_nLeftMargin).getStr()));
720 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPropLeftMargin"), BAD_CAST(OString::number(m_nPropLeftMargin).getStr()));
721 (void)xmlTextWriterEndElement(pWriter);
722}
723
724boost::property_tree::ptree SvxLeftMarginItem::dumpAsJSON() const
725{
726 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
727
728 boost::property_tree::ptree aState;
729
730 MapUnit eTargetUnit = MapUnit::MapInch;
731
732 OUString sLeft = GetMetricText(GetLeft(),
733 MapUnit::MapTwip, eTargetUnit, nullptr);
734
735 aState.put("left", sLeft);
736 aState.put("unit", "inch");
737
738 aTree.push_back(std::make_pair("state", aState));
739
740 return aTree;
741}
742
745{
746}
747
750 , m_nTextLeftMargin(nLeft)
751{
752}
753
755{
756 bool bRet = true;
757 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
758 nMemberId &= ~CONVERT_TWIPS;
759 switch (nMemberId)
760 {
761 // tdf#154282 - return both values for the hardcoded 0 in SfxDispatchController_Impl::StateChanged
762 case 0:
763 {
764 css::frame::status::LeftRightMarginScale aLRSpace;
765 aLRSpace.TextLeft = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetTextLeft()) : GetTextLeft());
766 aLRSpace.ScaleLeft = static_cast<sal_Int16>(m_nPropLeftMargin);
767 rVal <<= aLRSpace;
768 break;
769 }
770 case MID_TXT_LMARGIN :
771 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetTextLeft()) : GetTextLeft());
772 break;
773 case MID_L_REL_MARGIN:
774 rVal <<= static_cast<sal_Int16>(m_nPropLeftMargin);
775 break;
776 default:
777 assert(false);
778 bRet = false;
779 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
780 OSL_FAIL("unknown MemberId");
781 }
782 return bRet;
783}
784
786{
787 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
788 nMemberId &= ~CONVERT_TWIPS;
789
790 switch (nMemberId)
791 {
792 case MID_TXT_LMARGIN:
793 {
794 sal_Int32 nVal = 0;
795 if (!(rVal >>= nVal))
796 {
797 return false;
798 }
799 SetTextLeft(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
800 }
801 break;
802 case MID_L_REL_MARGIN:
803 {
804 sal_Int32 nRel = 0;
805 if ((rVal >>= nRel) && nRel >= 0 && nRel < SAL_MAX_UINT16)
806 {
807 m_nPropLeftMargin = static_cast<sal_uInt16>(nRel);
808 }
809 else
810 {
811 return false;
812 }
813 }
814 break;
815 default:
816 assert(false);
817 OSL_FAIL("unknown MemberId");
818 return false;
819 }
820 return true;
821}
822
824{
825 assert(SfxPoolItem::operator==(rAttr));
826
827 const SvxTextLeftMarginItem& rOther = static_cast<const SvxTextLeftMarginItem&>(rAttr);
828
829 return (m_nTextLeftMargin == rOther.GetTextLeft()
830 && m_nPropLeftMargin == rOther.GetPropLeft());
831}
832
834{
835 return new SvxTextLeftMarginItem(*this);
836}
837
839(
841 MapUnit eCoreUnit,
842 MapUnit ePresUnit,
843 OUString& rText, const IntlWrapper& rIntl
844) const
845{
846 switch (ePres)
847 {
848 case SfxItemPresentation::Nameless:
849 {
850 if (100 != m_nPropLeftMargin)
851 {
853 Application::GetSettings().GetUILanguageTag());
854 }
855 else
856 {
858 eCoreUnit, ePresUnit, &rIntl);
859 }
860 return true;
861 }
862 case SfxItemPresentation::Complete:
863 {
864 rText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);
865 if (100 != m_nPropLeftMargin)
866 {
868 Application::GetSettings().GetUILanguageTag());
869 }
870 else
871 {
872 rText += GetMetricText(m_nTextLeftMargin, eCoreUnit, ePresUnit, &rIntl)
873 + " " + EditResId(GetMetricId(ePresUnit));
874 }
875 return true;
876 }
877 default: ; // prevent warning
878 }
879 return false;
880}
881
883{
885}
886
888{
889 return true;
890}
891
893{
894 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxTextLeftMarginItem"));
895 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
896 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nTextLeftMargin"), BAD_CAST(OString::number(m_nTextLeftMargin).getStr()));
897 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPropLeftMargin"), BAD_CAST(OString::number(m_nPropLeftMargin).getStr()));
898 (void)xmlTextWriterEndElement(pWriter);
899}
900
901boost::property_tree::ptree SvxTextLeftMarginItem::dumpAsJSON() const
902{
903 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
904
905 boost::property_tree::ptree aState;
906
907 MapUnit eTargetUnit = MapUnit::MapInch;
908
909 OUString sLeft = GetMetricText(GetTextLeft(),
910 MapUnit::MapTwip, eTargetUnit, nullptr);
911
912 aState.put("left", sLeft);
913 aState.put("unit", "inch");
914
915 aTree.push_back(std::make_pair("state", aState));
916
917 return aTree;
918}
919
922{
923}
924
925SvxFirstLineIndentItem::SvxFirstLineIndentItem(const short nFirst, const sal_uInt16 nId)
927 , m_nFirstLineOffset(nFirst)
928{
929}
930
932{
933 bool bRet = true;
934 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
935 nMemberId &= ~CONVERT_TWIPS;
936 switch (nMemberId)
937 {
939 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nFirstLineOffset) : m_nFirstLineOffset);
940 break;
942 rVal <<= static_cast<sal_Int16>(m_nPropFirstLineOffset);
943 break;
944 case MID_FIRST_AUTO:
945 rVal <<= IsAutoFirst();
946 break;
947 default:
948 assert(false);
949 bRet = false;
950 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
951 OSL_FAIL("unknown MemberId");
952 }
953 return bRet;
954}
955
957{
958 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
959 nMemberId &= ~CONVERT_TWIPS;
960
961 switch (nMemberId)
962 {
964 {
965 sal_Int32 nVal = 0;
966 if (!(rVal >>= nVal))
967 {
968 return false;
969 }
970 m_nFirstLineOffset = bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal;
972 break;
973 }
975 {
976 sal_Int32 nRel = 0;
977 if ((rVal >>= nRel) && nRel >= 0 && nRel < SAL_MAX_UINT16)
978 {
980 }
981 else
982 {
983 return false;
984 }
985 break;
986 }
987 case MID_FIRST_AUTO:
988 SetAutoFirst(Any2Bool(rVal));
989 break;
990 default:
991 assert(false);
992 OSL_FAIL("unknown MemberId");
993 return false;
994 }
995 return true;
996}
997
999{
1000 assert(SfxPoolItem::operator==(rAttr));
1001
1002 const SvxFirstLineIndentItem& rOther = static_cast<const SvxFirstLineIndentItem&>(rAttr);
1003
1004 return (m_nFirstLineOffset == rOther.GetTextFirstLineOffset()
1006 && m_bAutoFirst == rOther.IsAutoFirst());
1007}
1008
1010{
1011 return new SvxFirstLineIndentItem(*this);
1012}
1013
1015(
1016 SfxItemPresentation ePres,
1017 MapUnit eCoreUnit,
1018 MapUnit ePresUnit,
1019 OUString& rText, const IntlWrapper& rIntl
1020) const
1021{
1022 switch (ePres)
1023 {
1024 case SfxItemPresentation::Nameless:
1025 {
1026 if (100 != m_nPropFirstLineOffset)
1027 {
1029 Application::GetSettings().GetUILanguageTag());
1030 }
1031 else
1032 {
1033 rText += GetMetricText(static_cast<tools::Long>(m_nFirstLineOffset),
1034 eCoreUnit, ePresUnit, &rIntl);
1035 }
1036 return true;
1037 }
1038 case SfxItemPresentation::Complete:
1039 {
1040 rText += EditResId(RID_SVXITEMS_LRSPACE_FLINE);
1041 if (100 != m_nPropFirstLineOffset)
1042 {
1044 Application::GetSettings().GetUILanguageTag());
1045 }
1046 else
1047 {
1048 rText += GetMetricText(static_cast<tools::Long>(m_nFirstLineOffset),
1049 eCoreUnit, ePresUnit, &rIntl)
1050 + " " + EditResId(GetMetricId(ePresUnit));
1051 }
1052 return true;
1053 }
1054 default: ; // prevent warning
1055 }
1056 return false;
1057}
1058
1060{
1061 m_nFirstLineOffset = static_cast<short>(BigInt::Scale(m_nFirstLineOffset, nMult, nDiv));
1062}
1063
1065{
1066 return true;
1067}
1068
1070{
1071 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFirstLineIndentItem"));
1072 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1073 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nFirstLineOffset"), BAD_CAST(OString::number(m_nFirstLineOffset).getStr()));
1074 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPropFirstLineOffset"), BAD_CAST(OString::number(m_nPropFirstLineOffset).getStr()));
1075 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_bAutoFirst"), BAD_CAST(OString::number(int(m_bAutoFirst)).getStr()));
1076 (void)xmlTextWriterEndElement(pWriter);
1077}
1078
1079boost::property_tree::ptree SvxFirstLineIndentItem::dumpAsJSON() const
1080{
1081 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1082
1083 boost::property_tree::ptree aState;
1084
1085 MapUnit eTargetUnit = MapUnit::MapInch;
1086
1087 OUString sFirstline = GetMetricText(GetTextFirstLineOffset(),
1088 MapUnit::MapTwip, eTargetUnit, nullptr);
1089
1090 aState.put("firstline", sFirstline);
1091 aState.put("unit", "inch");
1092
1093 aTree.push_back(std::make_pair("state", aState));
1094
1095 return aTree;
1096}
1097
1099 : SfxPoolItem(nId)
1100{
1101}
1102
1103SvxRightMarginItem::SvxRightMarginItem(const tools::Long nRight, const sal_uInt16 nId)
1104 : SfxPoolItem(nId)
1105 , m_nRightMargin(nRight)
1106{
1107}
1108
1110{
1111 bool bRet = true;
1112 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1113 nMemberId &= ~CONVERT_TWIPS;
1114 switch (nMemberId)
1115 {
1116 // tdf#154282 - return both values for the hardcoded 0 in SfxDispatchController_Impl::StateChanged
1117 case 0:
1118 {
1119 css::frame::status::LeftRightMarginScale aLRSpace;
1120 aLRSpace.Right = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nRightMargin) : m_nRightMargin);
1121 aLRSpace.ScaleRight = static_cast<sal_Int16>(m_nPropRightMargin);
1122 rVal <<= aLRSpace;
1123 break;
1124 }
1125 case MID_R_MARGIN:
1126 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nRightMargin) : m_nRightMargin);
1127 break;
1128 case MID_R_REL_MARGIN:
1129 rVal <<= static_cast<sal_Int16>(m_nPropRightMargin);
1130 break;
1131 default:
1132 assert(false);
1133 bRet = false;
1134 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
1135 OSL_FAIL("unknown MemberId");
1136 }
1137 return bRet;
1138}
1139
1141{
1142 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1143 nMemberId &= ~CONVERT_TWIPS;
1144
1145 switch (nMemberId)
1146 {
1147 case MID_R_MARGIN:
1148 {
1149 sal_Int32 nVal = 0;
1150 if (!(rVal >>= nVal))
1151 {
1152 return false;
1153 }
1154 SetRight(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
1155 break;
1156 }
1157 case MID_R_REL_MARGIN:
1158 {
1159 sal_Int32 nRel = 0;
1160 if ((rVal >>= nRel) && nRel >= 0 && nRel < SAL_MAX_UINT16)
1161 {
1162 m_nPropRightMargin = static_cast<sal_uInt16>(nRel);
1163 }
1164 else
1165 {
1166 return false;
1167 }
1168 }
1169 break;
1170 default:
1171 assert(false);
1172 OSL_FAIL("unknown MemberId");
1173 return false;
1174 }
1175 return true;
1176}
1177
1179{
1180 assert(SfxPoolItem::operator==(rAttr));
1181
1182 const SvxRightMarginItem& rOther = static_cast<const SvxRightMarginItem&>(rAttr);
1183
1184 return (m_nRightMargin == rOther.GetRight()
1185 && m_nPropRightMargin == rOther.GetPropRight());
1186}
1187
1189{
1190 return new SvxRightMarginItem(*this);
1191}
1192
1194(
1195 SfxItemPresentation ePres,
1196 MapUnit eCoreUnit,
1197 MapUnit ePresUnit,
1198 OUString& rText, const IntlWrapper& rIntl
1199) const
1200{
1201 switch (ePres)
1202 {
1203 case SfxItemPresentation::Nameless:
1204 {
1205 if (100 != m_nRightMargin)
1206 {
1208 Application::GetSettings().GetUILanguageTag());
1209 }
1210 else
1211 {
1213 eCoreUnit, ePresUnit, &rIntl);
1214 }
1215 return true;
1216 }
1217 case SfxItemPresentation::Complete:
1218 {
1219 rText += EditResId(RID_SVXITEMS_LRSPACE_RIGHT);
1220 if (100 != m_nPropRightMargin)
1221 {
1223 Application::GetSettings().GetUILanguageTag());
1224 }
1225 else
1226 {
1228 eCoreUnit, ePresUnit, &rIntl)
1229 + " " + EditResId(GetMetricId(ePresUnit));
1230 }
1231 return true;
1232 }
1233 default: ; // prevent warning
1234 }
1235 return false;
1236}
1237
1239{
1241}
1242
1244{
1245 return true;
1246}
1247
1249{
1250 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxRightMarginItem"));
1251 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1252 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nRightMargin"), BAD_CAST(OString::number(m_nRightMargin).getStr()));
1253 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nPropRightMargin"), BAD_CAST(OString::number(m_nPropRightMargin).getStr()));
1254 (void)xmlTextWriterEndElement(pWriter);
1255}
1256
1257boost::property_tree::ptree SvxRightMarginItem::dumpAsJSON() const
1258{
1259 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1260
1261 boost::property_tree::ptree aState;
1262
1263 MapUnit eTargetUnit = MapUnit::MapInch;
1264
1265 OUString sRight = GetMetricText(GetRight(),
1266 MapUnit::MapTwip, eTargetUnit, nullptr);
1267
1268 aState.put("right", sRight);
1269 aState.put("unit", "inch");
1270
1271 aTree.push_back(std::make_pair("state", aState));
1272
1273 return aTree;
1274}
1275
1277 : SfxPoolItem(nId)
1278{
1279}
1280
1282{
1283 bool bRet = true;
1284 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1285 nMemberId &= ~CONVERT_TWIPS;
1286 switch (nMemberId)
1287 {
1288 case MID_GUTTER_MARGIN:
1289 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(m_nGutterMargin)
1290 : m_nGutterMargin);
1291 break;
1292 default:
1293 assert(false);
1294 bRet = false;
1295 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
1296 OSL_FAIL("unknown MemberId");
1297 }
1298 return bRet;
1299}
1300
1302{
1303 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1304 nMemberId &= ~CONVERT_TWIPS;
1305
1306 switch (nMemberId)
1307 {
1308 case MID_GUTTER_MARGIN:
1309 {
1310 sal_Int32 nVal = 0;
1311 if (!(rVal >>= nVal))
1312 {
1313 return false;
1314 }
1315 SetGutterMargin(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
1316 break;
1317 }
1318 default:
1319 assert(false);
1320 OSL_FAIL("unknown MemberId");
1321 return false;
1322 }
1323 return true;
1324}
1325
1327{
1328 assert(SfxPoolItem::operator==(rAttr));
1329
1330 const SvxGutterLeftMarginItem& rOther = static_cast<const SvxGutterLeftMarginItem&>(rAttr);
1331
1332 return (m_nGutterMargin == rOther.GetGutterMargin());
1333}
1334
1336{
1337 return new SvxGutterLeftMarginItem(*this);
1338}
1339
1341(
1342 SfxItemPresentation /*ePres*/,
1343 MapUnit /*eCoreUnit*/,
1344 MapUnit /*ePresUnit*/,
1345 OUString& /*rText*/, const IntlWrapper& /*rIntl*/
1346) const
1347{
1348 // TODO?
1349 return false;
1350}
1351
1353{
1354 // TODO?
1355}
1356
1358{
1359 return true;
1360}
1361
1363{
1364 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxGutterLeftMarginItem"));
1365 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1366 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
1367 BAD_CAST(OString::number(m_nGutterMargin).getStr()));
1368 (void)xmlTextWriterEndElement(pWriter);
1369}
1370
1371boost::property_tree::ptree SvxGutterLeftMarginItem::dumpAsJSON() const
1372{
1373 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1374
1375 boost::property_tree::ptree aState;
1376
1377 // TODO?
1378 aState.put("unit", "inch");
1379
1380 aTree.push_back(std::make_pair("state", aState));
1381
1382 return aTree;
1383}
1384
1386 : SfxPoolItem(nId)
1387{
1388}
1389
1391{
1392 bool bRet = true;
1393 //bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1394 nMemberId &= ~CONVERT_TWIPS;
1395#ifndef _MSC_VER
1396 switch (nMemberId)
1397 {
1398 // TODO?
1399 default:
1400 assert(false);
1401 bRet = false;
1402 // SfxDispatchController_Impl::StateChanged calls this with hardcoded 0 triggering this; there used to be a MID_LR_MARGIN 0 but what type would it have?
1403 OSL_FAIL("unknown MemberId");
1404 }
1405#else
1406 (void) nMemberId;
1407#endif
1408 return bRet;
1409}
1410
1412{
1413 //bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
1414 nMemberId &= ~CONVERT_TWIPS;
1415
1416#ifndef _MSC_VER
1417 switch (nMemberId)
1418 {
1419 // TODO?
1420 default:
1421 assert(false);
1422 OSL_FAIL("unknown MemberId");
1423 return false;
1424 }
1425#else
1426 (void) nMemberId;
1427#endif
1428 return true;
1429}
1430
1431
1433{
1434 assert(SfxPoolItem::operator==(rAttr));
1435
1436 const SvxGutterRightMarginItem& rOther = static_cast<const SvxGutterRightMarginItem&>(rAttr);
1437
1438 return (m_nRightGutterMargin == rOther.GetRightGutterMargin());
1439}
1440
1442{
1443 return new SvxGutterRightMarginItem(*this);
1444}
1445
1447(
1448 SfxItemPresentation /*ePres*/,
1449 MapUnit /*eCoreUnit*/,
1450 MapUnit /*ePresUnit*/,
1451 OUString& /*rText*/, const IntlWrapper& /*rIntl*/
1452) const
1453{
1454 // TODO?
1455 return false;
1456}
1457
1459{
1460 // TODO?
1461}
1462
1464{
1465 return true;
1466}
1467
1469{
1470 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxGutterRightMarginItem"));
1471 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1472 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nRightGutterMargin"),
1473 BAD_CAST(OString::number(m_nRightGutterMargin).getStr()));
1474 (void)xmlTextWriterEndElement(pWriter);
1475}
1476
1477boost::property_tree::ptree SvxGutterRightMarginItem::dumpAsJSON() const
1478{
1479 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1480
1481 boost::property_tree::ptree aState;
1482
1483 // TODO?
1484 aState.put("unit", "inch");
1485
1486 aTree.push_back(std::make_pair("state", aState));
1487
1488 return aTree;
1489}
1490
1491
1492bool SvxLRSpaceItem::operator==( const SfxPoolItem& rAttr ) const
1493{
1494 assert(SfxPoolItem::operator==(rAttr));
1495
1496 const SvxLRSpaceItem& rOther = static_cast<const SvxLRSpaceItem&>(rAttr);
1497
1498 return (
1500 m_nGutterMargin == rOther.GetGutterMargin() &&
1502 nLeftMargin == rOther.GetLeft() &&
1503 nRightMargin == rOther.GetRight() &&
1505 nPropLeftMargin == rOther.GetPropLeft() &&
1506 nPropRightMargin == rOther.GetPropRight() &&
1507 bAutoFirst == rOther.IsAutoFirst() &&
1510}
1511
1513{
1514 return new SvxLRSpaceItem( *this );
1515}
1516
1518(
1519 SfxItemPresentation ePres,
1520 MapUnit eCoreUnit,
1521 MapUnit ePresUnit,
1522 OUString& rText, const IntlWrapper& rIntl
1523) const
1524{
1525 switch ( ePres )
1526 {
1527 case SfxItemPresentation::Nameless:
1528 {
1529 if ( 100 != nPropLeftMargin )
1530 {
1532 Application::GetSettings().GetUILanguageTag());
1533 }
1534 else
1535 rText = GetMetricText( nLeftMargin,
1536 eCoreUnit, ePresUnit, &rIntl );
1537 rText += cpDelim;
1538 if ( 100 != nPropFirstLineOffset )
1539 {
1541 Application::GetSettings().GetUILanguageTag());
1542 }
1543 else
1544 rText += GetMetricText( static_cast<tools::Long>(nFirstLineOffset),
1545 eCoreUnit, ePresUnit, &rIntl );
1546 rText += cpDelim;
1547 if ( 100 != nRightMargin )
1548 {
1550 Application::GetSettings().GetUILanguageTag());
1551 }
1552 else
1553 rText += GetMetricText( nRightMargin,
1554 eCoreUnit, ePresUnit, &rIntl );
1555 return true;
1556 }
1557 case SfxItemPresentation::Complete:
1558 {
1559 rText = EditResId(RID_SVXITEMS_LRSPACE_LEFT);
1560 if ( 100 != nPropLeftMargin )
1562 Application::GetSettings().GetUILanguageTag());
1563 else
1564 {
1565 rText += GetMetricText( nLeftMargin, eCoreUnit, ePresUnit, &rIntl ) +
1566 " " + EditResId(GetMetricId(ePresUnit));
1567 }
1568 rText += cpDelim;
1569 if ( 100 != nPropFirstLineOffset || nFirstLineOffset )
1570 {
1571 rText += EditResId(RID_SVXITEMS_LRSPACE_FLINE);
1572 if ( 100 != nPropFirstLineOffset )
1574 Application::GetSettings().GetUILanguageTag());
1575 else
1576 {
1577 rText += GetMetricText( static_cast<tools::Long>(nFirstLineOffset),
1578 eCoreUnit, ePresUnit, &rIntl ) +
1579 " " + EditResId(GetMetricId(ePresUnit));
1580 }
1581 rText += cpDelim;
1582 }
1583 rText += EditResId(RID_SVXITEMS_LRSPACE_RIGHT);
1584 if ( 100 != nPropRightMargin )
1586 Application::GetSettings().GetUILanguageTag());
1587 else
1588 {
1589 rText += GetMetricText( nRightMargin,
1590 eCoreUnit, ePresUnit, &rIntl ) +
1591 " " + EditResId(GetMetricId(ePresUnit));
1592 }
1593 return true;
1594 }
1595 default: ; // prevent warning
1596 }
1597 return false;
1598}
1599
1600
1602{
1603 nFirstLineOffset = static_cast<short>(BigInt::Scale( nFirstLineOffset, nMult, nDiv ));
1604 nLeftMargin = BigInt::Scale( nLeftMargin, nMult, nDiv );
1605 nRightMargin = BigInt::Scale( nRightMargin, nMult, nDiv );
1606}
1607
1608
1610{
1611 return true;
1612}
1613
1614
1616{
1617 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxLRSpaceItem"));
1618 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1619 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nFirstLineOffset"), BAD_CAST(OString::number(nFirstLineOffset).getStr()));
1620 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLeftMargin"), BAD_CAST(OString::number(nLeftMargin).getStr()));
1621 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nRightMargin"), BAD_CAST(OString::number(nRightMargin).getStr()));
1622 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nGutterMargin"),
1623 BAD_CAST(OString::number(m_nGutterMargin).getStr()));
1624 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nRightGutterMargin"),
1625 BAD_CAST(OString::number(m_nRightGutterMargin).getStr()));
1626 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropFirstLineOffset"), BAD_CAST(OString::number(nPropFirstLineOffset).getStr()));
1627 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropLeftMargin"), BAD_CAST(OString::number(nPropLeftMargin).getStr()));
1628 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropRightMargin"), BAD_CAST(OString::number(nPropRightMargin).getStr()));
1629 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bAutoFirst"), BAD_CAST(OString::number(int(bAutoFirst)).getStr()));
1630 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bExplicitZeroMarginValRight"), BAD_CAST(OString::number(int(bExplicitZeroMarginValRight)).getStr()));
1631 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bExplicitZeroMarginValLeft"), BAD_CAST(OString::number(int(bExplicitZeroMarginValLeft)).getStr()));
1632 (void)xmlTextWriterEndElement(pWriter);
1633}
1634
1635
1636boost::property_tree::ptree SvxLRSpaceItem::dumpAsJSON() const
1637{
1638 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1639
1640 boost::property_tree::ptree aState;
1641
1642 MapUnit eTargetUnit = MapUnit::MapInch;
1643
1644 OUString sLeft = GetMetricText(GetLeft(),
1645 MapUnit::MapTwip, eTargetUnit, nullptr);
1646
1647 OUString sRight = GetMetricText(GetRight(),
1648 MapUnit::MapTwip, eTargetUnit, nullptr);
1649
1650 OUString sFirstline = GetMetricText(GetTextFirstLineOffset(),
1651 MapUnit::MapTwip, eTargetUnit, nullptr);
1652
1653 aState.put("left", sLeft);
1654 aState.put("right", sRight);
1655 aState.put("firstline", sFirstline);
1656 aState.put("unit", "inch");
1657
1658 aTree.push_back(std::make_pair("state", aState));
1659
1660 return aTree;
1661}
1662
1663
1664SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nId )
1665 : SfxPoolItem(nId)
1666 , nUpper(0)
1667 , nLower(0)
1668 , bContext(false)
1669 , nPropUpper(100)
1670 , nPropLower(100)
1671{
1672}
1673
1674
1675SvxULSpaceItem::SvxULSpaceItem( const sal_uInt16 nUp, const sal_uInt16 nLow,
1676 const sal_uInt16 nId )
1677 : SfxPoolItem(nId)
1678 , nUpper(nUp)
1679 , nLower(nLow)
1680 , bContext(false)
1681 , nPropUpper(100)
1682 , nPropLower(100)
1683{
1684}
1685
1686
1687bool SvxULSpaceItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1688{
1689 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1690 nMemberId &= ~CONVERT_TWIPS;
1691 switch( nMemberId )
1692 {
1693 // now all signed
1694 case 0:
1695 {
1696 css::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
1697 aUpperLowerMarginScale.Upper = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nUpper) : nUpper);
1698 aUpperLowerMarginScale.Lower = static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nLower) : nPropUpper);
1699 aUpperLowerMarginScale.ScaleUpper = static_cast<sal_Int16>(nPropUpper);
1700 aUpperLowerMarginScale.ScaleLower = static_cast<sal_Int16>(nPropLower);
1701 rVal <<= aUpperLowerMarginScale;
1702 break;
1703 }
1704 case MID_UP_MARGIN: rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nUpper) : nUpper); break;
1705 case MID_LO_MARGIN: rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nLower) : nLower); break;
1706 case MID_CTX_MARGIN: rVal <<= bContext; break;
1707 case MID_UP_REL_MARGIN: rVal <<= static_cast<sal_Int16>(nPropUpper); break;
1708 case MID_LO_REL_MARGIN: rVal <<= static_cast<sal_Int16>(nPropLower); break;
1709 }
1710 return true;
1711}
1712
1713
1714bool SvxULSpaceItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1715{
1716 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
1717 nMemberId &= ~CONVERT_TWIPS;
1718 sal_Int32 nVal = 0;
1719 bool bVal = false;
1720 switch( nMemberId )
1721 {
1722 case 0:
1723 {
1724 css::frame::status::UpperLowerMarginScale aUpperLowerMarginScale;
1725 if ( !(rVal >>= aUpperLowerMarginScale ))
1726 return false;
1727 {
1728 SetUpper(bConvert ? o3tl::toTwips(aUpperLowerMarginScale.Upper, o3tl::Length::mm100) : aUpperLowerMarginScale.Upper);
1729 SetLower(bConvert ? o3tl::toTwips(aUpperLowerMarginScale.Lower, o3tl::Length::mm100) : aUpperLowerMarginScale.Lower);
1730 if( aUpperLowerMarginScale.ScaleUpper > 1 )
1731 nPropUpper = aUpperLowerMarginScale.ScaleUpper;
1732 if( aUpperLowerMarginScale.ScaleLower > 1 )
1733 nPropUpper = aUpperLowerMarginScale.ScaleLower;
1734 }
1735 }
1736 break;
1737 case MID_UP_MARGIN :
1738 if(!(rVal >>= nVal))
1739 return false;
1740 SetUpper(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
1741 break;
1742 case MID_LO_MARGIN :
1743 if(!(rVal >>= nVal) || nVal < 0)
1744 return false;
1745 SetLower(bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal);
1746 break;
1747 case MID_CTX_MARGIN :
1748 if (!(rVal >>= bVal))
1749 return false;
1750 SetContextValue(bVal);
1751 break;
1752 case MID_UP_REL_MARGIN:
1753 case MID_LO_REL_MARGIN:
1754 {
1755 sal_Int32 nRel = 0;
1756 if((rVal >>= nRel) && nRel > 1 )
1757 {
1758 if(MID_UP_REL_MARGIN == nMemberId)
1759 nPropUpper = static_cast<sal_uInt16>(nRel);
1760 else
1761 nPropLower = static_cast<sal_uInt16>(nRel);
1762 }
1763 else
1764 return false;
1765 }
1766 break;
1767
1768 default:
1769 OSL_FAIL("unknown MemberId");
1770 return false;
1771 }
1772 return true;
1773}
1774
1775
1776bool SvxULSpaceItem::operator==( const SfxPoolItem& rAttr ) const
1777{
1778 assert(SfxPoolItem::operator==(rAttr));
1779
1780 const SvxULSpaceItem& rSpaceItem = static_cast<const SvxULSpaceItem&>( rAttr );
1781 return ( nUpper == rSpaceItem.nUpper &&
1782 nLower == rSpaceItem.nLower &&
1783 bContext == rSpaceItem.bContext &&
1784 nPropUpper == rSpaceItem.nPropUpper &&
1785 nPropLower == rSpaceItem.nPropLower );
1786}
1787
1789{
1790 return new SvxULSpaceItem( *this );
1791}
1792
1794(
1795 SfxItemPresentation ePres,
1796 MapUnit eCoreUnit,
1797 MapUnit ePresUnit,
1798 OUString& rText,
1799 const IntlWrapper& rIntl
1800) const
1801{
1802 switch ( ePres )
1803 {
1804 case SfxItemPresentation::Nameless:
1805 {
1806 if ( 100 != nPropUpper )
1807 {
1809 Application::GetSettings().GetUILanguageTag());
1810 }
1811 else
1812 rText = GetMetricText( static_cast<tools::Long>(nUpper), eCoreUnit, ePresUnit, &rIntl );
1813 rText += cpDelim;
1814 if ( 100 != nPropLower )
1815 {
1817 Application::GetSettings().GetUILanguageTag());
1818 }
1819 else
1820 rText += GetMetricText( static_cast<tools::Long>(nLower), eCoreUnit, ePresUnit, &rIntl );
1821 return true;
1822 }
1823 case SfxItemPresentation::Complete:
1824 {
1825 rText = EditResId(RID_SVXITEMS_ULSPACE_UPPER);
1826 if ( 100 != nPropUpper )
1827 {
1829 Application::GetSettings().GetUILanguageTag());
1830 }
1831 else
1832 {
1833 rText += GetMetricText( static_cast<tools::Long>(nUpper), eCoreUnit, ePresUnit, &rIntl ) +
1834 " " + EditResId(GetMetricId(ePresUnit));
1835 }
1836 rText += cpDelim + EditResId(RID_SVXITEMS_ULSPACE_LOWER);
1837 if ( 100 != nPropLower )
1838 {
1840 Application::GetSettings().GetUILanguageTag());
1841 }
1842 else
1843 {
1844 rText += GetMetricText( static_cast<tools::Long>(nLower), eCoreUnit, ePresUnit, &rIntl ) +
1845 " " + EditResId(GetMetricId(ePresUnit));
1846 }
1847 return true;
1848 }
1849 default: ; // prevent warning
1850 }
1851 return false;
1852}
1853
1854
1856{
1857 nUpper = static_cast<sal_uInt16>(BigInt::Scale( nUpper, nMult, nDiv ));
1858 nLower = static_cast<sal_uInt16>(BigInt::Scale( nLower, nMult, nDiv ));
1859}
1860
1861
1863{
1864 return true;
1865}
1866
1867
1869{
1870 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxULSpaceItem"));
1871 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
1872 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nUpper"), BAD_CAST(OString::number(nUpper).getStr()));
1873 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nLower"), BAD_CAST(OString::number(nLower).getStr()));
1874 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bContext"), BAD_CAST(OString::boolean(bContext).getStr()));
1875 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropUpper"), BAD_CAST(OString::number(nPropUpper).getStr()));
1876 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nPropLower"), BAD_CAST(OString::number(nPropLower).getStr()));
1877 (void)xmlTextWriterEndElement(pWriter);
1878}
1879
1880boost::property_tree::ptree SvxULSpaceItem::dumpAsJSON() const
1881{
1882 boost::property_tree::ptree aTree = SfxPoolItem::dumpAsJSON();
1883
1884 boost::property_tree::ptree aState;
1885
1886 MapUnit eTargetUnit = MapUnit::MapInch;
1887
1888 OUString sUpper = GetMetricText(GetUpper(),
1889 MapUnit::MapTwip, eTargetUnit, nullptr);
1890
1891 OUString sLower = GetMetricText(GetLower(),
1892 MapUnit::MapTwip, eTargetUnit, nullptr);
1893
1894 aState.put("upper", sUpper);
1895 aState.put("lower", sLower);
1896 aState.put("unit", "inch");
1897
1898 aTree.push_back(std::make_pair("state", aState));
1899
1900 return aTree;
1901}
1902
1904{
1905 return new SvxPrintItem( *this );
1906}
1907
1909(
1910 SfxItemPresentation /*ePres*/,
1911 MapUnit /*eCoreUnit*/,
1912 MapUnit /*ePresUnit*/,
1913 OUString& rText, const IntlWrapper&
1914) const
1915{
1916 TranslateId pId = RID_SVXITEMS_PRINT_FALSE;
1917
1918 if ( GetValue() )
1919 pId = RID_SVXITEMS_PRINT_TRUE;
1920 rText = EditResId(pId);
1921 return true;
1922}
1923
1925{
1926 return new SvxOpaqueItem( *this );
1927}
1928
1930(
1931 SfxItemPresentation /*ePres*/,
1932 MapUnit /*eCoreUnit*/,
1933 MapUnit /*ePresUnit*/,
1934 OUString& rText, const IntlWrapper&
1935) const
1936{
1937 TranslateId pId = RID_SVXITEMS_OPAQUE_FALSE;
1938
1939 if ( GetValue() )
1940 pId = RID_SVXITEMS_OPAQUE_TRUE;
1941 rText = EditResId(pId);
1942 return true;
1943}
1944
1945
1946bool SvxProtectItem::operator==( const SfxPoolItem& rAttr ) const
1947{
1948 assert(SfxPoolItem::operator==(rAttr));
1949
1950 const SvxProtectItem& rItem = static_cast<const SvxProtectItem&>(rAttr);
1951 return ( bCntnt == rItem.bCntnt &&
1952 bSize == rItem.bSize &&
1953 bPos == rItem.bPos );
1954}
1955
1956
1957bool SvxProtectItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
1958{
1959 nMemberId &= ~CONVERT_TWIPS;
1960 bool bValue;
1961 switch(nMemberId)
1962 {
1963 case MID_PROTECT_CONTENT : bValue = bCntnt; break;
1964 case MID_PROTECT_SIZE : bValue = bSize; break;
1965 case MID_PROTECT_POSITION: bValue = bPos; break;
1966 default:
1967 OSL_FAIL("Wrong MemberId");
1968 return false;
1969 }
1970
1971 rVal <<= bValue;
1972 return true;
1973}
1974
1975
1976bool SvxProtectItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
1977{
1978 nMemberId &= ~CONVERT_TWIPS;
1979 bool bVal( Any2Bool(rVal) );
1980 switch(nMemberId)
1981 {
1982 case MID_PROTECT_CONTENT : bCntnt = bVal; break;
1983 case MID_PROTECT_SIZE : bSize = bVal; break;
1984 case MID_PROTECT_POSITION: bPos = bVal; break;
1985 default:
1986 OSL_FAIL("Wrong MemberId");
1987 return false;
1988 }
1989 return true;
1990}
1991
1993{
1994 return new SvxProtectItem( *this );
1995}
1996
1998(
1999 SfxItemPresentation /*ePres*/,
2000 MapUnit /*eCoreUnit*/,
2001 MapUnit /*ePresUnit*/,
2002 OUString& rText, const IntlWrapper&
2003) const
2004{
2005 TranslateId pId = RID_SVXITEMS_PROT_CONTENT_FALSE;
2006
2007 if ( bCntnt )
2008 pId = RID_SVXITEMS_PROT_CONTENT_TRUE;
2009 rText = EditResId(pId) + cpDelim;
2010 pId = RID_SVXITEMS_PROT_SIZE_FALSE;
2011
2012 if ( bSize )
2013 pId = RID_SVXITEMS_PROT_SIZE_TRUE;
2014 rText += EditResId(pId) + cpDelim;
2015 pId = RID_SVXITEMS_PROT_POS_FALSE;
2016
2017 if ( bPos )
2018 pId = RID_SVXITEMS_PROT_POS_TRUE;
2019 rText += EditResId(pId);
2020 return true;
2021}
2022
2023
2025{
2026 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxProtectItem"));
2027 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
2028 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("content"), BAD_CAST(OString::boolean(bCntnt).getStr()));
2029 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("size"), BAD_CAST(OString::boolean(bSize).getStr()));
2030 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("position"), BAD_CAST(OString::boolean(bPos).getStr()));
2031 (void)xmlTextWriterEndElement(pWriter);
2032}
2033
2034
2035SvxShadowItem::SvxShadowItem( const sal_uInt16 nId,
2036 const Color *pColor, const sal_uInt16 nW,
2037 const SvxShadowLocation eLoc ) :
2039 aShadowColor(COL_GRAY),
2040 nWidth ( nW ),
2041 eLocation ( eLoc )
2042{
2043 if ( pColor )
2044 aShadowColor = *pColor;
2045}
2046
2047
2048bool SvxShadowItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2049{
2050 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2051 nMemberId &= ~CONVERT_TWIPS;
2052
2053 table::ShadowFormat aShadow;
2054 table::ShadowLocation eSet = table::ShadowLocation_NONE;
2055 switch( eLocation )
2056 {
2057 case SvxShadowLocation::TopLeft : eSet = table::ShadowLocation_TOP_LEFT ; break;
2058 case SvxShadowLocation::TopRight : eSet = table::ShadowLocation_TOP_RIGHT ; break;
2059 case SvxShadowLocation::BottomLeft : eSet = table::ShadowLocation_BOTTOM_LEFT ; break;
2060 case SvxShadowLocation::BottomRight: eSet = table::ShadowLocation_BOTTOM_RIGHT; break;
2061 default: ; // prevent warning
2062 }
2063 aShadow.Location = eSet;
2064 aShadow.ShadowWidth = bConvert ? convertTwipToMm100(nWidth) : nWidth;
2065 aShadow.IsTransparent = aShadowColor.IsTransparent();
2066 aShadow.Color = sal_Int32(aShadowColor);
2067
2068 sal_Int8 nTransparence = rtl::math::round((float(255 - aShadowColor.GetAlpha()) * 100) / 255);
2069
2070 switch ( nMemberId )
2071 {
2072 case MID_LOCATION: rVal <<= aShadow.Location; break;
2073 case MID_WIDTH: rVal <<= aShadow.ShadowWidth; break;
2074 case MID_TRANSPARENT: rVal <<= aShadow.IsTransparent; break;
2075 case MID_BG_COLOR: rVal <<= aShadow.Color; break;
2076 case 0: rVal <<= aShadow; break;
2077 case MID_SHADOW_TRANSPARENCE: rVal <<= nTransparence; break;
2078 default: OSL_FAIL("Wrong MemberId!"); return false;
2079 }
2080
2081 return true;
2082}
2083
2084bool SvxShadowItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2085{
2086 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2087 nMemberId &= ~CONVERT_TWIPS;
2088
2089 table::ShadowFormat aShadow;
2090 uno::Any aAny;
2091 bool bRet = QueryValue( aAny, bConvert ? CONVERT_TWIPS : 0 ) && ( aAny >>= aShadow );
2092 switch ( nMemberId )
2093 {
2094 case MID_LOCATION:
2095 {
2096 bRet = (rVal >>= aShadow.Location);
2097 if ( !bRet )
2098 {
2099 sal_Int16 nVal = 0;
2100 bRet = (rVal >>= nVal);
2101 aShadow.Location = static_cast<table::ShadowLocation>(nVal);
2102 }
2103
2104 break;
2105 }
2106
2107 case MID_WIDTH: rVal >>= aShadow.ShadowWidth; break;
2108 case MID_TRANSPARENT: rVal >>= aShadow.IsTransparent; break;
2109 case MID_BG_COLOR: rVal >>= aShadow.Color; break;
2110 case 0: rVal >>= aShadow; break;
2112 {
2113 sal_Int32 nTransparence = 0;
2114 if ((rVal >>= nTransparence) && !o3tl::checked_multiply<sal_Int32>(nTransparence, 255, nTransparence))
2115 {
2116 Color aColor(ColorTransparency, aShadow.Color);
2117 aColor.SetAlpha(255 - rtl::math::round(float(nTransparence) / 100));
2118 aShadow.Color = sal_Int32(aColor);
2119 }
2120 break;
2121 }
2122 default: OSL_FAIL("Wrong MemberId!"); return false;
2123 }
2124
2125 if ( bRet )
2126 {
2127 switch( aShadow.Location )
2128 {
2129 case table::ShadowLocation_NONE : eLocation = SvxShadowLocation::NONE; break;
2130 case table::ShadowLocation_TOP_LEFT : eLocation = SvxShadowLocation::TopLeft; break;
2131 case table::ShadowLocation_TOP_RIGHT : eLocation = SvxShadowLocation::TopRight; break;
2132 case table::ShadowLocation_BOTTOM_LEFT : eLocation = SvxShadowLocation::BottomLeft ; break;
2133 case table::ShadowLocation_BOTTOM_RIGHT: eLocation = SvxShadowLocation::BottomRight; break;
2134 default: ; // prevent warning
2135 }
2136
2137 nWidth = bConvert ? o3tl::toTwips(aShadow.ShadowWidth, o3tl::Length::mm100) : aShadow.ShadowWidth;
2138 Color aSet(ColorTransparency, aShadow.Color);
2139 aShadowColor = aSet;
2140 }
2141
2142 return bRet;
2143}
2144
2145
2146bool SvxShadowItem::operator==( const SfxPoolItem& rAttr ) const
2147{
2148 assert(SfxPoolItem::operator==(rAttr));
2149
2150 const SvxShadowItem& rItem = static_cast<const SvxShadowItem&>(rAttr);
2151 return ( ( aShadowColor == rItem.aShadowColor ) &&
2152 ( nWidth == rItem.GetWidth() ) &&
2153 ( eLocation == rItem.GetLocation() ) );
2154}
2155
2157{
2158 return new SvxShadowItem( *this );
2159}
2160
2162{
2163 sal_uInt16 nSpace = 0;
2164
2165 switch ( nShadow )
2166 {
2170 nSpace = nWidth;
2171 break;
2172
2176 nSpace = nWidth;
2177 break;
2178
2182 nSpace = nWidth;
2183 break;
2184
2188 nSpace = nWidth;
2189 break;
2190
2191 default:
2192 OSL_FAIL( "wrong shadow" );
2193 }
2194 return nSpace;
2195}
2196
2198{
2199 RID_SVXITEMS_SHADOW_NONE,
2200 RID_SVXITEMS_SHADOW_TOPLEFT,
2201 RID_SVXITEMS_SHADOW_TOPRIGHT,
2202 RID_SVXITEMS_SHADOW_BOTTOMLEFT,
2203 RID_SVXITEMS_SHADOW_BOTTOMRIGHT
2204};
2205
2207(
2208 SfxItemPresentation ePres,
2209 MapUnit eCoreUnit,
2210 MapUnit ePresUnit,
2211 OUString& rText, const IntlWrapper& rIntl
2212) const
2213{
2214 switch ( ePres )
2215 {
2216 case SfxItemPresentation::Nameless:
2217 {
2219 TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
2220
2222 pId = RID_SVXITEMS_TRANSPARENT_TRUE;
2223 rText += EditResId(pId) +
2224 cpDelim +
2225 GetMetricText( static_cast<tools::Long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) +
2226 cpDelim +
2227 EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]);
2228 return true;
2229 }
2230 case SfxItemPresentation::Complete:
2231 {
2232 rText = EditResId(RID_SVXITEMS_SHADOW_COMPLETE) +
2234 cpDelim;
2235
2236 TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
2238 pId = RID_SVXITEMS_TRANSPARENT_TRUE;
2239 rText += EditResId(pId) +
2240 cpDelim +
2241 GetMetricText( static_cast<tools::Long>(nWidth), eCoreUnit, ePresUnit, &rIntl ) +
2242 " " + EditResId(GetMetricId(ePresUnit)) +
2243 cpDelim +
2244 EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]);
2245 return true;
2246 }
2247 default: ; // prevent warning
2248 }
2249 return false;
2250}
2251
2252
2254{
2255 nWidth = static_cast<sal_uInt16>(BigInt::Scale( nWidth, nMult, nDiv ));
2256}
2257
2258
2260{
2261 return true;
2262}
2263
2264
2266{
2267 return sal_uInt16(SvxShadowLocation::End); // SvxShadowLocation::BottomRight + 1
2268}
2269
2271{
2272 return static_cast<sal_uInt16>(GetLocation());
2273}
2274
2275
2276void SvxShadowItem::SetEnumValue( sal_uInt16 nVal )
2277{
2278 SetLocation( static_cast<SvxShadowLocation>(nVal) );
2279}
2280
2282{
2283 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxShadowItem"));
2284 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
2285 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("aShadowColor"), BAD_CAST(aShadowColor.AsRGBHexString().toUtf8().getStr()));
2286 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nWidth"), BAD_CAST(OString::number(nWidth).getStr()));
2287 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("eLocation"), BAD_CAST(OString::number(static_cast<int>(eLocation)).getStr()));
2288 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(EditResId(RID_SVXITEMS_SHADOW[static_cast<int>(eLocation)]).toUtf8().getStr()));
2289 (void)xmlTextWriterEndElement(pWriter);
2290}
2291
2292// class SvxBoxItem ------------------------------------------------------
2293
2295 : SfxPoolItem (rCopy)
2296 , mpTopBorderLine(rCopy.mpTopBorderLine ? new SvxBorderLine(*rCopy.mpTopBorderLine) : nullptr)
2297 , mpBottomBorderLine(rCopy.mpBottomBorderLine ? new SvxBorderLine(*rCopy.mpBottomBorderLine) : nullptr)
2298 , mpLeftBorderLine(rCopy.mpLeftBorderLine ? new SvxBorderLine(*rCopy.mpLeftBorderLine) : nullptr)
2299 , mpRightBorderLine(rCopy.mpRightBorderLine ? new SvxBorderLine(*rCopy.mpRightBorderLine) : nullptr)
2300 , mnTopDistance(rCopy.mnTopDistance)
2301 , mnBottomDistance(rCopy.mnBottomDistance)
2302 , mnLeftDistance(rCopy.mnLeftDistance)
2303 , mnRightDistance(rCopy.mnRightDistance)
2304 , maTempComplexColors(rCopy.maTempComplexColors)
2305 , mbRemoveAdjCellBorder(rCopy.mbRemoveAdjCellBorder)
2306{
2307}
2308
2309
2310SvxBoxItem::SvxBoxItem(const sal_uInt16 nId)
2311 : SfxPoolItem(nId)
2312{
2313}
2314
2315
2317{
2318}
2319
2321{
2322 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBoxItem"));
2323 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("top-dist"),
2324 BAD_CAST(OString::number(mnTopDistance).getStr()));
2325 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("bottom-dist"),
2326 BAD_CAST(OString::number(mnBottomDistance).getStr()));
2327 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("left-dist"),
2328 BAD_CAST(OString::number(mnLeftDistance).getStr()));
2329 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("right-dist"),
2330 BAD_CAST(OString::number(mnRightDistance).getStr()));
2331 SfxPoolItem::dumpAsXml(pWriter);
2332 (void)xmlTextWriterEndElement(pWriter);
2333}
2334
2335boost::property_tree::ptree SvxBoxItem::dumpAsJSON() const
2336{
2337 boost::property_tree::ptree aTree;
2338
2339 boost::property_tree::ptree aState;
2340 aState.put("top", GetTop() && !GetTop()->isEmpty());
2341 aState.put("bottom", GetBottom() && !GetBottom()->isEmpty());
2342 aState.put("left", GetLeft() && !GetLeft()->isEmpty());
2343 aState.put("right", GetRight() && !GetRight()->isEmpty());
2344
2345 aTree.push_back(std::make_pair("state", aState));
2346 aTree.put("commandName", ".uno:BorderOuter");
2347
2348 return aTree;
2349}
2350
2351
2352static bool CompareBorderLine(const std::unique_ptr<SvxBorderLine> & pBrd1, const SvxBorderLine* pBrd2)
2353{
2354 if( pBrd1.get() == pBrd2 )
2355 return true;
2356 if( pBrd1 == nullptr || pBrd2 == nullptr)
2357 return false;
2358 return *pBrd1 == *pBrd2;
2359}
2360
2361
2362bool SvxBoxItem::operator==( const SfxPoolItem& rAttr ) const
2363{
2364 assert(SfxPoolItem::operator==(rAttr));
2365
2366 const SvxBoxItem& rBoxItem = static_cast<const SvxBoxItem&>(rAttr);
2367 return (
2378}
2379
2380
2381table::BorderLine2 SvxBoxItem::SvxLineToLine(const SvxBorderLine* pLine, bool bConvert)
2382{
2383 table::BorderLine2 aLine;
2384 if(pLine)
2385 {
2386 aLine.Color = sal_Int32(pLine->GetColor());
2387 aLine.InnerLineWidth = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetInWidth() ): pLine->GetInWidth() );
2388 aLine.OuterLineWidth = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetOutWidth()): pLine->GetOutWidth() );
2389 aLine.LineDistance = sal_uInt16( bConvert ? convertTwipToMm100(pLine->GetDistance()): pLine->GetDistance() );
2390 aLine.LineStyle = sal_Int16(pLine->GetBorderLineStyle());
2391 aLine.LineWidth = sal_uInt32( bConvert ? convertTwipToMm100( pLine->GetWidth( ) ) : pLine->GetWidth( ) );
2392 }
2393 else
2394 {
2395 aLine.Color = aLine.InnerLineWidth = aLine.OuterLineWidth = aLine.LineDistance = 0;
2396 aLine.LineStyle = table::BorderLineStyle::NONE; // 0 is SOLID!
2397 }
2398 return aLine;
2399}
2400
2401bool SvxBoxItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
2402{
2403 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2404 table::BorderLine2 aRetLine;
2405 sal_Int16 nDist = 0;
2406 bool bDistMember = false;
2407 nMemberId &= ~CONVERT_TWIPS;
2408 switch(nMemberId)
2409 {
2410 case 0:
2411 {
2412 // 4 Borders and 5 distances
2413 uno::Sequence< uno::Any > aSeq{
2418 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetSmallestDistance()) : GetSmallestDistance())),
2419 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(mnTopDistance) : mnTopDistance)),
2420 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(mnBottomDistance) : mnBottomDistance)),
2421 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(mnLeftDistance) : mnLeftDistance)),
2422 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(mnRightDistance) : mnRightDistance))
2423 };
2424 rVal <<= aSeq;
2425 return true;
2426 }
2427 case MID_LEFT_BORDER:
2428 case LEFT_BORDER:
2429 aRetLine = SvxBoxItem::SvxLineToLine(GetLeft(), bConvert);
2430 break;
2431 case MID_RIGHT_BORDER:
2432 case RIGHT_BORDER:
2433 aRetLine = SvxBoxItem::SvxLineToLine(GetRight(), bConvert);
2434 break;
2435 case MID_BOTTOM_BORDER:
2436 case BOTTOM_BORDER:
2437 aRetLine = SvxBoxItem::SvxLineToLine(GetBottom(), bConvert);
2438 break;
2439 case MID_TOP_BORDER:
2440 case TOP_BORDER:
2441 aRetLine = SvxBoxItem::SvxLineToLine(GetTop(), bConvert);
2442 break;
2443 case BORDER_DISTANCE:
2444 nDist = GetSmallestDistance();
2445 bDistMember = true;
2446 break;
2448 nDist = mnTopDistance;
2449 bDistMember = true;
2450 break;
2452 nDist = mnBottomDistance;
2453 bDistMember = true;
2454 break;
2456 nDist = mnLeftDistance;
2457 bDistMember = true;
2458 break;
2460 nDist = mnRightDistance;
2461 bDistMember = true;
2462 break;
2464 {
2466 {
2467 rVal <<= model::color::createXComplexColor(mpBottomBorderLine->getComplexColor());
2468 }
2470 {
2472 }
2473 return true;
2474 }
2476 {
2477 if (mpLeftBorderLine)
2478 {
2479 rVal <<= model::color::createXComplexColor(mpLeftBorderLine->getComplexColor());
2480 }
2482 {
2484 }
2485 return true;
2486 }
2488 {
2490 {
2491 rVal <<= model::color::createXComplexColor(mpRightBorderLine->getComplexColor());
2492 }
2494 {
2496 }
2497 return true;
2498 }
2500 {
2501 if (mpTopBorderLine)
2502 {
2503 rVal <<= model::color::createXComplexColor(mpTopBorderLine->getComplexColor());
2504 }
2506 {
2508 }
2509 return true;
2510 }
2511 case LINE_STYLE:
2512 case LINE_WIDTH:
2513 // it doesn't make sense to return a value for these since it's
2514 // probably ambiguous
2515 return true;
2516 }
2517
2518 if( bDistMember )
2519 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(nDist) : nDist);
2520 else
2521 rVal <<= aRetLine;
2522
2523 return true;
2524}
2525
2526namespace
2527{
2528
2529bool
2530lcl_lineToSvxLine(const table::BorderLine& rLine, SvxBorderLine& rSvxLine, bool bConvert, bool bGuessWidth)
2531{
2532 rSvxLine.SetColor( Color(ColorTransparency, rLine.Color));
2533 if ( bGuessWidth )
2534 {
2535 rSvxLine.GuessLinesWidths( rSvxLine.GetBorderLineStyle(),
2536 bConvert ? o3tl::toTwips(rLine.OuterLineWidth, o3tl::Length::mm100) : rLine.OuterLineWidth,
2537 bConvert ? o3tl::toTwips(rLine.InnerLineWidth, o3tl::Length::mm100) : rLine.InnerLineWidth,
2538 bConvert ? o3tl::toTwips(rLine.LineDistance, o3tl::Length::mm100) : rLine.LineDistance );
2539 }
2540
2541 bool bRet = !rSvxLine.isEmpty();
2542 return bRet;
2543}
2544
2545}
2546
2547
2548bool SvxBoxItem::LineToSvxLine(const css::table::BorderLine& rLine, SvxBorderLine& rSvxLine, bool bConvert)
2549{
2550 return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, true);
2551}
2552
2553bool
2554SvxBoxItem::LineToSvxLine(const css::table::BorderLine2& rLine, SvxBorderLine& rSvxLine, bool bConvert)
2555{
2556 SvxBorderLineStyle const nStyle =
2557 (rLine.LineStyle < 0 || BORDER_LINE_STYLE_MAX < rLine.LineStyle)
2558 ? SvxBorderLineStyle::SOLID // default
2559 : static_cast<SvxBorderLineStyle>(rLine.LineStyle);
2560
2561 rSvxLine.SetBorderLineStyle( nStyle );
2562
2563 bool bGuessWidth = true;
2564 if ( rLine.LineWidth )
2565 {
2566 rSvxLine.SetWidth( bConvert? o3tl::toTwips(rLine.LineWidth, o3tl::Length::mm100) : rLine.LineWidth );
2567 // fdo#46112: double does not necessarily mean symmetric
2568 // for backwards compatibility
2569 bGuessWidth = (SvxBorderLineStyle::DOUBLE == nStyle || SvxBorderLineStyle::DOUBLE_THIN == nStyle) &&
2570 (rLine.InnerLineWidth > 0) && (rLine.OuterLineWidth > 0);
2571 }
2572
2573 return lcl_lineToSvxLine(rLine, rSvxLine, bConvert, bGuessWidth);
2574}
2575
2576
2577namespace
2578{
2579
2580bool
2581lcl_extractBorderLine(const uno::Any& rAny, table::BorderLine2& rLine)
2582{
2583 if (rAny >>= rLine)
2584 return true;
2585
2586 table::BorderLine aBorderLine;
2587 if (rAny >>= aBorderLine)
2588 {
2589 rLine.Color = aBorderLine.Color;
2590 rLine.InnerLineWidth = aBorderLine.InnerLineWidth;
2591 rLine.OuterLineWidth = aBorderLine.OuterLineWidth;
2592 rLine.LineDistance = aBorderLine.LineDistance;
2593 rLine.LineStyle = table::BorderLineStyle::SOLID;
2594 return true;
2595 }
2596
2597 return false;
2598}
2599
2600template<typename Item, typename Line>
2601bool
2602lcl_setLine(const uno::Any& rAny, Item& rItem, Line nLine, const bool bConvert)
2603{
2604 bool bDone = false;
2605 table::BorderLine2 aBorderLine;
2606 if (lcl_extractBorderLine(rAny, aBorderLine))
2607 {
2608 SvxBorderLine aLine;
2609 bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2610 rItem.SetLine( bSet ? &aLine : nullptr, nLine);
2611 bDone = true;
2612 }
2613 return bDone;
2614}
2615
2616}
2617
2618bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
2619{
2620 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
2622 bool bDistMember = false;
2623 nMemberId &= ~CONVERT_TWIPS;
2624 switch(nMemberId)
2625 {
2626 case 0:
2627 {
2628 uno::Sequence< uno::Any > aSeq;
2629 if (( rVal >>= aSeq ) && ( aSeq.getLength() == 9 ))
2630 {
2631 // 4 Borders and 5 distances
2633 for (size_t n(0); n != std::size(aBorders); ++n)
2634 {
2635 if (!lcl_setLine(aSeq[n], *this, aBorders[n], bConvert))
2636 return false;
2637 tryMigrateComplexColor(aBorders[n]);
2638 }
2639
2640 // WTH are the borders and the distances saved in different order?
2642 for ( sal_Int32 n = 4; n < 9; n++ )
2643 {
2644 sal_Int32 nDist = 0;
2645 if ( aSeq[n] >>= nDist )
2646 {
2647 if( bConvert )
2648 nDist = o3tl::toTwips(nDist, o3tl::Length::mm100);
2649 if ( n == 4 )
2650 SetAllDistances(nDist);
2651 else
2652 SetDistance( nDist, nLines[n-5] );
2653 }
2654 else
2655 return false;
2656 }
2657
2658 return true;
2659 }
2660 else
2661 return false;
2662 }
2664 bDistMember = true;
2665 [[fallthrough]];
2666 case LEFT_BORDER:
2667 case MID_LEFT_BORDER:
2668 nLine = SvxBoxItemLine::LEFT;
2669 break;
2671 bDistMember = true;
2672 [[fallthrough]];
2673 case RIGHT_BORDER:
2674 case MID_RIGHT_BORDER:
2675 nLine = SvxBoxItemLine::RIGHT;
2676 break;
2678 bDistMember = true;
2679 [[fallthrough]];
2680 case BOTTOM_BORDER:
2681 case MID_BOTTOM_BORDER:
2682 nLine = SvxBoxItemLine::BOTTOM;
2683 break;
2685 bDistMember = true;
2686 [[fallthrough]];
2687 case TOP_BORDER:
2688 case MID_TOP_BORDER:
2689 nLine = SvxBoxItemLine::TOP;
2690 break;
2691 case LINE_STYLE:
2692 {
2693 drawing::LineStyle eDrawingStyle;
2694 rVal >>= eDrawingStyle;
2696 switch ( eDrawingStyle )
2697 {
2698 default:
2699 case drawing::LineStyle_NONE:
2700 break;
2701 case drawing::LineStyle_SOLID:
2702 eBorderStyle = SvxBorderLineStyle::SOLID;
2703 break;
2704 case drawing::LineStyle_DASH:
2705 eBorderStyle = SvxBorderLineStyle::DASHED;
2706 break;
2707 }
2708
2709 // Set the line style on all borders
2711 {
2712 editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( n ) );
2713 if( pLine )
2714 pLine->SetBorderLineStyle( eBorderStyle );
2715 }
2716 return true;
2717 }
2718 break;
2719 case LINE_WIDTH:
2720 {
2721 // Set the line width on all borders
2722 tools::Long nWidth(0);
2723 rVal >>= nWidth;
2724 if( bConvert )
2725 nWidth = o3tl::toTwips(nWidth, o3tl::Length::mm100);
2726
2727 // Set the line Width on all borders
2729 {
2730 editeng::SvxBorderLine* pLine = const_cast< editeng::SvxBorderLine* >( GetLine( n ) );
2731 if( pLine )
2732 pLine->SetWidth( nWidth );
2733 }
2734 }
2735 return true;
2737 {
2739 return mpBottomBorderLine->setComplexColorFromAny(rVal);
2740 else
2741 {
2742 css::uno::Reference<css::util::XComplexColor> xComplexColor;
2743 if (!(rVal >>= xComplexColor))
2744 return false;
2745
2746 if (xComplexColor.is())
2748 }
2749 return true;
2750 }
2752 {
2753 if (mpLeftBorderLine)
2754 return mpLeftBorderLine->setComplexColorFromAny(rVal);
2755 else
2756 {
2757 css::uno::Reference<css::util::XComplexColor> xComplexColor;
2758 if (!(rVal >>= xComplexColor))
2759 return false;
2760
2761 if (xComplexColor.is())
2763 }
2764 return true;
2765 }
2767 {
2769 return mpRightBorderLine->setComplexColorFromAny(rVal);
2770 else
2771 {
2772 css::uno::Reference<css::util::XComplexColor> xComplexColor;
2773 if (!(rVal >>= xComplexColor))
2774 return false;
2775
2776 if (xComplexColor.is())
2778 }
2779 return true;
2780 }
2782 {
2783 if (mpTopBorderLine)
2784 return mpTopBorderLine->setComplexColorFromAny(rVal);
2785 else
2786 {
2787 css::uno::Reference<css::util::XComplexColor> xComplexColor;
2788 if (!(rVal >>= xComplexColor))
2789 return false;
2790
2791 if (xComplexColor.is())
2793 }
2794 return true;
2795 }
2796 }
2797
2798 if( bDistMember || nMemberId == BORDER_DISTANCE )
2799 {
2800 sal_Int32 nDist = 0;
2801 if(!(rVal >>= nDist))
2802 return false;
2803
2804 {
2805 if( bConvert )
2806 nDist = o3tl::toTwips(nDist, o3tl::Length::mm100);
2807 if( nMemberId == BORDER_DISTANCE )
2808 SetAllDistances(nDist);
2809 else
2810 SetDistance( nDist, nLine );
2811 }
2812 }
2813 else
2814 {
2815 SvxBorderLine aLine;
2816 if( !rVal.hasValue() )
2817 return false;
2818
2819 table::BorderLine2 aBorderLine;
2820 if( lcl_extractBorderLine(rVal, aBorderLine) )
2821 {
2822 // usual struct
2823 }
2824 else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
2825 {
2826 // serialization for basic macro recording
2827 uno::Reference < script::XTypeConverter > xConverter
2828 ( script::Converter::create(::comphelper::getProcessComponentContext()) );
2829 uno::Sequence < uno::Any > aSeq;
2830 uno::Any aNew;
2831 try { aNew = xConverter->convertTo( rVal, cppu::UnoType<uno::Sequence < uno::Any >>::get() ); }
2832 catch (const uno::Exception&) {}
2833
2834 aNew >>= aSeq;
2835 if (aSeq.getLength() >= 4 && aSeq.getLength() <= 6)
2836 {
2837 sal_Int32 nVal = 0;
2838 if ( aSeq[0] >>= nVal )
2839 aBorderLine.Color = nVal;
2840 if ( aSeq[1] >>= nVal )
2841 aBorderLine.InnerLineWidth = static_cast<sal_Int16>(nVal);
2842 if ( aSeq[2] >>= nVal )
2843 aBorderLine.OuterLineWidth = static_cast<sal_Int16>(nVal);
2844 if ( aSeq[3] >>= nVal )
2845 aBorderLine.LineDistance = static_cast<sal_Int16>(nVal);
2846 if (aSeq.getLength() >= 5) // fdo#40874 added fields
2847 {
2848 if (aSeq[4] >>= nVal)
2849 {
2850 aBorderLine.LineStyle = nVal;
2851 }
2852 if (aSeq.getLength() >= 6)
2853 {
2854 if (aSeq[5] >>= nVal)
2855 {
2856 aBorderLine.LineWidth = nVal;
2857 }
2858 }
2859 }
2860 }
2861 else
2862 return false;
2863 }
2864 else
2865 return false;
2866
2867 bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
2868 SetLine(bSet ? &aLine : nullptr, nLine);
2870 }
2871
2872 return true;
2873}
2874
2876{
2877 return new SvxBoxItem( *this );
2878}
2879
2881(
2882 SfxItemPresentation ePres,
2883 MapUnit eCoreUnit,
2884 MapUnit ePresUnit,
2885 OUString& rText, const IntlWrapper& rIntl
2886) const
2887{
2888 OUString cpDelimTmp(cpDelim);
2889 switch ( ePres )
2890 {
2891 case SfxItemPresentation::Nameless:
2892 {
2893 rText.clear();
2894
2895 if (mpTopBorderLine)
2896 {
2897 rText = mpTopBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp;
2898 }
2903 {
2905 {
2906 rText += mpBottomBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp;
2907 }
2908 if (mpLeftBorderLine)
2909 {
2910 rText += mpLeftBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp;
2911 }
2913 {
2914 rText += mpRightBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp;
2915 }
2916 }
2917 rText += GetMetricText( static_cast<tools::Long>(mnTopDistance), eCoreUnit, ePresUnit, &rIntl );
2921 {
2922 rText += cpDelimTmp +
2923 GetMetricText( tools::Long(mnBottomDistance), eCoreUnit, ePresUnit, &rIntl ) +
2924 cpDelimTmp +
2925 GetMetricText( tools::Long(mnLeftDistance), eCoreUnit, ePresUnit, &rIntl ) +
2926 cpDelimTmp +
2927 GetMetricText( tools::Long(mnRightDistance), eCoreUnit, ePresUnit, &rIntl );
2928 }
2929 return true;
2930 }
2931 case SfxItemPresentation::Complete:
2932 {
2934 {
2935 rText = EditResId(RID_SVXITEMS_BORDER_NONE) + cpDelimTmp;
2936 }
2937 else
2938 {
2939 rText = EditResId(RID_SVXITEMS_BORDER_COMPLETE);
2944 {
2945 rText += mpTopBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl, true ) + cpDelimTmp;
2946 }
2947 else
2948 {
2949 if (mpTopBorderLine)
2950 {
2951 rText += EditResId(RID_SVXITEMS_BORDER_TOP) +
2952 mpTopBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl, true ) +
2953 cpDelimTmp;
2954 }
2956 {
2957 rText += EditResId(RID_SVXITEMS_BORDER_BOTTOM) +
2958 mpBottomBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl, true ) +
2959 cpDelimTmp;
2960 }
2961 if (mpLeftBorderLine)
2962 {
2963 rText += EditResId(RID_SVXITEMS_BORDER_LEFT) +
2964 mpLeftBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl, true ) +
2965 cpDelimTmp;
2966 }
2968 {
2969 rText += EditResId(RID_SVXITEMS_BORDER_RIGHT) +
2970 mpRightBorderLine->GetValueString( eCoreUnit, ePresUnit, &rIntl, true ) +
2971 cpDelimTmp;
2972 }
2973 }
2974 }
2975
2976 rText += EditResId(RID_SVXITEMS_BORDER_DISTANCE);
2980 {
2981 rText += GetMetricText(tools::Long(mnTopDistance), eCoreUnit, ePresUnit, &rIntl ) +
2982 " " + EditResId(GetMetricId(ePresUnit));
2983 }
2984 else
2985 {
2986 rText += EditResId(RID_SVXITEMS_BORDER_TOP) +
2987 GetMetricText(tools::Long(mnTopDistance), eCoreUnit, ePresUnit, &rIntl) +
2988 " " + EditResId(GetMetricId(ePresUnit)) +
2989 cpDelimTmp +
2990 EditResId(RID_SVXITEMS_BORDER_BOTTOM) +
2991 GetMetricText(tools::Long(mnBottomDistance), eCoreUnit, ePresUnit, &rIntl) +
2992 " " + EditResId(GetMetricId(ePresUnit)) +
2993 cpDelimTmp +
2994 EditResId(RID_SVXITEMS_BORDER_LEFT) +
2995 GetMetricText(tools::Long(mnLeftDistance), eCoreUnit, ePresUnit, &rIntl) +
2996 " " + EditResId(GetMetricId(ePresUnit)) +
2997 cpDelimTmp +
2998 EditResId(RID_SVXITEMS_BORDER_RIGHT) +
2999 GetMetricText(tools::Long(mnRightDistance), eCoreUnit, ePresUnit, &rIntl) +
3000 " " + EditResId(GetMetricId(ePresUnit));
3001 }
3002 return true;
3003 }
3004 default: ; // prevent warning
3005 }
3006 return false;
3007}
3008
3009
3011{
3012 if (mpTopBorderLine)
3013 mpTopBorderLine->ScaleMetrics( nMult, nDiv );
3015 mpBottomBorderLine->ScaleMetrics( nMult, nDiv );
3016 if (mpLeftBorderLine)
3017 mpLeftBorderLine->ScaleMetrics( nMult, nDiv );
3019 mpRightBorderLine->ScaleMetrics( nMult, nDiv );
3020
3021 mnTopDistance = static_cast<sal_Int16>(BigInt::Scale(mnTopDistance, nMult, nDiv));
3022 mnBottomDistance = static_cast<sal_Int16>(BigInt::Scale(mnBottomDistance, nMult, nDiv));
3023 mnLeftDistance = static_cast<sal_Int16>(BigInt::Scale(mnLeftDistance, nMult, nDiv));
3024 mnRightDistance = static_cast<sal_Int16>(BigInt::Scale(mnRightDistance, nMult, nDiv));
3025}
3026
3027
3029{
3030 return true;
3031}
3032
3033
3034const SvxBorderLine *SvxBoxItem::GetLine( SvxBoxItemLine nLine ) const
3035{
3036 const SvxBorderLine *pRet = nullptr;
3037
3038 switch ( nLine )
3039 {
3041 pRet = mpTopBorderLine.get();
3042 break;
3044 pRet = mpBottomBorderLine.get();
3045 break;
3047 pRet = mpLeftBorderLine.get();
3048 break;
3050 pRet = mpRightBorderLine.get();
3051 break;
3052 default:
3053 OSL_FAIL( "wrong line" );
3054 break;
3055 }
3056
3057 return pRet;
3058}
3059
3060
3061void SvxBoxItem::SetLine( const SvxBorderLine* pNew, SvxBoxItemLine nLine )
3062{
3063 std::unique_ptr<SvxBorderLine> pTmp( pNew ? new SvxBorderLine( *pNew ) : nullptr );
3064
3065 switch ( nLine )
3066 {
3068 mpTopBorderLine = std::move(pTmp);
3069 break;
3071 mpBottomBorderLine = std::move(pTmp);
3072 break;
3074 mpLeftBorderLine = std::move(pTmp);
3075 break;
3077 mpRightBorderLine = std::move(pTmp);
3078 break;
3079 default:
3080 OSL_FAIL( "wrong line" );
3081 }
3082}
3083
3084
3086{
3087 // The smallest distance that is not 0 will be returned.
3088 sal_uInt16 nDist = mnTopDistance;
3089 if (mnBottomDistance && (!nDist || mnBottomDistance < nDist))
3090 nDist = mnBottomDistance;
3091 if (mnLeftDistance && (!nDist || mnLeftDistance < nDist))
3092 nDist = mnLeftDistance;
3093 if (mnRightDistance && (!nDist || mnRightDistance < nDist))
3094 nDist = mnRightDistance;
3095
3096 return nDist;
3097}
3098
3099
3100sal_Int16 SvxBoxItem::GetDistance( SvxBoxItemLine nLine, bool bAllowNegative ) const
3101{
3102 sal_Int16 nDist = 0;
3103 switch ( nLine )
3104 {
3106 nDist = mnTopDistance;
3107 break;
3109 nDist = mnBottomDistance;
3110 break;
3112 nDist = mnLeftDistance;
3113 break;
3115 nDist = mnRightDistance;
3116 break;
3117 default:
3118 OSL_FAIL( "wrong line" );
3119 }
3120
3121 if (!bAllowNegative && nDist < 0)
3122 {
3123 nDist = 0;
3124 }
3125 return nDist;
3126}
3127
3128
3129void SvxBoxItem::SetDistance( sal_Int16 nNew, SvxBoxItemLine nLine )
3130{
3131 switch ( nLine )
3132 {
3134 mnTopDistance = nNew;
3135 break;
3137 mnBottomDistance = nNew;
3138 break;
3140 mnLeftDistance = nNew;
3141 break;
3143 mnRightDistance = nNew;
3144 break;
3145 default:
3146 OSL_FAIL( "wrong line" );
3147 }
3148}
3149
3151{
3152 SvxBorderLine* pTmp = nullptr;
3153 sal_uInt16 nWidth = 0;
3154 switch ( nLine )
3155 {
3157 pTmp = mpTopBorderLine.get();
3158 break;
3160 pTmp = mpBottomBorderLine.get();
3161 break;
3163 pTmp = mpLeftBorderLine.get();
3164 break;
3166 pTmp = mpRightBorderLine.get();
3167 break;
3168 default:
3169 OSL_FAIL( "wrong line" );
3170 }
3171
3172 if( pTmp )
3173 nWidth = pTmp->GetScaledWidth();
3174
3175 return nWidth;
3176}
3177
3178sal_Int16 SvxBoxItem::CalcLineSpace( SvxBoxItemLine nLine, bool bEvenIfNoLine, bool bAllowNegative ) const
3179{
3180 SvxBorderLine* pTmp = nullptr;
3181 sal_Int16 nDist = 0;
3182 switch ( nLine )
3183 {
3185 pTmp = mpTopBorderLine.get();
3186 nDist = mnTopDistance;
3187 break;
3189 pTmp = mpBottomBorderLine.get();
3190 nDist = mnBottomDistance;
3191 break;
3193 pTmp = mpLeftBorderLine.get();
3194 nDist = mnLeftDistance;
3195 break;
3197 pTmp = mpRightBorderLine.get();
3198 nDist = mnRightDistance;
3199 break;
3200 default:
3201 OSL_FAIL( "wrong line" );
3202 }
3203
3204 if( pTmp )
3205 {
3206 nDist = nDist + pTmp->GetScaledWidth();
3207 }
3208 else if( !bEvenIfNoLine )
3209 nDist = 0;
3210
3211 if (!bAllowNegative && nDist < 0)
3212 {
3213 nDist = 0;
3214 }
3215
3216 return nDist;
3217}
3218
3220{
3221 if (!GetLine(eLine))
3222 return;
3223
3224 auto nIndex = size_t(eLine);
3225
3227 return;
3228
3229 switch (eLine)
3230 {
3232 mpTopBorderLine->setComplexColor(maTempComplexColors[nIndex]);
3233 break;
3236 break;
3238 mpLeftBorderLine->setComplexColor(maTempComplexColors[nIndex]);
3239 break;
3241 mpRightBorderLine->setComplexColor(maTempComplexColors[nIndex]);
3242 break;
3243 }
3244
3246}
3247
3248bool SvxBoxItem::HasBorder( bool bTreatPaddingAsBorder ) const
3249{
3250 return CalcLineSpace( SvxBoxItemLine::BOTTOM, bTreatPaddingAsBorder )
3251 || CalcLineSpace( SvxBoxItemLine::RIGHT, bTreatPaddingAsBorder )
3252 || CalcLineSpace( SvxBoxItemLine::TOP, bTreatPaddingAsBorder )
3253 || CalcLineSpace( SvxBoxItemLine::LEFT, bTreatPaddingAsBorder );
3254}
3255
3256// class SvxBoxInfoItem --------------------------------------------------
3257
3259 : SfxPoolItem(nId)
3260 , mbDistance(false)
3261 , mbMinimumDistance(false)
3262{
3263 ResetFlags();
3264}
3265
3266
3268 : SfxPoolItem(rCopy)
3269 , mpHorizontalLine(rCopy.mpHorizontalLine ? new SvxBorderLine(*rCopy.mpHorizontalLine) : nullptr)
3270 , mpVerticalLine(rCopy.mpVerticalLine ? new SvxBorderLine(*rCopy.mpVerticalLine) : nullptr)
3271 , mbEnableHorizontalLine(rCopy.mbEnableHorizontalLine)
3272 , mbEnableVerticalLine(rCopy.mbEnableVerticalLine)
3273 , mbDistance(rCopy.mbDistance)
3274 , mbMinimumDistance (rCopy.mbMinimumDistance)
3275 , mnValidFlags(rCopy.mnValidFlags)
3276 , mnDefaultMinimumDistance(rCopy.mnDefaultMinimumDistance)
3277{
3278}
3279
3281{
3282}
3283
3284
3285boost::property_tree::ptree SvxBoxInfoItem::dumpAsJSON() const
3286{
3287 boost::property_tree::ptree aTree;
3288
3289 boost::property_tree::ptree aState;
3290 aState.put("vertical", GetVert() && !GetVert()->isEmpty());
3291 aState.put("horizontal", GetHori() && !GetHori()->isEmpty());
3292
3293 aTree.push_back(std::make_pair("state", aState));
3294 aTree.put("commandName", ".uno:BorderInner");
3295
3296 return aTree;
3297}
3298
3299
3300bool SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const
3301{
3302 assert(SfxPoolItem::operator==(rAttr));
3303
3304 const SvxBoxInfoItem& rBoxInfo = static_cast<const SvxBoxInfoItem&>(rAttr);
3305
3308 && mbDistance == rBoxInfo.mbDistance
3310 && mnValidFlags == rBoxInfo.mnValidFlags
3313 && CompareBorderLine(mpVerticalLine, rBoxInfo.GetVert()));
3314}
3315
3316
3317void SvxBoxInfoItem::SetLine( const SvxBorderLine* pNew, SvxBoxInfoItemLine nLine )
3318{
3319 std::unique_ptr<SvxBorderLine> pCopy(pNew ? new SvxBorderLine(*pNew) : nullptr);
3320
3321 if ( SvxBoxInfoItemLine::HORI == nLine )
3322 {
3323 mpHorizontalLine = std::move(pCopy);
3324 }
3325 else if ( SvxBoxInfoItemLine::VERT == nLine )
3326 {
3327 mpVerticalLine = std::move(pCopy);
3328 }
3329 else
3330 {
3331 OSL_FAIL( "wrong line" );
3332 }
3333}
3334
3336{
3337 return new SvxBoxInfoItem( *this );
3338}
3339
3341(
3342 SfxItemPresentation /*ePres*/,
3343 MapUnit /*eCoreUnit*/,
3344 MapUnit /*ePresUnit*/,
3345 OUString& rText, const IntlWrapper&
3346) const
3347{
3348 rText.clear();
3349 return false;
3350}
3351
3352
3354{
3355 if (mpHorizontalLine)
3356 mpHorizontalLine->ScaleMetrics(nMult, nDiv);
3357 if (mpVerticalLine)
3358 mpVerticalLine->ScaleMetrics(nMult, nDiv);
3360}
3361
3362
3364{
3365 return true;
3366}
3367
3368
3370{
3371 mnValidFlags = static_cast<SvxBoxInfoItemValidFlags>(0x7F); // all valid except Disable
3372}
3373
3374bool SvxBoxInfoItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
3375{
3376 bool bConvert = 0 != (nMemberId & CONVERT_TWIPS);
3377 table::BorderLine2 aRetLine;
3378 sal_Int16 nVal=0;
3379 bool bIntMember = false;
3380 nMemberId &= ~CONVERT_TWIPS;
3381 switch(nMemberId)
3382 {
3383 case 0:
3384 {
3385 // 2 BorderLines, flags, valid flags and distance
3386 if ( IsTable() )
3387 nVal |= 0x01;
3388 if ( IsDist() )
3389 nVal |= 0x02;
3390 if ( IsMinDist() )
3391 nVal |= 0x04;
3392 css::uno::Sequence< css::uno::Any > aSeq{
3395 uno::Any(nVal),
3396 uno::Any(static_cast<sal_Int16>(mnValidFlags)),
3397 uno::Any(static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetDefDist()) : GetDefDist()))
3398 };
3399 rVal <<= aSeq;
3400 return true;
3401 }
3402
3403 case MID_HORIZONTAL:
3404 aRetLine = SvxBoxItem::SvxLineToLine(mpHorizontalLine.get(), bConvert);
3405 break;
3406 case MID_VERTICAL:
3407 aRetLine = SvxBoxItem::SvxLineToLine(mpVerticalLine.get(), bConvert);
3408 break;
3409 case MID_FLAGS:
3410 bIntMember = true;
3411 if ( IsTable() )
3412 nVal |= 0x01;
3413 if ( IsDist() )
3414 nVal |= 0x02;
3415 if ( IsMinDist() )
3416 nVal |= 0x04;
3417 rVal <<= nVal;
3418 break;
3419 case MID_VALIDFLAGS:
3420 bIntMember = true;
3421 rVal <<= static_cast<sal_Int16>(mnValidFlags);
3422 break;
3423 case MID_DISTANCE:
3424 bIntMember = true;
3425 rVal <<= static_cast<sal_Int32>(bConvert ? convertTwipToMm100(GetDefDist()) : GetDefDist());
3426 break;
3427 default: OSL_FAIL("Wrong MemberId!"); return false;
3428 }
3429
3430 if( !bIntMember )
3431 rVal <<= aRetLine;
3432
3433 return true;
3434}
3435
3436
3437bool SvxBoxInfoItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
3438{
3439 bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
3440 nMemberId &= ~CONVERT_TWIPS;
3441 bool bRet;
3442 switch(nMemberId)
3443 {
3444 case 0:
3445 {
3446 css::uno::Sequence< css::uno::Any > aSeq;
3447 if (( rVal >>= aSeq ) && ( aSeq.getLength() == 5 ))
3448 {
3449 // 2 BorderLines, flags, valid flags and distance
3450 if (!lcl_setLine(aSeq[0], *this, SvxBoxInfoItemLine::HORI, bConvert))
3451 return false;
3452 if (!lcl_setLine(aSeq[1], *this, SvxBoxInfoItemLine::VERT, bConvert))
3453 return false;
3454
3455 sal_Int16 nFlags( 0 );
3456 sal_Int32 nVal( 0 );
3457 if ( aSeq[2] >>= nFlags )
3458 {
3459 SetTable ( ( nFlags & 0x01 ) != 0 );
3460 SetDist ( ( nFlags & 0x02 ) != 0 );
3461 SetMinDist( ( nFlags & 0x04 ) != 0 );
3462 }
3463 else
3464 return false;
3465 if ( aSeq[3] >>= nFlags )
3466 mnValidFlags = static_cast<SvxBoxInfoItemValidFlags>(nFlags);
3467 else
3468 return false;
3469 if (( aSeq[4] >>= nVal ) && ( nVal >= 0 ))
3470 {
3471 if( bConvert )
3472 nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
3473 SetDefDist( nVal );
3474 }
3475 }
3476 return true;
3477 }
3478
3479 case MID_HORIZONTAL:
3480 case MID_VERTICAL:
3481 {
3482 if( !rVal.hasValue() )
3483 return false;
3484
3485 table::BorderLine2 aBorderLine;
3486 if( lcl_extractBorderLine(rVal, aBorderLine) )
3487 {
3488 // usual struct
3489 }
3490 else if (rVal.getValueTypeClass() == uno::TypeClass_SEQUENCE )
3491 {
3492 // serialization for basic macro recording
3493 uno::Reference < script::XTypeConverter > xConverter( script::Converter::create(::comphelper::getProcessComponentContext()) );
3494 uno::Any aNew;
3495 uno::Sequence < uno::Any > aSeq;
3496 try { aNew = xConverter->convertTo( rVal, cppu::UnoType<uno::Sequence < uno::Any >>::get() ); }
3497 catch (const uno::Exception&) {}
3498
3499 if ((aNew >>= aSeq) &&
3500 aSeq.getLength() >= 4 && aSeq.getLength() <= 6)
3501 {
3502 sal_Int32 nVal = 0;
3503 if ( aSeq[0] >>= nVal )
3504 aBorderLine.Color = nVal;
3505 if ( aSeq[1] >>= nVal )
3506 aBorderLine.InnerLineWidth = static_cast<sal_Int16>(nVal);
3507 if ( aSeq[2] >>= nVal )
3508 aBorderLine.OuterLineWidth = static_cast<sal_Int16>(nVal);
3509 if ( aSeq[3] >>= nVal )
3510 aBorderLine.LineDistance = static_cast<sal_Int16>(nVal);
3511 if (aSeq.getLength() >= 5) // fdo#40874 added fields
3512 {
3513 if (aSeq[4] >>= nVal)
3514 {
3515 aBorderLine.LineStyle = nVal;
3516 }
3517 if (aSeq.getLength() >= 6)
3518 {
3519 if (aSeq[5] >>= nVal)
3520 {
3521 aBorderLine.LineWidth = nVal;
3522 }
3523 }
3524 }
3525 }
3526 else
3527 return false;
3528 }
3529 else if (rVal.getValueType() == cppu::UnoType<css::uno::Sequence < sal_Int16 >>::get() )
3530 {
3531 // serialization for basic macro recording
3532 css::uno::Sequence < sal_Int16 > aSeq;
3533 rVal >>= aSeq;
3534 if (aSeq.getLength() >= 4 && aSeq.getLength() <= 6)
3535 {
3536 aBorderLine.Color = aSeq[0];
3537 aBorderLine.InnerLineWidth = aSeq[1];
3538 aBorderLine.OuterLineWidth = aSeq[2];
3539 aBorderLine.LineDistance = aSeq[3];
3540 if (aSeq.getLength() >= 5) // fdo#40874 added fields
3541 {
3542 aBorderLine.LineStyle = aSeq[4];
3543 if (aSeq.getLength() >= 6)
3544 {
3545 aBorderLine.LineWidth = aSeq[5];
3546 }
3547 }
3548 }
3549 else
3550 return false;
3551 }
3552 else
3553 return false;
3554
3555 SvxBorderLine aLine;
3556 bool bSet = SvxBoxItem::LineToSvxLine(aBorderLine, aLine, bConvert);
3557 if ( bSet )
3559 break;
3560 }
3561 case MID_FLAGS:
3562 {
3563 sal_Int16 nFlags = sal_Int16();
3564 bRet = (rVal >>= nFlags);
3565 if ( bRet )
3566 {
3567 SetTable ( ( nFlags & 0x01 ) != 0 );
3568 SetDist ( ( nFlags & 0x02 ) != 0 );
3569 SetMinDist( ( nFlags & 0x04 ) != 0 );
3570 }
3571
3572 break;
3573 }
3574 case MID_VALIDFLAGS:
3575 {
3576 sal_Int16 nFlags = sal_Int16();
3577 bRet = (rVal >>= nFlags);
3578 if ( bRet )
3579 mnValidFlags = static_cast<SvxBoxInfoItemValidFlags>(nFlags);
3580 break;
3581 }
3582 case MID_DISTANCE:
3583 {
3584 sal_Int32 nVal = 0;
3585 bRet = (rVal >>= nVal);
3586 if ( bRet && nVal>=0 )
3587 {
3588 if( bConvert )
3589 nVal = o3tl::toTwips(nVal, o3tl::Length::mm100);
3590 SetDefDist( static_cast<sal_uInt16>(nVal) );
3591 }
3592 break;
3593 }
3594 default: OSL_FAIL("Wrong MemberId!"); return false;
3595 }
3596
3597 return true;
3598}
3599
3600
3601namespace editeng
3602{
3603
3604void BorderDistanceFromWord(bool bFromEdge, sal_Int32& nMargin, sal_Int32& nBorderDistance,
3605 sal_Int32 nBorderWidth)
3606{
3607 // See https://wiki.openoffice.org/wiki/Writer/MSInteroperability/PageBorder
3608
3609 sal_Int32 nNewMargin = nMargin;
3610 sal_Int32 nNewBorderDistance = nBorderDistance;
3611
3612 if (bFromEdge)
3613 {
3614 nNewMargin = nBorderDistance;
3615 nNewBorderDistance = nMargin - nBorderDistance - nBorderWidth;
3616 }
3617 else
3618 {
3619 nNewMargin -= nBorderDistance + nBorderWidth;
3620 }
3621
3622 // Ensure correct distance from page edge to text in cases not supported by us:
3623 // when border is outside entire page area (!bFromEdge && BorderDistance > Margin),
3624 // and when border is inside page body area (bFromEdge && BorderDistance > Margin)
3625 if (nNewMargin < 0)
3626 {
3627 nNewMargin = 0;
3628 nNewBorderDistance = std::max<sal_Int32>(nMargin - nBorderWidth, 0);
3629 }
3630 else if (nNewBorderDistance < 0)
3631 {
3632 nNewMargin = nMargin;
3633 }
3634
3635 nMargin = nNewMargin;
3636 nBorderDistance = nNewBorderDistance;
3637}
3638
3639// Heuristics to decide if we need to use "from edge" offset of borders
3640//
3641// There are two cases when we can safely use "from text" or "from edge" offset without distorting
3642// border position (modulo rounding errors):
3643// 1. When distance of all borders from text is no greater than 31 pt, we use "from text"
3644// 2. Otherwise, if distance of all borders from edge is no greater than 31 pt, we use "from edge"
3645// In all other cases, the position of borders would be distorted on export, because Word doesn't
3646// support the offset of >31 pts (https://msdn.microsoft.com/en-us/library/ff533820), and we need
3647// to decide which type of offset would provide less wrong result (i.e., the result would look
3648// closer to original). Here, we just check sum of distances from text to borders, and if it is
3649// less than sum of distances from borders to edges. The alternative would be to compare total areas
3650// between text-and-borders and between borders-and-edges (taking into account different lengths of
3651// borders, and visual impact of that).
3652void BorderDistancesToWord(const SvxBoxItem& rBox, const WordPageMargins& rMargins,
3653 WordBorderDistances& rDistances)
3654{
3655 // Use signed sal_Int32 that can hold sal_uInt16, to prevent overflow at subtraction below
3656 const sal_Int32 nT = rBox.GetDistance(SvxBoxItemLine::TOP, /*bAllowNegative=*/true);
3657 const sal_Int32 nL = rBox.GetDistance(SvxBoxItemLine::LEFT, /*bAllowNegative=*/true);
3658 const sal_Int32 nB = rBox.GetDistance(SvxBoxItemLine::BOTTOM, /*bAllowNegative=*/true);
3659 const sal_Int32 nR = rBox.GetDistance(SvxBoxItemLine::RIGHT, /*bAllowNegative=*/true);
3660
3661 // Only take into account existing borders
3662 const SvxBorderLine* pLnT = rBox.GetLine(SvxBoxItemLine::TOP);
3663 const SvxBorderLine* pLnL = rBox.GetLine(SvxBoxItemLine::LEFT);
3664 const SvxBorderLine* pLnB = rBox.GetLine(SvxBoxItemLine::BOTTOM);
3665 const SvxBorderLine* pLnR = rBox.GetLine(SvxBoxItemLine::RIGHT);
3666
3667 // We need to take border widths into account
3668 const tools::Long nWidthT = pLnT ? pLnT->GetScaledWidth() : 0;
3669 const tools::Long nWidthL = pLnL ? pLnL->GetScaledWidth() : 0;
3670 const tools::Long nWidthB = pLnB ? pLnB->GetScaledWidth() : 0;
3671 const tools::Long nWidthR = pLnR ? pLnR->GetScaledWidth() : 0;
3672
3673 // Resulting distances from text to borders
3674 const sal_Int32 nT2BT = pLnT ? nT : 0;
3675 const sal_Int32 nT2BL = pLnL ? nL : 0;
3676 const sal_Int32 nT2BB = pLnB ? nB : 0;
3677 const sal_Int32 nT2BR = pLnR ? nR : 0;
3678
3679 // Resulting distances from edge to borders
3680 const sal_Int32 nE2BT = pLnT ? std::max<sal_Int32>(rMargins.nTop - nT - nWidthT, 0) : 0;
3681 const sal_Int32 nE2BL = pLnL ? std::max<sal_Int32>(rMargins.nLeft - nL - nWidthL, 0) : 0;
3682 const sal_Int32 nE2BB = pLnB ? std::max<sal_Int32>(rMargins.nBottom - nB - nWidthB, 0) : 0;
3683 const sal_Int32 nE2BR = pLnR ? std::max<sal_Int32>(rMargins.nRight - nR - nWidthR, 0) : 0;
3684
3685 const sal_Int32 n32pt = 32 * 20;
3686 // 1. If all borders are in range of 31 pts from text
3687 if (nT2BT >= 0 && nT2BT < n32pt && nT2BL >= 0 && nT2BL < n32pt && nT2BB >= 0 && nT2BB < n32pt && nT2BR >= 0 && nT2BR < n32pt)
3688 {
3689 rDistances.bFromEdge = false;
3690 }
3691 else
3692 {
3693 // 2. If all borders are in range of 31 pts from edge
3694 if (nE2BT < n32pt && nE2BL < n32pt && nE2BB < n32pt && nE2BR < n32pt)
3695 {
3696 rDistances.bFromEdge = true;
3697 }
3698 else
3699 {
3700 // Let's try to guess which would be the best approximation
3701 rDistances.bFromEdge =
3702 (nT2BT + nT2BL + nT2BB + nT2BR) > (nE2BT + nE2BL + nE2BB + nE2BR);
3703 }
3704 }
3705
3706 if (rDistances.bFromEdge)
3707 {
3708 rDistances.nTop = sal::static_int_cast<sal_uInt16>(nE2BT);
3709 rDistances.nLeft = sal::static_int_cast<sal_uInt16>(nE2BL);
3710 rDistances.nBottom = sal::static_int_cast<sal_uInt16>(nE2BB);
3711 rDistances.nRight = sal::static_int_cast<sal_uInt16>(nE2BR);
3712 }
3713 else
3714 {
3715 rDistances.nTop = sal::static_int_cast<sal_uInt16>(nT2BT);
3716 rDistances.nLeft = sal::static_int_cast<sal_uInt16>(nT2BL);
3717 rDistances.nBottom = sal::static_int_cast<sal_uInt16>(nT2BB);
3718 rDistances.nRight = sal::static_int_cast<sal_uInt16>(nT2BR);
3719 }
3720}
3721
3722}
3723
3724// class SvxFormatBreakItem -------------------------------------------------
3725
3727{
3728 assert(SfxPoolItem::operator==(rAttr));
3729
3730 return GetValue() == static_cast<const SvxFormatBreakItem&>( rAttr ).GetValue();
3731}
3732
3733
3735(
3736 SfxItemPresentation /*ePres*/,
3737 MapUnit /*eCoreUnit*/,
3738 MapUnit /*ePresUnit*/,
3739 OUString& rText, const IntlWrapper&
3740) const
3741{
3742 rText = GetValueTextByPos( GetEnumValue() );
3743 return true;
3744}
3745
3746OUString SvxFormatBreakItem::GetValueTextByPos( sal_uInt16 nPos )
3747{
3748 static TranslateId RID_SVXITEMS_BREAK[] =
3749 {
3750 RID_SVXITEMS_BREAK_NONE,
3751 RID_SVXITEMS_BREAK_COLUMN_BEFORE,
3752 RID_SVXITEMS_BREAK_COLUMN_AFTER,
3753 RID_SVXITEMS_BREAK_COLUMN_BOTH,
3754 RID_SVXITEMS_BREAK_PAGE_BEFORE,
3755 RID_SVXITEMS_BREAK_PAGE_AFTER,
3756 RID_SVXITEMS_BREAK_PAGE_BOTH
3757 };
3758 static_assert(std::size(RID_SVXITEMS_BREAK) == size_t(SvxBreak::End), "unexpected size");
3759 assert(nPos < sal_uInt16(SvxBreak::End) && "enum overflow!");
3760 return EditResId(RID_SVXITEMS_BREAK[nPos]);
3761}
3762
3763bool SvxFormatBreakItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
3764{
3765 style::BreakType eBreak = style::BreakType_NONE;
3766 switch ( GetBreak() )
3767 {
3768 case SvxBreak::ColumnBefore: eBreak = style::BreakType_COLUMN_BEFORE; break;
3769 case SvxBreak::ColumnAfter: eBreak = style::BreakType_COLUMN_AFTER ; break;
3770 case SvxBreak::ColumnBoth: eBreak = style::BreakType_COLUMN_BOTH ; break;
3771 case SvxBreak::PageBefore: eBreak = style::BreakType_PAGE_BEFORE ; break;
3772 case SvxBreak::PageAfter: eBreak = style::BreakType_PAGE_AFTER ; break;
3773 case SvxBreak::PageBoth: eBreak = style::BreakType_PAGE_BOTH ; break;
3774 default: ; // prevent warning
3775 }
3776 rVal <<= eBreak;
3777 return true;
3778}
3779
3780bool SvxFormatBreakItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
3781{
3782 style::BreakType nBreak;
3783
3784 if(!(rVal >>= nBreak))
3785 {
3786 sal_Int32 nValue = 0;
3787 if(!(rVal >>= nValue))
3788 return false;
3789
3790 nBreak = static_cast<style::BreakType>(nValue);
3791 }
3792
3793 SvxBreak eBreak = SvxBreak::NONE;
3794 switch( nBreak )
3795 {
3796 case style::BreakType_COLUMN_BEFORE: eBreak = SvxBreak::ColumnBefore; break;
3797 case style::BreakType_COLUMN_AFTER: eBreak = SvxBreak::ColumnAfter; break;
3798 case style::BreakType_COLUMN_BOTH: eBreak = SvxBreak::ColumnBoth; break;
3799 case style::BreakType_PAGE_BEFORE: eBreak = SvxBreak::PageBefore; break;
3800 case style::BreakType_PAGE_AFTER: eBreak = SvxBreak::PageAfter; break;
3801 case style::BreakType_PAGE_BOTH: eBreak = SvxBreak::PageBoth; break;
3802 default: ; // prevent warning
3803 }
3804 SetValue(eBreak);
3805
3806 return true;
3807}
3808
3810{
3811 return new SvxFormatBreakItem( *this );
3812}
3813
3815{
3816 return sal_uInt16(SvxBreak::End); // SvxBreak::PageBoth + 1
3817}
3818
3820{
3821 return new SvxFormatKeepItem( *this );
3822}
3823
3825(
3826 SfxItemPresentation /*ePres*/,
3827 MapUnit /*eCoreUnit*/,
3828 MapUnit /*ePresUnit*/,
3829 OUString& rText, const IntlWrapper&
3830 ) const
3831{
3832 TranslateId pId = RID_SVXITEMS_FMTKEEP_FALSE;
3833
3834 if ( GetValue() )
3835 pId = RID_SVXITEMS_FMTKEEP_TRUE;
3836 rText = EditResId(pId);
3837 return true;
3838}
3839
3841{
3842 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFormatKeepItem"));
3843
3844 SfxBoolItem::dumpAsXml(pWriter);
3845
3846 (void)xmlTextWriterEndElement(pWriter);
3847}
3848
3849SvxLineItem::SvxLineItem( const sal_uInt16 nId ) :
3850 SfxPoolItem ( nId )
3851{
3852}
3853
3854
3856 SfxPoolItem ( rCpy ),
3857 pLine(rCpy.pLine ? new SvxBorderLine( *rCpy.pLine ) : nullptr)
3858{
3859}
3860
3861
3863{
3864}
3865
3866
3867bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
3868{
3869 assert(SfxPoolItem::operator==(rAttr));
3870
3871 return CompareBorderLine(pLine, static_cast<const SvxLineItem&>(rAttr).GetLine());
3872}
3873
3875{
3876 return new SvxLineItem( *this );
3877}
3878
3879bool SvxLineItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemId ) const
3880{
3881 bool bConvert = 0!=(nMemId&CONVERT_TWIPS);
3882 nMemId &= ~CONVERT_TWIPS;
3883 if ( nMemId == 0 )
3884 {
3885 rVal <<= SvxBoxItem::SvxLineToLine(pLine.get(), bConvert);
3886 return true;
3887 }
3888 else if ( pLine )
3889 {
3890 switch ( nMemId )
3891 {
3892 case MID_FG_COLOR: rVal <<= pLine->GetColor(); break;
3893 case MID_OUTER_WIDTH: rVal <<= sal_Int32(pLine->GetOutWidth()); break;
3894 case MID_INNER_WIDTH: rVal <<= sal_Int32(pLine->GetInWidth( )); break;
3895 case MID_DISTANCE: rVal <<= sal_Int32(pLine->GetDistance()); break;
3896 default:
3897 OSL_FAIL( "Wrong MemberId" );
3898 return false;
3899 }
3900 }
3901
3902 return true;
3903}
3904
3905
3906bool SvxLineItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemId )
3907{
3908 bool bConvert = 0!=(nMemId&CONVERT_TWIPS);
3909 nMemId &= ~CONVERT_TWIPS;
3910 sal_Int32 nVal = 0;
3911 if ( nMemId == 0 )
3912 {
3913 table::BorderLine2 aLine;
3914 if ( lcl_extractBorderLine(rVal, aLine) )
3915 {
3916 if ( !pLine )
3917 pLine.reset( new SvxBorderLine );
3918 if( !SvxBoxItem::LineToSvxLine(aLine, *pLine, bConvert) )
3919 pLine.reset();
3920 return true;
3921 }
3922 return false;
3923 }
3924 else if ( rVal >>= nVal )
3925 {
3926 if ( !pLine )
3927 pLine.reset( new SvxBorderLine );
3928
3929 switch ( nMemId )
3930 {
3931 case MID_FG_COLOR: pLine->SetColor( Color(ColorTransparency, nVal) ); break;
3932 case MID_LINE_STYLE:
3933 pLine->SetBorderLineStyle(static_cast<SvxBorderLineStyle>(nVal));
3934 break;
3935 default:
3936 OSL_FAIL( "Wrong MemberId" );
3937 return false;
3938 }
3939
3940 return true;
3941 }
3942
3943 return false;
3944}
3945
3946
3948(
3949 SfxItemPresentation ePres,
3950 MapUnit eCoreUnit,
3951 MapUnit ePresUnit,
3952 OUString& rText, const IntlWrapper& rIntl
3953) const
3954{
3955 rText.clear();
3956
3957 if ( pLine )
3958 rText = pLine->GetValueString( eCoreUnit, ePresUnit, &rIntl,
3959 (SfxItemPresentation::Complete == ePres) );
3960 return true;
3961}
3962
3963
3965{
3966 if ( pLine ) pLine->ScaleMetrics( nMult, nDiv );
3967}
3968
3969
3971{
3972 return true;
3973}
3974
3975
3976void SvxLineItem::SetLine( const SvxBorderLine* pNew )
3977{
3978 pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr );
3979}
3980
3982 : SfxPoolItem(_nWhich)
3983 , aColor(COL_TRANSPARENT)
3984 , aFilterColor(COL_TRANSPARENT)
3985 , nShadingValue(ShadingPattern::CLEAR)
3986 , nGraphicTransparency(0)
3987 , eGraphicPos(GPOS_NONE)
3988 , bLoadAgain(true)
3989{
3990}
3991
3992SvxBrushItem::SvxBrushItem(const Color& rColor, sal_uInt16 _nWhich)
3993 : SfxPoolItem(_nWhich)
3994 , aColor(rColor)
3995 , aFilterColor(COL_TRANSPARENT)
3996 , nShadingValue(ShadingPattern::CLEAR)
3997 , nGraphicTransparency(0)
3998 , eGraphicPos(GPOS_NONE)
3999 , bLoadAgain(true)
4000{
4001}
4002
4003SvxBrushItem::SvxBrushItem(Color const& rColor, model::ComplexColor const& rComplexColor, sal_uInt16 nWhich)
4004 : SfxPoolItem(nWhich)
4005 , aColor(rColor)
4006 , maComplexColor(rComplexColor)
4007 , aFilterColor(COL_TRANSPARENT)
4008 , nShadingValue(ShadingPattern::CLEAR)
4009 , nGraphicTransparency(0)
4010 , eGraphicPos(GPOS_NONE)
4011 , bLoadAgain(true)
4012{
4013}
4014
4015SvxBrushItem::SvxBrushItem(const Graphic& rGraphic, SvxGraphicPosition ePos, sal_uInt16 _nWhich)
4016 : SfxPoolItem(_nWhich)
4017 , aColor(COL_TRANSPARENT)
4018 , aFilterColor(COL_TRANSPARENT)
4019 , nShadingValue(ShadingPattern::CLEAR)
4020 , xGraphicObject(new GraphicObject(rGraphic))
4021 , nGraphicTransparency(0)
4022 , eGraphicPos((GPOS_NONE != ePos) ? ePos : GPOS_MM)
4023 , bLoadAgain(true)
4024{
4025 DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
4026}
4027
4028SvxBrushItem::SvxBrushItem(const GraphicObject& rGraphicObj, SvxGraphicPosition ePos, sal_uInt16 _nWhich)
4029 : SfxPoolItem(_nWhich)
4030 , aColor(COL_TRANSPARENT)
4031 , aFilterColor(COL_TRANSPARENT)
4032 , nShadingValue(ShadingPattern::CLEAR)
4033 , xGraphicObject(new GraphicObject(rGraphicObj))
4034 , nGraphicTransparency(0)
4035 , eGraphicPos((GPOS_NONE != ePos) ? ePos : GPOS_MM)
4036 , bLoadAgain(true)
4037{
4038 DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
4039}
4040
4041SvxBrushItem::SvxBrushItem(OUString aLink, OUString aFilter,
4042 SvxGraphicPosition ePos, sal_uInt16 _nWhich)
4043 : SfxPoolItem(_nWhich)
4044 , aColor(COL_TRANSPARENT)
4045 , aFilterColor(COL_TRANSPARENT)
4046 , nShadingValue(ShadingPattern::CLEAR)
4047 , nGraphicTransparency(0)
4048 , maStrLink(std::move(aLink))
4049 , maStrFilter(std::move(aFilter))
4050 , eGraphicPos((GPOS_NONE != ePos) ? ePos : GPOS_MM)
4051 , bLoadAgain(true)
4052{
4053 DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
4054}
4055
4057 : SfxPoolItem(rItem)
4058 , aColor(rItem.aColor)
4059 , maComplexColor(rItem.maComplexColor)
4060 , aFilterColor(rItem.aFilterColor)
4061 , nShadingValue(rItem.nShadingValue)
4062 , xGraphicObject(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr)
4063 , nGraphicTransparency(rItem.nGraphicTransparency)
4064 , maStrLink(rItem.maStrLink)
4065 , maStrFilter(rItem.maStrFilter)
4066 , eGraphicPos(rItem.eGraphicPos)
4067 , bLoadAgain(rItem.bLoadAgain)
4068{
4069}
4070
4072 : SfxPoolItem(std::move(rItem))
4073 , aColor(std::move(rItem.aColor))
4074 , maComplexColor(std::move(rItem.maComplexColor))
4075 , aFilterColor(std::move(rItem.aFilterColor))
4076 , nShadingValue(std::move(rItem.nShadingValue))
4077 , xGraphicObject(std::move(rItem.xGraphicObject))
4078 , nGraphicTransparency(std::move(rItem.nGraphicTransparency))
4079 , maStrLink(std::move(rItem.maStrLink))
4080 , maStrFilter(std::move(rItem.maStrFilter))
4081 , eGraphicPos(std::move(rItem.eGraphicPos))
4082 , bLoadAgain(std::move(rItem.bLoadAgain))
4083{
4084}
4085
4087{
4088}
4089
4091{
4092 if (GPOS_NONE != GetGraphicPos())
4093 {
4094 // graphic used
4095 return true;
4096 }
4097 else if (!GetColor().IsFullyTransparent())
4098 {
4099 // color used
4100 return true;
4101 }
4102
4103 return false;
4104}
4105
4106
4108{
4109 // 0xff must not be returned!
4110 return sal_Int8(nPercent ? (50 + 0xfe * nPercent) / 100 : 0);
4111}
4112
4113
4115{
4116 return static_cast<sal_Int8>((nTrans * 100 + 127) / 254);
4117}
4118
4119
4120bool SvxBrushItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
4121{
4122 nMemberId &= ~CONVERT_TWIPS;
4123 switch( nMemberId)
4124 {
4125 case MID_BACK_COLOR:
4126 rVal <<= aColor;
4127 break;
4129 rVal <<= aColor.GetRGBColor();
4130 break;
4133 break;
4134
4136 {
4138 rVal <<= xComplexColor;
4139 break;
4140 }
4141 break;
4142
4144 rVal <<= static_cast<style::GraphicLocation>(static_cast<sal_Int16>(eGraphicPos));
4145 break;
4146
4148 rVal <<= ( aColor.GetAlpha() == 0 );
4149 break;
4150
4151 case MID_GRAPHIC_URL:
4152 case MID_GRAPHIC:
4153 {
4154 uno::Reference<graphic::XGraphic> xGraphic;
4155 if (!maStrLink.isEmpty())
4156 {
4158 xGraphic = aGraphic.GetXGraphic();
4159 }
4160 else if (xGraphicObject)
4161 {
4162 xGraphic = xGraphicObject->GetGraphic().GetXGraphic();
4163 }
4164 rVal <<= xGraphic;
4165 }
4166 break;
4167
4168 case MID_GRAPHIC_FILTER:
4169 {
4170 rVal <<= maStrFilter;
4171 }
4172 break;
4173
4175 rVal <<= nGraphicTransparency;
4176 break;
4177
4178 case MID_SHADING_VALUE:
4179 {
4180 rVal <<= nShadingValue;
4181 }
4182 break;
4183 }
4184
4185 return true;
4186}
4187
4188
4189bool SvxBrushItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
4190{
4191 nMemberId &= ~CONVERT_TWIPS;
4192 switch( nMemberId)
4193 {
4194 case MID_BACK_COLOR:
4196 {
4197 Color aNewCol;
4198 if ( !( rVal >>= aNewCol ) )
4199 return false;
4200 if(MID_BACK_COLOR_R_G_B == nMemberId)
4201 {
4202 aNewCol.SetAlpha(aColor.GetAlpha());
4203 }
4204 aColor = aNewCol;
4205 }
4206 break;
4208 {
4209 sal_Int32 nTrans = 0;
4210 if ( !( rVal >>= nTrans ) || nTrans < 0 || nTrans > 100 )
4211 return false;
4213 }
4214 break;
4215
4217 {
4218 css::uno::Reference<css::util::XComplexColor> xComplexColor;
4219 if (!(rVal >>= xComplexColor))
4220 return false;
4221
4222 if (xComplexColor.is())
4224 }
4225 break;
4226
4228 {
4229 style::GraphicLocation eLocation;
4230 if ( !( rVal>>=eLocation ) )
4231 {
4232 sal_Int32 nValue = 0;
4233 if ( !( rVal >>= nValue ) )
4234 return false;
4235 eLocation = static_cast<style::GraphicLocation>(nValue);
4236 }
4237 SetGraphicPos( static_cast<SvxGraphicPosition>(static_cast<sal_uInt16>(eLocation)) );
4238 }
4239 break;
4240
4242 aColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 );
4243 break;
4244
4245 case MID_GRAPHIC_URL:
4246 case MID_GRAPHIC:
4247 {
4248 Graphic aGraphic;
4249
4250 if (rVal.getValueType() == ::cppu::UnoType<OUString>::get())
4251 {
4252 OUString aURL = rVal.get<OUString>();
4253 aGraphic = vcl::graphic::loadFromURL(aURL);
4254 }
4255 else if (rVal.getValueType() == cppu::UnoType<graphic::XGraphic>::get())
4256 {
4257 auto xGraphic = rVal.get<uno::Reference<graphic::XGraphic>>();
4258 aGraphic = Graphic(xGraphic);
4259 }
4260
4261 if (!aGraphic.IsNone())
4262 {
4263 maStrLink.clear();
4264
4265 std::unique_ptr<GraphicObject> xOldGrfObj(std::move(xGraphicObject));
4266 xGraphicObject.reset(new GraphicObject(aGraphic));
4268 xOldGrfObj.reset();
4269
4270 if (!aGraphic.IsNone() && eGraphicPos == GPOS_NONE)
4271 {
4273 }
4274 else if (aGraphic.IsNone())
4275 {
4277 }
4278 }
4279 }
4280 break;
4281
4282 case MID_GRAPHIC_FILTER:
4283 {
4284 if( rVal.getValueType() == ::cppu::UnoType<OUString>::get() )
4285 {
4286 OUString sLink;
4287 rVal >>= sLink;
4288 SetGraphicFilter( sLink );
4289 }
4290 }
4291 break;
4293 {
4294 sal_Int32 nTmp = 0;
4295 rVal >>= nTmp;
4296 if(nTmp >= 0 && nTmp <= 100)
4297 {
4299 if (xGraphicObject)
4301 }
4302 }
4303 break;
4304
4305 case MID_SHADING_VALUE:
4306 {
4307 sal_Int32 nVal = 0;
4308 if (!(rVal >>= nVal))
4309 return false;
4310
4311 nShadingValue = nVal;
4312 }
4313 break;
4314 }
4315
4316 return true;
4317}
4318
4319
4321(
4322 SfxItemPresentation /*ePres*/,
4323 MapUnit /*eCoreUnit*/,
4324 MapUnit /*ePresUnit*/,
4325 OUString& rText, const IntlWrapper&
4326 ) const
4327{
4328 if ( GPOS_NONE == eGraphicPos )
4329 {
4330 rText = ::GetColorString( aColor ) + cpDelim;
4331 TranslateId pId = RID_SVXITEMS_TRANSPARENT_FALSE;
4332
4333 if ( aColor.IsTransparent() )
4334 pId = RID_SVXITEMS_TRANSPARENT_TRUE;
4335 rText += EditResId(pId);
4336 }
4337 else
4338 {
4339 rText = EditResId(RID_SVXITEMS_GRAPHIC);
4340 }
4341
4342 return true;
4343}
4344
4345bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
4346{
4347 assert(SfxPoolItem::operator==(rAttr));
4348
4349 const SvxBrushItem& rCmp = static_cast<const SvxBrushItem&>(rAttr);
4350 bool bEqual =
4351 aColor == rCmp.aColor &&
4353 aFilterColor == rCmp.aFilterColor &&
4354 eGraphicPos == rCmp.eGraphicPos &&
4356
4357 if ( bEqual )
4358 {
4359 if ( GPOS_NONE != eGraphicPos )
4360 {
4361 bEqual = maStrLink == rCmp.maStrLink;
4362
4363 if ( bEqual )
4364 {
4365 bEqual = maStrFilter == rCmp.maStrFilter;
4366 }
4367
4368 if ( bEqual )
4369 {
4370 if (!rCmp.xGraphicObject)
4371 bEqual = !xGraphicObject;
4372 else
4373 bEqual = xGraphicObject &&
4374 (*xGraphicObject == *rCmp.xGraphicObject);
4375 }
4376 }
4377
4378 if (bEqual)
4379 {
4380 bEqual = nShadingValue == rCmp.nShadingValue;
4381 }
4382 }
4383
4384 return bEqual;
4385}
4386
4388{
4389 return new SvxBrushItem( *this );
4390}
4391
4392const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const
4393{
4394 if (bLoadAgain && !maStrLink.isEmpty() && !xGraphicObject)
4395 // when graphics already loaded, use as a cache
4396 {
4398 return nullptr;
4399 }
4400
4401 // tdf#94088 prepare graphic and state
4402 Graphic aGraphic;
4403 bool bGraphicLoaded = false;
4404
4405 // try to create stream directly from given URL
4406 std::unique_ptr<SvStream> xStream(utl::UcbStreamHelper::CreateStream(maStrLink, StreamMode::STD_READ));
4407 // tdf#94088 if we have a stream, try to load it directly as graphic
4408 if (xStream && !xStream->GetError())
4409 {
4410 if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, maStrLink, *xStream,
4411 GRFILTER_FORMAT_DONTKNOW, nullptr, GraphicFilterImportFlags::DontSetLogsizeForJpeg))
4412 {
4413 bGraphicLoaded = true;
4414 }
4415 }
4416
4417 // tdf#94088 if no succeeded, try if the string (which is not empty) contains
4418 // a 'data:' scheme url and try to load that (embedded graphics)
4419 if(!bGraphicLoaded)
4420 {
4421 INetURLObject aGraphicURL( maStrLink );
4422
4423 if( INetProtocol::Data == aGraphicURL.GetProtocol() )
4424 {
4425 std::unique_ptr<SvMemoryStream> const xMemStream(aGraphicURL.getData());
4426 if (xMemStream)
4427 {
4428 if (ERRCODE_NONE == GraphicFilter::GetGraphicFilter().ImportGraphic(aGraphic, u"", *xMemStream))
4429 {
4430 bGraphicLoaded = true;
4431
4432 // tdf#94088 delete the no longer needed data scheme URL which
4433 // is potentially pretty // large, containing a base64 encoded copy of the graphic
4434 const_cast< SvxBrushItem* >(this)->maStrLink.clear();
4435 }
4436 }
4437 }
4438 }
4439
4440 // tdf#94088 when we got a graphic, set it
4441 if(bGraphicLoaded && GraphicType::NONE != aGraphic.GetType())
4442 {
4443 xGraphicObject.reset(new GraphicObject);
4444 xGraphicObject->SetGraphic(aGraphic);
4445 const_cast < SvxBrushItem*> (this)->ApplyGraphicTransparency_Impl();
4446 }
4447 else
4448 {
4449 bLoadAgain = false;
4450 }
4451 }
4452
4453 return xGraphicObject.get();
4454}
4455
4457{
4458 if (nNew != nGraphicTransparency)
4459 {
4460 nGraphicTransparency = nNew;
4462 }
4463}
4464
4465const Graphic* SvxBrushItem::GetGraphic(OUString const & referer) const
4466{
4467 const GraphicObject* pGrafObj = GetGraphicObject(referer);
4468 return( pGrafObj ? &( pGrafObj->GetGraphic() ) : nullptr );
4469}
4470
4472{
4473 eGraphicPos = eNew;
4474
4475 if ( GPOS_NONE == eGraphicPos )
4476 {
4477 xGraphicObject.reset();
4478 maStrLink.clear();
4479 maStrFilter.clear();
4480 }
4481 else
4482 {
4483 if (!xGraphicObject && maStrLink.isEmpty())
4484 {
4485 xGraphicObject.reset(new GraphicObject); // Creating a dummy
4486 }
4487 }
4488}
4489
4491{
4492 if ( maStrLink.isEmpty() )
4493 {
4494 if (xGraphicObject)
4495 xGraphicObject->SetGraphic(rNew);
4496 else
4497 xGraphicObject.reset(new GraphicObject(rNew));
4498
4500
4501 if ( GPOS_NONE == eGraphicPos )
4502 eGraphicPos = GPOS_MM; // None would be brush, then Default: middle
4503 }
4504 else
4505 {
4506 OSL_FAIL( "SetGraphic() on linked graphic! :-/" );
4507 }
4508}
4509
4511{
4512 if ( maStrLink.isEmpty() )
4513 {
4514 if (xGraphicObject)
4515 *xGraphicObject = rNewObj;
4516 else
4517 xGraphicObject.reset(new GraphicObject(rNewObj));
4518
4520
4521 if ( GPOS_NONE == eGraphicPos )
4522 eGraphicPos = GPOS_MM; // None would be brush, then Default: middle
4523 }
4524 else
4525 {
4526 OSL_FAIL( "SetGraphic() on linked graphic! :-/" );
4527 }
4528}
4529
4530void SvxBrushItem::SetGraphicLink( const OUString& rNew )
4531{
4532 if ( rNew.isEmpty() )
4533 maStrLink.clear();
4534 else
4535 {
4536 maStrLink = rNew;
4537 xGraphicObject.reset();
4538 }
4539}
4540
4541void SvxBrushItem::SetGraphicFilter( const OUString& rNew )
4542{
4543 maStrFilter = rNew;
4544}
4545
4547{
4548 DBG_ASSERT(xGraphicObject, "no GraphicObject available" );
4549 if (xGraphicObject)
4550 {
4551 GraphicAttr aAttr(xGraphicObject->GetAttr());
4554 xGraphicObject->SetAttr(aAttr);
4555 }
4556}
4557
4559{
4560 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBrushItem"));
4561 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
4562 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("color"), BAD_CAST(aColor.AsRGBHexString().toUtf8().getStr()));
4563 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("filtercolor"), BAD_CAST(aFilterColor.AsRGBHexString().toUtf8().getStr()));
4564 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("shadingValue"), BAD_CAST(OString::number(nShadingValue).getStr()));
4565 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("link"), BAD_CAST(maStrLink.toUtf8().getStr()));
4566 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("filter"), BAD_CAST(maStrFilter.toUtf8().getStr()));
4567 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("graphicPos"), BAD_CAST(OString::number(eGraphicPos).getStr()));
4568 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("loadAgain"), BAD_CAST(OString::boolean(bLoadAgain).getStr()));
4569 (void)xmlTextWriterEndElement(pWriter);
4570}
4571
4572
4574 sal_uInt16 _nWhich )
4575 : SfxEnumItem<SvxFrameDirection>( _nWhich, nValue )
4576{
4577}
4578
4579
4581{
4582}
4583
4585{
4586 return new SvxFrameDirectionItem( *this );
4587}
4588
4590{
4591 TranslateId const RID_SVXITEMS_FRMDIR[] =
4592 {
4593 RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP,
4594 RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP,
4595 RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT,
4596 RID_SVXITEMS_FRMDIR_VERT_TOP_LEFT,
4597 RID_SVXITEMS_FRMDIR_ENVIRONMENT,
4598 RID_SVXITEMS_FRMDIR_VERT_BOT_LEFT,
4599 RID_SVXITEMS_FRMDIR_VERT_TOP_RIGHT90
4600 };
4601 return RID_SVXITEMS_FRMDIR[nIndex];
4602}
4603
4605 SfxItemPresentation /*ePres*/,
4606 MapUnit /*eCoreUnit*/,
4607 MapUnit /*ePresUnit*/,
4608 OUString& rText, const IntlWrapper&) const
4609{
4611 return true;
4612}
4613
4614bool SvxFrameDirectionItem::PutValue( const css::uno::Any& rVal,
4615 sal_uInt8 )
4616{
4617 sal_Int16 nVal = sal_Int16();
4618 bool bRet = ( rVal >>= nVal );
4619 if( bRet )
4620 {
4621 // translate WritingDirection2 constants into SvxFrameDirection
4622 switch( nVal )
4623 {
4624 case text::WritingMode2::LR_TB:
4626 break;
4627 case text::WritingMode2::RL_TB:
4629 break;
4630 case text::WritingMode2::TB_RL:
4632 break;
4633 case text::WritingMode2::TB_LR:
4635 break;
4636 case text::WritingMode2::BT_LR:
4638 break;
4639 case text::WritingMode2::TB_RL90:
4641 break;
4642 case text::WritingMode2::PAGE:
4644 break;
4645 default:
4646 bRet = false;
4647 break;
4648 }
4649 }
4650
4651 return bRet;
4652}
4653
4654
4655bool SvxFrameDirectionItem::QueryValue( css::uno::Any& rVal,
4656 sal_uInt8 ) const
4657{
4658 // translate SvxFrameDirection into WritingDirection2
4659 sal_Int16 nVal;
4660 bool bRet = true;
4661 switch( GetValue() )
4662 {
4664 nVal = text::WritingMode2::LR_TB;
4665 break;
4667 nVal = text::WritingMode2::RL_TB;
4668 break;
4670 nVal = text::WritingMode2::TB_RL;
4671 break;
4673 nVal = text::WritingMode2::TB_LR;
4674 break;
4676 nVal = text::WritingMode2::BT_LR;
4677 break;
4679 nVal = text::WritingMode2::TB_RL90;
4680 break;
4682 nVal = text::WritingMode2::PAGE;
4683 break;
4684 default:
4685 OSL_FAIL("Unknown SvxFrameDirection value!");
4686 bRet = false;
4687 break;
4688 }
4689
4690 // return value + error state
4691 if( bRet )
4692 {
4693 rVal <<= nVal;
4694 }
4695 return bRet;
4696}
4697
4699{
4700 (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxFrameDirectionItem"));
4701 (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("m_nWhich"),
4702 BAD_CAST(OString::number(Which()).getStr()));
4703 (void)xmlTextWriterWriteAttribute(
4704 pWriter, BAD_CAST("m_nValue"),
4705 BAD_CAST(OString::number(static_cast<sal_Int16>(GetValue())).getStr()));
4706 (void)xmlTextWriterEndElement(pWriter);
4707}
4708
4709/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::chart::ChartAxisLabelPosition ePos
constexpr auto convertTwipToMm100(N n)
Reference< XInputStream > xStream
SvxBorderLineStyle
Definition: borderline.hxx:50
@ DASHED
Dashed border line.
@ DOUBLE_THIN
Double border line consisting of two fixed thin lines separated by a variable gap.
@ NONE
No border line.
@ BORDER_LINE_STYLE_MAX
Maximum valid border line style value.
@ SOLID
Solid border line.
@ DOUBLE
Double border line.
SvxBoxInfoItemValidFlags
Definition: boxitem.hxx:179
SvxBoxItemLine
Definition: boxitem.hxx:42
SvxBoxInfoItemLine
Definition: boxitem.hxx:174
SvxGraphicPosition
Definition: brushitem.hxx:33
@ GPOS_NONE
Definition: brushitem.hxx:34
@ GPOS_MM
Definition: brushitem.hxx:36
constexpr int nBorderWidth
static const AllSettings & GetSettings()
static tools::Long Scale(tools::Long nVal, tools::Long nMult, tools::Long nDiv)
sal_uInt8 GetValue() const
Color GetRGBColor() const
OUString AsRGBHexString() const
sal_uInt8 GetAlpha() const
bool IsTransparent() const
void SetAlpha(sal_uInt8 nAlpha)
void SetAlpha(sal_uInt8 cAlpha)
static GraphicFilter & GetGraphicFilter()
const Graphic & GetGraphic() const
css::uno::Reference< css::graphic::XGraphic > GetXGraphic() const
GraphicType GetType() const
bool IsNone() const
std::unique_ptr< SvMemoryStream > getData() const
INetProtocol GetProtocol() const
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const override
bool GetValue() const
virtual sal_uInt16 GetEnumValue() const override
EnumT GetValue() const
void SetValue(EnumT nTheValue)
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
sal_uInt16 Which() const
virtual boost::property_tree::ptree dumpAsJSON() const
constexpr tools::Long Height() const
void setWidth(tools::Long nWidth)
void setHeight(tools::Long nHeight)
constexpr tools::Long Width() const
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:3341
virtual SvxBoxInfoItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:3335
bool IsTable() const
Definition: boxitem.hxx:246
SvxBoxInfoItemValidFlags mnValidFlags
Definition: boxitem.hxx:217
void SetTable(bool bNew)
Definition: boxitem.hxx:247
bool mbEnableVerticalLine
true = Enable inner horizontal line.
Definition: boxitem.hxx:202
bool mbDistance
true = Enable inner vertical line.
Definition: boxitem.hxx:214
bool IsMinDist() const
Definition: boxitem.hxx:259
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:3437
bool IsDist() const
Definition: boxitem.hxx:254
std::unique_ptr< editeng::SvxBorderLine > mpVerticalLine
Definition: boxitem.hxx:199
virtual ~SvxBoxInfoItem() override
Definition: frmitems.cxx:3280
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:3374
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:3353
void ResetFlags()
Definition: frmitems.cxx:3369
sal_uInt16 mnDefaultMinimumDistance
Definition: boxitem.hxx:218
void SetDist(bool bNew)
Definition: boxitem.hxx:255
bool mbEnableHorizontalLine
Definition: boxitem.hxx:201
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:97
void SetMinDist(bool bNew)
Definition: boxitem.hxx:260
void SetDefDist(sal_uInt16 nNew)
Definition: boxitem.hxx:262
std::unique_ptr< editeng::SvxBorderLine > mpHorizontalLine
Definition: boxitem.hxx:198
const editeng::SvxBorderLine * GetHori() const
Definition: boxitem.hxx:240
sal_uInt16 GetDefDist() const
Definition: boxitem.hxx:261
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:3300
const editeng::SvxBorderLine * GetVert() const
Definition: boxitem.hxx:241
bool mbMinimumDistance
Definition: boxitem.hxx:215
virtual bool HasMetrics() const override
Definition: frmitems.cxx:3363
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:3285
SvxBoxInfoItem(const sal_uInt16 nId)
Definition: frmitems.cxx:3258
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxInfoItemLine nLine)
Definition: frmitems.cxx:3317
static bool LineToSvxLine(const css::table::BorderLine &rLine, editeng::SvxBorderLine &rSvxLine, bool bConvert)
sal_Int16 mnTopDistance
Definition: boxitem.hxx:64
const editeng::SvxBorderLine * GetTop() const
Definition: boxitem.hxx:98
void tryMigrateComplexColor(SvxBoxItemLine eLine)
Definition: frmitems.cxx:3219
virtual bool HasMetrics() const override
Definition: frmitems.cxx:3028
sal_Int16 CalcLineSpace(SvxBoxItemLine nLine, bool bEvenIfNoLine=false, bool bAllowNegative=false) const
Definition: frmitems.cxx:3178
std::unique_ptr< editeng::SvxBorderLine > mpBottomBorderLine
Definition: boxitem.hxx:60
virtual SvxBoxItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:2875
const editeng::SvxBorderLine * GetLine(SvxBoxItemLine nLine) const
Definition: frmitems.cxx:3034
sal_uInt16 GetSmallestDistance() const
Definition: frmitems.cxx:3085
const editeng::SvxBorderLine * GetRight() const
Definition: boxitem.hxx:110
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:2320
std::unique_ptr< editeng::SvxBorderLine > mpTopBorderLine
Definition: boxitem.hxx:59
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:3010
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:96
void SetLine(const editeng::SvxBorderLine *pNew, SvxBoxItemLine nLine)
Definition: frmitems.cxx:3061
static css::table::BorderLine2 SvxLineToLine(const editeng::SvxBorderLine *pLine, bool bConvert)
Definition: frmitems.cxx:2381
sal_Int16 mnRightDistance
Definition: boxitem.hxx:67
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:2362
bool mbRemoveAdjCellBorder
Definition: boxitem.hxx:72
SvxBoxItem(const sal_uInt16 nId)
Definition: frmitems.cxx:2310
const editeng::SvxBorderLine * GetLeft() const
Definition: boxitem.hxx:106
std::array< model::ComplexColor, 4 > maTempComplexColors
Definition: boxitem.hxx:70
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:2335
sal_uInt16 CalcLineWidth(SvxBoxItemLine nLine) const
Definition: frmitems.cxx:3150
std::unique_ptr< editeng::SvxBorderLine > mpLeftBorderLine
Definition: boxitem.hxx:61
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:2881
sal_Int16 GetDistance(SvxBoxItemLine nLine, bool bAllowNegative=false) const
Definition: frmitems.cxx:3100
void SetDistance(sal_Int16 nNew, SvxBoxItemLine nLine)
Definition: frmitems.cxx:3129
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:2618
std::unique_ptr< editeng::SvxBorderLine > mpRightBorderLine
Definition: boxitem.hxx:62
sal_Int16 mnBottomDistance
Definition: boxitem.hxx:65
sal_Int16 mnLeftDistance
Definition: boxitem.hxx:66
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:2401
virtual ~SvxBoxItem() override
Definition: frmitems.cxx:2316
const editeng::SvxBorderLine * GetBottom() const
Definition: boxitem.hxx:102
bool HasBorder(bool bTreatPaddingAsBorder) const
Definition: frmitems.cxx:3248
void SetAllDistances(sal_Int16 nNew)
Definition: boxitem.hxx:143
SvxBrushItem(sal_uInt16 nWhich)
Definition: frmitems.cxx:3981
void SetGraphicPos(SvxGraphicPosition eNew)
Definition: frmitems.cxx:4471
const GraphicObject * GetGraphicObject(OUString const &referer=OUString()) const
Definition: frmitems.cxx:4392
model::ComplexColor maComplexColor
Definition: brushitem.hxx:44
OUString maStrFilter
Definition: brushitem.hxx:51
void setGraphicTransparency(sal_Int8 nNew)
Definition: frmitems.cxx:4456
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:4120
const Color & GetColor() const
Definition: brushitem.hxx:90
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:94
void SetGraphicLink(const OUString &rNew)
Definition: frmitems.cxx:4530
const Graphic * GetGraphic(OUString const &referer=OUString()) const
Definition: frmitems.cxx:4465
void ApplyGraphicTransparency_Impl()
Definition: frmitems.cxx:4546
Color aColor
Definition: brushitem.hxx:43
bool isUsed() const
Definition: frmitems.cxx:4090
virtual ~SvxBrushItem() override
Definition: frmitems.cxx:4086
SvxGraphicPosition eGraphicPos
Definition: brushitem.hxx:52
bool bLoadAgain
Definition: brushitem.hxx:53
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:4345
static sal_Int8 TransparencyToPercent(sal_Int32 nTrans)
Definition: frmitems.cxx:4114
OUString maStrLink
Definition: brushitem.hxx:50
void SetGraphicObject(const GraphicObject &rNewObj)
Definition: frmitems.cxx:4510
std::unique_ptr< GraphicObject > xGraphicObject
Definition: brushitem.hxx:47
sal_Int32 nShadingValue
Definition: brushitem.hxx:46
Color aFilterColor
Definition: brushitem.hxx:45
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:4189
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:4558
SvxGraphicPosition GetGraphicPos() const
Definition: brushitem.hxx:107
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:4321
sal_Int8 nGraphicTransparency
Definition: brushitem.hxx:48
void SetGraphic(const Graphic &rNew)
Definition: frmitems.cxx:4490
virtual SvxBrushItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:4387
void SetGraphicFilter(const OUString &rNew)
Definition: frmitems.cxx:4541
first line indent that may be applied to paragraphs
Definition: lrspitem.hxx:133
virtual SvxFirstLineIndentItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1009
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1079
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:998
short m_nFirstLineOffset
First-line indent always relative to GetTextLeft()
Definition: lrspitem.hxx:136
bool m_bAutoFirst
Automatic calculation of the first line indent.
Definition: lrspitem.hxx:139
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:931
void SetPropTextFirstLineOffset(const sal_uInt16 nProp)
Definition: lrspitem.hxx:147
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:497
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1069
bool IsAutoFirst() const
Definition: lrspitem.hxx:142
sal_uInt16 GetPropTextFirstLineOffset() const
Definition: lrspitem.hxx:149
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:956
void SetAutoFirst(const bool bNew)
Definition: lrspitem.hxx:143
short GetTextFirstLineOffset() const
Definition: lrspitem.hxx:146
sal_uInt16 m_nPropFirstLineOffset
Definition: lrspitem.hxx:137
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1059
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1015
SvxFirstLineIndentItem(const sal_uInt16 nId)
Definition: frmitems.cxx:920
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1064
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:3780
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:98
static OUString GetValueTextByPos(sal_uInt16 nPos)
Definition: frmitems.cxx:3746
virtual sal_uInt16 GetValueCount() const override
Definition: frmitems.cxx:3814
virtual SvxFormatBreakItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:3809
SvxFormatBreakItem(const SvxBreak eBrk, const sal_uInt16 nWhich)
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:3763
SvxBreak GetBreak() const
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:3735
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:3726
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:3840
virtual SvxFormatKeepItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:3819
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:99
SvxFormatKeepItem(const bool bKeep, const sal_uInt16 _nWhich)
Definition: keepitem.hxx:53
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:3825
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:4614
virtual ~SvxFrameDirectionItem() override
Definition: frmitems.cxx:4580
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:4698
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:4655
SvxFrameDirectionItem(SvxFrameDirection nValue, sal_uInt16 nWhich)
Definition: frmitems.cxx:4573
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:4604
virtual SvxFrameDirectionItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:4584
gutter margin - for page styles
Definition: lrspitem.hxx:218
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1352
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1341
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1371
void SetGutterMargin(const tools::Long nGutterMargin)
Definition: lrspitem.hxx:224
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1326
SvxGutterLeftMarginItem(const sal_uInt16 nId)
Definition: frmitems.cxx:1276
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:1301
tools::Long GetGutterMargin() const
Definition: lrspitem.hxx:225
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1357
tools::Long m_nGutterMargin
The amount of extra space added to the left margin.
Definition: lrspitem.hxx:221
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1362
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:1281
virtual SvxGutterLeftMarginItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1335
gutter margin - for page styles
Definition: lrspitem.hxx:251
virtual SvxGutterRightMarginItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1441
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1463
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1468
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1432
SvxGutterRightMarginItem(const sal_uInt16 nId)
Definition: frmitems.cxx:1385
tools::Long m_nRightGutterMargin
The amount of extra space added to the right margin, on mirrored pages.
Definition: lrspitem.hxx:254
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1447
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:1411
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:1390
tools::Long GetRightGutterMargin() const
Definition: lrspitem.hxx:257
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1477
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1458
void SetGutterMargin(const tools::Long nGutterMargin)
Definition: lrspitem.hxx:353
void SetPropTextFirstLineOffset(const sal_uInt16 nProp)
Definition: lrspitem.hxx:347
tools::Long GetRightGutterMargin() const
Definition: lrspitem.hxx:356
bool bExplicitZeroMarginValLeft
Definition: lrspitem.hxx:295
short nFirstLineOffset
First-line indent always relative to GetTextLeft()
Definition: lrspitem.hxx:284
void SetExplicitZeroMarginValRight(const bool eR)
Definition: lrspitem.hxx:336
bool IsAutoFirst() const
Definition: lrspitem.hxx:331
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:338
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:326
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:391
sal_uInt16 GetPropRight() const
Definition: lrspitem.hxx:339
bool IsExplicitZeroMarginValRight() const
Definition: lrspitem.hxx:334
sal_uInt16 nPropLeftMargin
Definition: lrspitem.hxx:292
bool IsExplicitZeroMarginValLeft() const
Definition: lrspitem.hxx:335
sal_uInt16 nPropFirstLineOffset
Definition: lrspitem.hxx:292
short GetTextFirstLineOffset() const
Definition: lrspitem.hxx:346
tools::Long nLeftMargin
Definition: lrspitem.hxx:285
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1609
SvxLRSpaceItem(const sal_uInt16 nId)
Definition: frmitems.cxx:290
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:487
tools::Long GetRight() const
Definition: lrspitem.hxx:328
sal_uInt16 nPropRightMargin
Definition: lrspitem.hxx:292
virtual SvxLRSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1512
tools::Long nRightMargin
Definition: lrspitem.hxx:286
void SetExplicitZeroMarginValLeft(const bool eL)
Definition: lrspitem.hxx:337
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1601
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:539
tools::Long GetGutterMargin() const
Definition: lrspitem.hxx:354
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:91
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1636
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1615
tools::Long GetTextLeft() const
Definition: frmitems.cxx:567
tools::Long GetLeft() const
Definition: lrspitem.hxx:327
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1518
tools::Long m_nGutterMargin
The amount of extra space added to the left margin.
Definition: lrspitem.hxx:288
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1492
bool bExplicitZeroMarginValRight
Definition: lrspitem.hxx:294
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:504
void SetAutoFirst(const bool bNew)
Definition: lrspitem.hxx:332
sal_uInt16 GetPropTextFirstLineOffset() const
Definition: lrspitem.hxx:349
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:474
tools::Long m_nRightGutterMargin
The amount of extra space added to the right margin, on mirrored pages.
Definition: lrspitem.hxx:290
GetLeft() - for everything that's not applied to a paragraph.
Definition: lrspitem.hxx:51
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:64
sal_uInt16 m_nPropLeftMargin
Definition: lrspitem.hxx:55
virtual bool HasMetrics() const override
Definition: frmitems.cxx:710
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:724
SvxLeftMarginItem(const sal_uInt16 nId)
Definition: frmitems.cxx:575
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:468
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:586
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:662
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:608
tools::Long m_nLeftMargin
left margin: nothing special
Definition: lrspitem.hxx:54
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:646
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:715
tools::Long GetLeft() const
Definition: lrspitem.hxx:62
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:705
virtual SvxLeftMarginItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:656
const editeng::SvxBorderLine * GetLine() const
Definition: lineitem.hxx:61
virtual bool HasMetrics() const override
Definition: frmitems.cxx:3970
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:3867
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:100
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:3879
std::unique_ptr< editeng::SvxBorderLine > pLine
Definition: lineitem.hxx:65
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:3906
virtual SvxLineItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:3874
virtual ~SvxLineItem() override
Definition: frmitems.cxx:3862
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:3948
SvxLineItem(const sal_uInt16 nId)
Definition: frmitems.cxx:3849
void SetLine(const editeng::SvxBorderLine *pNew)
Definition: frmitems.cxx:3976
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:3964
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1930
SvxOpaqueItem(const sal_uInt16 nId, const bool bOpa=true)
Definition: opaqitem.hxx:47
virtual SvxOpaqueItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1924
virtual SvxPaperBinItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:102
SvxPaperBinItem(const sal_uInt16 nId, const sal_uInt8 nTray=PAPERBIN_PRINTER_SETTINGS)
Definition: pbinitem.hxx:52
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:89
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:108
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1909
SvxPrintItem(const sal_uInt16 nId, const bool bPrt=true)
Definition: prntitem.hxx:49
virtual SvxPrintItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1903
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:1957
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:1976
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1998
virtual SvxProtectItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1992
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1946
SvxProtectItem(const sal_uInt16 nId)
Definition: protitem.hxx:68
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:93
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:2024
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:1109
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1194
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1178
tools::Long m_nRightMargin
right margin: nothing special
Definition: lrspitem.hxx:181
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:481
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1238
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:1140
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1257
tools::Long GetRight() const
Definition: lrspitem.hxx:189
SvxRightMarginItem(const sal_uInt16 nId)
Definition: frmitems.cxx:1098
virtual SvxRightMarginItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1188
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1248
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1243
sal_uInt16 m_nPropRightMargin
Definition: lrspitem.hxx:182
sal_uInt16 GetPropRight() const
Definition: lrspitem.hxx:191
virtual sal_uInt16 GetValueCount() const override
Definition: frmitems.cxx:2265
SvxShadowItem(const sal_uInt16 nId, const Color *pColor=nullptr, const sal_uInt16 nWidth=100, const SvxShadowLocation eLoc=SvxShadowLocation::NONE)
Definition: frmitems.cxx:2035
sal_uInt16 GetWidth() const
Definition: shaditem.hxx:67
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:2146
sal_uInt16 CalcShadowSpace(SvxShadowItemSide nShadow) const
Definition: frmitems.cxx:2161
virtual sal_uInt16 GetEnumValue() const override
Definition: frmitems.cxx:2270
sal_uInt16 nWidth
Definition: shaditem.hxx:41
void SetLocation(SvxShadowLocation eNew)
Definition: shaditem.hxx:71
SvxShadowLocation GetLocation() const
Definition: shaditem.hxx:68
SvxShadowLocation eLocation
Definition: shaditem.hxx:42
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:2207
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:2048
Color aShadowColor
Definition: shaditem.hxx:40
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:2253
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:95
virtual void SetEnumValue(sal_uInt16 nNewVal) override
Definition: frmitems.cxx:2276
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:2281
virtual bool HasMetrics() const override
Definition: frmitems.cxx:2259
virtual SvxShadowItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:2156
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:2084
SvxSizeItem(const sal_uInt16 nId)
Definition: frmitems.cxx:224
virtual bool HasMetrics() const override
Definition: frmitems.cxx:284
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:174
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:244
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:277
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:150
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:90
const Size & GetSize() const
Definition: sizeitem.hxx:58
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:231
virtual SvxSizeItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:238
Size m_aSize
Definition: sizeitem.hxx:36
GetTextLeft() - for everything that's applied to a paragraph.
Definition: lrspitem.hxx:91
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:754
sal_uInt16 m_nPropLeftMargin
Definition: lrspitem.hxx:96
tools::Long m_nTextLeftMargin
left margin including negative first-line indent
Definition: lrspitem.hxx:95
virtual SvxTextLeftMarginItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:833
void SetTextLeft(const tools::Long nL, const sal_uInt16 nProp=100)
Definition: frmitems.cxx:533
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:901
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:882
virtual bool HasMetrics() const override
Definition: frmitems.cxx:887
sal_uInt16 GetPropLeft() const
Definition: lrspitem.hxx:103
tools::Long GetLeft(SvxFirstLineIndentItem const &rFirstLine) const
get left margin without negative first-line indent
Definition: frmitems.cxx:559
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:785
tools::Long GetTextLeft() const
Definition: frmitems.cxx:554
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:839
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:892
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:823
SvxTextLeftMarginItem(const sal_uInt16 nId)
Definition: frmitems.cxx:743
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:86
sal_uInt16 nLower
Definition: ulspitem.hxx:38
sal_uInt16 nPropUpper
Definition: ulspitem.hxx:40
virtual bool HasMetrics() const override
Definition: frmitems.cxx:1862
sal_uInt16 nPropLower
Definition: ulspitem.hxx:40
static SfxPoolItem * CreateDefault()
Definition: frmitems.cxx:92
sal_uInt16 nUpper
Definition: ulspitem.hxx:37
sal_uInt16 GetUpper() const
Definition: ulspitem.hxx:72
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const override
Definition: frmitems.cxx:1687
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
Definition: ulspitem.hxx:82
virtual SvxULSpaceItem * Clone(SfxItemPool *pPool=nullptr) const override
Definition: frmitems.cxx:1788
sal_uInt16 GetLower() const
Definition: ulspitem.hxx:73
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: frmitems.cxx:1868
virtual void ScaleMetrics(tools::Long nMult, tools::Long nDiv) override
Definition: frmitems.cxx:1855
virtual bool operator==(const SfxPoolItem &) const override
Definition: frmitems.cxx:1776
SvxULSpaceItem(const sal_uInt16 nId)
Definition: frmitems.cxx:1664
virtual bool GetPresentation(SfxItemPresentation ePres, MapUnit eCoreMetric, MapUnit ePresMetric, OUString &rText, const IntlWrapper &) const override
Definition: frmitems.cxx:1794
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId) override
Definition: frmitems.cxx:1714
void SetContextValue(const bool bC)
Definition: ulspitem.hxx:68
virtual boost::property_tree::ptree dumpAsJSON() const override
Definition: frmitems.cxx:1880
void SetWidth(tools::Long nWidth)
Definition: borderline.cxx:634
sal_uInt16 GetScaledWidth() const
Definition: borderline.hxx:244
void SetBorderLineStyle(SvxBorderLineStyle nNew)
Definition: borderline.cxx:552
static OUString formatPercent(double dNumber, const LanguageTag &rLangTag)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
constexpr ::Color COL_GRAY(0x80, 0x80, 0x80)
ColorTransparency
constexpr ::Color COL_TRANSPARENT(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
#define DBG_ASSERT(sCon, aError)
URL aURL
float u
OUString EditResId(TranslateId aId)
Definition: eerdll.cxx:192
#define ERRCODE_NONE
Reference< XTypeConverter > xConverter
struct _xmlTextWriter * xmlTextWriterPtr
sal_Int16 nValue
SvxFrameDirection
Defines possible text directions in frames.
Definition: frmdir.hxx:31
@ Vertical_LR_BT
Vertical, from bottom to top, from left to right (vert="vert270").
@ Environment
Use the value from the environment, can only be used in frames.
@ Vertical_LR_TB
Vertical, from top to bottom, from left to right (typical for mongol language).
@ Vertical_RL_TB
Vertical, from top to bottom, from right to left (typical for asian languages).
@ Vertical_RL_TB90
Vertical, from top to bottom, from right to left (vert="vert").
@ Horizontal_RL_TB
Horizontal, from right to left, from top to bottom (typical for arabic/hebrew languages).
@ Horizontal_LR_TB
Horizontal, from left to right, from top to bottom (typical for western languages).
static TranslateId RID_SVXITEMS_SHADOW[]
Definition: frmitems.cxx:2197
TranslateId getFrmDirResId(size_t nIndex)
Definition: frmitems.cxx:4589
static bool CompareBorderLine(const std::unique_ptr< SvxBorderLine > &pBrd1, const SvxBorderLine *pBrd2)
Definition: frmitems.cxx:2352
static sal_Int8 lcl_PercentToTransparency(tools::Long nPercent)
Definition: frmitems.cxx:4107
#define GRFILTER_FORMAT_DONTKNOW
awt::Size m_aSize
sal_Int32 nIndex
OUString GetColorString(const Color &rCol)
Definition: itemtype.cxx:137
OUString GetMetricText(tools::Long nVal, MapUnit eSrcUnit, MapUnit eDestUnit, const IntlWrapper *pIntl)
Definition: itemtype.cxx:32
TranslateId GetMetricId(MapUnit eUnit)
Definition: itemtype.cxx:191
constexpr OUStringLiteral cpDelim
Definition: itemtype.hxx:33
sal_Int64 n
sal_uInt16 nPos
Sequence< sal_Int8 > aSeq
sal_Int32 nFirstLineOffset
#define SAL_WARN_IF(condition, area, stream)
MapUnit
#define MID_WIDTH
#define MID_SIZE_HEIGHT
#define MID_SIZE_WIDTH
#define MID_SIZE_SIZE
#define BOTTOM_BORDER
Definition: memberids.h:148
#define MID_BACK_COLOR
Definition: memberids.h:166
#define MID_LO_MARGIN
Definition: memberids.h:123
#define MID_FIRST_AUTO
Definition: memberids.h:135
#define MID_GRAPHIC_URL
Definition: memberids.h:170
#define MID_CTX_MARGIN
Definition: memberids.h:126
#define MID_LO_REL_MARGIN
Definition: memberids.h:125
#define MID_GRAPHIC_POSITION
Definition: memberids.h:167
#define MID_PROTECT_POSITION
Definition: memberids.h:142
#define BORDER_DISTANCE
Definition: memberids.h:149
#define TOP_BORDER
Definition: memberids.h:147
#define MID_R_REL_MARGIN
Definition: memberids.h:132
#define MID_BG_COLOR
Definition: memberids.h:25
#define MID_BORDER_TOP_COLOR
Definition: memberids.h:163
#define MID_SHADOW_TRANSPARENCE
Definition: memberids.h:188
#define MID_TRANSPARENT
Definition: memberids.h:24
#define LEFT_BORDER_DISTANCE
Definition: memberids.h:150
#define RIGHT_BORDER
Definition: memberids.h:146
#define MID_BACK_COLOR_R_G_B
Definition: memberids.h:174
#define MID_BOTTOM_BORDER
Definition: memberids.h:157
#define MID_R_MARGIN
Definition: memberids.h:130
#define MID_VERTICAL
Definition: memberids.h:57
#define MID_PROTECT_CONTENT
Definition: memberids.h:140
#define MID_INNER_WIDTH
Definition: memberids.h:30
#define MID_PROTECT_SIZE
Definition: memberids.h:141
#define TOP_BORDER_DISTANCE
Definition: memberids.h:152
#define MID_FLAGS
Definition: memberids.h:26
#define LINE_WIDTH
Definition: memberids.h:159
#define RIGHT_BORDER_DISTANCE
Definition: memberids.h:151
#define MID_LINE_STYLE
Definition: memberids.h:32
#define MID_TOP_BORDER
Definition: memberids.h:156
#define MID_BACK_COLOR_TRANSPARENCY
Definition: memberids.h:175
#define MID_SHADING_VALUE
Definition: memberids.h:176
#define MID_FIRST_LINE_INDENT
Definition: memberids.h:133
#define MID_HORIZONTAL
Definition: memberids.h:56
#define MID_GUTTER_MARGIN
Definition: memberids.h:137
#define MID_LOCATION
Definition: memberids.h:23
#define LINE_STYLE
Definition: memberids.h:158
#define BOTTOM_BORDER_DISTANCE
Definition: memberids.h:153
#define MID_FIRST_LINE_REL_INDENT
Definition: memberids.h:134
#define MID_TXT_LMARGIN
Definition: memberids.h:136
#define MID_OUTER_WIDTH
Definition: memberids.h:29
#define MID_VALIDFLAGS
Definition: memberids.h:58
#define MID_BORDER_RIGHT_COLOR
Definition: memberids.h:162
#define MID_L_MARGIN
Definition: memberids.h:129
#define MID_BORDER_BOTTOM_COLOR
Definition: memberids.h:160
#define MID_RIGHT_BORDER
Definition: memberids.h:155
#define MID_UP_REL_MARGIN
Definition: memberids.h:124
#define MID_GRAPHIC_TRANSPARENT
Definition: memberids.h:169
#define MID_UP_MARGIN
Definition: memberids.h:122
#define MID_GRAPHIC
Definition: memberids.h:168
#define MID_LEFT_BORDER
Definition: memberids.h:154
#define MID_BACKGROUND_COMPLEX_COLOR
Definition: memberids.h:177
#define MID_FG_COLOR
Definition: memberids.h:28
#define MID_L_REL_MARGIN
Definition: memberids.h:131
#define LEFT_BORDER
Definition: memberids.h:145
#define MID_GRAPHIC_FILTER
Definition: memberids.h:171
#define MID_BORDER_LEFT_COLOR
Definition: memberids.h:161
#define MID_GRAPHIC_TRANSPARENCY
Definition: memberids.h:173
#define MID_DISTANCE
Definition: memberids.h:27
bool isUntrustedReferer(OUString const &referer)
tools::Long const nRightMargin
tools::Long const nLeftMargin
void BorderDistanceFromWord(bool bFromEdge, sal_Int32 &nMargin, sal_Int32 &nBorderDistance, sal_Int32 nBorderWidth)
Definition: frmitems.cxx:3604
void BorderDistancesToWord(const SvxBoxItem &rBox, const WordPageMargins &rMargins, WordBorderDistances &rDistances)
Definition: frmitems.cxx:3652
model::ComplexColor getFromXComplexColor(uno::Reference< util::XComplexColor > const &rxColor)
uno::Reference< util::XComplexColor > createXComplexColor(model::ComplexColor const &rColor)
constexpr auto toTwips(N number, Length from)
long Long
Graphic loadFromURL(OUString const &rURL, weld::Window *pParentWin)
bool getType(BSTR name, Type &type)
sal_Int16 nId
#define PAPERBIN_PRINTER_SETTINGS
Definition: pbinitem.hxx:27
SfxItemPresentation
#define CONVERT_TWIPS
bool Any2Bool(const css::uno::Any &rValue)
SvxShadowItemSide
Definition: shaditem.hxx:36
bool hasValue()
SvxShadowLocation
Definition: svxenum.hxx:43
SvxBreak
Definition: svxenum.hxx:88
SvxBoxItem & rBoxItem
unsigned char sal_uInt8
#define SAL_MAX_UINT16
signed char sal_Int8