From 93b4bf647a5899f54ef51f8b4bfed0faa66b466e Mon Sep 17 00:00:00 2001 From: Rishabh Kumar Date: Fri, 31 Jul 2015 02:28:28 +0530 Subject: tdf#89466: Slide Background tab Change-Id: Ic3ba6b47a1e5fcaeec76c4e4ff0ba6128653af86 Reviewed-on: https://gerrit.libreoffice.org/17007 Tested-by: Jenkins Reviewed-by: Katarina Behrens --- sd/Library_sd.mk | 1 + sd/UIConfig_simpress.mk | 1 + sd/sdi/_drvwsh.sdi | 30 ++ sd/source/ui/func/fupage.cxx | 13 +- sd/source/ui/sidebar/PanelFactory.cxx | 3 + sd/source/ui/sidebar/SlideBackground.cxx | 525 ++++++++++++++++++++++ sd/source/ui/sidebar/SlideBackground.hxx | 119 +++++ sd/source/ui/view/drviews2.cxx | 7 +- sd/source/ui/view/drviews9.cxx | 13 + sd/source/ui/view/drviewsf.cxx | 5 + sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 245 ++++++++++ 11 files changed, 960 insertions(+), 2 deletions(-) create mode 100644 sd/source/ui/sidebar/SlideBackground.cxx create mode 100644 sd/source/ui/sidebar/SlideBackground.hxx create mode 100644 sd/uiconfig/simpress/ui/sidebarslidebackground.ui (limited to 'sd') diff --git a/sd/Library_sd.mk b/sd/Library_sd.mk index c54bd6dabf72..76e35ae4a4bc 100644 --- a/sd/Library_sd.mk +++ b/sd/Library_sd.mk @@ -341,6 +341,7 @@ $(eval $(call gb_Library_add_exception_objects,sd,\ sd/source/ui/sidebar/RecentlyUsedMasterPages \ sd/source/ui/sidebar/RecentMasterPagesSelector \ sd/source/ui/sidebar/SlideTransitionPanel \ + sd/source/ui/sidebar/SlideBackground \ sd/source/ui/sidebar/TableDesignPanel \ sd/source/ui/slideshow/PaneHider \ sd/source/ui/slideshow/SlideShowRestarter \ diff --git a/sd/UIConfig_simpress.mk b/sd/UIConfig_simpress.mk index 531175a49a8c..bcb61601c2b3 100644 --- a/sd/UIConfig_simpress.mk +++ b/sd/UIConfig_simpress.mk @@ -127,6 +127,7 @@ $(eval $(call gb_UIConfig_add_uifiles,modules/simpress,\ sd/uiconfig/simpress/ui/publishingdialog \ sd/uiconfig/simpress/ui/remotedialog \ sd/uiconfig/simpress/ui/sdviewpage \ + sd/uiconfig/simpress/ui/sidebarslidebackground \ sd/uiconfig/simpress/ui/slidedesigndialog \ sd/uiconfig/simpress/ui/slidetransitionspanel \ sd/uiconfig/simpress/ui/tabledesignpanel \ diff --git a/sd/sdi/_drvwsh.sdi b/sd/sdi/_drvwsh.sdi index c8b3d53166aa..e74034d730ea 100644 --- a/sd/sdi/_drvwsh.sdi +++ b/sd/sdi/_drvwsh.sdi @@ -2612,6 +2612,36 @@ interface DrawView ExecMethod = FuTemporary ; StateMethod = GetMenuState ; ] + SID_ATTR_PAGE_SIZE + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_ATTR_PAGE_COLOR + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState; + ] + SID_ATTR_PAGE_GRADIENT + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_ATTR_PAGE_HATCH + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_ATTR_PAGE_BITMAP + [ + ExecMethod = FuTemporary ; + StateMethod = GetMenuState ; + ] + SID_ATTR_PAGE_FILLSTYLE + [ + ExecMethod = FuTemporary; + StateMethod = GetMenuState; + ] SID_DISPLAY_MASTER_BACKGROUND [ ExecMethod = FuTemporary ; diff --git a/sd/source/ui/func/fupage.cxx b/sd/source/ui/func/fupage.cxx index eda465c25288..cb2ecda96154 100644 --- a/sd/source/ui/func/fupage.cxx +++ b/sd/source/ui/func/fupage.cxx @@ -42,7 +42,7 @@ #include #include #include - +#include #include "glob.hrc" #include #include @@ -148,6 +148,15 @@ void FuPage::DoExecute( SfxRequest& ) // if we now have arguments, apply them to current page if( mpArgs ) ApplyItemSet( 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 ); } } @@ -213,6 +222,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_OUTER, SID_ATTR_BORDER_SHADOW, SID_ATTR_BORDER_SHADOW, XATTR_FILL_FIRST, XATTR_FILL_LAST, + SID_ATTR_PAGE_COLOR,SID_ATTR_PAGE_FILLSTYLE, EE_PARA_WRITINGDIR, EE_PARA_WRITINGDIR, 0); @@ -324,6 +334,7 @@ const SfxItemSet* FuPage::ExecuteDialog( vcl::Window* pParent ) } } } + else { // create the dialog diff --git a/sd/source/ui/sidebar/PanelFactory.cxx b/sd/source/ui/sidebar/PanelFactory.cxx index 8939525859ba..12b629b27fd3 100644 --- a/sd/source/ui/sidebar/PanelFactory.cxx +++ b/sd/source/ui/sidebar/PanelFactory.cxx @@ -30,6 +30,7 @@ #include "NavigatorWrapper.hxx" #include "SlideTransitionPanel.hxx" #include "TableDesignPanel.hxx" +#include #include #include @@ -129,6 +130,8 @@ Reference SAL_CALL PanelFactory::createUIElement ( pControl = VclPtr::Create(pParentWindow, *pBase); else if (EndsWith(rsUIElementResourceURL, "/NavigatorPanel")) pControl = VclPtr::Create(pParentWindow, *pBase, pBindings); + else if (EndsWith(rsUIElementResourceURL, "/SlideBackgroundPanel")) + pControl = VclPtr::Create(pParentWindow, *pBase, xFrame, pBindings); #undef EndsWith if (!pControl) diff --git a/sd/source/ui/sidebar/SlideBackground.cxx b/sd/source/ui/sidebar/SlideBackground.cxx new file mode 100644 index 000000000000..3ad3e56166ca --- /dev/null +++ b/sd/source/ui/sidebar/SlideBackground.cxx @@ -0,0 +1,525 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include +#include "SlideBackground.hxx" +#include "TransitionPreset.hxx" +#include "sdresid.hxx" +#include "ViewShellBase.hxx" +#include "DrawDocShell.hxx" +#include "SlideSorterViewShell.hxx" +#include "drawdoc.hxx" +#include "filedlg.hxx" +#include "strings.hrc" +#include "drawdoc.hxx" +#include "DocumentHelper.hxx" +#include "MasterPagesSelector.hxx" +#include "DrawViewShell.hxx" +#include "DrawController.hxx" +#include +#include "sdresid.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include "app.hrc" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace ::com::sun::star; + +using ::com::sun::star::uno::Reference; + + +namespace sd { namespace sidebar { + +SlideBackground::SlideBackground( + Window * pParent, + ViewShellBase& rBase, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings + ) : + PanelLayout( pParent, "SlideBackground", "modules/simpress/ui/sidebarslidebackground.ui", rxFrame ), + mrBase( rBase ), + maPaperController(SID_ATTR_PAGE_SIZE, *pBindings, *this), + maBckColorController(SID_ATTR_PAGE_COLOR, *pBindings, *this), + maBckGradientController(SID_ATTR_PAGE_GRADIENT, *pBindings, *this), + maBckHatchController(SID_ATTR_PAGE_HATCH, *pBindings, *this), + maBckBitmapController(SID_ATTR_PAGE_BITMAP, *pBindings, *this), + maBckFillStyleController(SID_ATTR_PAGE_FILLSTYLE, *pBindings, *this), + maBckImageController(SID_SELECT_BACKGROUND, *pBindings, *this), + maDspBckController(SID_DISPLAY_MASTER_BACKGROUND, *pBindings, *this), + maDspObjController(SID_DISPLAY_MASTER_OBJECTS, *pBindings, *this), + maMetricController(SID_ATTR_METRIC, *pBindings, *this), + mpFillStyleItem(), + mpColorItem(), + mpGradientItem(), + mpHatchItem(), + mpBitmapItem(), + mpBindings(pBindings) +{ + get(mpPaperSizeBox,"paperformat"); + get(mpPaperOrientation, "orientation"); + get(mpMasterSlide, "masterslide"); + get(mpFillAttr, "fillattr1"); + get(mpFillGrad, "fillattr2"); + get(mpFillStyle, "fillstyle"); + get(mpFillLB, "fillattr"); + get(mpDspMasterBackground, "displaymasterbackground"); + get(mpDspMasterObjects, "displaymasterobjects"); + Initialize(); +} + +SlideBackground::~SlideBackground() +{ + disposeOnce(); +} + +void SlideBackground::Initialize() +{ + mpPaperSizeBox->SetSelectHdl(LINK(this,SlideBackground,PaperSizeModifyHdl)); + mpPaperOrientation->SetSelectHdl(LINK(this,SlideBackground,PaperSizeModifyHdl)); + + ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>( SfxObjectShell::Current() ); + SdDrawDocument* pDoc = pDocSh->GetDoc(); + sal_uInt16 nCount = pDoc->GetMasterPageCount(); + for( sal_uInt16 nLayout = 0; nLayout < nCount; nLayout++ ) + { + SdPage* pMaster = static_cast(pDoc->GetMasterPage(nLayout)); + if( pMaster->GetPageKind() == PK_STANDARD) + { + OUString aLayoutName(pMaster->GetLayoutName()); + aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR)); + mpMasterSlide->InsertEntry(aLayoutName); + } + } + + meUnit = maPaperController.GetCoreMetric(); + + mpMasterSlide->SetSelectHdl(LINK(this, SlideBackground, AssignMasterPage)); + + mpFillStyle->SetSelectHdl(LINK(this, SlideBackground, FillStyleModifyHdl)); + mpFillLB->SetSelectHdl(LINK(this, SlideBackground, FillColorHdl)); + mpFillGrad->SetSelectHdl(LINK(this, SlideBackground, FillColorHdl)); + mpFillAttr->SetSelectHdl(LINK(this, SlideBackground, FillBackgroundHdl)); + + ViewShell* pMainViewShell = mrBase.GetMainViewShell().get(); + DrawViewShell* pDrawViewShell = static_cast(pMainViewShell); + SdPage* mpPage = pDrawViewShell->getCurrentPage(); + OUString aLayoutName( mpPage->GetLayoutName() ); + aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(SD_LT_SEPARATOR)); + mpMasterSlide->SelectEntry(aLayoutName); + mpFillStyle->SelectEntryPos(0); + + mpDspMasterBackground->SetClickHdl(LINK(this, SlideBackground, DspBackground)); + mpDspMasterObjects->SetClickHdl(LINK(this,SlideBackground, DspObjects)); + + Update(); +} + +void SlideBackground::Update() +{ + const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + switch(eXFS) + { + case drawing::FillStyle_NONE: + { + mpFillLB->Hide(); + mpFillAttr->Hide(); + mpFillGrad->Hide(); + } + break; + case drawing::FillStyle_SOLID: + { + mpFillAttr->Hide(); + mpFillGrad->Hide(); + mpFillLB->Show(); + mpFillLB->Clear(); + const SvxColorListItem aItem( *static_cast(pSh->GetItem(SID_COLOR_TABLE))); + mpFillLB->Fill(aItem.GetColorList()); + } + break; + case drawing::FillStyle_GRADIENT: + { + mpFillLB->Show(); + const SvxColorListItem aItem(*static_cast(pSh->GetItem(SID_COLOR_TABLE))); + mpFillAttr->Hide(); + mpFillGrad->Show(); + mpFillLB->Clear(); + mpFillGrad->Clear(); + mpFillLB->Fill(aItem.GetColorList()); + mpFillGrad->Fill(aItem.GetColorList()); + } + break; + case drawing::FillStyle_HATCH: + { + mpFillLB->Hide(); + const SvxHatchListItem aItem(*static_cast(pSh->GetItem(SID_HATCH_LIST))); + mpFillAttr->Show(); + mpFillAttr->Clear(); + mpFillAttr->Fill(aItem.GetHatchList()); + mpFillGrad->Hide(); + } + break; + case drawing::FillStyle_BITMAP: + { + mpFillLB->Hide(); + const SvxBitmapListItem aItem(*static_cast(pSh->GetItem(SID_BITMAP_LIST))); + mpFillAttr->Show(); + mpFillAttr->Clear(); + mpFillAttr->Fill(aItem.GetBitmapList()); + mpFillGrad->Hide(); + } + break; + default: + break; + } +} + +void SlideBackground::dispose() +{ + mpPaperSizeBox.clear(); + mpPaperOrientation.clear(); + mpMasterSlide.clear(); + mpFillAttr.clear(); + mpFillGrad.clear(); + mpFillStyle.clear(); + mpFillLB.clear(); + mpDspMasterBackground.clear(); + mpDspMasterObjects.clear(); + + maPaperController.dispose(); + maBckColorController.dispose(); + maBckGradientController.dispose(); + maBckHatchController.dispose(); + maBckBitmapController.dispose(); + maBckFillStyleController.dispose(); + maBckImageController.dispose(); + maDspBckController.dispose(); + maDspObjController.dispose(); + maMetricController.dispose(); + + PanelLayout::dispose(); +} + +void SlideBackground::DataChanged (const DataChangedEvent& /*rEvent*/) +{ + +} +void SlideBackground::NotifyItemUpdate( + const sal_uInt16 nSID, + const SfxItemState eState, + const SfxPoolItem* pState, + const bool bIsEnabled) +{ + (void)bIsEnabled; + + switch(nSID) + { + + case SID_ATTR_PAGE_COLOR: + { + if(eState >= SfxItemState::DEFAULT) + { + mpFillStyle->SelectEntryPos(1); + mpColorItem.reset(pState ? static_cast< XFillColorItem* >(pState->Clone()) : 0); + Update(); + } + } + break; + + case SID_ATTR_PAGE_HATCH: + { + if(eState >= SfxItemState::DEFAULT) + { + mpFillStyle->SelectEntryPos(3); + mpHatchItem.reset(pState ? static_cast < XFillHatchItem* >(pState->Clone()) : 0); + Update(); + } + } + break; + + case SID_ATTR_PAGE_GRADIENT: + { + if(eState >= SfxItemState::DEFAULT) + { + mpFillStyle->SelectEntryPos(2); + mpGradientItem.reset(pState ? static_cast< XFillGradientItem* >(pState->Clone()) : 0); + Update(); + } + } + break; + case SID_ATTR_PAGE_BITMAP: + { + if(eState >= SfxItemState::DEFAULT) + { + mpFillStyle->SelectEntryPos(4); + mpBitmapItem.reset(pState ? static_cast< XFillBitmapItem* >(pState->Clone()) : 0); + Update(); + } + } + break; + + case SID_ATTR_PAGE_FILLSTYLE: + { + if(eState >= SfxItemState::DEFAULT) + { + const XFillStyleItem* aFillStyleItem = dynamic_cast< const XFillStyleItem* >(pState); + css::drawing::FillStyle eXFS = aFillStyleItem->GetValue(); + switch(eXFS) + { + case drawing::FillStyle_NONE: + mpFillStyle->SelectEntryPos(0); + break; + case drawing::FillStyle_SOLID: + mpFillStyle->SelectEntryPos(1); + break; + case drawing::FillStyle_GRADIENT: + mpFillStyle->SelectEntryPos(2); + break; + case drawing::FillStyle_HATCH: + mpFillStyle->SelectEntryPos(3); + break; + case drawing::FillStyle_BITMAP: + mpFillStyle->SelectEntryPos(4); + break; + default: + break; + } + Update(); + } + } + break; + + case SID_ATTR_PAGE_SIZE: + { + if(eState >= SfxItemState::DEFAULT) + { + const SvxSizeItem* aSizeItem = dynamic_cast< const SvxSizeItem* >(pState); + Size aPaperSize = aSizeItem->GetSize(); + //Paper ePaper = SvxPaperInfo::GetSvxPaper(aPaperSize, MAP_100TH_MM,true); + if( aPaperSize.Width() > aPaperSize.Height() ) + mpPaperOrientation->SelectEntryPos(0); + else + mpPaperOrientation->SelectEntryPos(1); + } + } + break; + + case SID_DISPLAY_MASTER_BACKGROUND: + { + const SfxBoolItem* aBoolItem = dynamic_cast< const SfxBoolItem* >(pState); + if(aBoolItem->GetValue()) + mpDspMasterBackground->SetState(TRISTATE_TRUE); + else + mpDspMasterBackground->SetState(TRISTATE_FALSE); + } + break; + case SID_DISPLAY_MASTER_OBJECTS: + { + const SfxBoolItem* aBoolItem = dynamic_cast< const SfxBoolItem* >(pState); + if(aBoolItem->GetValue()) + mpDspMasterObjects->SetState(TRISTATE_TRUE); + else + mpDspMasterObjects->SetState(TRISTATE_FALSE); + } + break; + + case SID_SELECT_BACKGROUND: + { + if(eState >= SfxItemState::DEFAULT) + { + mpFillStyle->SelectEntryPos(4); + Update(); + } + } + break; + default: + break; + } +} +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 }); +} +IMPL_LINK_NOARG_TYPED(SlideBackground, PaperSizeModifyHdl, ListBox&, void) +{ + sal_uInt32 nPos = mpPaperSizeBox->GetSelectEntryPos(); + Paper ePaper = PAPER_USER; + switch(nPos) + { + case 0: ePaper = PAPER_A6;break; + case 1: ePaper = PAPER_A5;break; + case 2: ePaper = PAPER_A4;break; + case 3: ePaper = PAPER_A3;break; + case 4: ePaper = PAPER_A2;break; + case 5: ePaper = PAPER_A1;break; + case 6 :ePaper = PAPER_A0;break; + case 7: ePaper = PAPER_B6_ISO;break; + case 8: ePaper = PAPER_B5_ISO;break; + case 9: ePaper = PAPER_B4_ISO;break; + case 10: ePaper = PAPER_LETTER;break; + case 11: ePaper = PAPER_LEGAL;break; + case 12: ePaper = PAPER_FANFOLD_LEGAL_DE;break; + case 13: ePaper = PAPER_TABLOID;break; + case 14: ePaper = PAPER_B6_JIS;break; + case 15: ePaper = PAPER_B5_JIS;break; + case 16: ePaper = PAPER_B4_JIS;break; + case 17: ePaper = PAPER_KAI16;break; + case 18: ePaper = PAPER_KAI32;break; + case 19: ePaper = PAPER_KAI32BIG;break; + case 20: ePaper = PAPER_USER;break; + case 21: ePaper = PAPER_ENV_DL;break; + case 22: ePaper = PAPER_ENV_C6;break; + case 23: ePaper = PAPER_ENV_C65;break; + case 24: ePaper = PAPER_ENV_C5;break; + case 25: ePaper = PAPER_ENV_C4;break; + case 26: ePaper = PAPER_SLIDE_DIA;break; + case 27: ePaper = PAPER_SCREEN_4_3;break; + case 28: ePaper = PAPER_SCREEN_16_9;break; + case 29: ePaper = PAPER_SCREEN_16_10;break; + case 30: ePaper = PAPER_POSTCARD_JP;break; + default: + break; + } + Size aSize(SvxPaperInfo::GetPaperSize(ePaper, (MapUnit)(meUnit))); + + if(mpPaperOrientation->GetSelectEntryPos() == 0) + Swap(aSize); + + SvxSizeItem aSizeItem(SID_ATTR_PAGE_SIZE,aSize); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_SIZE, SfxCallMode::RECORD, { &aSizeItem }); +} + +IMPL_LINK_NOARG_TYPED(SlideBackground, FillColorHdl, ListBox&, void) +{ + const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); + switch(eXFS) + { + case drawing::FillStyle_SOLID: + { + XFillColorItem aItem(OUString(), mpFillLB->GetSelectEntryColor()); + GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_PAGE_COLOR, SfxCallMode::RECORD, { &aItem }); + } + 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 }); + } + break; + default: + break; + } +} + +IMPL_LINK_NOARG_TYPED(SlideBackground, FillBackgroundHdl, ListBox&, void) +{ + const drawing::FillStyle eXFS = (drawing::FillStyle)mpFillStyle->GetSelectEntryPos(); + SfxObjectShell* pSh = SfxObjectShell::Current(); + switch(eXFS) + { + + case drawing::FillStyle_HATCH: + { + //XFillBackgroundItem aBackgroundItem(true); + const XFillStyleItem aFillStyleItem(drawing::FillStyle_HATCH); + const SvxHatchListItem aHatchListItem(*static_cast(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 }); + } + break; + + case drawing::FillStyle_BITMAP: + { + const XFillStyleItem aFillStyleItem(drawing::FillStyle_BITMAP); + SvxBitmapListItem aBitmapListItem(*static_cast(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 }); + } + break; + default: + break; + } +} + +IMPL_LINK_NOARG_TYPED(SlideBackground, AssignMasterPage, ListBox&, void) +{ + ::sd::DrawDocShell* pDocSh = dynamic_cast<::sd::DrawDocShell*>( SfxObjectShell::Current() ); + SdDrawDocument* mpDoc = pDocSh->GetDoc(); + sal_uInt16 nSelectedPage = SDRPAGE_NOTFOUND; + for( sal_uInt16 nPage = 0; nPage < mpDoc->GetSdPageCount(PK_STANDARD); nPage++ ) + { + if(mpDoc->GetSdPage(nPage,PK_STANDARD)->IsSelected()) + { + nSelectedPage = nPage; + break; + } + } + OUString aLayoutName(mpMasterSlide->GetSelectEntry()); + mpDoc->SetMasterPage(nSelectedPage, aLayoutName, mpDoc, false, false); +} + +IMPL_LINK_NOARG_TYPED(SlideBackground, DspBackground, Button*, void) +{ + bool IsChecked = (mpDspMasterBackground->IsChecked() ? true : false); + const SfxBoolItem aBoolItem(SID_DISPLAY_MASTER_BACKGROUND, IsChecked); + GetBindings()->GetDispatcher()->ExecuteList(SID_DISPLAY_MASTER_BACKGROUND, SfxCallMode::RECORD, { &aBoolItem }); +} + +IMPL_LINK_NOARG_TYPED(SlideBackground, DspObjects, Button*, void) +{ + bool IsChecked = (mpDspMasterObjects->IsChecked() ? true : false); + const SfxBoolItem aBoolItem(SID_DISPLAY_MASTER_OBJECTS,IsChecked); + GetBindings()->GetDispatcher()->ExecuteList(SID_DISPLAY_MASTER_OBJECTS, SfxCallMode::RECORD, { &aBoolItem, &aBoolItem }); +} + +}} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/sidebar/SlideBackground.hxx b/sd/source/ui/sidebar/SlideBackground.hxx new file mode 100644 index 000000000000..a40e6f4e7cda --- /dev/null +++ b/sd/source/ui/sidebar/SlideBackground.hxx @@ -0,0 +1,119 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_SD_SOURCE_UI_SIDEBAR_SLIDEBACKGROUND_HXX +#define INCLUDED_SD_SOURCE_UI_SIDEBAR_SLIDEBACKGROUND_HXX + +#include +#include +#include +#include +#include +#include +#include +#include "ViewShellBase.hxx" +#include +#include +#include +#include +#include +#include "fupage.hxx" +#include +#include +#include +#include +#include +#include +#include + +namespace sd { namespace sidebar { + +class SlideBackground : + public PanelLayout, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + SlideBackground( + Window * pParent, + ViewShellBase& rBase, + const css::uno::Reference& rxFrame, + SfxBindings* pBindings ); + virtual ~SlideBackground(); + virtual void dispose(); + SfxBindings* GetBindings() { return mpBindings; } + // Window + virtual void DataChanged (const DataChangedEvent& rEvent); + virtual void NotifyItemUpdate( + const sal_uInt16 nSID, + const SfxItemState eState, + const SfxPoolItem* pState, + const bool bIsEnabled); + +private: + + ViewShellBase& mrBase; + + VclPtr mpPaperSizeBox; + VclPtr mpPaperOrientation; + VclPtr mpMasterSlide; + VclPtr mpFillStyle; + VclPtr mpFillLB; + VclPtr mpFillAttr; + VclPtr mpFillGrad; + VclPtr mpDspMasterBackground; + VclPtr mpDspMasterObjects; + + ::sfx2::sidebar::ControllerItem maPaperController; + ::sfx2::sidebar::ControllerItem maBckColorController; + ::sfx2::sidebar::ControllerItem maBckGradientController; + ::sfx2::sidebar::ControllerItem maBckHatchController; + ::sfx2::sidebar::ControllerItem maBckBitmapController; + ::sfx2::sidebar::ControllerItem maBckFillStyleController; + ::sfx2::sidebar::ControllerItem maBckImageController; + ::sfx2::sidebar::ControllerItem maDspBckController; + ::sfx2::sidebar::ControllerItem maDspObjController; + ::sfx2::sidebar::ControllerItem maMetricController; + + std::unique_ptr< XFillStyleItem > mpFillStyleItem; + std::unique_ptr< XFillColorItem > mpColorItem; + std::unique_ptr< XFillGradientItem > mpGradientItem; + std::unique_ptr< XFillHatchItem > mpHatchItem; + std::unique_ptr< XFillBitmapItem > mpBitmapItem; + + SfxBindings* mpBindings; + + SfxMapUnit meUnit; + + DECL_LINK_TYPED(FillBackgroundHdl, ListBox&, void); + DECL_LINK_TYPED(FillStyleModifyHdl, ListBox&, void); + DECL_LINK_TYPED(PaperSizeModifyHdl, ListBox&, void); + DECL_LINK_TYPED(FillColorHdl, ListBox&, void); + DECL_LINK_TYPED(AssignMasterPage, ListBox&, void); + DECL_LINK_TYPED(DspBackground, Button*, void); + DECL_LINK_TYPED(DspObjects, Button*, void); + + void Initialize(); + void Update(); +}; + +}} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index b2b123d5c585..7e0b5b798c7d 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -1199,8 +1199,13 @@ 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_SAVE_BACKGROUND: + case SID_ATTR_PAGE_SIZE: case SID_PAGESETUP: // BASIC ?? { SetCurrentFunction( FuPage::Create( this, GetActiveWindow(), mpDrawView, GetDoc(), rReq ) ); diff --git a/sd/source/ui/view/drviews9.cxx b/sd/source/ui/view/drviews9.cxx index 0a2958c2776b..1678b78b256d 100644 --- a/sd/source/ui/view/drviews9.cxx +++ b/sd/source/ui/view/drviews9.cxx @@ -221,6 +221,7 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->ClearItem (XATTR_FILLSTYLE); pAttr->Put (XFillStyleItem ((drawing::FillStyle) pFillStyle->GetValue ()), XATTR_FILLSTYLE); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); } #if HAVE_FEATURE_SCRIPTING else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE); @@ -286,7 +287,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) XATTR_FILLCOLOR); pAttr->Put (XFillStyleItem (drawing::FillStyle_SOLID), XATTR_FILLSTYLE); rBindings.Invalidate (SID_ATTR_FILL_COLOR); + rBindings.Invalidate (SID_ATTR_PAGE_COLOR); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); break; } #if HAVE_FEATURE_SCRIPTING @@ -369,7 +372,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) } rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); + rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT); break; } #if HAVE_FEATURE_SCRIPTING @@ -423,7 +428,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) } rBindings.Invalidate (SID_ATTR_FILL_HATCH); + rBindings.Invalidate (SID_ATTR_PAGE_HATCH); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); break; } #if HAVE_FEATURE_SCRIPTING @@ -546,7 +553,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) } rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); + rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); } #if HAVE_FEATURE_SCRIPTING else StarBASIC::FatalError (ERRCODE_BASIC_BAD_PROP_VALUE); @@ -643,7 +652,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->Put (XFillGradientItem (pName->GetValue (), pEntry->GetGradient ()), XATTR_FILLGRADIENT); rBindings.Invalidate (SID_ATTR_FILL_GRADIENT); + rBindings.Invalidate (SID_ATTR_PAGE_GRADIENT); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); break; } } @@ -678,7 +689,9 @@ void DrawViewShell::AttrExec (SfxRequest &rReq) pAttr->Put (XFillHatchItem (pName->GetValue (), pEntry->GetHatch ()), XATTR_FILLHATCH); rBindings.Invalidate (SID_ATTR_FILL_HATCH); + rBindings.Invalidate (SID_ATTR_PAGE_HATCH); rBindings.Invalidate (SID_ATTR_FILL_STYLE); + rBindings.Invalidate (SID_ATTR_PAGE_FILLSTYLE); break; } } diff --git a/sd/source/ui/view/drviewsf.cxx b/sd/source/ui/view/drviewsf.cxx index 15bb40e9aa6c..81cfae06eae3 100644 --- a/sd/source/ui/view/drviewsf.cxx +++ b/sd/source/ui/view/drviewsf.cxx @@ -385,10 +385,15 @@ 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: diff --git a/sd/uiconfig/simpress/ui/sidebarslidebackground.ui b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui new file mode 100644 index 000000000000..8051781ec9ea --- /dev/null +++ b/sd/uiconfig/simpress/ui/sidebarslidebackground.ui @@ -0,0 +1,245 @@ + + + + + + + True + False + + + True + False + True + True + 6 + 6 + + + True + False + _Format: + True + + + 0 + 0 + + + + + True + False + Background: + + + 0 + 2 + + + + + True + False + + Landscape + Portrait + + + + 1 + 1 + + + + + True + False + + + 1 + 2 + + + + + False + True + + + 1 + 3 + + + + + Edit Master Slide + True + True + .uno:SlideMasterPage + + + 1 + 10 + + + + + Display Objects + True + True + True + False + 0 + True + + + 1 + 9 + + + + + True + False + + + 1 + 7 + + + + + True + False + True + Master Slide: + start + + + 0 + 7 + + + + + Insert Image + True + True + True + .uno:SelectBackground + + + 1 + 6 + + + + + False + True + + + 1 + 4 + + + + + False + True + + + 1 + 5 + + + + + Display Background + True + True + False + 0 + True + + + 1 + 8 + + + + + True + False + + A6 + A5 + A4 + A3 + A2 + A1 + A0 + B6(ISO) + B5(ISO) + B4(ISO) + Letter + Legal + Long Bond + Tabloid + B6(JIS) + B5 (JIS) + B4 (JIS) + 16 Kai + 32 Kai + Big 32 Kai + User + DL Envelope + C6 Envelope + C6/5 Envelope + C5 Envelope + C4 Envelope + Dia Slide + Screen 4:3 + Screen 16:9 + Screen 16:10 + Japanese Postcard + + + + 1 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 0 + 0 + + + + -- cgit