summaryrefslogtreecommitdiff
path: root/editeng/source/items/textitem.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-08-27 12:21:37 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-08-27 14:45:02 +0100
commit3bc69b1d0d8620afd89a993b5f6bc46a2ff5267f (patch)
tree3b2782fbc31807559d3e0e5ea4790cd07294ba2a /editeng/source/items/textitem.cxx
parent5fba7ebf5c465b218b650141eab28c27cc19c79e (diff)
don't write SvxBackgroundColorItem via inherited SvxColorItem::Store
SvxBackgroundColorItem inherits from SvxColorItem and for backwards compatibility with the StarOffice 5 binary file format (yes, really) writes/reads only rgb and not the transparency value, so copying and pasting text from a sidebar comment in writer to itself or another one results in a black character background as the default COL_AUTO turns into black Change-Id: I18b5105dd8e060b9e49dda6026e26d3a0f00d8f5
Diffstat (limited to 'editeng/source/items/textitem.cxx')
-rw-r--r--editeng/source/items/textitem.cxx38
1 files changed, 11 insertions, 27 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx
index 028ba85d0b63..9c76d7eab65f 100644
--- a/editeng/source/items/textitem.cxx
+++ b/editeng/source/items/textitem.cxx
@@ -1850,9 +1850,12 @@ SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol,
{
}
-SvxBackgroundColorItem:: SvxBackgroundColorItem( SvStream& rStrm, const sal_uInt16 Id ) :
- SvxColorItem( rStrm, Id )
+SvxBackgroundColorItem::SvxBackgroundColorItem(SvStream& rStrm, const sal_uInt16 nId)
+ : SvxColorItem(nId)
{
+ Color aColor;
+ aColor.Read(rStrm);
+ SetValue(aColor);
}
SvxBackgroundColorItem::SvxBackgroundColorItem( const SvxBackgroundColorItem& rCopy ) :
@@ -1862,9 +1865,14 @@ SvxBackgroundColorItem::SvxBackgroundColorItem( const SvxBackgroundColorItem& rC
SfxPoolItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const
{
- return new SvxBackgroundColorItem( *this );
+ return new SvxBackgroundColorItem(*this);
}
+SvStream& SvxBackgroundColorItem::Store(SvStream& rStrm, sal_uInt16) const
+{
+ GetValue().Write(rStrm);
+ return rStrm;
+}
SfxPoolItem* SvxBackgroundColorItem::Create(SvStream& rStrm, sal_uInt16 ) const
{
@@ -1918,23 +1926,18 @@ bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId
}
// class SvxColorItem ----------------------------------------------------
-
SvxColorItem::SvxColorItem( const sal_uInt16 nId ) :
SfxPoolItem( nId ),
mColor( COL_BLACK )
{
}
-
-
SvxColorItem::SvxColorItem( const Color& rCol, const sal_uInt16 nId ) :
SfxPoolItem( nId ),
mColor( rCol )
{
}
-
-
SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
SfxPoolItem( nId )
{
@@ -1943,21 +1946,16 @@ SvxColorItem::SvxColorItem( SvStream &rStrm, const sal_uInt16 nId ) :
mColor = aColor;
}
-
-
SvxColorItem::SvxColorItem( const SvxColorItem &rCopy ) :
SfxPoolItem( rCopy ),
mColor( rCopy.mColor )
{
}
-
-
SvxColorItem::~SvxColorItem()
{
}
-
sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
{
DBG_ASSERT( SOFFICE_FILEFORMAT_31==nFFVer ||
@@ -1967,8 +1965,6 @@ sal_uInt16 SvxColorItem::GetVersion( sal_uInt16 nFFVer ) const
return SOFFICE_FILEFORMAT_50 >= nFFVer ? VERSION_USEAUTOCOLOR : 0;
}
-
-
bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
{
DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" );
@@ -1976,16 +1972,12 @@ bool SvxColorItem::operator==( const SfxPoolItem& rAttr ) const
return mColor == static_cast<const SvxColorItem&>( rAttr ).mColor;
}
-
-
bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
{
rVal <<= (sal_Int32)(mColor.GetColor());
return true;
}
-
-
bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
{
sal_Int32 nColor = 0;
@@ -1996,15 +1988,11 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId*/ )
return true;
}
-
-
SfxPoolItem* SvxColorItem::Clone( SfxItemPool * ) const
{
return new SvxColorItem( *this );
}
-
-
SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
{
if( VERSION_USEAUTOCOLOR == nItemVersion &&
@@ -2015,15 +2003,11 @@ SvStream& SvxColorItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
return rStrm;
}
-
-
SfxPoolItem* SvxColorItem::Create(SvStream& rStrm, sal_uInt16 /*nVer*/ ) const
{
return new SvxColorItem( rStrm, Which() );
}
-
-
bool SvxColorItem::GetPresentation
(
SfxItemPresentation /*ePres*/,