diff options
Diffstat (limited to 'editeng/source/items/textitem.cxx')
-rw-r--r-- | editeng/source/items/textitem.cxx | 66 |
1 files changed, 56 insertions, 10 deletions
diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index e1700df6e254..d9dba072b980 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -1313,26 +1313,32 @@ bool SvxContourItem::GetPresentation // class SvxBackgroundColorItem ----------------------------------------- SvxBackgroundColorItem::SvxBackgroundColorItem( const sal_uInt16 nId ) : - SvxColorItem( nId ) + SfxPoolItem( nId ), + mColor( COL_WHITE ) { } +SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol, const sal_uInt16 nId ) : + SfxPoolItem( nId ), + mColor( rCol ) +{ +} -SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol, - const sal_uInt16 nId ) : - SvxColorItem( rCol, nId ) +SvxBackgroundColorItem::~SvxBackgroundColorItem() { } -SvxBackgroundColorItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const +bool SvxBackgroundColorItem::operator==( const SfxPoolItem& rAttr ) const { - return new SvxBackgroundColorItem(*this); + assert(SfxPoolItem::operator==(rAttr)); + + return mColor == static_cast<const SvxBackgroundColorItem&>( rAttr ).mColor; } bool SvxBackgroundColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { nMemberId &= ~CONVERT_TWIPS; - Color aColor = SvxColorItem::GetValue(); + Color aColor = SvxBackgroundColorItem::GetValue(); switch( nMemberId ) { @@ -1354,27 +1360,67 @@ bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId { nMemberId &= ~CONVERT_TWIPS; sal_Int32 nColor = 0; - Color aColor = SvxColorItem::GetValue(); + Color aColor = SvxBackgroundColorItem::GetValue(); switch( nMemberId ) { case MID_GRAPHIC_TRANSPARENT: { aColor.SetTransparency( Any2Bool( rVal ) ? 0xff : 0 ); - SvxColorItem::SetValue( aColor ); + SvxBackgroundColorItem::SetValue( aColor ); break; } default: { if(!(rVal >>= nColor)) return false; - SvxColorItem::SetValue( Color(nColor) ); + SvxBackgroundColorItem::SetValue( Color(nColor) ); break; } } return true; } +SvxBackgroundColorItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const +{ + return new SvxBackgroundColorItem(*this); +} + + +bool SvxBackgroundColorItem::GetPresentation +( + SfxItemPresentation /*ePres*/, + MapUnit /*eCoreUnit*/, + MapUnit /*ePresUnit*/, + OUString& rText, const IntlWrapper& /*rIntl*/ +) const +{ + rText = ::GetColorString( mColor ); + return true; +} + +void SvxBackgroundColorItem::dumpAsXml(xmlTextWriterPtr pWriter) const +{ + (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SvxBackgroundColorItem")); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("whichId"), BAD_CAST(OString::number(Which()).getStr())); + + std::stringstream ss; + ss << mColor; + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(ss.str().c_str())); + + OUString aStr; + IntlWrapper aIntlWrapper(SvtSysLocale().GetUILanguageTag()); + GetPresentation( SfxItemPresentation::Complete, MapUnit::Map100thMM, MapUnit::Map100thMM, aStr, aIntlWrapper); + (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("presentation"), BAD_CAST(OUStringToOString(aStr, RTL_TEXTENCODING_UTF8).getStr())); + (void)xmlTextWriterEndElement(pWriter); +} + +void SvxBackgroundColorItem::SetValue( const Color& rNewCol ) +{ + mColor = rNewCol; +} + + // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : SfxPoolItem( nId ), |