summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorArmin Le Grand <Armin.Le.Grand@me.com>2019-04-18 19:25:06 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2019-04-25 19:59:04 +0200
commit1e2682235cded9a7cd90e55f0bfc60a1285e9a46 (patch)
tree17457bc49d6faf37270c8a481b94765f58a5f434 /editeng
parent5e4c1e6ba425ce0b75864e4584a846957b032e61 (diff)
WIP: Further preparations for deeper Item changes
(1) Migrated all still existing binary load/save stuff in SfxPoolItem to legacy files. Isolated from Item implementations. Adapted all usages. No more methods Create/Store needed, also GetVersion removed (2) Removed operator= for SfxPoolItem. Adapted all usages. Goal ist to handle Items more as Objects ('Object-Oriented') in the sense to move/handle instances, not to copy one instance over another one (which is more and more problematic with hard to copy content as UNO API stuff or similar). This lead to much more usages of std::shared_ptr which correlates well with future plans fr Items (see dev branch). Next logic step will be to also remove copy constructor Linux build and corrections done Fixed Writer test and removed unused defines Fixed another unused m,acro Started to unify the AutoFormat stuff Changes to OUString constructor usages, tests completely No idea why, but SfxStringItem constructor which takes a OUString& now insists of not getting ::OUString's handed in - changed all 'SfxStringItem.*OUString.*".*"' accordingly Change-Id: Ibed7358b18fb019994a7490332b9d797a6694c29 Reviewed-on: https://gerrit.libreoffice.org/71075 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/Library_editeng.mk1
-rw-r--r--editeng/source/editeng/editdoc.cxx32
-rw-r--r--editeng/source/editeng/impedit.hxx2
-rw-r--r--editeng/source/editeng/impedit4.cxx2
-rw-r--r--editeng/source/items/bulitem.cxx9
-rw-r--r--editeng/source/items/frmitems.cxx505
-rw-r--r--editeng/source/items/justifyitem.cxx17
-rwxr-xr-xediteng/source/items/legacyitem.cxx807
-rw-r--r--editeng/source/items/numitem.cxx12
-rw-r--r--editeng/source/items/paraitem.cxx92
-rw-r--r--editeng/source/items/textitem.cxx312
-rw-r--r--editeng/source/items/writingmodeitem.cxx5
-rw-r--r--editeng/source/items/xmlcnitm.cxx6
-rw-r--r--editeng/source/rtf/rtfitem.cxx91
14 files changed, 883 insertions, 1010 deletions
diff --git a/editeng/Library_editeng.mk b/editeng/Library_editeng.mk
index 87e23b8628da..9354071b3a70 100644
--- a/editeng/Library_editeng.mk
+++ b/editeng/Library_editeng.mk
@@ -77,6 +77,7 @@ $(eval $(call gb_Library_add_exception_objects,editeng,\
editeng/source/items/itemtype \
editeng/source/items/justifyitem \
editeng/source/items/numitem \
+ editeng/source/items/legacyitem \
editeng/source/items/optitems \
editeng/source/items/paperinf \
editeng/source/items/paraitem \
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 8c27e0dbf09a..ef5964c822f5 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -816,16 +816,16 @@ void ContentAttribsInfo::AppendCharAttrib(EditCharAttrib* pNew)
aPrevCharAttribs.push_back(std::unique_ptr<EditCharAttrib>(pNew));
}
-void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit )
+void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit )
{
DBG_ASSERT( eSourceUnit != eDestUnit, "ConvertItem - Why?!" );
- switch ( rPoolItem.Which() )
+ switch ( rPoolItem->Which() )
{
case EE_PARA_LRSPACE:
{
- assert(dynamic_cast<const SvxLRSpaceItem *>(&rPoolItem) != nullptr);
- SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(rPoolItem);
+ assert(dynamic_cast<const SvxLRSpaceItem *>(rPoolItem.get()) != nullptr);
+ SvxLRSpaceItem& rItem = static_cast<SvxLRSpaceItem&>(*rPoolItem);
rItem.SetTextFirstLineOfst( sal::static_int_cast< short >( OutputDevice::LogicToLogic( rItem.GetTextFirstLineOfst(), eSourceUnit, eDestUnit ) ) );
rItem.SetTextLeft( OutputDevice::LogicToLogic( rItem.GetTextLeft(), eSourceUnit, eDestUnit ) );
rItem.SetRight( OutputDevice::LogicToLogic( rItem.GetRight(), eSourceUnit, eDestUnit ) );
@@ -833,16 +833,16 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit
break;
case EE_PARA_ULSPACE:
{
- assert(dynamic_cast<const SvxULSpaceItem *>(&rPoolItem) != nullptr);
- SvxULSpaceItem& rItem = static_cast<SvxULSpaceItem&>(rPoolItem);
+ assert(dynamic_cast<const SvxULSpaceItem *>(rPoolItem.get()) != nullptr);
+ SvxULSpaceItem& rItem = static_cast<SvxULSpaceItem&>(*rPoolItem);
rItem.SetUpper( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetUpper(), eSourceUnit, eDestUnit ) ) );
rItem.SetLower( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLower(), eSourceUnit, eDestUnit ) ) );
}
break;
case EE_PARA_SBL:
{
- assert(dynamic_cast<const SvxLineSpacingItem *>(&rPoolItem) != nullptr);
- SvxLineSpacingItem& rItem = static_cast<SvxLineSpacingItem&>(rPoolItem);
+ assert(dynamic_cast<const SvxLineSpacingItem *>(rPoolItem.get()) != nullptr);
+ SvxLineSpacingItem& rItem = static_cast<SvxLineSpacingItem&>(*rPoolItem);
// SetLineHeight changes also eLineSpace!
if ( rItem.GetLineSpaceRule() == SvxLineSpaceRule::Min )
rItem.SetLineHeight( sal::static_int_cast< sal_uInt16 >( OutputDevice::LogicToLogic( rItem.GetLineHeight(), eSourceUnit, eDestUnit ) ) );
@@ -850,24 +850,24 @@ void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit
break;
case EE_PARA_TABS:
{
- assert(dynamic_cast<const SvxTabStopItem *>(&rPoolItem) != nullptr);
- SvxTabStopItem& rItem = static_cast<SvxTabStopItem&>(rPoolItem);
- SvxTabStopItem aNewItem( EE_PARA_TABS );
+ assert(dynamic_cast<const SvxTabStopItem *>(rPoolItem.get()) != nullptr);
+ SvxTabStopItem& rItem = static_cast<SvxTabStopItem&>(*rPoolItem);
+ SvxTabStopItem* pNewItem(new SvxTabStopItem(EE_PARA_TABS));
for ( sal_uInt16 i = 0; i < rItem.Count(); i++ )
{
const SvxTabStop& rTab = rItem[i];
SvxTabStop aNewStop( OutputDevice::LogicToLogic( rTab.GetTabPos(), eSourceUnit, eDestUnit ), rTab.GetAdjustment(), rTab.GetDecimal(), rTab.GetFill() );
- aNewItem.Insert( aNewStop );
+ pNewItem->Insert( aNewStop );
}
- rItem = aNewItem;
+ rPoolItem.reset(pNewItem);
}
break;
case EE_CHAR_FONTHEIGHT:
case EE_CHAR_FONTHEIGHT_CJK:
case EE_CHAR_FONTHEIGHT_CTL:
{
- assert(dynamic_cast<const SvxFontHeightItem *>(&rPoolItem) != nullptr);
- SvxFontHeightItem& rItem = static_cast<SvxFontHeightItem&>(rPoolItem);
+ assert(dynamic_cast<const SvxFontHeightItem *>(rPoolItem.get()) != nullptr);
+ SvxFontHeightItem& rItem = static_cast<SvxFontHeightItem&>(*rPoolItem);
rItem.SetHeight( OutputDevice::LogicToLogic( rItem.GetHeight(), eSourceUnit, eDestUnit ) );
}
break;
@@ -899,7 +899,7 @@ void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const Map
if ( eSourceUnit != eDestUnit )
{
std::unique_ptr<SfxPoolItem> pItem(rSource.Get( nSourceWhich ).Clone());
- ConvertItem( *pItem, eSourceUnit, eDestUnit );
+ ConvertItem( pItem, eSourceUnit, eDestUnit );
pItem->SetWhich(nWhich);
rDest.Put( *pItem );
}
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 9d7ea22183e3..9f0e27909515 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -1225,7 +1225,7 @@ inline vcl::Cursor* ImpEditView::GetCursor()
return pCursor.get();
}
-void ConvertItem( SfxPoolItem& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
+void ConvertItem( std::unique_ptr<SfxPoolItem>& rPoolItem, MapUnit eSourceUnit, MapUnit eDestUnit );
void ConvertAndPutItems( SfxItemSet& rDest, const SfxItemSet& rSource, const MapUnit* pSourceUnit = nullptr, const MapUnit* pDestUnit = nullptr );
AsianCompressionFlags GetCharTypeForCompression( sal_Unicode cChar );
Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin );
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 1838a063359e..79ac6acbc61d 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1230,7 +1230,7 @@ EditSelection ImpEditEngine::InsertTextObject( const EditTextObject& rTextObject
else
{
std::unique_ptr<SfxPoolItem> pNew(rX.GetItem()->Clone());
- ConvertItem( *pNew, eSourceUnit, eDestUnit );
+ ConvertItem( pNew, eSourceUnit, eDestUnit );
pAttr = MakeCharAttrib( aEditDoc.GetItemPool(), *pNew, rX.GetStart()+nStartPos, rX.GetEnd()+nStartPos );
}
DBG_ASSERT( pAttr->GetEnd() <= aPaM.GetNode()->Len(), "InsertBinTextObject: Attribute does not fit! (1)" );
diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx
index 04c844e99bdd..97c6f76457db 100644
--- a/editeng/source/items/bulitem.cxx
+++ b/editeng/source/items/bulitem.cxx
@@ -26,9 +26,6 @@
#include <tools/debug.hxx>
#include <vcl/dibtools.hxx>
-#define BULITEM_VERSION (sal_uInt16(2))
-
-
SvxBulletItem::SvxBulletItem( sal_uInt16 _nWhich )
: SfxPoolItem(_nWhich)
, aFont(OutputDevice::GetDefaultFont( DefaultFontType::FIXED, LANGUAGE_SYSTEM, GetDefaultFontFlags::NONE ))
@@ -69,12 +66,6 @@ SfxPoolItem* SvxBulletItem::Clone( SfxItemPool * /*pPool*/ ) const
}
-sal_uInt16 SvxBulletItem::GetVersion( sal_uInt16 /*nVersion*/ ) const
-{
- return BULITEM_VERSION;
-}
-
-
void SvxBulletItem::CopyValidProperties( const SvxBulletItem& rCopyFrom )
{
vcl::Font _aFont = GetFont();
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index e384f8503d74..ac78520bdaa8 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -96,58 +96,6 @@ using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::table::BorderLineStyle;
-/*
-SvxBorderLine is not an SfxPoolItem, and has no Store/Create serialization/deserialization methods.
-Since border line information needs to be serialized by the table autoformat code, these file-local
-methods are defined to encapsulate the necessary serialization logic.
-*/
-namespace
-{
- /// Item version for saved border lines. The old version saves the line without style information.
- const int BORDER_LINE_OLD_VERSION = 0;
- /// Item version for saved border lies. The new version includes line style.
- const int BORDER_LINE_WITH_STYLE_VERSION = 1;
-
- /// Store a border line to a stream.
- SvStream& StoreBorderLine(SvStream &stream, const SvxBorderLine &l, sal_uInt16 version)
- {
- WriteColor( stream, l.GetColor() );
- stream.WriteUInt16( l.GetOutWidth() )
- .WriteUInt16( l.GetInWidth() )
- .WriteUInt16( l.GetDistance() );
-
- if (version >= BORDER_LINE_WITH_STYLE_VERSION)
- stream.WriteUInt16( static_cast<sal_uInt16>(l.GetBorderLineStyle()) );
-
- return stream;
- }
-
-
- /// Creates a border line from a stream.
- SvxBorderLine CreateBorderLine(SvStream &stream, sal_uInt16 version)
- {
- sal_uInt16 nOutline, nInline, nDistance;
- sal_uInt16 nStyle = css::table::BorderLineStyle::NONE;
- Color aColor;
- ReadColor( stream, aColor ).ReadUInt16( nOutline ).ReadUInt16( nInline ).ReadUInt16( nDistance );
-
- if (version >= BORDER_LINE_WITH_STYLE_VERSION)
- stream.ReadUInt16( nStyle );
-
- SvxBorderLine border(&aColor);
- border.GuessLinesWidths(static_cast<SvxBorderLineStyle>(nStyle), nOutline, nInline, nDistance);
- return border;
- }
-
-
- /// Retrieves a BORDER_LINE_* version from a BOX_BORDER_* version.
- sal_uInt16 BorderLineVersionFromBoxVersion(sal_uInt16 boxVersion)
- {
- return (boxVersion >= BOX_BORDER_STYLE_VERSION)? BORDER_LINE_WITH_STYLE_VERSION : BORDER_LINE_OLD_VERSION;
- }
-}
-
-
SfxPoolItem* SvxPaperBinItem::CreateDefault() { return new SvxPaperBinItem(0);}
SfxPoolItem* SvxSizeItem::CreateDefault() { return new SvxSizeItem(0);}
SfxPoolItem* SvxLRSpaceItem::CreateDefault() { return new SvxLRSpaceItem(0);}
@@ -647,14 +595,6 @@ bool SvxLRSpaceItem::GetPresentation
}
-sal_uInt16 SvxLRSpaceItem::GetVersion( sal_uInt16 nFileVersion ) const
-{
- return (nFileVersion == SOFFICE_FILEFORMAT_31)
- ? LRSPACE_TXTLEFT_VERSION
- : LRSPACE_NEGATIVE_VERSION;
-}
-
-
void SvxLRSpaceItem::ScaleMetrics( long nMult, long nDiv )
{
nFirstLineOfst = static_cast<short>(Scale( nFirstLineOfst, nMult, nDiv ));
@@ -883,12 +823,6 @@ bool SvxULSpaceItem::GetPresentation
}
-sal_uInt16 SvxULSpaceItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return ULSPACE_16_VERSION;
-}
-
-
void SvxULSpaceItem::ScaleMetrics( long nMult, long nDiv )
{
nUpper = static_cast<sal_uInt16>(Scale( nUpper, nMult, nDiv ));
@@ -1274,18 +1208,6 @@ bool SvxShadowItem::GetPresentation
}
-SvStream& SvxShadowItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteSChar( static_cast<sal_uInt8>(GetLocation()) )
- .WriteUInt16( GetWidth() )
- .WriteBool( aShadowColor.GetTransparency() > 0 );
- WriteColor( rStrm, GetColor() );
- WriteColor( rStrm, GetColor() );
- rStrm.WriteSChar( aShadowColor.GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID
- return rStrm;
-}
-
-
void SvxShadowItem::ScaleMetrics( long nMult, long nDiv )
{
nWidth = static_cast<sal_uInt16>(Scale( nWidth, nMult, nDiv ));
@@ -1298,23 +1220,6 @@ bool SvxShadowItem::HasMetrics() const
}
-SfxPoolItem* SvxShadowItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 cLoc;
- sal_uInt16 _nWidth;
- bool bTrans;
- Color aColor;
- Color aFillColor;
- sal_Int8 nStyle;
- rStrm.ReadSChar( cLoc ).ReadUInt16( _nWidth )
- .ReadCharAsBool( bTrans );
- ReadColor( rStrm, aColor );
- ReadColor( rStrm, aFillColor ).ReadSChar( nStyle );
- aColor.SetTransparency(bTrans ? 0xff : 0);
- return new SvxShadowItem( Which(), &aColor, _nWidth, static_cast<SvxShadowLocation>(cLoc) );
-}
-
-
sal_uInt16 SvxShadowItem::GetValueCount() const
{
return sal_uInt16(SvxShadowLocation::End); // SvxShadowLocation::BottomRight + 1
@@ -1376,21 +1281,6 @@ SvxBoxItem::~SvxBoxItem()
}
-SvxBoxItem& SvxBoxItem::operator=( const SvxBoxItem& rBox )
-{
- nTopDist = rBox.nTopDist;
- nBottomDist = rBox.nBottomDist;
- nLeftDist = rBox.nLeftDist;
- nRightDist = rBox.nRightDist;
- bRemoveAdjCellBorder = rBox.bRemoveAdjCellBorder;
- SetLine( rBox.GetTop(), SvxBoxItemLine::TOP );
- SetLine( rBox.GetBottom(), SvxBoxItemLine::BOTTOM );
- SetLine( rBox.GetLeft(), SvxBoxItemLine::LEFT );
- SetLine( rBox.GetRight(), SvxBoxItemLine::RIGHT );
- return *this;
-}
-
-
static bool CmpBrdLn( const std::unique_ptr<SvxBorderLine> & pBrd1, const SvxBorderLine* pBrd2 )
{
if( pBrd1.get() == pBrd2 )
@@ -1946,58 +1836,6 @@ bool SvxBoxItem::GetPresentation
}
-SvStream& SvxBoxItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm.WriteUInt16( GetSmallestDistance() );
- const SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom
- pLine[ 0 ] = GetTop();
- pLine[ 1 ] = GetLeft();
- pLine[ 2 ] = GetRight();
- pLine[ 3 ] = GetBottom();
-
- for( int i = 0; i < 4; i++ )
- {
- const SvxBorderLine* l = pLine[ i ];
- if( l )
- {
- rStrm.WriteSChar(i);
- StoreBorderLine(rStrm, *l, BorderLineVersionFromBoxVersion(nItemVersion));
- }
- }
- sal_Int8 cLine = 4;
- if( nItemVersion >= BOX_4DISTS_VERSION &&
- !(nTopDist == nLeftDist &&
- nTopDist == nRightDist &&
- nTopDist == nBottomDist) )
- {
- cLine |= 0x10;
- }
-
- rStrm.WriteSChar( cLine );
-
- if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 )
- {
- rStrm.WriteUInt16( nTopDist )
- .WriteUInt16( nLeftDist )
- .WriteUInt16( nRightDist )
- .WriteUInt16( nBottomDist );
- }
-
- return rStrm;
-}
-
-
-sal_uInt16 SvxBoxItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxBoxItem: Is there a new file format?" );
- return SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ? 0 : BOX_BORDER_STYLE_VERSION;
-}
-
-
void SvxBoxItem::ScaleMetrics( long nMult, long nDiv )
{
if ( pTop ) pTop->ScaleMetrics( nMult, nDiv );
@@ -2017,45 +1855,6 @@ bool SvxBoxItem::HasMetrics() const
}
-SfxPoolItem* SvxBoxItem::Create( SvStream& rStrm, sal_uInt16 nIVersion ) const
-{
- sal_uInt16 nDistance;
- rStrm.ReadUInt16( nDistance );
- SvxBoxItem* pAttr = new SvxBoxItem( Which() );
-
- SvxBoxItemLine aLineMap[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
- SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM };
-
- sal_Int8 cLine(0);
- while (rStrm.good())
- {
- rStrm.ReadSChar( cLine );
-
- if( cLine > 3 )
- break;
-
- SvxBorderLine aBorder = CreateBorderLine(rStrm, BorderLineVersionFromBoxVersion(nIVersion));
- pAttr->SetLine( &aBorder, aLineMap[cLine] );
- }
-
- if( nIVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 )
- {
- for(SvxBoxItemLine & i : aLineMap)
- {
- sal_uInt16 nDist;
- rStrm.ReadUInt16( nDist );
- pAttr->SetDistance( nDist, i );
- }
- }
- else
- {
- pAttr->SetAllDistances(nDistance);
- }
-
- return pAttr;
-}
-
-
const SvxBorderLine *SvxBoxItem::GetLine( SvxBoxItemLine nLine ) const
{
const SvxBorderLine *pRet = nullptr;
@@ -2269,22 +2068,6 @@ SvxBoxInfoItem::~SvxBoxInfoItem()
{
}
-SvxBoxInfoItem &SvxBoxInfoItem::operator=( const SvxBoxInfoItem& rCpy )
-{
- if (this != &rCpy)
- {
- pHori.reset( rCpy.GetHori() ? new SvxBorderLine( *rCpy.GetHori() ) : nullptr );
- pVert.reset( rCpy.GetVert() ? new SvxBorderLine( *rCpy.GetVert() ) : nullptr );
- mbEnableHor = rCpy.mbEnableHor;
- mbEnableVer = rCpy.mbEnableVer;
- bDist = rCpy.IsDist();
- bMinDist = rCpy.IsMinDist();
- nValidFlags = rCpy.nValidFlags;
- nDefDist = rCpy.GetDefDist();
- }
- return *this;
-}
-
bool SvxBoxInfoItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
@@ -2802,36 +2585,6 @@ SfxPoolItem* SvxFormatBreakItem::Clone( SfxItemPool* ) const
}
-SvStream& SvxFormatBreakItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm.WriteSChar( GetEnumValue() );
- if( FMTBREAK_NOAUTO > nItemVersion )
- rStrm.WriteSChar( 0x01 );
- return rStrm;
-}
-
-
-sal_uInt16 SvxFormatBreakItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxFormatBreakItem: Is there a new file format? ");
- return SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ? 0 : FMTBREAK_NOAUTO;
-}
-
-
-SfxPoolItem* SvxFormatBreakItem::Create( SvStream& rStrm, sal_uInt16 nVersion ) const
-{
- sal_Int8 eBreak, bDummy;
- rStrm.ReadSChar( eBreak );
- if( FMTBREAK_NOAUTO > nVersion )
- rStrm.ReadSChar( bDummy );
- return new SvxFormatBreakItem( static_cast<SvxBreak>(eBreak), Which() );
-}
-
-
sal_uInt16 SvxFormatBreakItem::GetValueCount() const
{
return sal_uInt16(SvxBreak::End); // SvxBreak::PageBoth + 1
@@ -2844,21 +2597,6 @@ SfxPoolItem* SvxFormatKeepItem::Clone( SfxItemPool* ) const
}
-SvStream& SvxFormatKeepItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteSChar( static_cast<sal_Int8>(GetValue()) );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxFormatKeepItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- sal_Int8 bIsKeep;
- rStrm.ReadSChar( bIsKeep );
- return new SvxFormatKeepItem( bIsKeep != 0, Which() );
-}
-
-
bool SvxFormatKeepItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -2894,14 +2632,6 @@ SvxLineItem::~SvxLineItem()
}
-SvxLineItem& SvxLineItem::operator=( const SvxLineItem& rLine )
-{
- SetLine( rLine.GetLine() );
-
- return *this;
-}
-
-
bool SvxLineItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
@@ -3001,24 +2731,6 @@ bool SvxLineItem::GetPresentation
}
-SvStream& SvxLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- if( pLine )
- {
- WriteColor( rStrm, pLine->GetColor() );
- rStrm.WriteInt16( pLine->GetOutWidth() )
- .WriteInt16( pLine->GetInWidth() )
- .WriteInt16( pLine->GetDistance() );
- }
- else
- {
- WriteColor( rStrm, Color() );
- rStrm.WriteInt16( 0 ).WriteInt16( 0 ).WriteInt16( 0 );
- }
- return rStrm;
-}
-
-
void SvxLineItem::ScaleMetrics( long nMult, long nDiv )
{
if ( pLine ) pLine->ScaleMetrics( nMult, nDiv );
@@ -3031,31 +2743,11 @@ bool SvxLineItem::HasMetrics() const
}
-SfxPoolItem* SvxLineItem::Create( SvStream& rStrm, sal_uInt16 ) const
-{
- SvxLineItem* _pLine = new SvxLineItem( Which() );
- short nOutline, nInline, nDistance;
- Color aColor;
-
- ReadColor( rStrm, aColor ).ReadInt16( nOutline ).ReadInt16( nInline ).ReadInt16( nDistance );
- if( nOutline )
- {
- SvxBorderLine aLine( &aColor );
- aLine.GuessLinesWidths(SvxBorderLineStyle::NONE, nOutline, nInline, nDistance);
- _pLine->SetLine( &aLine );
- }
- return _pLine;
-}
-
void SvxLineItem::SetLine( const SvxBorderLine* pNew )
{
pLine.reset( pNew ? new SvxBorderLine( *pNew ) : nullptr );
}
-#define LOAD_GRAPHIC (sal_uInt16(0x0001))
-#define LOAD_LINK (sal_uInt16(0x0002))
-#define LOAD_FILTER (sal_uInt16(0x0004))
-
SvxBrushItem::SvxBrushItem(sal_uInt16 _nWhich)
: SfxPoolItem(_nWhich)
, aColor(COL_TRANSPARENT)
@@ -3114,115 +2806,6 @@ SvxBrushItem::SvxBrushItem(const OUString& rLink, const OUString& rFilter,
DBG_ASSERT( GPOS_NONE != ePos, "SvxBrushItem-Ctor with GPOS_NONE == ePos" );
}
-SvxBrushItem::SvxBrushItem(SvStream& rStream, sal_uInt16 nVersion, sal_uInt16 _nWhich)
- : SfxPoolItem(_nWhich)
- , aColor(COL_TRANSPARENT)
- , nShadingValue(ShadingPattern::CLEAR)
- , nGraphicTransparency(0)
- , eGraphicPos(GPOS_NONE)
- , bLoadAgain(false)
-{
- bool bTrans;
- Color aTempColor;
- Color aTempFillColor;
- sal_Int8 nStyle;
-
- rStream.ReadCharAsBool( bTrans );
- ReadColor( rStream, aTempColor );
- ReadColor( rStream, aTempFillColor );
- rStream.ReadSChar( nStyle );
-
- switch ( nStyle )
- {
- case 8: // BRUSH_25:
- {
- sal_uInt32 nRed = aTempColor.GetRed();
- sal_uInt32 nGreen = aTempColor.GetGreen();
- sal_uInt32 nBlue = aTempColor.GetBlue();
- nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed())*2;
- nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen())*2;
- nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue())*2;
- aColor = Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) );
- }
- break;
-
- case 9: // BRUSH_50:
- {
- sal_uInt32 nRed = aTempColor.GetRed();
- sal_uInt32 nGreen = aTempColor.GetGreen();
- sal_uInt32 nBlue = aTempColor.GetBlue();
- nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed());
- nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen());
- nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue());
- aColor = Color( static_cast<sal_Int8>(nRed/2), static_cast<sal_Int8>(nGreen/2), static_cast<sal_Int8>(nBlue/2) );
- }
- break;
-
- case 10: // BRUSH_75:
- {
- sal_uInt32 nRed = aTempColor.GetRed()*2;
- sal_uInt32 nGreen = aTempColor.GetGreen()*2;
- sal_uInt32 nBlue = aTempColor.GetBlue()*2;
- nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed());
- nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen());
- nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue());
- aColor = Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) );
- }
- break;
-
- case 0: // BRUSH_NULL:
- aColor = COL_TRANSPARENT;
- break;
-
- default:
- aColor = aTempColor;
- }
-
- if ( nVersion >= BRUSH_GRAPHIC_VERSION )
- {
- sal_uInt16 nDoLoad = 0;
- sal_Int8 nPos;
-
- rStream.ReadUInt16( nDoLoad );
-
- if ( nDoLoad & LOAD_GRAPHIC )
- {
- Graphic aGraphic;
-
- ReadGraphic( rStream, aGraphic );
- xGraphicObject.reset(new GraphicObject(aGraphic));
-
- if( SVSTREAM_FILEFORMAT_ERROR == rStream.GetError() )
- {
- rStream.ResetError();
- rStream.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() );
- }
- }
-
- if ( nDoLoad & LOAD_LINK )
- {
- // UNICODE: rStream >> aRel;
- OUString aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
-
- // TODO/MBA: how can we get a BaseURL here?!
- OSL_FAIL("No BaseURL!");
- OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
- DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
- maStrLink = aAbs;
- }
-
- if ( nDoLoad & LOAD_FILTER )
- {
- // UNICODE: rStream >> maStrFilter;
- maStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
- }
-
- rStream.ReadSChar( nPos );
-
- eGraphicPos = static_cast<SvxGraphicPosition>(nPos);
- }
-}
-
SvxBrushItem::SvxBrushItem(const SvxBrushItem& rItem)
: SfxPoolItem(rItem)
, aColor(rItem.aColor)
@@ -3269,11 +2852,6 @@ bool SvxBrushItem::isUsed() const
return false;
}
-sal_uInt16 SvxBrushItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return BRUSH_GRAPHIC_VERSION;
-}
-
static sal_Int8 lcl_PercentToTransparency(long nPercent)
{
@@ -3498,35 +3076,6 @@ bool SvxBrushItem::GetPresentation
return true;
}
-SvxBrushItem& SvxBrushItem::operator=(const SvxBrushItem& rItem)
-{
- if (&rItem != this)
- {
- aColor = rItem.aColor;
- nShadingValue = rItem.nShadingValue;
- xGraphicObject.reset(rItem.xGraphicObject ? new GraphicObject(*rItem.xGraphicObject) : nullptr);
- nGraphicTransparency = rItem.nGraphicTransparency;
- maStrLink = rItem.maStrLink;
- maStrFilter = rItem.maStrFilter;
- eGraphicPos = rItem.eGraphicPos;
- bLoadAgain = rItem.bLoadAgain;
- }
- return *this;
-}
-
-SvxBrushItem& SvxBrushItem::operator=(SvxBrushItem&& rItem)
-{
- aColor = std::move(rItem.aColor);
- nShadingValue = std::move(rItem.nShadingValue);
- xGraphicObject = std::move(rItem.xGraphicObject);
- nGraphicTransparency = std::move(rItem.nGraphicTransparency);
- maStrLink = std::move(rItem.maStrLink);
- maStrFilter = std::move(rItem.maStrFilter);
- eGraphicPos = std::move(rItem.eGraphicPos);
- bLoadAgain = std::move(rItem.bLoadAgain);
- return *this;
-}
-
bool SvxBrushItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
@@ -3572,48 +3121,6 @@ SfxPoolItem* SvxBrushItem::Clone( SfxItemPool* ) const
}
-SfxPoolItem* SvxBrushItem::Create( SvStream& rStream, sal_uInt16 nVersion ) const
-{
- return new SvxBrushItem( rStream, nVersion, Which() );
-}
-
-
-SvStream& SvxBrushItem::Store( SvStream& rStream , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStream.WriteBool( false );
- WriteColor( rStream, aColor );
- WriteColor( rStream, aColor );
- rStream.WriteSChar( aColor.GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID
-
- sal_uInt16 nDoLoad = 0;
-
- if (xGraphicObject && maStrLink.isEmpty())
- nDoLoad |= LOAD_GRAPHIC;
- if ( !maStrLink.isEmpty() )
- nDoLoad |= LOAD_LINK;
- if ( !maStrFilter.isEmpty() )
- nDoLoad |= LOAD_FILTER;
- rStream.WriteUInt16( nDoLoad );
-
- if (xGraphicObject && maStrLink.isEmpty())
- WriteGraphic(rStream, xGraphicObject->GetGraphic());
- if ( !maStrLink.isEmpty() )
- {
- OSL_FAIL("No BaseURL!");
- // TODO/MBA: how to get a BaseURL?!
- OUString aRel = INetURLObject::GetRelURL( "", maStrLink );
- // UNICODE: rStream << aRel;
- rStream.WriteUniOrByteString(aRel, rStream.GetStreamCharSet());
- }
- if ( !maStrFilter.isEmpty() )
- {
- // UNICODE: rStream << maStrFilter;
- rStream.WriteUniOrByteString(maStrFilter, rStream.GetStreamCharSet());
- }
- rStream.WriteSChar( eGraphicPos );
- return rStream;
-}
-
const GraphicObject* SvxBrushItem::GetGraphicObject(OUString const & referer) const
{
if (bLoadAgain && !maStrLink.isEmpty() && !xGraphicObject)
@@ -3812,18 +3319,6 @@ SfxPoolItem* SvxFrameDirectionItem::Clone( SfxItemPool * ) const
}
-SfxPoolItem* SvxFrameDirectionItem::Create( SvStream & rStrm, sal_uInt16 /*nVer*/ ) const
-{
- sal_uInt16 nValue;
- rStrm.ReadUInt16( nValue );
- return new SvxFrameDirectionItem( static_cast<SvxFrameDirection>(nValue), Which() );
-}
-
-sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFVer ? USHRT_MAX : 0;
-}
-
const char* getFrmDirResId(size_t nIndex)
{
const char* const RID_SVXITEMS_FRMDIR[] =
diff --git a/editeng/source/items/justifyitem.cxx b/editeng/source/items/justifyitem.cxx
index d010f72d58b1..1b9701356bdc 100644
--- a/editeng/source/items/justifyitem.cxx
+++ b/editeng/source/items/justifyitem.cxx
@@ -171,15 +171,6 @@ SfxPoolItem* SvxHorJustifyItem::Clone( SfxItemPool* ) const
return new SvxHorJustifyItem( *this );
}
-
-SfxPoolItem* SvxHorJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const
-{
- sal_uInt16 nVal;
- rStream.ReadUInt16( nVal );
- return new SvxHorJustifyItem( static_cast<SvxCellHorJustify>(nVal), Which() );
-}
-
-
sal_uInt16 SvxHorJustifyItem::GetValueCount() const
{
return sal_uInt16(SvxCellHorJustify::Repeat) + 1; // Last Enum value + 1
@@ -308,14 +299,6 @@ SfxPoolItem* SvxVerJustifyItem::Clone( SfxItemPool* ) const
}
-SfxPoolItem* SvxVerJustifyItem::Create( SvStream& rStream, sal_uInt16 ) const
-{
- sal_uInt16 nVal;
- rStream.ReadUInt16( nVal );
- return new SvxVerJustifyItem( static_cast<SvxCellVerJustify>(nVal), Which() );
-}
-
-
sal_uInt16 SvxVerJustifyItem::GetValueCount() const
{
return static_cast<sal_uInt16>(SvxCellVerJustify::Bottom) + 1; // Last Enum value + 1
diff --git a/editeng/source/items/legacyitem.cxx b/editeng/source/items/legacyitem.cxx
new file mode 100755
index 000000000000..9a4acfafcead
--- /dev/null
+++ b/editeng/source/items/legacyitem.cxx
@@ -0,0 +1,807 @@
+/* -*- 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 <editeng/legacyitem.hxx>
+#include <unotools/fontdefs.hxx>
+#include <tools/tenccvt.hxx>
+#include <tools/stream.hxx>
+#include <comphelper/fileformat.h>
+#include <vcl/graph.hxx>
+#include <vcl/GraphicObject.hxx>
+#include <osl/diagnose.h>
+#include <tools/urlobj.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/colritem.hxx>
+#include <editeng/boxitem.hxx>
+#include <editeng/borderline.hxx>
+#include <editeng/lineitem.hxx>
+#include <editeng/brushitem.hxx>
+#include <editeng/editerr.hxx>
+#include <editeng/adjustitem.hxx>
+#include <editeng/justifyitem.hxx>
+#include <editeng/frmdiritem.hxx>
+#include <editeng/formatbreakitem.hxx>
+#include <editeng/keepitem.hxx>
+#include <editeng/shaditem.hxx>
+
+void Create_legacy_direct_set(SvxFontHeightItem& rItem, sal_uInt32 nH, sal_uInt16 nP, MapUnit eP)
+{
+ rItem.legacy_direct_set(nH, nP, eP);
+}
+
+namespace legacy
+{
+ namespace SvxFont
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxFontItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding;
+ OUString aName, aStyle;
+ rStrm.ReadUChar( _eFamily );
+ rStrm.ReadUChar( eFontPitch );
+ rStrm.ReadUChar( eFontTextEncoding );
+
+ // UNICODE: rStrm >> aName;
+ aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
+
+ // UNICODE: rStrm >> aStyle;
+ aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
+
+ // Set the "correct" textencoding
+ eFontTextEncoding = static_cast<sal_uInt8>(GetSOLoadTextEncoding( eFontTextEncoding ));
+
+ // at some point, the StarBats changes from ANSI font to SYMBOL font
+ if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName == "StarBats" )
+ eFontTextEncoding = RTL_TEXTENCODING_SYMBOL;
+
+ // Check if we have stored unicode
+ sal_uInt64 const nStreamPos = rStrm.Tell();
+ // #define STORE_UNICODE_MAGIC_MARKER 0xFE331188
+ sal_uInt32 nMagic = 0xFE331188;
+ rStrm.ReadUInt32( nMagic );
+ if ( nMagic == 0xFE331188 )
+ {
+ aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
+ aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
+ }
+ else
+ {
+ rStrm.Seek( nStreamPos );
+ }
+
+ rItem.SetFamilyName(aName);
+ rItem.SetStyleName(aStyle);
+ rItem.SetFamily(static_cast<FontFamily>(_eFamily));
+ rItem.SetPitch(static_cast<FontPitch>(eFontPitch));
+ rItem.SetCharSet(static_cast<rtl_TextEncoding>(eFontTextEncoding));
+ }
+
+ SvStream& Store(const SvxFontItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ const bool bToBats(IsStarSymbol(rItem.GetFamilyName()));
+
+ rStrm.WriteUChar(rItem.GetFamily()).WriteUChar(rItem.GetPitch()).WriteUChar(bToBats ?
+ RTL_TEXTENCODING_SYMBOL :
+ GetSOStoreTextEncoding(rItem.GetCharSet()));
+
+ const OUString aStoreFamilyName(bToBats ? "StarBats" : rItem.GetFamilyName());
+
+ rStrm.WriteUniOrByteString(aStoreFamilyName, rStrm.GetStreamCharSet());
+ rStrm.WriteUniOrByteString(rItem.GetStyleName(), rStrm.GetStreamCharSet());
+
+ return rStrm;
+ }
+ }
+
+ namespace SvxFontHeight
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ return (nFileFormatVersion <= SOFFICE_FILEFORMAT_40)
+ ? FONTHEIGHT_16_VERSION
+ : FONTHEIGHT_UNIT_VERSION;
+ }
+
+ void Create(SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ sal_uInt16 nsize, nprop = 0;
+ MapUnit nPropUnit = MapUnit::MapRelative;
+
+ rStrm.ReadUInt16( nsize );
+
+ if( FONTHEIGHT_16_VERSION <= nItemVersion )
+ rStrm.ReadUInt16( nprop );
+ else
+ {
+ sal_uInt8 nP;
+ rStrm .ReadUChar( nP );
+ nprop = static_cast<sal_uInt16>(nP);
+ }
+
+ if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
+ {
+ sal_uInt16 nTmp;
+ rStrm.ReadUInt16( nTmp );
+ nPropUnit = static_cast<MapUnit>(nTmp);
+ }
+
+ Create_legacy_direct_set(rItem, nsize, nprop, nPropUnit);
+ }
+
+ SvStream& Store(const SvxFontHeightItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ rStrm.WriteUInt16( rItem.GetHeight() );
+
+ if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
+ rStrm.WriteUInt16( rItem.GetProp() ).WriteUInt16( static_cast<sal_uInt16>(rItem.GetPropUnit()) );
+ else
+ {
+ // When exporting to the old versions the relative information is lost
+ // when there is no percentage
+ sal_uInt16 _nProp = rItem.GetProp();
+ if( MapUnit::MapRelative != rItem.GetPropUnit() )
+ _nProp = 100;
+ rStrm.WriteUInt16( _nProp );
+ }
+ return rStrm;
+ }
+ }
+
+ namespace SvxWeight
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt8 nWeight(0);
+ rStrm.ReadUChar(nWeight);
+ rItem.SetValue(static_cast<FontWeight>(nWeight));
+ }
+
+ SvStream& Store(const SvxWeightItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUChar(rItem.GetValue());
+ return rStrm;
+ }
+ }
+
+ namespace SvxPosture
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt8 nPosture(0);
+ rStrm.ReadUChar(nPosture);
+ rItem.SetValue(static_cast<FontItalic>(nPosture));
+ }
+
+ SvStream& Store(const SvxPostureItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUChar( rItem.GetValue() );
+ return rStrm;
+ }
+ }
+
+ namespace SvxTextLine // SvxUnderlineItem, SvxOverlineItem -> SvxTextLineItem
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt8 nState(0);
+ rStrm.ReadUChar(nState);
+ rItem.SetValue(static_cast<FontLineStyle>(nState));
+ // GetColor() is *not* saved/loaded ?!?
+ }
+
+ SvStream& Store(const SvxTextLineItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUChar(rItem.GetValue());
+ // GetColor() is *not* saved/loaded ?!?
+ return rStrm;
+ }
+ }
+
+ namespace SvxCrossedOut
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt8 eCross(0);
+ rStrm.ReadUChar(eCross);
+ rItem.SetValue(static_cast<FontStrikeout>(eCross));
+ }
+
+ SvStream& Store(const SvxCrossedOutItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUChar(rItem.GetValue());
+ return rStrm;
+ }
+ }
+
+ namespace SvxColor
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_40==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_50==nFileFormatVersion,
+ "SvxColorItem: Is there a new file format? ");
+ return SOFFICE_FILEFORMAT_50 >= nFileFormatVersion ? VERSION_USEAUTOCOLOR : 0;
+ }
+
+ void Create(SvxColorItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ Color aColor(COL_AUTO);
+ ReadColor(rStrm, aColor);
+ rItem.SetValue(aColor);
+ }
+
+ SvStream& Store(const SvxColorItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ if( VERSION_USEAUTOCOLOR == nItemVersion && COL_AUTO == rItem.GetValue() )
+ WriteColor( rStrm, COL_BLACK );
+ else
+ WriteColor( rStrm, rItem.GetValue() );
+ return rStrm;
+ }
+ }
+
+ namespace SvxBox
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_40==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_50==nFileFormatVersion,
+ "SvxBoxItem: Is there a new file format?" );
+ return SOFFICE_FILEFORMAT_31==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_40==nFileFormatVersion ? 0 : BOX_BORDER_STYLE_VERSION;
+ }
+
+ /// Item version for saved border lines. The old version saves the line without style information.
+ const int BORDER_LINE_OLD_VERSION = 0;
+ /// Item version for saved border lies. The new version includes line style.
+ const int BORDER_LINE_WITH_STYLE_VERSION = 1;
+
+ /// Creates a border line from a stream.
+ static ::editeng::SvxBorderLine CreateBorderLine(SvStream &stream, sal_uInt16 version)
+ {
+ sal_uInt16 nOutline, nInline, nDistance;
+ sal_uInt16 nStyle = css::table::BorderLineStyle::NONE;
+ Color aColor;
+ ReadColor( stream, aColor ).ReadUInt16( nOutline ).ReadUInt16( nInline ).ReadUInt16( nDistance );
+
+ if (version >= BORDER_LINE_WITH_STYLE_VERSION)
+ stream.ReadUInt16( nStyle );
+
+ ::editeng::SvxBorderLine border(&aColor);
+ border.GuessLinesWidths(static_cast<SvxBorderLineStyle>(nStyle), nOutline, nInline, nDistance);
+ return border;
+ }
+
+ /// Retrieves a BORDER_LINE_* version from a BOX_BORDER_* version.
+ static sal_uInt16 BorderLineVersionFromBoxVersion(sal_uInt16 boxVersion)
+ {
+ return (boxVersion >= BOX_BORDER_STYLE_VERSION)? BORDER_LINE_WITH_STYLE_VERSION : BORDER_LINE_OLD_VERSION;
+ }
+
+ void Create(SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ sal_uInt16 nDistance(0);
+ rStrm.ReadUInt16( nDistance );
+ SvxBoxItemLine aLineMap[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::LEFT,
+ SvxBoxItemLine::RIGHT, SvxBoxItemLine::BOTTOM };
+ sal_Int8 cLine(0);
+
+ while (rStrm.good())
+ {
+ rStrm.ReadSChar( cLine );
+
+ if( cLine > 3 )
+ break;
+
+ ::editeng::SvxBorderLine aBorder = CreateBorderLine(rStrm, BorderLineVersionFromBoxVersion(nItemVersion));
+ rItem.SetLine( &aBorder, aLineMap[cLine] );
+ }
+
+ if( nItemVersion >= BOX_4DISTS_VERSION && (cLine&0x10) != 0 )
+ {
+ for(SvxBoxItemLine & i : aLineMap)
+ {
+ sal_uInt16 nDist;
+ rStrm.ReadUInt16( nDist );
+ rItem.SetDistance( nDist, i );
+ }
+ }
+ else
+ {
+ rItem.SetAllDistances(nDistance);
+ }
+ }
+
+ /// Store a border line to a stream.
+ static SvStream& StoreBorderLine(SvStream &stream, const ::editeng::SvxBorderLine &l, sal_uInt16 version)
+ {
+ WriteColor( stream, l.GetColor() );
+ stream.WriteUInt16( l.GetOutWidth() )
+ .WriteUInt16( l.GetInWidth() )
+ .WriteUInt16( l.GetDistance() );
+
+ if (version >= BORDER_LINE_WITH_STYLE_VERSION)
+ stream.WriteUInt16( static_cast<sal_uInt16>(l.GetBorderLineStyle()) );
+
+ return stream;
+ }
+
+ SvStream& Store(const SvxBoxItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ rStrm.WriteUInt16( rItem.GetSmallestDistance() );
+ const ::editeng::SvxBorderLine* pLine[ 4 ]; // top, left, right, bottom
+ pLine[ 0 ] = rItem.GetTop();
+ pLine[ 1 ] = rItem.GetLeft();
+ pLine[ 2 ] = rItem.GetRight();
+ pLine[ 3 ] = rItem.GetBottom();
+
+ for( int i = 0; i < 4; i++ )
+ {
+ const ::editeng::SvxBorderLine* l = pLine[ i ];
+ if( l )
+ {
+ rStrm.WriteSChar(i);
+ StoreBorderLine(rStrm, *l, BorderLineVersionFromBoxVersion(nItemVersion));
+ }
+ }
+ sal_Int8 cLine = 4;
+ const sal_uInt16 nTopDist(rItem.GetDistance(SvxBoxItemLine::TOP));
+ const sal_uInt16 nLeftDist(rItem.GetDistance(SvxBoxItemLine::LEFT));
+ const sal_uInt16 nRightDist(rItem.GetDistance(SvxBoxItemLine::RIGHT));
+ const sal_uInt16 nBottomDist(rItem.GetDistance(SvxBoxItemLine::BOTTOM));
+
+ if( nItemVersion >= BOX_4DISTS_VERSION &&
+ !(nTopDist == nLeftDist &&
+ nTopDist == nRightDist &&
+ nTopDist == nBottomDist) )
+ {
+ cLine |= 0x10;
+ }
+
+ rStrm.WriteSChar( cLine );
+
+ if( nItemVersion >= BOX_4DISTS_VERSION && (cLine & 0x10) != 0 )
+ {
+ rStrm.WriteUInt16( nTopDist )
+ .WriteUInt16( nLeftDist )
+ .WriteUInt16( nRightDist )
+ .WriteUInt16( nBottomDist );
+ }
+
+ return rStrm;
+ }
+ }
+
+ namespace SvxLine
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxLineItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ short nOutline, nInline, nDistance;
+ Color aColor;
+
+ ReadColor( rStrm, aColor ).ReadInt16( nOutline ).ReadInt16( nInline ).ReadInt16( nDistance );
+ if( nOutline )
+ {
+ ::editeng::SvxBorderLine aLine( &aColor );
+ aLine.GuessLinesWidths(SvxBorderLineStyle::NONE, nOutline, nInline, nDistance);
+ rItem.SetLine( &aLine );
+ }
+ }
+
+ SvStream& Store(const SvxLineItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ const ::editeng::SvxBorderLine* pLine(rItem.GetLine());
+
+ if(nullptr != pLine)
+ {
+ WriteColor( rStrm, pLine->GetColor() );
+ rStrm.WriteInt16( pLine->GetOutWidth() )
+ .WriteInt16( pLine->GetInWidth() )
+ .WriteInt16( pLine->GetDistance() );
+ }
+ else
+ {
+ WriteColor( rStrm, Color() );
+ rStrm.WriteInt16( 0 ).WriteInt16( 0 ).WriteInt16( 0 );
+ }
+
+ return rStrm;
+ }
+ }
+
+ namespace SvxBrush
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return BRUSH_GRAPHIC_VERSION;
+ }
+
+ const sal_uInt16 LOAD_GRAPHIC = (sal_uInt16(0x0001));
+ const sal_uInt16 LOAD_LINK = (sal_uInt16(0x0002));
+ const sal_uInt16 LOAD_FILTER = (sal_uInt16(0x0004));
+
+ void Create(SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ bool bTrans;
+ Color aTempColor;
+ Color aTempFillColor;
+ sal_Int8 nStyle;
+
+ rStrm.ReadCharAsBool( bTrans );
+ ReadColor( rStrm, aTempColor );
+ ReadColor( rStrm, aTempFillColor );
+ rStrm.ReadSChar( nStyle );
+
+ switch ( nStyle )
+ {
+ case 8: // BRUSH_25:
+ {
+ sal_uInt32 nRed = aTempColor.GetRed();
+ sal_uInt32 nGreen = aTempColor.GetGreen();
+ sal_uInt32 nBlue = aTempColor.GetBlue();
+ nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed())*2;
+ nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen())*2;
+ nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue())*2;
+ rItem.SetColor(Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) ));
+ }
+ break;
+
+ case 9: // BRUSH_50:
+ {
+ sal_uInt32 nRed = aTempColor.GetRed();
+ sal_uInt32 nGreen = aTempColor.GetGreen();
+ sal_uInt32 nBlue = aTempColor.GetBlue();
+ nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed());
+ nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen());
+ nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue());
+ rItem.SetColor(Color( static_cast<sal_Int8>(nRed/2), static_cast<sal_Int8>(nGreen/2), static_cast<sal_Int8>(nBlue/2) ));
+ }
+ break;
+
+ case 10: // BRUSH_75:
+ {
+ sal_uInt32 nRed = aTempColor.GetRed()*2;
+ sal_uInt32 nGreen = aTempColor.GetGreen()*2;
+ sal_uInt32 nBlue = aTempColor.GetBlue()*2;
+ nRed += static_cast<sal_uInt32>(aTempFillColor.GetRed());
+ nGreen += static_cast<sal_uInt32>(aTempFillColor.GetGreen());
+ nBlue += static_cast<sal_uInt32>(aTempFillColor.GetBlue());
+ rItem.SetColor(Color( static_cast<sal_Int8>(nRed/3), static_cast<sal_Int8>(nGreen/3), static_cast<sal_Int8>(nBlue/3) ));
+ }
+ break;
+
+ case 0: // BRUSH_NULL:
+ rItem.SetColor(COL_TRANSPARENT);
+ break;
+
+ default:
+ rItem.SetColor(aTempColor);
+ }
+
+ if ( nItemVersion >= BRUSH_GRAPHIC_VERSION )
+ {
+ sal_uInt16 nDoLoad = 0;
+ sal_Int8 nPos;
+
+ rStrm.ReadUInt16( nDoLoad );
+
+ if ( nDoLoad & LOAD_GRAPHIC )
+ {
+ Graphic aGraphic;
+
+ ReadGraphic( rStrm, aGraphic );
+ rItem.SetGraphicObject(GraphicObject(aGraphic));
+
+ if( SVSTREAM_FILEFORMAT_ERROR == rStrm.GetError() )
+ {
+ rStrm.ResetError();
+ rStrm.SetError( ERRCODE_SVX_GRAPHIC_WRONG_FILEFORMAT.MakeWarning() );
+ }
+ }
+
+ if ( nDoLoad & LOAD_LINK )
+ {
+ // UNICODE: rStrm >> aRel;
+ OUString aRel = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
+
+ // TODO/MBA: how can we get a BaseURL here?!
+ OSL_FAIL("No BaseURL!");
+ OUString aAbs = INetURLObject::GetAbsURL( "", aRel );
+ DBG_ASSERT( !aAbs.isEmpty(), "Invalid URL!" );
+ rItem.SetGraphicLink(aAbs);
+ }
+
+ if ( nDoLoad & LOAD_FILTER )
+ {
+ // UNICODE: rStrm >> maStrFilter;
+ rItem.SetGraphicFilter(rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet()));
+ }
+
+ rStrm.ReadSChar( nPos );
+
+ rItem.SetGraphicPos(static_cast<SvxGraphicPosition>(nPos));
+ }
+ }
+
+ SvStream& Store(const SvxBrushItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteBool( false );
+ WriteColor( rStrm, rItem.GetColor() );
+ WriteColor( rStrm, rItem.GetColor() );
+ rStrm.WriteSChar( rItem.GetColor().GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID
+
+ sal_uInt16 nDoLoad = 0;
+ const GraphicObject* pGraphicObject(rItem.GetGraphicObject());
+
+ if (nullptr != pGraphicObject && rItem.GetGraphicLink().isEmpty())
+ nDoLoad |= LOAD_GRAPHIC;
+ if ( !rItem.GetGraphicLink().isEmpty() )
+ nDoLoad |= LOAD_LINK;
+ if ( !rItem.GetGraphicFilter().isEmpty() )
+ nDoLoad |= LOAD_FILTER;
+ rStrm.WriteUInt16( nDoLoad );
+
+ if (nullptr != pGraphicObject && rItem.GetGraphicLink().isEmpty())
+ WriteGraphic(rStrm, pGraphicObject->GetGraphic());
+ if ( !rItem.GetGraphicLink().isEmpty() )
+ {
+ OSL_FAIL("No BaseURL!");
+ // TODO/MBA: how to get a BaseURL?!
+ OUString aRel = INetURLObject::GetRelURL( "", rItem.GetGraphicLink() );
+ // UNICODE: rStrm << aRel;
+ rStrm.WriteUniOrByteString(aRel, rStrm.GetStreamCharSet());
+ }
+ if ( !rItem.GetGraphicFilter().isEmpty() )
+ {
+ // UNICODE: rStrm << rItem.GetGraphicFilter();
+ rStrm.WriteUniOrByteString(rItem.GetGraphicFilter(), rStrm.GetStreamCharSet());
+ }
+ rStrm.WriteSChar( rItem.GetGraphicPos() );
+ return rStrm;
+ }
+ }
+
+ namespace SvxAdjust
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ return (nFileFormatVersion == SOFFICE_FILEFORMAT_31)
+ ? 0 : ADJUST_LASTBLOCK_VERSION;
+ }
+
+ void Create(SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ char eAdjustment;
+ rStrm.ReadChar(eAdjustment);
+ rItem.SetAdjust(static_cast<::SvxAdjust>(eAdjustment));
+
+ if( nItemVersion >= ADJUST_LASTBLOCK_VERSION )
+ {
+ sal_Int8 nFlags;
+ rStrm.ReadSChar( nFlags );
+ rItem.SetAsFlags(nFlags);
+ }
+ }
+
+ SvStream& Store(const SvxAdjustItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ rStrm.WriteChar( static_cast<char>(rItem.GetAdjust()) );
+ if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION )
+ {
+ const sal_Int8 nFlags(rItem.GetAsFlags());
+ rStrm.WriteSChar( nFlags );
+ }
+ return rStrm;
+ }
+ }
+
+ namespace SvxHorJustify
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt16 nVal(0);
+ rStrm.ReadUInt16( nVal );
+ rItem.SetValue(static_cast<::SvxCellHorJustify>(nVal));
+ }
+
+ SvStream& Store(const SvxHorJustifyItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+
+ namespace SvxVerJustify
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt16 nVal(0);
+ rStrm.ReadUInt16( nVal );
+ rItem.SetValue(static_cast<::SvxCellVerJustify>(nVal));
+ }
+
+ SvStream& Store(const SvxVerJustifyItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+
+ namespace SvxFrameDirection
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ return SOFFICE_FILEFORMAT_50 > nFileFormatVersion ? USHRT_MAX : 0;
+ }
+
+ void Create(SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_uInt16 nVal(0);
+ rStrm.ReadUInt16( nVal );
+ rItem.SetValue(static_cast<::SvxFrameDirection>(nVal));
+ }
+
+ SvStream& Store(const SvxFrameDirectionItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteUInt16( static_cast<sal_uInt16>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+
+ namespace SvxFormatBreak
+ {
+ sal_uInt16 GetVersion(sal_uInt16 nFileFormatVersion)
+ {
+ DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_40==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_50==nFileFormatVersion,
+ "SvxFormatBreakItem: Is there a new file format? ");
+ return SOFFICE_FILEFORMAT_31==nFileFormatVersion ||
+ SOFFICE_FILEFORMAT_40==nFileFormatVersion ? 0 : FMTBREAK_NOAUTO;
+ }
+
+ void Create(SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ sal_Int8 eBreak, bDummy;
+ rStrm.ReadSChar( eBreak );
+ if( FMTBREAK_NOAUTO > nItemVersion )
+ rStrm.ReadSChar( bDummy );
+ rItem.SetValue(static_cast<::SvxBreak>(eBreak));
+ }
+
+ SvStream& Store(const SvxFormatBreakItem& rItem, SvStream& rStrm, sal_uInt16 nItemVersion)
+ {
+ rStrm.WriteSChar( rItem.GetEnumValue() );
+ if( FMTBREAK_NOAUTO > nItemVersion )
+ rStrm.WriteSChar( 0x01 );
+ return rStrm;
+ }
+ }
+
+ namespace SvxFormatKeep
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ // derived from SfxBoolItem, but that uses
+ // rStream.ReadCharAsBool( tmp );
+ sal_Int8 bIsKeep;
+ rStrm.ReadSChar( bIsKeep );
+ rItem.SetValue(static_cast<bool>(bIsKeep));
+ }
+
+ SvStream& Store(const SvxFormatKeepItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ // derived from SfxBoolItem, but that uses
+ // rStream.WriteBool( m_bValue ); // not bool for serialization!
+ rStrm.WriteSChar( static_cast<sal_Int8>(rItem.GetValue()) );
+ return rStrm;
+ }
+ }
+
+ namespace SvxShadow
+ {
+ sal_uInt16 GetVersion(sal_uInt16)
+ {
+ return 0;
+ }
+
+ void Create(SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ sal_Int8 cLoc;
+ sal_uInt16 _nWidth;
+ bool bTrans;
+ Color aColor;
+ Color aFillColor;
+ sal_Int8 nStyle;
+ rStrm.ReadSChar( cLoc ).ReadUInt16( _nWidth ).ReadCharAsBool( bTrans );
+ ReadColor( rStrm, aColor );
+ ReadColor( rStrm, aFillColor ).ReadSChar( nStyle );
+ aColor.SetTransparency(bTrans ? 0xff : 0);
+
+ rItem.SetLocation(static_cast<SvxShadowLocation>(cLoc));
+ rItem.SetWidth(_nWidth);
+ rItem.SetColor(aColor);
+ }
+
+ SvStream& Store(const SvxShadowItem& rItem, SvStream& rStrm, sal_uInt16)
+ {
+ rStrm.WriteSChar( static_cast<sal_uInt8>(rItem.GetLocation()) )
+ .WriteUInt16( rItem.GetWidth() )
+ .WriteBool( rItem.GetColor().GetTransparency() > 0 );
+ WriteColor( rStrm, rItem.GetColor() );
+ WriteColor( rStrm, rItem.GetColor() );
+ rStrm.WriteSChar( rItem.GetColor().GetTransparency() > 0 ? 0 : 1 ); //BRUSH_NULL : BRUSH_SOLID
+ return rStrm;
+ }
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/items/numitem.cxx b/editeng/source/items/numitem.cxx
index ddb1aa11926f..5a748f5a4414 100644
--- a/editeng/source/items/numitem.cxx
+++ b/editeng/source/items/numitem.cxx
@@ -53,6 +53,7 @@
#include <editeng/unonrule.hxx>
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
+#include <editeng/legacyitem.hxx>
#define DEF_WRITER_LSPACE 500 //Standard Indentation
#define DEF_DRAW_LSPACE 800 //Standard Indentation
@@ -217,8 +218,8 @@ SvxNumberFormat::SvxNumberFormat( SvStream &rStream )
rStream.ReadUInt16( hasGraphicBrush );
if ( hasGraphicBrush )
{
- std::unique_ptr<SvxBrushItem> pTmp( new SvxBrushItem( SID_ATTR_BRUSH ) );
- pGraphicBrush.reset( static_cast<SvxBrushItem*>(pTmp->Create( rStream, BRUSH_GRAPHIC_VERSION )) );
+ pGraphicBrush.reset(new SvxBrushItem(SID_ATTR_BRUSH));
+ legacy::SvxBrush::Create(*pGraphicBrush, rStream, BRUSH_GRAPHIC_VERSION);
}
else pGraphicBrush = nullptr;
rStream.ReadUInt16( nTmp16 ); eVertOrient = nTmp16;
@@ -290,7 +291,7 @@ void SvxNumberFormat::Store(SvStream &rStream, FontToSubsFontConverter pConverte
pGraphicBrush->SetGraphicLink("");
}
- pGraphicBrush->Store(rStream, BRUSH_GRAPHIC_VERSION);
+ legacy::SvxBrush::Store(*pGraphicBrush, rStream, BRUSH_GRAPHIC_VERSION);
}
else
rStream.WriteUInt16( 0 );
@@ -939,11 +940,6 @@ SfxPoolItem* SvxNumBulletItem::Clone( SfxItemPool * ) const
return new SvxNumBulletItem(*this);
}
-sal_uInt16 SvxNumBulletItem::GetVersion( sal_uInt16 /*nFileVersion*/ ) const
-{
- return NUMITEM_VERSION_03;
-}
-
bool SvxNumBulletItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
{
rVal <<= SvxCreateNumRule( pNumRule.get() );
diff --git a/editeng/source/items/paraitem.cxx b/editeng/source/items/paraitem.cxx
index 3bd1449b7c0e..4cf9750f15ca 100644
--- a/editeng/source/items/paraitem.cxx
+++ b/editeng/source/items/paraitem.cxx
@@ -401,47 +401,6 @@ void SvxAdjustItem::SetEnumValue( sal_uInt16 nVal )
}
-sal_uInt16 SvxAdjustItem::GetVersion( sal_uInt16 nFileVersion ) const
-{
- return (nFileVersion == SOFFICE_FILEFORMAT_31)
- ? 0 : ADJUST_LASTBLOCK_VERSION;
-}
-
-
-SfxPoolItem* SvxAdjustItem::Create(SvStream& rStrm, sal_uInt16 nVersion) const
-{
- char eAdjustment;
- rStrm.ReadChar( eAdjustment );
- SvxAdjustItem *pRet = new SvxAdjustItem( static_cast<SvxAdjust>(eAdjustment), Which() );
- if( nVersion >= ADJUST_LASTBLOCK_VERSION )
- {
- sal_Int8 nFlags;
- rStrm.ReadSChar( nFlags );
- pRet->bOneBlock = 0 != (nFlags & 0x0001);
- pRet->bLastCenter = 0 != (nFlags & 0x0002);
- pRet->bLastBlock = 0 != (nFlags & 0x0004);
- }
- return pRet;
-}
-
-
-SvStream& SvxAdjustItem::Store( SvStream& rStrm, sal_uInt16 nItemVersion ) const
-{
- rStrm.WriteChar( static_cast<char>(GetAdjust()) );
- if ( nItemVersion >= ADJUST_LASTBLOCK_VERSION )
- {
- sal_Int8 nFlags = 0;
- if ( bOneBlock )
- nFlags |= 0x0001;
- if ( bLastCenter )
- nFlags |= 0x0002;
- if ( bLastBlock )
- nFlags |= 0x0004;
- rStrm.WriteSChar( nFlags );
- }
- return rStrm;
-}
-
// class SvxWidowsItem ---------------------------------------------------
SvxWidowsItem::SvxWidowsItem(const sal_uInt8 nL, const sal_uInt16 nId ) :
@@ -752,12 +711,6 @@ sal_uInt16 SvxTabStopItem::GetPos( const sal_Int32 nPos ) const
}
-SvxTabStopItem& SvxTabStopItem::operator=( const SvxTabStopItem& rTSI )
-{
- maTabStops = rTSI.maTabStops;
- return *this;
-}
-
bool SvxTabStopItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
{
bool bConvert = 0!=(nMemberId&CONVERT_TWIPS);
@@ -1090,16 +1043,6 @@ SfxPoolItem* SvxScriptSpaceItem::Clone( SfxItemPool * ) const
return new SvxScriptSpaceItem( *this );
}
-sal_uInt16 SvxScriptSpaceItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxTwoLinesItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxScriptSpaceItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -1123,16 +1066,6 @@ SfxPoolItem* SvxHangingPunctuationItem::Clone( SfxItemPool * ) const
return new SvxHangingPunctuationItem( *this );
}
-sal_uInt16 SvxHangingPunctuationItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxHangingPunctuationItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxHangingPunctuationItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -1156,16 +1089,6 @@ SfxPoolItem* SvxForbiddenRuleItem::Clone( SfxItemPool * ) const
return new SvxForbiddenRuleItem( *this );
}
-sal_uInt16 SvxForbiddenRuleItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxForbiddenRuleItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxForbiddenRuleItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -1192,11 +1115,6 @@ SfxPoolItem* SvxParaVertAlignItem::Clone( SfxItemPool* ) const
return new SvxParaVertAlignItem( *this );
}
-sal_uInt16 SvxParaVertAlignItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxParaVertAlignItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -1252,16 +1170,6 @@ SfxPoolItem* SvxParaGridItem::Clone( SfxItemPool * ) const
return new SvxParaGridItem( *this );
}
-sal_uInt16 SvxParaGridItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxParaGridItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxParaGridItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 019fb06eb621..13c5c04ffbbe 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -94,8 +94,6 @@
#include <editeng/eerdll.hxx>
#include <libxml/xmlwriter.h>
-#define STORE_UNICODE_MAGIC_MARKER 0xFE331188
-
using namespace ::com::sun::star;
using namespace ::com::sun::star::text;
@@ -199,17 +197,6 @@ SvxFontItem::SvxFontItem( const FontFamily eFam, const OUString& aName,
}
-SvxFontItem& SvxFontItem::operator=(const SvxFontItem& rFont)
-{
- aFamilyName = rFont.GetFamilyName();
- aStyleName = rFont.GetStyleName();
- eFamily = rFont.GetFamily();
- ePitch = rFont.GetPitch();
- eTextEncoding = rFont.GetCharSet();
- return *this;
-}
-
-
bool SvxFontItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const
{
nMemberId &= ~CONVERT_TWIPS;
@@ -330,64 +317,6 @@ SfxPoolItem* SvxFontItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxFontItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- bool bToBats = IsStarSymbol( GetFamilyName() );
-
- rStrm.WriteUChar( GetFamily() ).WriteUChar( GetPitch() )
- .WriteUChar( bToBats ? RTL_TEXTENCODING_SYMBOL : GetSOStoreTextEncoding(GetCharSet()) );
-
- OUString aStoreFamilyName( GetFamilyName() );
- if( bToBats )
- aStoreFamilyName = "StarBats";
- rStrm.WriteUniOrByteString(aStoreFamilyName, rStrm.GetStreamCharSet());
- rStrm.WriteUniOrByteString(GetStyleName(), rStrm.GetStreamCharSet());
-
- return rStrm;
-}
-
-
-SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 _eFamily, eFontPitch, eFontTextEncoding;
- OUString aName, aStyle;
- rStrm.ReadUChar( _eFamily );
- rStrm.ReadUChar( eFontPitch );
- rStrm.ReadUChar( eFontTextEncoding );
-
- // UNICODE: rStrm >> aName;
- aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
-
- // UNICODE: rStrm >> aStyle;
- aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
-
- // Set the "correct" textencoding
- eFontTextEncoding = static_cast<sal_uInt8>(GetSOLoadTextEncoding( eFontTextEncoding ));
-
- // at some point, the StarBats changes from ANSI font to SYMBOL font
- if ( RTL_TEXTENCODING_SYMBOL != eFontTextEncoding && aName == "StarBats" )
- eFontTextEncoding = RTL_TEXTENCODING_SYMBOL;
-
- // Check if we have stored unicode
- sal_uInt64 const nStreamPos = rStrm.Tell();
- sal_uInt32 nMagic = STORE_UNICODE_MAGIC_MARKER;
- rStrm.ReadUInt32( nMagic );
- if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
- {
- aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
- aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
- }
- else
- {
- rStrm.Seek( nStreamPos );
- }
-
-
- return new SvxFontItem( static_cast<FontFamily>(_eFamily), aName, aStyle,
- static_cast<FontPitch>(eFontPitch), static_cast<rtl_TextEncoding>(eFontTextEncoding), Which() );
-}
-
-
bool SvxFontItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -433,21 +362,6 @@ sal_uInt16 SvxPostureItem::GetValueCount() const
}
-SvStream& SvxPostureItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteUChar( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxPostureItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nPosture;
- rStrm.ReadUChar( nPosture );
- return new SvxPostureItem( static_cast<FontItalic>(nPosture), Which() );
-}
-
-
bool SvxPostureItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -581,20 +495,6 @@ SfxPoolItem* SvxWeightItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxWeightItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteUChar( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxWeightItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nWeight;
- rStrm.ReadUChar( nWeight );
- return new SvxWeightItem( static_cast<FontWeight>(nWeight), Which() );
-}
-
bool SvxWeightItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -697,55 +597,6 @@ SfxPoolItem* SvxFontHeightItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxFontHeightItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- rStrm.WriteUInt16( GetHeight() );
-
- if( FONTHEIGHT_UNIT_VERSION <= nItemVersion )
- rStrm.WriteUInt16( GetProp() ).WriteUInt16( static_cast<sal_uInt16>(GetPropUnit()) );
- else
- {
- // When exporting to the old versions the relative information is lost
- // when there is no percentage
- sal_uInt16 _nProp = GetProp();
- if( MapUnit::MapRelative != GetPropUnit() )
- _nProp = 100;
- rStrm.WriteUInt16( _nProp );
- }
- return rStrm;
-}
-
-
-SfxPoolItem* SvxFontHeightItem::Create( SvStream& rStrm,
- sal_uInt16 nVersion ) const
-{
- sal_uInt16 nsize, nprop = 0;
- MapUnit nPropUnit = MapUnit::MapRelative;
-
- rStrm.ReadUInt16( nsize );
-
- if( FONTHEIGHT_16_VERSION <= nVersion )
- rStrm.ReadUInt16( nprop );
- else
- {
- sal_uInt8 nP;
- rStrm .ReadUChar( nP );
- nprop = static_cast<sal_uInt16>(nP);
- }
-
- if( FONTHEIGHT_UNIT_VERSION <= nVersion )
- {
- sal_uInt16 nTmp;
- rStrm.ReadUInt16( nTmp );
- nPropUnit = static_cast<MapUnit>(nTmp);
- }
-
- SvxFontHeightItem* pItem = new SvxFontHeightItem( nsize, 100, Which() );
- pItem->SetProp( nprop, nPropUnit );
- return pItem;
-}
-
-
bool SvxFontHeightItem::operator==( const SfxPoolItem& rItem ) const
{
assert(SfxPoolItem::operator==(rItem));
@@ -1009,14 +860,6 @@ bool SvxFontHeightItem::GetPresentation
}
-sal_uInt16 SvxFontHeightItem::GetVersion(sal_uInt16 nFileVersion) const
-{
- return (nFileVersion <= SOFFICE_FILEFORMAT_40)
- ? FONTHEIGHT_16_VERSION
- : FONTHEIGHT_UNIT_VERSION;
-}
-
-
void SvxFontHeightItem::ScaleMetrics( long nMult, long nDiv )
{
nHeight = static_cast<sal_uInt32>(Scale( nHeight, nMult, nDiv ));
@@ -1112,21 +955,6 @@ sal_uInt16 SvxTextLineItem::GetValueCount() const
}
-SvStream& SvxTextLineItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteUChar( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxTextLineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm.ReadUChar( nState );
- return new SvxTextLineItem( static_cast<FontLineStyle>(nState), Which() );
-}
-
-
bool SvxTextLineItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -1232,14 +1060,6 @@ SfxPoolItem* SvxUnderlineItem::Clone( SfxItemPool * ) const
}
-SfxPoolItem* SvxUnderlineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm.ReadUChar( nState );
- return new SvxUnderlineItem( static_cast<FontLineStyle>(nState), Which() );
-}
-
-
OUString SvxUnderlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
{
static const char* RID_SVXITEMS_UL[] =
@@ -1283,14 +1103,6 @@ SfxPoolItem* SvxOverlineItem::Clone( SfxItemPool * ) const
}
-SfxPoolItem* SvxOverlineItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm.ReadUChar( nState );
- return new SvxOverlineItem( static_cast<FontLineStyle>(nState), Which() );
-}
-
-
OUString SvxOverlineItem::GetValueTextByPos( sal_uInt16 nPos ) const
{
static const char* RID_SVXITEMS_OL[] =
@@ -1358,21 +1170,6 @@ SfxPoolItem* SvxCrossedOutItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxCrossedOutItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteUChar( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxCrossedOutItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 eCross;
- rStrm.ReadUChar( eCross );
- return new SvxCrossedOutItem( static_cast<FontStrikeout>(eCross), Which() );
-}
-
-
bool SvxCrossedOutItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -1450,21 +1247,6 @@ SfxPoolItem* SvxShadowedItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxShadowedItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteBool( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxShadowedItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- sal_uInt8 nState;
- rStrm.ReadUChar( nState );
- return new SvxShadowedItem( nState, Which() );
-}
-
-
bool SvxShadowedItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -1556,21 +1338,6 @@ SfxPoolItem* SvxContourItem::Clone( SfxItemPool * ) const
}
-SvStream& SvxContourItem::Store( SvStream& rStrm , sal_uInt16 /*nItemVersion*/ ) const
-{
- rStrm.WriteBool( GetValue() );
- return rStrm;
-}
-
-
-SfxPoolItem* SvxContourItem::Create(SvStream& rStrm, sal_uInt16) const
-{
- bool bValue;
- rStrm.ReadCharAsBool( bValue );
- return new SvxContourItem( bValue, Which() );
-}
-
-
bool SvxContourItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -1665,27 +1432,10 @@ SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
{
}
-SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
- SfxPoolItem( nId )
-{
- Color aColor;
- ReadColor( rStrm, aColor );
- mColor = aColor;
-}
-
SvxColorItem::~SvxColorItem()
{
}
-sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxColorItem: Is there a new file format? ");
- return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0;
-}
-
bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
{
assert(SfxPoolItem::operator==(rAttr));
@@ -1709,21 +1459,6 @@ SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const
return new SvxColorItem( *this );
}
-SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
-{
- if( VERSION_USEAUTOCOLOR == nItemVersion &&
- COL_AUTO == mColor )
- WriteColor( rStrm, COL_BLACK );
- else
- WriteColor( rStrm, mColor );
- return rStrm;
-}
-
-SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const
-{
- return new SvxColorItem( rStrm, Which() );
-}
-
bool SvxColorItem::GetPresentation
(
SfxItemPresentation /*ePres*/,
@@ -2328,17 +2063,6 @@ bool SvxEmphasisMarkItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
return true;
}
-sal_uInt16 SvxEmphasisMarkItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxEmphasisMarkItem: Is there a new file format? ");
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-
/*************************************************************************
|* class SvxTwoLinesItem
*************************************************************************/
@@ -2448,17 +2172,6 @@ bool SvxTwoLinesItem::GetPresentation( SfxItemPresentation /*ePres*/,
}
-sal_uInt16 SvxTwoLinesItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
- SOFFICE_FILEFORMAT_40==nFFVer ||
- SOFFICE_FILEFORMAT_50==nFFVer,
- "SvxTwoLinesItem: Is there a new file format?" );
-
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
-
/*************************************************************************
|* class SvxTextRotateItem
*************************************************************************/
@@ -2473,11 +2186,6 @@ SfxPoolItem* SvxTextRotateItem::Clone(SfxItemPool*) const
return new SvxTextRotateItem(*this);
}
-sal_uInt16 SvxTextRotateItem::GetVersion(sal_uInt16 nFFVer) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxTextRotateItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -2563,11 +2271,6 @@ SfxPoolItem* SvxCharRotateItem::Clone( SfxItemPool* ) const
return new SvxCharRotateItem( *this );
}
-sal_uInt16 SvxCharRotateItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxCharRotateItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -2658,11 +2361,6 @@ SfxPoolItem* SvxCharScaleWidthItem::Clone( SfxItemPool* ) const
}
-sal_uInt16 SvxCharScaleWidthItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
bool SvxCharScaleWidthItem::GetPresentation(
SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/, MapUnit /*ePresMetric*/,
@@ -2717,11 +2415,6 @@ SfxPoolItem* SvxCharReliefItem::Clone( SfxItemPool * ) const
return new SvxCharReliefItem( *this );
}
-sal_uInt16 SvxCharReliefItem::GetVersion( sal_uInt16 nFFVer ) const
-{
- return SOFFICE_FILEFORMAT_50 > nFFVer ? USHRT_MAX : 0;
-}
-
static const char* RID_SVXITEMS_RELIEF[] =
{
RID_SVXITEMS_RELIEF_NONE,
@@ -2815,11 +2508,6 @@ SfxPoolItem* SvxScriptSetItem::Clone( SfxItemPool * ) const
return p;
}
-SfxPoolItem* SvxScriptSetItem::Create( SvStream &, sal_uInt16 ) const
-{
- return nullptr;
-}
-
const SfxPoolItem* SvxScriptSetItem::GetItemOfScriptSet(
const SfxItemSet& rSet, sal_uInt16 nId )
{
diff --git a/editeng/source/items/writingmodeitem.cxx b/editeng/source/items/writingmodeitem.cxx
index 1c6363d61667..dfa2df0de9cd 100644
--- a/editeng/source/items/writingmodeitem.cxx
+++ b/editeng/source/items/writingmodeitem.cxx
@@ -50,11 +50,6 @@ SfxPoolItem* SvxWritingModeItem::Clone( SfxItemPool * ) const
return new SvxWritingModeItem( *this );
}
-sal_uInt16 SvxWritingModeItem::GetVersion( sal_uInt16 /*nFVer*/ ) const
-{
- return USHRT_MAX;
-}
-
bool SvxWritingModeItem::GetPresentation( SfxItemPresentation /*ePres*/,
MapUnit /*eCoreMetric*/,
MapUnit /*ePresMetric*/,
diff --git a/editeng/source/items/xmlcnitm.cxx b/editeng/source/items/xmlcnitm.cxx
index ce4de850736a..4e0c25c9c239 100644
--- a/editeng/source/items/xmlcnitm.cxx
+++ b/editeng/source/items/xmlcnitm.cxx
@@ -68,12 +68,6 @@ bool SvXMLAttrContainerItem::GetPresentation(
return false;
}
-sal_uInt16 SvXMLAttrContainerItem::GetVersion( sal_uInt16 /*nFileFormatVersion*/ ) const
-{
- // This item should never be stored
- return USHRT_MAX;
-}
-
bool SvXMLAttrContainerItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
{
Reference<XNameContainer> xContainer
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index 218124a009e4..41880b4f35b2 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -778,24 +778,30 @@ ATTR_SETUNDERLINE:
case RTF_ULC:
if( aPlainMap.nUnderline )
{
- SvxUnderlineItem aUL( LINESTYLE_SINGLE, aPlainMap.nUnderline );
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == pSet->GetItemState(
- aPlainMap.nUnderline, false, &pItem ) )
+ std::unique_ptr<SvxUnderlineItem> aUL(std::make_unique<SvxUnderlineItem>(LINESTYLE_SINGLE, aPlainMap.nUnderline));
+ const SfxPoolItem* pItem(nullptr);
+
+ if( SfxItemState::SET == pSet->GetItemState(aPlainMap.nUnderline, false, &pItem ) )
{
// is switched off ?
- if( LINESTYLE_NONE ==
- static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() )
+ if( LINESTYLE_NONE == static_cast<const SvxUnderlineItem*>(pItem)->GetLineStyle() )
break;
- aUL = *static_cast<const SvxUnderlineItem*>(pItem);
+
+ aUL.reset(static_cast<SvxUnderlineItem*>(pItem->Clone()));
}
else
- aUL = static_cast<const SvxUnderlineItem&>(pSet->Get( aPlainMap.nUnderline, false ));
+ {
+ aUL.reset(static_cast<SvxUnderlineItem*>(pSet->Get( aPlainMap.nUnderline, false).Clone()));
+ }
- if( LINESTYLE_NONE == aUL.GetLineStyle() )
- aUL.SetLineStyle( LINESTYLE_SINGLE );
- aUL.SetColor( GetColor( sal_uInt16(nTokenValue) ));
- pSet->Put( aUL );
+ if(LINESTYLE_NONE == aUL->GetLineStyle())
+ {
+ aUL->SetLineStyle(LINESTYLE_SINGLE);
+ }
+
+ aUL->SetColor(GetColor(sal_uInt16(nTokenValue)));
+
+ pSet->Put(*aUL);
}
break;
@@ -873,24 +879,30 @@ ATTR_SETOVERLINE:
case RTF_OLC:
if( aPlainMap.nOverline )
{
- SvxOverlineItem aOL( LINESTYLE_SINGLE, aPlainMap.nOverline );
- const SfxPoolItem* pItem;
- if( SfxItemState::SET == pSet->GetItemState(
- aPlainMap.nOverline, false, &pItem ) )
+ std::unique_ptr<SvxOverlineItem> aOL(std::make_unique<SvxOverlineItem>(LINESTYLE_SINGLE, aPlainMap.nOverline));
+ const SfxPoolItem* pItem(nullptr);
+
+ if( SfxItemState::SET == pSet->GetItemState(aPlainMap.nOverline, false, &pItem ) )
{
// is switched off ?
- if( LINESTYLE_NONE ==
- static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() )
+ if( LINESTYLE_NONE == static_cast<const SvxOverlineItem*>(pItem)->GetLineStyle() )
break;
- aOL = *static_cast<const SvxOverlineItem*>(pItem);
+
+ aOL.reset(static_cast<SvxOverlineItem*>(pItem->Clone()));
}
else
- aOL = static_cast<const SvxOverlineItem&>(pSet->Get( aPlainMap.nOverline, false ));
+ {
+ aOL.reset(static_cast<SvxOverlineItem*>(pSet->Get( aPlainMap.nOverline, false).Clone()));
+ }
+
+ if(LINESTYLE_NONE == aOL->GetLineStyle())
+ {
+ aOL->SetLineStyle(LINESTYLE_SINGLE);
+ }
- if( LINESTYLE_NONE == aOL.GetLineStyle() )
- aOL.SetLineStyle( LINESTYLE_SINGLE );
- aOL.SetColor( GetColor( sal_uInt16(nTokenValue) ));
- pSet->Put( aOL );
+ aOL->SetColor(GetColor(sal_uInt16(nTokenValue)));
+
+ pSet->Put(*aOL);
}
break;
@@ -1372,10 +1384,13 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
bool bTableDef )
{
// then read the border attribute
- SvxBoxItem aAttr( aPardMap.nBox );
- const SfxPoolItem* pItem;
+ std::unique_ptr<SvxBoxItem> aAttr(std::make_unique<SvxBoxItem>(aPardMap.nBox));
+ const SfxPoolItem* pItem(nullptr);
+
if( SfxItemState::SET == rSet.GetItemState( aPardMap.nBox, false, &pItem ) )
- aAttr = *static_cast<const SvxBoxItem*>(pItem);
+ {
+ aAttr.reset(static_cast<SvxBoxItem*>(pItem->Clone()));
+ }
SvxBorderLine aBrd( nullptr, DEF_LINE_WIDTH_0 ); // Simple plain line
bool bContinue = true;
@@ -1400,7 +1415,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
if( bTableDef )
{
if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
+ SetBorderLine( nBorderTyp, *aAttr, aBrd );
nBorderTyp = RTF_BRDRT;
}
break;
@@ -1410,7 +1425,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
if( bTableDef )
{
if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
+ SetBorderLine( nBorderTyp, *aAttr, aBrd );
nBorderTyp = RTF_BRDRB;
}
break;
@@ -1420,7 +1435,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
if( bTableDef )
{
if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
+ SetBorderLine( nBorderTyp, *aAttr, aBrd );
nBorderTyp = RTF_BRDRL;
}
break;
@@ -1430,7 +1445,7 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
if( bTableDef )
{
if (nBorderTyp != 0)
- SetBorderLine( nBorderTyp, aAttr, aBrd );
+ SetBorderLine( nBorderTyp, *aAttr, aBrd );
nBorderTyp = RTF_BRDRR;
}
break;
@@ -1506,23 +1521,23 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
switch( nBorderTyp )
{
case RTF_BRDRB:
- aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::BOTTOM );
+ aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::BOTTOM );
break;
case RTF_BRDRT:
- aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::TOP );
+ aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::TOP );
break;
case RTF_BRDRL:
- aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::LEFT );
+ aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::LEFT );
break;
case RTF_BRDRR:
- aAttr.SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::RIGHT );
+ aAttr->SetDistance( static_cast<sal_uInt16>(nTokenValue), SvxBoxItemLine::RIGHT );
break;
case RTF_BOX:
- aAttr.SetAllDistances( static_cast<sal_uInt16>(nTokenValue) );
+ aAttr->SetAllDistances( static_cast<sal_uInt16>(nTokenValue) );
break;
}
}
@@ -1544,9 +1559,9 @@ void SvxRTFParser::ReadBorderAttr( int nToken, SfxItemSet& rSet,
if ( bDoubleWidth ) nWidth *= 2;
aBrd.SetWidth( nWidth );
- SetBorderLine( nBorderTyp, aAttr, aBrd );
+ SetBorderLine( nBorderTyp, *aAttr, aBrd );
- rSet.Put( aAttr );
+ rSet.Put( *aAttr );
SkipToken();
}