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
26class SwView;
27
29{
30 sal_Int32 m_nStdEntry;
31 sal_uInt32 m_nDefFormat;
36 bool m_bShowLanguageControl; //determine whether the language control has
37 //to be shown in the number format dialog
38 bool m_bUseAutomaticLanguage;//determine whether language is automatically assigned
39public:
41
42 void SetAutomaticLanguage(bool bSet) { m_bUseAutomaticLanguage = bSet; }
43 bool IsAutomaticLanguage()const { return m_bUseAutomaticLanguage; }
44 SvNumFormatType GetFormatType() const { return m_nCurrFormatType; }
45 LanguageType GetCurLanguage() const { return m_eCurLanguage;}
46 void SetLanguage(LanguageType eSet) { m_eCurLanguage = eSet; }
47 void SetShowLanguageControl(bool bSet) { m_bShowLanguageControl = bSet; }
48 SAL_DLLPRIVATE static double GetDefValue(const SvNumFormatType nFormatType);
49 void SetOneArea(bool bOnlyOne) { m_bOneArea = bOnlyOne; }
50
51 void SetFormatType(const SvNumFormatType nFormatType);
52 void SetDefFormat(const sal_uInt32 nDefFormat);
53 virtual sal_uInt32 GetFormat() const = 0;
54
55 virtual void Init();
56 void CallSelectHdl();
57
58 virtual void clear();
59 virtual int get_count() const = 0;
60 virtual int get_active() const = 0;
61 virtual OUString get_id(int nPos) const = 0;
62 virtual OUString get_text(int nPos) const = 0;
63 virtual weld::Widget& get_widget() const = 0;
64 virtual void append(const OUString& rId, const OUString& rText) = 0;
65 virtual void append_text(const OUString& rText) = 0;
66 virtual void insert_text(int nPos, const OUString& rText) = 0;
67 virtual void set_active(int nPos) = 0;
68 virtual void set_id(int nPos, const OUString& rId) = 0;
69 virtual ~SwNumFormatBase() {}
70};
71
73{
74 std::unique_ptr<weld::ComboBox> mxControl;
75
77
78 virtual void Init() override;
79
80public:
81 NumFormatListBox(std::unique_ptr<weld::ComboBox> xControl);
82
83 virtual sal_uInt32 GetFormat() const override;
84
85 virtual void clear() override;
86 virtual int get_count() const override { return mxControl->get_count(); }
87 virtual int get_active() const override { return mxControl->get_active(); }
88 virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
89 virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
90 virtual weld::Widget& get_widget() const override { return *mxControl; }
91 virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
92 virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
93 virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
94 virtual void set_active(int nPos) override { mxControl->set_active(nPos); }
95 virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
96 void show() { mxControl->show(); }
97 void hide() { mxControl->hide(); }
98
99 void set_sensitive(bool bSensitive) { mxControl->set_sensitive(bSensitive); }
100 void connect_changed(const Link<weld::ComboBox&, void>& rLink) { mxControl->connect_changed(rLink); }
101 OUString get_buildable_name() const { return mxControl->get_buildable_name(); }
102 void set_buildable_name(const OUString& rId){ mxControl->set_buildable_name(rId); }
103};
104
106{
107 std::unique_ptr<weld::TreeView> mxControl;
108
110
111 virtual void Init() override;
112
113public:
114 SwNumFormatTreeView(std::unique_ptr<weld::TreeView> xControl);
115
116 virtual sal_uInt32 GetFormat() const override;
117
118 virtual void clear() override;
119 virtual int get_count() const override { return mxControl->n_children(); }
120 virtual int get_active() const override { return mxControl->get_selected_index(); }
121 virtual OUString get_id(int nPos) const override { return mxControl->get_id(nPos); }
122 virtual OUString get_text(int nPos) const override { return mxControl->get_text(nPos); }
123 virtual weld::Widget& get_widget() const override { return *mxControl; }
124 virtual void append(const OUString& rId, const OUString& rText) override { mxControl->append(rId, rText); }
125 virtual void append_text(const OUString& rText) override { mxControl->append_text(rText); }
126 virtual void insert_text(int nPos, const OUString& rText) override { mxControl->insert_text(nPos, rText); }
127 virtual void set_active(int nPos) override { mxControl->select(nPos); }
128 virtual void set_id(int nPos, const OUString& rId) override { mxControl->set_id(nPos, rId); }
129 OUString get_selected_text() const { return mxControl->get_selected_text(); }
130 bool get_visible() const { return mxControl->get_visible(); }
131 int get_selected_index() const { return mxControl->get_selected_index(); }
132 void set_visible(bool bVisible) { mxControl->set_visible(bVisible); }
133 void select(int nPos) { mxControl->select(nPos); }
134 void connect_row_activated(const Link<weld::TreeView&, bool>& rLink) { mxControl->connect_row_activated(rLink); }
135 OUString get_buildable_name() const { return mxControl->get_buildable_name(); }
136 void set_buildable_name(const OUString& rId){ mxControl->set_buildable_name(rId); }
137};
138
139#endif
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:92
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:91
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:89
virtual int get_active() const override
Definition: numfmtlb.hxx:87
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:90
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:93
void set_buildable_name(const OUString &rId)
Definition: numfmtlb.hxx:102
std::unique_ptr< weld::ComboBox > mxControl
Definition: numfmtlb.hxx:74
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:88
DECL_DLLPRIVATE_LINK(SelectHdl, weld::ComboBox &, void)
virtual int get_count() const override
Definition: numfmtlb.hxx:86
OUString get_buildable_name() const
Definition: numfmtlb.hxx:101
void set_sensitive(bool bSensitive)
Definition: numfmtlb.hxx:99
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:94
void connect_changed(const Link< weld::ComboBox &, void > &rLink)
Definition: numfmtlb.hxx:100
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:95
SvNumFormatType GetFormatType() const
Definition: numfmtlb.hxx:44
bool mbCurrFormatTypeNeedsInit
Definition: numfmtlb.hxx:35
virtual void append(const OUString &rId, const OUString &rText)=0
sal_uInt32 m_nDefFormat
Definition: numfmtlb.hxx:31
virtual int get_active() const =0
void SetLanguage(LanguageType eSet)
Definition: numfmtlb.hxx:46
LanguageType GetCurLanguage() const
Definition: numfmtlb.hxx:45
virtual OUString get_id(int nPos) const =0
void SetAutomaticLanguage(bool bSet)
Definition: numfmtlb.hxx:42
LanguageType m_eCurLanguage
Definition: numfmtlb.hxx:33
virtual void set_id(int nPos, const OUString &rId)=0
virtual ~SwNumFormatBase()
Definition: numfmtlb.hxx:69
virtual void insert_text(int nPos, const OUString &rText)=0
virtual void append_text(const OUString &rText)=0
bool m_bShowLanguageControl
Definition: numfmtlb.hxx:36
SvNumFormatType m_nCurrFormatType
Definition: numfmtlb.hxx:32
void SetOneArea(bool bOnlyOne)
Definition: numfmtlb.hxx:49
virtual sal_uInt32 GetFormat() const =0
virtual weld::Widget & get_widget() const =0
virtual void set_active(int nPos)=0
sal_Int32 m_nStdEntry
Definition: numfmtlb.hxx:30
virtual int get_count() const =0
virtual OUString get_text(int nPos) const =0
void SetShowLanguageControl(bool bSet)
Definition: numfmtlb.hxx:47
bool m_bUseAutomaticLanguage
Definition: numfmtlb.hxx:38
bool IsAutomaticLanguage() const
Definition: numfmtlb.hxx:43
OUString get_selected_text() const
Definition: numfmtlb.hxx:129
virtual int get_active() const override
Definition: numfmtlb.hxx:120
virtual void set_active(int nPos) override
Definition: numfmtlb.hxx:127
virtual OUString get_id(int nPos) const override
Definition: numfmtlb.hxx:121
OUString get_buildable_name() const
Definition: numfmtlb.hxx:135
void connect_row_activated(const Link< weld::TreeView &, bool > &rLink)
Definition: numfmtlb.hxx:134
virtual void set_id(int nPos, const OUString &rId) override
Definition: numfmtlb.hxx:128
virtual void append_text(const OUString &rText) override
Definition: numfmtlb.hxx:125
int get_selected_index() const
Definition: numfmtlb.hxx:131
std::unique_ptr< weld::TreeView > mxControl
Definition: numfmtlb.hxx:107
virtual void insert_text(int nPos, const OUString &rText) override
Definition: numfmtlb.hxx:126
DECL_DLLPRIVATE_LINK(SelectHdl, weld::TreeView &, void)
virtual void append(const OUString &rId, const OUString &rText) override
Definition: numfmtlb.hxx:124
virtual weld::Widget & get_widget() const override
Definition: numfmtlb.hxx:123
void set_visible(bool bVisible)
Definition: numfmtlb.hxx:132
bool get_visible() const
Definition: numfmtlb.hxx:130
void select(int nPos)
Definition: numfmtlb.hxx:133
virtual OUString get_text(int nPos) const override
Definition: numfmtlb.hxx:122
void set_buildable_name(const OUString &rId)
Definition: numfmtlb.hxx:136
virtual int get_count() const override
Definition: numfmtlb.hxx:119
Definition: view.hxx:146
void Init()
virtual SotClipboardFormatId GetFormat(const TransferableDataHelper &aHelper) override
sal_uInt16 nPos
#define SW_DLLPUBLIC
Definition: swdllapi.h:28
bool bVisible
SvNumFormatType