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_SVX_HDFT_HXX
20 #define INCLUDED_SVX_HDFT_HXX
21 
22 #include <sfx2/tabdlg.hxx>
23 
24 #include <vcl/weld.hxx>
25 
26 #include <svx/pagectrl.hxx>
27 #include <svx/svxdllapi.h>
28 #include <memory>
29 
30 namespace weld { class CustomWeld; }
31 
32 namespace svx
33 {
34     SVX_DLLPUBLIC bool ShowBorderBackgroundDlg(weld::Window* pParent, SfxItemSet* pBBSet);
35 }
36 
37 class SVX_DLLPUBLIC SvxHFPage : public SfxTabPage
38 {
39 public:
40 
41     virtual bool    FillItemSet( SfxItemSet* rOutSet ) override;
42     virtual void    Reset( const SfxItemSet* rSet ) override;
43 
44     virtual         ~SvxHFPage() override;
45 
DisableDeleteQueryBox()46     void DisableDeleteQueryBox() { mbDisableQueryBox = true; }
47 
48     virtual void PageCreated(const SfxAllItemSet&) override;
49 
50     void            EnableDynamicSpacing();
51 
52 protected:
53     static const sal_uInt16 pRanges[];
54 
55     virtual void    ActivatePage( const SfxItemSet& rSet ) override;
56     virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
57 
58     SvxHFPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet, sal_uInt16 nSetId);
59 
60     sal_uInt16 const       nId;
61     std::unique_ptr<SfxItemSet> pBBSet;
62     bool            mbDisableQueryBox : 1;
63     bool            mbEnableDrawingLayerFillStyles : 1;
64 
65     SvxPageWindow m_aBspWin;
66     std::unique_ptr<weld::Label> m_xPageLbl;
67     std::unique_ptr<weld::CheckButton> m_xTurnOnBox;
68     std::unique_ptr<weld::CheckButton> m_xCntSharedBox;
69     std::unique_ptr<weld::CheckButton> m_xCntSharedFirstBox;
70     std::unique_ptr<weld::Label> m_xLMLbl;
71     std::unique_ptr<weld::MetricSpinButton>m_xLMEdit;
72     std::unique_ptr<weld::Label> m_xRMLbl;
73     std::unique_ptr<weld::MetricSpinButton> m_xRMEdit;
74     std::unique_ptr<weld::Label> m_xDistFT;
75     std::unique_ptr<weld::MetricSpinButton> m_xDistEdit;
76     std::unique_ptr<weld::CheckButton> m_xDynSpacingCB;
77     std::unique_ptr<weld::Label> m_xHeightFT;
78     std::unique_ptr<weld::MetricSpinButton> m_xHeightEdit;
79     std::unique_ptr<weld::CheckButton> m_xHeightDynBtn;
80     std::unique_ptr<weld::Button> m_xBackgroundBtn;
81     std::unique_ptr<weld::CustomWeld> m_xBspWin;
82 
83     void            InitHandler();
84     void TurnOn(const weld::ToggleButton* pButton);
85     DECL_LINK(TurnOnHdl, weld::ToggleButton&, void);
86     DECL_LINK(BackgroundHdl, weld::Button&, void);
87     DECL_LINK(ValueChangeHdl, weld::MetricSpinButton&, void);
88     void RangeHdl();
89     void            UpdateExample();
90 
91 private:
92     SVX_DLLPRIVATE void         ResetBackground_Impl( const SfxItemSet& rSet );
93 };
94 
95 class SVX_DLLPUBLIC SvxHeaderPage final : public SvxHFPage
96 {
97 public:
98     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
99     // returns the Which values to the range
GetRanges()100     static const sal_uInt16*  GetRanges() { return pRanges; }
101     SVX_DLLPRIVATE SvxHeaderPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
102 };
103 
104 class SVX_DLLPUBLIC SvxFooterPage final : public SvxHFPage
105 {
106 public:
107     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
GetRanges()108     static const sal_uInt16*  GetRanges() { return pRanges; }
109     SVX_DLLPRIVATE SvxFooterPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
110 };
111 
112 class SVX_DLLPUBLIC DeleteHeaderDialog final : public weld::MessageDialogController
113 {
114 public:
DeleteHeaderDialog(weld::Widget * pParent)115     DeleteHeaderDialog(weld::Widget* pParent)
116         : MessageDialogController(pParent, "svx/ui/deleteheaderdialog.ui",
117                 "DeleteHeaderDialog")
118     {
119     }
120 };
121 
122 class SVX_DLLPUBLIC DeleteFooterDialog final : public weld::MessageDialogController
123 {
124 public:
DeleteFooterDialog(weld::Widget * pParent)125     DeleteFooterDialog(weld::Widget* pParent)
126         : MessageDialogController(pParent, "svx/ui/deletefooterdialog.ui",
127                 "DeleteFooterDialog")
128     {
129     }
130 };
131 
132 #endif
133 
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
135