1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 5 * This Source Code Form is subject to the terms of the Mozilla Public 6 * License, v. 2.0. If a copy of the MPL was not distributed with this 7 * file, You can obtain one at http://mozilla.org/MPL/2.0/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 11 * Licensed to the Apache Software Foundation (ASF) under one or more 12 * contributor license agreements. See the NOTICE file distributed 13 * with this work for additional information regarding copyright 14 * ownership. The ASF licenses this file to you under the Apache 15 * License, Version 2.0 (the "License"); you may not use this file 16 * except in compliance with the License. You may obtain a copy of 17 * the License at http://www.apache.org/licenses/LICENSE-2.0 . 18 */ 19 20 #ifndef INCLUDED_SD_SOURCE_UI_SIDEBAR_SLIDEBACKGROUND_HXX 21 #define INCLUDED_SD_SOURCE_UI_SIDEBAR_SLIDEBACKGROUND_HXX 22 23 #include <memory> 24 #include <svl/intitem.hxx> 25 #include <svx/dlgutil.hxx> 26 #include <vcl/lstbox.hxx> 27 #include <vcl/fixed.hxx> 28 #include <vcl/button.hxx> 29 #include <vcl/layout.hxx> 30 #include <svx/sidebar/PanelLayout.hxx> 31 #include <svx/itemwin.hxx> 32 #include <sfx2/sidebar/ControllerItem.hxx> 33 #include <svx/papersizelistbox.hxx> 34 #include <sfx2/sidebar/IContextChangeReceiver.hxx> 35 36 namespace sd { class ViewShellBase; } 37 namespace sd { namespace tools { class EventMultiplexerEvent; } } 38 39 class SvxColorListBox; 40 class SvxPageItem; 41 class SvxLongLRSpaceItem; 42 class SvxLongULSpaceItem; 43 class XFillColorItem; 44 class XGradient; 45 class XFillGradientItem; 46 class XFillBitmapItem; 47 class XFillHatchItem; 48 49 static const long MINBODY = 284; 50 51 namespace sd { namespace sidebar { 52 53 class SlideBackground : 54 public PanelLayout, 55 public ::sfx2::sidebar::IContextChangeReceiver, 56 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 57 { 58 public: 59 SlideBackground( 60 Window * pParent, 61 ViewShellBase& rBase, 62 const css::uno::Reference<css::frame::XFrame>& rxFrame, 63 SfxBindings* pBindings ); 64 virtual ~SlideBackground() override; 65 virtual void dispose() override; GetBindings()66 SfxBindings* GetBindings() { return mpBindings; } 67 // Window 68 virtual void DataChanged (const DataChangedEvent& rEvent) override; 69 virtual void NotifyItemUpdate( 70 const sal_uInt16 nSID, 71 const SfxItemState eState, 72 const SfxPoolItem* pState) override; 73 virtual void HandleContextChange( 74 const vcl::EnumContext& rContext) override; 75 virtual boost::property_tree::ptree DumpAsPropertyTree() override; 76 77 private: 78 79 ViewShellBase& mrBase; 80 81 VclPtr<PaperSizeListBox> mpPaperSizeBox; 82 VclPtr<ListBox> mpPaperOrientation; 83 VclPtr<ListBox> mpMasterSlide; 84 VclPtr<FixedText> mpBackgroundLabel; 85 VclPtr<SvxFillTypeBox> mpFillStyle; 86 VclPtr<SvxColorListBox> mpFillLB; 87 VclPtr<SvxFillAttrBox> mpFillAttr; 88 VclPtr<SvxColorListBox> mpFillGrad; 89 VclPtr<Button> mpInsertImage; 90 VclPtr<CheckBox> mpDspMasterBackground; 91 VclPtr<CheckBox> mpDspMasterObjects; 92 VclPtr<Button> mpCloseMaster; 93 VclPtr<Button> mpEditMaster; 94 VclPtr<FixedText> mpMasterLabel; 95 VclPtr<ListBox> mpMarginSelectBox; 96 VclPtr<VclVBox> m_pContainer; 97 98 ::sfx2::sidebar::ControllerItem maPaperSizeController; 99 ::sfx2::sidebar::ControllerItem maPaperOrientationController; 100 ::sfx2::sidebar::ControllerItem maPaperMarginLRController; 101 ::sfx2::sidebar::ControllerItem maPaperMarginULController; 102 ::sfx2::sidebar::ControllerItem maBckColorController; 103 ::sfx2::sidebar::ControllerItem maBckGradientController; 104 ::sfx2::sidebar::ControllerItem maBckHatchController; 105 ::sfx2::sidebar::ControllerItem maBckBitmapController; 106 ::sfx2::sidebar::ControllerItem maBckFillStyleController; 107 ::sfx2::sidebar::ControllerItem maBckImageController; 108 ::sfx2::sidebar::ControllerItem maDspBckController; 109 ::sfx2::sidebar::ControllerItem maDspObjController; 110 ::sfx2::sidebar::ControllerItem maMetricController; 111 ::sfx2::sidebar::ControllerItem maCloseMasterController; 112 113 std::unique_ptr< SvxPageItem > mpPageItem; 114 std::unique_ptr< XFillColorItem > mpColorItem; 115 std::unique_ptr< XFillGradientItem > mpGradientItem; 116 std::unique_ptr< XFillHatchItem > mpHatchItem; 117 std::unique_ptr< XFillBitmapItem > mpBitmapItem; 118 119 bool mbSwitchModeToNormal; 120 bool mbSwitchModeToMaster; 121 122 css::uno::Reference<css::frame::XFrame> mxFrame; 123 vcl::EnumContext maContext; 124 vcl::EnumContext const maDrawOtherContext; 125 vcl::EnumContext const maDrawMasterContext; 126 vcl::EnumContext const maImpressOtherContext; 127 vcl::EnumContext const maImpressMasterContext; 128 vcl::EnumContext const maImpressHandoutContext; 129 vcl::EnumContext const maImpressNotesContext; 130 bool mbTitle; 131 std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; 132 std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem; 133 long m_nPageLeftMargin; 134 long m_nPageRightMargin; 135 long m_nPageTopMargin; 136 long m_nPageBottomMargin; 137 FieldUnit meFUnit; 138 OUString maCustomEntry; 139 140 SfxBindings* const mpBindings; 141 142 MapUnit meUnit; 143 144 DECL_LINK(FillBackgroundHdl, ListBox&, void); 145 DECL_LINK(FillStyleModifyHdl, ListBox&, void); 146 DECL_LINK(PaperSizeModifyHdl, ListBox&, void); 147 DECL_LINK(FillColorHdl, SvxColorListBox&, void); 148 DECL_LINK(AssignMasterPage, ListBox&, void); 149 DECL_LINK(DspBackground, Button*, void); 150 DECL_LINK(DspObjects, Button*, void); 151 DECL_LINK(CloseMasterHdl, Button*, void); 152 DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); 153 DECL_LINK( ModifyMarginHdl, ListBox&, void ); 154 155 void Initialize(); 156 void Update(); 157 void UpdateMarginBox(); 158 void SetPanelTitle(const OUString& rTitle); 159 void SetMarginsFieldUnit(); 160 161 Color const & GetColorSetOrDefault(); 162 XGradient const & GetGradientSetOrDefault(); 163 OUString const & GetHatchingSetOrDefault(); 164 OUString const & GetBitmapSetOrDefault(); 165 OUString const & GetPatternSetOrDefault(); 166 bool IsDraw(); 167 bool IsImpress(); 168 void addListener(); 169 void removeListener(); 170 void ExecuteMarginLRChange(const long mnPageLeftMargin, const long mnPageRightMargin); 171 void ExecuteMarginULChange(const long mnPageTopMargin, const long mnPageBottomMargin); 172 void populateMasterSlideDropdown(); 173 void updateMasterSlideSelection(); 174 175 static FieldUnit GetCurrentUnit(SfxItemState eState, const SfxPoolItem* pState); 176 }; 177 178 }} 179 180 #endif 181 182 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 183