diff options
author | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-05-04 10:44:43 +0200 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-05-06 16:31:27 +0000 |
commit | 7848ba85695e715a8faaf40c22df133388da5d8c (patch) | |
tree | 85a2bc25a8bd29c92057d2cba260a926372a0925 /sd | |
parent | 77ba88a0beaa78024ef29b8879edce0b7371ad9e (diff) |
tdf#89466: Getting/setting page background works now
Change-Id: I60194adfdca2e4bd9d7d44cc1d43ec14f0774fc3
Reviewed-on: https://gerrit.libreoffice.org/24658
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Tested-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/sdi/_drvwsh.sdi | 8 | ||||
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 9 | ||||
-rw-r--r-- | sd/source/ui/inc/DrawViewShell.hxx | 4 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 54 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 5 | ||||
-rw-r--r-- | sd/source/ui/view/drviews7.cxx | 133 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 5 |
7 files changed, 174 insertions, 44 deletions
diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index bce7cb69eb67..7ed164cb8139 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2624,22 +2624,22 @@ interface DrawView ] SID_ATTR_PAGE_COLOR [ - ExecMethod = FuTemporary ; + ExecMethod = SetPageProperties ; StateMethod = GetPageProperties; ] SID_ATTR_PAGE_GRADIENT [ - ExecMethod = FuTemporary ; + ExecMethod = SetPageProperties ; StateMethod = GetPageProperties ; ] SID_ATTR_PAGE_HATCH [ - ExecMethod = FuTemporary ; + ExecMethod = SetPageProperties ; StateMethod = GetPageProperties ; ] SID_ATTR_PAGE_BITMAP [ - ExecMethod = FuTemporary ; + ExecMethod = SetPageProperties ; StateMethod = GetPageProperties ; ] SID_ATTR_PAGE_FILLSTYLE diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index b33783f9e736..2ac7754b8585 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -154,15 +154,6 @@ void FuPage::DoExecute( SfxRequest& ) ApplyItemSet( mpArgs ); mpView->SetAttributes( *mpArgs ); } - - static sal_uInt16 SidArray[] = { - SID_ATTR_PAGE_COLOR, - SID_ATTR_PAGE_GRADIENT, - SID_ATTR_PAGE_HATCH, - SID_ATTR_PAGE_BITMAP, - SID_ATTR_PAGE_FILLSTYLE, - 0 }; - mpDrawViewShell->GetViewFrame()->GetBindings().Invalidate( SidArray ); } } diff --git a/sd/source/ui/inc/DrawViewShell.hxx b/sd/source/ui/inc/DrawViewShell.hxx index b043f18851b3..b96a0e2bfd6f 100644 --- a/sd/source/ui/inc/DrawViewShell.hxx +++ b/sd/source/ui/inc/DrawViewShell.hxx @@ -148,7 +148,6 @@ public: void GetCtrlState(SfxItemSet& rSet); void GetDrawAttrState(SfxItemSet& rSet); void GetMenuState(SfxItemSet& rSet); - void GetPageProperties(SfxItemSet& rSet); void GetTableMenuState(SfxItemSet& rSet); /** Set the items of the given item set that are related to switching the editing mode to the correct values. @@ -159,6 +158,9 @@ public: void GetAttrState(SfxItemSet& rSet); void GetSnapItemState(SfxItemSet& rSet); + void SetPageProperties (SfxRequest& rReq); + void GetPageProperties(SfxItemSet& rSet); + void GetState (SfxItemSet& rSet); void Execute (SfxRequest& rReq); diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx index 6f0cf41ab3b8..884eca526360 100644 --- a/sd/source/ui/sidebar/SlideBackground.cxx +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -219,6 +219,15 @@ void SlideBackground::Update() mpFillLB->Clear(); const SvxColorListItem aItem( *static_cast<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); mpFillLB->Fill(aItem.GetColorList()); + + const Color aColor = mpColorItem->GetColorValue(); + mpFillLB->SelectEntry( aColor ); + + if(mpFillLB->GetSelectEntryCount() == 0) + { + mpFillLB->InsertEntry(aColor, OUString()); + mpFillLB->SelectEntry(aColor); + } } break; case drawing::FillStyle_GRADIENT: @@ -231,8 +240,27 @@ void SlideBackground::Update() mpFillGrad->Clear(); mpFillLB->Fill(aItem.GetColorList()); mpFillGrad->Fill(aItem.GetColorList()); + + const XGradient xGradient = mpGradientItem->GetGradientValue(); + const Color aStartColor = xGradient.GetStartColor(); + const Color aEndColor = xGradient.GetEndColor(); + mpFillLB->SelectEntry( aStartColor ); + mpFillGrad->SelectEntry( aEndColor ); + + if(mpFillLB->GetSelectEntryCount() == 0) + { + mpFillLB->InsertEntry(aStartColor, OUString()); + mpFillLB->SelectEntry(aStartColor); + } + + if(mpFillGrad->GetSelectEntryCount() == 0) + { + mpFillGrad->InsertEntry(aEndColor, OUString()); + mpFillGrad->SelectEntry(aEndColor); + } } break; + case drawing::FillStyle_HATCH: { mpFillLB->Hide(); @@ -241,8 +269,12 @@ void SlideBackground::Update() mpFillAttr->Clear(); mpFillAttr->Fill(aItem.GetHatchList()); mpFillGrad->Hide(); + + const OUString aHatchName = mpHatchItem->GetName(); + mpFillAttr->SelectEntry( aHatchName ); } break; + case drawing::FillStyle_BITMAP: { mpFillLB->Hide(); @@ -251,8 +283,12 @@ void SlideBackground::Update() mpFillAttr->Clear(); mpFillAttr->Fill(aItem.GetBitmapList()); mpFillGrad->Hide(); + + const OUString aBitmapName = mpBitmapItem->GetName(); + mpFillAttr->SelectEntry( aBitmapName ); } break; + default: break; } @@ -489,12 +525,11 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillColorHdl, ListBox&, void) break; case drawing::FillStyle_GRADIENT: { - const XFillStyleItem aFillStyleItem(drawing::FillStyle_GRADIENT); XGradient aGradient; aGradient.SetStartColor(mpFillLB->GetSelectEntryColor()); aGradient.SetEndColor(mpFillGrad->GetSelectEntryColor()); - XFillGradientItem aItem(mpFillStyle->GetSelectEntry(),aGradient); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aFillStyleItem ,&aItem }); + XFillGradientItem aItem(aGradient); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_GRADIENT, SfxCallMode::RECORD, { &aItem }); } break; default: @@ -511,24 +546,23 @@ IMPL_LINK_NOARG_TYPED(SlideBackground, FillBackgroundHdl, ListBox&, void) case drawing::FillStyle_HATCH: { - //XFillBackgroundItem aBackgroundItem(true); - const XFillStyleItem aFillStyleItem(drawing::FillStyle_HATCH); const SvxHatchListItem aHatchListItem(*static_cast<const SvxHatchListItem*>(pSh->GetItem(SID_HATCH_LIST))); sal_uInt16 nPos = mpFillAttr->GetSelectEntryPos(); XHatch aHatch = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetHatch(); - XFillHatchItem aItem(mpFillStyle->GetSelectEntry(), aHatch); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem, &aFillStyleItem }); + const OUString aHatchName = aHatchListItem.GetHatchList()->GetHatch(nPos)->GetName(); + XFillHatchItem aItem(aHatchName, aHatch); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_HATCH, SfxCallMode::RECORD, { &aItem }); } break; case drawing::FillStyle_BITMAP: { - const XFillStyleItem aFillStyleItem(drawing::FillStyle_BITMAP); SvxBitmapListItem aBitmapListItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); sal_Int16 nPos = mpFillAttr->GetSelectEntryPos(); GraphicObject aBitmap = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetGraphicObject(); - XFillBitmapItem aItem(mpFillStyle->GetSelectEntry(), aBitmap); - GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, SfxCallMode::RECORD, { &aFillStyleItem, &aItem }); + OUString aBitmapName = aBitmapListItem.GetBitmapList()->GetBitmap(nPos)->GetName(); + XFillBitmapItem aItem(aBitmapName, aBitmap); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_BITMAP, SfxCallMode::RECORD, { &aItem }); } break; default: diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index c71c05b66667..340936a65148 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1199,11 +1199,6 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq) } break; - case SID_ATTR_PAGE_COLOR: - case SID_ATTR_PAGE_GRADIENT: - case SID_ATTR_PAGE_HATCH: - case SID_ATTR_PAGE_BITMAP: - case SID_ATTR_PAGE_FILLSTYLE: case SID_SELECT_BACKGROUND: case SID_ATTR_PAGE_SIZE: case SID_ATTR_PAGE: diff --git a/sd/source/ui/view/drviews7.cxx b/sd/source/ui/view/drviews7.cxx index d2d35bc00042..fbc9ef5bb7a7 100644 --- a/sd/source/ui/view/drviews7.cxx +++ b/sd/source/ui/view/drviews7.cxx @@ -44,6 +44,10 @@ #include <svl/whiter.hxx> #include <sfx2/dispatch.hxx> #include <svx/svdograf.hxx> +#include <svx/xflclit.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xflhtit.hxx> +#include <svx/xbtmpit.hxx> #include <editeng/unolingu.hxx> #include <svx/extrusionbar.hxx> #include <svx/fontworkbar.hxx> @@ -1548,16 +1552,6 @@ void DrawViewShell::GetMenuState( SfxItemSet &rSet ) GetModeSwitchingMenuState (rSet); } -void DrawViewShell::GetPageProperties( SfxItemSet &rSet ) -{ - SdPage *pPage = getCurrentPage(); - SvxPageItem aPageItem(SID_ATTR_PAGE); - aPageItem.SetLandscape( pPage->GetOrientation() == ORIENTATION_LANDSCAPE ); - - rSet.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE, pPage->GetSize())); - rSet.Put( aPageItem ); -} - void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet) { //DrawView @@ -1643,6 +1637,125 @@ void DrawViewShell::GetModeSwitchingMenuState (SfxItemSet &rSet) svx::FontworkBar::getState( mpDrawView, rSet ); } +void DrawViewShell::GetPageProperties( SfxItemSet &rSet ) +{ + SdPage *pPage = getCurrentPage(); + + if (pPage != nullptr && GetDoc() != nullptr) + { + SvxPageItem aPageItem(SID_ATTR_PAGE); + aPageItem.SetLandscape( pPage->GetOrientation() == ORIENTATION_LANDSCAPE ); + + rSet.Put(SvxSizeItem( SID_ATTR_PAGE_SIZE, pPage->GetSize() )); + rSet.Put(aPageItem); + + SfxItemSet aMergedAttr(GetDoc()->GetPool(), XATTR_FILL_FIRST, XATTR_FILL_LAST, 0); + SdStyleSheet* pStyleSheet = pPage->getPresentationStyle(HID_PSEUDOSHEET_BACKGROUND); + MergePageBackgroundFilling(pPage, pStyleSheet, meEditMode == EM_MASTERPAGE, aMergedAttr); + + drawing::FillStyle eXFS = (drawing::FillStyle) static_cast<const XFillStyleItem*>( aMergedAttr.GetItem( XATTR_FILLSTYLE ) )->GetValue(); + XFillStyleItem aFillStyleItem( eXFS ); + aFillStyleItem.SetWhich( SID_ATTR_PAGE_FILLSTYLE ); + rSet.Put(aFillStyleItem); + + switch (eXFS) + { + case (drawing::FillStyle_SOLID): + { + Color aColor = static_cast<const XFillColorItem*>( aMergedAttr.GetItem( XATTR_FILLCOLOR ) )->GetColorValue(); + XFillColorItem aFillColorItem( OUString(), aColor ); + aFillColorItem.SetWhich( SID_ATTR_PAGE_COLOR ); + rSet.Put( aFillColorItem ); + } + break; + + case (drawing::FillStyle_GRADIENT): + { + const XGradient& xGradient = static_cast<const XFillGradientItem*>( aMergedAttr.GetItem( XATTR_FILLGRADIENT ) )->GetGradientValue(); + XFillGradientItem aFillGradientItem( OUString(), xGradient, SID_ATTR_PAGE_GRADIENT ); + rSet.Put( aFillGradientItem ); + } + + case (drawing::FillStyle_HATCH): + { + const XFillHatchItem *pFillHatchItem( static_cast<const XFillHatchItem*>( aMergedAttr.GetItem( XATTR_FILLHATCH ) ) ); + XFillHatchItem aFillHatchItem( pFillHatchItem->GetName(), pFillHatchItem->GetHatchValue()); + aFillHatchItem.SetWhich( SID_ATTR_PAGE_HATCH ); + rSet.Put( aFillHatchItem ); + } + + case (drawing::FillStyle_BITMAP): + { + const XFillBitmapItem *pFillBitmapItem = static_cast<const XFillBitmapItem*>( aMergedAttr.GetItem( XATTR_FILLBITMAP ) ); + XFillBitmapItem aFillBitmapItem( pFillBitmapItem->GetName(), pFillBitmapItem->GetGraphicObject() ); + aFillBitmapItem.SetWhich( SID_ATTR_PAGE_BITMAP ); + rSet.Put( aFillBitmapItem ); + } + + default: + break; + } + } +} + +void DrawViewShell::SetPageProperties (SfxRequest& rReq) +{ + SdPage *pPage = getCurrentPage(); + sal_uInt16 nSlotId = rReq.GetSlot(); + const SfxItemSet *pArgs = rReq.GetArgs(); + + if ( pPage && pArgs ) + { + if ( ( nSlotId >= SID_ATTR_PAGE_COLOR ) && ( nSlotId <= SID_ATTR_PAGE_FILLSTYLE ) ) + { + SdrPageProperties& rPageProperties = pPage->getSdrPageProperties(); + rPageProperties.ClearItem(XATTR_FILLSTYLE); + rPageProperties.ClearItem(XATTR_FILLGRADIENT); + rPageProperties.ClearItem(XATTR_FILLHATCH); + rPageProperties.ClearItem(XATTR_FILLBITMAP); + + switch (nSlotId) + { + case(SID_ATTR_PAGE_COLOR): + { + XFillColorItem aColorItem( static_cast<const XFillColorItem&>(pArgs->Get( XATTR_FILLCOLOR )) ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_SOLID ) ); + rPageProperties.PutItem( XFillColorItem( aColorItem )); + } + break; + + case(SID_ATTR_PAGE_GRADIENT): + { + XFillGradientItem aGradientItem( static_cast<const XFillGradientItem&>(pArgs->Get( XATTR_FILLGRADIENT )) ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_GRADIENT ) ); + rPageProperties.PutItem( XFillGradientItem( aGradientItem ) ); + } + break; + + case(SID_ATTR_PAGE_HATCH): + { + XFillHatchItem aHatchItem( static_cast<const XFillHatchItem&>(pArgs->Get( XATTR_FILLHATCH )) ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_HATCH ) ); + rPageProperties.PutItem( XFillHatchItem( aHatchItem )); + } + break; + + case(SID_ATTR_PAGE_BITMAP): + { + XFillBitmapItem aBitmapItem( static_cast<const XFillBitmapItem&>(pArgs->Get( XATTR_FILLBITMAP )) ); + rPageProperties.PutItem( XFillStyleItem( drawing::FillStyle_BITMAP ) ); + rPageProperties.PutItem( XFillBitmapItem( aBitmapItem )); + } + break; + + default: + break; + } + } + } +} + + void DrawViewShell::GetState (SfxItemSet& rSet) { // Iterate over all requested items in the set. diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 81cfae06eae3..15bb40e9aa6c 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -385,15 +385,10 @@ void DrawViewShell::GetAttrState( SfxItemSet& rSet ) } break; case SID_ATTR_FILL_STYLE: - case SID_ATTR_PAGE_FILLSTYLE: case SID_ATTR_FILL_COLOR: - case SID_ATTR_PAGE_COLOR: case SID_ATTR_FILL_GRADIENT: - case SID_ATTR_PAGE_GRADIENT: case SID_ATTR_FILL_HATCH: - case SID_ATTR_PAGE_HATCH: case SID_ATTR_FILL_BITMAP: - case SID_ATTR_PAGE_BITMAP: case SID_ATTR_FILL_SHADOW: case SID_ATTR_SHADOW_COLOR: case SID_ATTR_SHADOW_TRANSPARENCE: |