LibreOffice Module sw (master) 1
PageMarginControl.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
20#define INCLUDED_SW_SOURCE_UIBASE_SIDEBAR_PAGEMARGINCONTROL_HXX
21
22#include <sal/config.h>
23
26
27#define SWPAGE_NARROW_VALUE 720
28#define SWPAGE_NORMAL_VALUE 1136
29#define SWPAGE_WIDE_VALUE1 1440
30#define SWPAGE_WIDE_VALUE2 2880
31#define SWPAGE_WIDE_VALUE3 1800
32
33// #i19922# - tdf#126051 see cui/source/tabpages/page.cxx and svx/source/dialog/hdft.cxx
34constexpr tools::Long MINBODY = o3tl::toTwips(1, o3tl::Length::mm); // 1mm in twips rounded
35
36class PageMarginPopup;
37
38namespace sw::sidebar {
39
41{
42public:
43 explicit PageMarginControl(PageMarginPopup* pControl, weld::Widget* pParent);
44 virtual void GrabFocus() override;
45 virtual ~PageMarginControl() override;
46
47private:
48 std::unique_ptr<weld::Button> m_xNarrow;
49 std::unique_ptr<weld::Button> m_xNormal;
50 std::unique_ptr<weld::Button> m_xWide;
51 std::unique_ptr<weld::Button> m_xMirrored;
52 std::unique_ptr<weld::Button> m_xLast;
53 std::unique_ptr<weld::Button> m_xMoreButton;
54
55 std::unique_ptr<weld::Label> m_xLeft;
56 std::unique_ptr<weld::Label> m_xRight;
57 std::unique_ptr<weld::Label> m_xInner;
58 std::unique_ptr<weld::Label> m_xOuter;
59
60 std::unique_ptr<weld::MetricSpinButton> m_xLeftMarginEdit;
61 std::unique_ptr<weld::MetricSpinButton> m_xRightMarginEdit;
62 std::unique_ptr<weld::MetricSpinButton> m_xTopMarginEdit;
63 std::unique_ptr<weld::MetricSpinButton> m_xBottomMarginEdit;
64
65 // hidden metric field
66 std::unique_ptr<weld::MetricSpinButton> m_xWidthHeightField;
67
69
75
77
79
86
88
89 DECL_LINK( SelectMarginHdl, weld::Button&, void );
90 DECL_LINK( ModifyLRMarginHdl, weld::MetricSpinButton&, void );
91 DECL_LINK( ModifyULMarginHdl, weld::MetricSpinButton&, void );
92 DECL_LINK(MoreButtonClickHdl_Impl, weld::Button&, void);
93
94 static void ExecuteMarginLRChange(
95 const tools::Long nPageLeftMargin,
96 const tools::Long nPageRightMargin );
97 static void ExecuteMarginULChange(
98 const tools::Long nPageTopMargin,
99 const tools::Long nPageBottomMargin );
100 static void ExecutePageLayoutChange( const bool bMirrored );
101
102 void SetMetricFieldMaxValues(const Size& rPageSize);
103
104 bool GetUserCustomValues();
106
107 void FillHelpText( const bool bUserCustomValuesAvailable );
108};
109
110} // end of namespace sw::sidebar
111
112#endif
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr tools::Long MINBODY
virtual void GrabFocus() override
std::unique_ptr< weld::Button > m_xLast
std::unique_ptr< weld::Button > m_xNormal
PageMarginControl(PageMarginPopup *pControl, weld::Widget *pParent)
std::unique_ptr< weld::MetricSpinButton > m_xBottomMarginEdit
std::unique_ptr< weld::Button > m_xMirrored
std::unique_ptr< weld::MetricSpinButton > m_xWidthHeightField
rtl::Reference< PageMarginPopup > m_xControl
std::unique_ptr< weld::Button > m_xNarrow
DECL_LINK(ModifyLRMarginHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::Button > m_xMoreButton
static void ExecutePageLayoutChange(const bool bMirrored)
DECL_LINK(SelectMarginHdl, weld::Button &, void)
std::unique_ptr< weld::Button > m_xWide
void SetMetricFieldMaxValues(const Size &rPageSize)
std::unique_ptr< weld::Label > m_xOuter
void FillHelpText(const bool bUserCustomValuesAvailable)
std::unique_ptr< weld::MetricSpinButton > m_xTopMarginEdit
std::unique_ptr< weld::MetricSpinButton > m_xRightMarginEdit
std::unique_ptr< weld::Label > m_xLeft
static void ExecuteMarginLRChange(const tools::Long nPageLeftMargin, const tools::Long nPageRightMargin)
std::unique_ptr< weld::MetricSpinButton > m_xLeftMarginEdit
std::unique_ptr< weld::Label > m_xInner
DECL_LINK(ModifyULMarginHdl, weld::MetricSpinButton &, void)
std::unique_ptr< weld::Label > m_xRight
DECL_LINK(MoreButtonClickHdl_Impl, weld::Button &, void)
static void ExecuteMarginULChange(const tools::Long nPageTopMargin, const tools::Long nPageBottomMargin)
MapUnit
constexpr auto toTwips(N number, Length from)
long Long