summaryrefslogtreecommitdiffstats
path: root/svx/source/items
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /svx/source/items
parentInitial commit. (diff)
downloadlibreoffice-upstream.tar.xz
libreoffice-upstream.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'svx/source/items')
-rw-r--r--svx/source/items/SmartTagItem.cxx96
-rw-r--r--svx/source/items/algitem.cxx315
-rw-r--r--svx/source/items/autoformathelper.cxx393
-rw-r--r--svx/source/items/chrtitem.cxx178
-rw-r--r--svx/source/items/clipfmtitem.cxx151
-rw-r--r--svx/source/items/customshapeitem.cxx347
-rw-r--r--svx/source/items/drawitem.cxx349
-rw-r--r--svx/source/items/e3ditem.cxx100
-rw-r--r--svx/source/items/galleryitem.cxx140
-rw-r--r--svx/source/items/grfitem.cxx121
-rw-r--r--svx/source/items/hlnkitem.cxx184
-rw-r--r--svx/source/items/legacyitem.cxx105
-rw-r--r--svx/source/items/numfmtsh.cxx1593
-rw-r--r--svx/source/items/numinf.cxx131
-rw-r--r--svx/source/items/ofaitem.cxx56
-rw-r--r--svx/source/items/pageitem.cxx289
-rw-r--r--svx/source/items/postattr.cxx154
-rw-r--r--svx/source/items/rotmodit.cxx123
-rw-r--r--svx/source/items/svxerr.cxx36
-rw-r--r--svx/source/items/viewlayoutitem.cxx170
-rw-r--r--svx/source/items/zoomslideritem.cxx219
21 files changed, 5250 insertions, 0 deletions
diff --git a/svx/source/items/SmartTagItem.cxx b/svx/source/items/SmartTagItem.cxx
new file mode 100644
index 000000000..fcec36315
--- /dev/null
+++ b/svx/source/items/SmartTagItem.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <comphelper/propertysequence.hxx>
+#include <svx/SmartTagItem.hxx>
+#include <sal/log.hxx>
+
+#include <com/sun/star/container/XStringKeyMap.hpp>
+
+
+using namespace ::com::sun::star;
+
+
+SfxPoolItem* SvxSmartTagItem::CreateDefault() { SAL_WARN( "svx", "No SvxSmartTagItem factory available"); return nullptr; }
+
+SvxSmartTagItem::SvxSmartTagItem( const TypedWhichId<SvxSmartTagItem> nId,
+ const css::uno::Sequence < css::uno::Sequence< css::uno::Reference< css::smarttags::XSmartTagAction > > >& rActionComponentsSequence,
+ const css::uno::Sequence < css::uno::Sequence< sal_Int32 > >& rActionIndicesSequence,
+ const css::uno::Sequence< css::uno::Reference< css::container::XStringKeyMap > >& rStringKeyMaps,
+ const css::uno::Reference<css::text::XTextRange>& rRange,
+ const css::uno::Reference<css::frame::XController>& rController,
+ const css::lang::Locale& rLocale,
+ const OUString& rApplicationName,
+ const OUString& rRangeText ) :
+ SfxPoolItem( nId ),
+ maActionComponentsSequence( rActionComponentsSequence ),
+ maActionIndicesSequence( rActionIndicesSequence ),
+ maStringKeyMaps( rStringKeyMaps ),
+ mxRange( rRange ),
+ mxController( rController ),
+ maLocale( rLocale ),
+ maApplicationName( rApplicationName ),
+ maRangeText( rRangeText )
+{
+}
+
+
+bool SvxSmartTagItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= comphelper::InitPropertySequence( {
+ { "ActionComponents", css::uno::Any( maActionComponentsSequence ) },
+ { "ActionIndices", css::uno::Any( maActionIndicesSequence ) },
+ { "StringKeyMaps", css::uno::Any( maStringKeyMaps ) },
+ { "TextRange", css::uno::Any( mxRange ) },
+ { "Controller", css::uno::Any( mxController ) },
+ { "Locale", css::uno::Any( maLocale ) },
+ { "ApplicationName", css::uno::Any( maApplicationName ) },
+ { "RangeText", css::uno::Any( maRangeText ) },
+ } );
+ return true;
+}
+
+bool SvxSmartTagItem::PutValue( const uno::Any& /*rVal*/, sal_uInt8 /* nMemberId */)
+{
+ return false;
+}
+
+
+bool SvxSmartTagItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxSmartTagItem& rItem = static_cast<const SvxSmartTagItem&>(rAttr);
+
+ return maActionComponentsSequence == rItem.maActionComponentsSequence &&
+ maActionIndicesSequence == rItem.maActionIndicesSequence &&
+ maStringKeyMaps == rItem.maStringKeyMaps &&
+ mxRange == rItem.mxRange &&
+ mxController == rItem.mxController &&
+ maApplicationName == rItem.maApplicationName &&
+ maRangeText == rItem.maRangeText;
+}
+
+
+SvxSmartTagItem* SvxSmartTagItem::Clone( SfxItemPool * ) const
+{
+ return new SvxSmartTagItem( *this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx
new file mode 100644
index 000000000..917edb1f6
--- /dev/null
+++ b/svx/source/items/algitem.cxx
@@ -0,0 +1,315 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/strings.hrc>
+#include <osl/diagnose.h>
+#include <tools/mapunit.hxx>
+#include <tools/UnitConversion.hxx>
+#include <com/sun/star/table/CellOrientation.hpp>
+
+#include <svx/algitem.hxx>
+#include <svx/dialmgr.hxx>
+#include <editeng/itemtype.hxx>
+#include <editeng/eerdll.hxx>
+#include <svx/unomid.hxx>
+
+#include <climits>
+
+using namespace ::com::sun::star;
+
+
+SfxPoolItem* SvxMarginItem::CreateDefault() { return new SvxMarginItem(TypedWhichId<SvxMarginItem>(0)) ;}
+
+SvxOrientationItem::SvxOrientationItem( const SvxCellOrientation eOrientation,
+ const TypedWhichId<SvxOrientationItem> nId):
+ SfxEnumItem( nId, eOrientation )
+{
+}
+
+SvxOrientationItem::SvxOrientationItem( Degree100 nRotation, bool bStacked, const TypedWhichId<SvxOrientationItem> nId ) :
+ SfxEnumItem( nId, SvxCellOrientation::Standard )
+{
+ if( bStacked )
+ {
+ SetValue( SvxCellOrientation::Stacked );
+ }
+ else switch( nRotation.get() )
+ {
+ case 9000: SetValue( SvxCellOrientation::BottomUp ); break;
+ case 27000: SetValue( SvxCellOrientation::TopBottom ); break;
+ default: SetValue( SvxCellOrientation::Standard );
+ }
+}
+
+
+bool SvxOrientationItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText,
+ const IntlWrapper& ) const
+{
+ rText = GetValueText( GetValue() );
+ return true;
+}
+
+
+bool SvxOrientationItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ table::CellOrientation eUno = table::CellOrientation_STANDARD;
+ switch ( GetValue() )
+ {
+ case SvxCellOrientation::Standard: eUno = table::CellOrientation_STANDARD; break;
+ case SvxCellOrientation::TopBottom: eUno = table::CellOrientation_TOPBOTTOM; break;
+ case SvxCellOrientation::BottomUp: eUno = table::CellOrientation_BOTTOMTOP; break;
+ case SvxCellOrientation::Stacked: eUno = table::CellOrientation_STACKED; break;
+ }
+ rVal <<= eUno;
+ return true;
+}
+
+bool SvxOrientationItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ table::CellOrientation eOrient;
+ if(!(rVal >>= eOrient))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return false;
+ eOrient = static_cast<table::CellOrientation>(nValue);
+ }
+ SvxCellOrientation eSvx = SvxCellOrientation::Standard;
+ switch (eOrient)
+ {
+ case table::CellOrientation_STANDARD: eSvx = SvxCellOrientation::Standard; break;
+ case table::CellOrientation_TOPBOTTOM: eSvx = SvxCellOrientation::TopBottom; break;
+ case table::CellOrientation_BOTTOMTOP: eSvx = SvxCellOrientation::BottomUp; break;
+ case table::CellOrientation_STACKED: eSvx = SvxCellOrientation::Stacked; break;
+ default: ; //prevent warning
+ }
+ SetValue( eSvx );
+ return true;
+}
+
+OUString SvxOrientationItem::GetValueText( SvxCellOrientation nVal )
+{
+ OString id = OString::Concat(RID_SVXITEMS_ORI_STANDARD.mpId) + OString::number(static_cast<int>(nVal));
+ return SvxResId(TranslateId(RID_SVXITEMS_ORI_STANDARD.mpContext, id.getStr()));
+}
+
+SvxOrientationItem* SvxOrientationItem::Clone( SfxItemPool* ) const
+{
+ return new SvxOrientationItem( *this );
+}
+
+sal_uInt16 SvxOrientationItem::GetValueCount() const
+{
+ return static_cast<sal_uInt16>(SvxCellOrientation::Stacked) + 1; // last enum value + 1
+}
+
+bool SvxOrientationItem::IsStacked() const
+{
+ return GetValue() == SvxCellOrientation::Stacked;
+}
+
+Degree100 SvxOrientationItem::GetRotation( Degree100 nStdAngle ) const
+{
+ Degree100 nAngle = nStdAngle;
+ switch( GetValue() )
+ {
+ case SvxCellOrientation::BottomUp: nAngle = 9000_deg100; break;
+ case SvxCellOrientation::TopBottom: nAngle = 27000_deg100; break;
+ default: ; //prevent warning
+ }
+ return nAngle;
+}
+
+SvxMarginItem::SvxMarginItem( const TypedWhichId<SvxMarginItem> nId ) :
+
+ SfxPoolItem( nId ),
+
+ nLeftMargin ( 20 ),
+ nTopMargin ( 20 ),
+ nRightMargin ( 20 ),
+ nBottomMargin( 20 )
+{
+}
+
+
+SvxMarginItem::SvxMarginItem( sal_Int16 nLeft,
+ sal_Int16 nTop,
+ sal_Int16 nRight,
+ sal_Int16 nBottom,
+ const TypedWhichId<SvxMarginItem> nId ) :
+ SfxPoolItem( nId ),
+
+ nLeftMargin ( nLeft ),
+ nTopMargin ( nTop ),
+ nRightMargin ( nRight ),
+ nBottomMargin( nBottom )
+{
+}
+
+
+bool SvxMarginItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ MapUnit eCoreUnit,
+ MapUnit ePresUnit,
+ OUString& rText, const IntlWrapper& rIntl
+) const
+{
+ OUString cpDelimTmp(cpDelim);
+
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ {
+ rText = GetMetricText( static_cast<tools::Long>(nLeftMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ cpDelimTmp +
+ GetMetricText( static_cast<tools::Long>(nTopMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ cpDelimTmp +
+ GetMetricText( static_cast<tools::Long>(nRightMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ cpDelimTmp +
+ GetMetricText( static_cast<tools::Long>(nBottomMargin), eCoreUnit, ePresUnit, &rIntl );
+ return true;
+ }
+ case SfxItemPresentation::Complete:
+ {
+ rText = SvxResId(RID_SVXITEMS_MARGIN_LEFT) +
+ GetMetricText( static_cast<tools::Long>(nLeftMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ " " + EditResId(GetMetricId(ePresUnit)) +
+ cpDelimTmp +
+ SvxResId(RID_SVXITEMS_MARGIN_TOP) +
+ GetMetricText( static_cast<tools::Long>(nTopMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ " " + EditResId(GetMetricId(ePresUnit)) +
+ cpDelimTmp +
+ SvxResId(RID_SVXITEMS_MARGIN_RIGHT) +
+ GetMetricText( static_cast<tools::Long>(nRightMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ " " + EditResId(GetMetricId(ePresUnit)) +
+ cpDelimTmp +
+ SvxResId(RID_SVXITEMS_MARGIN_BOTTOM) +
+ GetMetricText( static_cast<tools::Long>(nBottomMargin), eCoreUnit, ePresUnit, &rIntl ) +
+ " " + EditResId(GetMetricId(ePresUnit));
+ return true;
+ }
+ default: ; //prevent warning
+ }
+ return false;
+}
+
+
+bool SvxMarginItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+
+ return ( ( nLeftMargin == static_cast<const SvxMarginItem&>(rItem).nLeftMargin ) &&
+ ( nTopMargin == static_cast<const SvxMarginItem&>(rItem).nTopMargin ) &&
+ ( nRightMargin == static_cast<const SvxMarginItem&>(rItem).nRightMargin ) &&
+ ( nBottomMargin == static_cast<const SvxMarginItem&>(rItem).nBottomMargin ) );
+}
+
+SvxMarginItem* SvxMarginItem::Clone( SfxItemPool* ) const
+{
+ return new SvxMarginItem(*this);
+}
+
+bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ // now sign everything
+ case MID_MARGIN_L_MARGIN:
+ rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin );
+ break;
+ case MID_MARGIN_R_MARGIN:
+ rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin );
+ break;
+ case MID_MARGIN_UP_MARGIN:
+ rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nTopMargin) : nTopMargin );
+ break;
+ case MID_MARGIN_LO_MARGIN:
+ rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nBottomMargin) : nBottomMargin );
+ break;
+ default:
+ OSL_FAIL("unknown MemberId");
+ return false;
+ }
+ return true;
+}
+
+
+bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ bool bConvert = ( ( nMemberId & CONVERT_TWIPS ) != 0 );
+ tools::Long nMaxVal = bConvert ? convertTwipToMm100(SHRT_MAX) : SHRT_MAX; // members are sal_Int16
+ sal_Int32 nVal = 0;
+ if(!(rVal >>= nVal) || (nVal > nMaxVal))
+ return false;
+
+ switch ( nMemberId & ~CONVERT_TWIPS )
+ {
+ case MID_MARGIN_L_MARGIN:
+ nLeftMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
+ break;
+ case MID_MARGIN_R_MARGIN:
+ nRightMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
+ break;
+ case MID_MARGIN_UP_MARGIN:
+ nTopMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
+ break;
+ case MID_MARGIN_LO_MARGIN:
+ nBottomMargin = static_cast<sal_Int16>( bConvert ? o3tl::toTwips(nVal, o3tl::Length::mm100) : nVal );
+ break;
+ default:
+ OSL_FAIL("unknown MemberId");
+ return false;
+ }
+ return true;
+}
+
+
+void SvxMarginItem::SetLeftMargin( sal_Int16 nLeft )
+{
+ nLeftMargin = nLeft;
+}
+
+
+void SvxMarginItem::SetTopMargin( sal_Int16 nTop )
+{
+ nTopMargin = nTop;
+}
+
+
+void SvxMarginItem::SetRightMargin( sal_Int16 nRight )
+{
+ nRightMargin = nRight;
+}
+
+
+void SvxMarginItem::SetBottomMargin( sal_Int16 nBottom )
+{
+ nBottomMargin = nBottom;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/autoformathelper.cxx b/svx/source/items/autoformathelper.cxx
new file mode 100644
index 000000000..0ae522fbd
--- /dev/null
+++ b/svx/source/items/autoformathelper.cxx
@@ -0,0 +1,393 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/autoformathelper.hxx>
+#include <tools/stream.hxx>
+#include <svl/legacyitem.hxx>
+#include <editeng/legacyitem.hxx>
+#include <svx/legacyitem.hxx>
+#include <editeng/fontitem.hxx>
+#include <editeng/fhgtitem.hxx>
+#include <editeng/wghtitem.hxx>
+#include <editeng/postitem.hxx>
+#include <editeng/udlnitem.hxx>
+#include <editeng/crossedoutitem.hxx>
+#include <editeng/contouritem.hxx>
+#include <editeng/shdditem.hxx>
+#include <editeng/colritem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/lineitem.hxx>
+#include <editeng/brushitem.hxx>
+#include <editeng/adjustitem.hxx>
+#include <editeng/justifyitem.hxx>
+#include <svl/eitem.hxx>
+#include <svx/algitem.hxx>
+#include <svl/intitem.hxx>
+#include <svx/rotmodit.hxx>
+#include <osl/thread.h>
+
+//////////////////////////////////////////////////////////////////////////////
+
+AutoFormatVersions::AutoFormatVersions()
+: nFontVersion(0),
+ nFontHeightVersion(0),
+ nWeightVersion(0),
+ nPostureVersion(0),
+ nUnderlineVersion(0),
+ nOverlineVersion(0),
+ nCrossedOutVersion(0),
+ nContourVersion(0),
+ nShadowedVersion(0),
+ nColorVersion(0),
+ nBoxVersion(0),
+ nLineVersion(0),
+ nBrushVersion(0),
+ nAdjustVersion(0),
+ nHorJustifyVersion(0),
+ nVerJustifyVersion(0),
+ nOrientationVersion(0),
+ nMarginVersion(0),
+ nBoolVersion(0),
+ nInt32Version(0),
+ nRotateModeVersion(0),
+ nNumFormatVersion(0)
+{
+}
+
+const sal_uInt16 AUTOFORMAT_ID_300OVRLN = 10031;
+const sal_uInt16 AUTOFORMAT_ID_680DR14 = 10011;
+const sal_uInt16 AUTOFORMAT_ID_504 = 9801;
+
+void AutoFormatVersions::LoadBlockA( SvStream& rStream, sal_uInt16 nVer )
+{
+ rStream.ReadUInt16( nFontVersion );
+ rStream.ReadUInt16( nFontHeightVersion );
+ rStream.ReadUInt16( nWeightVersion );
+ rStream.ReadUInt16( nPostureVersion );
+ rStream.ReadUInt16( nUnderlineVersion );
+ if ( nVer >= AUTOFORMAT_ID_300OVRLN )
+ rStream.ReadUInt16( nOverlineVersion );
+ rStream.ReadUInt16( nCrossedOutVersion );
+ rStream.ReadUInt16( nContourVersion );
+ rStream.ReadUInt16( nShadowedVersion );
+ rStream.ReadUInt16( nColorVersion );
+ rStream.ReadUInt16( nBoxVersion );
+ if ( nVer >= AUTOFORMAT_ID_680DR14 )
+ rStream.ReadUInt16( nLineVersion );
+ rStream.ReadUInt16( nBrushVersion );
+ rStream.ReadUInt16( nAdjustVersion );
+}
+
+void AutoFormatVersions::LoadBlockB( SvStream& rStream, sal_uInt16 nVer )
+{
+ rStream.ReadUInt16( nHorJustifyVersion );
+ rStream.ReadUInt16( nVerJustifyVersion );
+ rStream.ReadUInt16( nOrientationVersion );
+ rStream.ReadUInt16( nMarginVersion );
+ rStream.ReadUInt16( nBoolVersion );
+ if ( nVer >= AUTOFORMAT_ID_504 )
+ {
+ rStream.ReadUInt16( nInt32Version );
+ rStream.ReadUInt16( nRotateModeVersion );
+ }
+ rStream.ReadUInt16( nNumFormatVersion );
+}
+
+void AutoFormatVersions::WriteBlockA(SvStream& rStream, sal_uInt16 fileVersion)
+{
+ rStream.WriteUInt16(legacy::SvxFont::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxFontHeight::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxWeight::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxPosture::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxTextLine::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxTextLine::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxCrossedOut::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxColor::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxBox::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxLine::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxBrush::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxAdjust::GetVersion(fileVersion));
+}
+
+void AutoFormatVersions::WriteBlockB(SvStream& rStream, sal_uInt16 fileVersion)
+{
+ rStream.WriteUInt16(legacy::SvxHorJustify::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxVerJustify::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxOrientation::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxMargin::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SfxBool::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::CntInt32::GetVersion(fileVersion));
+ rStream.WriteUInt16(legacy::SvxRotateMode::GetVersion(fileVersion));
+ rStream.WriteUInt16( 0 ); // NumberFormat
+}
+
+//////////////////////////////////////////////////////////////////////////////
+
+void AutoFormatBase::SetFont( const SvxFontItem& rNew ) { m_aFont.reset(rNew.Clone()); }
+void AutoFormatBase::SetHeight( const SvxFontHeightItem& rNew ) { m_aHeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetWeight( const SvxWeightItem& rNew ) { m_aWeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetPosture( const SvxPostureItem& rNew ) { m_aPosture.reset(rNew.Clone()); }
+void AutoFormatBase::SetCJKFont( const SvxFontItem& rNew ) { m_aCJKFont.reset(rNew.Clone()); }
+void AutoFormatBase::SetCJKHeight( const SvxFontHeightItem& rNew ) { m_aCJKHeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetCJKWeight( const SvxWeightItem& rNew ) { m_aCJKWeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetCJKPosture( const SvxPostureItem& rNew ) { m_aCJKPosture.reset(rNew.Clone()); }
+void AutoFormatBase::SetCTLFont( const SvxFontItem& rNew ) { m_aCTLFont.reset(rNew.Clone()); }
+void AutoFormatBase::SetCTLHeight( const SvxFontHeightItem& rNew ) { m_aCTLHeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetCTLWeight( const SvxWeightItem& rNew ) { m_aCTLWeight.reset(rNew.Clone()); }
+void AutoFormatBase::SetCTLPosture( const SvxPostureItem& rNew ) { m_aCTLPosture.reset(rNew.Clone()); }
+void AutoFormatBase::SetUnderline( const SvxUnderlineItem& rNew ) { m_aUnderline.reset(rNew.Clone()); }
+void AutoFormatBase::SetOverline( const SvxOverlineItem& rNew ) { m_aOverline.reset(rNew.Clone()); }
+void AutoFormatBase::SetCrossedOut( const SvxCrossedOutItem& rNew ) { m_aCrossedOut.reset(rNew.Clone()); }
+void AutoFormatBase::SetContour( const SvxContourItem& rNew ) { m_aContour.reset(rNew.Clone()); }
+void AutoFormatBase::SetShadowed( const SvxShadowedItem& rNew ) { m_aShadowed.reset(rNew.Clone()); }
+void AutoFormatBase::SetColor( const SvxColorItem& rNew ) { m_aColor.reset(rNew.Clone()); }
+void AutoFormatBase::SetBox( const SvxBoxItem& rNew ) { m_aBox.reset(rNew.Clone()); }
+void AutoFormatBase::SetTLBR( const SvxLineItem& rNew ) { m_aTLBR.reset(rNew.Clone()); }
+void AutoFormatBase::SetBLTR( const SvxLineItem& rNew ) { m_aBLTR.reset(rNew.Clone()); }
+void AutoFormatBase::SetBackground( const SvxBrushItem& rNew ) { m_aBackground.reset(rNew.Clone()); }
+void AutoFormatBase::SetAdjust( const SvxAdjustItem& rNew ) { m_aAdjust.reset(rNew.Clone()); }
+void AutoFormatBase::SetHorJustify( const SvxHorJustifyItem& rNew ) { m_aHorJustify.reset(rNew.Clone()); }
+void AutoFormatBase::SetVerJustify( const SvxVerJustifyItem& rNew ) { m_aVerJustify.reset(rNew.Clone()); }
+void AutoFormatBase::SetStacked( const SfxBoolItem& rNew ) { m_aStacked.reset(rNew.Clone()); }
+void AutoFormatBase::SetMargin( const SvxMarginItem& rNew ) { m_aMargin.reset(rNew.Clone()); }
+void AutoFormatBase::SetLinebreak( const SfxBoolItem& rNew ) { m_aLinebreak.reset(rNew.Clone()); }
+void AutoFormatBase::SetRotateAngle( const SfxInt32Item& rNew ) { m_aRotateAngle.reset(rNew.Clone()); }
+void AutoFormatBase::SetRotateMode( const SvxRotateModeItem& rNew ) { m_aRotateMode.reset(rNew.Clone()); }
+
+AutoFormatBase::AutoFormatBase()
+{
+}
+
+AutoFormatBase::AutoFormatBase( const AutoFormatBase& rNew )
+: m_aFont(rNew.m_aFont->Clone()),
+ m_aHeight(rNew.m_aHeight->Clone()),
+ m_aWeight(rNew.m_aWeight->Clone()),
+ m_aPosture(rNew.m_aPosture->Clone()),
+ m_aCJKFont(rNew.m_aCJKFont->Clone()),
+ m_aCJKHeight(rNew.m_aCJKHeight->Clone()),
+ m_aCJKWeight(rNew.m_aCJKWeight->Clone()),
+ m_aCJKPosture(rNew.m_aCJKPosture->Clone()),
+ m_aCTLFont(rNew.m_aCTLFont->Clone()),
+ m_aCTLHeight(rNew.m_aCTLHeight->Clone()),
+ m_aCTLWeight(rNew.m_aCTLWeight->Clone()),
+ m_aCTLPosture(rNew.m_aCTLPosture->Clone()),
+ m_aUnderline(rNew.m_aUnderline->Clone()),
+ m_aOverline(rNew.m_aOverline->Clone()),
+ m_aCrossedOut(rNew.m_aCrossedOut->Clone()),
+ m_aContour(rNew.m_aContour->Clone()),
+ m_aShadowed(rNew.m_aShadowed->Clone()),
+ m_aColor(rNew.m_aColor->Clone()),
+ m_aBox(rNew.m_aBox->Clone()),
+ m_aTLBR(rNew.m_aTLBR->Clone()),
+ m_aBLTR(rNew.m_aBLTR->Clone()),
+ m_aBackground(rNew.m_aBackground->Clone()),
+ m_aAdjust(rNew.m_aAdjust->Clone()),
+ m_aHorJustify(rNew.m_aHorJustify->Clone()),
+ m_aVerJustify(rNew.m_aVerJustify->Clone()),
+ m_aStacked(rNew.m_aStacked->Clone()),
+ m_aMargin(rNew.m_aMargin->Clone()),
+ m_aLinebreak(rNew.m_aLinebreak->Clone()),
+ m_aRotateAngle(rNew.m_aRotateAngle->Clone()),
+ m_aRotateMode(rNew.m_aRotateMode->Clone())
+{
+}
+
+AutoFormatBase::~AutoFormatBase()
+{
+}
+
+AutoFormatBase& AutoFormatBase::operator=(const AutoFormatBase& rRef)
+{
+ // check self-assignment
+ if(this == &rRef)
+ {
+ return *this;
+ }
+
+ // copy local members - this will use ::Clone() on all involved Items
+ SetFont(rRef.GetFont());
+ SetHeight(rRef.GetHeight());
+ SetWeight(rRef.GetWeight());
+ SetPosture(rRef.GetPosture());
+ SetCJKFont(rRef.GetCJKFont());
+ SetCJKHeight(rRef.GetCJKHeight());
+ SetCJKWeight(rRef.GetCJKWeight());
+ SetCJKPosture(rRef.GetCJKPosture());
+ SetCTLFont(rRef.GetCTLFont());
+ SetCTLHeight(rRef.GetCTLHeight());
+ SetCTLWeight(rRef.GetCTLWeight());
+ SetCTLPosture(rRef.GetCTLPosture());
+ SetUnderline(rRef.GetUnderline());
+ SetOverline(rRef.GetOverline());
+ SetCrossedOut(rRef.GetCrossedOut());
+ SetContour(rRef.GetContour());
+ SetShadowed(rRef.GetShadowed());
+ SetColor(rRef.GetColor());
+ SetBox(rRef.GetBox());
+ SetTLBR(rRef.GetTLBR());
+ SetBLTR(rRef.GetBLTR());
+ SetBackground(rRef.GetBackground());
+ SetAdjust(rRef.GetAdjust());
+ SetHorJustify(rRef.GetHorJustify());
+ SetVerJustify(rRef.GetVerJustify());
+ SetStacked(rRef.GetStacked());
+ SetMargin(rRef.GetMargin());
+ SetLinebreak(rRef.GetLinebreak());
+ SetRotateAngle(rRef.GetRotateAngle());
+ SetRotateMode(rRef.GetRotateMode());
+
+ return *this;
+}
+
+const sal_uInt16 AUTOFORMAT_DATA_ID_641 = 10002;
+const sal_uInt16 AUTOFORMAT_DATA_ID_300OVRLN = 10032;
+const sal_uInt16 AUTOFORMAT_DATA_ID_680DR14 = 10012;
+const sal_uInt16 AUTOFORMAT_DATA_ID_504 = 9802;
+
+bool AutoFormatBase::LoadBlockA( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer )
+{
+ legacy::SvxFont::Create(*m_aFont, rStream, rVersions.nFontVersion);
+
+ if( rStream.GetStreamCharSet() == m_aFont->GetCharSet() )
+ {
+ m_aFont->SetCharSet(::osl_getThreadTextEncoding());
+ }
+
+ legacy::SvxFontHeight::Create(*m_aHeight, rStream, rVersions.nFontHeightVersion);
+ legacy::SvxWeight::Create(*m_aWeight, rStream, rVersions.nWeightVersion);
+ legacy::SvxPosture::Create(*m_aPosture, rStream, rVersions.nPostureVersion);
+
+ // --- from 641 on: CJK and CTL font settings
+ if( AUTOFORMAT_DATA_ID_641 <= nVer )
+ {
+ legacy::SvxFont::Create(*m_aCJKFont, rStream, rVersions.nFontVersion);
+ legacy::SvxFontHeight::Create(*m_aCJKHeight, rStream, rVersions.nFontHeightVersion);
+ legacy::SvxWeight::Create(*m_aCJKWeight, rStream, rVersions.nWeightVersion);
+ legacy::SvxPosture::Create(*m_aCJKPosture, rStream, rVersions.nPostureVersion);
+
+ legacy::SvxFont::Create(*m_aCTLFont, rStream, rVersions.nFontVersion);
+ legacy::SvxFontHeight::Create(*m_aCTLHeight, rStream, rVersions.nFontHeightVersion);
+ legacy::SvxWeight::Create(*m_aCTLWeight, rStream, rVersions.nWeightVersion);
+ legacy::SvxPosture::Create(*m_aCTLPosture, rStream, rVersions.nPostureVersion);
+ }
+
+ legacy::SvxTextLine::Create(*m_aUnderline, rStream, rVersions.nUnderlineVersion);
+
+ if( nVer >= AUTOFORMAT_DATA_ID_300OVRLN )
+ {
+ legacy::SvxTextLine::Create(*m_aOverline, rStream, rVersions.nOverlineVersion);
+ }
+
+ legacy::SvxCrossedOut::Create(*m_aCrossedOut, rStream, rVersions.nCrossedOutVersion);
+ legacy::SfxBool::Create(*m_aContour, rStream, rVersions.nContourVersion);
+ legacy::SfxBool::Create(*m_aShadowed, rStream, rVersions.nShadowedVersion);
+ legacy::SvxColor::Create(*m_aColor, rStream, rVersions.nColorVersion);
+ legacy::SvxBox::Create(*m_aBox, rStream, rVersions.nBoxVersion);
+
+ // --- from 680/dr14 on: diagonal frame lines
+ if( nVer >= AUTOFORMAT_DATA_ID_680DR14 )
+ {
+ legacy::SvxLine::Create(*m_aTLBR, rStream, rVersions.nLineVersion);
+ legacy::SvxLine::Create(*m_aBLTR, rStream, rVersions.nLineVersion);
+ }
+
+ legacy::SvxBrush::Create(*m_aBackground, rStream, rVersions.nBrushVersion);
+ legacy::SvxAdjust::Create(*m_aAdjust, rStream, rVersions.nAdjustVersion);
+
+ return ERRCODE_NONE == rStream.GetError();
+}
+
+bool AutoFormatBase::LoadBlockB( SvStream& rStream, const AutoFormatVersions& rVersions, sal_uInt16 nVer )
+{
+ legacy::SvxHorJustify::Create(*m_aHorJustify, rStream, rVersions.nHorJustifyVersion);
+ legacy::SvxVerJustify::Create(*m_aVerJustify, rStream, rVersions.nVerJustifyVersion);
+ SvxOrientationItem aOrientation( SvxCellOrientation::Standard, TypedWhichId<SvxOrientationItem>(0));
+ legacy::SvxOrientation::Create(aOrientation, rStream, rVersions.nOrientationVersion);
+ legacy::SvxMargin::Create(*m_aMargin, rStream, rVersions.nMarginVersion);
+ legacy::SfxBool::Create(*m_aLinebreak, rStream, rVersions.nBoolVersion);
+
+ if ( nVer >= AUTOFORMAT_DATA_ID_504 )
+ {
+ legacy::CntInt32::Create(*m_aRotateAngle, rStream, rVersions.nInt32Version);
+ legacy::SvxRotateMode::Create(*m_aRotateMode, rStream, rVersions.nRotateModeVersion);
+ }
+
+ m_aStacked->SetValue( aOrientation.IsStacked() );
+ m_aRotateAngle->SetValue( aOrientation.GetRotation( Degree100(m_aRotateAngle->GetValue()) ).get() );
+
+ return ERRCODE_NONE == rStream.GetError();
+}
+
+bool AutoFormatBase::SaveBlockA( SvStream& rStream, sal_uInt16 fileVersion ) const
+{
+ legacy::SvxFont::Store(*m_aFont, rStream, legacy::SvxFont::GetVersion(fileVersion));
+ legacy::SvxFontHeight::Store(*m_aHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion));
+ legacy::SvxWeight::Store(*m_aWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion));
+ legacy::SvxPosture::Store(*m_aPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion));
+
+ // --- from 641 on: CJK and CTL font settings
+ legacy::SvxFont::Store(*m_aCJKFont, rStream, legacy::SvxFont::GetVersion(fileVersion));
+ legacy::SvxFontHeight::Store(*m_aCJKHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion));
+ legacy::SvxWeight::Store(*m_aCJKWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion));
+ legacy::SvxPosture::Store(*m_aCJKPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion));
+
+ legacy::SvxFont::Store(*m_aCTLFont, rStream, legacy::SvxFont::GetVersion(fileVersion));
+ legacy::SvxFontHeight::Store(*m_aCTLHeight, rStream, legacy::SvxFontHeight::GetVersion(fileVersion));
+ legacy::SvxWeight::Store(*m_aCTLWeight, rStream, legacy::SvxWeight::GetVersion(fileVersion));
+ legacy::SvxPosture::Store(*m_aCTLPosture, rStream, legacy::SvxPosture::GetVersion(fileVersion));
+
+ legacy::SvxTextLine::Store(*m_aUnderline, rStream, legacy::SvxTextLine::GetVersion(fileVersion));
+
+ // --- from DEV300/overline2 on: overline support
+ legacy::SvxTextLine::Store(*m_aOverline, rStream, legacy::SvxTextLine::GetVersion(fileVersion));
+ legacy::SvxCrossedOut::Store(*m_aCrossedOut, rStream, legacy::SvxCrossedOut::GetVersion(fileVersion));
+ legacy::SfxBool::Store(*m_aContour, rStream, legacy::SfxBool::GetVersion(fileVersion));
+ legacy::SfxBool::Store(*m_aShadowed, rStream, legacy::SfxBool::GetVersion(fileVersion));
+ legacy::SvxColor::Store(*m_aColor, rStream, legacy::SvxColor::GetVersion(fileVersion));
+ legacy::SvxBox::Store(*m_aBox, rStream, legacy::SvxBox::GetVersion(fileVersion));
+
+ // --- from 680/dr14 on: diagonal frame lines
+ legacy::SvxLine::Store(*m_aTLBR, rStream, legacy::SvxLine::GetVersion(fileVersion));
+ legacy::SvxLine::Store(*m_aBLTR, rStream, legacy::SvxLine::GetVersion(fileVersion));
+ legacy::SvxBrush::Store(*m_aBackground, rStream, legacy::SvxBrush::GetVersion(fileVersion));
+ legacy::SvxAdjust::Store(*m_aAdjust, rStream, legacy::SvxAdjust::GetVersion(fileVersion));
+
+ return ERRCODE_NONE == rStream.GetError();
+}
+
+bool AutoFormatBase::SaveBlockB( SvStream& rStream, sal_uInt16 fileVersion ) const
+{
+ legacy::SvxHorJustify::Store(*m_aHorJustify, rStream, legacy::SvxHorJustify::GetVersion(fileVersion));
+ legacy::SvxVerJustify::Store(*m_aVerJustify, rStream, legacy::SvxVerJustify::GetVersion(fileVersion));
+ SvxOrientationItem aOrientation( Degree100(m_aRotateAngle->GetValue()), m_aStacked->GetValue(), TypedWhichId<SvxOrientationItem>(0) );
+ legacy::SvxOrientation::Store(aOrientation, rStream, legacy::SvxOrientation::GetVersion(fileVersion));
+ legacy::SvxMargin::Store(*m_aMargin, rStream, legacy::SvxMargin::GetVersion(fileVersion));
+ legacy::SfxBool::Store(*m_aLinebreak, rStream, legacy::SfxBool::GetVersion(fileVersion));
+
+ // Calc Rotation from SO5
+ legacy::CntInt32::Store(*m_aRotateAngle, rStream, legacy::CntInt32::GetVersion(fileVersion));
+ legacy::SvxRotateMode::Store(*m_aRotateMode, rStream, legacy::SvxRotateMode::GetVersion(fileVersion));
+
+ return ERRCODE_NONE == rStream.GetError();
+}
+
+//////////////////////////////////////////////////////////////////////////////
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/chrtitem.cxx b/svx/source/items/chrtitem.cxx
new file mode 100644
index 000000000..6fb6e8523
--- /dev/null
+++ b/svx/source/items/chrtitem.cxx
@@ -0,0 +1,178 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <rtl/math.hxx>
+#include <unotools/intlwrapper.hxx>
+#include <unotools/localedatawrapper.hxx>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+
+#include <svx/chrtitem.hxx>
+
+using namespace ::com::sun::star;
+
+
+SfxPoolItem* SvxDoubleItem::CreateDefault() { return new SvxDoubleItem(0.0, TypedWhichId<SvxDoubleItem>(0));}
+
+SvxChartTextOrderItem::SvxChartTextOrderItem(SvxChartTextOrder eOrder,
+ TypedWhichId<SvxChartTextOrderItem> nId) :
+ SfxEnumItem(nId, eOrder)
+{
+}
+
+SvxChartTextOrderItem* SvxChartTextOrderItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartTextOrderItem(*this);
+}
+
+bool SvxChartTextOrderItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ // the order of the two enums is not equal, so a mapping is required
+ css::chart::ChartAxisArrangeOrderType eAO;
+ SvxChartTextOrder eOrder( GetValue());
+
+ switch( eOrder )
+ {
+ case SvxChartTextOrder::SideBySide:
+ eAO = css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE; break;
+ case SvxChartTextOrder::UpDown:
+ eAO = css::chart::ChartAxisArrangeOrderType_STAGGER_ODD; break;
+ case SvxChartTextOrder::DownUp:
+ eAO = css::chart::ChartAxisArrangeOrderType_STAGGER_EVEN; break;
+ case SvxChartTextOrder::Auto:
+ eAO = css::chart::ChartAxisArrangeOrderType_AUTO; break;
+ }
+
+ rVal <<= eAO;
+
+ return true;
+}
+
+
+bool SvxChartTextOrderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ // the order of the two enums is not equal, so a mapping is required
+ css::chart::ChartAxisArrangeOrderType eAO;
+ SvxChartTextOrder eOrder;
+
+ if(!(rVal >>= eAO))
+ {
+ // also try an int (for Basic)
+ sal_Int32 nAO = 0;
+ if(!(rVal >>= nAO))
+ return false;
+ eAO = static_cast< css::chart::ChartAxisArrangeOrderType >( nAO );
+ }
+
+ switch( eAO )
+ {
+ case css::chart::ChartAxisArrangeOrderType_SIDE_BY_SIDE:
+ eOrder = SvxChartTextOrder::SideBySide; break;
+ case css::chart::ChartAxisArrangeOrderType_STAGGER_ODD:
+ eOrder = SvxChartTextOrder::UpDown; break;
+ case css::chart::ChartAxisArrangeOrderType_STAGGER_EVEN:
+ eOrder = SvxChartTextOrder::DownUp; break;
+ case css::chart::ChartAxisArrangeOrderType_AUTO:
+ eOrder = SvxChartTextOrder::Auto; break;
+ default:
+ return false;
+ }
+
+ SetValue( eOrder );
+
+ return true;
+}
+
+SvxDoubleItem::SvxDoubleItem(double fValue, TypedWhichId<SvxDoubleItem> nId) :
+ SfxPoolItem(nId),
+ fVal(fValue)
+{
+}
+
+SvxDoubleItem::SvxDoubleItem(const SvxDoubleItem& rItem) :
+ SfxPoolItem(rItem),
+ fVal(rItem.fVal)
+{
+}
+
+bool SvxDoubleItem::GetPresentation
+ ( SfxItemPresentation /*ePresentation*/, MapUnit /*eCoreMetric*/,
+ MapUnit /*ePresentationMetric*/, OUString& rText,
+ const IntlWrapper& rIntlWrapper) const
+{
+ rText = ::rtl::math::doubleToUString( fVal, rtl_math_StringFormat_E, 4,
+ rIntlWrapper.getLocaleData()->getNumDecimalSep()[0], true );
+ return true;
+}
+
+bool SvxDoubleItem::operator == (const SfxPoolItem& rItem) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxDoubleItem&>(rItem).fVal == fVal;
+}
+
+SvxDoubleItem* SvxDoubleItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxDoubleItem(*this);
+}
+
+bool SvxDoubleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= fVal;
+ return true;
+}
+
+bool SvxDoubleItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ return rVal >>= fVal;
+}
+
+SvxChartKindErrorItem::SvxChartKindErrorItem(SvxChartKindError eOrient,
+ TypedWhichId<SvxChartKindErrorItem> nId) :
+ SfxEnumItem(nId, eOrient)
+{
+}
+
+SvxChartKindErrorItem* SvxChartKindErrorItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartKindErrorItem(*this);
+}
+
+SvxChartIndicateItem::SvxChartIndicateItem(SvxChartIndicate eOrient,
+ TypedWhichId<SvxChartIndicateItem> nId) :
+ SfxEnumItem(nId, eOrient)
+{
+}
+
+SvxChartIndicateItem* SvxChartIndicateItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartIndicateItem(*this);
+}
+
+SvxChartRegressItem::SvxChartRegressItem(SvxChartRegress eOrient,
+ TypedWhichId<SvxChartRegressItem> nId) :
+ SfxEnumItem(nId, eOrient)
+{
+}
+
+SvxChartRegressItem* SvxChartRegressItem::Clone(SfxItemPool* /*pPool*/) const
+{
+ return new SvxChartRegressItem(*this);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/clipfmtitem.cxx b/svx/source/items/clipfmtitem.cxx
new file mode 100644
index 000000000..caae609f6
--- /dev/null
+++ b/svx/source/items/clipfmtitem.cxx
@@ -0,0 +1,151 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <vector>
+
+#include <svx/clipfmtitem.hxx>
+#include <com/sun/star/frame/status/ClipboardFormats.hpp>
+
+struct SvxClipboardFormatItem_Impl
+{
+ std::vector<OUString> aFmtNms;
+ std::vector<SotClipboardFormatId> aFmtIds;
+
+ SvxClipboardFormatItem_Impl() {}
+};
+
+SfxPoolItem* SvxClipboardFormatItem::CreateDefault() { return new SvxClipboardFormatItem(TypedWhichId<SvxClipboardFormatItem>(0)); };
+
+SvxClipboardFormatItem::SvxClipboardFormatItem( TypedWhichId<SvxClipboardFormatItem> nId )
+ : SfxPoolItem( nId ), pImpl( new SvxClipboardFormatItem_Impl )
+{
+}
+
+SvxClipboardFormatItem::SvxClipboardFormatItem( const SvxClipboardFormatItem& rCpy )
+ : SfxPoolItem( rCpy ),
+ pImpl( new SvxClipboardFormatItem_Impl( *rCpy.pImpl ) )
+{
+}
+
+SvxClipboardFormatItem::~SvxClipboardFormatItem()
+{
+}
+
+bool SvxClipboardFormatItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ sal_uInt16 nCount = Count();
+
+ css::frame::status::ClipboardFormats aClipFormats;
+
+ aClipFormats.Identifiers.realloc( nCount );
+ auto pIdentifiers = aClipFormats.Identifiers.getArray();
+ aClipFormats.Names.realloc( nCount );
+ auto pNames = aClipFormats.Names.getArray();
+ for ( sal_uInt16 n=0; n < nCount; n++ )
+ {
+ pIdentifiers[n] = static_cast<sal_Int64>(GetClipbrdFormatId( n ));
+ pNames[n] = GetClipbrdFormatName( n );
+ }
+
+ rVal <<= aClipFormats;
+ return true;
+}
+
+bool SvxClipboardFormatItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ css::frame::status::ClipboardFormats aClipFormats;
+ if ( rVal >>= aClipFormats )
+ {
+ sal_uInt16 nCount = sal_uInt16( aClipFormats.Identifiers.getLength() );
+
+ pImpl->aFmtIds.clear();
+ pImpl->aFmtNms.clear();
+ for ( sal_uInt16 n=0; n < nCount; ++n )
+ AddClipbrdFormat( static_cast<SotClipboardFormatId>(aClipFormats.Identifiers[n]), aClipFormats.Names[n], n );
+
+ return true;
+ }
+
+ return false;
+}
+
+bool SvxClipboardFormatItem::operator==( const SfxPoolItem& rComp ) const
+{
+ if (!SfxPoolItem::operator==(rComp))
+ return false;
+ const SvxClipboardFormatItem& rCmp = static_cast<const SvxClipboardFormatItem&>(rComp);
+ if(rCmp.pImpl->aFmtNms.size() != pImpl->aFmtNms.size())
+ return false;
+
+ int nRet = 1;
+ for( sal_uInt16 n = 0, nEnd = rCmp.pImpl->aFmtNms.size(); n < nEnd; ++n )
+ {
+ if( pImpl->aFmtIds[ n ] != rCmp.pImpl->aFmtIds[ n ] ||
+ pImpl->aFmtNms[n] != rCmp.pImpl->aFmtNms[n] )
+ {
+ nRet = 0;
+ break;
+ }
+ }
+
+ return nRet;
+}
+
+SvxClipboardFormatItem* SvxClipboardFormatItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxClipboardFormatItem( *this );
+}
+
+void SvxClipboardFormatItem::AddClipbrdFormat( SotClipboardFormatId nId )
+{
+ sal_uInt16 nPos = pImpl->aFmtNms.size();
+
+ pImpl->aFmtNms.insert( pImpl->aFmtNms.begin() + nPos, OUString());
+ pImpl->aFmtIds.insert( pImpl->aFmtIds.begin() + nPos, nId );
+}
+
+void SvxClipboardFormatItem::AddClipbrdFormat( SotClipboardFormatId nId, const OUString& rName,
+ sal_uInt16 nPos )
+{
+ if( nPos > pImpl->aFmtNms.size() )
+ nPos = pImpl->aFmtNms.size();
+
+ pImpl->aFmtNms.insert(pImpl->aFmtNms.begin() + nPos, rName);
+ pImpl->aFmtIds.insert( pImpl->aFmtIds.begin()+nPos, nId );
+}
+
+sal_uInt16 SvxClipboardFormatItem::Count() const
+{
+ return pImpl->aFmtIds.size();
+}
+
+SotClipboardFormatId SvxClipboardFormatItem::GetClipbrdFormatId( sal_uInt16 nPos ) const
+{
+ return pImpl->aFmtIds[ nPos ];
+}
+
+OUString const & SvxClipboardFormatItem::GetClipbrdFormatName( sal_uInt16 nPos ) const
+{
+ return pImpl->aFmtNms[nPos];
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/customshapeitem.cxx b/svx/source/items/customshapeitem.cxx
new file mode 100644
index 000000000..3caa270de
--- /dev/null
+++ b/svx/source/items/customshapeitem.cxx
@@ -0,0 +1,347 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <o3tl/any.hxx>
+#include <comphelper/anycompare.hxx>
+#include <comphelper/anytohash.hxx>
+#include <svx/sdasitm.hxx>
+
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+using namespace ::std;
+using namespace com::sun::star;
+
+
+SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem()
+: SfxPoolItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )
+{}
+
+SdrCustomShapeGeometryItem::SdrCustomShapeGeometryItem( const uno::Sequence< beans::PropertyValue >& rVal )
+: SfxPoolItem( SDRATTR_CUSTOMSHAPE_GEOMETRY )
+{
+ SetPropSeq( rVal );
+}
+
+css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rPropName )
+{
+ css::uno::Any* pRet = nullptr;
+ PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) );
+ if ( aHashIter != aPropHashMap.end() )
+ pRet = &aPropSeq.getArray()[ (*aHashIter).second ].Value;
+ return pRet;
+}
+
+const css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rPropName ) const
+{
+ const css::uno::Any* pRet = nullptr;
+ PropertyHashMap::const_iterator aHashIter( aPropHashMap.find( rPropName ) );
+ if ( aHashIter != aPropHashMap.end() )
+ pRet = &aPropSeq[ (*aHashIter).second ].Value;
+ return pRet;
+}
+
+css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rSequenceName, const OUString& rPropName )
+{
+ css::uno::Any* pRet = nullptr;
+ css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if ( pSeqAny )
+ {
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ {
+ pRet = &const_cast<css::uno::Sequence<css::beans::PropertyValue> &>(*rSecSequence).getArray()[ (*aHashIter).second ].Value;
+ }
+ }
+ }
+ return pRet;
+}
+
+const css::uno::Any* SdrCustomShapeGeometryItem::GetPropertyValueByName( const OUString& rSequenceName, const OUString& rPropName ) const
+{
+ const css::uno::Any* pRet = nullptr;
+ const css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if ( pSeqAny )
+ {
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny) )
+ {
+ PropertyPairHashMap::const_iterator aHashIter( aPropPairHashMap.find( PropertyPair( rSequenceName, rPropName ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ {
+ pRet = &(*rSecSequence)[ (*aHashIter).second ].Value;
+ }
+ }
+ }
+ return pRet;
+}
+
+void SdrCustomShapeGeometryItem::SetPropertyValue( const css::beans::PropertyValue& rPropVal )
+{
+ css::uno::Any* pAny = GetPropertyValueByName( rPropVal.Name );
+ if ( pAny )
+ { // property is already available
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
+ { // old property is a sequence->each entry has to be removed from the HashPairMap
+ for ( auto const & i : *rSecSequence )
+ {
+ PropertyPairHashMap::iterator aHashIter( aPropPairHashMap.find( PropertyPair( rPropVal.Name, i.Name ) ) );
+ if ( aHashIter != aPropPairHashMap.end() )
+ aPropPairHashMap.erase( aHashIter );
+ }
+ }
+ *pAny = rPropVal.Value;
+ if ( auto rSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pAny) )
+ { // the new property is a sequence->each entry has to be inserted into the HashPairMap
+ for ( sal_Int32 i = 0; i < rSecSequence->getLength(); i++ )
+ {
+ beans::PropertyValue const & rPropVal2 = (*rSecSequence)[ i ];
+ aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = i;
+ }
+ }
+ }
+ else
+ { // it's a new property
+ assert(std::none_of(std::cbegin(aPropSeq), std::cend(aPropSeq),
+ [&rPropVal](beans::PropertyValue const& rVal)
+ { return rVal.Name == rPropVal.Name; } ));
+ sal_uInt32 nIndex = aPropSeq.getLength();
+ aPropSeq.realloc( nIndex + 1 );
+ aPropSeq.getArray()[ nIndex ] = rPropVal ;
+
+ aPropHashMap[ rPropVal.Name ] = nIndex;
+ }
+ InvalidateHash();
+}
+
+void SdrCustomShapeGeometryItem::SetPropertyValue( const OUString& rSequenceName, const css::beans::PropertyValue& rPropVal )
+{
+ css::uno::Any* pAny = GetPropertyValueByName( rSequenceName, rPropVal.Name );
+ if ( pAny ) // just replacing
+ *pAny = rPropVal.Value;
+ else
+ {
+ css::uno::Any* pSeqAny = GetPropertyValueByName( rSequenceName );
+ if( pSeqAny == nullptr )
+ {
+ css::uno::Sequence < beans::PropertyValue > aSeq;
+ beans::PropertyValue aValue;
+ aValue.Name = rSequenceName;
+ aValue.Value <<= aSeq;
+
+ assert(std::none_of(std::cbegin(aPropSeq), std::cend(aPropSeq),
+ [&rSequenceName](beans::PropertyValue const& rV)
+ { return rV.Name == rSequenceName; } ));
+ sal_uInt32 nIndex = aPropSeq.getLength();
+ aPropSeq.realloc( nIndex + 1 );
+ auto pPropSeq = aPropSeq.getArray();
+ pPropSeq[ nIndex ] = aValue;
+ aPropHashMap[ rSequenceName ] = nIndex;
+
+ pSeqAny = &pPropSeq[ nIndex ].Value;
+ }
+
+ if (auto pSecSequence = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(*pSeqAny))
+ {
+ PropertyPairHashMap::iterator aHashIter(
+ aPropPairHashMap.find(PropertyPair(rSequenceName, rPropVal.Name)));
+ auto& rSeq = const_cast<css::uno::Sequence<css::beans::PropertyValue>&>(*pSecSequence);
+ if (aHashIter != aPropPairHashMap.end())
+ {
+ rSeq.getArray()[(*aHashIter).second].Value = rPropVal.Value;
+ }
+ else
+ {
+ const sal_Int32 nCount = pSecSequence->getLength();
+ rSeq.realloc(nCount + 1);
+ rSeq.getArray()[nCount] = rPropVal;
+
+ aPropPairHashMap[PropertyPair(rSequenceName, rPropVal.Name)] = nCount;
+ }
+ }
+ }
+ InvalidateHash();
+}
+
+void SdrCustomShapeGeometryItem::ClearPropertyValue( const OUString& rPropName )
+{
+ if ( !aPropSeq.hasElements() )
+ return;
+
+ PropertyHashMap::iterator aHashIter( aPropHashMap.find( rPropName ) );
+ if ( aHashIter == aPropHashMap.end() )
+ return;
+
+ auto pPropSeq = aPropSeq.getArray();
+ css::uno::Any& rSeqAny = pPropSeq[(*aHashIter).second].Value;
+ if (auto pSecSequence
+ = o3tl::tryAccess<css::uno::Sequence<beans::PropertyValue>>(rSeqAny))
+ {
+ for (const auto& rPropVal : *pSecSequence)
+ {
+ auto _aHashIter(aPropPairHashMap.find(PropertyPair(rPropName, rPropVal.Name)));
+ if (_aHashIter != aPropPairHashMap.end())
+ aPropPairHashMap.erase(_aHashIter); // removing property from pair hashmap
+ }
+ }
+ sal_Int32 nLength = aPropSeq.getLength();
+ if ( nLength )
+ {
+ sal_Int32 nIndex = (*aHashIter).second;
+ if ( nIndex != ( nLength - 1 ) ) // resizing sequence
+ {
+ PropertyHashMap::iterator aHashIter2( aPropHashMap.find( aPropSeq[ nLength - 1 ].Name ) );
+ (*aHashIter2).second = nIndex;
+ pPropSeq[ nIndex ] = aPropSeq[ nLength - 1 ];
+ }
+ aPropSeq.realloc( nLength - 1 );
+ }
+ aPropHashMap.erase( aHashIter ); // removing property from hashmap
+ InvalidateHash();
+}
+
+SdrCustomShapeGeometryItem::~SdrCustomShapeGeometryItem()
+{
+}
+
+bool SdrCustomShapeGeometryItem::operator==( const SfxPoolItem& rCmp ) const
+{
+ if( !SfxPoolItem::operator==( rCmp ))
+ return false;
+ const SdrCustomShapeGeometryItem& other = static_cast<const SdrCustomShapeGeometryItem&>(rCmp);
+ // This is called often by SfxItemPool, and comparing uno sequences is relatively slow.
+ // So keep a hash of the sequence and if either of the sequences has a usable hash,
+ // compare using that.
+ UpdateHash();
+ other.UpdateHash();
+ if( aHashState != other.aHashState )
+ return false;
+ if( aHashState == HashState::Valid && aHash != other.aHash )
+ return false;
+
+ return aPropSeq == other.aPropSeq;
+}
+
+bool SdrCustomShapeGeometryItem::operator<( const SfxPoolItem& rCmp ) const
+{
+ assert(dynamic_cast<const SdrCustomShapeGeometryItem*>( &rCmp ));
+ const SdrCustomShapeGeometryItem& other = static_cast<const SdrCustomShapeGeometryItem&>(rCmp);
+ // Again, try to optimize by checking hashes first (this is operator< for sorting purposes,
+ // so the ordering can be somewhat arbitrary).
+ UpdateHash();
+ other.UpdateHash();
+ if( aHashState != other.aHashState )
+ return aHashState < other.aHashState;
+ if( aHashState == HashState::Valid )
+ return aHash < other.aHash;
+
+ return comphelper::anyLess( css::uno::Any( aPropSeq ),
+ css::uno::Any( other.aPropSeq ));
+}
+
+void SdrCustomShapeGeometryItem::UpdateHash() const
+{
+ if( aHashState != HashState::Unknown )
+ return;
+ std::optional< size_t > hash = comphelper::anyToHash( css::uno::Any( aPropSeq ));
+ if( hash.has_value())
+ {
+ aHash = *hash;
+ aHashState = HashState::Valid;
+ }
+ else
+ aHashState = HashState::Unusable;
+}
+
+void SdrCustomShapeGeometryItem::InvalidateHash()
+{
+ aHashState = HashState::Unknown;
+}
+
+bool SdrCustomShapeGeometryItem::GetPresentation(
+ SfxItemPresentation ePresentation, MapUnit /*eCoreMetric*/,
+ MapUnit /*ePresentationMetric*/, OUString &rText, const IntlWrapper&) const
+{
+ rText += " ";
+ if ( ePresentation == SfxItemPresentation::Complete )
+ {
+ rText = " " + rText;
+ return true;
+ }
+ else if ( ePresentation == SfxItemPresentation::Nameless )
+ return true;
+ return false;
+}
+
+SdrCustomShapeGeometryItem* SdrCustomShapeGeometryItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SdrCustomShapeGeometryItem( aPropSeq );
+}
+
+bool SdrCustomShapeGeometryItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ rVal <<= aPropSeq;
+ return true;
+}
+
+bool SdrCustomShapeGeometryItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ css::uno::Sequence< css::beans::PropertyValue > propSeq;
+ if ( ! ( rVal >>= propSeq ) )
+ return false;
+
+ SetPropSeq( propSeq );
+ return true;
+}
+
+void SdrCustomShapeGeometryItem::SetPropSeq( const css::uno::Sequence< css::beans::PropertyValue >& rVal )
+{
+ if( aPropSeq == rVal )
+ return;
+
+ aPropSeq = rVal;
+ aPropHashMap.clear();
+ aPropPairHashMap.clear();
+ for ( sal_Int32 i = 0; i < aPropSeq.getLength(); i++ )
+ {
+ const beans::PropertyValue& rPropVal = aPropSeq[ i ];
+ std::pair<PropertyHashMap::iterator, bool> const ret(
+ aPropHashMap.insert(std::make_pair(rPropVal.Name, i)));
+ assert(ret.second); // serious bug: duplicate xml attribute exported
+ if (!ret.second)
+ {
+ throw uno::RuntimeException(
+ "CustomShapeGeometry has duplicate property " + rPropVal.Name);
+ }
+ if (auto rPropSeq = o3tl::tryAccess<uno::Sequence<beans::PropertyValue>>(
+ rPropVal.Value))
+ {
+ for ( sal_Int32 j = 0; j < rPropSeq->getLength(); j++ )
+ {
+ beans::PropertyValue const & rPropVal2 = (*rPropSeq)[ j ];
+ aPropPairHashMap[ PropertyPair( rPropVal.Name, rPropVal2.Name ) ] = j;
+ }
+ }
+ }
+ InvalidateHash();
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/drawitem.cxx b/svx/source/items/drawitem.cxx
new file mode 100644
index 000000000..24a6acb39
--- /dev/null
+++ b/svx/source/items/drawitem.cxx
@@ -0,0 +1,349 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/drawitem.hxx>
+#include <svx/xtable.hxx>
+
+using namespace ::com::sun::star;
+
+
+SfxPoolItem* SvxColorListItem::CreateDefault() { return new SvxColorListItem ;}
+SfxPoolItem* SvxGradientListItem::CreateDefault() { return new SvxGradientListItem ;}
+SfxPoolItem* SvxHatchListItem::CreateDefault() { return new SvxHatchListItem ;}
+SfxPoolItem* SvxBitmapListItem::CreateDefault() { return new SvxBitmapListItem ;}
+SfxPoolItem* SvxPatternListItem::CreateDefault() { return new SvxPatternListItem ;}
+SfxPoolItem* SvxDashListItem::CreateDefault() { return new SvxDashListItem ;}
+SfxPoolItem* SvxLineEndListItem::CreateDefault() { return new SvxLineEndListItem ;}
+
+SvxColorListItem::SvxColorListItem()
+{
+}
+
+
+SvxColorListItem::SvxColorListItem( XColorListRef const & pTable, TypedWhichId<SvxColorListItem> nW ) :
+ SfxPoolItem( nW ),
+ pColorList( pTable )
+{
+}
+
+
+SvxColorListItem::SvxColorListItem( const SvxColorListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pColorList( rItem.pColorList )
+{
+}
+
+bool SvxColorListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+bool SvxColorListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxColorListItem&>(rItem).pColorList == pColorList;
+}
+
+SvxColorListItem* SvxColorListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxColorListItem( *this );
+}
+
+// Should be a template class but ...
+#define QUERY_PUT_IMPL(svtype, xtype) \
+bool svtype::QueryValue( css::uno::Any& rVal, sal_uInt8 ) const \
+{ \
+ rVal <<= uno::Reference< uno::XWeak >( p##xtype ); \
+ return true; \
+} \
+\
+bool svtype::PutValue( const css::uno::Any& rVal, sal_uInt8 ) \
+{ \
+ uno::Reference< uno::XWeak > xRef; \
+ if( rVal >>= xRef ) { \
+ p##xtype = X##xtype##Ref(dynamic_cast<X##xtype *>(xRef.get())); \
+ return true; \
+ } \
+ return false; \
+}
+
+QUERY_PUT_IMPL( SvxColorListItem, ColorList )
+
+SvxGradientListItem::SvxGradientListItem()
+{
+}
+
+SvxGradientListItem::SvxGradientListItem( XGradientListRef const & pList, TypedWhichId<SvxGradientListItem> nW ) :
+ SfxPoolItem( nW ),
+ pGradientList( pList )
+{
+}
+
+
+SvxGradientListItem::SvxGradientListItem( const SvxGradientListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pGradientList( rItem.pGradientList )
+{
+}
+
+
+bool SvxGradientListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+
+bool SvxGradientListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxGradientListItem&>(rItem).pGradientList == pGradientList;
+}
+
+SvxGradientListItem* SvxGradientListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGradientListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxGradientListItem, GradientList )
+
+SvxHatchListItem::SvxHatchListItem()
+{
+}
+
+
+SvxHatchListItem::SvxHatchListItem( XHatchListRef const & pList, TypedWhichId<SvxHatchListItem> nW ) :
+ SfxPoolItem( nW ),
+ pHatchList( pList )
+{
+}
+
+
+SvxHatchListItem::SvxHatchListItem( const SvxHatchListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pHatchList( rItem.pHatchList )
+{
+}
+
+
+bool SvxHatchListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+
+bool SvxHatchListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxHatchListItem&>(rItem).pHatchList == pHatchList;
+}
+
+SvxHatchListItem* SvxHatchListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxHatchListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxHatchListItem, HatchList )
+
+SvxBitmapListItem::SvxBitmapListItem()
+{
+}
+
+SvxBitmapListItem::SvxBitmapListItem( XBitmapListRef const & pList, TypedWhichId<SvxBitmapListItem> nW ) :
+ SfxPoolItem( nW ),
+ pBitmapList( pList )
+{
+}
+
+SvxBitmapListItem::SvxBitmapListItem( const SvxBitmapListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pBitmapList( rItem.pBitmapList )
+{
+}
+
+bool SvxBitmapListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+bool SvxBitmapListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxBitmapListItem&>(rItem).pBitmapList == pBitmapList;
+}
+
+SvxBitmapListItem* SvxBitmapListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxBitmapListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxBitmapListItem, BitmapList )
+
+SvxPatternListItem::SvxPatternListItem()
+{
+}
+
+SvxPatternListItem::SvxPatternListItem( XPatternListRef const & pList, TypedWhichId<SvxPatternListItem> nW ) :
+ SfxPoolItem( nW ),
+ pPatternList( pList )
+{
+}
+
+SvxPatternListItem::SvxPatternListItem( const SvxPatternListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pPatternList( rItem.pPatternList )
+{
+}
+
+bool SvxPatternListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+bool SvxPatternListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxPatternListItem&>(rItem).pPatternList == pPatternList;
+}
+
+SvxPatternListItem* SvxPatternListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPatternListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxPatternListItem, PatternList )
+
+SvxDashListItem::SvxDashListItem()
+{
+}
+
+SvxDashListItem::SvxDashListItem( XDashListRef const & pList, TypedWhichId<SvxDashListItem> nW ) :
+ SfxPoolItem( nW ),
+ pDashList( pList )
+{
+}
+
+SvxDashListItem::SvxDashListItem( const SvxDashListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pDashList( rItem.pDashList )
+{
+}
+
+bool SvxDashListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+bool SvxDashListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxDashListItem&>(rItem).pDashList == pDashList;
+}
+
+SvxDashListItem* SvxDashListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxDashListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxDashListItem, DashList )
+
+SvxLineEndListItem::SvxLineEndListItem()
+{
+}
+
+SvxLineEndListItem::SvxLineEndListItem( XLineEndListRef const & pList, TypedWhichId<SvxLineEndListItem> nW ) :
+ SfxPoolItem( nW ),
+ pLineEndList( pList )
+{
+}
+
+SvxLineEndListItem::SvxLineEndListItem( const SvxLineEndListItem& rItem ) :
+ SfxPoolItem( rItem ),
+ pLineEndList( rItem.pLineEndList )
+{
+}
+
+bool SvxLineEndListItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+bool SvxLineEndListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxLineEndListItem&>(rItem).pLineEndList == pLineEndList;
+}
+
+SvxLineEndListItem* SvxLineEndListItem::Clone( SfxItemPool * ) const
+{
+ return new SvxLineEndListItem( *this );
+}
+
+QUERY_PUT_IMPL( SvxLineEndListItem, LineEndList )
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/e3ditem.cxx b/svx/source/items/e3ditem.cxx
new file mode 100644
index 000000000..135c7efaf
--- /dev/null
+++ b/svx/source/items/e3ditem.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/drawing/Direction3D.hpp>
+#include <libxml/xmlwriter.h>
+
+#include <svx/e3ditem.hxx>
+
+using namespace ::com::sun::star;
+
+
+SvxB3DVectorItem::~SvxB3DVectorItem()
+{
+}
+
+
+SvxB3DVectorItem::SvxB3DVectorItem( TypedWhichId<SvxB3DVectorItem> _nWhich, const basegfx::B3DVector& rVal ) :
+ SfxPoolItem( _nWhich ),
+ aVal( rVal )
+{
+}
+
+
+SvxB3DVectorItem::SvxB3DVectorItem( const SvxB3DVectorItem& rItem ) :
+ SfxPoolItem( rItem ),
+ aVal( rItem.aVal )
+{
+}
+
+
+bool SvxB3DVectorItem::operator==( const SfxPoolItem &rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+ return static_cast<const SvxB3DVectorItem&>(rItem).aVal == aVal;
+}
+
+SvxB3DVectorItem* SvxB3DVectorItem::Clone( SfxItemPool* /*pPool*/ ) const
+{
+ return new SvxB3DVectorItem( *this );
+}
+
+bool SvxB3DVectorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ assert(!std::isnan(aVal.getX()) && !std::isnan(aVal.getY()) && !std::isnan(aVal.getZ()));
+
+ drawing::Direction3D aDirection;
+
+ // enter values
+ aDirection.DirectionX = aVal.getX();
+ aDirection.DirectionY = aVal.getY();
+ aDirection.DirectionZ = aVal.getZ();
+
+ rVal <<= aDirection;
+ return true;
+}
+
+
+bool SvxB3DVectorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ drawing::Direction3D aDirection;
+ if(!(rVal >>= aDirection))
+ return false;
+
+ aVal.setX(aDirection.DirectionX);
+ aVal.setY(aDirection.DirectionY);
+ aVal.setZ(aDirection.DirectionZ);
+
+ assert(!std::isnan(aVal.getX()) && !std::isnan(aVal.getY()) && !std::isnan(aVal.getZ()));
+
+ return true;
+}
+
+
+void SvxB3DVectorItem::dumpAsXml(xmlTextWriterPtr pWriter) const
+{
+ (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxB3DVectorItem"));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("x"), BAD_CAST(OString::number(aVal.getX()).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("y"), BAD_CAST(OString::number(aVal.getY()).getStr()));
+ (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("z"), BAD_CAST(OString::number(aVal.getZ()).getStr()));
+ (void)xmlTextWriterEndElement(pWriter);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/galleryitem.cxx b/svx/source/items/galleryitem.cxx
new file mode 100644
index 000000000..5e50c5efb
--- /dev/null
+++ b/svx/source/items/galleryitem.cxx
@@ -0,0 +1,140 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/galleryitem.hxx>
+#include <com/sun/star/gallery/GalleryItemType.hpp>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/uno/Sequence.hxx>
+
+#include <comphelper/propertyvalue.hxx>
+
+#include <cassert>
+
+
+SfxPoolItem* SvxGalleryItem::CreateDefault() { return new SvxGalleryItem; }
+
+SvxGalleryItem::SvxGalleryItem()
+ : m_nType( css::gallery::GalleryItemType::EMPTY )
+{
+}
+
+SvxGalleryItem::SvxGalleryItem( const SvxGalleryItem &rItem )
+ : SfxPoolItem( rItem )
+ , m_nType( rItem.m_nType )
+ , m_aURL( rItem.m_aURL )
+ , m_xDrawing( rItem.m_xDrawing )
+ , m_xGraphic( rItem.m_xGraphic )
+{
+}
+
+SvxGalleryItem::~SvxGalleryItem()
+{
+}
+
+bool SvxGalleryItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /* nMemberId */ ) const
+{
+ css::uno::Sequence< css::beans::PropertyValue > aSeq{
+ comphelper::makePropertyValue(SVXGALLERYITEM_TYPE, m_nType),
+ comphelper::makePropertyValue(SVXGALLERYITEM_URL, m_aURL),
+ comphelper::makePropertyValue(SVXGALLERYITEM_FILTER, m_aURL),
+ comphelper::makePropertyValue(SVXGALLERYITEM_DRAWING, m_xDrawing),
+ comphelper::makePropertyValue(SVXGALLERYITEM_GRAPHIC, m_xGraphic)
+ };
+ assert(aSeq.getLength() == SVXGALLERYITEM_PARAMS);
+
+ rVal <<= aSeq;
+
+ return true;
+}
+
+bool SvxGalleryItem::PutValue( const css::uno::Any& rVal, sal_uInt8 /* nMemberId */)
+{
+ css::uno::Sequence< css::beans::PropertyValue > aSeq;
+
+ if ( !( rVal >>= aSeq ) || ( aSeq.getLength() < SVXGALLERYITEM_PARAMS ) )
+ return false;
+
+ int nConverted(0);
+ bool bAllConverted( true );
+
+ sal_Int8 nType(0);
+ OUString aURL, aFilterName;
+ css::uno::Reference< css::lang::XComponent > xDrawing;
+ css::uno::Reference< css::graphic::XGraphic > xGraphic;
+
+ for ( const css::beans::PropertyValue& rProp : std::as_const(aSeq) )
+ {
+ if ( rProp.Name == SVXGALLERYITEM_TYPE )
+ {
+ bAllConverted &= ( rProp.Value >>= nType );
+ ++nConverted;
+ }
+ else if ( rProp.Name == SVXGALLERYITEM_URL )
+ {
+ bAllConverted &= ( rProp.Value >>= aURL );
+ ++nConverted;
+ }
+ else if ( rProp.Name == SVXGALLERYITEM_FILTER )
+ {
+ bAllConverted &= ( rProp.Value >>= aFilterName );
+ ++nConverted;
+ }
+ else if ( rProp.Name == SVXGALLERYITEM_DRAWING )
+ {
+ bAllConverted &= ( rProp.Value >>= xDrawing );
+ ++nConverted;
+ }
+ else if ( rProp.Name == SVXGALLERYITEM_GRAPHIC )
+ {
+ bAllConverted &= ( rProp.Value >>= xGraphic );
+ ++nConverted;
+ }
+ }
+
+ if ( !bAllConverted || nConverted != SVXGALLERYITEM_PARAMS )
+ return false;
+
+ m_nType = nType;
+ m_aURL = aURL;
+ m_xDrawing = xDrawing;
+ m_xGraphic = xGraphic;
+
+ return true;
+}
+
+bool SvxGalleryItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxGalleryItem& rItem = static_cast<const SvxGalleryItem&>(rAttr);
+
+ return m_nType == rItem.m_nType &&
+ m_aURL == rItem.m_aURL &&
+ m_xDrawing == rItem.m_xDrawing &&
+ m_xGraphic == rItem.m_xGraphic;
+}
+
+SvxGalleryItem* SvxGalleryItem::Clone( SfxItemPool * ) const
+{
+ return new SvxGalleryItem( *this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/grfitem.cxx b/svx/source/items/grfitem.cxx
new file mode 100644
index 000000000..30c0977a0
--- /dev/null
+++ b/svx/source/items/grfitem.cxx
@@ -0,0 +1,121 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/grfcrop.hxx>
+#include <editeng/itemtype.hxx>
+#include <com/sun/star/text/GraphicCrop.hpp>
+#include <tools/mapunit.hxx>
+#include <tools/UnitConversion.hxx>
+
+using namespace ::com::sun::star;
+
+SvxGrfCrop::SvxGrfCrop( TypedWhichId<SvxGrfCrop> nItemId )
+ : SfxPoolItem( nItemId ),
+ nLeft( 0 ), nRight( 0 ), nTop( 0 ), nBottom( 0 )
+{}
+
+SvxGrfCrop::SvxGrfCrop( sal_Int32 nL, sal_Int32 nR,
+ sal_Int32 nT, sal_Int32 nB, TypedWhichId<SvxGrfCrop> nItemId )
+ : SfxPoolItem( nItemId ),
+ nLeft( nL ), nRight( nR ), nTop( nT ), nBottom( nB )
+{}
+
+SvxGrfCrop::~SvxGrfCrop()
+{
+}
+
+bool SvxGrfCrop::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxGrfCrop& rCrop = static_cast<const SvxGrfCrop&>(rAttr);
+ return nLeft == rCrop.GetLeft() &&
+ nRight == rCrop.GetRight() &&
+ nTop == rCrop.GetTop() &&
+ nBottom == rCrop.GetBottom();
+}
+
+
+bool SvxGrfCrop::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ text::GraphicCrop aRet;
+ aRet.Left = nLeft;
+ aRet.Right = nRight;
+ aRet.Top = nTop;
+ aRet.Bottom = nBottom;
+
+ if( bConvert )
+ {
+ aRet.Right = convertTwipToMm100(aRet.Right );
+ aRet.Top = convertTwipToMm100(aRet.Top );
+ aRet.Left = convertTwipToMm100(aRet.Left );
+ aRet.Bottom = convertTwipToMm100(aRet.Bottom);
+ }
+
+
+ rVal <<= aRet;
+ return true;
+}
+
+bool SvxGrfCrop::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ text::GraphicCrop aVal;
+
+ if(!(rVal >>= aVal))
+ return false;
+ if( bConvert )
+ {
+ aVal.Right = o3tl::toTwips(aVal.Right, o3tl::Length::mm100);
+ aVal.Top = o3tl::toTwips(aVal.Top, o3tl::Length::mm100);
+ aVal.Left = o3tl::toTwips(aVal.Left, o3tl::Length::mm100);
+ aVal.Bottom = o3tl::toTwips(aVal.Bottom, o3tl::Length::mm100);
+ }
+
+ nLeft = aVal.Left ;
+ nRight = aVal.Right ;
+ nTop = aVal.Top ;
+ nBottom = aVal.Bottom;
+ return true;
+}
+
+bool SvxGrfCrop::GetPresentation(
+ SfxItemPresentation ePres, MapUnit eCoreUnit, MapUnit /*ePresUnit*/,
+ OUString &rText, const IntlWrapper& rIntl ) const
+{
+ rText.clear();
+ switch( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ return true;
+ case SfxItemPresentation::Complete:
+ rText = "L: " + ::GetMetricText( GetLeft(), eCoreUnit, MapUnit::MapMM, &rIntl ) +
+ " R: " + ::GetMetricText( GetRight(), eCoreUnit, MapUnit::MapMM, &rIntl ) +
+ " T: " + ::GetMetricText( GetTop(), eCoreUnit, MapUnit::MapMM, &rIntl ) +
+ " B: " + ::GetMetricText( GetBottom(), eCoreUnit, MapUnit::MapMM, &rIntl );
+ return true;
+
+ default:
+ return false;
+ }
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx
new file mode 100644
index 000000000..4a8bc3290
--- /dev/null
+++ b/svx/source/items/hlnkitem.cxx
@@ -0,0 +1,184 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/svxids.hrc>
+#include <sfx2/event.hxx>
+#include <svx/hlnkitem.hxx>
+
+
+SfxPoolItem* SvxHyperlinkItem::CreateDefault() { return new SvxHyperlinkItem(TypedWhichId<SvxHyperlinkItem>(0));}
+
+SvxHyperlinkItem::SvxHyperlinkItem( const SvxHyperlinkItem& rHyperlinkItem ):
+ SfxPoolItem(rHyperlinkItem)
+{
+ sName = rHyperlinkItem.sName;
+ sURL = rHyperlinkItem.sURL;
+ sTarget = rHyperlinkItem.sTarget;
+ eType = rHyperlinkItem.eType;
+ sIntName = rHyperlinkItem.sIntName;
+ nMacroEvents = rHyperlinkItem.nMacroEvents;
+
+ if( rHyperlinkItem.GetMacroTable() )
+ pMacroTable.reset( new SvxMacroTableDtor( *rHyperlinkItem.GetMacroTable() ) );
+
+};
+
+SvxHyperlinkItem::SvxHyperlinkItem( TypedWhichId<SvxHyperlinkItem> _nWhich, const OUString& rName, const OUString& rURL,
+ const OUString& rTarget, const OUString& rIntName, SvxLinkInsertMode eTyp,
+ HyperDialogEvent nEvents, SvxMacroTableDtor const *pMacroTbl ):
+ SfxPoolItem (_nWhich),
+ sName (rName),
+ sURL (rURL),
+ sTarget (rTarget),
+ eType (eTyp),
+ sIntName (rIntName),
+ nMacroEvents (nEvents)
+{
+ if (pMacroTbl)
+ pMacroTable.reset( new SvxMacroTableDtor ( *pMacroTbl ) );
+}
+
+SvxHyperlinkItem* SvxHyperlinkItem::Clone( SfxItemPool* ) const
+{
+ return new SvxHyperlinkItem( *this );
+}
+
+bool SvxHyperlinkItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxHyperlinkItem& rItem = static_cast<const SvxHyperlinkItem&>(rAttr);
+
+ bool bRet = ( sName == rItem.sName &&
+ sURL == rItem.sURL &&
+ sTarget == rItem.sTarget &&
+ eType == rItem.eType &&
+ sIntName == rItem.sIntName &&
+ nMacroEvents == rItem.nMacroEvents);
+ if (!bRet)
+ return false;
+
+ const SvxMacroTableDtor* pOther = static_cast<const SvxHyperlinkItem&>(rAttr).pMacroTable.get();
+ if( !pMacroTable )
+ return ( !pOther || pOther->empty() );
+ if( !pOther )
+ return pMacroTable->empty();
+
+ const SvxMacroTableDtor& rOwn = *pMacroTable;
+ const SvxMacroTableDtor& rOther = *pOther;
+
+ return rOwn == rOther;
+}
+
+void SvxHyperlinkItem::SetMacro( HyperDialogEvent nEvent, const SvxMacro& rMacro )
+{
+ SvMacroItemId nSfxEvent = SvMacroItemId::NONE;
+ switch( nEvent )
+ {
+ case HyperDialogEvent::MouseOverObject:
+ nSfxEvent = SvMacroItemId::OnMouseOver;
+ break;
+ case HyperDialogEvent::MouseClickObject:
+ nSfxEvent = SvMacroItemId::OnClick;
+ break;
+ case HyperDialogEvent::MouseOutObject:
+ nSfxEvent = SvMacroItemId::OnMouseOut;
+ break;
+ default: break;
+ }
+
+ if( !pMacroTable )
+ pMacroTable.reset( new SvxMacroTableDtor );
+
+ pMacroTable->Insert( nSfxEvent, rMacro);
+}
+
+void SvxHyperlinkItem::SetMacroTable( const SvxMacroTableDtor& rTbl )
+{
+ pMacroTable.reset( new SvxMacroTableDtor ( rTbl ) );
+}
+
+bool SvxHyperlinkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch(nMemberId)
+ {
+ case MID_HLINK_NAME :
+ rVal <<= sIntName;
+ break;
+ case MID_HLINK_TEXT :
+ rVal <<= sName;
+ break;
+ case MID_HLINK_URL:
+ rVal <<= sURL;
+ break;
+ case MID_HLINK_TARGET:
+ rVal <<= sTarget;
+ break;
+ case MID_HLINK_TYPE:
+ rVal <<= static_cast<sal_Int32>(eType);
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+bool SvxHyperlinkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ OUString aStr;
+ sal_Int32 nVal = 0;
+ switch(nMemberId)
+ {
+ case MID_HLINK_NAME :
+ if(!(rVal >>= aStr))
+ return false;
+ sIntName = aStr;
+ break;
+ case MID_HLINK_TEXT :
+ if(!(rVal >>= aStr))
+ return false;
+ sName = aStr;
+ break;
+ case MID_HLINK_URL:
+ if(!(rVal >>= aStr))
+ return false;
+ sURL = aStr;
+ break;
+ case MID_HLINK_TARGET:
+ if(!(rVal >>= aStr))
+ return false;
+ sTarget = aStr;
+ break;
+ case MID_HLINK_TYPE:
+ if(!(rVal >>= nVal))
+ return false;
+ eType = static_cast<SvxLinkInsertMode>(static_cast<sal_uInt16>(nVal));
+ break;
+ default:
+ return false;
+ }
+
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/legacyitem.cxx b/svx/source/items/legacyitem.cxx
new file mode 100644
index 000000000..005f97d2d
--- /dev/null
+++ b/svx/source/items/legacyitem.cxx
@@ -0,0 +1,105 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/legacyitem.hxx>
+#include <tools/stream.hxx>
+#include <svx/algitem.hxx>
+#include <svx/rotmodit.hxx>
+
+namespace legacy
+{
+ namespace SvxOrientation
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt16 nVal(0);
+ rStrm.ReadUInt16( nVal );
+ rItem.SetValue(static_cast<::SvxCellOrientation>(nVal));
+ }
+
+ SvStream& Store(const SvxOrientationItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+
+ namespace SvxMargin
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_Int16 nLeft(0);
+ sal_Int16 nTop(0);
+ sal_Int16 nRight(0);
+ sal_Int16 nBottom(0);
+
+ rStrm.ReadInt16( nLeft );
+ rStrm.ReadInt16( nTop );
+ rStrm.ReadInt16( nRight );
+ rStrm.ReadInt16( nBottom );
+
+ rItem.SetLeftMargin(nLeft);
+ rItem.SetTopMargin(nTop);
+ rItem.SetRightMargin(nRight);
+ rItem.SetBottomMargin(nBottom);
+ }
+
+ SvStream& Store(const SvxMarginItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteInt16( rItem.GetLeftMargin() );
+ rStrm.WriteInt16( rItem.GetTopMargin() );
+ rStrm.WriteInt16( rItem.GetRightMargin() );
+ rStrm.WriteInt16( rItem.GetBottomMargin() );
+ return rStrm;
+ }
+ }
+
+ namespace SvxRotateMode
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt16 nVal(0);
+ rStrm.ReadUInt16( nVal );
+ rItem.SetValue(static_cast<::SvxRotateMode>(nVal));
+ }
+
+ SvStream& Store(const SvxRotateModeItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx
new file mode 100644
index 000000000..40811d846
--- /dev/null
+++ b/svx/source/items/numfmtsh.cxx
@@ -0,0 +1,1593 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <tools/color.hxx>
+
+#include <tools/debug.hxx>
+#include <i18nlangtag/mslangid.hxx>
+#include <o3tl/safeint.hxx>
+#include <svl/numformat.hxx>
+#include <svl/zforlist.hxx>
+#include <svl/zformat.hxx>
+#include <svl/currencytable.hxx>
+
+#include <svx/numfmtsh.hxx>
+#include <svx/flagsdef.hxx>
+#include <svx/tbcontrl.hxx>
+
+#include <limits>
+
+namespace
+{
+double GetDefaultValNum(const SvNumFormatType nType)
+{
+ switch (nType)
+ {
+ case SvNumFormatType::NUMBER:
+ return fSvxNumValConst[SvxNumValCategory::Standard];
+ case SvNumFormatType::CURRENCY:
+ return fSvxNumValConst[SvxNumValCategory::Currency];
+ case SvNumFormatType::PERCENT:
+ return fSvxNumValConst[SvxNumValCategory::Percent];
+ case SvNumFormatType::DATE:
+ case SvNumFormatType::DATETIME:
+ return fSvxNumValConst[SvxNumValCategory::Date];
+ case SvNumFormatType::TIME:
+ return fSvxNumValConst[SvxNumValCategory::Time];
+ case SvNumFormatType::SCIENTIFIC:
+ return fSvxNumValConst[SvxNumValCategory::Scientific];
+ case SvNumFormatType::FRACTION:
+ return fSvxNumValConst[SvxNumValCategory::Fraction];
+ case SvNumFormatType::LOGICAL:
+ return fSvxNumValConst[SvxNumValCategory::Boolean];
+ default:
+ break;
+ }
+ return fSvxNumValConst[SvxNumValCategory::NoValue];
+}
+}
+
+SvxNumberFormatShell* SvxNumberFormatShell::Create(SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType,
+ const OUString& rNumStr)
+{
+ return new SvxNumberFormatShell(pNumFormatter, nFormatKey, eNumValType, rNumStr);
+}
+
+SvxNumberFormatShell* SvxNumberFormatShell::Create(SvNumberFormatter* pNumFormatter,
+ sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType, double nNumVal,
+ const OUString* pNumStr)
+{
+ return new SvxNumberFormatShell(pNumFormatter, nFormatKey, eNumValType, nNumVal, pNumStr);
+}
+
+SvxNumberFormatShell::SvxNumberFormatShell(SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType, const OUString& rNumStr)
+ : pFormatter(pNumFormatter)
+ , pCurFmtTable(nullptr)
+ , eValType(eNumValType)
+ , bUndoAddList(true)
+ , nCurFormatKey(nFormatKey)
+ , nCurCategory(SvNumFormatType::ALL)
+ , eCurLanguage(LANGUAGE_NONE)
+ , pCurCurrencyEntry(nullptr)
+ , bBankingSymbol(false)
+ , nCurCurrencyEntryPos(sal_uInt16(SELPOS_NONE))
+ , bUseStarFormat(false)
+ , bIsDefaultValNum(true)
+{
+ nValNum = 0;
+
+ switch (eValType)
+ {
+ case SvxNumberValueType::String:
+ aValStr = rNumStr;
+ break;
+ case SvxNumberValueType::Number:
+ if (pFormatter)
+ {
+ nValNum = GetDefaultValNum(pFormatter->GetType(nCurFormatKey));
+ }
+ [[fallthrough]];
+ case SvxNumberValueType::Undefined:
+ default:
+ aValStr.clear();
+ }
+}
+
+SvxNumberFormatShell::SvxNumberFormatShell(SvNumberFormatter* pNumFormatter, sal_uInt32 nFormatKey,
+ SvxNumberValueType eNumValType, double nNumVal,
+ const OUString* pNumStr)
+ : pFormatter(pNumFormatter)
+ , pCurFmtTable(nullptr)
+ , eValType(eNumValType)
+ , bUndoAddList(true)
+ , nCurFormatKey(nFormatKey)
+ , nCurCategory(SvNumFormatType::ALL)
+ , eCurLanguage(LANGUAGE_NONE)
+ , pCurCurrencyEntry(nullptr)
+ , bBankingSymbol(false)
+ , nCurCurrencyEntryPos(sal_uInt16(SELPOS_NONE))
+ , bUseStarFormat(false)
+ , bIsDefaultValNum(false)
+{
+ // #50441# When used in Writer, the SvxNumberInfoItem contains the
+ // original string in addition to the value
+
+ if (pNumStr)
+ aValStr = *pNumStr;
+
+ switch (eValType)
+ {
+ case SvxNumberValueType::Number:
+ nValNum = nNumVal;
+ break;
+ case SvxNumberValueType::String:
+ case SvxNumberValueType::Undefined:
+ default:
+ nValNum = 0;
+ bIsDefaultValNum = true;
+ }
+}
+
+SvxNumberFormatShell::~SvxNumberFormatShell()
+{
+ /*
+ * At this point, depending on whether the added user-defined were
+ * validated (ValidateNewEntries()), the add list is removed from
+ * the number formatter again.
+ *
+ * Deleting formats from the formatter happens for Undo reasons
+ * only in the calling instance.
+ */
+
+ if (bUndoAddList)
+ {
+ // Added formats are invalid => remove them
+
+ for (const auto& rItem : aAddList)
+ pFormatter->DeleteEntry(rItem);
+ }
+}
+
+std::vector<sal_uInt32> const& SvxNumberFormatShell::GetUpdateData() const { return aDelList; }
+
+void SvxNumberFormatShell::CategoryChanged(sal_uInt16 nCatLbPos, short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries)
+{
+ SvNumFormatType nOldCategory = nCurCategory;
+ PosToCategory_Impl(nCatLbPos, nCurCategory);
+ pCurFmtTable = &(pFormatter->GetEntryTable(nCurCategory, nCurFormatKey, eCurLanguage));
+ // reinitialize currency if category newly entered
+ if (nCurCategory == SvNumFormatType::CURRENCY && nOldCategory != nCurCategory)
+ pCurCurrencyEntry = nullptr;
+ rFmtSelPos = FillEntryList_Impl(rFmtEntries);
+}
+
+void SvxNumberFormatShell::LanguageChanged(LanguageType eLangType, short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries)
+{
+ eCurLanguage = eLangType;
+ pCurFmtTable = &(pFormatter->ChangeCL(nCurCategory, nCurFormatKey, eCurLanguage));
+ rFmtSelPos = FillEntryList_Impl(rFmtEntries);
+}
+
+void SvxNumberFormatShell::FormatChanged(sal_uInt16 nFmtLbPos, OUString& rPreviewStr,
+ const Color*& rpFontColor)
+{
+ if (static_cast<size_t>(nFmtLbPos) >= aCurEntryList.size())
+ return;
+
+ nCurFormatKey = aCurEntryList[nFmtLbPos];
+
+ if (nCurFormatKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ GetPreviewString_Impl(rPreviewStr, rpFontColor);
+ }
+ else if (nCurCategory == SvNumFormatType::CURRENCY)
+ {
+ if (static_cast<size_t>(nFmtLbPos) < aCurrencyFormatList.size())
+ {
+ MakePrevStringFromVal(aCurrencyFormatList[nFmtLbPos], rPreviewStr, rpFontColor,
+ nValNum);
+ }
+ }
+}
+
+bool SvxNumberFormatShell::AddFormat(OUString& rFormat, sal_Int32& rErrPos,
+ sal_uInt16& rCatLbSelPos, short& rFmtSelPos,
+ std::vector<OUString>& rFmtEntries)
+{
+ bool bInserted = false;
+ sal_uInt32 nAddKey = pFormatter->GetEntryKey(rFormat, eCurLanguage);
+
+ if (nAddKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // exists already?
+ {
+ ::std::vector<sal_uInt32>::iterator nAt = GetRemoved_Impl(nAddKey);
+ if (nAt != aDelList.end())
+ {
+ aDelList.erase(nAt);
+ bInserted = true;
+ }
+ else
+ {
+ OSL_FAIL("duplicate format!");
+ }
+ }
+ else // new format
+ {
+ sal_Int32 nPos;
+ bInserted = pFormatter->PutEntry(rFormat, nPos, nCurCategory, nAddKey, eCurLanguage);
+ rErrPos = (nPos >= 0) ? nPos : -1;
+
+ if (bInserted)
+ {
+ // May be sorted under a different locale if LCID was parsed.
+ const SvNumberformat* pEntry = pFormatter->GetEntry(nAddKey);
+ if (pEntry)
+ {
+ LanguageType nLang = pEntry->GetLanguage();
+ if (eCurLanguage != nLang)
+ {
+ // Current language's list would not show entry, adapt.
+ eCurLanguage = nLang;
+ }
+ }
+ }
+ }
+
+ if (bInserted)
+ {
+ nCurFormatKey = nAddKey;
+ DBG_ASSERT(GetAdded_Impl(nCurFormatKey) == aAddList.end(), "duplicate format!");
+ aAddList.push_back(nCurFormatKey);
+
+ // get current table
+ pCurFmtTable = &(pFormatter->GetEntryTable(nCurCategory, nCurFormatKey, eCurLanguage));
+ nCurCategory = pFormatter->GetType(nAddKey);
+ CategoryToPos_Impl(nCurCategory, rCatLbSelPos);
+ rFmtSelPos = FillEntryList_Impl(rFmtEntries);
+ }
+ else if (rErrPos != 0) // syntax error
+ {
+ ;
+ }
+ else // insert twice not possible
+ {
+ OSL_FAIL("duplicate format!");
+ }
+
+ return bInserted;
+}
+
+void SvxNumberFormatShell::RemoveFormat(std::u16string_view rFormat, sal_uInt16& rCatLbSelPos,
+ short& rFmtSelPos, std::vector<OUString>& rFmtEntries)
+{
+ sal_uInt32 nDelKey = pFormatter->GetEntryKey(rFormat, eCurLanguage);
+
+ DBG_ASSERT(nDelKey != NUMBERFORMAT_ENTRY_NOT_FOUND, "entry not found!");
+ DBG_ASSERT(!IsRemoved_Impl(nDelKey), "entry already removed!");
+
+ if ((nDelKey == NUMBERFORMAT_ENTRY_NOT_FOUND) || IsRemoved_Impl(nDelKey))
+ return;
+
+ aDelList.push_back(nDelKey);
+
+ ::std::vector<sal_uInt32>::iterator nAt = GetAdded_Impl(nDelKey);
+ if (nAt != aAddList.end())
+ {
+ aAddList.erase(nAt);
+ }
+
+ nCurCategory = pFormatter->GetType(nDelKey);
+ pCurFmtTable = &(pFormatter->GetEntryTable(nCurCategory, nCurFormatKey, eCurLanguage));
+
+ nCurFormatKey = pFormatter->GetStandardFormat(nCurCategory, eCurLanguage);
+
+ CategoryToPos_Impl(nCurCategory, rCatLbSelPos);
+ rFmtSelPos = FillEntryList_Impl(rFmtEntries);
+}
+
+void SvxNumberFormatShell::MakeFormat(OUString& rFormat, bool bThousand, bool bNegRed,
+ sal_uInt16 nPrecision, sal_uInt16 nLeadingZeroes,
+ sal_uInt16 nCurrencyPos)
+{
+ if (aCurrencyFormatList.size() > static_cast<size_t>(nCurrencyPos))
+ {
+ sal_Int32 rErrPos = 0;
+ std::vector<OUString> aFmtEList;
+
+ sal_uInt32 nFound
+ = pFormatter->TestNewString(aCurrencyFormatList[nCurrencyPos], eCurLanguage);
+
+ if (nFound == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ sal_uInt16 rCatLbSelPos = 0;
+ short rFmtSelPos = 0;
+ AddFormat(aCurrencyFormatList[nCurrencyPos], rErrPos, rCatLbSelPos, rFmtSelPos,
+ aFmtEList);
+ }
+
+ if (rErrPos == 0)
+ {
+ rFormat = pFormatter->GenerateFormat(nCurFormatKey, eCurLanguage, bThousand, bNegRed,
+ nPrecision, nLeadingZeroes);
+ }
+ }
+ else
+ {
+ rFormat = pFormatter->GenerateFormat(nCurFormatKey, eCurLanguage, bThousand, bNegRed,
+ nPrecision, nLeadingZeroes);
+ }
+}
+
+sal_uInt16 SvxNumberFormatShell::GetFormatIntegerDigits(std::u16string_view rFormat) const
+{
+ sal_uInt32 nFmtKey = pFormatter->GetEntryKey(rFormat, eCurLanguage);
+
+ return pFormatter->GetFormatIntegerDigits(nFmtKey);
+}
+
+void SvxNumberFormatShell::GetOptions(const OUString& rFormat, bool& rThousand, bool& rNegRed,
+ sal_uInt16& rPrecision, sal_uInt16& rLeadingZeroes,
+ sal_uInt16& rCatLbPos)
+{
+ sal_uInt32 nFmtKey = pFormatter->GetEntryKey(rFormat, eCurLanguage);
+
+ if (nFmtKey != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ pFormatter->GetFormatSpecialInfo(nFmtKey, rThousand, rNegRed, rPrecision, rLeadingZeroes);
+
+ CategoryToPos_Impl(pFormatter->GetType(nFmtKey), rCatLbPos);
+ }
+ else
+ {
+ bool bTestBanking = false;
+ sal_uInt16 nPos = FindCurrencyTableEntry(rFormat, bTestBanking);
+
+ if (IsInTable(nPos, bTestBanking, rFormat)
+ && pFormatter->GetFormatSpecialInfo(rFormat, rThousand, rNegRed, rPrecision,
+ rLeadingZeroes, eCurLanguage)
+ == 0)
+ {
+ rCatLbPos = CAT_CURRENCY;
+ }
+ else
+ rCatLbPos = CAT_USERDEFINED;
+ }
+}
+
+void SvxNumberFormatShell::MakePreviewString(const OUString& rFormatStr, OUString& rPreviewStr,
+ const Color*& rpFontColor)
+{
+ rpFontColor = nullptr;
+
+ sal_uInt32 nExistingFormat = pFormatter->GetEntryKey(rFormatStr, eCurLanguage);
+ if (nExistingFormat == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ // real preview - not implemented in NumberFormatter for text formats
+ pFormatter->GetPreviewString(rFormatStr, nValNum, rPreviewStr, &rpFontColor, eCurLanguage,
+ bUseStarFormat);
+ }
+ else
+ {
+ // format exists
+
+ // #50441# if a string was set in addition to the value, use it for text formats
+ bool bUseText = (eValType == SvxNumberValueType::String
+ || (!aValStr.isEmpty()
+ && (pFormatter->GetType(nExistingFormat) & SvNumFormatType::TEXT)));
+
+ if (bUseText)
+ {
+ pFormatter->GetOutputString(aValStr, nExistingFormat, rPreviewStr, &rpFontColor);
+ }
+ else
+ {
+ if (bIsDefaultValNum)
+ nValNum = GetDefaultValNum(pFormatter->GetType(nExistingFormat));
+ pFormatter->GetOutputString(nValNum, nExistingFormat, rPreviewStr, &rpFontColor,
+ bUseStarFormat);
+ }
+ }
+}
+
+bool SvxNumberFormatShell::IsUserDefined(const OUString& rFmtString)
+{
+ sal_uInt32 nFound = pFormatter->GetEntryKey(rFmtString, eCurLanguage);
+
+ bool bFlag = false;
+ if (nFound != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ bFlag = pFormatter->IsUserDefined(rFmtString, eCurLanguage);
+
+ if (bFlag)
+ {
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nFound);
+
+ if (pNumEntry != nullptr && pNumEntry->HasNewCurrency())
+ {
+ bool bTestBanking;
+ sal_uInt16 nPos = FindCurrencyTableEntry(rFmtString, bTestBanking);
+ bFlag = !IsInTable(nPos, bTestBanking, rFmtString);
+ }
+ }
+ }
+ return bFlag;
+}
+
+bool SvxNumberFormatShell::FindEntry(const OUString& rFmtString, sal_uInt32* pAt /* = NULL */)
+{
+ bool bRes = false;
+
+ sal_uInt32 nFound = NUMBERFORMAT_ENTRY_NOT_FOUND;
+ // There may be multiple builtin entries with the same format code, first
+ // try if the current key matches.
+ const SvNumberformat* pEntry = pFormatter->GetEntry(nCurFormatKey);
+ if (pEntry && pEntry->GetLanguage() == eCurLanguage && pEntry->GetFormatstring() == rFmtString)
+ nFound = nCurFormatKey;
+
+ if (nFound == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ // Find the first matching format code.
+ nFound = pFormatter->TestNewString(rFmtString, eCurLanguage);
+
+ if (nFound == NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ bool bTestBanking = false;
+ sal_uInt16 nPos = FindCurrencyTableEntry(rFmtString, bTestBanking);
+
+ if (IsInTable(nPos, bTestBanking, rFmtString))
+ {
+ nFound = NUMBERFORMAT_ENTRY_NEW_CURRENCY;
+ bRes = true;
+ }
+ }
+ else
+ {
+ bRes = !IsRemoved_Impl(nFound);
+ }
+
+ if (pAt)
+ *pAt = nFound;
+
+ return bRes;
+}
+
+void SvxNumberFormatShell::GetInitSettings(sal_uInt16& nCatLbPos, LanguageType& rLangType,
+ sal_uInt16& nFmtLbSelPos,
+ std::vector<OUString>& rFmtEntries,
+ OUString& rPrevString, const Color*& rpPrevColor)
+{
+ // precondition: number formater found
+ DBG_ASSERT(pFormatter != nullptr, "Number formatter not found!");
+
+ short nSelPos = SELPOS_NONE;
+
+ // special treatment for undefined number format:
+ if ((eValType == SvxNumberValueType::Undefined) && (nCurFormatKey == 0))
+ PosToCategory_Impl(CAT_ALL, nCurCategory); // category = all
+ else
+ nCurCategory = SvNumFormatType::UNDEFINED; // category = undefined
+
+ pCurFmtTable = &(pFormatter->GetFirstEntryTable(nCurCategory, nCurFormatKey, eCurLanguage));
+
+ CategoryToPos_Impl(nCurCategory, nCatLbPos);
+ rLangType = eCurLanguage;
+
+ nSelPos = FillEntryList_Impl(rFmtEntries);
+
+ DBG_ASSERT(nSelPos != SELPOS_NONE, "Leere Formatliste!");
+
+ nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? static_cast<sal_uInt16>(nSelPos) : 0;
+ GetPreviewString_Impl(rPrevString, rpPrevColor);
+}
+
+short SvxNumberFormatShell::FillEntryList_Impl(std::vector<OUString>& rList)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+ short nSelPos = SELPOS_NONE;
+
+ aCurEntryList.clear();
+
+ if (nCurCategory == SvNumFormatType::ALL)
+ {
+ FillEListWithStd_Impl(rList, SvNumFormatType::NUMBER, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::NUMBER, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::PERCENT, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::PERCENT, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::CURRENCY, nSelPos);
+ // No FillEListWithUsD_Impl() here, user defined currency formats
+ // were already added.
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::DATE, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::DATE, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::TIME, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::TIME, nSelPos);
+
+ nSelPos = FillEListWithDateTime_Impl(rList, nSelPos, false);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::DATETIME, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::SCIENTIFIC, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::SCIENTIFIC, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::FRACTION, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::FRACTION, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::LOGICAL, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::LOGICAL, nSelPos);
+
+ FillEListWithStd_Impl(rList, SvNumFormatType::TEXT, nSelPos);
+ nSelPos = FillEListWithUsD_Impl(rList, SvNumFormatType::TEXT, nSelPos);
+ }
+ else
+ {
+ FillEListWithStd_Impl(rList, nCurCategory, nSelPos, true);
+ if (nCurCategory != SvNumFormatType::CURRENCY)
+ nSelPos = FillEListWithUsD_Impl(rList, nCurCategory, nSelPos);
+ if (nCurCategory == SvNumFormatType::DATE || nCurCategory == SvNumFormatType::TIME)
+ nSelPos = FillEListWithDateTime_Impl(rList, nSelPos, true);
+ }
+
+ return nSelPos;
+}
+
+void SvxNumberFormatShell::FillEListWithStd_Impl(std::vector<OUString>& rList,
+ SvNumFormatType eCategory, short& nSelPos,
+ bool bSuppressDuplicates)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+
+ assert(pCurFmtTable != nullptr);
+
+ aCurrencyFormatList.clear();
+
+ NfIndexTableOffset eOffsetStart;
+ NfIndexTableOffset eOffsetEnd;
+
+ switch (eCategory)
+ {
+ case SvNumFormatType::NUMBER:
+ eOffsetStart = NF_NUMBER_START;
+ eOffsetEnd = NF_NUMBER_END;
+ break;
+ case SvNumFormatType::PERCENT:
+ eOffsetStart = NF_PERCENT_START;
+ eOffsetEnd = NF_PERCENT_END;
+ break;
+ case SvNumFormatType::CURRENCY:
+ // Currency entries are generated and assembled, ignore
+ // bSuppressDuplicates.
+ nSelPos = FillEListWithCurrency_Impl(rList, nSelPos);
+ return;
+ case SvNumFormatType::DATE:
+ eOffsetStart = NF_DATE_START;
+ eOffsetEnd = NF_DATE_END;
+ break;
+ case SvNumFormatType::TIME:
+ eOffsetStart = NF_TIME_START;
+ eOffsetEnd = NF_TIME_END;
+ break;
+ case SvNumFormatType::SCIENTIFIC:
+ eOffsetStart = NF_SCIENTIFIC_START;
+ eOffsetEnd = NF_SCIENTIFIC_END;
+ break;
+ case SvNumFormatType::FRACTION:
+ eOffsetStart = NF_FRACTION_START;
+ eOffsetEnd = NF_FRACTION_END;
+ // Fraction formats are internally generated by the number
+ // formatter and are not supposed to contain duplicates anyway.
+ nSelPos = FillEListWithFormats_Impl(rList, nSelPos, eOffsetStart, eOffsetEnd, false);
+ nSelPos
+ = FillEListWithFormats_Impl(rList, nSelPos, NF_FRACTION_3D, NF_FRACTION_100, false);
+ return;
+ case SvNumFormatType::LOGICAL:
+ eOffsetStart = NF_BOOLEAN;
+ eOffsetEnd = NF_BOOLEAN;
+ break;
+ case SvNumFormatType::TEXT:
+ eOffsetStart = NF_TEXT;
+ eOffsetEnd = NF_TEXT;
+ break;
+ default:
+ return;
+ }
+
+ nSelPos
+ = FillEListWithFormats_Impl(rList, nSelPos, eOffsetStart, eOffsetEnd, bSuppressDuplicates);
+}
+
+short SvxNumberFormatShell::FillEListWithFormats_Impl(std::vector<OUString>& rList, short nSelPos,
+ NfIndexTableOffset eOffsetStart,
+ NfIndexTableOffset eOffsetEnd,
+ bool bSuppressDuplicates)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+ for (tools::Long nIndex = eOffsetStart; nIndex <= eOffsetEnd; ++nIndex)
+ {
+ FillEListWithOneFormat_Impl(rList, nSelPos, bSuppressDuplicates,
+ static_cast<NfIndexTableOffset>(nIndex), false);
+ }
+
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithDateTime_Impl(std::vector<OUString>& rList, short nSelPos,
+ bool bSuppressDuplicates)
+{
+ // Append a list of date+time formats.
+
+ // Add first, so a NF_DATETIME_SYSTEM_SHORT_HHMM may be suppressed in
+ // locales that do not use 2-digit years there and this here is the
+ // default.
+ FillEListWithOneFormat_Impl(rList, nSelPos, bSuppressDuplicates, NF_DATETIME_SYS_DDMMYYYY_HHMM,
+ true);
+
+ for (tools::Long nIndex = NF_DATETIME_START; nIndex <= NF_DATETIME_END; ++nIndex)
+ {
+ FillEListWithOneFormat_Impl(rList, nSelPos, bSuppressDuplicates,
+ static_cast<NfIndexTableOffset>(nIndex), true);
+ }
+
+ // Always add the internally generated ISO formats.
+ nSelPos = FillEListWithFormats_Impl(rList, nSelPos, NF_DATETIME_ISO_YYYYMMDD_HHMMSS,
+ NF_DATETIME_ISO_YYYYMMDDTHHMMSS000, false);
+
+ return nSelPos;
+}
+
+void SvxNumberFormatShell::FillEListWithOneFormat_Impl(std::vector<OUString>& rList, short& nSelPos,
+ bool bSuppressDuplicates,
+ NfIndexTableOffset nOffset,
+ bool bSuppressIsoDateTime)
+{
+ sal_uInt32 nNFEntry = pFormatter->GetFormatIndex(nOffset, eCurLanguage);
+
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nNFEntry);
+ if (pNumEntry == nullptr)
+ return;
+
+ SvNumFormatType nMyCat = pNumEntry->GetMaskedType();
+ sal_uInt16 nMyType;
+ CategoryToPos_Impl(nMyCat, nMyType);
+ OUString aNewFormNInfo = pNumEntry->GetFormatstring();
+
+ if (nNFEntry == nCurFormatKey)
+ {
+ nSelPos = (!IsRemoved_Impl(nNFEntry)) ? aCurEntryList.size() : SELPOS_NONE;
+ }
+
+ // Ugly hack to suppress an ISO date+time format that is the default
+ // date+time format of the locale and identical to the internally generated
+ // one always to be added after/below.
+ const bool bSupIso
+ = bSuppressIsoDateTime && bSuppressDuplicates
+ && (aNewFormNInfo == "YYYY-MM-DD HH:MM:SS" || aNewFormNInfo == "YYYY-MM-DD\"T\"HH:MM:SS");
+
+ if (!bSupIso
+ && (!bSuppressDuplicates || IsEssentialFormat_Impl(nMyCat, nNFEntry)
+ || std::find(rList.begin(), rList.end(), aNewFormNInfo) == rList.end()))
+ {
+ rList.push_back(aNewFormNInfo);
+ aCurEntryList.push_back(nNFEntry);
+ }
+}
+
+bool SvxNumberFormatShell::IsEssentialFormat_Impl(SvNumFormatType eType, sal_uInt32 nKey)
+{
+ if (nKey == nCurFormatKey)
+ return true;
+
+ const NfIndexTableOffset nIndex = pFormatter->GetIndexTableOffset(nKey);
+ switch (nIndex)
+ {
+ // These are preferred or edit formats.
+ case NF_DATE_SYS_DDMMYYYY:
+ case NF_DATE_ISO_YYYYMMDD:
+ case NF_TIME_HH_MMSS:
+ case NF_TIME_MMSS00:
+ case NF_TIME_HH_MMSS00:
+ case NF_DATETIME_SYS_DDMMYYYY_HHMM:
+ case NF_DATETIME_SYS_DDMMYYYY_HHMMSS:
+ case NF_DATETIME_ISO_YYYYMMDD_HHMMSS:
+ case NF_DATETIME_ISO_YYYYMMDD_HHMMSS000:
+ case NF_DATETIME_ISO_YYYYMMDDTHHMMSS:
+ case NF_DATETIME_ISO_YYYYMMDDTHHMMSS000:
+ return true;
+ default:
+ break;
+ }
+
+ return nKey == pFormatter->GetStandardFormat(eType, eCurLanguage);
+}
+
+short SvxNumberFormatShell::FillEListWithCurrency_Impl(std::vector<OUString>& rList, short nSelPos)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+ DBG_ASSERT(pCurFmtTable != nullptr, "unknown NumberFormat");
+
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ bool bTmpBanking;
+ OUString rSymbol;
+
+ bool bFlag = pFormatter->GetNewCurrencySymbolString(nCurFormatKey, rSymbol, &pTmpCurrencyEntry,
+ &bTmpBanking);
+
+ if ((!bFlag && pCurCurrencyEntry == nullptr)
+ || (bFlag && pTmpCurrencyEntry == nullptr && rSymbol.isEmpty())
+ || (nCurCategory == SvNumFormatType::ALL))
+ {
+ if (nCurCategory == SvNumFormatType::ALL)
+ FillEListWithUserCurrencys(rList, nSelPos);
+ nSelPos = FillEListWithSysCurrencys(rList, nSelPos);
+ }
+ else
+ {
+ nSelPos = FillEListWithUserCurrencys(rList, nSelPos);
+ }
+
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithSysCurrencys(std::vector<OUString>& rList, short nSelPos)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT(pCurFmtTable != nullptr, "unknown NumberFormat");
+
+ sal_uInt32 nNFEntry;
+ OUString aNewFormNInfo;
+
+ nCurCurrencyEntryPos = 0;
+
+ for (tools::Long nIndex = NF_CURRENCY_START; nIndex <= NF_CURRENCY_END; nIndex++)
+ {
+ nNFEntry
+ = pFormatter->GetFormatIndex(static_cast<NfIndexTableOffset>(nIndex), eCurLanguage);
+
+ if (nCurCategory == SvNumFormatType::ALL && nNFEntry != nCurFormatKey)
+ // Deprecated old currency entries, for ALL add only if used as
+ // current format key.
+ continue;
+
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nNFEntry);
+
+ if (pNumEntry == nullptr)
+ continue;
+
+ SvNumFormatType nMyCat = pNumEntry->GetMaskedType();
+ CategoryToPos_Impl(nMyCat, nMyType);
+ aNewFormNInfo = pNumEntry->GetFormatstring();
+
+ if (nNFEntry == nCurFormatKey)
+ {
+ nSelPos = (!IsRemoved_Impl(nNFEntry)) ? aCurEntryList.size() : SELPOS_NONE;
+ }
+
+ rList.push_back(aNewFormNInfo);
+ aCurEntryList.push_back(nNFEntry);
+ }
+
+ if (nCurCategory != SvNumFormatType::ALL)
+ {
+ for (const auto& rEntry : *pCurFmtTable)
+ {
+ sal_uInt32 nKey = rEntry.first;
+ const SvNumberformat* pNumEntry = rEntry.second;
+
+ if (!IsRemoved_Impl(nKey))
+ {
+ bool bUserNewCurrency = false;
+ if (pNumEntry->HasNewCurrency())
+ {
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ bool bTmpBanking;
+ OUString rSymbol;
+
+ pFormatter->GetNewCurrencySymbolString(nKey, rSymbol, &pTmpCurrencyEntry,
+ &bTmpBanking);
+
+ bUserNewCurrency = (pTmpCurrencyEntry != nullptr);
+ }
+
+ if (!bUserNewCurrency && (pNumEntry->GetType() & SvNumFormatType::DEFINED))
+ {
+ SvNumFormatType nMyCat = pNumEntry->GetMaskedType();
+ CategoryToPos_Impl(nMyCat, nMyType);
+ aNewFormNInfo = pNumEntry->GetFormatstring();
+
+ if (nKey == nCurFormatKey)
+ nSelPos = aCurEntryList.size();
+ rList.push_back(aNewFormNInfo);
+ aCurEntryList.push_back(nKey);
+ }
+ }
+ }
+ }
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithUserCurrencys(std::vector<OUString>& rList, short nSelPos)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+ sal_uInt16 nMyType;
+
+ DBG_ASSERT(pCurFmtTable != nullptr, "unknown NumberFormat");
+
+ OUString aNewFormNInfo;
+
+ const NfCurrencyEntry* pTmpCurrencyEntry;
+ bool bTmpBanking, bAdaptSelPos;
+ OUString rSymbol;
+ OUString rBankSymbol;
+
+ std::vector<OUString> aList;
+ std::vector<sal_uInt32> aKeyList;
+
+ pFormatter->GetNewCurrencySymbolString(nCurFormatKey, rSymbol, &pTmpCurrencyEntry,
+ &bTmpBanking);
+
+ OUString rShortSymbol;
+
+ if (pCurCurrencyEntry == nullptr)
+ {
+ // #110398# If no currency format was previously selected (we're not
+ // about to add another currency), try to select the initial currency
+ // format (nCurFormatKey) that was set in FormatChanged() after
+ // matching the format string entered in the dialog.
+ bAdaptSelPos = true;
+ pCurCurrencyEntry = const_cast<NfCurrencyEntry*>(pTmpCurrencyEntry);
+ bBankingSymbol = bTmpBanking;
+ nCurCurrencyEntryPos = FindCurrencyFormat(pTmpCurrencyEntry, bTmpBanking);
+ }
+ else
+ {
+ if (pTmpCurrencyEntry == pCurCurrencyEntry)
+ bAdaptSelPos = true;
+ else
+ {
+ bAdaptSelPos = false;
+ pTmpCurrencyEntry = pCurCurrencyEntry;
+ }
+ bTmpBanking = bBankingSymbol;
+ }
+
+ if (pTmpCurrencyEntry != nullptr)
+ {
+ rSymbol = pTmpCurrencyEntry->BuildSymbolString(false);
+ rBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true);
+ rShortSymbol = pTmpCurrencyEntry->BuildSymbolString(bTmpBanking, true);
+ }
+
+ for (const auto& rEntry : *pCurFmtTable)
+ {
+ sal_uInt32 nKey = rEntry.first;
+ const SvNumberformat* pNumEntry = rEntry.second;
+
+ if (!IsRemoved_Impl(nKey))
+ {
+ if (pNumEntry->GetType() & SvNumFormatType::DEFINED || pNumEntry->IsAdditionalBuiltin())
+ {
+ SvNumFormatType nMyCat = pNumEntry->GetMaskedType();
+ CategoryToPos_Impl(nMyCat, nMyType);
+ aNewFormNInfo = pNumEntry->GetFormatstring();
+
+ bool bInsFlag = false;
+ if (pNumEntry->HasNewCurrency())
+ {
+ bInsFlag = true; // merge locale formats into currency selection
+ }
+ else if ((!bTmpBanking && aNewFormNInfo.indexOf(rSymbol) >= 0)
+ || (bTmpBanking && aNewFormNInfo.indexOf(rBankSymbol) >= 0))
+ {
+ bInsFlag = true;
+ }
+ else if (aNewFormNInfo.indexOf(rShortSymbol) >= 0)
+ {
+ OUString rTstSymbol;
+ const NfCurrencyEntry* pTstCurrencyEntry;
+ bool bTstBanking;
+
+ pFormatter->GetNewCurrencySymbolString(nKey, rTstSymbol, &pTstCurrencyEntry,
+ &bTstBanking);
+
+ if (pTmpCurrencyEntry == pTstCurrencyEntry && bTstBanking == bTmpBanking)
+ {
+ bInsFlag = true;
+ }
+ }
+
+ if (bInsFlag)
+ {
+ aList.push_back(aNewFormNInfo);
+ aKeyList.push_back(nKey);
+ }
+ }
+ }
+ }
+
+ NfWSStringsDtor aWSStringsDtor;
+ sal_uInt16 nDefault;
+ if (pTmpCurrencyEntry && nCurCategory != SvNumFormatType::ALL)
+ {
+ nDefault
+ = pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, *pTmpCurrencyEntry, bTmpBanking);
+ if (!bTmpBanking)
+ pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, *pTmpCurrencyEntry, true);
+ }
+ else
+ nDefault = 0;
+ if (!bTmpBanking && nCurCategory != SvNumFormatType::ALL)
+ {
+ // append formats for all currencies defined in the current I18N locale
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCurrCount = rCurrencyTable.size();
+ LanguageType eLang = MsLangId::getRealLanguage(eCurLanguage);
+ for (sal_uInt16 i = 0; i < nCurrCount; ++i)
+ {
+ const NfCurrencyEntry* pCurr = &rCurrencyTable[i];
+ if (pCurr->GetLanguage() == eLang && pTmpCurrencyEntry != pCurr)
+ {
+ pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, *pCurr, false);
+ pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, *pCurr, true);
+ }
+ }
+ }
+
+ size_t nOldListCount = rList.size();
+ for (size_t i = 0, nPos = nOldListCount; i < aWSStringsDtor.size(); ++i)
+ {
+ bool bFlag = true;
+ OUString aInsStr(aWSStringsDtor[i]);
+ size_t j;
+ for (j = 0; j < aList.size(); ++j)
+ {
+ if (aList[j] == aInsStr)
+ {
+ bFlag = false;
+ break;
+ }
+ }
+ if (bFlag)
+ {
+ rList.push_back(aInsStr);
+ aCurEntryList.insert(aCurEntryList.begin() + (nPos++), NUMBERFORMAT_ENTRY_NOT_FOUND);
+ }
+ else
+ {
+ rList.push_back(aList[j]);
+ aList.erase(aList.begin() + j);
+ aCurEntryList.insert(aCurEntryList.begin() + (nPos++), aKeyList[j]);
+ aKeyList.erase(aKeyList.begin() + j);
+ }
+ }
+
+ for (size_t i = 0; i < aKeyList.size(); ++i)
+ {
+ if (aKeyList[i] != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ rList.push_back(aList[i]);
+ aCurEntryList.push_back(aKeyList[i]);
+ }
+ }
+
+ for (size_t i = nOldListCount; i < rList.size(); ++i)
+ {
+ aCurrencyFormatList.push_back(rList[i]);
+
+ if (nSelPos == SELPOS_NONE && bAdaptSelPos && aCurEntryList[i] == nCurFormatKey)
+ nSelPos = i;
+ }
+
+ if (nSelPos == SELPOS_NONE && nCurCategory != SvNumFormatType::ALL)
+ nSelPos = nDefault;
+
+ return nSelPos;
+}
+
+short SvxNumberFormatShell::FillEListWithUsD_Impl(std::vector<OUString>& rList,
+ SvNumFormatType eCategory, short nSelPos)
+{
+ /* Create a current list of format entries. The return value is
+ * the list position of the current format. If the list is empty
+ * or if there is no current format, SELPOS_NONE is delivered.
+ */
+
+ assert(pCurFmtTable != nullptr);
+
+ OUString aNewFormNInfo;
+
+ const bool bCatDefined = (eCategory == SvNumFormatType::DEFINED);
+ const bool bCategoryMatch = (eCategory != SvNumFormatType::ALL && !bCatDefined);
+
+ for (const auto& rEntry : *pCurFmtTable)
+ {
+ const SvNumberformat* pNumEntry = rEntry.second;
+
+ if (bCategoryMatch && (pNumEntry->GetMaskedType() & eCategory) != eCategory)
+ continue; // for; type does not match category if not ALL
+
+ const bool bUserDefined = bool(pNumEntry->GetType() & SvNumFormatType::DEFINED);
+ if (!bUserDefined && bCatDefined)
+ continue; // for; not user defined in DEFINED category
+
+ if (!(bUserDefined || (!bCatDefined && pNumEntry->IsAdditionalBuiltin())))
+ continue; // for; does not match criteria at all
+
+ const sal_uInt32 nKey = rEntry.first;
+ if (!IsRemoved_Impl(nKey))
+ {
+ aNewFormNInfo = pNumEntry->GetFormatstring();
+
+ bool bAdd = true;
+ if (pNumEntry->HasNewCurrency())
+ {
+ bool bTestBanking;
+ sal_uInt16 nPos = FindCurrencyTableEntry(aNewFormNInfo, bTestBanking);
+ bAdd = !IsInTable(nPos, bTestBanking, aNewFormNInfo);
+ }
+ if (bAdd)
+ {
+ if (nKey == nCurFormatKey)
+ nSelPos = aCurEntryList.size();
+ rList.push_back(aNewFormNInfo);
+ aCurEntryList.push_back(nKey);
+ }
+ }
+ }
+ return nSelPos;
+}
+
+void SvxNumberFormatShell::GetPreviewString_Impl(OUString& rString, const Color*& rpColor)
+{
+ rpColor = nullptr;
+
+ // #50441# if a string was set in addition to the value, use it for text formats
+ bool bUseText
+ = (eValType == SvxNumberValueType::String
+ || (!aValStr.isEmpty() && (pFormatter->GetType(nCurFormatKey) & SvNumFormatType::TEXT)));
+
+ if (bUseText)
+ {
+ pFormatter->GetOutputString(aValStr, nCurFormatKey, rString, &rpColor);
+ }
+ else
+ {
+ pFormatter->GetOutputString(nValNum, nCurFormatKey, rString, &rpColor, bUseStarFormat);
+ }
+}
+
+::std::vector<sal_uInt32>::iterator SvxNumberFormatShell::GetRemoved_Impl(size_t nKey)
+{
+ return ::std::find(aDelList.begin(), aDelList.end(), nKey);
+}
+
+bool SvxNumberFormatShell::IsRemoved_Impl(size_t nKey)
+{
+ return GetRemoved_Impl(nKey) != aDelList.end();
+}
+
+::std::vector<sal_uInt32>::iterator SvxNumberFormatShell::GetAdded_Impl(size_t nKey)
+{
+ return ::std::find(aAddList.begin(), aAddList.end(), nKey);
+}
+
+// Conversion routines:
+void SvxNumberFormatShell::PosToCategory_Impl(sal_uInt16 nPos, SvNumFormatType& rCategory)
+{
+ // map category css::form positions (->resource)
+ switch (nPos)
+ {
+ case CAT_USERDEFINED:
+ rCategory = SvNumFormatType::DEFINED;
+ break;
+ case CAT_NUMBER:
+ rCategory = SvNumFormatType::NUMBER;
+ break;
+ case CAT_PERCENT:
+ rCategory = SvNumFormatType::PERCENT;
+ break;
+ case CAT_CURRENCY:
+ rCategory = SvNumFormatType::CURRENCY;
+ break;
+ case CAT_DATE:
+ rCategory = SvNumFormatType::DATE;
+ break;
+ case CAT_TIME:
+ rCategory = SvNumFormatType::TIME;
+ break;
+ case CAT_SCIENTIFIC:
+ rCategory = SvNumFormatType::SCIENTIFIC;
+ break;
+ case CAT_FRACTION:
+ rCategory = SvNumFormatType::FRACTION;
+ break;
+ case CAT_BOOLEAN:
+ rCategory = SvNumFormatType::LOGICAL;
+ break;
+ case CAT_TEXT:
+ rCategory = SvNumFormatType::TEXT;
+ break;
+ case CAT_ALL:
+ default:
+ rCategory = SvNumFormatType::ALL;
+ break;
+ }
+}
+
+void SvxNumberFormatShell::CategoryToPos_Impl(SvNumFormatType nCategory, sal_uInt16& rPos)
+{
+ // map category to css::form positions (->resource)
+ switch (nCategory)
+ {
+ case SvNumFormatType::DEFINED:
+ rPos = CAT_USERDEFINED;
+ break;
+ case SvNumFormatType::NUMBER:
+ rPos = CAT_NUMBER;
+ break;
+ case SvNumFormatType::PERCENT:
+ rPos = CAT_PERCENT;
+ break;
+ case SvNumFormatType::CURRENCY:
+ rPos = CAT_CURRENCY;
+ break;
+ case SvNumFormatType::DATETIME:
+ case SvNumFormatType::DATE:
+ rPos = CAT_DATE;
+ break;
+ case SvNumFormatType::TIME:
+ rPos = CAT_TIME;
+ break;
+ case SvNumFormatType::SCIENTIFIC:
+ rPos = CAT_SCIENTIFIC;
+ break;
+ case SvNumFormatType::FRACTION:
+ rPos = CAT_FRACTION;
+ break;
+ case SvNumFormatType::LOGICAL:
+ rPos = CAT_BOOLEAN;
+ break;
+ case SvNumFormatType::TEXT:
+ rPos = CAT_TEXT;
+ break;
+ case SvNumFormatType::ALL:
+ default:
+ rPos = CAT_ALL;
+ }
+}
+
+/*
+ * Function: Formats the number nValue dependent on rFormatStr
+ * and stores the result in rPreviewStr.
+ * Input: FormatString, color, number to format
+ * Output: Output string rPreviewStr
+ */
+void SvxNumberFormatShell::MakePrevStringFromVal(const OUString& rFormatStr, OUString& rPreviewStr,
+ const Color*& rpFontColor, double nValue)
+{
+ rpFontColor = nullptr;
+ pFormatter->GetPreviewString(rFormatStr, nValue, rPreviewStr, &rpFontColor, eCurLanguage);
+}
+
+/*
+ * Function: Returns the comment for a given entry.
+ * Input: Number of the entry
+ * Output: Comment string
+ */
+void SvxNumberFormatShell::SetComment4Entry(short nEntry, const OUString& aEntStr)
+{
+ SvNumberformat* pNumEntry;
+ if (nEntry < 0)
+ return;
+ sal_uInt32 nMyNfEntry = aCurEntryList[nEntry];
+ pNumEntry = const_cast<SvNumberformat*>(pFormatter->GetEntry(nMyNfEntry));
+ if (pNumEntry != nullptr)
+ pNumEntry->SetComment(aEntStr);
+}
+
+/*
+ * Function: Returns the comment for a given entry.
+ * Input: Number of the entry
+ * Output: Comment string
+ */
+OUString SvxNumberFormatShell::GetComment4Entry(short nEntry)
+{
+ if (nEntry < 0)
+ return OUString();
+
+ if (o3tl::make_unsigned(nEntry) < aCurEntryList.size())
+ {
+ sal_uInt32 nMyNfEntry = aCurEntryList[nEntry];
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+ if (pNumEntry != nullptr)
+ return pNumEntry->GetComment();
+ }
+
+ return OUString();
+}
+
+/*
+ * Function: Returns the category number for a given entry.
+ * Input: Number of the entry
+ * Output: Category number
+ */
+short SvxNumberFormatShell::GetCategory4Entry(short nEntry) const
+{
+ if (nEntry < 0)
+ return 0;
+ if (o3tl::make_unsigned(nEntry) < aCurEntryList.size())
+ {
+ sal_uInt32 nMyNfEntry = aCurEntryList[nEntry];
+
+ if (nMyNfEntry != NUMBERFORMAT_ENTRY_NOT_FOUND)
+ {
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+ if (pNumEntry != nullptr)
+ {
+ SvNumFormatType nMyCat = pNumEntry->GetMaskedType();
+ sal_uInt16 nMyType;
+ CategoryToPos_Impl(nMyCat, nMyType);
+
+ return static_cast<short>(nMyType);
+ }
+ return 0;
+ }
+ else if (!aCurrencyFormatList.empty())
+ {
+ return CAT_CURRENCY;
+ }
+ }
+ return 0;
+}
+
+/*
+ * Function: Returns the information about whether an entry is user-specific.
+ * Input: Number of the entry
+ * Output: User-specific?
+ */
+bool SvxNumberFormatShell::GetUserDefined4Entry(short nEntry)
+{
+ if (nEntry < 0)
+ return false;
+ if (o3tl::make_unsigned(nEntry) < aCurEntryList.size())
+ {
+ sal_uInt32 nMyNfEntry = aCurEntryList[nEntry];
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+
+ if (pNumEntry != nullptr)
+ {
+ if (pNumEntry->GetType() & SvNumFormatType::DEFINED)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+/*
+ * Function: Returns the format string for a given entry.
+ * Input: Number of the entry
+ * Output: Format string
+ */
+OUString SvxNumberFormatShell::GetFormat4Entry(short nEntry)
+{
+ if (nEntry < 0)
+ return OUString();
+
+ if (!aCurrencyFormatList.empty())
+ {
+ if (aCurrencyFormatList.size() > o3tl::make_unsigned(nEntry))
+ return aCurrencyFormatList[nEntry];
+ }
+ else
+ {
+ sal_uInt32 nMyNfEntry = aCurEntryList[nEntry];
+ const SvNumberformat* pNumEntry = pFormatter->GetEntry(nMyNfEntry);
+
+ if (pNumEntry != nullptr)
+ return pNumEntry->GetFormatstring();
+ }
+ return OUString();
+}
+
+/*
+ * Function: Returns the list number for a given format index.
+ * Input: Number of the entry
+ * Output: Category number
+ */
+short SvxNumberFormatShell::GetListPos4Entry(sal_uInt32 nIdx, std::u16string_view rFmtString)
+{
+ short nSelP = SELPOS_NONE;
+ if (nIdx != NUMBERFORMAT_ENTRY_NEW_CURRENCY)
+ {
+ // Check list size against return type limit.
+ if (aCurEntryList.size() <= o3tl::make_unsigned(::std::numeric_limits<short>::max()))
+ {
+ for (size_t i = 0; i < aCurEntryList.size(); ++i)
+ {
+ if (aCurEntryList[i] == nIdx)
+ {
+ nSelP = i;
+ break;
+ }
+ }
+ }
+ else
+ {
+ OSL_FAIL("svx::SvxNumberFormatShell::GetListPos4Entry(), list got too large!");
+ }
+ }
+ else
+ {
+ // A second list holds the generated currency formats.
+ for (size_t i = 0; i < aCurrencyFormatList.size(); ++i)
+ {
+ if (rFmtString == aCurrencyFormatList[i])
+ {
+ nSelP = static_cast<short>(i);
+ break;
+ }
+ }
+ }
+ return nSelP;
+}
+
+OUString SvxNumberFormatShell::GetStandardName() const
+{
+ return pFormatter->GetStandardName(eCurLanguage);
+}
+
+void SvxNumberFormatShell::GetCurrencySymbols(std::vector<OUString>& rList, sal_uInt16* pPos)
+{
+ const NfCurrencyEntry* pTmpCurrencyEntry = SvNumberFormatter::MatchSystemCurrency();
+
+ bool bFlag = (pTmpCurrencyEntry == nullptr);
+
+ SvxCurrencyToolBoxControl::GetCurrencySymbols(rList, bFlag, aCurCurrencyList);
+
+ if (pPos == nullptr)
+ return;
+
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nTableCount = rCurrencyTable.size();
+
+ *pPos = 0;
+ size_t nCount = aCurCurrencyList.size();
+
+ if (bFlag)
+ {
+ *pPos = 1;
+ nCurCurrencyEntryPos = 1;
+ }
+ else
+ {
+ for (size_t i = 1; i < nCount; i++)
+ {
+ const sal_uInt16 j = aCurCurrencyList[i];
+ if (j != sal_uInt16(-1) && j < nTableCount && pTmpCurrencyEntry == &rCurrencyTable[j])
+ {
+ *pPos = static_cast<sal_uInt16>(i);
+ nCurCurrencyEntryPos = static_cast<sal_uInt16>(i);
+ break;
+ }
+ }
+ }
+}
+
+void SvxNumberFormatShell::SetCurrencySymbol(sal_uInt32 nPos)
+{
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount = rCurrencyTable.size();
+
+ bBankingSymbol = (nPos >= nCount);
+
+ if (nPos >= aCurCurrencyList.size())
+ return;
+
+ sal_uInt16 nCurrencyPos = aCurCurrencyList[nPos];
+ if (nCurrencyPos != sal_uInt16(-1))
+ {
+ pCurCurrencyEntry = const_cast<NfCurrencyEntry*>(&rCurrencyTable[nCurrencyPos]);
+ nCurCurrencyEntryPos = nPos;
+ }
+ else
+ {
+ pCurCurrencyEntry = nullptr;
+ nCurCurrencyEntryPos = 0;
+ nCurFormatKey = pFormatter->GetFormatIndex(NF_CURRENCY_1000DEC2_RED, eCurLanguage);
+ }
+}
+
+void SvxNumberFormatShell::SetCurCurrencyEntry(NfCurrencyEntry* pCEntry)
+{
+ pCurCurrencyEntry = pCEntry;
+}
+
+bool SvxNumberFormatShell::IsTmpCurrencyFormat(const OUString& rFmtString)
+{
+ sal_uInt32 nFound;
+ FindEntry(rFmtString, &nFound);
+ return nFound == NUMBERFORMAT_ENTRY_NEW_CURRENCY;
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const OUString& rFmtString)
+{
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount = rCurrencyTable.size();
+
+ bool bTestBanking = false;
+
+ sal_uInt16 nPos = FindCurrencyTableEntry(rFmtString, bTestBanking);
+
+ if (nPos != sal_uInt16(-1))
+ {
+ sal_uInt16 nStart = 0;
+ if (bTestBanking && aCurCurrencyList.size() > nPos)
+ {
+ nStart = nCount;
+ }
+ for (size_t j = nStart; j < aCurCurrencyList.size(); j++)
+ {
+ if (aCurCurrencyList[j] == nPos)
+ return j;
+ }
+ }
+ return sal_uInt16(-1);
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry(const OUString& rFmtString,
+ bool& bTestBanking)
+{
+ sal_uInt16 nPos = sal_uInt16(-1);
+
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount = rCurrencyTable.size();
+
+ const SvNumberformat* pFormat;
+ OUString aSymbol, aExtension;
+ sal_uInt32 nFound = pFormatter->TestNewString(rFmtString, eCurLanguage);
+ if (nFound != NUMBERFORMAT_ENTRY_NOT_FOUND
+ && ((pFormat = pFormatter->GetEntry(nFound)) != nullptr)
+ && pFormat->GetNewCurrencySymbol(aSymbol, aExtension))
+ {
+ // eventually match with format locale
+ const NfCurrencyEntry* pTmpCurrencyEntry = SvNumberFormatter::GetCurrencyEntry(
+ bTestBanking, aSymbol, aExtension, pFormat->GetLanguage());
+ if (pTmpCurrencyEntry)
+ {
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ if (pTmpCurrencyEntry == &rCurrencyTable[i])
+ {
+ nPos = i;
+ break;
+ }
+ }
+ }
+ }
+ else
+ {
+ // search symbol string only
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ const NfCurrencyEntry* pTmpCurrencyEntry = &rCurrencyTable[i];
+ OUString _aSymbol = pTmpCurrencyEntry->BuildSymbolString(false);
+ OUString aBankSymbol = pTmpCurrencyEntry->BuildSymbolString(true);
+
+ if (rFmtString.indexOf(_aSymbol) != -1)
+ {
+ bTestBanking = false;
+ nPos = i;
+ break;
+ }
+ else if (rFmtString.indexOf(aBankSymbol) != -1)
+ {
+ bTestBanking = true;
+ nPos = i;
+ break;
+ }
+ }
+ }
+
+ return nPos;
+}
+
+sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpCurrencyEntry,
+ bool bTmpBanking)
+{
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+ sal_uInt16 nCount = rCurrencyTable.size();
+
+ sal_uInt16 nPos = 0;
+ for (sal_uInt16 i = 0; i < nCount; i++)
+ {
+ if (pTmpCurrencyEntry == &rCurrencyTable[i])
+ {
+ nPos = i;
+ break;
+ }
+ }
+
+ sal_uInt16 nStart = 0;
+ if (bTmpBanking && aCurCurrencyList.size() > nPos)
+ {
+ nStart = nCount;
+ }
+ for (size_t j = nStart; j < aCurCurrencyList.size(); j++)
+ {
+ if (aCurCurrencyList[j] == nPos)
+ return j;
+ }
+ return sal_uInt16(-1);
+}
+
+bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, bool const bTmpBanking,
+ std::u16string_view rFmtString) const
+{
+ bool bFlag = false;
+
+ if (nPos != sal_uInt16(-1))
+ {
+ const NfCurrencyTable& rCurrencyTable = SvNumberFormatter::GetTheCurrencyTable();
+
+ if (nPos < rCurrencyTable.size())
+ {
+ NfWSStringsDtor aWSStringsDtor;
+ pFormatter->GetCurrencyFormatStrings(aWSStringsDtor, rCurrencyTable[nPos], bTmpBanking);
+
+ for (const OUString& s : aWSStringsDtor)
+ {
+ if (s == rFmtString)
+ {
+ bFlag = true;
+ break;
+ }
+ }
+ }
+ }
+
+ return bFlag;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/numinf.cxx b/svx/source/items/numinf.cxx
new file mode 100644
index 000000000..d4bb1e915
--- /dev/null
+++ b/svx/source/items/numinf.cxx
@@ -0,0 +1,131 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/numinf.hxx>
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( const TypedWhichId<SvxNumberInfoItem> nId ) :
+ SfxPoolItem ( nId ),
+ pFormatter ( nullptr ),
+ eValueType ( SvxNumberValueType::Undefined ),
+ aStringVal ( "" ),
+ nDoubleVal ( 0 )
+{
+}
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const TypedWhichId<SvxNumberInfoItem> nId ) :
+ SfxPoolItem ( nId ),
+ pFormatter ( pNumFormatter ),
+ eValueType ( SvxNumberValueType::Undefined ),
+ aStringVal ( "" ),
+ nDoubleVal ( 0 )
+{
+}
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const OUString& rVal, const TypedWhichId<SvxNumberInfoItem> nId ) :
+ SfxPoolItem ( nId ),
+ pFormatter ( pNumFormatter ),
+ eValueType ( SvxNumberValueType::String ),
+ aStringVal ( rVal ),
+ nDoubleVal ( 0 )
+{
+}
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const double& rVal, const TypedWhichId<SvxNumberInfoItem> nId ) :
+ SfxPoolItem ( nId ),
+ pFormatter ( pNumFormatter ),
+ eValueType ( SvxNumberValueType::Number ),
+ aStringVal ( "" ),
+ nDoubleVal ( rVal )
+{
+}
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( SvNumberFormatter* pNumFormatter,
+ const double& rVal, const OUString& rValueStr,
+ const TypedWhichId<SvxNumberInfoItem> nId ) :
+ SfxPoolItem ( nId ),
+ pFormatter ( pNumFormatter ),
+ eValueType ( SvxNumberValueType::Number ),
+ aStringVal ( rValueStr ),
+ nDoubleVal ( rVal )
+{
+}
+
+
+SvxNumberInfoItem::SvxNumberInfoItem( const SvxNumberInfoItem& rItem ) :
+ SfxPoolItem ( rItem ),
+ pFormatter ( rItem.pFormatter ),
+ eValueType ( rItem.eValueType ),
+ aStringVal ( rItem.aStringVal ),
+ nDoubleVal ( rItem.nDoubleVal ),
+ mvDelFormats( rItem.mvDelFormats )
+{
+}
+
+
+SvxNumberInfoItem::~SvxNumberInfoItem()
+{
+}
+
+
+bool SvxNumberInfoItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+
+bool SvxNumberInfoItem::operator==( const SfxPoolItem& rItem ) const
+{
+ assert(SfxPoolItem::operator==(rItem));
+
+ const SvxNumberInfoItem& rOther = static_cast<const SvxNumberInfoItem&>(rItem);
+
+ return mvDelFormats == rOther.mvDelFormats &&
+ pFormatter == rOther.pFormatter &&
+ eValueType == rOther.eValueType &&
+ nDoubleVal == rOther.nDoubleVal &&
+ aStringVal == rOther.aStringVal;
+}
+
+SvxNumberInfoItem* SvxNumberInfoItem::Clone( SfxItemPool * ) const
+{
+ return new SvxNumberInfoItem( *this );
+}
+
+void SvxNumberInfoItem::SetDelFormats( std::vector<sal_uInt32> && aData )
+{
+ mvDelFormats = std::move(aData);
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/ofaitem.cxx b/svx/source/items/ofaitem.cxx
new file mode 100644
index 000000000..688507592
--- /dev/null
+++ b/svx/source/items/ofaitem.cxx
@@ -0,0 +1,56 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+
+#include <svx/ofaitem.hxx>
+#include <svx/xtable.hxx>
+
+OfaPtrItem::OfaPtrItem( sal_uInt16 _nWhich, void *_pPtr )
+ : SfxPoolItem( _nWhich ), pPtr( _pPtr )
+{
+
+}
+
+bool OfaPtrItem::operator==( const SfxPoolItem& rItem) const
+{
+ return SfxPoolItem::operator==(rItem) &&
+ static_cast<const OfaPtrItem&>(rItem).pPtr == pPtr;
+}
+
+OfaPtrItem* OfaPtrItem::Clone( SfxItemPool * ) const
+{
+ return new OfaPtrItem( *this );
+}
+
+OfaXColorListItem::OfaXColorListItem( sal_uInt16 _nWhich, const rtl::Reference<XColorList> &xRef )
+ : SfxPoolItem( _nWhich ), mxRef( xRef )
+{}
+
+bool OfaXColorListItem::operator==( const SfxPoolItem& rItem ) const
+{
+ return SfxPoolItem::operator==(rItem)
+ && mxRef == static_cast<OfaXColorListItem const &>(rItem).mxRef;
+}
+
+OfaXColorListItem* OfaXColorListItem::Clone( SfxItemPool* /*pPool = 0*/ ) const
+{
+ return new OfaXColorListItem( *this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx
new file mode 100644
index 000000000..93239ea3d
--- /dev/null
+++ b/svx/source/items/pageitem.cxx
@@ -0,0 +1,289 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <utility>
+
+#include <osl/diagnose.h>
+#include <comphelper/processfactory.hxx>
+#include <tools/resary.hxx>
+#include <svx/pageitem.hxx>
+#include <svx/strarray.hxx>
+#include <editeng/itemtype.hxx>
+#include <svx/unomid.hxx>
+#include <com/sun/star/text/DefaultNumberingProvider.hpp>
+#include <com/sun/star/text/XNumberingTypeInfo.hpp>
+#include <com/sun/star/style/NumberingType.hpp>
+#include <com/sun/star/style/PageStyleLayout.hpp>
+#include <svl/itemset.hxx>
+#include <svx/strings.hrc>
+#include <svx/dialmgr.hxx>
+
+using namespace ::com::sun::star;
+
+SfxPoolItem* SvxPageItem::CreateDefault() { return new SvxPageItem(TypedWhichId<SvxPageItem>(0));}
+
+SvxPageItem::SvxPageItem( const TypedWhichId<SvxPageItem> nId ) : SfxPoolItem( nId ),
+
+ eNumType ( SVX_NUM_ARABIC ),
+ bLandscape ( false ),
+ eUse ( SvxPageUsage::All )
+{
+}
+
+// Copy-Ctor
+SvxPageItem::SvxPageItem( const SvxPageItem& rItem )
+ : SfxPoolItem( rItem )
+{
+ eNumType = rItem.eNumType;
+ bLandscape = rItem.bLandscape;
+ eUse = rItem.eUse;
+}
+
+SvxPageItem::~SvxPageItem() {}
+
+// Clone
+SvxPageItem* SvxPageItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPageItem( *this );
+}
+
+// Test for equality
+bool SvxPageItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+ const SvxPageItem& rItem = static_cast<const SvxPageItem&>(rAttr);
+ return ( eNumType == rItem.eNumType &&
+ bLandscape == rItem.bLandscape &&
+ eUse == rItem.eUse );
+}
+
+static OUString GetUsageText( const SvxPageUsage eU )
+{
+ switch( eU )
+ {
+ case SvxPageUsage::Left : return SvxResId(RID_SVXITEMS_PAGE_USAGE_LEFT);
+ case SvxPageUsage::Right : return SvxResId(RID_SVXITEMS_PAGE_USAGE_RIGHT);
+ case SvxPageUsage::All : return SvxResId(RID_SVXITEMS_PAGE_USAGE_ALL);
+ case SvxPageUsage::Mirror: return SvxResId(RID_SVXITEMS_PAGE_USAGE_MIRROR);
+ default: return OUString();
+ }
+}
+
+const TranslateId RID_SVXITEMS_PAGE_NUMS[] =
+{
+ RID_SVXITEMS_PAGE_NUM_CHR_UPPER,
+ RID_SVXITEMS_PAGE_NUM_CHR_LOWER,
+ RID_SVXITEMS_PAGE_NUM_ROM_UPPER,
+ RID_SVXITEMS_PAGE_NUM_ROM_LOWER,
+ RID_SVXITEMS_PAGE_NUM_ARABIC,
+ RID_SVXITEMS_PAGE_NUM_NONE
+};
+
+namespace
+{
+ OUString GetNumberingDescription(SvxNumType eNumType)
+ {
+ // classic ones, keep displaying the old name
+ if (eNumType <= css::style::NumberingType::NUMBER_NONE)
+ return SvxResId(RID_SVXITEMS_PAGE_NUMS[eNumType]);
+ // new ones, reuse the text used in the numbering dropdown list
+ sal_uInt32 n = SvxNumberingTypeTable::FindIndex(eNumType);
+ if (n != RESARRAY_INDEX_NOTFOUND)
+ return SvxNumberingTypeTable::GetString(n);
+ css::uno::Reference<css::uno::XComponentContext> xContext = comphelper::getProcessComponentContext();
+ css::uno::Reference<css::text::XDefaultNumberingProvider> xDefNum = css::text::DefaultNumberingProvider::create(xContext);
+ css::uno::Reference<css::text::XNumberingTypeInfo> xInfo(xDefNum, css::uno::UNO_QUERY);
+ if (!xInfo.is())
+ return OUString();
+ return xInfo->getNumberingIdentifier(eNumType);
+ }
+}
+
+bool SvxPageItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ OUString cpDelimTmp(cpDelim);
+
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ {
+ if ( !aDescName.isEmpty() )
+ {
+ rText = aDescName + cpDelimTmp;
+ }
+ rText += GetNumberingDescription(eNumType) + cpDelimTmp;
+ if ( bLandscape )
+ rText += SvxResId(RID_SVXITEMS_PAGE_LAND_TRUE);
+ else
+ rText += SvxResId(RID_SVXITEMS_PAGE_LAND_FALSE);
+ OUString aUsageText = GetUsageText( eUse );
+ if (!aUsageText.isEmpty())
+ {
+ rText += cpDelimTmp + aUsageText;
+ }
+ return true;
+ }
+ case SfxItemPresentation::Complete:
+ {
+ rText += SvxResId(RID_SVXITEMS_PAGE_COMPLETE);
+ if ( !aDescName.isEmpty() )
+ {
+ rText += aDescName + cpDelimTmp;
+ }
+ rText += GetNumberingDescription(eNumType) + cpDelimTmp;
+ if ( bLandscape )
+ rText += SvxResId(RID_SVXITEMS_PAGE_LAND_TRUE);
+ else
+ rText += SvxResId(RID_SVXITEMS_PAGE_LAND_FALSE);
+ OUString aUsageText = GetUsageText( eUse );
+ if (!aUsageText.isEmpty())
+ {
+ rText += cpDelimTmp + aUsageText;
+ }
+ return true;
+ }
+ default: ;//prevent warning
+ }
+ return false;
+}
+
+
+bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+// sal_Bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
+ nMemberId &= ~CONVERT_TWIPS;
+ switch( nMemberId )
+ {
+ case MID_PAGE_NUMTYPE:
+ {
+ //! constants aren't in IDLs any more ?!?
+ rVal <<= static_cast<sal_Int16>( eNumType );
+ }
+ break;
+ case MID_PAGE_ORIENTATION:
+ rVal <<= bLandscape;
+ break;
+ case MID_PAGE_LAYOUT :
+ {
+ style::PageStyleLayout eRet;
+ switch(eUse)
+ {
+ case SvxPageUsage::Left : eRet = style::PageStyleLayout_LEFT; break;
+ case SvxPageUsage::Right : eRet = style::PageStyleLayout_RIGHT; break;
+ case SvxPageUsage::All : eRet = style::PageStyleLayout_ALL; break;
+ case SvxPageUsage::Mirror: eRet = style::PageStyleLayout_MIRRORED; break;
+ default:
+ OSL_FAIL("what layout is this?");
+ return false;
+ }
+ rVal <<= eRet;
+ }
+ break;
+ }
+
+ return true;
+}
+
+bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ switch( nMemberId & ~CONVERT_TWIPS )
+ {
+ case MID_PAGE_NUMTYPE:
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return false;
+
+ eNumType = static_cast<SvxNumType>(nValue);
+ }
+ break;
+ case MID_PAGE_ORIENTATION:
+ bLandscape = Any2Bool(rVal);
+ break;
+ case MID_PAGE_LAYOUT :
+ {
+ style::PageStyleLayout eLayout;
+ if(!(rVal >>= eLayout))
+ {
+ sal_Int32 nValue = 0;
+ if(!(rVal >>= nValue))
+ return false;
+ eLayout = static_cast<style::PageStyleLayout>(nValue);
+ }
+ switch( eLayout )
+ {
+ case style::PageStyleLayout_LEFT : eUse = SvxPageUsage::Left ; break;
+ case style::PageStyleLayout_RIGHT : eUse = SvxPageUsage::Right; break;
+ case style::PageStyleLayout_ALL : eUse = SvxPageUsage::All ; break;
+ case style::PageStyleLayout_MIRRORED: eUse = SvxPageUsage::Mirror;break;
+ default: ;//prevent warning
+ }
+ }
+ break;
+ }
+ return true;
+}
+
+// HeaderFooterSet
+SvxSetItem::SvxSetItem( const TypedWhichId<SvxSetItem> nId, const SfxItemSet& rSet ) :
+
+ SfxSetItem( nId, rSet )
+{
+}
+
+SvxSetItem::SvxSetItem( const SvxSetItem& rItem ) :
+
+ SfxSetItem( rItem )
+{
+}
+
+SvxSetItem::SvxSetItem( const TypedWhichId<SvxSetItem> nId, SfxItemSet&& _pSet ) :
+
+ SfxSetItem( nId, std::move(_pSet) )
+{
+}
+
+SvxSetItem* SvxSetItem::Clone( SfxItemPool * ) const
+{
+ return new SvxSetItem(*this);
+}
+
+bool SvxSetItem::GetPresentation
+(
+ SfxItemPresentation /*ePres*/,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ rText.clear();
+ return false;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/postattr.cxx b/svx/source/items/postattr.cxx
new file mode 100644
index 000000000..267c2cd9a
--- /dev/null
+++ b/svx/source/items/postattr.cxx
@@ -0,0 +1,154 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/postattr.hxx>
+#include <svx/strings.hrc>
+#include <svx/dialmgr.hxx>
+
+SfxPoolItem* SvxPostItAuthorItem::CreateDefault() { return new SvxPostItAuthorItem(TypedWhichId<SvxPostItAuthorItem>(0)); }
+SfxPoolItem* SvxPostItDateItem::CreateDefault() { return new SvxPostItDateItem(TypedWhichId<SvxPostItDateItem>(0)); }
+SfxPoolItem* SvxPostItTextItem::CreateDefault() { return new SvxPostItTextItem(TypedWhichId<SvxPostItTextItem>(0)); }
+SfxPoolItem* SvxPostItIdItem::CreateDefault() { return new SvxPostItIdItem(TypedWhichId<SvxPostItIdItem>(0)); }
+
+SvxPostItAuthorItem::SvxPostItAuthorItem( TypedWhichId<SvxPostItAuthorItem> _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+
+SvxPostItAuthorItem::SvxPostItAuthorItem( const OUString& rAuthor,
+ TypedWhichId<SvxPostItAuthorItem> _nWhich ) :
+ SfxStringItem( _nWhich, rAuthor )
+{
+}
+
+
+bool SvxPostItAuthorItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ rText = GetValue();
+ return true;
+ case SfxItemPresentation::Complete:
+ rText = SvxResId(RID_SVXITEMS_AUTHOR_COMPLETE) + GetValue();
+ return true;
+ default: ;//prevent warning
+ }
+ return false;
+}
+
+SvxPostItAuthorItem* SvxPostItAuthorItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItAuthorItem( *this );
+}
+
+SvxPostItDateItem::SvxPostItDateItem( TypedWhichId<SvxPostItDateItem> _nWhich )
+ : SfxStringItem(_nWhich)
+{
+}
+
+
+SvxPostItDateItem::SvxPostItDateItem( const OUString& rDate, TypedWhichId<SvxPostItDateItem> _nWhich ) :
+ SfxStringItem( _nWhich, rDate )
+{
+}
+
+
+bool SvxPostItDateItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ rText = GetValue();
+ return true;
+ case SfxItemPresentation::Complete:
+ rText = SvxResId(RID_SVXITEMS_DATE_COMPLETE) + GetValue();
+ return true;
+ default: ;//prevent warning
+ }
+ return false;
+}
+
+
+SvxPostItDateItem* SvxPostItDateItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItDateItem( *this );
+}
+
+SvxPostItTextItem::SvxPostItTextItem( TypedWhichId<SvxPostItTextItem> _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+SvxPostItTextItem::SvxPostItTextItem( const OUString& rText, TypedWhichId<SvxPostItTextItem> _nWhich ) :
+
+ SfxStringItem( _nWhich, rText )
+{
+}
+
+bool SvxPostItTextItem::GetPresentation
+(
+ SfxItemPresentation ePres,
+ MapUnit /*eCoreUnit*/,
+ MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper&
+) const
+{
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Nameless:
+ rText = GetValue();
+ return true;
+ case SfxItemPresentation::Complete:
+ rText = SvxResId(RID_SVXITEMS_TEXT_COMPLETE) + GetValue();
+ return true;
+ default: ;//prevent warning
+ }
+ return false;
+}
+
+SvxPostItTextItem* SvxPostItTextItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItTextItem( *this );
+}
+
+SvxPostItIdItem::SvxPostItIdItem( TypedWhichId<SvxPostItIdItem> _nWhich )
+{
+ SetWhich( _nWhich );
+}
+
+SvxPostItIdItem* SvxPostItIdItem::Clone( SfxItemPool * ) const
+{
+ return new SvxPostItIdItem( *this );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/rotmodit.cxx b/svx/source/items/rotmodit.cxx
new file mode 100644
index 000000000..eb559fdae
--- /dev/null
+++ b/svx/source/items/rotmodit.cxx
@@ -0,0 +1,123 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <com/sun/star/table/CellVertJustify2.hpp>
+
+#include <svx/dialmgr.hxx>
+#include <svx/rotmodit.hxx>
+#include <rotationstrings.hrc>
+
+using namespace ::com::sun::star;
+
+
+SfxPoolItem* SvxRotateModeItem::CreateDefault() { return new SvxRotateModeItem(SVX_ROTATE_MODE_STANDARD, TypedWhichId<SvxRotateModeItem>(0));}
+
+
+// SvxRotateModeItem - orientation with turned text
+
+
+SvxRotateModeItem::SvxRotateModeItem( SvxRotateMode eMode, TypedWhichId<SvxRotateModeItem> _nWhich )
+ : SfxEnumItem( _nWhich, eMode )
+{
+}
+
+SvxRotateModeItem::SvxRotateModeItem( const SvxRotateModeItem& rItem )
+ : SfxEnumItem( rItem )
+{
+}
+
+SvxRotateModeItem::~SvxRotateModeItem()
+{
+}
+
+OUString SvxRotateModeItem::GetValueText(SvxRotateMode nVal)
+{
+ assert(nVal <= SVX_ROTATE_MODE_BOTTOM && "enum overflow!");
+ return SvxResId(RID_SVXITEMS_ROTATE_MODE[static_cast<size_t>(nVal)]);
+}
+
+bool SvxRotateModeItem::GetPresentation(
+ SfxItemPresentation ePres,
+ MapUnit /*eCoreUnit*/, MapUnit /*ePresUnit*/,
+ OUString& rText, const IntlWrapper& ) const
+{
+ rText.clear();
+
+ switch ( ePres )
+ {
+ case SfxItemPresentation::Complete:
+ rText += GetValueText(GetValue());
+ return true;
+
+ case SfxItemPresentation::Nameless:
+ rText += OUString::number( GetValue() );
+ return true;
+ default: ;//prevent warning
+ }
+
+ return false;
+}
+
+sal_uInt16 SvxRotateModeItem::GetValueCount() const
+{
+ return 4; // STANDARD, TOP, CENTER, BOTTOM
+}
+
+SvxRotateModeItem* SvxRotateModeItem::Clone( SfxItemPool* ) const
+{
+ return new SvxRotateModeItem( *this );
+}
+
+bool SvxRotateModeItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
+{
+ sal_Int32 nUno = table::CellVertJustify2::STANDARD;
+ switch ( GetValue() )
+ {
+ case SVX_ROTATE_MODE_STANDARD: nUno = table::CellVertJustify2::STANDARD; break;
+ case SVX_ROTATE_MODE_TOP: nUno = table::CellVertJustify2::TOP; break;
+ case SVX_ROTATE_MODE_CENTER: nUno = table::CellVertJustify2::CENTER; break;
+ case SVX_ROTATE_MODE_BOTTOM: nUno = table::CellVertJustify2::BOTTOM; break;
+ }
+ rVal <<= nUno;
+ return true;
+}
+
+bool SvxRotateModeItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
+{
+ sal_Int32 nUno(0);
+ if(!(rVal >>= nUno))
+ {
+ nUno = table::CellVertJustify2::STANDARD;
+ }
+
+ SvxRotateMode eSvx = SVX_ROTATE_MODE_STANDARD;
+ switch (nUno)
+ {
+ case table::CellVertJustify2::STANDARD: eSvx = SVX_ROTATE_MODE_STANDARD; break;
+ case table::CellVertJustify2::TOP: eSvx = SVX_ROTATE_MODE_TOP; break;
+ case table::CellVertJustify2::CENTER: eSvx = SVX_ROTATE_MODE_CENTER; break;
+ case table::CellVertJustify2::BOTTOM: eSvx = SVX_ROTATE_MODE_BOTTOM; break;
+ default: ;//prevent warning
+ }
+ SetValue( eSvx );
+ return true;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/svxerr.cxx b/svx/source/items/svxerr.cxx
new file mode 100644
index 000000000..24efadda4
--- /dev/null
+++ b/svx/source/items/svxerr.cxx
@@ -0,0 +1,36 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/svxerr.hxx>
+#include <svx/dialmgr.hxx>
+#include <svxerr.hrc>
+
+SvxErrorHandler::SvxErrorHandler() :
+ SfxErrorHandler(
+ RID_SVXERRCODE, ErrCodeArea::Svx, ErrCodeArea::Svx, SvxResLocale())
+{
+}
+
+void SvxErrorHandler::ensure()
+{
+ static SvxErrorHandler SINGLETON;
+ // coverity[side_effect_free : FALSE] - not actually side-effect-free
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx
new file mode 100644
index 000000000..d923133a1
--- /dev/null
+++ b/svx/source/items/viewlayoutitem.cxx
@@ -0,0 +1,170 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <svx/viewlayoutitem.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+#include <comphelper/propertyvalue.hxx>
+#include <osl/diagnose.h>
+
+#include <cassert>
+
+
+SfxPoolItem* SvxViewLayoutItem::CreateDefault() { return new SvxViewLayoutItem; }
+
+constexpr OUStringLiteral VIEWLAYOUT_PARAM_COLUMNS = u"Columns";
+constexpr OUStringLiteral VIEWLAYOUT_PARAM_BOOKMODE = u"BookMode";
+#define VIEWLAYOUT_PARAMS 2
+
+
+SvxViewLayoutItem::SvxViewLayoutItem
+(
+ sal_uInt16 nColumns,
+ bool bBookMode,
+ TypedWhichId<SvxViewLayoutItem> _nWhich
+)
+: SfxUInt16Item( _nWhich, nColumns ),
+ mbBookMode( bBookMode )
+{
+}
+
+
+SvxViewLayoutItem::SvxViewLayoutItem( const SvxViewLayoutItem& rOrig )
+: SfxUInt16Item( rOrig ),
+ mbBookMode( rOrig.IsBookMode() )
+{
+}
+
+
+SvxViewLayoutItem::~SvxViewLayoutItem()
+{
+}
+
+SvxViewLayoutItem* SvxViewLayoutItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxViewLayoutItem( *this );
+}
+
+bool SvxViewLayoutItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxViewLayoutItem& rItem = static_cast<const SvxViewLayoutItem&>(rAttr);
+
+ return ( GetValue() == rItem.GetValue() &&
+ mbBookMode == rItem.IsBookMode() );
+}
+
+bool SvxViewLayoutItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aSeq{
+ comphelper::makePropertyValue(VIEWLAYOUT_PARAM_COLUMNS, sal_Int32( GetValue() )),
+ comphelper::makePropertyValue(VIEWLAYOUT_PARAM_BOOKMODE, mbBookMode)
+ };
+ assert(aSeq.getLength() == VIEWLAYOUT_PARAMS);
+ rVal <<= aSeq;
+ }
+ break;
+
+ case MID_VIEWLAYOUT_COLUMNS : rVal <<= static_cast<sal_Int32>(GetValue()); break;
+ case MID_VIEWLAYOUT_BOOKMODE: rVal <<= mbBookMode; break;
+ default:
+ OSL_FAIL("svx::SvxViewLayoutItem::QueryValue(), Wrong MemberId!");
+ return false;
+ }
+
+ return true;
+}
+
+bool SvxViewLayoutItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == VIEWLAYOUT_PARAMS ))
+ {
+ sal_Int32 nColumns( 0 );
+ bool bBookMode = false;
+ bool bAllConverted( true );
+ sal_Int16 nConvertedCount( 0 );
+ for ( const auto& rProp : std::as_const(aSeq) )
+ {
+ if ( rProp.Name == VIEWLAYOUT_PARAM_COLUMNS )
+ {
+ bAllConverted &= ( rProp.Value >>= nColumns );
+ ++nConvertedCount;
+ }
+ else if ( rProp.Name == VIEWLAYOUT_PARAM_BOOKMODE )
+ {
+ bAllConverted &= ( rProp.Value >>= bBookMode );
+ ++nConvertedCount;
+ }
+ }
+
+ if ( bAllConverted && nConvertedCount == VIEWLAYOUT_PARAMS )
+ {
+ SetValue( static_cast<sal_uInt16>(nColumns) );
+ mbBookMode = bBookMode;
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ case MID_VIEWLAYOUT_COLUMNS:
+ {
+ sal_Int32 nVal = 0;
+ if ( rVal >>= nVal )
+ {
+ SetValue( static_cast<sal_uInt16>(nVal) );
+ return true;
+ }
+ else
+ return false;
+ }
+
+ case MID_VIEWLAYOUT_BOOKMODE:
+ {
+ bool bBookMode = false;
+ if ( rVal >>= bBookMode )
+ {
+ mbBookMode = bBookMode;
+ return true;
+ }
+ else
+ return false;
+ }
+
+ default:
+ OSL_FAIL("svx::SvxViewLayoutItem::PutValue(), Wrong MemberId!");
+ return false;
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx
new file mode 100644
index 000000000..046a03591
--- /dev/null
+++ b/svx/source/items/zoomslideritem.cxx
@@ -0,0 +1,219 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#include <sal/config.h>
+
+#include <comphelper/propertyvalue.hxx>
+#include <osl/diagnose.h>
+
+#include <svx/zoomslideritem.hxx>
+#include <com/sun/star/beans/PropertyValue.hpp>
+
+
+SfxPoolItem* SvxZoomSliderItem::CreateDefault() { return new SvxZoomSliderItem; }
+
+constexpr OUStringLiteral ZOOMSLIDER_PARAM_CURRENTZOOM = u"Columns";
+constexpr OUStringLiteral ZOOMSLIDER_PARAM_SNAPPINGPOINTS = u"SnappingPoints";
+constexpr OUStringLiteral ZOOMSLIDER_PARAM_MINZOOM = u"MinValue";
+constexpr OUStringLiteral ZOOMSLIDER_PARAM_MAXZOOM = u"MaxValue";
+#define ZOOMSLIDER_PARAMS 4
+
+
+SvxZoomSliderItem::SvxZoomSliderItem( sal_uInt16 nCurrentZoom, sal_uInt16 nMinZoom, sal_uInt16 nMaxZoom, TypedWhichId<SvxZoomSliderItem> _nWhich )
+: SfxUInt16Item( _nWhich, nCurrentZoom ), mnMinZoom( nMinZoom ), mnMaxZoom( nMaxZoom )
+{
+}
+
+SvxZoomSliderItem* SvxZoomSliderItem::Clone( SfxItemPool * /*pPool*/ ) const
+{
+ return new SvxZoomSliderItem( *this );
+}
+
+bool SvxZoomSliderItem::operator==( const SfxPoolItem& rAttr ) const
+{
+ assert(SfxPoolItem::operator==(rAttr));
+
+ const SvxZoomSliderItem& rItem = static_cast<const SvxZoomSliderItem&>(rAttr);
+
+ return ( GetValue() == rItem.GetValue() && maValues == rItem.maValues &&
+ mnMinZoom == rItem.mnMinZoom && mnMaxZoom == rItem.mnMaxZoom );
+}
+
+bool SvxZoomSliderItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aSeq{
+ comphelper::makePropertyValue(ZOOMSLIDER_PARAM_CURRENTZOOM, sal_Int32( GetValue() )),
+ comphelper::makePropertyValue(ZOOMSLIDER_PARAM_SNAPPINGPOINTS, maValues),
+ comphelper::makePropertyValue(ZOOMSLIDER_PARAM_MINZOOM, mnMinZoom),
+ comphelper::makePropertyValue(ZOOMSLIDER_PARAM_MAXZOOM, mnMaxZoom)
+ };
+ assert(aSeq.getLength() == ZOOMSLIDER_PARAMS);
+ rVal <<= aSeq;
+ }
+ break;
+
+ case MID_ZOOMSLIDER_CURRENTZOOM :
+ {
+ rVal <<= static_cast<sal_Int32>(GetValue());
+ }
+ break;
+ case MID_ZOOMSLIDER_SNAPPINGPOINTS:
+ {
+ rVal <<= maValues;
+ }
+ break;
+ case MID_ZOOMSLIDER_MINZOOM:
+ {
+ rVal <<= mnMinZoom;
+ }
+ break;
+ case MID_ZOOMSLIDER_MAXZOOM:
+ {
+ rVal <<= mnMaxZoom;
+ }
+ break;
+ default:
+ OSL_FAIL("svx::SvxZoomSliderItem::QueryValue(), Wrong MemberId!");
+ return false;
+ }
+
+ return true;
+}
+
+bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId )
+{
+ nMemberId &= ~CONVERT_TWIPS;
+ switch ( nMemberId )
+ {
+ case 0 :
+ {
+ css::uno::Sequence< css::beans::PropertyValue > aSeq;
+ if (( rVal >>= aSeq ) && ( aSeq.getLength() == ZOOMSLIDER_PARAMS ))
+ {
+ sal_Int32 nCurrentZoom( 0 );
+ css::uno::Sequence < sal_Int32 > aValues;
+
+ bool bAllConverted( true );
+ sal_Int16 nConvertedCount( 0 );
+ sal_Int32 nMinZoom( 0 ), nMaxZoom( 0 );
+
+ for ( const auto& rProp : std::as_const(aSeq) )
+ {
+ if ( rProp.Name == ZOOMSLIDER_PARAM_CURRENTZOOM )
+ {
+ bAllConverted &= ( rProp.Value >>= nCurrentZoom );
+ ++nConvertedCount;
+ }
+ else if ( rProp.Name == ZOOMSLIDER_PARAM_SNAPPINGPOINTS )
+ {
+ bAllConverted &= ( rProp.Value >>= aValues );
+ ++nConvertedCount;
+ }
+ else if( rProp.Name == ZOOMSLIDER_PARAM_MINZOOM )
+ {
+ bAllConverted &= ( rProp.Value >>= nMinZoom );
+ ++nConvertedCount;
+ }
+ else if( rProp.Name == ZOOMSLIDER_PARAM_MAXZOOM )
+ {
+ bAllConverted &= ( rProp.Value >>= nMaxZoom );
+ ++nConvertedCount;
+ }
+ }
+
+ if ( bAllConverted && nConvertedCount == ZOOMSLIDER_PARAMS )
+ {
+ SetValue( static_cast<sal_uInt16>(nCurrentZoom) );
+ maValues = aValues;
+ mnMinZoom = sal::static_int_cast< sal_uInt16 >( nMinZoom );
+ mnMaxZoom = sal::static_int_cast< sal_uInt16 >( nMaxZoom );
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ case MID_ZOOMSLIDER_CURRENTZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if ( rVal >>= nVal )
+ {
+ SetValue( static_cast<sal_uInt16>(nVal) );
+ return true;
+ }
+ else
+ return false;
+ }
+
+ case MID_ZOOMSLIDER_SNAPPINGPOINTS:
+ {
+ css::uno::Sequence < sal_Int32 > aValues;
+ if ( rVal >>= aValues )
+ {
+ maValues = aValues;
+ return true;
+ }
+ else
+ return false;
+ }
+ case MID_ZOOMSLIDER_MINZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if( rVal >>= nVal )
+ {
+ mnMinZoom = static_cast<sal_uInt16>(nVal);
+ return true;
+ }
+ else
+ return false;
+ }
+ case MID_ZOOMSLIDER_MAXZOOM:
+ {
+ sal_Int32 nVal = 0;
+ if( rVal >>= nVal )
+ {
+ mnMaxZoom = static_cast<sal_uInt16>(nVal);
+ return true;
+ }
+ else
+ return false;
+ }
+ default:
+ OSL_FAIL("svx::SvxZoomSliderItem::PutValue(), Wrong MemberId!");
+ return false;
+ }
+}
+
+void SvxZoomSliderItem::AddSnappingPoint( sal_Int32 nNew )
+{
+ const sal_Int32 nValues = maValues.getLength();
+ maValues.realloc( nValues + 1 );
+ sal_Int32* pValues = maValues.getArray();
+ pValues[ nValues ] = nNew;
+}
+
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */