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