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