1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 2 /* 3 * This file is part of the LibreOffice project. 4 * 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/. 8 * 9 * This file incorporates work covered by the following license notice: 10 * 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 . 18 */ 19 #pragma once 20 21 #include <sfx2/sidebar/PanelLayout.hxx> 22 #include <sfx2/sidebar/ControllerItem.hxx> 23 24 #include <svx/pageitem.hxx> 25 #include <svx/rulritem.hxx> 26 #include <svx/papersizelistbox.hxx> 27 28 #include <tools/fldunit.hxx> 29 #include <svl/poolitem.hxx> 30 #include <svx/relfld.hxx> 31 32 #include <memory> 33 34 namespace sw::sidebar { 35 36 class PageFormatPanel : 37 public PanelLayout, 38 public ::sfx2::sidebar::ControllerItem::ItemUpdateReceiverInterface 39 { 40 public: 41 static std::unique_ptr<PanelLayout> Create( 42 weld::Widget* pParent, 43 SfxBindings* pBindings); 44 45 virtual void NotifyItemUpdate( 46 const sal_uInt16 nSId, 47 const SfxItemState eState, 48 const SfxPoolItem* pState) override; 49 GetControlState(const sal_uInt16,boost::property_tree::ptree &)50 virtual void GetControlState( 51 const sal_uInt16 /*nSId*/, 52 boost::property_tree::ptree& /*rState*/) override {}; 53 54 PageFormatPanel( 55 weld::Widget* pParent, 56 SfxBindings* pBindings); 57 virtual ~PageFormatPanel() override; 58 59 static FieldUnit GetCurrentUnit( SfxItemState eState, const SfxPoolItem* pState ); 60 61 private: 62 63 SfxBindings* mpBindings; 64 65 std::unique_ptr<SvxPaperSizeListBox> mxPaperSizeBox; 66 std::unique_ptr<SvxRelativeField> mxPaperWidth; 67 std::unique_ptr<SvxRelativeField> mxPaperHeight; 68 std::unique_ptr<weld::ComboBox> mxPaperOrientation; 69 std::unique_ptr<weld::ComboBox> mxMarginSelectBox; 70 std::unique_ptr<weld::Label> mxCustomEntry; 71 72 ::sfx2::sidebar::ControllerItem maPaperSizeController; 73 ::sfx2::sidebar::ControllerItem maPaperOrientationController; 74 ::sfx2::sidebar::ControllerItem maMetricController; 75 ::sfx2::sidebar::ControllerItem maSwPageLRControl; 76 ::sfx2::sidebar::ControllerItem maSwPageULControl; 77 78 std::unique_ptr<SvxPageItem> mpPageItem; 79 std::unique_ptr<SvxLongLRSpaceItem> mpPageLRMarginItem; 80 std::unique_ptr<SvxLongULSpaceItem> mpPageULMarginItem; 81 82 FieldUnit meFUnit; 83 MapUnit meUnit; 84 85 tools::Long mnPageLeftMargin; 86 tools::Long mnPageRightMargin; 87 tools::Long mnPageTopMargin; 88 tools::Long mnPageBottomMargin; 89 OUString aCustomEntry; 90 91 void Initialize(); 92 void SetMarginFieldUnit(); 93 void UpdateMarginBox(); 94 void ExecuteMarginLRChange( const tools::Long nPageLeftMargin, const tools::Long nPageRightMargin ); 95 void ExecuteMarginULChange( const tools::Long nPageTopMargin, const tools::Long nPageBottomMargin); 96 DECL_LINK(PaperFormatModifyHdl, weld::ComboBox&, void); 97 DECL_LINK(PaperSizeModifyHdl, weld::MetricSpinButton&, void); 98 DECL_LINK(PaperModifyMarginHdl, weld::ComboBox&, void ); 99 }; 100 101 } //end of namespace sw::sidebar 102 103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 104