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