2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 #ifndef SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
19 #define SW_SIDEBAR_PAGE_PROPERTY_PANEL_HXX
21 #include <com/sun/star/frame/XFrame.hpp>
22 #include <com/sun/star/document/XUndoManager.hpp>
24 #include <svx/sidebar/Popup.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
28 namespace svx
{ namespace sidebar
{
32 #include <i18nutil/paper.hxx>
34 #include <svx/pageitem.hxx>
35 #include <svx/rulritem.hxx>
36 #include <editeng/sizeitem.hxx>
38 #include <vcl/ctrl.hxx>
39 #include <vcl/fixed.hxx>
40 #include <vcl/button.hxx>
41 #include <vcl/toolbox.hxx>
42 #include <vcl/lstbox.hxx>
43 #include <vcl/field.hxx>
44 #include <svl/intitem.hxx>
46 #include <boost/scoped_ptr.hpp>
49 namespace css
= ::com::sun::star
;
50 namespace cssu
= ::com::sun::star::uno
;
52 namespace sw
{ namespace sidebar
{
54 class PagePropertyPanel
56 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
59 static PagePropertyPanel
* Create(
61 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
62 SfxBindings
* pBindings
);
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 const bool bIsEnabled
);
71 SfxBindings
* GetBindings() const
77 ::svx::sidebar::PopupControl
* CreatePageOrientationControl( ::svx::sidebar::PopupContainer
* pParent
);
78 void ExecuteOrientationChange( const sal_Bool bLandscape
);
79 void ClosePageOrientationPopup();
81 ::svx::sidebar::PopupControl
* CreatePageMarginControl( ::svx::sidebar::PopupContainer
* pParent
);
82 void ExecuteMarginLRChange(
83 const long nPageLeftMargin
,
84 const long nPageRightMargin
);
85 void ExecuteMarginULChange(
86 const long nPageTopMargin
,
87 const long nPageBottomMargin
);
88 void ExecutePageLayoutChange( const bool bMirrored
);
89 void ClosePageMarginPopup();
91 ::svx::sidebar::PopupControl
* CreatePageSizeControl( ::svx::sidebar::PopupContainer
* pParent
);
92 void ExecuteSizeChange( const Paper ePaper
);
93 void ClosePageSizePopup();
95 ::svx::sidebar::PopupControl
* CreatePageColumnControl( ::svx::sidebar::PopupContainer
* pParent
);
96 void ExecuteColumnChange( const sal_uInt16 nColumnType
);
97 void ClosePageColumnPopup();
105 const ::com::sun::star::uno::Reference
< ::com::sun::star::frame::XFrame
>& rxFrame
,
106 SfxBindings
* pBindings
);
107 virtual ~PagePropertyPanel(void);
109 SfxBindings
* mpBindings
;
111 // toolboxes - on click open corresponding popup
112 FixedText maFtOrientation
;
113 ::boost::scoped_ptr
<Window
> mpToolBoxOrientationBackground
;
114 ::boost::scoped_ptr
<ToolBox
> mpToolBoxOrientation
;
115 FixedText maFtMargin
;
116 ::boost::scoped_ptr
<Window
> mpToolBoxMarginBackground
;
117 ::boost::scoped_ptr
<ToolBox
> mpToolBoxMargin
;
119 ::boost::scoped_ptr
<Window
> mpToolBoxSizeBackground
;
120 ::boost::scoped_ptr
<ToolBox
> mpToolBoxSize
;
121 FixedText maFtColumn
;
122 ::boost::scoped_ptr
<Window
> mpToolBoxColumnBackground
;
123 ::boost::scoped_ptr
<ToolBox
> mpToolBoxColumn
;
133 Image mImgMarginCustom
;
137 Image mImgMirrored_L
;
138 Image mImgMarginCustom_L
;
156 Image mImgSizeNone_L
;
162 Image mImgColumnNone
;
168 Image mImgColumnNone_L
;
170 // item keeping the following page style attributes:
171 // - page orientation
172 // - page usage - only left, only right, both, mirrored
173 // item also hold the numbering type for the page style which should
175 ::boost::scoped_ptr
<SvxPageItem
> mpPageItem
;
177 // item keeping the page style's left and right margins
178 ::boost::scoped_ptr
<SvxLongLRSpaceItem
> mpPageLRMarginItem
;
179 // item keeping the page style's top and bottom margins
180 ::boost::scoped_ptr
<SvxLongULSpaceItem
> mpPageULMarginItem
;
182 // item keeping the page style's page size
183 ::boost::scoped_ptr
<SvxSizeItem
> mpPageSizeItem
;
184 // Paper corresponding to the page style's page size
187 // item keeping the page column type
188 ::boost::scoped_ptr
<SfxInt16Item
> mpPageColumnTypeItem
;
194 ::sfx2::sidebar::ControllerItem m_aSwPagePgULControl
;
195 ::sfx2::sidebar::ControllerItem m_aSwPagePgLRControl
;
196 ::sfx2::sidebar::ControllerItem m_aSwPagePgSizeControl
;
197 ::sfx2::sidebar::ControllerItem m_aSwPagePgControl
;
198 ::sfx2::sidebar::ControllerItem m_aSwPageColControl
;
199 ::sfx2::sidebar::ControllerItem m_aSwPagePgMetricControl
;
202 ::svx::sidebar::Popup maOrientationPopup
;
203 ::svx::sidebar::Popup maMarginPopup
;
204 ::svx::sidebar::Popup maSizePopup
;
205 ::svx::sidebar::Popup maColumnPopup
;
207 const cssu::Reference
< css::document::XUndoManager
> mxUndoManager
;
209 bool mbInvalidateSIDAttrPageOnSIDAttrPageSizeNotify
;
211 // handler for popup toolboxes to show the popups
212 DECL_LINK(ClickOrientationHdl
, ToolBox
* );
213 DECL_LINK(ClickMarginHdl
, ToolBox
* );
214 DECL_LINK(ClickSizeHdl
, ToolBox
* );
215 DECL_LINK(ClickColumnHdl
, ToolBox
* );
219 void MetricState( SfxItemState eState
, const SfxPoolItem
* pState
);
221 // helper to adjust popup toolbox' images
222 void ChangeMarginImage();
223 void ChangeSizeImage();
224 void ChangeColumnImage( const sal_uInt16 nColumnType
);
228 } } // end of namespace ::sw::sidebar