Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / sw / source / uibase / sidebar / PageFormatPanel.hxx
blob94b611d4278a0cef0d63840381cefe7b5d70522f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEFORMATPANEL_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEFORMATPANEL_HXX
22 #include <com/sun/star/frame/XFrame.hpp>
24 #include <svx/sidebar/PanelLayout.hxx>
26 #include <sfx2/sidebar/ControllerItem.hxx>
28 #include <i18nutil/paper.hxx>
30 #include <svx/pageitem.hxx>
31 #include <svx/rulritem.hxx>
32 #include <svx/papersizelistbox.hxx>
33 #include <editeng/sizeitem.hxx>
35 #include <vcl/ctrl.hxx>
36 #include <vcl/fixed.hxx>
37 #include <vcl/button.hxx>
38 #include <vcl/toolbox.hxx>
39 #include <vcl/lstbox.hxx>
40 #include <vcl/field.hxx>
41 #include <svl/intitem.hxx>
42 #include <tools/fldunit.hxx>
43 #include <svl/poolitem.hxx>
44 #include <svx/relfld.hxx>
46 #include <memory>
47 #include <vector>
49 namespace sw { namespace sidebar {
51 class PageFormatPanel:
52 public PanelLayout,
53 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface
55 public:
56 static VclPtr<vcl::Window> Create(
57 vcl::Window* pParent,
58 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
59 SfxBindings* pBindings);
61 virtual void NotifyItemUpdate(
62 const sal_uInt16 nSId,
63 const SfxItemState eState,
64 const SfxPoolItem* pState,
65 const bool bIsEnabled) override;
67 PageFormatPanel(
68 vcl::Window* pParent,
69 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rxFrame,
70 SfxBindings* pBindings);
71 virtual ~PageFormatPanel() override;
72 virtual void dispose() override;
74 static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState );
76 private:
78 SfxBindings* mpBindings;
80 VclPtr<PaperSizeListBox> mpPaperSizeBox;
81 VclPtr<SvxRelativeField> mpPaperWidth;
82 VclPtr<SvxRelativeField> mpPaperHeight;
83 VclPtr<ListBox> mpPaperOrientation;
84 VclPtr<ListBox> mpMarginSelectBox;
85 VclPtr<FixedText> mpCustomEntry;
87 ::sfx2::sidebar::ControllerItem maPaperSizeController;
88 ::sfx2::sidebar::ControllerItem maPaperOrientationController;
89 ::sfx2::sidebar::ControllerItem maMetricController;
90 ::sfx2::sidebar::ControllerItem maSwPageLRControl;
91 ::sfx2::sidebar::ControllerItem maSwPageULControl;
93 std::unique_ptr<SvxPageItem> mpPageItem;
94 std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem;
95 std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem;
97 FieldUnit meFUnit, meLastFUnit;
98 MapUnit meUnit;
100 long mnPageLeftMargin;
101 long mnPageRightMargin;
102 long mnPageTopMargin;
103 long mnPageBottomMargin;
104 OUString aCustomEntry;
106 void Initialize();
107 void UpdateMarginBox();
108 void ExecuteMarginLRChange( const long nPageLeftMargin, const long nPageRightMargin );
109 void ExecuteMarginULChange( const long nPageTopMargin, const long nPageBottomMargin);
110 DECL_LINK(PaperFormatModifyHdl, ListBox&, void);
111 DECL_LINK(PaperSizeModifyHdl, Edit&, void);
112 DECL_LINK(PaperModifyMarginHdl, ListBox&, void );
115 } } //end of namespace sw::sidebar
117 #endif
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */