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 <vcl/customweld.hxx>
22 #include <vcl/weld.hxx>
23 #include <sfx2/tabdlg.hxx>
24 
25 #include <editeng/tstpitem.hxx>
26 #include <svx/flagsdef.hxx>
27 
28 class SvxTabulatorTabPage;
29 
30 // class TabWin_Impl -----------------------------------------------------
31 
32 class TabWin_Impl : public weld::CustomWidgetController
33 {
34 private:
35     sal_uInt16  nTabStyle;
36 
37 public:
38 
TabWin_Impl()39     TabWin_Impl() : nTabStyle(0)
40     {
41     }
42     virtual void Paint(vcl::RenderContext& rRenderContext, const ::tools::Rectangle& rRect) override;
43 
SetTabStyle(sal_uInt16 nStyle)44     void SetTabStyle(sal_uInt16 nStyle) {nTabStyle = nStyle; }
45 };
46 
47 // class SvxTabulatorTabPage ---------------------------------------------
48 /*
49     [Description]
50     In this TabPage tabulators are managed.
51 
52     [Items]
53     <SvxTabStopItem><SID_ATTR_TABSTOP>
54     <SfxUInt16Item><SID_ATTR_TABSTOP_DEFAULTS>
55     <SfxUInt16Item><SID_ATTR_TABSTOP_POS>
56     <SfxInt32Item><SID_ATTR_TABSTOP_OFFSET>
57 */
58 
59 class SvxTabulatorTabPage : public SfxTabPage
60 {
61     static const sal_uInt16 pRanges[];
62 
63 public:
64     SvxTabulatorTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet);
65     static std::unique_ptr<SfxTabPage> Create( weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* rSet );
66     virtual ~SvxTabulatorTabPage() override;
67 
GetRanges()68     static const sal_uInt16* GetRanges() { return pRanges; }
69 
70     virtual bool        FillItemSet( SfxItemSet* rSet ) override;
71     virtual void        Reset( const SfxItemSet* rSet ) override;
72 
73     void                DisableControls( const TabulatorDisableFlags nFlag );
74 
75 protected:
76     virtual DeactivateRC   DeactivatePage( SfxItemSet* pSet ) override;
77 
78 private:
79     // local variables, internal functions
80     SvxTabStop      aCurrentTab;
81     std::unique_ptr<SvxTabStopItem>  aNewTabs;
82     tools::Long            nDefDist;
83 
84     TabWin_Impl    m_aLeftWin;
85     TabWin_Impl    m_aRightWin;
86     TabWin_Impl    m_aCenterWin;
87     TabWin_Impl    m_aDezWin;
88 
89     // just to format the numbers, not shown
90     std::unique_ptr<weld::MetricSpinButton> m_xTabSpin;
91     // tabulators and positions
92     std::unique_ptr<weld::EntryTreeView> m_xTabBox;
93     // TabType
94     std::unique_ptr<weld::RadioButton> m_xLeftTab;
95     std::unique_ptr<weld::RadioButton> m_xRightTab;
96     std::unique_ptr<weld::RadioButton> m_xCenterTab;
97     std::unique_ptr<weld::RadioButton> m_xDezTab;
98 
99     std::unique_ptr<weld::Entry> m_xDezChar;
100     std::unique_ptr<weld::Label> m_xDezCharLabel;
101 
102     std::unique_ptr<weld::RadioButton> m_xNoFillChar;
103     std::unique_ptr<weld::RadioButton> m_xFillPoints;
104     std::unique_ptr<weld::RadioButton> m_xFillDashLine ;
105     std::unique_ptr<weld::RadioButton> m_xFillSolidLine;
106     std::unique_ptr<weld::RadioButton> m_xFillSpecial;
107     std::unique_ptr<weld::Entry> m_xFillChar;
108 
109     std::unique_ptr<weld::Button> m_xNewBtn;
110     std::unique_ptr<weld::Button> m_xDelAllBtn;
111     std::unique_ptr<weld::Button> m_xDelBtn;
112 
113     std::unique_ptr<weld::Container> m_xTypeFrame;
114     std::unique_ptr<weld::Container> m_xFillFrame;
115 
116     std::unique_ptr<weld::CustomWeld> m_xLeftWin;
117     std::unique_ptr<weld::CustomWeld> m_xRightWin;
118     std::unique_ptr<weld::CustomWeld> m_xCenterWin;
119     std::unique_ptr<weld::CustomWeld> m_xDezWin;
120 
121     void            InitTabPos_Impl( sal_uInt16 nPos = 0 );
122     void            SetFillAndTabType_Impl();
123     void            NewHdl_Impl(const weld::Button*);
124 
125     OUString        FormatTab();
126 
127     // Handler
128     DECL_LINK(NewHdl_Impl, weld::Button&, void);
129     DECL_LINK(DelHdl_Impl, weld::Button&, void);
130     DECL_LINK(DelAllHdl_Impl, weld::Button&, void);
131 
132     DECL_LINK(FillTypeCheckHdl_Impl, weld::Toggleable&, void);
133     DECL_LINK(TabTypeCheckHdl_Impl, weld::Toggleable&, void);
134 
135     DECL_LINK(SelectHdl_Impl, weld::TreeView&, bool);
136     DECL_LINK(ModifyHdl_Impl, weld::ComboBox&, void);
137     DECL_LINK(ReformatHdl_Impl, weld::Widget&, void);
138     DECL_LINK(GetFillCharHdl_Impl, weld::Widget&, void);
139     DECL_LINK(GetDezCharHdl_Impl, weld::Widget&, void);
140 
141     int FindCurrentTab();
142 
143     virtual void            PageCreated(const SfxAllItemSet& aSet) override;
144 };
145 
146 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
147