1ff0525f2SOliver-Rainer Wittmann /**************************************************************
2ff0525f2SOliver-Rainer Wittmann *
3ff0525f2SOliver-Rainer Wittmann * Licensed to the Apache Software Foundation (ASF) under one
4ff0525f2SOliver-Rainer Wittmann * or more contributor license agreements.  See the NOTICE file
5ff0525f2SOliver-Rainer Wittmann * distributed with this work for additional information
6ff0525f2SOliver-Rainer Wittmann * regarding copyright ownership.  The ASF licenses this file
7ff0525f2SOliver-Rainer Wittmann * to you under the Apache License, Version 2.0 (the
8ff0525f2SOliver-Rainer Wittmann * "License"); you may not use this file except in compliance
9ff0525f2SOliver-Rainer Wittmann * with the License.  You may obtain a copy of the License at
10ff0525f2SOliver-Rainer Wittmann *
11ff0525f2SOliver-Rainer Wittmann *   http://www.apache.org/licenses/LICENSE-2.0
12ff0525f2SOliver-Rainer Wittmann *
13ff0525f2SOliver-Rainer Wittmann * Unless required by applicable law or agreed to in writing,
14ff0525f2SOliver-Rainer Wittmann * software distributed under the License is distributed on an
15ff0525f2SOliver-Rainer Wittmann * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16ff0525f2SOliver-Rainer Wittmann * KIND, either express or implied.  See the License for the
17ff0525f2SOliver-Rainer Wittmann * specific language governing permissions and limitations
18ff0525f2SOliver-Rainer Wittmann * under the License.
19ff0525f2SOliver-Rainer Wittmann *
20ff0525f2SOliver-Rainer Wittmann *************************************************************/
21ff0525f2SOliver-Rainer Wittmann 
22ff0525f2SOliver-Rainer Wittmann #ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
23ff0525f2SOliver-Rainer Wittmann #define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
24ff0525f2SOliver-Rainer Wittmann 
25550fbbbdSOliver-Rainer Wittmann #include <com/sun/star/frame/XFrame.hpp>
26550fbbbdSOliver-Rainer Wittmann #include <com/sun/star/document/XUndoManager.hpp>
27550fbbbdSOliver-Rainer Wittmann 
28ff0525f2SOliver-Rainer Wittmann #include <svx/sidebar/Popup.hxx>
29ff0525f2SOliver-Rainer Wittmann 
30ff0525f2SOliver-Rainer Wittmann #include <sfx2/sidebar/ControllerItem.hxx>
31*6a606da0SAndre Fischer #include <sfx2/sidebar/GridLayouter.hxx>
32ff0525f2SOliver-Rainer Wittmann 
33ff0525f2SOliver-Rainer Wittmann namespace svx { namespace sidebar {
34ff0525f2SOliver-Rainer Wittmann     class PopupControl;
35ff0525f2SOliver-Rainer Wittmann } }
36ff0525f2SOliver-Rainer Wittmann 
37ff0525f2SOliver-Rainer Wittmann #include <i18npool/paper.hxx>
38ff0525f2SOliver-Rainer Wittmann 
39ff0525f2SOliver-Rainer Wittmann #include <svx/pageitem.hxx>
40f120fe41SAndre Fischer #include <svx/rulritem.hxx>
41ff0525f2SOliver-Rainer Wittmann #include <editeng/sizeitem.hxx>
42ff0525f2SOliver-Rainer Wittmann 
43ff0525f2SOliver-Rainer Wittmann #include <vcl/ctrl.hxx>
44ff0525f2SOliver-Rainer Wittmann #include <vcl/fixed.hxx>
45ff0525f2SOliver-Rainer Wittmann #include <vcl/button.hxx>
46ff0525f2SOliver-Rainer Wittmann #include <vcl/toolbox.hxx>
47ff0525f2SOliver-Rainer Wittmann #include <vcl/lstbox.hxx>
48ff0525f2SOliver-Rainer Wittmann #include <vcl/field.hxx>
49f120fe41SAndre Fischer #include <svl/intitem.hxx>
50ff0525f2SOliver-Rainer Wittmann 
51ff0525f2SOliver-Rainer Wittmann #include <boost/scoped_ptr.hpp>
52ff0525f2SOliver-Rainer Wittmann 
53ff0525f2SOliver-Rainer Wittmann 
54f120fe41SAndre Fischer namespace css = ::com::sun::star;
55f120fe41SAndre Fischer namespace cssu = ::com::sun::star::uno;
56f120fe41SAndre Fischer 
57ff0525f2SOliver-Rainer Wittmann namespace sw { namespace sidebar {
58ff0525f2SOliver-Rainer Wittmann 
59ff0525f2SOliver-Rainer Wittmann     class PagePropertyPanel
60ff0525f2SOliver-Rainer Wittmann         : public Control,
61ff0525f2SOliver-Rainer Wittmann           public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
62ff0525f2SOliver-Rainer Wittmann     {
63ff0525f2SOliver-Rainer Wittmann     public:
64ff0525f2SOliver-Rainer Wittmann         static PagePropertyPanel* Create(
65ff0525f2SOliver-Rainer Wittmann             Window* pParent,
66550fbbbdSOliver-Rainer Wittmann             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
675cd5f659SOliver-Rainer Wittmann             SfxBindings* pBindings );
68ff0525f2SOliver-Rainer Wittmann 
69ff0525f2SOliver-Rainer Wittmann         // interface of ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
70ff0525f2SOliver-Rainer Wittmann         virtual void NotifyItemUpdate(
71ff0525f2SOliver-Rainer Wittmann             const sal_uInt16 nSId,
72ff0525f2SOliver-Rainer Wittmann             const SfxItemState eState,
7345da7d5eSAndre Fischer             const SfxPoolItem* pState,
7445da7d5eSAndre Fischer             const bool bIsEnabled);
75ff0525f2SOliver-Rainer Wittmann 
GetBindings() const76ff0525f2SOliver-Rainer Wittmann         SfxBindings* GetBindings() const
77ff0525f2SOliver-Rainer Wittmann         {
78ff0525f2SOliver-Rainer Wittmann             return mpBindings;
79ff0525f2SOliver-Rainer Wittmann         }
80ff0525f2SOliver-Rainer Wittmann 
81ff0525f2SOliver-Rainer Wittmann 
82ff0525f2SOliver-Rainer Wittmann         ::svx::sidebar::PopupControl* CreatePageOrientationControl( ::svx::sidebar::PopupContainer* pParent );
83ff0525f2SOliver-Rainer Wittmann         void ExecuteOrientationChange( const sal_Bool bLandscape );
84ff0525f2SOliver-Rainer Wittmann         void ClosePageOrientationPopup();
85ff0525f2SOliver-Rainer Wittmann 
86ff0525f2SOliver-Rainer Wittmann         ::svx::sidebar::PopupControl* CreatePageMarginControl( ::svx::sidebar::PopupContainer* pParent );
87ff0525f2SOliver-Rainer Wittmann         void ExecuteMarginLRChange(
88ff0525f2SOliver-Rainer Wittmann             const long nPageLeftMargin,
89ff0525f2SOliver-Rainer Wittmann             const long nPageRightMargin );
90ff0525f2SOliver-Rainer Wittmann         void ExecuteMarginULChange(
91ff0525f2SOliver-Rainer Wittmann             const long nPageTopMargin,
92ff0525f2SOliver-Rainer Wittmann             const long nPageBottomMargin );
93ff0525f2SOliver-Rainer Wittmann         void ExecutePageLayoutChange( const bool bMirrored );
94ff0525f2SOliver-Rainer Wittmann         void ClosePageMarginPopup();
95ff0525f2SOliver-Rainer Wittmann 
96ff0525f2SOliver-Rainer Wittmann         ::svx::sidebar::PopupControl* CreatePageSizeControl( ::svx::sidebar::PopupContainer* pParent );
97ff0525f2SOliver-Rainer Wittmann         void ExecuteSizeChange( const Paper ePaper );
98ff0525f2SOliver-Rainer Wittmann         void ClosePageSizePopup();
99ff0525f2SOliver-Rainer Wittmann 
100ff0525f2SOliver-Rainer Wittmann         ::svx::sidebar::PopupControl* CreatePageColumnControl( ::svx::sidebar::PopupContainer* pParent );
101ff0525f2SOliver-Rainer Wittmann         void ExecuteColumnChange( const sal_uInt16 nColumnType );
102ff0525f2SOliver-Rainer Wittmann         void ClosePageColumnPopup();
103ff0525f2SOliver-Rainer Wittmann 
104550fbbbdSOliver-Rainer Wittmann         void StartUndo();
105550fbbbdSOliver-Rainer Wittmann         void EndUndo();
106550fbbbdSOliver-Rainer Wittmann 
107*6a606da0SAndre Fischer         // Inherited from vcl Window.
108*6a606da0SAndre Fischer         virtual void Resize (void);
109*6a606da0SAndre Fischer 
110ff0525f2SOliver-Rainer Wittmann     private:
111ff0525f2SOliver-Rainer Wittmann         PagePropertyPanel(
112ff0525f2SOliver-Rainer Wittmann             Window* pParent,
113550fbbbdSOliver-Rainer Wittmann             const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame>& rxFrame,
1145cd5f659SOliver-Rainer Wittmann             SfxBindings* pBindings );
115ff0525f2SOliver-Rainer Wittmann         virtual ~PagePropertyPanel(void);
116ff0525f2SOliver-Rainer Wittmann 
117ff0525f2SOliver-Rainer Wittmann         SfxBindings* mpBindings;
118ff0525f2SOliver-Rainer Wittmann 
119ff0525f2SOliver-Rainer Wittmann         // toolboxes - on click open corresponding popup
120ff0525f2SOliver-Rainer Wittmann         FixedText   maFtOrientation;
121ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<Window> mpToolBoxOrientationBackground;
122ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<ToolBox> mpToolBoxOrientation;
123ff0525f2SOliver-Rainer Wittmann         FixedText				maFtMargin;
124ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<Window> mpToolBoxMarginBackground;
125ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<ToolBox> mpToolBoxMargin;
126ff0525f2SOliver-Rainer Wittmann         FixedText				maFtSize;
127ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<Window> mpToolBoxSizeBackground;
128ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<ToolBox> mpToolBoxSize;
129ff0525f2SOliver-Rainer Wittmann         FixedText				maFtColumn;
130ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<Window> mpToolBoxColumnBackground;
131ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<ToolBox> mpToolBoxColumn;
132ff0525f2SOliver-Rainer Wittmann 
133ff0525f2SOliver-Rainer Wittmann         Image*					maImgSize;
134ff0525f2SOliver-Rainer Wittmann         Image*					maImgSize_L;
135ff0525f2SOliver-Rainer Wittmann         Image					mImgPortrait;
136ff0525f2SOliver-Rainer Wittmann         Image					mImgLandscape;
137ff0525f2SOliver-Rainer Wittmann         Image					mImgNarrow;
138ff0525f2SOliver-Rainer Wittmann         Image					mImgNormal;
139ff0525f2SOliver-Rainer Wittmann         Image					mImgWide;
140ff0525f2SOliver-Rainer Wittmann         Image					mImgMirrored;
141ff0525f2SOliver-Rainer Wittmann         Image					mImgMarginCustom;
142ff0525f2SOliver-Rainer Wittmann         Image					mImgNarrow_L;
143ff0525f2SOliver-Rainer Wittmann         Image					mImgNormal_L;
144ff0525f2SOliver-Rainer Wittmann         Image					mImgWide_L;
145ff0525f2SOliver-Rainer Wittmann         Image					mImgMirrored_L;
146ff0525f2SOliver-Rainer Wittmann         Image					mImgMarginCustom_L;
147ff0525f2SOliver-Rainer Wittmann         Image					mImgA3;
148ff0525f2SOliver-Rainer Wittmann         Image					mImgA4;
149ff0525f2SOliver-Rainer Wittmann         Image					mImgA5;
150ff0525f2SOliver-Rainer Wittmann         Image					mImgB4;
151ff0525f2SOliver-Rainer Wittmann         Image					mImgB5;
152ff0525f2SOliver-Rainer Wittmann         Image					mImgC5;
153ff0525f2SOliver-Rainer Wittmann         Image					mImgLetter;
154ff0525f2SOliver-Rainer Wittmann         Image					mImgLegal;
155ff0525f2SOliver-Rainer Wittmann         Image					mImgSizeNone;
156ff0525f2SOliver-Rainer Wittmann         Image					mImgA3_L;
157ff0525f2SOliver-Rainer Wittmann         Image					mImgA4_L;
158ff0525f2SOliver-Rainer Wittmann         Image					mImgA5_L;
159ff0525f2SOliver-Rainer Wittmann         Image					mImgB4_L;
160ff0525f2SOliver-Rainer Wittmann         Image					mImgB5_L;
161ff0525f2SOliver-Rainer Wittmann         Image					mImgC5_L;
162ff0525f2SOliver-Rainer Wittmann         Image					mImgLetter_L;
163ff0525f2SOliver-Rainer Wittmann         Image					mImgLegal_L;
164ff0525f2SOliver-Rainer Wittmann         Image					mImgSizeNone_L;
165ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn1;
166ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn2;
167ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn3;
168ff0525f2SOliver-Rainer Wittmann         Image					mImgLeft;
169ff0525f2SOliver-Rainer Wittmann         Image					mImgRight;
170ff0525f2SOliver-Rainer Wittmann         Image					mImgColumnNone;
171ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn1_L;
172ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn2_L;
173ff0525f2SOliver-Rainer Wittmann         Image					mImgColumn3_L;
174ff0525f2SOliver-Rainer Wittmann         Image					mImgLeft_L;
175ff0525f2SOliver-Rainer Wittmann         Image					mImgRight_L;
176ff0525f2SOliver-Rainer Wittmann         Image					mImgColumnNone_L;
177ff0525f2SOliver-Rainer Wittmann 
178ff0525f2SOliver-Rainer Wittmann         // item keeping the following page style attributes:
179ff0525f2SOliver-Rainer Wittmann         // - page orientation
180ff0525f2SOliver-Rainer Wittmann         // - page usage - only left, only right, both, mirrored
181ff0525f2SOliver-Rainer Wittmann         // item also hold the numbering type for the page style which should
182ff0525f2SOliver-Rainer Wittmann         // be kept stable.
183ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<SvxPageItem> mpPageItem;
184ff0525f2SOliver-Rainer Wittmann 
185ff0525f2SOliver-Rainer Wittmann         // item keeping the page style's left and right margins
186ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
187ff0525f2SOliver-Rainer Wittmann         // item keeping the page style's top and bottom margins
188ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
189ff0525f2SOliver-Rainer Wittmann 
190ff0525f2SOliver-Rainer Wittmann         // item keeping the page style's page size
191ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<SvxSizeItem> mpPageSizeItem;
192ff0525f2SOliver-Rainer Wittmann         // Paper corresponding to the page style's page size
193ff0525f2SOliver-Rainer Wittmann         Paper mePaper;
194ff0525f2SOliver-Rainer Wittmann 
195ff0525f2SOliver-Rainer Wittmann         // item keeping the page column type
196ff0525f2SOliver-Rainer Wittmann         ::boost::scoped_ptr<SfxInt16Item> mpPageColumnTypeItem;
197ff0525f2SOliver-Rainer Wittmann 
198ff0525f2SOliver-Rainer Wittmann         FieldUnit 			meFUnit;
199ff0525f2SOliver-Rainer Wittmann         SfxMapUnit			meUnit;
200ff0525f2SOliver-Rainer Wittmann 
201ff0525f2SOliver-Rainer Wittmann         // controller items
202ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl;
203ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl;
204ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl;
205ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPagePgControl;
206ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPageColControl;
207ff0525f2SOliver-Rainer Wittmann         ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl;
208ff0525f2SOliver-Rainer Wittmann 
209ff0525f2SOliver-Rainer Wittmann         // popups
210550fbbbdSOliver-Rainer Wittmann         ::svx::sidebar::Popup maOrientationPopup;
211550fbbbdSOliver-Rainer Wittmann         ::svx::sidebar::Popup maMarginPopup;
212550fbbbdSOliver-Rainer Wittmann         ::svx::sidebar::Popup maSizePopup;
213550fbbbdSOliver-Rainer Wittmann         ::svx::sidebar::Popup maColumnPopup;
214550fbbbdSOliver-Rainer Wittmann 
215550fbbbdSOliver-Rainer Wittmann         const cssu::Reference< css::document::XUndoManager > mxUndoManager;
216ff0525f2SOliver-Rainer Wittmann 
2177dc3d34dSOliver-Rainer Wittmann         bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify;
218*6a606da0SAndre Fischer         ::sfx2::sidebar::GridLayouter maLayouter;
2197dc3d34dSOliver-Rainer Wittmann 
220ff0525f2SOliver-Rainer Wittmann         // handler for popup toolboxes to show the popups
221ff0525f2SOliver-Rainer Wittmann         DECL_LINK(ClickOrientationHdl, ToolBox* );
222ff0525f2SOliver-Rainer Wittmann         DECL_LINK(ClickMarginHdl, ToolBox* );
223ff0525f2SOliver-Rainer Wittmann         DECL_LINK(ClickSizeHdl, ToolBox* );
224ff0525f2SOliver-Rainer Wittmann         DECL_LINK(ClickColumnHdl, ToolBox* );
225ff0525f2SOliver-Rainer Wittmann 
226ff0525f2SOliver-Rainer Wittmann         void Initialize();
227ff0525f2SOliver-Rainer Wittmann 
228ff0525f2SOliver-Rainer Wittmann         void MetricState( SfxItemState eState, const SfxPoolItem* pState );
229ff0525f2SOliver-Rainer Wittmann 
230ff0525f2SOliver-Rainer Wittmann         // helper to adjust popup toolbox' images
231ff0525f2SOliver-Rainer Wittmann         void ChangeMarginImage();
232ff0525f2SOliver-Rainer Wittmann         void ChangeSizeImage();
233ff0525f2SOliver-Rainer Wittmann         void ChangeColumnImage( const sal_uInt16 nColumnType );
234ff0525f2SOliver-Rainer Wittmann 
235ff0525f2SOliver-Rainer Wittmann     };
236ff0525f2SOliver-Rainer Wittmann 
237ff0525f2SOliver-Rainer Wittmann } } // end of namespace ::sw::sidebar
238ff0525f2SOliver-Rainer Wittmann 
239ff0525f2SOliver-Rainer Wittmann #endif
240