1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_UI_ENVELP_LABFMT_HXX
20 #define INCLUDED_SW_SOURCE_UI_ENVELP_LABFMT_HXX
25 #include <sfx2/tabdlg.hxx>
26 #include <vcl/idle.hxx>
27 #include <vcl/customweld.hxx>
28 #include <vcl/weld.hxx>
30 class SwLabFormatPage
;
32 class SwLabPreview
: public weld::CustomWidgetController
39 OUString m_aHeightStr
;
45 tools::Long m_lHDistWidth
;
46 tools::Long m_lVDistWidth
;
47 tools::Long m_lHeightWidth
;
48 tools::Long m_lLeftWidth
;
49 tools::Long m_lUpperWidth
;
50 tools::Long m_lColsWidth
;
52 tools::Long m_lXWidth
;
53 tools::Long m_lXHeight
;
57 virtual void SetDrawingArea(weld::DrawingArea
* pDrawingArea
) override
;
58 virtual void Paint(vcl::RenderContext
& rRenderContext
, const tools::Rectangle
& rRect
) override
;
63 void UpdateItem(const SwLabItem
& rItem
);
66 class SwLabFormatPage
: public SfxTabPage
72 SwLabPreview m_aPreview
;
74 std::unique_ptr
<weld::Label
> m_xMakeFI
;
75 std::unique_ptr
<weld::Label
> m_xTypeFI
;
76 std::unique_ptr
<weld::CustomWeld
> m_xPreview
;
77 std::unique_ptr
<weld::MetricSpinButton
> m_xHDistField
;
78 std::unique_ptr
<weld::MetricSpinButton
> m_xVDistField
;
79 std::unique_ptr
<weld::MetricSpinButton
> m_xWidthField
;
80 std::unique_ptr
<weld::MetricSpinButton
> m_xHeightField
;
81 std::unique_ptr
<weld::MetricSpinButton
> m_xLeftField
;
82 std::unique_ptr
<weld::MetricSpinButton
> m_xUpperField
;
83 std::unique_ptr
<weld::SpinButton
> m_xColsField
;
84 std::unique_ptr
<weld::SpinButton
> m_xRowsField
;
85 std::unique_ptr
<weld::MetricSpinButton
> m_xPWidthField
;
86 std::unique_ptr
<weld::MetricSpinButton
> m_xPHeightField
;
87 std::unique_ptr
<weld::Button
> m_xSavePB
;
89 DECL_LINK(ModifyHdl
, weld::SpinButton
&, void);
90 DECL_LINK(MetricModifyHdl
, weld::MetricSpinButton
&, void);
91 DECL_LINK(PreviewHdl
, Timer
*, void);
92 DECL_LINK(SaveHdl
, weld::Button
&, void);
97 SwLabFormatPage(weld::Container
* pPage
, weld::DialogController
* pController
,
98 const SfxItemSet
& rSet
);
99 virtual ~SwLabFormatPage() override
;
101 static std::unique_ptr
<SfxTabPage
>
102 Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rSet
);
104 virtual void ActivatePage(const SfxItemSet
& rSet
) override
;
105 virtual DeactivateRC
DeactivatePage(SfxItemSet
* pSet
) override
;
106 void FillItem(SwLabItem
& rItem
);
107 virtual bool FillItemSet(SfxItemSet
* rSet
) override
;
108 virtual void Reset(const SfxItemSet
* rSet
) override
;
110 SwLabDlg
* GetParentSwLabDlg() { return static_cast<SwLabDlg
*>(GetDialogController()); }
113 class SwSaveLabelDlg
: public weld::GenericDialogController
116 SwLabDlg
* m_pLabDialog
;
119 std::unique_ptr
<weld::ComboBox
> m_xMakeCB
;
120 std::unique_ptr
<weld::Entry
> m_xTypeED
;
121 std::unique_ptr
<weld::Button
> m_xOKPB
;
123 DECL_LINK(OkHdl
, weld::Button
&, void);
124 DECL_LINK(ModifyEntryHdl
, weld::Entry
&, void);
125 DECL_LINK(ModifyComboHdl
, weld::ComboBox
&, void);
130 SwSaveLabelDlg(SwLabDlg
* pParent
, SwLabRec
& rRec
);
131 virtual ~SwSaveLabelDlg() override
;
133 void SetLabel(const OUString
& rMake
, const OUString
& rType
)
135 m_xMakeCB
->set_entry_text(rMake
);
136 m_xTypeED
->set_text(rType
);
138 bool GetLabel(SwLabItem
& rItem
);
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */