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/weld.hxx>
23 #include <svl/zforlist.hxx>
24 #include <swdllapi.h>
25 
26 class SwView;
27 
29 {
30 protected:
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 public:
42 
43  void SetAutomaticLanguage(bool bSet) { bUseAutomaticLanguage = bSet; }
44  bool IsAutomaticLanguage()const { return bUseAutomaticLanguage; }
45  SvNumFormatType GetFormatType() const { return nCurrFormatType; }
46  LanguageType GetCurLanguage() const { return eCurLanguage;}
47  void SetLanguage(LanguageType eSet) { eCurLanguage = eSet; }
48  void SetShowLanguageControl(bool bSet) { bShowLanguageControl = bSet; }
49  SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType);
50  void SetOneArea(bool bOnlyOne) { bOneArea = bOnlyOne; }
51 
52  void SetFormatType(const SvNumFormatType nFormatType);
53  void SetDefFormat(const sal_uInt32 nDefFormat);
54  virtual sal_uInt32 GetFormat() const = 0;
55 
56  virtual void Init();
57  void CallSelectHdl();
58 
59  virtual void clear();
60  virtual int get_count() const = 0;
61  virtual int get_active() const = 0;
62  virtual OUString get_id(int nPos) const = 0;
63  virtual OUString get_text(int nPos) const = 0;
64  virtual weld::Widget& get_widget() const = 0;
65  virtual void append(const OUString& rId, const OUString& rText) = 0;
66  virtual void append_text(const OUString& rText) = 0;
67  virtual void insert_text(int nPos, const OUString& rText) = 0;
68  virtual void set_active(int nPos) = 0;
69  virtual void set_id(int nPos, const OUString& rId) = 0;
70  virtual ~SwNumFormatBase() {}
71 };
72 
74 {
75  std::unique_ptr<weld::ComboBox> mxControl;
76 
77  DECL_DLLPRIVATE_LINK( SelectHdl, weld::ComboBox&, void );
78 
79  virtual void Init() override;
80 
81 public:
82  NumFormatListBox(std::unique_ptr<weld::ComboBox> xControl);
83 
84  virtual sal_uInt32 GetFormat() const override;
85 
86  virtual void clear() override;
87  virtual int get_count() const override { return mxControl->get_count(); }
88  virtual int get_active() const override { return mxControl->get_active(); }
89  virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
90  virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
91  virtual weld::Widget& get_widget() const override { return *mxControl; }
92  virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
93  virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
94  virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
95  virtual void set_active(int nPos) override { mxControl->set_active(nPos); }
96  virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
97  void show() { mxControl->show(); }
98  void hide() { mxControl->hide(); }
99 
100  void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
101  void connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); }
102 };
103 
105 {
106  std::unique_ptr<weld::TreeView> mxControl;
107 
108  DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
109 
110  virtual void Init() override;
111 
112 public:
113  SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl);
114 
115  virtual sal_uInt32 GetFormat() const override;
116 
117  virtual void clear() override;
118  virtual int get_count() const override { return mxControl->n_children(); }
119  virtual int get_active() const override { return mxControl->get_selected_index(); }
120  virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
121  virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
122  virtual weld::Widget& get_widget() const override { return *mxControl; }
123  virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
124  virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
125  virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
126  virtual void set_active(int nPos) override { mxControl->select(nPos); }
127  virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
128  OUString get_selected_text() const { return mxControl->get_selected_text(); }
129  bool get_visible() const { return mxControl->get_visible(); }
130  bool get_value_changed_from_saved() const { return mxControl->get_value_changed_from_saved(); }
131  void save_value() { return mxControl->save_value(); }
132  void show() { mxControl->show(); }
133  void hide() { mxControl->hide(); }
134  int get_selected_index() const { return mxControl->get_selected_index(); }
135  void set_visible(bool bVisible) { mxControl->set_visible(bVisible); }
136  void select(int nPos) { mxControl->select(nPos); }
137  void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxControl->connect_row_activated(rLink); }
138 
139  void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
140  void connect_changed(const Link<weld::TreeView&, void>& rLink) { mxControl->connect_changed(rLink); }
141 };
142 
143 #endif
144 
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool get_visible() const
Definition: numfmtlb.hxx:129
sal_Int32 nStdEntry
Definition: numfmtlb.hxx:33
std::unique_ptr< weld::ComboBox > mxControl
Definition: numfmtlb.hxx:75
void Init()
virtual int get_active() const override
Definition: numfmtlb.hxx:88
virtual int get_count() const override
Definition: numfmtlb.hxx:87
sal_uInt32 nDefFormat
Definition: numfmtlb.hxx:35
void set_visible(bool bVisible)
Definition: numfmtlb.hxx:135
void select(int nPos)
Definition: numfmtlb.hxx:136
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:96
virtual void clear()
Definition: numfmtlb.cxx:460
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:95
virtual sal_uInt32 GetFormat() const =0
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:92
SvNumFormatType GetFormatType() const
Definition: numfmtlb.hxx:45
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:125
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:100
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:139
bool mbCurrFormatTypeNeedsInit
Definition: numfmtlb.hxx:32
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:89
virtual ~SwNumFormatBase()
Definition: numfmtlb.hxx:70
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:90
SvNumFormatType nCurrFormatType
Definition: numfmtlb.hxx:31
bool get_value_changed_from_saved() const
Definition: numfmtlb.hxx:130
std::unique_ptr< weld::TreeView > mxControl
Definition: numfmtlb.hxx:106
void connect_changed(const Link< weld::ComboBox &, void > &rLink)
Definition: numfmtlb.hxx:101
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: numfmtlb.hxx:137
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:120
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:91
OUString get_selected_text() const
Definition: numfmtlb.hxx:128
bool bShowLanguageControl
Definition: numfmtlb.hxx:37
LanguageType eCurLanguage
Definition: numfmtlb.hxx:36
void SetAutomaticLanguage(bool bSet)
Definition: numfmtlb.hxx:43
void SetLanguage(LanguageType eSet)
Definition: numfmtlb.hxx:47
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:93
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:122
SvNumFormatType
void connect_changed(const Link< weld::TreeView &, void > &rLink)
Definition: numfmtlb.hxx:140
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual int get_count() const override
Definition: numfmtlb.hxx:118
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:127
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:126
LanguageType GetCurLanguage() const
Definition: numfmtlb.hxx:46
bool IsAutomaticLanguage() const
Definition: numfmtlb.hxx:44
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:94
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:121
bool bUseAutomaticLanguage
Definition: numfmtlb.hxx:39
int get_selected_index() const
Definition: numfmtlb.hxx:134
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:124
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:123
virtual void Init()
Definition: numfmtlb.cxx:144
void SetShowLanguageControl(bool bSet)
Definition: numfmtlb.hxx:48
void SetOneArea(bool bOnlyOne)
Definition: numfmtlb.hxx:50
Definition: view.hxx:146
virtual int get_active() const override
Definition: numfmtlb.hxx:119