20#include <com/sun/star/ui/XDeck.hpp>
21#include <com/sun/star/ui/XPanel.hpp>
22#include <com/sun/star/frame/XController2.hpp>
36#include <pageformatpanel.hrc>
48#include <svx/svxids.hrc>
65#include <unomodel.hxx>
70using ::com::sun::star::uno::Reference;
91 css::uno::Reference<css::frame::XFrame> xFrame,
93 PanelLayout( pParent,
"SlideBackgroundPanel",
"modules/simpress/ui/sidebarslidebackground.ui" ),
96 mxPaperOrientation(m_xBuilder->weld_combo_box(
"orientation")),
97 mxMasterSlide(m_xBuilder->weld_combo_box(
"masterslide")),
98 mxBackgroundLabel(m_xBuilder->weld_label(
"label3")),
99 mxFillStyle(m_xBuilder->weld_combo_box(
"fillstyle")),
101 mxFillAttr(m_xBuilder->weld_combo_box(
"fillattr1")),
102 mxFillGrad1(
new ColorListBox(m_xBuilder->weld_menu_button(
"fillattr2"), [
this]{ return GetFrameWeld(); })),
103 mxFillGrad2(
new ColorListBox(m_xBuilder->weld_menu_button(
"fillattr3"), [
this]{ return GetFrameWeld(); })),
104 mxInsertImage(m_xBuilder->weld_button(
"button2")),
105 mxDspMasterBackground(m_xBuilder->weld_check_button(
"displaymasterbackground")),
106 mxDspMasterObjects(m_xBuilder->weld_check_button(
"displaymasterobjects")),
107 mxCloseMaster(m_xBuilder->weld_button(
"closemasterslide")),
108 mxEditMaster(m_xBuilder->weld_button(
"masterslidebutton")),
109 mxMasterLabel(m_xBuilder->weld_label(
"masterlabel")),
110 mxMarginSelectBox(m_xBuilder->weld_combo_box(
"marginLB")),
111 mxCustomEntry(m_xBuilder->weld_label(
"customlabel")),
112 mxMarginLabel(m_xBuilder->weld_label(
"labelmargin")),
113 maPaperSizeController(SID_ATTR_PAGE_SIZE, *pBindings, *
this),
114 maPaperOrientationController(SID_ATTR_PAGE, *pBindings, *
this),
115 maPaperMarginLRController(SID_ATTR_PAGE_LRSPACE, *pBindings, *
this),
116 maPaperMarginULController(SID_ATTR_PAGE_ULSPACE, *pBindings, *
this),
117 maBckColorController(SID_ATTR_PAGE_COLOR, *pBindings, *
this),
118 maBckGradientController(SID_ATTR_PAGE_GRADIENT, *pBindings, *
this),
119 maBckHatchController(SID_ATTR_PAGE_HATCH, *pBindings, *
this),
120 maBckBitmapController(SID_ATTR_PAGE_BITMAP, *pBindings, *
this),
121 maBckFillStyleController(SID_ATTR_PAGE_FILLSTYLE, *pBindings, *
this),
122 maBckImageController(SID_SELECT_BACKGROUND, *pBindings, *
this),
123 maDspBckController(SID_DISPLAY_MASTER_BACKGROUND, *pBindings, *
this),
124 maDspObjController(SID_DISPLAY_MASTER_OBJECTS, *pBindings, *
this),
125 maMetricController(SID_ATTR_METRIC, *pBindings, *
this),
126 maCloseMasterController(SID_CLOSE_MASTER_VIEW, *pBindings, *
this),
128 mbSwitchModeToNormal(
false),
129 mbSwitchModeToMaster(
false),
130 mxFrame(std::move(xFrame)),
140 m_nPageLeftMargin(0),
141 m_nPageRightMargin(0),
143 m_nPageBottomMargin(0),
145 mpBindings(pBindings)
149 mxMasterSlide->set_size_request(42, -1);
151 maCustomEntry = mxCustomEntry->get_label();
175 if (pState && eState >= SfxItemState::DEFAULT)
195 OUString sMeasurement = rLocaleData.
getNum(RID_PAGEFORMATPANEL_MARGINS_INCH[
i].second, 2,
true,
false) +
sSuffix;
204 OUString sMeasurement = rLocaleData.
getNum(RID_PAGEFORMATPANEL_MARGINS_CM[
i].second, 2,
true,
false) +
sSuffix;
244 OUString aLayoutName(
mpPage->GetLayoutName() );
245 aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(
SD_LT_SEPARATOR));
472 if (nCustomIndex != -1)
478 if (nCustomIndex != -1)
484 if (nCustomIndex != -1)
490 if (nCustomIndex != -1)
496 if (nCustomIndex != -1)
502 if (nCustomIndex != -1)
508 if (nCustomIndex != -1)
513 if (nCustomIndex == -1)
521 Reference<frame::XController2>
xController(
mxFrame->getController(), uno::UNO_QUERY);
525 Reference<ui::XSidebarProvider> xSidebarProvider =
xController->getSidebar();
526 if ( !xSidebarProvider.is() )
529 Reference<ui::XDecks> xDecks = xSidebarProvider->getDecks();
533 Reference<ui::XDeck> xDeck ( xDecks->getByName(
"PropertyDeck"), uno::UNO_QUERY);
537 Reference<ui::XPanels> xPanels = xDeck->getPanels();
541 if (xPanels->hasByName(
"SlideBackgroundPanel"))
543 Reference<ui::XPanel> xPanel ( xPanels->getByName(
"SlideBackgroundPanel"), uno::UNO_QUERY);
547 xPanel->setTitle( rTitle );
566 switch (rEvent.meEventId)
571 populateMasterSlideDropdown();
574 mbSwitchModeToNormal =
true;
577 mbSwitchModeToMaster =
true;
582 if ( mbSwitchModeToMaster )
585 SetPanelTitle(
SdResId(STR_MASTERSLIDE_NAME));
587 SetPanelTitle(
SdResId(STR_MASTERPAGE_NAME));
588 mbSwitchModeToMaster =
false;
590 else if ( mbSwitchModeToNormal )
593 SetPanelTitle(
SdResId(STR_SLIDE_NAME));
595 SetPanelTitle(
SdResId(STR_PAGE_NAME));
596 mbSwitchModeToNormal =
false;
603 static const sal_uInt16
SidArray[] = {
605 SID_ATTR_PAGE_GRADIENT,
607 SID_ATTR_PAGE_BITMAP,
608 SID_ATTR_PAGE_FILLSTYLE,
609 SID_DISPLAY_MASTER_BACKGROUND,
610 SID_DISPLAY_MASTER_OBJECTS,
612 updateMasterSlideSelection();
622 mxCloseMaster->hide();
623 mxEditMaster->hide();
625 SetPanelTitle(
SdResId(STR_MASTERPAGE_NAME));
627 SetPanelTitle(
SdResId(STR_PAGE_NAME));
631 if(
maContext == maImpressMasterContext )
632 SetPanelTitle(
SdResId(STR_MASTERSLIDE_NAME));
634 SetPanelTitle(
SdResId(STR_SLIDE_NAME));
636 else if (
maContext == maImpressNotesContext )
638 mxMasterLabel->set_label(
SdResId(STR_MASTERSLIDE_LABEL));
639 ViewShell* pMainViewShell = mrBase.GetMainViewShell().get();
645 SetPanelTitle(
SdResId(STR_MASTERSLIDE_NAME));
647 SetPanelTitle(
SdResId(STR_SLIDE_NAME));
665 for( sal_uInt16 nLayout = 0; nLayout <
nCount; nLayout++ )
671 aLayoutName = aLayoutName.copy(0,aLayoutName.indexOf(
SD_LT_SEPARATOR));
685 SdPage* pMasterPage =
static_cast<SdPage*
>(&rMasterPage);
764 OUString aGradientName;
768 aGradient = pGradListItem->
GetGradientList()->GetGradient(0)->GetGradient();
769 aGradientName = pGradListItem->
GetGradientList()->GetGradient(0)->GetName();
786 aHatch = pHatchListItem->
GetHatchList()->GetHatch(0)->GetHatch();
787 aHatchName = pHatchListItem->
GetHatchList()->GetHatch(0)->GetName();
804 aGraphObj = pBmpListItem->
GetBitmapList()->GetBitmap(0)->GetGraphicObject();
805 aBmpName = pBmpListItem->
GetBitmapList()->GetBitmap(0)->GetName();
822 aGraphObj = pPtrnListItem->
GetPatternList()->GetBitmap(0)->GetGraphicObject();
823 aPtrnName = pPtrnListItem->
GetPatternList()->GetBitmap(0)->GetName();
832 const sal_uInt16 nSID,
839 case SID_ATTR_PAGE_COLOR:
841 if(eState >= SfxItemState::DEFAULT)
850 case SID_ATTR_PAGE_HATCH:
852 if(eState >= SfxItemState::DEFAULT)
861 case SID_ATTR_PAGE_GRADIENT:
863 if(eState >= SfxItemState::DEFAULT)
871 case SID_ATTR_PAGE_BITMAP:
873 if(eState >= SfxItemState::DEFAULT)
890 case SID_ATTR_PAGE_FILLSTYLE:
893 if (eState >= SfxItemState::DEFAULT)
897 css::drawing::FillStyle eXFS = pFillStyleItem->GetValue();
900 case drawing::FillStyle_NONE:
903 case drawing::FillStyle_SOLID:
906 case drawing::FillStyle_GRADIENT:
909 case drawing::FillStyle_HATCH:
912 case drawing::FillStyle_BITMAP:
928 case SID_ATTR_PAGE_SIZE:
931 if (eState >= SfxItemState::DEFAULT)
932 pSizeItem =
dynamic_cast<const SvxSizeItem*
>(pState);
948 if (eState >= SfxItemState::DEFAULT)
949 pPageItem =
dynamic_cast<const SvxPageItem*
>(pState);
953 bool bIsLandscape =
mpPageItem->IsLandscape();
959 case SID_ATTR_PAGE_LRSPACE:
962 if (eState >= SfxItemState::DEFAULT)
972 case SID_ATTR_PAGE_ULSPACE:
975 if (eState >= SfxItemState::DEFAULT)
985 case SID_DISPLAY_MASTER_BACKGROUND:
988 if (eState >= SfxItemState::DEFAULT)
989 pBoolItem =
dynamic_cast< const SfxBoolItem*
>(pState);
994 case SID_DISPLAY_MASTER_OBJECTS:
997 if (eState >= SfxItemState::DEFAULT)
998 pBoolItem =
dynamic_cast< const SfxBoolItem*
>(pState);
1003 case SID_SELECT_BACKGROUND:
1005 if(eState >= SfxItemState::DEFAULT)
1012 case SID_ATTR_METRIC:
1030 const eFillStyle
nPos =
static_cast<eFillStyle
>(mxFillStyle->get_active());
1046 const XFillColorItem aItem( OUString(), mpColorItem->GetColorValue() );
1056 const XFillGradientItem aItem( mpGradientItem->GetName(), mpGradientItem->GetGradientValue() );
1066 const XFillHatchItem aItem( mpHatchItem->GetName(), mpHatchItem->GetHatchValue() );
1077 const XFillBitmapItem aItem( mpBitmapItem->GetName(), mpBitmapItem->GetGraphicObject() );
1091 const Paper ePaper = mxPaperSizeBox->get_active_id();
1094 if (mxPaperOrientation->get_active() == 0)
1097 mpPageItem->SetLandscape(mxPaperOrientation->get_active() == 0);
1098 const SvxSizeItem aSizeItem(SID_ATTR_PAGE_SIZE, aSize);
1102 const SfxBoolItem aFitObjs(SID_ATTR_PAGE_EXT1, IsImpress());
1105 { &aSizeItem, mpPageItem.get(), &aFitObjs });
1114 if (pViewShell->
GetDocId() == mrBase.GetDocId())
1125 const drawing::FillStyle eXFS =
static_cast<drawing::FillStyle
>(mxFillStyle->get_active());
1128 case drawing::FillStyle_SOLID:
1130 XFillColorItem aItem(OUString(), mxFillLB->GetSelectEntryColor());
1134 case drawing::FillStyle_GRADIENT:
1152 const eFillStyle nFillPos =
static_cast<eFillStyle
>(mxFillStyle->get_active());
1162 sal_uInt16
nPos = mxFillAttr->get_active();
1164 const OUString aHatchName = pHatchListItem->
GetHatchList()->GetHatch(
nPos)->GetName();
1174 sal_Int16
nPos = mxFillAttr->get_active();
1180 aBitmap = pBitmapListItem->
GetBitmapList()->GetBitmap(
nPos)->GetGraphicObject();
1183 else if( nFillPos ==
PATTERN )
1207 if (pSSVS ==
nullptr)
1210 auto& rSSController = pSSVS->GetSlideSorter().GetController();
1211 auto& rPageSelector = rSSController.GetPageSelector();
1215 if (rPageSelector.IsPageSelected(nPage))
1217 OUString aLayoutName(mxMasterSlide->get_active_text());
1218 pDoc->
SetMasterPage(nPage, aLayoutName, pDoc,
false,
false);
1240 bool IsChecked = mxDspMasterBackground->get_active();
1241 const SfxBoolItem aBoolItem(SID_DISPLAY_MASTER_BACKGROUND, IsChecked);
1247 bool IsChecked = mxDspMasterObjects->get_active();
1248 const SfxBoolItem aBoolItem(SID_DISPLAY_MASTER_OBJECTS,IsChecked);
1254 bool bApplyNewPageMargins =
true;
1255 switch ( mxMarginSelectBox->get_active() )
1258 SetNone(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1261 SetNarrow(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1264 SetModerate(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1267 SetNormal075(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1270 SetNormal100(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1273 SetNormal125(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1276 SetWide(m_nPageLeftMargin, m_nPageRightMargin, m_nPageTopMargin, m_nPageBottomMargin);
1279 bApplyNewPageMargins =
false;
1283 if(bApplyNewPageMargins)
1285 ExecuteMarginLRChange(m_nPageLeftMargin, m_nPageRightMargin);
1286 ExecuteMarginULChange(m_nPageTopMargin, m_nPageBottomMargin);
1304 aColorStops.emplace_back(0.0,
mxFillGrad1->GetSelectEntryColor().getBColor());
1305 aColorStops.emplace_back(1.0,
mxFillGrad2->GetSelectEntryColor().getBColor());
@ EditViewSelection
The selection in the center pane has changed.
@ EditModeNormal
Edit mode was (or is being) switched to normal mode.
@ EditModeMaster
Edit mode was (or is being) switched to master mode.
@ ViewAdded
A new ViewShell is being displayed in one of the panes.
@ EndTextEdit
Text editing in one of the shapes in the MainViewShell has ended.
@ ShapeChanged
The state of a shape has changed.
@ CurrentPageChanged
The current page has changed.
const LocaleDataWrapper & GetLocaleDataWrapper() const
static const AllSettings & GetSettings()
OUString getNum(sal_Int64 nNumber, sal_uInt16 nDecimals, bool bUseThousandSep=true, bool bTrailingZeros=true) const
sfx2::sidebar::Panel * m_pPanel
virtual weld::Window * GetFrameWeld() const
virtual void DumpAsPropertyTree(tools::JsonWriter &)
void SetMasterPage(sal_uInt16 nSdPageNum, std::u16string_view rLayoutName, SdDrawDocument *pSourceDoc, bool bMaster, bool bCheckMasters)
sal_uInt16 GetSdPageCount(PageKind ePgKind) const
PageKind GetPageKind() const
virtual OUString GetLayoutName() const override
const OUString & GetName() const
const SdrPage * GetMasterPage(sal_uInt16 nPgNum) const
sal_uInt16 GetMasterPageCount() const
SdrPage & TRG_GetMasterPage() const
bool TRG_HasMasterPage() const
void Update(sal_uInt16 nId)
SfxDispatcher * GetDispatcher() const
void Invalidate(sal_uInt16 nId)
MapUnit GetCoreMetric() const
const SfxPoolItem * Execute(sal_uInt16 nSlot, SfxCallMode nCall=SfxCallMode::SLOT, const SfxPoolItem **pArgs=nullptr, sal_uInt16 nModi=0, const SfxPoolItem **pInternalArgs=nullptr)
const SfxPoolItem * ExecuteList(sal_uInt16 nSlot, SfxCallMode nCall, std::initializer_list< SfxPoolItem const * > args, std::initializer_list< SfxPoolItem const * > internalargs=std::initializer_list< SfxPoolItem const * >())
static void notifyDocumentSizeChangedAllViews(vcl::ITiledRenderable *pDoc, bool bInvalidateAll=true)
static SAL_WARN_UNUSED_RESULT SfxObjectShell * Current()
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const=0
const SfxPoolItem * GetItem(sal_uInt16 nSlotId) const
ViewShellDocId GetDocId() const override
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetNext(const SfxViewShell &rPrev, bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
static SAL_WARN_UNUSED_RESULT SfxViewShell * GetFirst(bool bOnlyVisible=true, const std::function< bool(const SfxViewShell *)> &isViewShell=nullptr)
virtual css::uno::Reference< css::frame::XModel > GetCurrentDocument() const
const XBitmapListRef & GetBitmapList() const
const XGradientListRef & GetGradientList() const
const XHatchListRef & GetHatchList() const
virtual SvxPageItem * Clone(SfxItemPool *pPool=nullptr) const override
static Paper GetSvxPaper(const Size &rSize, MapUnit eUnit)
static Size GetPaperSize(Paper ePaper, MapUnit eUnit=MapUnit::MapTwip)
const XPatternListRef & GetPatternList() const
const Size & GetSize() const
void SetColorStops(const basegfx::BColorStops &rSteps)
const basegfx::BColorStops & GetColorStops() const
SdDrawDocument * GetDoc()
Base class of the stacked shells that provide graphical views to Draw and Impress documents and editi...
EditMode GetEditMode() const
EditMode GetViewShEditMode() const
Return EditMode (Page or MasterPage) of working mode.
SfxViewShell descendant that the stacked Draw/Impress shells are based on.
std::shared_ptr< ViewShell > GetMainViewShell() const
Return the main view shell stacked on the called ViewShellBase object.
std::shared_ptr< tools::EventMultiplexer > const & GetEventMultiplexer() const
Return an event multiplexer.
Base class of the stacked shell hierarchy.
virtual SdPage * getCurrentPage() const =0
FrameView * GetFrameView()
SD_DLLPUBLIC SlideSorter & GetSlideSorter() const
virtual SfxBindings & GetBindings() override
SVXCORE_DLLPUBLIC FieldUnit GetModuleFieldUnit(const SfxItemSet &)
constexpr OUStringLiteral SD_LT_SEPARATOR
SlideShowContext maContext
#define LINK(Instance, Class, Member)
#define SAL_N_ELEMENTS(arr)
SVX_DLLPUBLIC void Fill(weld::ComboBox &, const XHatchListRef &pList)
SVX_DLLPUBLIC void Fill(weld::ComboBox &rListBox)
void addListener(const InterfaceRef &xObject, const css::uno::Reference< css::lang::XEventListener > &xListener)
constexpr OUStringLiteral first
const sal_uInt16 SidArray[]
OUString SdResId(TranslateId aId)
Reference< XController > xController
constexpr OUStringLiteral PATTERN