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