summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-09-10 17:19:19 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-09-14 11:43:51 +0100
commit9237a905fa5f2b67db73c15847eff203a258c2b4 (patch)
treebf213e7f3fd7322ee032af9fa648d04c99faaba1 /include
parent34f6b7f4529cc5a3b0e286fbd7318c2b7bf9b132 (diff)
weld SvxCharNamePage
Change-Id: Ia54a5ac4fe4a11b7c03508c336193bb52c616e7f
Diffstat (limited to 'include')
-rw-r--r--include/sfx2/newstyle.hxx4
-rw-r--r--include/svtools/ctrlbox.hxx98
-rw-r--r--include/svx/langbox.hxx30
-rw-r--r--include/vcl/combobox.hxx2
-rw-r--r--include/vcl/lstbox.hxx2
-rw-r--r--include/vcl/weld.hxx151
6 files changed, 229 insertions, 58 deletions
diff --git a/include/sfx2/newstyle.hxx b/include/sfx2/newstyle.hxx
index 6fecb3378f4d..5cd9e24b41e7 100644
--- a/include/sfx2/newstyle.hxx
+++ b/include/sfx2/newstyle.hxx
@@ -38,13 +38,13 @@ private:
DECL_DLLPRIVATE_LINK(OKHdl, weld::TreeView&, void);
DECL_DLLPRIVATE_LINK(OKClickHdl, weld::Button&, void);
- DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::ComboBoxText&, void);
public:
SfxNewStyleDlg(weld::Window* pParent, SfxStyleSheetBasePool&);
virtual ~SfxNewStyleDlg() override;
- OUString GetName() const { return comphelper::string::stripStart(m_xColBox->get_text(), ' '); }
+ OUString GetName() const { return comphelper::string::stripStart(m_xColBox->get_active_text(), ' '); }
};
#endif
diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx
index 65c2f5d62a6a..5ff94f0558a9 100644
--- a/include/svtools/ctrlbox.hxx
+++ b/include/svtools/ctrlbox.hxx
@@ -409,7 +409,12 @@ public:
virtual void Modify() override;
virtual Size GetOptimalSize() const override;
- void SetText( const OUString& rText ) override;
+ void SetText( const OUString& rText ) override
+ {
+ aLastStyle = rText;
+ ComboBox::SetText( rText );
+ }
+
void Fill( const OUString& rName, const FontList* pList );
private:
@@ -417,11 +422,27 @@ private:
FontStyleBox& operator =( const FontStyleBox& ) = delete;
};
-inline void FontStyleBox::SetText( const OUString& rText )
+class SVT_DLLPUBLIC SvtFontStyleBox
{
- aLastStyle = rText;
- ComboBox::SetText( rText );
-}
+ std::unique_ptr<weld::ComboBoxText> m_xComboBox;
+public:
+ SvtFontStyleBox(std::unique_ptr<weld::ComboBoxText> p);
+
+ void Fill(const OUString& rName, const FontList* pList);
+
+ void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_xComboBox->connect_changed(rLink); }
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
+ void append_text(const OUString& rStr) { m_xComboBox->append_text(rStr); }
+ void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
+ void save_value() { m_xComboBox->save_value(); }
+ OUString const& get_saved_value() const { return m_xComboBox->get_saved_value(); }
+ int get_count() const { return m_xComboBox->get_count(); }
+ int find_text(const OUString& rStr) const { return m_xComboBox->find_text(rStr); }
+private:
+ SvtFontStyleBox(const SvtFontStyleBox& ) = delete;
+ SvtFontStyleBox& operator=(const SvtFontStyleBox&) = delete;
+};
class SVT_DLLPUBLIC FontSizeBox : public MetricBox
{
@@ -472,6 +493,73 @@ private:
FontSizeBox& operator =( const FontSizeBox& ) = delete;
};
+class SVT_DLLPUBLIC SvtFontSizeBox
+{
+ FontMetric aFontMetric;
+ const FontList* pFontList;
+ int nSavedValue;
+ int nMin;
+ int nMax;
+ FieldUnit eUnit;
+ sal_uInt16 nDecimalDigits;
+ sal_uInt16 nRelMin;
+ sal_uInt16 nRelMax;
+ sal_uInt16 nRelStep;
+ short nPtRelMin;
+ short nPtRelMax;
+ short nPtRelStep;
+ bool bRelativeMode:1,
+ bRelative:1,
+ bPtRelative:1,
+ bStdSize:1;
+ Link<weld::ComboBoxText&, void> m_aChangeHdl;
+ std::unique_ptr<weld::ComboBoxText> m_xComboBox;
+
+ sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; }
+ void SetDecimalDigits(sal_uInt16 nDigits) { nDecimalDigits = nDigits; }
+ FieldUnit GetUnit() const { return eUnit; }
+ void SetUnit(FieldUnit _eUnit) { eUnit = _eUnit; }
+ void SetRange(int nNewMin, int nNewMax) { nMin = nNewMin; nMax = nNewMax; }
+ void SetValue(int nNewValue, FieldUnit eInUnit);
+
+ void InsertValue(int i);
+
+ OUString format_number(int nValue) const;
+
+ DECL_LINK(ModifyHdl, weld::ComboBoxText&, void);
+ DECL_LINK(ReformatHdl, weld::Widget&, void);
+public:
+ SvtFontSizeBox(std::unique_ptr<weld::ComboBoxText> p);
+
+ void Fill(const FontMetric* pFontMetric, const FontList* pList);
+
+ void EnableRelativeMode(sal_uInt16 nMin, sal_uInt16 nMax, sal_uInt16 nStep = 5);
+ void EnablePtRelativeMode(short nMin, short nMax, short nStep = 10);
+ bool IsRelativeMode() const { return bRelativeMode; }
+ void SetRelative( bool bRelative );
+ bool IsRelative() const { return bRelative; }
+ void SetPtRelative( bool bPtRel )
+ {
+ bPtRelative = bPtRel;
+ SetRelative(true);
+ }
+ bool IsPtRelative() const { return bPtRelative; }
+
+ void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
+ OUString get_active_text() const { return m_xComboBox->get_active_text(); }
+ void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); }
+ void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); }
+ int get_value() const;
+ void set_value(int nValue);
+ void save_value() { nSavedValue = get_value(); }
+ int get_saved_value() const { return nSavedValue; }
+
+private:
+ SvtFontSizeBox(const SvtFontSizeBox&) = delete;
+ SvtFontSizeBox& operator=(const SvtFontSizeBox&) = delete;
+};
+
+
#endif // INCLUDED_SVTOOLS_CTRLBOX_HXX
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/langbox.hxx b/include/svx/langbox.hxx
index 9b130559320f..723957c54e35 100644
--- a/include/svx/langbox.hxx
+++ b/include/svx/langbox.hxx
@@ -149,12 +149,23 @@ private:
class SVX_DLLPUBLIC LanguageBox
{
+public:
+ enum class EditedAndValid
+ {
+ No,
+ Valid,
+ Invalid
+ };
+
private:
std::unique_ptr<weld::ComboBoxText> m_xControl;
Link<weld::ComboBoxText&, void> m_aChangeHdl;
OUString m_aAllString;
+ LanguageType m_eSavedLanguage;
+ EditedAndValid m_eEditedAndValid;
bool m_bHasLangNone;
bool m_bLangNoneIsLangAll;
+ bool m_bWithCheckmark;
SVX_DLLPRIVATE int ImplTypeToPos(LanguageType eType) const;
SVX_DLLPRIVATE void ImplClear();
@@ -162,17 +173,24 @@ private:
public:
LanguageBox(std::unique_ptr<weld::ComboBoxText> pControl);
void SetLanguageList( SvxLanguageListFlags nLangList,
- bool bHasLangNone, bool bLangNoneIsLangAll = false );
+ bool bHasLangNone, bool bLangNoneIsLangAll = false,
+ bool bCheckSpellAvail = false );
void AddLanguages( const std::vector< LanguageType >& rLanguageTypes, SvxLanguageListFlags nLangList );
void InsertLanguage(const LanguageType nLangType);
- void SelectLanguage( const LanguageType eLangType );
- LanguageType GetSelectedLanguage() const;
- void SelectEntryPos(int nPos) { m_xControl->set_active(nPos); }
+
+ EditedAndValid GetEditedAndValid() const { return m_eEditedAndValid;}
+ sal_Int32 SaveEditedAsEntry();
void connect_changed(const Link<weld::ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
- void save_value() { m_xControl->save_value(); }
- bool get_value_changed_from_saved() const { return m_xControl->get_value_changed_from_saved(); }
+ void save_active_id() { m_eSavedLanguage = get_active_id(); }
+ LanguageType get_saved_active_id() const { return m_eSavedLanguage; }
+ bool get_active_id_changed_from_saved() const { return m_eSavedLanguage != get_active_id(); }
void hide() { m_xControl->hide(); }
+ void set_sensitive(bool bSensitive) { m_xControl->set_sensitive(bSensitive); }
+ void set_active(int nPos) { m_xControl->set_active(nPos); }
+ int get_active() const { return m_xControl->get_active(); }
+ void set_active_id(const LanguageType eLangType);
+ LanguageType get_active_id() const;
};
class SVX_DLLPUBLIC SvxLanguageComboBox : public ComboBox, public SvxLanguageBoxBase
diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx
index 4d30398e8c6e..890d5c1ceffc 100644
--- a/include/vcl/combobox.hxx
+++ b/include/vcl/combobox.hxx
@@ -173,6 +173,8 @@ public:
void setMaxWidthChars(sal_Int32 nWidth);
+ void SetWidthInChars(sal_Int32 nWidthInChars);
+
virtual bool set_property(const OString &rKey, const OUString &rValue) override;
virtual FactoryFunction GetUITestFactory() const override;
diff --git a/include/vcl/lstbox.hxx b/include/vcl/lstbox.hxx
index 62ad36283adc..fbc6bbca152b 100644
--- a/include/vcl/lstbox.hxx
+++ b/include/vcl/lstbox.hxx
@@ -70,10 +70,12 @@ class ImplListBoxFloatingWindow;
class ImplBtn;
class ImplWin;
class ImplListBoxWindow;
+class SalInstanceEntryTreeView;
class VCL_DLLPUBLIC ListBox : public Control
{
private:
+ friend SalInstanceEntryTreeView;
VclPtr<ImplListBox> mpImplLB;
VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
VclPtr<ImplWin> mpImplWin;
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 5c82b6d3dc27..b74df5232c4f 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -255,33 +255,41 @@ protected:
void signal_changed() { m_aChangeHdl.Call(*this); }
public:
- virtual int get_active() const = 0;
- virtual void set_active(int pos) = 0;
- virtual OUString get_active_text() const = 0;
- virtual OUString get_active_id() const = 0;
- virtual void set_active_id(const OUString& rStr) = 0;
- virtual OUString get_text(int pos) const = 0;
- virtual OUString get_id(int pos) const = 0;
virtual void insert_text(int pos, const OUString& rStr) = 0;
void append_text(const OUString& rStr) { insert_text(-1, rStr); }
virtual void insert(int pos, const OUString& rId, const OUString& rStr) = 0;
void append(const OUString& rId, const OUString& rStr) { insert(-1, rId, rStr); }
- virtual void remove(int pos) = 0;
- void remove_text(const OUString& rText) { remove(find_text(rText)); }
- virtual int find_text(const OUString& rStr) const = 0;
- void remove_id(const OUString& rId) { remove(find_id(rId)); }
- virtual int find_id(const OUString& rId) const = 0;
+
virtual int get_count() const = 0;
virtual void make_sorted() = 0;
virtual void clear() = 0;
- virtual void set_entry_error(bool bError) = 0;
-
- void connect_changed(const Link<ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
+ //by index
+ virtual int get_active() const = 0;
+ virtual void set_active(int pos) = 0;
+ virtual void remove(int pos) = 0;
+ //by text
+ virtual OUString get_active_text() const = 0;
void set_active_text(const OUString& rStr) { set_active(find_text(rStr)); }
+ virtual OUString get_text(int pos) const = 0;
+ virtual int find_text(const OUString& rStr) const = 0;
+ void remove_text(const OUString& rText) { remove(find_text(rText)); }
+ //by id
+ virtual OUString get_active_id() const = 0;
+ virtual void set_active_id(const OUString& rStr) = 0;
+ virtual OUString get_id(int pos) const = 0;
+ virtual int find_id(const OUString& rId) const = 0;
+ void remove_id(const OUString& rId) { remove(find_id(rId)); }
+
+ void connect_changed(const Link<ComboBoxText&, void>& rLink) { m_aChangeHdl = rLink; }
+
+ //entry related
+ virtual bool has_entry() const = 0;
+ virtual void set_entry_error(bool bError) = 0;
virtual void set_entry_text(const OUString& rStr) = 0;
+ virtual void set_entry_width_chars(int nChars) = 0;
virtual void select_entry_region(int nStartPos, int nEndPos) = 0;
virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0;
virtual void set_entry_completion(bool bEnable) = 0;
@@ -496,6 +504,7 @@ public:
virtual void set_position(int nCursorPos) = 0;
virtual void set_editable(bool bEditable) = 0;
virtual bool get_editable() const = 0;
+ virtual void set_error(bool bShowError) = 0;
virtual vcl::Font get_font() = 0;
virtual void set_font(const vcl::Font& rFont) = 0;
@@ -581,6 +590,83 @@ public:
static unsigned int Power10(unsigned int n);
};
+// an entry + treeview pair, where the entry autocompletes from the
+// treeview list, and selecting something in the list sets the
+// entry to that text, i.e. a visually exploded ComboBox
+class VCL_DLLPUBLIC EntryTreeView : virtual public ComboBoxText
+{
+private:
+ DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
+ DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
+ void EntryModifyHdl(weld::Entry& rEntry);
+
+protected:
+ std::unique_ptr<Entry> m_xEntry;
+ std::unique_ptr<TreeView> m_xTreeView;
+
+public:
+ EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
+
+ virtual void insert_text(int pos, const OUString& rStr) override
+ {
+ m_xTreeView->insert_text(rStr, pos);
+ }
+ virtual void insert(int pos, const OUString& rId, const OUString& rStr) override
+ {
+ m_xTreeView->insert(pos, rId, rStr, OUString());
+ }
+
+ virtual int get_count() const override { return m_xTreeView->n_children(); }
+ virtual void clear() override { m_xTreeView->clear(); }
+
+ //by index
+ virtual int get_active() const override { return m_xTreeView->get_selected_index(); }
+ virtual void set_active(int pos) override
+ {
+ m_xTreeView->select(pos);
+ m_xEntry->set_text(m_xTreeView->get_selected_text());
+ }
+ virtual void remove(int pos) override { m_xTreeView->remove(pos); }
+
+ //by text
+ virtual OUString get_active_text() const override { return m_xEntry->get_text(); }
+ virtual OUString get_text(int pos) const override { return m_xTreeView->get_text(pos); }
+ virtual int find_text(const OUString& rStr) const override
+ {
+ return m_xTreeView->find_text(rStr);
+ }
+
+ //by id
+ virtual OUString get_active_id() const override { return m_xTreeView->get_selected_id(); }
+ virtual void set_active_id(const OUString& rStr) override
+ {
+ m_xTreeView->select_id(rStr);
+ m_xEntry->set_text(m_xTreeView->get_selected_text());
+ }
+ virtual OUString get_id(int pos) const override { return m_xTreeView->get_id(pos); }
+ virtual int find_id(const OUString& rId) const override { return m_xTreeView->find_id(rId); }
+
+ //entry related
+ virtual bool has_entry() const override { return true; }
+ virtual void set_entry_error(bool bError) override { m_xEntry->set_error(bError); }
+ virtual void set_entry_text(const OUString& rStr) override { m_xEntry->set_text(rStr); }
+ virtual void set_entry_width_chars(int nChars) override { m_xEntry->set_width_chars(nChars); }
+ virtual void select_entry_region(int nStartPos, int nEndPos) override
+ {
+ m_xEntry->select_region(nStartPos, nEndPos);
+ }
+ virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) override
+ {
+ return m_xEntry->get_selection_bounds(rStartPos, rEndPos);
+ }
+ void connect_row_activated(const Link<TreeView&, void>& rLink)
+ {
+ m_xTreeView->connect_row_activated(rLink);
+ }
+
+ void set_height_request_by_rows(int nRows);
+};
+
class VCL_DLLPUBLIC MetricSpinButton
{
protected:
@@ -611,6 +697,8 @@ public:
spin_button_output(*m_xSpinButton);
}
+ static OUString MetricToString(FieldUnit rUnit);
+
FieldUnit get_unit() const { return m_eSrcUnit; }
void set_unit(FieldUnit eUnit)
@@ -901,33 +989,6 @@ public:
virtual Point get_accessible_location() = 0;
};
-// an entry + treeview pair, where the entry autocompletes from the
-// treeview list, and selecting something in the list sets the
-// entry to that text
-class VCL_DLLPUBLIC EntryTreeView
-{
-private:
- DECL_DLLPRIVATE_LINK(ClickHdl, weld::TreeView&, void);
- DECL_DLLPRIVATE_LINK(ModifyHdl, weld::Entry&, void);
- void EntryModifyHdl(weld::Entry& rEntry);
-
-protected:
- Link<Entry&, void> m_aChangeHdl;
- std::unique_ptr<Entry> m_xEntry;
- std::unique_ptr<TreeView> m_xTreeView;
-
-public:
- EntryTreeView(std::unique_ptr<Entry> xEntry, std::unique_ptr<TreeView> xTreeView);
- OUString get_text() const { return m_xEntry->get_text(); }
- void append_text(const OUString& rText) { m_xTreeView->append_text(rText); }
- void connect_row_activated(const Link<TreeView&, void>& rLink)
- {
- m_xTreeView->connect_row_activated(rLink);
- }
- void connect_changed(const Link<Entry&, void>& rLink) { m_aChangeHdl = rLink; }
- void set_size_request_by_digits_rows(int nDigits, int nRows);
-};
-
class VCL_DLLPUBLIC Menu
{
public:
@@ -1019,9 +1080,9 @@ public:
FactoryFunction pUITestFactoryFunction = nullptr, void* pUserData = nullptr,
bool bTakeOwnership = false)
= 0;
- virtual std::unique_ptr<EntryTreeView> weld_entry_tree_view(const OString& entryid,
- const OString& treeviewid,
- bool bTakeOwnership = false)
+ virtual std::unique_ptr<EntryTreeView>
+ weld_entry_tree_view(const OString& containerid, const OString& entryid,
+ const OString& treeviewid, bool bTakeOwnership = false)
= 0;
virtual std::unique_ptr<Menu> weld_menu(const OString& id, bool bTakeOwnership = true) = 0;
virtual std::unique_ptr<SizeGroup> create_size_group() = 0;