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:
31  sal_Int32 m_nStdEntry;
32  sal_uInt32 m_nDefFormat;
35  bool m_bOneArea;
37  bool m_bShowLanguageControl; //determine whether the language control has
38  //to be shown in the number format dialog
39  bool m_bUseAutomaticLanguage;//determine whether language is automatically assigned
40 public:
42 
43  void SetAutomaticLanguage(bool bSet) { m_bUseAutomaticLanguage = bSet; }
44  bool IsAutomaticLanguage()const { return m_bUseAutomaticLanguage; }
45  SvNumFormatType GetFormatType() const { return m_nCurrFormatType; }
46  LanguageType GetCurLanguage() const { return m_eCurLanguage;}
47  void SetLanguage(LanguageType eSet) { m_eCurLanguage = eSet; }
48  void SetShowLanguageControl(bool bSet) { m_bShowLanguageControl = bSet; }
49  SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType);
50  void SetOneArea(bool bOnlyOne) { m_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  OString get_buildable_name() const { return mxControl->get_buildable_name(); }
103  void set_buildable_name(const OString& rId){ mxControl->set_buildable_name(rId); }
104 };
105 
107 {
108  std::unique_ptr<weld::TreeView> mxControl;
109 
110  DECL_DLLPRIVATE_LINK( SelectHdl, weld::TreeView&, void );
111 
112  virtual void Init() override;
113 
114 public:
115  SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl);
116 
117  virtual sal_uInt32 GetFormat() const override;
118 
119  virtual void clear() override;
120  virtual int get_count() const override { return mxControl->n_children(); }
121  virtual int get_active() const override { return mxControl->get_selected_index(); }
122  virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
123  virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
124  virtual weld::Widget& get_widget() const override { return *mxControl; }
125  virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
126  virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
127  virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
128  virtual void set_active(int nPos) override { mxControl->select(nPos); }
129  virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
130  OUString get_selected_text() const { return mxControl->get_selected_text(); }
131  bool get_visible() const { return mxControl->get_visible(); }
132  int get_selected_index() const { return mxControl->get_selected_index(); }
133  void set_visible(bool bVisible) { mxControl->set_visible(bVisible); }
134  void select(int nPos) { mxControl->select(nPos); }
135  void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxControl->connect_row_activated(rLink); }
136  OString get_buildable_name() const { return mxControl->get_buildable_name(); }
137  void set_buildable_name(const OString& rId){ mxControl->set_buildable_name(rId); }
138 };
139 
140 #endif
141 
142 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
LanguageType m_eCurLanguage
Definition: numfmtlb.hxx:34
bool get_visible() const
Definition: numfmtlb.hxx:131
OString get_buildable_name() const
Definition: numfmtlb.hxx:102
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
void set_visible(bool bVisible)
Definition: numfmtlb.hxx:133
void select(int nPos)
Definition: numfmtlb.hxx:134
OString get_buildable_name() const
Definition: numfmtlb.hxx:136
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:96
virtual void clear()
Definition: numfmtlb.cxx:456
SvNumFormatType m_nCurrFormatType
Definition: numfmtlb.hxx:33
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:127
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:100
bool mbCurrFormatTypeNeedsInit
Definition: numfmtlb.hxx:36
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
std::unique_ptr< weld::TreeView > mxControl
Definition: numfmtlb.hxx:108
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:135
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:122
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:91
OUString get_selected_text() const
Definition: numfmtlb.hxx:130
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:124
SvNumFormatType
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
virtual int get_count() const override
Definition: numfmtlb.hxx:120
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:129
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:128
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
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:123
bool m_bShowLanguageControl
Definition: numfmtlb.hxx:37
void set_buildable_name(const OString &rId)
Definition: numfmtlb.hxx:103
int get_selected_index() const
Definition: numfmtlb.hxx:132
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:126
void set_buildable_name(const OString &rId)
Definition: numfmtlb.hxx:137
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:125
sal_uInt32 m_nDefFormat
Definition: numfmtlb.hxx:32
virtual void Init()
Definition: numfmtlb.cxx:141
void SetShowLanguageControl(bool bSet)
Definition: numfmtlb.hxx:48
bool m_bUseAutomaticLanguage
Definition: numfmtlb.hxx:39
void SetOneArea(bool bOnlyOne)
Definition: numfmtlb.hxx:50
sal_Int32 m_nStdEntry
Definition: numfmtlb.hxx:31
Definition: view.hxx:144
virtual int get_active() const override
Definition: numfmtlb.hxx:121