diff options
author | matteocam <matteo.campanelli@gmail.com> | 2014-05-29 16:31:28 -0400 |
---|---|---|
committer | Fridrich Štrba <fridrich.strba@bluewin.ch> | 2014-06-30 22:54:39 +0200 |
commit | 4693d7cc99fa4b659f834e703b8bbb0424d55fee (patch) | |
tree | 64e8950f4c47f962dc654c40c00785941b4faffa | |
parent | a74e588518df1a3f5e7209e52dcaccf38ae88e56 (diff) |
Added class SvxBackgroundColorItem
Change-Id: If10795bbbd9fc911896b57bbab5410bc1e62f71f
(cherry picked from commit ad6a2607f09d2f770e683a21ad7243a077d65a7a)
-rw-r--r-- | editeng/source/editeng/editattr.cxx | 23 | ||||
-rw-r--r-- | editeng/source/editeng/editattr.hxx | 13 | ||||
-rw-r--r-- | editeng/source/items/textitem.cxx | 39 | ||||
-rw-r--r-- | include/editeng/colritem.hxx | 25 |
4 files changed, 99 insertions, 1 deletions
diff --git a/editeng/source/editeng/editattr.cxx b/editeng/source/editeng/editattr.cxx index bfd0c388150a..87f456f13605 100644 --- a/editeng/source/editeng/editattr.cxx +++ b/editeng/source/editeng/editattr.cxx @@ -136,7 +136,6 @@ void EditCharAttribUnderline::SetFont( SvxFont& rFont, OutputDevice* pOutDev ) //pOutDev->SetTextLineColor( ((const SvxUnderlineItem*)GetItem())->GetColor() ); // FIXME(matteocam) - if ( pOutDev ) pOutDev->SetTextFillColor(aColor); } @@ -230,6 +229,28 @@ void EditCharAttribColor::SetFont( SvxFont& rFont, OutputDevice* ) //fprintf(stderr, "Called SetFont with Color %d\n", aColor.GetColor()); } +// class EditCharAttribBackgroundColor + +EditCharAttribBackgroundColor::EditCharAttribBackgroundColor( + const SvxBackgroundColorItem& rAttr, + sal_uInt16 _nStart, + sal_uInt16 _nEnd ) + : EditCharAttrib( rAttr, _nStart, _nEnd ) +{ + // FIXME(matteocam) + //DBG_ASSERT( rAttr.Which() == EE_CHAR_BKG_COLOR, "Not a BackgroundColor attribute!" ); +} + +void EditCharAttribBackgroundColor::SetFont( SvxFont& rFont, OutputDevice* ) +{ + /* FIXME(matteocam) + * + Color aColor = ((const SvxBackgroundColorItem*)GetItem())->GetValue(); + rFont.SetFillColor( aColor); // XXX: Is it SetFillColor we want? + */ + +} + // class EditCharAttribLanguage diff --git a/editeng/source/editeng/editattr.hxx b/editeng/source/editeng/editattr.hxx index 81ecb1952b48..74244179b018 100644 --- a/editeng/source/editeng/editattr.hxx +++ b/editeng/source/editeng/editattr.hxx @@ -38,6 +38,7 @@ class SvxOverlineItem; class SvxFontHeightItem; class SvxCharScaleWidthItem; class SvxColorItem; +class SvxBackgroundColorItem; class SvxAutoKernItem; class SvxKerningItem; class SvxWordLineModeItem; @@ -308,6 +309,18 @@ public: virtual void SetFont( SvxFont& rFont, OutputDevice* pOutDev ) SAL_OVERRIDE; }; +// class EditCharAttribBackgroundColor + +class EditCharAttribBackgroundColor : public EditCharAttrib +{ +public: + EditCharAttribBackgroundColor(const SvxBackgroundColorItem& rAttr, + sal_uInt16 nStart, + sal_uInt16 nEnd ); + virtual void SetFont(SvxFont& rFont, OutputDevice* pOutDev) SAL_OVERRIDE; +}; + + // class EditCharAttribLanguage diff --git a/editeng/source/items/textitem.cxx b/editeng/source/items/textitem.cxx index eb7aaecb2ac0..ca4d0f72a8a7 100644 --- a/editeng/source/items/textitem.cxx +++ b/editeng/source/items/textitem.cxx @@ -122,6 +122,8 @@ TYPEINIT1_FACTORY(SvxWordLineModeItem, SfxBoolItem, new SvxWordLineModeItem(fals TYPEINIT1_FACTORY(SvxContourItem, SfxBoolItem, new SvxContourItem(false, 0)); TYPEINIT1_FACTORY(SvxPropSizeItem, SfxUInt16Item, new SvxPropSizeItem(100, 0)); TYPEINIT1_FACTORY(SvxColorItem, SfxPoolItem, new SvxColorItem(0)); +// FIXME(matteocam): Should 2nd argoment of next line SfxColorItem or SfxPoolItem? +TYPEINIT1_FACTORY(SvxBackgroundColorItem, SvxColorItem, new SvxBackgroundColorItem(0)); TYPEINIT1_FACTORY(SvxCharSetColorItem, SvxColorItem, new SvxCharSetColorItem(0)); TYPEINIT1_FACTORY(SvxKerningItem, SfxInt16Item, new SvxKerningItem(0, 0)); TYPEINIT1_FACTORY(SvxCaseMapItem, SfxEnumItem, new SvxCaseMapItem(SVX_CASEMAP_NOT_MAPPED, 0)); @@ -1907,6 +1909,43 @@ SfxItemPresentation SvxPropSizeItem::GetPresentation return SFX_ITEM_PRESENTATION_NONE; } +// class SvxBackgroundColorItem ----------------------------------------- + +SvxBackgroundColorItem::SvxBackgroundColorItem( const sal_uInt16 nId ) : + SvxColorItem( nId ) +{ +} + + + +SvxBackgroundColorItem::SvxBackgroundColorItem( const Color& rCol, + const sal_uInt16 nId ) : + SvxColorItem( rCol, nId ) +{ +} + +SvxBackgroundColorItem:: SvxBackgroundColorItem( SvStream& rStrm, const sal_uInt16 Id ) : + SvxColorItem( rStrm, Id ) +{ +} + +SvxBackgroundColorItem::SvxBackgroundColorItem( const SvxBackgroundColorItem& rCopy ) : + SvxColorItem( rCopy ) +{ +} + +SfxPoolItem* SvxBackgroundColorItem::Clone( SfxItemPool * ) const +{ + return new SvxBackgroundColorItem( *this ); +} + + +SfxPoolItem* SvxBackgroundColorItem::Create(SvStream& rStrm, sal_uInt16 ) const +{ + return new SvxBackgroundColorItem( rStrm, Which() ); +} + + // class SvxColorItem ---------------------------------------------------- SvxColorItem::SvxColorItem( const sal_uInt16 nId ) : diff --git a/include/editeng/colritem.hxx b/include/editeng/colritem.hxx index fc82bd282935..815d2ed3f3d1 100644 --- a/include/editeng/colritem.hxx +++ b/include/editeng/colritem.hxx @@ -77,6 +77,31 @@ public: }; +/* + * FIXME(matteocam): + * both classes Svx{Background,}Color should be derived from a + * common ancestor or be totally separate (not recommended probably). +*/ + +// class SvxBackgroundColorItem + +// XXX: to be moved in a separate header. +class EDITENG_DLLPUBLIC SvxBackgroundColorItem : public SvxColorItem +{ + public: + TYPEINFO_OVERRIDE(); + + SvxBackgroundColorItem( const sal_uInt16 nId ); + SvxBackgroundColorItem( const Color& rCol, + const sal_uInt16 nId ); + SvxBackgroundColorItem( SvStream& rStrm, const sal_uInt16 nId ); + SvxBackgroundColorItem( const SvxBackgroundColorItem& rCopy ); + + virtual SfxPoolItem* Clone( SfxItemPool *pPool = 0 ) const SAL_OVERRIDE; + virtual SfxPoolItem* Create(SvStream &, sal_uInt16) const SAL_OVERRIDE; + +}; + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |