update credits
[LibreOffice.git] / sw / source / ui / sidebar / PagePropertyPanel.hxx
blob095d07331ba7c25cef7ea1db79ad8a2fc233d130
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
19 #define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
21 #include <com/sun/star/frame/XFrame.hpp>
22 #include <com/sun/star/document/XUndoManager.hpp>
24 #include <svx/sidebar/Popup.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
28 namespace svx { namespace sidebar {
29 class PopupControl;
30 } }
32 #include <i18nutil/paper.hxx>
34 #include <svx/pageitem.hxx>
35 #include <svx/rulritem.hxx>
36 #include <editeng/sizeitem.hxx>
38 #include <vcl/ctrl.hxx>
39 #include <vcl/fixed.hxx>
40 #include <vcl/button.hxx>
41 #include <vcl/toolbox.hxx>
42 #include <vcl/lstbox.hxx>
43 #include <vcl/field.hxx>
44 #include <svl/intitem.hxx>
46 #include <boost/scoped_ptr.hpp>
49 namespace css = ::com::sun::star;
50 namespace cssu = ::com::sun::star::uno;
52 namespace sw { namespace sidebar {
54 class PagePropertyPanel
55 : public Control,
56 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
58 public:
59 static PagePropertyPanel* Create(
60 Window* pParent,
61 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
62 SfxBindings* pBindings );
64 // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
65 virtual void NotifyItemUpdate(
66 const sal_uInt16 nSId,
67 const SfxItemState eState,
68 const SfxPoolItem* pState,
69 const bool bIsEnabled);
71 SfxBindings* GetBindings() const
73 return mpBindings;
77 ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
78 void ExecuteOrientationChange( const sal_Bool bLandscape );
79 void ClosePageOrientationPopup();
81 ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
82 void ExecuteMarginLRChange(
83 const long nPageLeftMargin,
84 const long nPageRightMargin );
85 void ExecuteMarginULChange(
86 const long nPageTopMargin,
87 const long nPageBottomMargin );
88 void ExecutePageLayoutChange( const bool bMirrored );
89 void ClosePageMarginPopup();
91 ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
92 void ExecuteSizeChange( const Paper ePaper );
93 void ClosePageSizePopup();
95 ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
96 void ExecuteColumnChange( const sal_uInt16 nColumnType );
97 void ClosePageColumnPopup();
99 void StartUndo();
100 void EndUndo();
102 private:
103 PagePropertyPanel(
104 Window* pParent,
105 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
106 SfxBindings* pBindings );
107 virtual ~PagePropertyPanel(void);
109 SfxBindings* mpBindings;
111 // toolboxes - on click open corresponding popup
112 FixedText maFtOrientation;
113 ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground;
114 ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation;
115 FixedText maFtMargin;
116 ::boost::scoped_ptr<Window> mpToolBoxMarginBackground;
117 ::boost::scoped_ptr<ToolBox> mpToolBoxMargin;
118 FixedText maFtSize;
119 ::boost::scoped_ptr<Window> mpToolBoxSizeBackground;
120 ::boost::scoped_ptr<ToolBox> mpToolBoxSize;
121 FixedText maFtColumn;
122 ::boost::scoped_ptr<Window> mpToolBoxColumnBackground;
123 ::boost::scoped_ptr<ToolBox> mpToolBoxColumn;
125 Image* maImgSize;
126 Image* maImgSize_L;
127 Image mImgPortrait;
128 Image mImgLandscape;
129 Image mImgNarrow;
130 Image mImgNormal;
131 Image mImgWide;
132 Image mImgMirrored;
133 Image mImgMarginCustom;
134 Image mImgNarrow_L;
135 Image mImgNormal_L;
136 Image mImgWide_L;
137 Image mImgMirrored_L;
138 Image mImgMarginCustom_L;
139 Image mImgA3;
140 Image mImgA4;
141 Image mImgA5;
142 Image mImgB4;
143 Image mImgB5;
144 Image mImgC5;
145 Image mImgLetter;
146 Image mImgLegal;
147 Image mImgSizeNone;
148 Image mImgA3_L;
149 Image mImgA4_L;
150 Image mImgA5_L;
151 Image mImgB4_L;
152 Image mImgB5_L;
153 Image mImgC5_L;
154 Image mImgLetter_L;
155 Image mImgLegal_L;
156 Image mImgSizeNone_L;
157 Image mImgColumn1;
158 Image mImgColumn2;
159 Image mImgColumn3;
160 Image mImgLeft;
161 Image mImgRight;
162 Image mImgColumnNone;
163 Image mImgColumn1_L;
164 Image mImgColumn2_L;
165 Image mImgColumn3_L;
166 Image mImgLeft_L;
167 Image mImgRight_L;
168 Image mImgColumnNone_L;
170 // item keeping the following page style attributes:
171 // - page orientation
172 // - page usage - only left, only right, both, mirrored
173 // item also hold the numbering type for the page style which should
174 // be kept stable.
175 ::boost::scoped_ptr<SvxPageItem> mpPageItem;
177 // item keeping the page style's left and right margins
178 ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
179 // item keeping the page style's top and bottom margins
180 ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
182 // item keeping the page style's page size
183 ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem;
184 // Paper corresponding to the page style's page size
185 Paper mePaper;
187 // item keeping the page column type
188 ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem;
190 FieldUnit meFUnit;
191 SfxMapUnit meUnit;
193 // controller items
194 ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl;
195 ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl;
196 ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl;
197 ::sfx2::sidebar::ControllerItem m_aSwPagePgControl;
198 ::sfx2::sidebar::ControllerItem m_aSwPageColControl;
199 ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
201 // popups
202 ::svx::sidebar::Popup maOrientationPopup;
203 ::svx::sidebar::Popup maMarginPopup;
204 ::svx::sidebar::Popup maSizePopup;
205 ::svx::sidebar::Popup maColumnPopup;
207 const cssu::Reference< css::document::XUndoManager > mxUndoManager;
209 bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
211 // handler for popup toolboxes to show the popups
212 DECL_LINK(ClickOrientationHdl, ToolBox* );
213 DECL_LINK(ClickMarginHdl, ToolBox* );
214 DECL_LINK(ClickSizeHdl, ToolBox* );
215 DECL_LINK(ClickColumnHdl, ToolBox* );
217 void Initialize();
219 void MetricState( SfxItemState eState, const SfxPoolItem* pState );
221 // helper to adjust popup toolbox' images
222 void ChangeMarginImage();
223 void ChangeSizeImage();
224 void ChangeColumnImage( const sal_uInt16 nColumnType );
228 } } // end of namespace ::sw::sidebar
230 #endif