diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-05-06 18:54:18 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-05-07 12:37:37 +0000 |
commit | d7859f40b0b51c88ea78967ace3f62f76d9786c1 (patch) | |
tree | 40d5cf1c7bceb0ef3db7484355901dd6e41c02ef /sd/source/ui/sidebar/SlideBackground.cxx | |
parent | 9613b493172fe9aa8efd9c9c090f82ca2e89cf21 (diff) |
tdf#89466: Switching between different fill types work now
... somehow ...
Change-Id: I6a9ccc60f35a2be092a60c01db04018b736a18b7
Reviewed-on: https://gerrit.libreoffice.org/24706
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd/source/ui/sidebar/SlideBackground.cxx')
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 94 |
1 files changed, 89 insertions, 5 deletions
diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 67ab9fce31f0..8a372131f124 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -220,7 +220,7 @@ void SlideBackground::Update() const SvxColorListItem aItem( *static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); mpFillLB->Fill(aItem.GetColorList()); - const Color aColor = mpColorItem->GetColorValue(); + const Color aColor = GetColorSetOrDefault(); mpFillLB->SelectEntry( aColor ); if(mpFillLB->GetSelectEntryCount() == 0) @@ -241,7 +241,7 @@ void SlideBackground::Update() mpFillLB->Fill(aItem.GetColorList()); mpFillGrad->Fill(aItem.GetColorList()); - const XGradient xGradient = mpGradientItem->GetGradientValue(); + const XGradient xGradient = GetGradientSetOrDefault(); const Color aStartColor = xGradient.GetStartColor(); const Color aEndColor = xGradient.GetEndColor(); mpFillLB->SelectEntry( aStartColor ); @@ -270,7 +270,7 @@ void SlideBackground::Update() mpFillAttr->Fill(aItem.GetHatchList()); mpFillGrad->Hide(); - const OUString aHatchName = mpHatchItem->GetName(); + const OUString aHatchName = GetHatchingSetOrDefault(); mpFillAttr->SelectEntry( aHatchName ); } break; @@ -284,7 +284,7 @@ void SlideBackground::Update() mpFillAttr->Fill(aItem.GetBitmapList()); mpFillGrad->Hide(); - const OUString aBitmapName = mpBitmapItem->GetName(); + const OUString aBitmapName = GetBitmapSetOrDefault(); mpFillAttr->SelectEntry( aBitmapName ); } break; @@ -321,10 +321,65 @@ void SlideBackground::dispose() PanelLayout::dispose(); } +Color SlideBackground::GetColorSetOrDefault() +{ + // Tango Sky Blue 1, to be consistent w/ area fill panel (b/c COL_AUTO for slides is transparent) + if ( !mpColorItem ) + mpColorItem.reset( new XFillColorItem( OUString(), Color(0x72, 0x9f, 0xcf) ) ); + + return mpColorItem->GetColorValue(); +} + +XGradient SlideBackground::GetGradientSetOrDefault() +{ + if( !mpGradientItem ) + { + SfxObjectShell* pSh = SfxObjectShell::Current(); + const SvxGradientListItem aGradListItem(*static_cast<const SvxGradientListItem*>(pSh->GetItem(SID_GRADIENT_LIST))); + const XGradient aGradient = aGradListItem.GetGradientList()->GetGradient(0)->GetGradient(); + const OUString aGradientName = aGradListItem.GetGradientList()->GetGradient(0)->GetName(); + + mpGradientItem.reset( new XFillGradientItem( aGradientName, aGradient ) ); + } + + return mpGradientItem->GetGradientValue(); +} + +const OUString SlideBackground::GetHatchingSetOrDefault() +{ + if( !mpHatchItem ) + { + SfxObjectShell* pSh = SfxObjectShell::Current(); + const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); + const XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(0)->GetHatch(); + const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(0)->GetName(); + + mpHatchItem.reset( new XFillHatchItem( aHatchName, aHatch ) ); + } + + return mpHatchItem->GetName(); +} + +const OUString SlideBackground::GetBitmapSetOrDefault() +{ + if( !mpBitmapItem ) + { + SfxObjectShell* pSh = SfxObjectShell::Current(); + const SvxBitmapListItem aBmpListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); + const GraphicObject aGraphObj = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetGraphicObject(); + const OUString aBmpName = aBmpListItem.GetBitmapList()->GetBitmap(0)->GetName(); + + mpBitmapItem.reset( new XFillBitmapItem( aBmpName, aGraphObj ) ); + } + + return mpBitmapItem->GetName(); +} + void SlideBackground::DataChanged (const DataChangedEvent& /*rEvent*/) { } + void SlideBackground::NotifyItemUpdate( const sal_uInt16 nSID, const SfxItemState eState, @@ -492,7 +547,33 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillStyleModifyHdl, ListBox&, void) const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); const XFillStyleItem aXFillStyleItem(eXFS); Update(); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_FILLSTYLE, SfxCallMode::RECORD, { &aXFillStyleItem }); + + switch (eXFS) + { + case drawing::FillStyle_SOLID: + { + XFillColorItem aItem( OUString(), mpColorItem->GetColorValue() ); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLOR, SfxCallMode::RECORD, { &aItem }); + } + break; + + case drawing::FillStyle_GRADIENT: + { + XFillGradientItem aItem( mpGradientItem->GetName(), mpGradientItem->GetGradientValue() ); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aItem }); + } + break; + + case drawing::FillStyle_HATCH: + { + XFillHatchItem aItem( mpHatchItem->GetName(), mpHatchItem->GetHatchValue() ); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem }); + } + break; + + default: + break; + } } IMPL_LINK_NOARG_TYPED(SlideBackground, PaperSizeModifyHdl, ListBox&, void) @@ -532,6 +613,7 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillColorHdl, ListBox&, void) XGradient aGradient; aGradient.SetStartColor(mpFillLB->GetSelectEntryColor()); aGradient.SetEndColor(mpFillGrad->GetSelectEntryColor()); + XFillGradientItem aItem(aGradient); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aItem }); } @@ -554,6 +636,7 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillBackgroundHdl, ListBox&, void) sal_uInt16 nPos = mpFillAttr->GetSelectEntryPos(); XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetHatch(); const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetName(); + XFillHatchItem aItem(aHatchName, aHatch); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem }); } @@ -565,6 +648,7 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillBackgroundHdl, ListBox&, void) sal_Int16 nPos = mpFillAttr->GetSelectEntryPos(); GraphicObject aBitmap = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); OUString aBitmapName = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetName(); + XFillBitmapItem aItem(aBitmapName, aBitmap); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, SfxCallMode::RECORD, { &aItem }); } |