diff options
author | Rishabh Kumar <kris.kr296@gmail.com> | 2015-07-31 02:28:28 +0530 |
---|---|---|
committer | Katarina Behrens <Katarina.Behrens@cib.de> | 2016-05-04 14:21:29 +0000 |
commit | 93b4bf647a5899f54ef51f8b4bfed0faa66b466e (patch) | |
tree | afccd767b2d2f275546038976e22d37914103d45 /sd | |
parent | c950792fd97894ae08304a7ded83b3d405f9a7d0 (diff) |
tdf#89466: Slide Background tab
Change-Id: Ic3ba6b47a1e5fcaeec76c4e4ff0ba6128653af86
Reviewed-on: https://gerrit.libreoffice.org/17007
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Katarina Behrens <Katarina.Behrens@cib.de>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/Library_sd.mk | 1 | ||||
-rw-r--r-- | sd/UIConfig_simpress.mk | 1 | ||||
-rw-r--r-- | sd/sdi/_drvwsh.sdi | 30 | ||||
-rw-r--r-- | sd/source/ui/func/fupage.cxx | 13 | ||||
-rw-r--r-- | sd/source/ui/sidebar/PanelFactory.cxx | 3 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.cxx | 525 | ||||
-rw-r--r-- | sd/source/ui/sidebar/SlideBackground.hxx | 119 | ||||
-rw-r--r-- | sd/source/ui/view/drviews2.cxx | 7 | ||||
-rw-r--r-- | sd/source/ui/view/drviews9.cxx | 13 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsf.cxx | 5 | ||||
-rw-r--r-- | sd/uiconfig/simpress/ui/sidebarslidebackground.ui | 245 |
11 files changed, 960 insertions, 2 deletions
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 <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> #include <svx/sdr/properties/properties.hxx> - +#include <sfx2/bindings.hxx> #include "glob.hrc" #include <editeng/shaditem.hxx> #include <editeng/boxitem.hxx> @@ -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 <SlideBackground.hxx> #include <sfx2/viewfrm.hxx> #include <sfx2/sidebar/SidebarPanelBase.hxx> @@ -129,6 +130,8 @@ Reference<ui::XUIElement> SAL_CALL PanelFactory::createUIElement ( pControl = VclPtr<TableDesignPanel>::Create(pParentWindow, *pBase); else if (EndsWith(rsUIElementResourceURL, "/NavigatorPanel")) pControl = VclPtr<NavigatorWrapper>::Create(pParentWindow, *pBase, pBindings); + else if (EndsWith(rsUIElementResourceURL, "/SlideBackgroundPanel")) + pControl = VclPtr<SlideBackground>::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 <com/sun/star/animations/XAnimationNode.hpp> +#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 <com/sun/star/beans/XPropertySet.hpp> +#include "sdresid.hxx" +#include <svtools/controldims.hrc> +#include <svx/gallery.hxx> +#include <svx/drawitem.hxx> +#include <unotools/pathoptions.hxx> +#include <vcl/msgbox.hxx> +#include <tools/urlobj.hxx> +#include <tools/resary.hxx> +#include <sfx2/sidebar/Theme.hxx> +#include "app.hrc" +#include <editeng/paperinf.hxx> +#include <editeng/sizeitem.hxx> +#include <svx/svxids.hrc> +#include <svx/xflclit.hxx> +#include <svx/xgrad.hxx> +#include <svx/xbitmap.hxx> +#include <svx/xflbckit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xattr.hxx> +#include <svx/xflhtit.hxx> +#include <svx/svdpage.hxx> +#include <sfx2/bindings.hxx> +#include <sfx2/dispatch.hxx> +#include <sfx2/objface.hxx> +#include <svx/dlgutil.hxx> +#include <algorithm> + +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<css::frame::XFrame>& 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<SdPage*>(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<DrawViewShell*>(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<const SvxColorListItem*>(pSh->GetItem(SID_COLOR_TABLE))); + mpFillLB->Fill(aItem.GetColorList()); + } + break; + case drawing::FillStyle_GRADIENT: + { + mpFillLB->Show(); + const SvxColorListItem aItem(*static_cast<const SvxColorListItem*>(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<const SvxHatchListItem*>(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<const SvxBitmapListItem*>(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<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 }); + } + 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 }); + } + 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 <vcl/ctrl.hxx> +#include <vcl/lstbox.hxx> +#include <vcl/fixed.hxx> +#include <vcl/button.hxx> +#include <vcl/field.hxx> +#include <svx/sidebar/PanelLayout.hxx> +#include <svx/pagectrl.hxx> +#include "ViewShellBase.hxx" +#include <svx/itemwin.hxx> +#include <sfx2/sidebar/ControlFactory.hxx> +#include <sfx2/sidebar/ControllerItem.hxx> +#include <com/sun/star/drawing/XDrawView.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "fupage.hxx" +#include <svx/xflclit.hxx> +#include <svx/xgrad.hxx> +#include <svx/xflgrit.hxx> +#include <svx/xbitmap.hxx> +#include <svx/xflbckit.hxx> +#include <svx/xbtmpit.hxx> +#include <svx/xflhtit.hxx> + +namespace sd { namespace sidebar { + +class SlideBackground : + public PanelLayout, + public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface +{ +public: + SlideBackground( + Window * pParent, + ViewShellBase& rBase, + const css::uno::Reference<css::frame::XFrame>& 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<ListBox> mpPaperSizeBox; + VclPtr<ListBox> mpPaperOrientation; + VclPtr<ListBox> mpMasterSlide; + VclPtr<ListBox> mpFillStyle; + VclPtr<ColorLB> mpFillLB; + VclPtr<SvxFillAttrBox> mpFillAttr; + VclPtr<ColorLB> mpFillGrad; + VclPtr<CheckBox> mpDspMasterBackground; + VclPtr<CheckBox> 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 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- Generated with glade 3.18.3 --> +<interface> + <requires lib="gtk+" version="3.0"/> + <requires lib="LibreOffice" version="1.0"/> + <object class="GtkGrid" id="SlideBackgroundPanel"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkGrid" id="grid1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="vexpand">True</property> + <property name="row_spacing">6</property> + <property name="column_spacing">6</property> + <child> + <object class="GtkLabel" id="label2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Format:</property> + <property name="use_underline">True</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Background:</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="orientation"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">Landscape</item> + <item translatable="yes">Portrait</item> + </items> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">1</property> + </packing> + </child> + <child> + <object class="svxlo-SvxFillTypeBox" id="fillstyle"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">2</property> + </packing> + </child> + <child> + <object class="svxlo-ColorLB" id="fillattr"> + <property name="can_focus">False</property> + <property name="has_tooltip">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">3</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button1"> + <property name="label" translatable="yes">Edit Master Slide</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:SlideMasterPage</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">10</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="displaymasterobjects"> + <property name="label" translatable="yes">Display Objects</property> + <property name="use_action_appearance">True</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">9</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="masterslide"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="label1"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <property name="label" translatable="yes">Master Slide:</property> + <property name="ellipsize">start</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">7</property> + </packing> + </child> + <child> + <object class="GtkButton" id="button2"> + <property name="label" translatable="yes">Insert Image</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <property name="action_name">.uno:SelectBackground</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">6</property> + </packing> + </child> + <child> + <object class="svxlo-SvxFillAttrBox" id="fillattr1"> + <property name="can_focus">False</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">4</property> + </packing> + </child> + <child> + <object class="svxlo-ColorLB" id="fillattr2"> + <property name="can_focus">False</property> + <property name="visible">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">5</property> + </packing> + </child> + <child> + <object class="GtkCheckButton" id="displaymasterbackground"> + <property name="label" translatable="yes">Display Background</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">False</property> + <property name="xalign">0</property> + <property name="draw_indicator">True</property> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">8</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="paperformat"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <items> + <item translatable="yes">A6</item> + <item translatable="yes">A5</item> + <item translatable="yes">A4</item> + <item translatable="yes">A3</item> + <item translatable="yes">A2</item> + <item translatable="yes">A1</item> + <item translatable="yes">A0</item> + <item translatable="yes">B6(ISO)</item> + <item translatable="yes">B5(ISO)</item> + <item translatable="yes">B4(ISO)</item> + <item translatable="yes">Letter</item> + <item translatable="yes">Legal</item> + <item translatable="yes">Long Bond</item> + <item translatable="yes">Tabloid</item> + <item translatable="yes">B6(JIS)</item> + <item translatable="yes">B5 (JIS)</item> + <item translatable="yes">B4 (JIS)</item> + <item translatable="yes">16 Kai</item> + <item translatable="yes">32 Kai</item> + <item translatable="yes">Big 32 Kai</item> + <item translatable="yes">User</item> + <item translatable="yes">DL Envelope</item> + <item translatable="yes">C6 Envelope</item> + <item translatable="yes">C6/5 Envelope</item> + <item translatable="yes">C5 Envelope</item> + <item translatable="yes">C4 Envelope</item> + <item translatable="yes">Dia Slide</item> + <item translatable="yes">Screen 4:3</item> + <item translatable="yes">Screen 16:9</item> + <item translatable="yes">Screen 16:10</item> + <item translatable="yes">Japanese Postcard</item> + </items> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> +</interface> |