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 VclPtr<vcl::Window> 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 : VclPtr< svx::sidebar::PopupControl> CreatePageOrientationControl( svx::sidebar::PopupContainer* pParent );
76 : void ExecuteOrientationChange( const bool bLandscape );
77 : void ClosePageOrientationPopup();
78 :
79 : VclPtr< 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 : VclPtr< svx::sidebar::PopupControl> CreatePageSizeControl( svx::sidebar::PopupContainer* pParent );
90 : void ExecuteSizeChange( const Paper ePaper );
91 : void ClosePageSizePopup();
92 :
93 : VclPtr< 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 : PagePropertyPanel(
101 : vcl::Window* pParent,
102 : const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
103 : SfxBindings* pBindings );
104 : private:
105 : virtual ~PagePropertyPanel();
106 : virtual void dispose() SAL_OVERRIDE;
107 :
108 : SfxBindings* mpBindings;
109 :
110 : // toolboxes - on click open corresponding popup
111 : VclPtr<ToolBox> mpToolBoxOrientation;
112 : VclPtr<ToolBox> mpToolBoxMargin;
113 : VclPtr<ToolBox> mpToolBoxSize;
114 : VclPtr<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 css::uno::Reference< css::document::XUndoManager > mxUndoManager;
199 :
200 : bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
201 :
202 : // handler for popup toolboxes to show the popups
203 : DECL_LINK_TYPED(ClickOrientationHdl, ToolBox*, void);
204 : DECL_LINK_TYPED(ClickMarginHdl, ToolBox*, void);
205 : DECL_LINK_TYPED(ClickSizeHdl, ToolBox*, void);
206 : DECL_LINK_TYPED(ClickColumnHdl, ToolBox*, void);
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: */
|