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