xref: /AOO41X/main/sw/source/ui/sidebar/PagePropertyPanel.hxx (revision fe617e93560c0575040cf13b538ba840fa9e2479)
1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21 
22 #ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
23 #define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
24 
25 #include <svx/sidebar/Popup.hxx>
26 
27 #include <sfx2/sidebar/ControllerItem.hxx>
28 
29 namespace svx { namespace sidebar {
30     class PopupControl;
31 } }
32 
33 #include <i18npool/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 Control,
57           public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
58     {
59     public:
60         static PagePropertyPanel* Create(
61             Window* pParent,
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 
70         SfxBindings* GetBindings() const
71         {
72             return mpBindings;
73         }
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     private:
99         PagePropertyPanel(
100             Window* pParent,
101             SfxBindings* pBindings );
102         virtual ~PagePropertyPanel(void);
103 
104         SfxBindings* mpBindings;
105 
106         // toolboxes - on click open corresponding popup
107         FixedText   maFtOrientation;
108         ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground;
109         ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation;
110         FixedText               maFtMargin;
111         ::boost::scoped_ptr<Window> mpToolBoxMarginBackground;
112         ::boost::scoped_ptr<ToolBox> mpToolBoxMargin;
113         FixedText               maFtSize;
114         ::boost::scoped_ptr<Window> mpToolBoxSizeBackground;
115         ::boost::scoped_ptr<ToolBox> mpToolBoxSize;
116         FixedText               maFtColumn;
117         ::boost::scoped_ptr<Window> mpToolBoxColumnBackground;
118         ::boost::scoped_ptr<ToolBox> mpToolBoxColumn;
119 
120         Image*                  maImgSize;
121         Image*                  maImgSize_L;
122         Image                   mImgPortrait;
123         Image                   mImgLandscape;
124         Image                   mImgNarrow;
125         Image                   mImgNormal;
126         Image                   mImgWide;
127         Image                   mImgMirrored;
128         Image                   mImgMarginCustom;
129         Image                   mImgNarrow_L;
130         Image                   mImgNormal_L;
131         Image                   mImgWide_L;
132         Image                   mImgMirrored_L;
133         Image                   mImgMarginCustom_L;
134         Image                   mImgA3;
135         Image                   mImgA4;
136         Image                   mImgA5;
137         Image                   mImgB4;
138         Image                   mImgB5;
139         Image                   mImgC5;
140         Image                   mImgLetter;
141         Image                   mImgLegal;
142         Image                   mImgSizeNone;
143         Image                   mImgA3_L;
144         Image                   mImgA4_L;
145         Image                   mImgA5_L;
146         Image                   mImgB4_L;
147         Image                   mImgB5_L;
148         Image                   mImgC5_L;
149         Image                   mImgLetter_L;
150         Image                   mImgLegal_L;
151         Image                   mImgSizeNone_L;
152         Image                   mImgColumn1;
153         Image                   mImgColumn2;
154         Image                   mImgColumn3;
155         Image                   mImgLeft;
156         Image                   mImgRight;
157         Image                   mImgColumnNone;
158         Image                   mImgColumn1_L;
159         Image                   mImgColumn2_L;
160         Image                   mImgColumn3_L;
161         Image                   mImgLeft_L;
162         Image                   mImgRight_L;
163         Image                   mImgColumnNone_L;
164 
165         // item keeping the following page style attributes:
166         // - page orientation
167         // - page usage - only left, only right, both, mirrored
168         // item also hold the numbering type for the page style which should
169         // be kept stable.
170         ::boost::scoped_ptr<SvxPageItem> mpPageItem;
171 
172         // item keeping the page style's left and right margins
173         ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
174         // item keeping the page style's top and bottom margins
175         ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
176 
177         // item keeping the page style's page size
178         ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem;
179         // Paper corresponding to the page style's page size
180         Paper mePaper;
181 
182         // item keeping the page column type
183         ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem;
184 
185         FieldUnit           meFUnit;
186         SfxMapUnit          meUnit;
187 
188         // controller items
189         ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl;
190         ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl;
191         ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl;
192         ::sfx2::sidebar::ControllerItem m_aSwPagePgControl;
193         ::sfx2::sidebar::ControllerItem m_aSwPageColControl;
194         ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
195 
196         // popups
197         ::boost::scoped_ptr< ::svx::sidebar::Popup > mpOrientationPopup;
198         ::boost::scoped_ptr< ::svx::sidebar::Popup > mpMarginPopup;
199         ::boost::scoped_ptr< ::svx::sidebar::Popup > mpSizePopup;
200         ::boost::scoped_ptr< ::svx::sidebar::Popup > mpColumnPopup;
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
224