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