diff options
author | Gülşah Köse <gulsah.kose@collabora.com> | 2021-05-28 01:23:53 +0300 |
---|---|---|
committer | Gülşah Köse <gulsah.kose@collabora.com> | 2021-05-31 11:36:18 +0200 |
commit | 936af331ba6f5073aeaa0f10f5f2af1def1d74c6 (patch) | |
tree | e145eb9a5f7b9fe05a7f7832cf6eb76388cc4662 | |
parent | 7d34a7777cfeec112ab5cdabba059d01d8876be4 (diff) |
Clean redundant SvxBackgroundColorItem and use SvxColorItem instead.
SvxBackgroundColorItem is just copied from SvxColorItem. There is
nothing special to SvxBackgroundColorItem class. SvxColorItem is a
generic item and it's used on many places related with colors. We can
use SvxColorItem for background colors too.
Change-Id: Iacea31a7557b806e95f5859ff60add9a2626ec05
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116282
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
Tested-by: Jenkins
24 files changed, 51 insertions, 195 deletions
diff --git a/compilerplugins/clang/constantparam.booleans.results b/compilerplugins/clang/constantparam.booleans.results index 94efdc01da0a..e34c49f419b8 100644 --- a/compilerplugins/clang/constantparam.booleans.results +++ b/compilerplugins/clang/constantparam.booleans.results @@ -706,10 +706,6 @@ include/editeng/boxitem.hxx:114 _Bool SvxBoxItem::HasBorder(_Bool) const _Bool bTreatPaddingAsBorder 1 -include/editeng/colritem.hxx:69 - void SvxBackgroundColorItem::SvxBackgroundColorItem(const unsigned short) - const unsigned short nId - 0 include/editeng/editeng.hxx:548 void EditEngine::dumpAsXmlEditDoc(struct _xmlTextWriter *) const struct _xmlTextWriter * pWriter diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 338990b31628..b583fa03768e 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1067,7 +1067,7 @@ bool SpellDialog::GetNextSentence_Impl(std::unique_ptr<UndoChangeGroupGuard>* pG } if (elem.bIsField) - m_xSentenceED->SetAttrib(SvxBackgroundColorItem(COL_LIGHTGRAY, EE_CHAR_BKGCOLOR), nStartPosition, nEndPosition); + m_xSentenceED->SetAttrib(SvxColorItem(COL_LIGHTGRAY, EE_CHAR_BKGCOLOR), nStartPosition, nEndPosition); m_xSentenceED->SetAttrib(SvxLanguageItem(elem.eLanguage, EE_CHAR_LANGUAGE), nStartPosition, nEndPosition); nStartPosition = nEndPosition; } diff --git a/cui/source/tabpages/backgrnd.cxx b/cui/source/tabpages/backgrnd.cxx index 38190271d778..3aac1fae51a7 100644 --- a/cui/source/tabpages/backgrnd.cxx +++ b/cui/source/tabpages/backgrnd.cxx @@ -153,8 +153,8 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) { if ( SID_ATTR_CHAR_BACK_COLOR == nSlot ) { - maSet.Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) ); - rCoreSet->Put( SvxBackgroundColorItem( COL_TRANSPARENT, nWhich ) ); + maSet.Put( SvxColorItem( COL_TRANSPARENT, nWhich ) ); + rCoreSet->Put( SvxColorItem( COL_TRANSPARENT, nWhich ) ); } else { @@ -169,8 +169,8 @@ bool SvxBkgTabPage::FillItemSet( SfxItemSet* rCoreSet ) XFillColorItem aColorItem( maSet.Get( XATTR_FILLCOLOR ) ); if ( SID_ATTR_CHAR_BACK_COLOR == nSlot ) { - maSet.Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) ); - rCoreSet->Put( SvxBackgroundColorItem( aColorItem.GetColorValue(), nWhich ) ); + maSet.Put( SvxColorItem( aColorItem.GetColorValue(), nWhich ) ); + rCoreSet->Put( SvxColorItem( aColorItem.GetColorValue(), nWhich ) ); } else { @@ -263,7 +263,7 @@ void SvxBkgTabPage::PageCreated(const SfxAllItemSet& aSet) if ( bCharBackColor ) { sal_uInt16 nWhich(maSet.GetPool()->GetWhich(SID_ATTR_CHAR_BACK_COLOR)); - Color aBackColor(static_cast<const SvxBackgroundColorItem&>(maSet.Get(nWhich)).GetValue()); + Color aBackColor(static_cast<const SvxColorItem&>(maSet.Get(nWhich)).GetValue()); SvxBrushItem aBrushItem(SvxBrushItem(aBackColor, SID_ATTR_BRUSH_CHAR)); setSvxBrushItemAsFillAttributesToTargetSet(aBrushItem, maSet); } diff --git a/editeng/inc/editattr.hxx b/editeng/inc/editattr.hxx index f0a6ec58da76..502a5b084605 100644 --- a/editeng/inc/editattr.hxx +++ b/editeng/inc/editattr.hxx @@ -38,7 +38,6 @@ class SvxOverlineItem; class SvxFontHeightItem; class SvxCharScaleWidthItem; class SvxColorItem; -class SvxBackgroundColorItem; class SvxAutoKernItem; class SvxKerningItem; class SvxWordLineModeItem; @@ -301,7 +300,7 @@ public: class EditCharAttribBackgroundColor final : public EditCharAttrib { public: - EditCharAttribBackgroundColor(const SvxBackgroundColorItem& rAttr, + EditCharAttribBackgroundColor(const SvxColorItem& rAttr, sal_Int32 nStart, sal_Int32 nEnd ); virtual void SetFont(SvxFont& rFont, OutputDevice* pOutDev) override; diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index dc5b50395441..5d7da53de477 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -219,7 +219,7 @@ void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* ) EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( - const SvxBackgroundColorItem& rAttr, + const SvxColorItem& rAttr, sal_Int32 _nStart, sal_Int32 _nEnd ) : EditCharAttrib( rAttr, _nStart, _nEnd ) @@ -229,7 +229,7 @@ EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* ) { - Color aColor = static_cast<const SvxBackgroundColorItem*>(GetItem())->GetValue(); + Color aColor = static_cast<const SvxColorItem*>(GetItem())->GetValue(); rFont.SetTransparent(false); rFont.SetFillColor(aColor); } diff --git a/editeng/source/editeng/editdbg.cxx b/editeng/source/editeng/editdbg.cxx index 9a005809d617..18b5747bb5bf 100644 --- a/editeng/source/editeng/editdbg.cxx +++ b/editeng/source/editeng/editdbg.cxx @@ -180,7 +180,7 @@ static OString DbgOutItem(const SfxItemPool& rPool, const SfxPoolItem& rItem) case EE_CHAR_BKGCOLOR: { aDebStr.append("FillColor= "); - Color aColor( static_cast<const SvxBackgroundColorItem&>(rItem).GetValue() ); + Color aColor( static_cast<const SvxColorItem&>(rItem).GetValue() ); aDebStr.append(static_cast<sal_Int32>(aColor.GetRed())); aDebStr.append(", "); aDebStr.append(static_cast<sal_Int32>(aColor.GetGreen())); diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index fcf2f7811e56..2a7f43032245 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -352,7 +352,7 @@ EditCharAttrib* MakeCharAttrib( SfxItemPool& rPool, const SfxPoolItem& rAttr, sa break; case EE_CHAR_BKGCOLOR: { - pNew = new EditCharAttribBackgroundColor( static_cast<const SvxBackgroundColorItem&>(rNew), nS, nE ); + pNew = new EditCharAttribBackgroundColor( static_cast<const SvxColorItem&>(rNew), nS, nE ); } break; default: diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 60165977fc32..f34c4c2f6637 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -2642,7 +2642,7 @@ void EditEngine::SetFontInfoInItemSet( SfxItemSet& rSet, const SvxFont& rFont ) rSet.Put( SvxEscapementItem( rFont.GetEscapement(), rFont.GetPropr(), EE_CHAR_ESCAPEMENT ) ); rSet.Put( SvxWeightItem( rFont.GetWeight(), EE_CHAR_WEIGHT ) ); rSet.Put( SvxColorItem( rFont.GetColor(), EE_CHAR_COLOR ) ); - rSet.Put( SvxBackgroundColorItem( rFont.GetFillColor(), EE_CHAR_BKGCOLOR ) ); + rSet.Put( SvxColorItem( rFont.GetFillColor(), EE_CHAR_BKGCOLOR ) ); rSet.Put( SvxUnderlineItem( rFont.GetUnderline(), EE_CHAR_UNDERLINE ) ); rSet.Put( SvxOverlineItem( rFont.GetOverline(), EE_CHAR_OVERLINE ) ); rSet.Put( SvxCrossedOutItem( rFont.GetStrikeout(), EE_CHAR_STRIKEOUT ) ); diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index a88415565f7e..bc3bb4c82b35 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -140,7 +140,7 @@ DefItems::DefItems() rDefItems[48] = new SvxOverlineItem( LINESTYLE_NONE, EE_CHAR_OVERLINE ); rDefItems[49] = new SvxCaseMapItem( SvxCaseMap::NotMapped, EE_CHAR_CASEMAP ); rDefItems[50] = new SfxGrabBagItem( EE_CHAR_GRABBAG ); - rDefItems[51] = new SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); + rDefItems[51] = new SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ); // Features rDefItems[52] = new SfxVoidItem( EE_FEATURE_TAB ); rDefItems[53] = new SfxVoidItem( EE_FEATURE_LINEBR ); diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index d67bd02df5c1..53f5328890b2 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -93,7 +93,6 @@ SfxPoolItem* SvxAutoKernItem::CreateDefault() {return new SvxAutoKernItem(false, SfxPoolItem* SvxWordLineModeItem::CreateDefault() {return new SvxWordLineModeItem(false, 0);} SfxPoolItem* SvxContourItem::CreateDefault() {return new SvxContourItem(false, 0);} SfxPoolItem* SvxColorItem::CreateDefault() {return new SvxColorItem(0);} -SfxPoolItem* SvxBackgroundColorItem::CreateDefault() {return new SvxBackgroundColorItem(0);} SfxPoolItem* SvxKerningItem::CreateDefault() {return new SvxKerningItem(0, 0);} SfxPoolItem* SvxCaseMapItem::CreateDefault() {return new SvxCaseMapItem(SvxCaseMap::NotMapped, 0);} SfxPoolItem* SvxEscapementItem::CreateDefault() {return new SvxEscapementItem(0);} @@ -1310,117 +1309,6 @@ bool SvxContourItem::GetPresentation return true; } -// class SvxBackgroundColorItem ----------------------------------------- - -SvxBackgroundColorItem::SvxBackgroundColorItem( const sal_uInt16 nId ) : - SfxPoolItem( nId ), - mColor( COL_WHITE ) -{ -} - -SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol, const sal_uInt16 nId ) : - SfxPoolItem( nId ), - mColor( rCol ) -{ -} - -SvxBackgroundColorItem::~SvxBackgroundColorItem() -{ -} - -bool SvxBackgroundColorItem::operator==( const SfxPoolItem& rAttr ) const -{ - 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 = SvxBackgroundColorItem::GetValue(); - - switch( nMemberId ) - { - case MID_GRAPHIC_TRANSPARENT: - { - rVal <<= aColor.GetAlpha() == 0; - break; - } - default: - { - rVal <<= aColor; - break; - } - } - return true; -} - -bool SvxBackgroundColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) -{ - nMemberId &= ~CONVERT_TWIPS; - Color nColor; - Color aColor = SvxBackgroundColorItem::GetValue(); - - switch( nMemberId ) - { - case MID_GRAPHIC_TRANSPARENT: - { - aColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 ); - SvxBackgroundColorItem::SetValue( aColor ); - break; - } - default: - { - if(!(rVal >>= nColor)) - return false; - SvxBackgroundColorItem::SetValue( 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 ), @@ -1456,6 +1344,11 @@ bool SvxColorItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= static_cast<sal_Int16>(basegfx::fround(fTransparency)); break; } + case MID_GRAPHIC_TRANSPARENT: + { + rVal <<= mColor.GetAlpha() == 0; + break; + } default: { rVal <<= mColor; @@ -1481,6 +1374,11 @@ bool SvxColorItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) } return bRet; } + case MID_GRAPHIC_TRANSPARENT: + { + mColor.SetAlpha( Any2Bool( rVal ) ? 0 : 255 ); + return true; + } default: { return rVal >>= mColor; diff --git a/include/IwyuFilter_include.yaml b/include/IwyuFilter_include.yaml index b7696960d04f..d608a87768d8 100644 --- a/include/IwyuFilter_include.yaml +++ b/include/IwyuFilter_include.yaml @@ -757,7 +757,6 @@ excludelist: - class SfxInt16Item - class SvxAdjustItem - class SvxAutoKernItem - - class SvxBackgroundColorItem - class SvxCaseMapItem - class SvxCharReliefItem - class SvxCharScaleWidthItem diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index 8e081fc6aab1..630648adea19 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -60,40 +60,6 @@ public: void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; -// XXX: to be moved in a separate header. -class EDITENG_DLLPUBLIC SvxBackgroundColorItem final : public SfxPoolItem -{ -private: - Color mColor; - -public: - static SfxPoolItem* CreateDefault(); - - SvxBackgroundColorItem(const sal_uInt16 nId); - SvxBackgroundColorItem(const Color& rCol, const sal_uInt16 nId); - virtual ~SvxBackgroundColorItem() override; - - virtual bool operator==(const SfxPoolItem& rPoolItem) const override; - virtual bool QueryValue(css::uno::Any& rVal, sal_uInt8 nMemberId = 0) const override; - virtual bool PutValue(const css::uno::Any& rVal, sal_uInt8 nMemberId) override; - - virtual bool GetPresentation(SfxItemPresentation ePres, - MapUnit eCoreMetric, MapUnit ePresMetric, - OUString &rText, const IntlWrapper& rIntlWrapper) const override; - - virtual SvxBackgroundColorItem* Clone(SfxItemPool* pPool = nullptr) const override; - SvxBackgroundColorItem(SvxBackgroundColorItem const &) = default; // SfxPoolItem copy function dichotomy - - const Color& GetValue() const - { - return mColor; - } - - void SetValue(const Color& rNewColor); - - void dumpAsXml(xmlTextWriterPtr pWriter) const override; -}; - #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/include/editeng/eeitem.hxx b/include/editeng/eeitem.hxx index 667890bf58c4..e4908ee59e0c 100644 --- a/include/editeng/eeitem.hxx +++ b/include/editeng/eeitem.hxx @@ -28,7 +28,6 @@ class SfxGrabBagItem; class SfxInt16Item; class SvxAdjustItem; class SvxAutoKernItem; -class SvxBackgroundColorItem; class SvxCaseMapItem; class SvxCharReliefItem; class SvxCharScaleWidthItem; @@ -127,7 +126,7 @@ constexpr TypedWhichId<SvXMLAttrContainerItem> EE_CHAR_XMLATTRIBS (EE_CHAR_S constexpr TypedWhichId<SvxOverlineItem> EE_CHAR_OVERLINE (EE_CHAR_START+29); constexpr TypedWhichId<SvxCaseMapItem> EE_CHAR_CASEMAP (EE_CHAR_START+30); constexpr TypedWhichId<SfxGrabBagItem> EE_CHAR_GRABBAG (EE_CHAR_START+31); -constexpr TypedWhichId<SvxBackgroundColorItem> EE_CHAR_BKGCOLOR (EE_CHAR_START+32); +constexpr TypedWhichId<SvxColorItem> EE_CHAR_BKGCOLOR (EE_CHAR_START+32); constexpr sal_uInt16 EE_CHAR_END (EE_CHAR_START + 32); diff --git a/sd/qa/unit/export-tests-ooxml1.cxx b/sd/qa/unit/export-tests-ooxml1.cxx index 9395e6eabeab..08504c8286a6 100644 --- a/sd/qa/unit/export-tests-ooxml1.cxx +++ b/sd/qa/unit/export-tests-ooxml1.cxx @@ -207,7 +207,7 @@ public: namespace { template< typename ItemValue, typename ItemType > -void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) +void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId) { CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); @@ -216,7 +216,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) { const ItemType* pAttrib = dynamic_cast<const ItemType *>((*it).pAttr); - if (pAttrib) + if (pAttrib && pAttrib->Which() == nId) { CPPUNIT_ASSERT_EQUAL( nVal, static_cast<ItemValue>(pAttrib->GetValue())); } @@ -289,7 +289,7 @@ void SdOOXMLExportTest1::testBnc887230() // Without the fix in place, this test would have failed with //- Expected: 255 //- Actual : 13421823 - checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff) ); + checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff), EE_CHAR_COLOR ); xDocShRef->DoClose(); } @@ -306,15 +306,15 @@ void SdOOXMLExportTest1::testBnc870233_1() // First shape has red, bold font { const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); - checkFontAttributes<Color, SvxColorItem>( pObj, Color(0xff0000) ); - checkFontAttributes<FontWeight, SvxWeightItem>( pObj, WEIGHT_BOLD ); + checkFontAttributes<Color, SvxColorItem>( pObj, Color(0xff0000), EE_CHAR_COLOR ); + checkFontAttributes<FontWeight, SvxWeightItem>( pObj, WEIGHT_BOLD, EE_CHAR_WEIGHT ); } // Second shape has blue, italic font { const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); - checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff) ); - checkFontAttributes<FontItalic, SvxPostureItem>( pObj, ITALIC_NORMAL ); + checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x0000ff), EE_CHAR_COLOR); + checkFontAttributes<FontItalic, SvxPostureItem>( pObj, ITALIC_NORMAL, EE_CHAR_ITALIC); } xDocShRef->DoClose(); @@ -334,7 +334,7 @@ void SdOOXMLExportTest1::testBnc870233_2() const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(0)); CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); - checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff)); + checkFontAttributes<Color, SvxColorItem>(pObj, Color(0x0000ff), EE_CHAR_COLOR); } // Second smart art has "dk2" font color (style) @@ -342,7 +342,7 @@ void SdOOXMLExportTest1::testBnc870233_2() const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(1)); CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); - checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x1F497D) ); + checkFontAttributes<Color, SvxColorItem>( pObj, Color(0x1F497D), EE_CHAR_COLOR ); } // Third smart art has white font color (style) @@ -350,7 +350,7 @@ void SdOOXMLExportTest1::testBnc870233_2() const SdrObjGroup *pObjGroup = dynamic_cast<SdrObjGroup *>(pPage->GetObj(2)); CPPUNIT_ASSERT(pObjGroup); const SdrTextObj *pObj = dynamic_cast<SdrTextObj *>(pObjGroup->GetSubList()->GetObj(0)); - checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff)); + checkFontAttributes<Color, SvxColorItem>(pObj, Color(0xffffff), EE_CHAR_COLOR); } xDocShRef->DoClose(); diff --git a/sd/qa/unit/export-tests.cxx b/sd/qa/unit/export-tests.cxx index 24797c0bb674..0e6d89297f03 100644 --- a/sd/qa/unit/export-tests.cxx +++ b/sd/qa/unit/export-tests.cxx @@ -18,6 +18,7 @@ #include <editeng/editobj.hxx> #include <editeng/outlobj.hxx> #include <editeng/colritem.hxx> +#include <editeng/eeitem.hxx> #include <svx/svdotext.hxx> #include <svx/svdograf.hxx> @@ -272,7 +273,7 @@ void SdExportTest::testBackgroundImage() namespace { template< typename ItemValue, typename ItemType > -void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) +void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal, sal_uInt32 nId) { CPPUNIT_ASSERT_MESSAGE( "no object", pObj != nullptr); const EditTextObject& aEdit = pObj->GetOutlinerParaObject()->GetTextObject(); @@ -281,7 +282,7 @@ void checkFontAttributes( const SdrTextObj* pObj, ItemValue nVal) for( std::vector<EECharAttrib>::reverse_iterator it = rLst.rbegin(); it!=rLst.rend(); ++it) { const ItemType* pAttrib = dynamic_cast<const ItemType *>((*it).pAttr); - if (pAttrib) + if (pAttrib && pAttrib->Which() == nId) { CPPUNIT_ASSERT_EQUAL( nVal, static_cast<ItemValue>(pAttrib->GetValue())); } @@ -298,10 +299,10 @@ void SdExportTest::testTransparentBackground() const SdrPage *pPage = GetPage( 1, xDocShRef ); const SdrTextObj *pObj1 = dynamic_cast<SdrTextObj *>( pPage->GetObj( 0 ) ); - checkFontAttributes<Color, SvxBackgroundColorItem>( pObj1, COL_TRANSPARENT ); + checkFontAttributes<Color, SvxColorItem>( pObj1, COL_TRANSPARENT, EE_CHAR_BKGCOLOR); const SdrTextObj *pObj2 = dynamic_cast<SdrTextObj *>( pPage->GetObj( 1 ) ); - checkFontAttributes<Color, SvxBackgroundColorItem>( pObj2, COL_YELLOW); + checkFontAttributes<Color, SvxColorItem>( pObj2, COL_YELLOW, EE_CHAR_BKGCOLOR); xDocShRef->DoClose(); } diff --git a/sd/source/core/stlpool.cxx b/sd/source/core/stlpool.cxx index e03b4ca17399..f7744e353b40 100644 --- a/sd/source/core/stlpool.cxx +++ b/sd/source/core/stlpool.cxx @@ -239,7 +239,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, rSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) ); rSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_COLOR) ); - rSet.Put( SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) ); + rSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) ); rSet.Put( XLineStyleItem(css::drawing::LineStyle_NONE) ); rSet.Put( XFillStyleItem(drawing::FillStyle_NONE) ); rSet.Put( SdrTextFitToSizeTypeItem(drawing::TextFitToSizeType_AUTOFIT) ); @@ -354,7 +354,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, rTitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rTitleSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF ) ); rTitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_COLOR )); - rTitleSet.Put(SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR )); + rTitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR )); rTitleSet.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST )); rTitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); // #i16874# enable kerning by default but only for new documents @@ -400,7 +400,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, rSubtitleSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rSubtitleSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF ) ); rSubtitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_COLOR )); - rSubtitleSet.Put(SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR )); + rSubtitleSet.Put(SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR )); rSubtitleSet.Put(SvxAdjustItem(SvxAdjust::Center, EE_PARA_JUST )); rSubtitleSet.Put( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); // #i16874# enable kerning by default but only for new documents @@ -449,7 +449,7 @@ void SdStyleSheetPool::CreateLayoutStyleSheets(std::u16string_view rLayoutName, rNotesSet.Put( SvxEmphasisMarkItem(FontEmphasisMark::NONE, EE_CHAR_EMPHASISMARK ) ); rNotesSet.Put( SvxCharReliefItem(FontRelief::NONE, EE_CHAR_RELIEF) ); rNotesSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_COLOR ) ); - rNotesSet.Put( SvxBackgroundColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) ); + rNotesSet.Put( SvxColorItem( COL_AUTO, EE_CHAR_BKGCOLOR ) ); rNotesSet.Put( SvxLRSpaceItem( 0, 0, 600, -600, EE_PARA_LRSPACE ) ); // #i16874# enable kerning by default but only for new documents rNotesSet.Put( SvxAutoKernItem( true, EE_CHAR_PAIRKERNING ) ); diff --git a/sd/source/ui/func/fuchar.cxx b/sd/source/ui/func/fuchar.cxx index 6b5cad68a973..a1c69e25b041 100644 --- a/sd/source/ui/func/fuchar.cxx +++ b/sd/source/ui/func/fuchar.cxx @@ -85,7 +85,7 @@ void FuChar::DoExecute( SfxRequest& rReq ) if ( pBrushItem ) { - SvxBackgroundColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); + SvxColorItem aBackColorItem( pBrushItem->GetColor(), EE_CHAR_BKGCOLOR ); aOtherSet.ClearItem( SID_ATTR_BRUSH_CHAR ); aOtherSet.Put( aBackColorItem ); } diff --git a/sd/source/ui/func/futempl.cxx b/sd/source/ui/func/futempl.cxx index aeb9251e3002..e75a18b74782 100644 --- a/sd/source/ui/func/futempl.cxx +++ b/sd/source/ui/func/futempl.cxx @@ -385,12 +385,12 @@ void FuTemplate::DoExecute( SfxRequest& rReq ) if (eFamily == SfxStyleFamily::Pseudo) { SfxItemSet aTempSet(*pOutSet); - /* Extract SvxBrushItem out of set and insert SvxBackgroundColorItem */ + /* Extract SvxBrushItem out of set and insert SvxColorItem */ const SvxBrushItem* pBrushItem = aTempSet.GetItem<SvxBrushItem>( SID_ATTR_BRUSH_CHAR ); if ( pBrushItem ) { - SvxBackgroundColorItem aBackColorItem(pBrushItem->GetColor(), EE_CHAR_BKGCOLOR); + SvxColorItem aBackColorItem(pBrushItem->GetColor(), EE_CHAR_BKGCOLOR); aTempSet.ClearItem( EE_CHAR_BKGCOLOR ); aTempSet.Put( aBackColorItem ); } diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index 2c92f0b66d06..4292978d85cf 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -95,7 +95,7 @@ namespace case SID_ATTR_CHAR_BACK_COLOR: { - SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); + SvxColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); pArgs->Put(pBackgroundItem); break; } diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 01120a842903..094cbb806d2b 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -3781,7 +3781,7 @@ void DrawViewShell::ExecChar( SfxRequest &rReq ) case SID_ATTR_CHAR_BACK_COLOR: if( rReq.GetArgs() ) { - const SvxBackgroundColorItem* pItem = rReq.GetArg<SvxBackgroundColorItem>(SID_ATTR_CHAR_BACK_COLOR); + const SvxColorItem* pItem = rReq.GetArg<SvxColorItem>(SID_ATTR_CHAR_BACK_COLOR); if (pItem) { aNewAttr.Put(*pItem); diff --git a/svl/source/items/poolitem.cxx b/svl/source/items/poolitem.cxx index 835bb911a930..599fcd0a0010 100644 --- a/svl/source/items/poolitem.cxx +++ b/svl/source/items/poolitem.cxx @@ -44,7 +44,6 @@ // class SvxBrushItem : public SfxPoolItem // class SvxBulletItem : public SfxPoolItem // class SvxColorItem : public SfxPoolItem -// class SvxBackgroundColorItem : public SvxColorItem // class SvxFontHeightItem : public SfxPoolItem // class SvxFieldItem : public SfxPoolItem // class SvxFontListItem : public SfxPoolItem diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi index e0c4abd4379f..7093e9cd9e0b 100644 --- a/svx/sdi/svx.sdi +++ b/svx/sdi/svx.sdi @@ -1523,8 +1523,8 @@ SvxColorItem Color SID_ATTR_CHAR_COLOR GroupId = SfxGroupId::Format; ] -SvxBackgroundColorItem CharBackColor SID_ATTR_CHAR_BACK_COLOR -(SfxStringItem Color SID_ATTR_COLOR_STR, SvxBackgroundColorItem CharBackColor SID_ATTR_CHAR_BACK_COLOR) +SvxColorItem CharBackColor SID_ATTR_CHAR_BACK_COLOR +(SfxStringItem Color SID_ATTR_COLOR_STR, SvxColorItem CharBackColor SID_ATTR_CHAR_BACK_COLOR) [ AutoUpdate = TRUE, FastCall = FALSE, diff --git a/svx/sdi/svxitems.sdi b/svx/sdi/svxitems.sdi index 36fe52e13867..549ffc3f3227 100644 --- a/svx/sdi/svxitems.sdi +++ b/svx/sdi/svxitems.sdi @@ -170,7 +170,6 @@ item INT16 SvxCharReliefItem; item BOOL SvxBlinkItem; item BOOL SvxAutoKernItem; item INT32 SvxColorItem; -item INT32 SvxBackgroundColorItem; item BOOL SvxContourItem; item INT16 SvxFormatBreakItem; // enum item BOOL SvxFormatKeepItem; diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index da358b617d17..770b46d7e7ba 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -112,7 +112,7 @@ namespace case SID_ATTR_CHAR_BACK_COLOR: { - SvxBackgroundColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); + SvxColorItem pBackgroundItem(aColor, EE_CHAR_BKGCOLOR); pArgs->Put(pBackgroundItem); break; } |