LibreOffice Module sw (master)  1
numfmtlb.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_INC_NUMFMTLB_HXX
20 #define INCLUDED_SW_SOURCE_UIBASE_INC_NUMFMTLB_HXX
21 
22 #include <vcl/lstbox.hxx>
23 #include <vcl/weld.hxx>
24 #include <svl/zforlist.hxx>
25 #include <swdllapi.h>
26 
27 class SwView;
28 
30 {
33  sal_Int32 nStdEntry;
34  bool bOneArea;
35  sal_uInt32 nDefFormat;
37  bool bShowLanguageControl; //determine whether the language control has
38  //to be shown in the number format dialog
39  bool bUseAutomaticLanguage;//determine whether language is automatically assigned
40 
41  DECL_DLLPRIVATE_LINK( SelectHdl, ListBox&, void );
42 
43  SAL_DLLPRIVATE void Init();
44 
45 public:
46  NumFormatListBox(vcl::Window* pWin, WinBits nStyle);
47 
48  virtual ~NumFormatListBox() override;
49 
50  void Clear();
51 
52  void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
53 
54  void SetFormatType(const SvNumFormatType nFormatType);
55  SvNumFormatType GetFormatType() const { return nCurrFormatType; }
56  void SetDefFormat(const sal_uInt32 nDefFormat);
57  sal_uInt32 GetFormat() const;
58 
59  LanguageType GetCurLanguage() const { return eCurLanguage;}
60  void SetLanguage(LanguageType eSet) { eCurLanguage = eSet;}
61 
62  void SetAutomaticLanguage(bool bSet){bUseAutomaticLanguage = bSet;}
63  bool IsAutomaticLanguage()const {return bUseAutomaticLanguage;}
64 
65  void SetShowLanguageControl(bool bSet){bShowLanguageControl = bSet;}
66 
67  SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType);
68 };
69 
71 {
72 protected:
75  sal_Int32 nStdEntry;
76  bool bOneArea;
77  sal_uInt32 nDefFormat;
79  bool bShowLanguageControl; //determine whether the language control has
80  //to be shown in the number format dialog
81  bool bUseAutomaticLanguage;//determine whether language is automatically assigned
82 public:
84 
85  void SetAutomaticLanguage(bool bSet) { bUseAutomaticLanguage = bSet; }
86  bool IsAutomaticLanguage()const { return bUseAutomaticLanguage; }
87  SvNumFormatType GetFormatType() const { return nCurrFormatType; }
88  LanguageType GetCurLanguage() const { return eCurLanguage;}
89  void SetLanguage(LanguageType eSet) { eCurLanguage = eSet; }
90  void SetShowLanguageControl(bool bSet) { bShowLanguageControl = bSet; }
91  void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
92 
93  void SetFormatType(const SvNumFormatType nFormatType);
94  void SetDefFormat(const sal_uInt32 nDefFormat);
95  virtual sal_uInt32 GetFormat() const = 0;
96 
97  virtual void Init();
98  void CallSelectHdl();
99 
100  virtual void clear();
101  virtual int get_count() const = 0;
102  virtual int get_active() const = 0;
103  virtual OUString get_id(int nPos) const = 0;
104  virtual OUString get_text(int nPos) const = 0;
105  virtual weld::Widget& get_widget() const = 0;
106  virtual void append(const OUString& rId, const OUString& rText) = 0;
107  virtual void append_text(const OUString& rText) = 0;
108  virtual void insert_text(int nPos, const OUString& rText) = 0;
109  virtual void set_active(int nPos) = 0;
110  virtual void set_id(int nPos, const OUString& rId) = 0;
111  virtual ~SwNumFormatBase() {}
112 };
113 
115 {
116  std::unique_ptr<weld::ComboBox> mxControl;
117 
118  DECL_DLLPRIVATE_LINK( SelectHdl, weld::ComboBox&, void );
119 
120  virtual void Init() override;
121 
122 public:
123  SwNumFormatListBox(std::unique_ptr<weld::ComboBox> xControl);
124 
125  virtual sal_uInt32 GetFormat() const override;
126 
127  virtual void clear() override;
128  virtual int get_count() const override { return mxControl->get_count(); }
129  virtual int get_active() const override { return mxControl->get_active(); }
130  virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
131  virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
132  virtual weld::Widget& get_widget() const override { return *mxControl; }
133  virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
134  virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
135  virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
136  virtual void set_active(int nPos) override { mxControl->set_active(nPos); }
137  virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
138  void show() { mxControl->show(); }
139  void hide() { mxControl->hide(); }
140 
141  void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
142  void connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); }
143 };
144 
146 {
147  std::unique_ptr<weld::TreeView> mxControl;
148 
149  DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
150 
151  virtual void Init() override;
152 
153 public:
154  SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl);
155 
156  virtual sal_uInt32 GetFormat() const override;
157 
158  virtual void clear() override;
159  virtual int get_count() const override { return mxControl->n_children(); }
160  virtual int get_active() const override { return mxControl->get_selected_index(); }
161  virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
162  virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
163  virtual weld::Widget& get_widget() const override { return *mxControl; }
164  virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
165  virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
166  virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
167  virtual void set_active(int nPos) override { mxControl->select(nPos); }
168  virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
169  OUString get_selected_text() const { return mxControl->get_selected_text(); }
170  bool get_visible() const { return mxControl->get_visible(); }
171  bool get_value_changed_from_saved() const { return mxControl->get_value_changed_from_saved(); }
172  void save_value() { return mxControl->save_value(); }
173  void show() { mxControl->show(); }
174  void hide() { mxControl->hide(); }
175  int get_selected_index() const { return mxControl->get_selected_index(); }
176  void set_visible(bool bVisible) { mxControl->set_visible(bVisible); }
177  void select(int nPos) { mxControl->select(nPos); }
178  void connect_row_activated(const Link<weld::TreeView&, void>& rLink) { mxControl->connect_row_activated(rLink); }
179 
180  void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
181  void connect_changed(const Link<weld::TreeView&, void>& rLink) { mxControl->connect_changed(rLink); }
182 };
183 
184 #endif
185 
186 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool get_visible() const
Definition: numfmtlb.hxx:170
sal_Int32 nStdEntry
Definition: numfmtlb.hxx:75
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:141
bool IsAutomaticLanguage() const
Definition: numfmtlb.hxx:63
bool mbCurrFormatTypeNeedsInit
Definition: numfmtlb.hxx:32
void Init()
sal_uInt32 nDefFormat
Definition: numfmtlb.hxx:77
void set_visible(bool bVisible)
Definition: numfmtlb.hxx:176
SvNumFormatType GetFormatType() const
Definition: numfmtlb.hxx:55
bool bUseAutomaticLanguage
Definition: numfmtlb.hxx:39
void select(int nPos)
Definition: numfmtlb.hxx:177
void SetShowLanguageControl(bool bSet)
Definition: numfmtlb.hxx:65
virtual void clear()
Definition: numfmtlb.cxx:795
virtual sal_uInt32 GetFormat() const =0
void Clear()
SvNumFormatType GetFormatType() const
Definition: numfmtlb.hxx:87
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:166
void connect_row_activated(const Link< weld::TreeView &, void > &rLink)
Definition: numfmtlb.hxx:178
virtual int get_count() const override
Definition: numfmtlb.hxx:128
void SetLanguage(LanguageType eSet)
Definition: numfmtlb.hxx:60
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:180
std::unique_ptr< weld::ComboBox > mxControl
Definition: numfmtlb.hxx:116
sal_Int64 WinBits
void SetOneArea(bool bOnlyOne)
Definition: numfmtlb.hxx:52
bool mbCurrFormatTypeNeedsInit
Definition: numfmtlb.hxx:74
void connect_changed(const Link< weld::ComboBox &, void > &rLink)
Definition: numfmtlb.hxx:142
virtual ~SwNumFormatBase()
Definition: numfmtlb.hxx:111
SvNumFormatType nCurrFormatType
Definition: numfmtlb.hxx:73
bool get_value_changed_from_saved() const
Definition: numfmtlb.hxx:171
std::unique_ptr< weld::TreeView > mxControl
Definition: numfmtlb.hxx:147
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:130
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:131
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:161
LanguageType eCurLanguage
Definition: numfmtlb.hxx:36
OUString get_selected_text() const
Definition: numfmtlb.hxx:169
bool bShowLanguageControl
Definition: numfmtlb.hxx:79
LanguageType eCurLanguage
Definition: numfmtlb.hxx:78
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:137
void SetAutomaticLanguage(bool bSet)
Definition: numfmtlb.hxx:85
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:134
void SetLanguage(LanguageType eSet)
Definition: numfmtlb.hxx:89
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:163
SvNumFormatType nCurrFormatType
Definition: numfmtlb.hxx:31
SvNumFormatType
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:136
void connect_changed(const Link< weld::TreeView &, void > &rLink)
Definition: numfmtlb.hxx:181
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual int get_count() const override
Definition: numfmtlb.hxx:159
DECL_DLLPRIVATE_LINK(ImplSelectHdl, LinkParamNone *, void)
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:168
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:167
LanguageType GetCurLanguage() const
Definition: numfmtlb.hxx:88
bool IsAutomaticLanguage() const
Definition: numfmtlb.hxx:86
bool bShowLanguageControl
Definition: numfmtlb.hxx:37
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:135
sal_uInt32 nDefFormat
Definition: numfmtlb.hxx:35
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:162
bool bUseAutomaticLanguage
Definition: numfmtlb.hxx:81
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:133
int get_selected_index() const
Definition: numfmtlb.hxx:175
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:165
LanguageType GetCurLanguage() const
Definition: numfmtlb.hxx:59
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:132
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:164
virtual void Init()
Definition: numfmtlb.cxx:479
void SetShowLanguageControl(bool bSet)
Definition: numfmtlb.hxx:90
void SetOneArea(bool bOnlyOne)
Definition: numfmtlb.hxx:91
void SetAutomaticLanguage(bool bSet)
Definition: numfmtlb.hxx:62
sal_Int32 nStdEntry
Definition: numfmtlb.hxx:33
Definition: view.hxx:146
virtual int get_active() const override
Definition: numfmtlb.hxx:129
virtual int get_active() const override
Definition: numfmtlb.hxx:160