Line data Source code
1 : /*
2 : * This file is part of the LibreOffice project.
3 : *
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/.
7 : *
8 : * This file incorporates work covered by the following license notice:
9 : *
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 .
17 : */
18 : #ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
19 : #define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
20 :
21 : #include <com/sun/star/frame/XFrame.hpp>
22 : #include <com/sun/star/document/XUndoManager.hpp>
23 :
24 : #include <svx/sidebar/Popup.hxx>
25 : #include <svx/sidebar/PanelLayout.hxx>
26 :
27 : #include <sfx2/sidebar/ControllerItem.hxx>
28 :
29 : namespace svx { namespace sidebar {
30 : class PopupControl;
31 : } }
32 :
33 : #include <i18nutil/paper.hxx>
34 :
35 : #include <svx/pageitem.hxx>
36 : #include <svx/rulritem.hxx>
37 : #include <editeng/sizeitem.hxx>
38 :
39 : #include <vcl/ctrl.hxx>
40 : #include <vcl/fixed.hxx>
41 : #include <vcl/button.hxx>
42 : #include <vcl/toolbox.hxx>
43 : #include <vcl/lstbox.hxx>
44 : #include <vcl/field.hxx>
45 : #include <svl/intitem.hxx>
46 :
47 : #include <boost/scoped_ptr.hpp>
48 :
49 :
50 : namespace css = ::com::sun::star;
51 : namespace cssu = ::com::sun::star::uno;
52 :
53 : namespace sw { namespace sidebar {
54 :
55 : class PagePropertyPanel
56 : : public PanelLayout,
57 : public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
58 : {
59 : public:
60 : static PagePropertyPanel* Create(
61 : Window* pParent,
62 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
63 : SfxBindings* pBindings );
64 :
65 : // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
66 : virtual void NotifyItemUpdate(
67 : const sal_uInt16 nSId,
68 : const SfxItemState eState,
69 : const SfxPoolItem* pState,
70 : const bool bIsEnabled);
71 :
72 0 : SfxBindings* GetBindings() const
73 : {
74 0 : return mpBindings;
75 : }
76 :
77 :
78 : ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
79 : void ExecuteOrientationChange( const sal_Bool bLandscape );
80 : void ClosePageOrientationPopup();
81 :
82 : ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
83 : void ExecuteMarginLRChange(
84 : const long nPageLeftMargin,
85 : const long nPageRightMargin );
86 : void ExecuteMarginULChange(
87 : const long nPageTopMargin,
88 : const long nPageBottomMargin );
89 : void ExecutePageLayoutChange( const bool bMirrored );
90 : void ClosePageMarginPopup();
91 :
92 : ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
93 : void ExecuteSizeChange( const Paper ePaper );
94 : void ClosePageSizePopup();
95 :
96 : ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
97 : void ExecuteColumnChange( const sal_uInt16 nColumnType );
98 : void ClosePageColumnPopup();
99 :
100 : void StartUndo();
101 : void EndUndo();
102 :
103 : private:
104 : PagePropertyPanel(
105 : Window* pParent,
106 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
107 : SfxBindings* pBindings );
108 : virtual ~PagePropertyPanel(void);
109 :
110 : SfxBindings* mpBindings;
111 :
112 : // toolboxes - on click open corresponding popup
113 : ToolBox* mpToolBoxOrientation;
114 : ToolBox* mpToolBoxMargin;
115 : ToolBox* mpToolBoxSize;
116 : ToolBox* mpToolBoxColumn;
117 :
118 : Image* maImgSize;
119 : Image* maImgSize_L;
120 : Image mImgPortrait;
121 : Image mImgLandscape;
122 : Image mImgNarrow;
123 : Image mImgNormal;
124 : Image mImgWide;
125 : Image mImgMirrored;
126 : Image mImgMarginCustom;
127 : Image mImgNarrow_L;
128 : Image mImgNormal_L;
129 : Image mImgWide_L;
130 : Image mImgMirrored_L;
131 : Image mImgMarginCustom_L;
132 : Image mImgA3;
133 : Image mImgA4;
134 : Image mImgA5;
135 : Image mImgB4;
136 : Image mImgB5;
137 : Image mImgC5;
138 : Image mImgLetter;
139 : Image mImgLegal;
140 : Image mImgSizeNone;
141 : Image mImgA3_L;
142 : Image mImgA4_L;
143 : Image mImgA5_L;
144 : Image mImgB4_L;
145 : Image mImgB5_L;
146 : Image mImgC5_L;
147 : Image mImgLetter_L;
148 : Image mImgLegal_L;
149 : Image mImgSizeNone_L;
150 : Image mImgColumn1;
151 : Image mImgColumn2;
152 : Image mImgColumn3;
153 : Image mImgLeft;
154 : Image mImgRight;
155 : Image mImgColumnNone;
156 : Image mImgColumn1_L;
157 : Image mImgColumn2_L;
158 : Image mImgColumn3_L;
159 : Image mImgLeft_L;
160 : Image mImgRight_L;
161 : Image mImgColumnNone_L;
162 :
163 : // item keeping the following page style attributes:
164 : // - page orientation
165 : // - page usage - only left, only right, both, mirrored
166 : // item also hold the numbering type for the page style which should
167 : // be kept stable.
168 : ::boost::scoped_ptr<SvxPageItem> mpPageItem;
169 :
170 : // item keeping the page style's left and right margins
171 : ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
172 : // item keeping the page style's top and bottom margins
173 : ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
174 :
175 : // item keeping the page style's page size
176 : ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem;
177 : // Paper corresponding to the page style's page size
178 : Paper mePaper;
179 :
180 : // item keeping the page column type
181 : ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem;
182 :
183 : FieldUnit meFUnit;
184 : SfxMapUnit meUnit;
185 :
186 : // controller items
187 : ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl;
188 : ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl;
189 : ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl;
190 : ::sfx2::sidebar::ControllerItem m_aSwPagePgControl;
191 : ::sfx2::sidebar::ControllerItem m_aSwPageColControl;
192 : ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
193 :
194 : // popups
195 : ::svx::sidebar::Popup maOrientationPopup;
196 : ::svx::sidebar::Popup maMarginPopup;
197 : ::svx::sidebar::Popup maSizePopup;
198 : ::svx::sidebar::Popup maColumnPopup;
199 :
200 : const cssu::Reference< css::document::XUndoManager > mxUndoManager;
201 :
202 : bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
203 :
204 : // handler for popup toolboxes to show the popups
205 : DECL_LINK(ClickOrientationHdl, ToolBox* );
206 : DECL_LINK(ClickMarginHdl, ToolBox* );
207 : DECL_LINK(ClickSizeHdl, ToolBox* );
208 : DECL_LINK(ClickColumnHdl, ToolBox* );
209 :
210 : void Initialize();
211 :
212 : void MetricState( SfxItemState eState, const SfxPoolItem* pState );
213 :
214 : // helper to adjust popup toolbox' images
215 : void ChangeMarginImage();
216 : void ChangeSizeImage();
217 : void ChangeColumnImage( const sal_uInt16 nColumnType );
218 :
219 : };
220 :
221 : } } // end of namespace ::sw::sidebar
222 :
223 : #endif
|