diff options
Diffstat (limited to 'sw/source/uibase/frmdlg/colex.cxx')
-rw-r--r-- | sw/source/uibase/frmdlg/colex.cxx | 79 |
1 files changed, 54 insertions, 25 deletions
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx index 98b4bad4a852..b1f04173bf80 100644 --- a/sw/source/uibase/frmdlg/colex.cxx +++ b/sw/source/uibase/frmdlg/colex.cxx @@ -20,7 +20,6 @@ #include "cmdid.h" #include "hintids.hxx" #include <algorithm> - #include <svl/eitem.hxx> #include <editeng/lrspitem.hxx> #include <editeng/ulspitem.hxx> @@ -37,6 +36,9 @@ #include "colex.hxx" #include "colmgr.hxx" +//UUUU +#include <svx/unobrushitemhelper.hxx> + // Taking the updated values from the set void SwPageExample::UpdateExample( const SfxItemSet& rSet ) { @@ -114,12 +116,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetHdLeft( rLR.GetLeft() ); SetHdRight( rLR.GetRight() ); SetHeader( true ); - if ( rHeaderSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) + + if(SFX_ITEM_SET == rHeaderSet.GetItemState(RES_BACKGROUND)) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rHeaderSet.Get( RES_BACKGROUND ); - SetHdColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetHdColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rHeaderSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rHeaderSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setHeaderFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if ( rHeaderSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -153,12 +163,20 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) SetFtLeft( rLR.GetLeft() ); SetFtRight( rLR.GetRight() ); SetFooter( true ); + if( rFooterSet.GetItemState( RES_BACKGROUND ) == SFX_ITEM_SET ) { - const SvxBrushItem& rItem = - (const SvxBrushItem&)rFooterSet.Get( RES_BACKGROUND ); - SetFtColor( rItem.GetColor() ); + //UUUU create FillAttributes from SvxBrushItem //SetFtColor(rItem.GetColor()); + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(rFooterSet.Get(RES_BACKGROUND)); + SfxItemSet aTempSet(*rFooterSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setFooterFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } + if( rFooterSet.GetItemState( RES_BOX ) == SFX_ITEM_SET ) { const SvxBoxItem& rItem = @@ -169,19 +187,18 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet ) else SetFooter( false ); } - if( SFX_ITEM_SET == rSet.GetItemState( RES_BACKGROUND, - false, &pItem ) ) - { - SetColor( ( (const SvxBrushItem*)pItem )->GetColor() ); - const Graphic* pGrf = ( (const SvxBrushItem*)pItem )->GetGraphic(); - if ( pGrf ) - { - Bitmap aBitmap = pGrf->GetBitmap(); - SetBitmap( &aBitmap ); - } - else - SetBitmap( NULL ); + if(SFX_ITEM_SET == rSet.GetItemState(RES_BACKGROUND, false, &pItem)) + { + //UUUU create FillAttributes from SvxBrushItem + const SvxBrushItem& rItem = static_cast< const SvxBrushItem& >(*pItem); + SfxItemSet aTempSet(*rSet.GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST); + + setSvxBrushItemAsFillAttributesToTargetSet(rItem, aTempSet); + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + aTempSet))); } Invalidate(); @@ -215,14 +232,23 @@ void SwColExample::DrawPage( const Point& rOrg, - GetFtHeight() - GetFtDist(); DrawRect(aRect); - if(GetColor() == Color(COL_TRANSPARENT)) + //UUUU + const Rectangle aDefineRect(aRect); + + //UUUU + const drawinglayer::attribute::SdrAllFillAttributesHelperPtr& rFillAttributes = getPageFillAttributes(); + + if(!rFillAttributes.get() || !rFillAttributes->isUsed()) { + //UUUU If there is no fill, use fallback color const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); const Color& rFieldColor = rStyleSettings.GetFieldColor(); - SetFillColor( rFieldColor ); + + setPageFillAttributes( + drawinglayer::attribute::SdrAllFillAttributesHelperPtr( + new drawinglayer::attribute::SdrAllFillAttributesHelper( + rFieldColor))); } - else - SetFillColor( GetColor() ); // #97495# make sure that the automatic column width's are always equal bool bAutoWidth = pColMgr->IsAutoWidth(); @@ -242,7 +268,10 @@ void SwColExample::DrawPage( const Point& rOrg, if(!bAutoWidth) nAutoColWidth = pColMgr->GetColWidth( i ); aRect.Right() = aRect.Left() + nAutoColWidth; - DrawRect(aRect); + + //UUUU use primitive draw command + drawFillAttributes(getPageFillAttributes(), aRect, aDefineRect); + if(i < nColumnCount - 1) aRect.Left() = aRect.Right() + pColMgr->GetGutterWidth(i); } |