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