/src/libreoffice/sd/source/ui/sidebar/SlideBackground.hxx
Line | Count | Source (jump to first uncovered line) |
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 | | #pragma once |
21 | | |
22 | | #include <memory> |
23 | | #include <sfx2/sidebar/PanelLayout.hxx> |
24 | | #include <sfx2/sidebar/ControllerItem.hxx> |
25 | | #include <svx/papersizelistbox.hxx> |
26 | | #include <sfx2/sidebar/IContextChangeReceiver.hxx> |
27 | | #include <vcl/EnumContext.hxx> |
28 | | |
29 | | #include <com/sun/star/frame/XFrame.hpp> |
30 | | |
31 | | namespace sd { class ViewShellBase; } |
32 | | namespace sd::tools { class EventMultiplexerEvent; } |
33 | | |
34 | | class ColorListBox; |
35 | | class SvxPageItem; |
36 | | class SvxLongLRSpaceItem; |
37 | | class SvxLongULSpaceItem; |
38 | | class XFillColorItem; |
39 | | class XFillGradientItem; |
40 | | class XFillBitmapItem; |
41 | | class XFillHatchItem; |
42 | | |
43 | | namespace sd::sidebar { |
44 | | |
45 | | class SlideBackground : |
46 | | public PanelLayout, |
47 | | public ::sfx2::sidebar::IContextChangeReceiver, |
48 | | public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface |
49 | | { |
50 | | public: |
51 | | SlideBackground( |
52 | | weld::Widget* pParent, |
53 | | ViewShellBase& rBase, |
54 | | css::uno::Reference<css::frame::XFrame> xFrame, |
55 | | SfxBindings* pBindings ); |
56 | | virtual ~SlideBackground() override; |
57 | 0 | SfxBindings* GetBindings() { return mpBindings; } |
58 | | // Window |
59 | | virtual void NotifyItemUpdate( |
60 | | const sal_uInt16 nSID, |
61 | | const SfxItemState eState, |
62 | | const SfxPoolItem* pState) override; |
63 | | |
64 | | virtual void GetControlState( |
65 | | const sal_uInt16 /*nSId*/, |
66 | 0 | boost::property_tree::ptree& /*rState*/) override {}; |
67 | | |
68 | | virtual void HandleContextChange( |
69 | | const vcl::EnumContext& rContext) override; |
70 | | virtual void DumpAsPropertyTree(::tools::JsonWriter&) override; |
71 | | |
72 | | private: |
73 | | |
74 | | ViewShellBase& mrBase; |
75 | | |
76 | | std::unique_ptr<SvxPaperSizeListBox> mxPaperSizeBox; |
77 | | std::unique_ptr<weld::ComboBox> mxPaperOrientation; |
78 | | std::unique_ptr<weld::ComboBox> mxMasterSlide; |
79 | | std::unique_ptr<weld::Label> mxBackgroundLabel; |
80 | | std::unique_ptr<weld::ComboBox> mxFillStyle; |
81 | | std::unique_ptr<ColorListBox> mxFillLB; |
82 | | std::unique_ptr<weld::ComboBox> mxFillAttr; |
83 | | std::unique_ptr<ColorListBox> mxFillGrad1; |
84 | | std::unique_ptr<ColorListBox> mxFillGrad2; |
85 | | std::unique_ptr<weld::Button> mxInsertImage; |
86 | | std::unique_ptr<weld::CheckButton> mxDspMasterBackground; |
87 | | std::unique_ptr<weld::CheckButton> mxDspMasterObjects; |
88 | | std::unique_ptr<weld::Button> mxCloseMaster; |
89 | | std::unique_ptr<weld::Button> mxEditMaster; |
90 | | std::unique_ptr<weld::Label> mxMasterLabel; |
91 | | std::unique_ptr<weld::ComboBox> mxMarginSelectBox; |
92 | | std::unique_ptr<weld::Label> mxCustomEntry; |
93 | | std::unique_ptr<weld::Label> mxMarginLabel; |
94 | | |
95 | | ::sfx2::sidebar::ControllerItem maPaperSizeController; |
96 | | ::sfx2::sidebar::ControllerItem maPaperOrientationController; |
97 | | ::sfx2::sidebar::ControllerItem maPaperMarginLRController; |
98 | | ::sfx2::sidebar::ControllerItem maPaperMarginULController; |
99 | | ::sfx2::sidebar::ControllerItem maBckColorController; |
100 | | ::sfx2::sidebar::ControllerItem maBckGradientController; |
101 | | ::sfx2::sidebar::ControllerItem maBckHatchController; |
102 | | ::sfx2::sidebar::ControllerItem maBckBitmapController; |
103 | | ::sfx2::sidebar::ControllerItem maBckFillStyleController; |
104 | | ::sfx2::sidebar::ControllerItem maBckImageController; |
105 | | ::sfx2::sidebar::ControllerItem maDspBckController; |
106 | | ::sfx2::sidebar::ControllerItem maDspObjController; |
107 | | ::sfx2::sidebar::ControllerItem maMetricController; |
108 | | ::sfx2::sidebar::ControllerItem maCloseMasterController; |
109 | | |
110 | | std::unique_ptr< SvxPageItem > mpPageItem; |
111 | | std::unique_ptr< XFillColorItem > mpColorItem; |
112 | | std::unique_ptr< XFillGradientItem > mpGradientItem; |
113 | | std::unique_ptr< XFillHatchItem > mpHatchItem; |
114 | | std::unique_ptr< XFillBitmapItem > mpBitmapItem; |
115 | | |
116 | | bool mbSwitchModeToNormal; |
117 | | bool mbSwitchModeToMaster; |
118 | | |
119 | | css::uno::Reference<css::frame::XFrame> mxFrame; |
120 | | vcl::EnumContext maContext; |
121 | | vcl::EnumContext maDrawOtherContext; |
122 | | vcl::EnumContext maDrawMasterContext; |
123 | | vcl::EnumContext maImpressOtherContext; |
124 | | vcl::EnumContext maImpressMasterContext; |
125 | | vcl::EnumContext maImpressHandoutContext; |
126 | | vcl::EnumContext maImpressNotesContext; |
127 | | bool mbTitle; |
128 | | std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; |
129 | | std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem; |
130 | | ::tools::Long m_nPageLeftMargin; |
131 | | ::tools::Long m_nPageRightMargin; |
132 | | ::tools::Long m_nPageTopMargin; |
133 | | ::tools::Long m_nPageBottomMargin; |
134 | | FieldUnit meFUnit; |
135 | | OUString maCustomEntry; |
136 | | |
137 | | SfxBindings* mpBindings; |
138 | | |
139 | | MapUnit meUnit; |
140 | | |
141 | | // MCGR: Preserve ColorStops until we have a UI to edit these |
142 | | basegfx::BColorStops maColorStops; |
143 | | |
144 | | DECL_LINK(FillBackgroundHdl, weld::ComboBox&, void); |
145 | | DECL_LINK(FillStyleModifyHdl, weld::ComboBox&, void); |
146 | | DECL_LINK(PaperSizeModifyHdl, weld::ComboBox&, void); |
147 | | DECL_LINK(FillColorHdl, ColorListBox&, void); |
148 | | DECL_LINK(AssignMasterPage, weld::ComboBox&, void); |
149 | | DECL_LINK(DspBackground, weld::Toggleable&, void); |
150 | | DECL_LINK(DspObjects, weld::Toggleable&, void); |
151 | | DECL_LINK(CloseMasterHdl, weld::Button&, void); |
152 | | DECL_LINK(EditMasterHdl, weld::Button&, void); |
153 | | DECL_LINK(SelectBgHdl, weld::Button&, void); |
154 | | DECL_LINK(EventMultiplexerListener, tools::EventMultiplexerEvent&, void ); |
155 | | DECL_LINK( ModifyMarginHdl, weld::ComboBox&, void ); |
156 | | |
157 | | void Initialize(); |
158 | | void Update(); |
159 | | void UpdateMarginBox(); |
160 | | void SetPanelTitle(const OUString& rTitle); |
161 | | void SetMarginsFieldUnit(); |
162 | | |
163 | | Color const & GetColorSetOrDefault(); |
164 | | basegfx::BGradient const & GetGradientSetOrDefault(); |
165 | | OUString const & GetHatchingSetOrDefault(); |
166 | | OUString const & GetBitmapSetOrDefault(); |
167 | | OUString const & GetPatternSetOrDefault(); |
168 | | bool IsDraw(); |
169 | | bool IsImpress(); |
170 | | void addListener(); |
171 | | void removeListener(); |
172 | | void ExecuteMarginLRChange(const ::tools::Long mnPageLeftMargin, const ::tools::Long mnPageRightMargin); |
173 | | void ExecuteMarginULChange(const ::tools::Long mnPageTopMargin, const ::tools::Long mnPageBottomMargin); |
174 | | void populateMasterSlideDropdown(); |
175 | | void updateMasterSlideSelection(); |
176 | | |
177 | | static FieldUnit GetCurrentUnit(SfxItemState eState, const SfxPoolItem* pState); |
178 | | |
179 | | // MCGR: Preserve ColorStops until we have a UI to edit these |
180 | | basegfx::BColorStops createColorStops(); |
181 | | }; |
182 | | |
183 | | } |
184 | | |
185 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |