Move SalInstanceEdit declaration to the header file
Change-Id: I660de317b88c4e83ccc310743dc4ef5b4c955a21 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/89370 Tested-by: Jenkins Reviewed-by: Szymon Kłos <szymon.klos@collabora.com>
This commit is contained in:
@@ -7,6 +7,8 @@
|
||||
#include <vcl/settings.hxx>
|
||||
#include <vcl/virdev.hxx>
|
||||
#include <vcl/ctrl.hxx>
|
||||
#include <vcl/edit.hxx>
|
||||
#include <vcl/spinfld.hxx>
|
||||
|
||||
class SalInstanceBuilder : public weld::Builder
|
||||
{
|
||||
@@ -495,4 +497,122 @@ public:
|
||||
virtual weld::Container* weld_content_area() override;
|
||||
};
|
||||
|
||||
class WeldTextFilter : public TextFilter
|
||||
{
|
||||
private:
|
||||
Link<OUString&, bool>& m_rInsertTextHdl;
|
||||
|
||||
public:
|
||||
WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl);
|
||||
|
||||
virtual OUString filter(const OUString& rText) override;
|
||||
};
|
||||
|
||||
class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
|
||||
{
|
||||
private:
|
||||
VclPtr<::Edit> m_xEntry;
|
||||
|
||||
DECL_LINK(ChangeHdl, Edit&, void);
|
||||
DECL_LINK(CursorListener, VclWindowEvent&, void);
|
||||
DECL_LINK(ActivateHdl, Edit&, bool);
|
||||
|
||||
WeldTextFilter m_aTextFilter;
|
||||
|
||||
public:
|
||||
SalInstanceEntry(::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership);
|
||||
|
||||
virtual void set_text(const OUString& rText) override;
|
||||
|
||||
virtual OUString get_text() const override;
|
||||
|
||||
virtual void set_width_chars(int nChars) override;
|
||||
|
||||
virtual int get_width_chars() const override;
|
||||
|
||||
virtual void set_max_length(int nChars) override;
|
||||
|
||||
virtual void select_region(int nStartPos, int nEndPos) override;
|
||||
|
||||
bool get_selection_bounds(int& rStartPos, int& rEndPos) override;
|
||||
|
||||
virtual void replace_selection(const OUString& rText) override;
|
||||
|
||||
virtual void set_position(int nCursorPos) override;
|
||||
|
||||
virtual int get_position() const override;
|
||||
|
||||
virtual void set_editable(bool bEditable) override;
|
||||
|
||||
virtual bool get_editable() const override;
|
||||
|
||||
virtual void set_message_type(weld::EntryMessageType eType) override;
|
||||
|
||||
virtual void set_font(const vcl::Font& rFont) override;
|
||||
|
||||
virtual void connect_cursor_position(const Link<Entry&, void>& rLink) override;
|
||||
|
||||
virtual void set_placeholder_text(const OUString& rText) override;
|
||||
|
||||
Edit& getEntry();
|
||||
|
||||
void fire_signal_changed();
|
||||
|
||||
virtual void cut_clipboard() override;
|
||||
|
||||
virtual void copy_clipboard() override;
|
||||
|
||||
virtual void paste_clipboard() override;
|
||||
|
||||
virtual ~SalInstanceEntry() override;
|
||||
};
|
||||
|
||||
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
|
||||
{
|
||||
private:
|
||||
VclPtr<FormattedField> m_xButton;
|
||||
|
||||
DECL_LINK(UpDownHdl, SpinField&, void);
|
||||
DECL_LINK(LoseFocusHdl, Control&, void);
|
||||
DECL_LINK(OutputHdl, Edit&, bool);
|
||||
DECL_LINK(InputHdl, sal_Int64*, TriState);
|
||||
DECL_LINK(ActivateHdl, Edit&, bool);
|
||||
|
||||
double toField(int nValue) const;
|
||||
|
||||
int fromField(double fValue) const;
|
||||
|
||||
public:
|
||||
SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership);
|
||||
|
||||
virtual int get_value() const override;
|
||||
|
||||
virtual void set_value(int value) override;
|
||||
|
||||
virtual void set_range(int min, int max) override;
|
||||
|
||||
virtual void get_range(int& min, int& max) const override;
|
||||
|
||||
virtual void set_increments(int step, int /*page*/) override;
|
||||
|
||||
virtual void get_increments(int& step, int& page) const override;
|
||||
|
||||
virtual void set_digits(unsigned int digits) override;
|
||||
|
||||
// SpinButton may be comprised of multiple subwidgets, consider the lot as
|
||||
// one thing for focus
|
||||
virtual bool has_focus() const override;
|
||||
|
||||
//so with hh::mm::ss, incrementing mm will not reset ss
|
||||
void DisableRemainderFactor();
|
||||
|
||||
//off by default for direct SpinButtons, MetricSpinButton enables it
|
||||
void SetUseThousandSep();
|
||||
|
||||
virtual unsigned int get_digits() const override;
|
||||
|
||||
virtual ~SalInstanceSpinButton() override;
|
||||
};
|
||||
|
||||
#endif
|
@@ -2989,169 +2989,181 @@ IMPL_LINK_NOARG(SalInstanceCalendar, ActivateHdl, ::Calendar*, void)
|
||||
signal_activated();
|
||||
}
|
||||
|
||||
namespace
|
||||
WeldTextFilter::WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl)
|
||||
: TextFilter(OUString())
|
||||
, m_rInsertTextHdl(rInsertTextHdl)
|
||||
{
|
||||
class WeldTextFilter : public TextFilter
|
||||
}
|
||||
|
||||
OUString WeldTextFilter::filter(const OUString& rText)
|
||||
{
|
||||
private:
|
||||
Link<OUString&, bool>& m_rInsertTextHdl;
|
||||
if (!m_rInsertTextHdl.IsSet())
|
||||
return rText;
|
||||
OUString sText(rText);
|
||||
const bool bContinue = m_rInsertTextHdl.Call(sText);
|
||||
if (!bContinue)
|
||||
return OUString();
|
||||
return sText;
|
||||
}
|
||||
|
||||
public:
|
||||
WeldTextFilter(Link<OUString&, bool>& rInsertTextHdl)
|
||||
: TextFilter(OUString())
|
||||
, m_rInsertTextHdl(rInsertTextHdl)
|
||||
{
|
||||
}
|
||||
|
||||
virtual OUString filter(const OUString& rText) override
|
||||
{
|
||||
if (!m_rInsertTextHdl.IsSet())
|
||||
return rText;
|
||||
OUString sText(rText);
|
||||
const bool bContinue = m_rInsertTextHdl.Call(sText);
|
||||
if (!bContinue)
|
||||
return OUString();
|
||||
return sText;
|
||||
}
|
||||
};
|
||||
|
||||
class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry
|
||||
SalInstanceEntry::SalInstanceEntry(Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||
: SalInstanceWidget(pEntry, pBuilder, bTakeOwnership)
|
||||
, m_xEntry(pEntry)
|
||||
, m_aTextFilter(m_aInsertTextHdl)
|
||||
{
|
||||
private:
|
||||
VclPtr<Edit> m_xEntry;
|
||||
m_xEntry->SetModifyHdl(LINK(this, SalInstanceEntry, ChangeHdl));
|
||||
m_xEntry->SetActivateHdl(LINK(this, SalInstanceEntry, ActivateHdl));
|
||||
m_xEntry->SetTextFilter(&m_aTextFilter);
|
||||
}
|
||||
|
||||
DECL_LINK(ChangeHdl, Edit&, void);
|
||||
DECL_LINK(CursorListener, VclWindowEvent&, void);
|
||||
DECL_LINK(ActivateHdl, Edit&, bool);
|
||||
void SalInstanceEntry::set_text(const OUString& rText)
|
||||
{
|
||||
disable_notify_events();
|
||||
m_xEntry->SetText(rText);
|
||||
enable_notify_events();
|
||||
}
|
||||
|
||||
WeldTextFilter m_aTextFilter;
|
||||
OUString SalInstanceEntry::get_text() const
|
||||
{
|
||||
return m_xEntry->GetText();
|
||||
}
|
||||
|
||||
public:
|
||||
SalInstanceEntry(Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership)
|
||||
: SalInstanceWidget(pEntry, pBuilder, bTakeOwnership)
|
||||
, m_xEntry(pEntry)
|
||||
, m_aTextFilter(m_aInsertTextHdl)
|
||||
void SalInstanceEntry::set_width_chars(int nChars)
|
||||
{
|
||||
m_xEntry->SetWidthInChars(nChars);
|
||||
}
|
||||
|
||||
int SalInstanceEntry::get_width_chars() const
|
||||
{
|
||||
return m_xEntry->GetWidthInChars();
|
||||
}
|
||||
|
||||
void SalInstanceEntry::set_max_length(int nChars)
|
||||
{
|
||||
m_xEntry->SetMaxTextLen(nChars);
|
||||
}
|
||||
|
||||
void SalInstanceEntry::select_region(int nStartPos, int nEndPos)
|
||||
{
|
||||
disable_notify_events();
|
||||
m_xEntry->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
|
||||
enable_notify_events();
|
||||
}
|
||||
|
||||
bool SalInstanceEntry::get_selection_bounds(int& rStartPos, int& rEndPos)
|
||||
{
|
||||
const Selection& rSelection = m_xEntry->GetSelection();
|
||||
rStartPos = rSelection.Min();
|
||||
rEndPos = rSelection.Max();
|
||||
return rSelection.Len();
|
||||
}
|
||||
|
||||
void SalInstanceEntry::replace_selection(const OUString& rText)
|
||||
{
|
||||
m_xEntry->ReplaceSelected(rText);
|
||||
}
|
||||
|
||||
void SalInstanceEntry::set_position(int nCursorPos)
|
||||
{
|
||||
disable_notify_events();
|
||||
if (nCursorPos < 0)
|
||||
m_xEntry->SetCursorAtLast();
|
||||
else
|
||||
m_xEntry->SetSelection(Selection(nCursorPos, nCursorPos));
|
||||
enable_notify_events();
|
||||
}
|
||||
|
||||
int SalInstanceEntry::get_position() const
|
||||
{
|
||||
return m_xEntry->GetSelection().Max();
|
||||
}
|
||||
|
||||
void SalInstanceEntry::set_editable(bool bEditable)
|
||||
{
|
||||
m_xEntry->SetReadOnly(!bEditable);
|
||||
}
|
||||
|
||||
bool SalInstanceEntry::get_editable() const
|
||||
{
|
||||
return !m_xEntry->IsReadOnly();
|
||||
}
|
||||
|
||||
void SalInstanceEntry::set_message_type(weld::EntryMessageType eType)
|
||||
{
|
||||
if (eType == weld::EntryMessageType::Error)
|
||||
{
|
||||
m_xEntry->SetModifyHdl(LINK(this, SalInstanceEntry, ChangeHdl));
|
||||
m_xEntry->SetActivateHdl(LINK(this, SalInstanceEntry, ActivateHdl));
|
||||
m_xEntry->SetTextFilter(&m_aTextFilter);
|
||||
// tdf#114603: enable setting the background to a different color;
|
||||
// relevant for GTK; see also #i75179#
|
||||
m_xEntry->SetForceControlBackground(true);
|
||||
m_xEntry->SetControlForeground(COL_WHITE);
|
||||
m_xEntry->SetControlBackground(0xff6563);
|
||||
}
|
||||
|
||||
virtual void set_text(const OUString& rText) override
|
||||
else if (eType == weld::EntryMessageType::Warning)
|
||||
{
|
||||
disable_notify_events();
|
||||
m_xEntry->SetText(rText);
|
||||
enable_notify_events();
|
||||
// tdf#114603: enable setting the background to a different color;
|
||||
// relevant for GTK; see also #i75179#
|
||||
m_xEntry->SetForceControlBackground(true);
|
||||
m_xEntry->SetControlForeground();
|
||||
m_xEntry->SetControlBackground(COL_YELLOW);
|
||||
}
|
||||
|
||||
virtual OUString get_text() const override { return m_xEntry->GetText(); }
|
||||
|
||||
virtual void set_width_chars(int nChars) override { m_xEntry->SetWidthInChars(nChars); }
|
||||
|
||||
virtual int get_width_chars() const override { return m_xEntry->GetWidthInChars(); }
|
||||
|
||||
virtual void set_max_length(int nChars) override { m_xEntry->SetMaxTextLen(nChars); }
|
||||
|
||||
virtual void select_region(int nStartPos, int nEndPos) override
|
||||
else
|
||||
{
|
||||
disable_notify_events();
|
||||
m_xEntry->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
|
||||
enable_notify_events();
|
||||
m_xEntry->SetForceControlBackground(false);
|
||||
m_xEntry->SetControlForeground();
|
||||
m_xEntry->SetControlBackground();
|
||||
}
|
||||
}
|
||||
|
||||
bool get_selection_bounds(int& rStartPos, int& rEndPos) override
|
||||
{
|
||||
const Selection& rSelection = m_xEntry->GetSelection();
|
||||
rStartPos = rSelection.Min();
|
||||
rEndPos = rSelection.Max();
|
||||
return rSelection.Len();
|
||||
}
|
||||
void SalInstanceEntry::set_font(const vcl::Font& rFont)
|
||||
{
|
||||
m_xEntry->SetPointFont(*m_xEntry, rFont);
|
||||
m_xEntry->Invalidate();
|
||||
}
|
||||
|
||||
virtual void replace_selection(const OUString& rText) override
|
||||
{
|
||||
m_xEntry->ReplaceSelected(rText);
|
||||
}
|
||||
void SalInstanceEntry::connect_cursor_position(const Link<Entry&, void>& rLink)
|
||||
{
|
||||
assert(!m_aCursorPositionHdl.IsSet());
|
||||
m_xEntry->AddEventListener(LINK(this, SalInstanceEntry, CursorListener));
|
||||
weld::Entry::connect_cursor_position(rLink);
|
||||
}
|
||||
|
||||
virtual void set_position(int nCursorPos) override
|
||||
{
|
||||
disable_notify_events();
|
||||
if (nCursorPos < 0)
|
||||
m_xEntry->SetCursorAtLast();
|
||||
else
|
||||
m_xEntry->SetSelection(Selection(nCursorPos, nCursorPos));
|
||||
enable_notify_events();
|
||||
}
|
||||
void SalInstanceEntry::set_placeholder_text(const OUString& rText)
|
||||
{
|
||||
m_xEntry->SetPlaceholderText(rText);
|
||||
}
|
||||
|
||||
virtual int get_position() const override { return m_xEntry->GetSelection().Max(); }
|
||||
Edit& SalInstanceEntry::getEntry()
|
||||
{
|
||||
return *m_xEntry;
|
||||
}
|
||||
|
||||
virtual void set_editable(bool bEditable) override { m_xEntry->SetReadOnly(!bEditable); }
|
||||
void SalInstanceEntry::fire_signal_changed()
|
||||
{
|
||||
signal_changed();
|
||||
}
|
||||
|
||||
virtual bool get_editable() const override { return !m_xEntry->IsReadOnly(); }
|
||||
void SalInstanceEntry::cut_clipboard()
|
||||
{
|
||||
m_xEntry->Cut();
|
||||
}
|
||||
|
||||
virtual void set_message_type(weld::EntryMessageType eType) override
|
||||
{
|
||||
if (eType == weld::EntryMessageType::Error)
|
||||
{
|
||||
// tdf#114603: enable setting the background to a different color;
|
||||
// relevant for GTK; see also #i75179#
|
||||
m_xEntry->SetForceControlBackground(true);
|
||||
m_xEntry->SetControlForeground(COL_WHITE);
|
||||
m_xEntry->SetControlBackground(0xff6563);
|
||||
}
|
||||
else if (eType == weld::EntryMessageType::Warning)
|
||||
{
|
||||
// tdf#114603: enable setting the background to a different color;
|
||||
// relevant for GTK; see also #i75179#
|
||||
m_xEntry->SetForceControlBackground(true);
|
||||
m_xEntry->SetControlForeground();
|
||||
m_xEntry->SetControlBackground(COL_YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_xEntry->SetForceControlBackground(false);
|
||||
m_xEntry->SetControlForeground();
|
||||
m_xEntry->SetControlBackground();
|
||||
}
|
||||
}
|
||||
void SalInstanceEntry::copy_clipboard()
|
||||
{
|
||||
m_xEntry->Copy();
|
||||
}
|
||||
|
||||
virtual void set_font(const vcl::Font& rFont) override
|
||||
{
|
||||
m_xEntry->SetPointFont(*m_xEntry, rFont);
|
||||
m_xEntry->Invalidate();
|
||||
}
|
||||
|
||||
virtual void connect_cursor_position(const Link<Entry&, void>& rLink) override
|
||||
{
|
||||
assert(!m_aCursorPositionHdl.IsSet());
|
||||
m_xEntry->AddEventListener(LINK(this, SalInstanceEntry, CursorListener));
|
||||
weld::Entry::connect_cursor_position(rLink);
|
||||
}
|
||||
|
||||
virtual void set_placeholder_text(const OUString& rText) override
|
||||
{
|
||||
m_xEntry->SetPlaceholderText(rText);
|
||||
}
|
||||
|
||||
Edit& getEntry() { return *m_xEntry; }
|
||||
|
||||
void fire_signal_changed() { signal_changed(); }
|
||||
|
||||
virtual void cut_clipboard() override { m_xEntry->Cut(); }
|
||||
|
||||
virtual void copy_clipboard() override { m_xEntry->Copy(); }
|
||||
|
||||
virtual void paste_clipboard() override { m_xEntry->Paste(); }
|
||||
|
||||
virtual ~SalInstanceEntry() override
|
||||
{
|
||||
if (m_aCursorPositionHdl.IsSet())
|
||||
m_xEntry->RemoveEventListener(LINK(this, SalInstanceEntry, CursorListener));
|
||||
m_xEntry->SetTextFilter(nullptr);
|
||||
m_xEntry->SetActivateHdl(Link<Edit&, bool>());
|
||||
m_xEntry->SetModifyHdl(Link<Edit&, void>());
|
||||
}
|
||||
};
|
||||
void SalInstanceEntry::paste_clipboard()
|
||||
{
|
||||
m_xEntry->Paste();
|
||||
}
|
||||
|
||||
SalInstanceEntry::~SalInstanceEntry()
|
||||
{
|
||||
if (m_aCursorPositionHdl.IsSet())
|
||||
m_xEntry->RemoveEventListener(LINK(this, SalInstanceEntry, CursorListener));
|
||||
m_xEntry->SetTextFilter(nullptr);
|
||||
m_xEntry->SetActivateHdl(Link<Edit&, bool>());
|
||||
m_xEntry->SetModifyHdl(Link<Edit&, void>());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SalInstanceEntry, ChangeHdl, Edit&, void) { signal_changed(); }
|
||||
@@ -4912,96 +4924,106 @@ IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool)
|
||||
return !signal_item_activated();
|
||||
}
|
||||
|
||||
namespace
|
||||
double SalInstanceSpinButton::toField(int nValue) const
|
||||
{
|
||||
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
|
||||
return static_cast<double>(nValue) / Power10(get_digits());
|
||||
}
|
||||
|
||||
int SalInstanceSpinButton::fromField(double fValue) const
|
||||
{
|
||||
private:
|
||||
VclPtr<FormattedField> m_xButton;
|
||||
return FRound(fValue * Power10(get_digits()));
|
||||
}
|
||||
|
||||
DECL_LINK(UpDownHdl, SpinField&, void);
|
||||
DECL_LINK(LoseFocusHdl, Control&, void);
|
||||
DECL_LINK(OutputHdl, Edit&, bool);
|
||||
DECL_LINK(InputHdl, sal_Int64*, TriState);
|
||||
DECL_LINK(ActivateHdl, Edit&, bool);
|
||||
SalInstanceSpinButton::SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership)
|
||||
: SalInstanceEntry(pButton, pBuilder, bTakeOwnership)
|
||||
, m_xButton(pButton)
|
||||
{
|
||||
m_xButton->SetThousandsSep(false); //off by default, MetricSpinButton enables it
|
||||
m_xButton->SetUpHdl(LINK(this, SalInstanceSpinButton, UpDownHdl));
|
||||
m_xButton->SetDownHdl(LINK(this, SalInstanceSpinButton, UpDownHdl));
|
||||
m_xButton->SetLoseFocusHdl(LINK(this, SalInstanceSpinButton, LoseFocusHdl));
|
||||
m_xButton->SetOutputHdl(LINK(this, SalInstanceSpinButton, OutputHdl));
|
||||
m_xButton->SetInputHdl(LINK(this, SalInstanceSpinButton, InputHdl));
|
||||
if (Edit* pEdit = m_xButton->GetSubEdit())
|
||||
pEdit->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl));
|
||||
else
|
||||
m_xButton->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl));
|
||||
}
|
||||
|
||||
double toField(int nValue) const { return static_cast<double>(nValue) / Power10(get_digits()); }
|
||||
|
||||
int fromField(double fValue) const { return FRound(fValue * Power10(get_digits())); }
|
||||
|
||||
public:
|
||||
SalInstanceSpinButton(FormattedField* pButton, SalInstanceBuilder* pBuilder,
|
||||
bool bTakeOwnership)
|
||||
: SalInstanceEntry(pButton, pBuilder, bTakeOwnership)
|
||||
, m_xButton(pButton)
|
||||
{
|
||||
m_xButton->SetThousandsSep(false); //off by default, MetricSpinButton enables it
|
||||
m_xButton->SetUpHdl(LINK(this, SalInstanceSpinButton, UpDownHdl));
|
||||
m_xButton->SetDownHdl(LINK(this, SalInstanceSpinButton, UpDownHdl));
|
||||
m_xButton->SetLoseFocusHdl(LINK(this, SalInstanceSpinButton, LoseFocusHdl));
|
||||
m_xButton->SetOutputHdl(LINK(this, SalInstanceSpinButton, OutputHdl));
|
||||
m_xButton->SetInputHdl(LINK(this, SalInstanceSpinButton, InputHdl));
|
||||
if (Edit* pEdit = m_xButton->GetSubEdit())
|
||||
pEdit->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl));
|
||||
else
|
||||
m_xButton->SetActivateHdl(LINK(this, SalInstanceSpinButton, ActivateHdl));
|
||||
int SalInstanceSpinButton::get_value() const
|
||||
{
|
||||
return fromField(m_xButton->GetValue());
|
||||
}
|
||||
|
||||
virtual int get_value() const override { return fromField(m_xButton->GetValue()); }
|
||||
|
||||
virtual void set_value(int value) override { m_xButton->SetValue(toField(value)); }
|
||||
|
||||
virtual void set_range(int min, int max) override
|
||||
{
|
||||
m_xButton->SetMinValue(toField(min));
|
||||
m_xButton->SetMaxValue(toField(max));
|
||||
void SalInstanceSpinButton::set_value(int value)
|
||||
{
|
||||
m_xButton->SetValue(toField(value));
|
||||
}
|
||||
|
||||
virtual void get_range(int& min, int& max) const override
|
||||
{
|
||||
min = fromField(m_xButton->GetMinValue());
|
||||
max = fromField(m_xButton->GetMaxValue());
|
||||
}
|
||||
void SalInstanceSpinButton::set_range(int min, int max)
|
||||
{
|
||||
m_xButton->SetMinValue(toField(min));
|
||||
m_xButton->SetMaxValue(toField(max));
|
||||
}
|
||||
|
||||
virtual void set_increments(int step, int /*page*/) override
|
||||
{
|
||||
m_xButton->SetSpinSize(toField(step));
|
||||
}
|
||||
void SalInstanceSpinButton::get_range(int& min, int& max) const
|
||||
{
|
||||
min = fromField(m_xButton->GetMinValue());
|
||||
max = fromField(m_xButton->GetMaxValue());
|
||||
}
|
||||
|
||||
virtual void get_increments(int& step, int& page) const override
|
||||
{
|
||||
step = fromField(m_xButton->GetSpinSize());
|
||||
page = fromField(m_xButton->GetSpinSize());
|
||||
}
|
||||
void SalInstanceSpinButton::set_increments(int step, int /*page*/)
|
||||
{
|
||||
m_xButton->SetSpinSize(toField(step));
|
||||
}
|
||||
|
||||
virtual void set_digits(unsigned int digits) override { m_xButton->SetDecimalDigits(digits); }
|
||||
void SalInstanceSpinButton::get_increments(int& step, int& page) const
|
||||
{
|
||||
step = fromField(m_xButton->GetSpinSize());
|
||||
page = fromField(m_xButton->GetSpinSize());
|
||||
}
|
||||
|
||||
// SpinButton may be comprised of multiple subwidgets, consider the lot as
|
||||
// one thing for focus
|
||||
virtual bool has_focus() const override { return m_xWidget->HasChildPathFocus(); }
|
||||
void SalInstanceSpinButton::set_digits(unsigned int digits)
|
||||
{
|
||||
m_xButton->SetDecimalDigits(digits);
|
||||
}
|
||||
|
||||
//so with hh::mm::ss, incrementing mm will not reset ss
|
||||
void DisableRemainderFactor() { m_xButton->DisableRemainderFactor(); }
|
||||
// SpinButton may be comprised of multiple subwidgets, consider the lot as
|
||||
// one thing for focus
|
||||
bool SalInstanceSpinButton::has_focus() const
|
||||
{
|
||||
return m_xWidget->HasChildPathFocus();
|
||||
}
|
||||
|
||||
//off by default for direct SpinButtons, MetricSpinButton enables it
|
||||
void SetUseThousandSep() { m_xButton->SetThousandsSep(true); }
|
||||
//so with hh::mm::ss, incrementing mm will not reset ss
|
||||
void SalInstanceSpinButton::DisableRemainderFactor()
|
||||
{
|
||||
m_xButton->DisableRemainderFactor();
|
||||
}
|
||||
|
||||
virtual unsigned int get_digits() const override { return m_xButton->GetDecimalDigits(); }
|
||||
//off by default for direct SpinButtons, MetricSpinButton enables it
|
||||
void SalInstanceSpinButton::SetUseThousandSep()
|
||||
{
|
||||
m_xButton->SetThousandsSep(true);
|
||||
}
|
||||
|
||||
virtual ~SalInstanceSpinButton() override
|
||||
{
|
||||
if (Edit* pEdit = m_xButton->GetSubEdit())
|
||||
pEdit->SetActivateHdl(Link<Edit&, bool>());
|
||||
else
|
||||
m_xButton->SetActivateHdl(Link<Edit&, bool>());
|
||||
m_xButton->SetInputHdl(Link<sal_Int64*, TriState>());
|
||||
m_xButton->SetOutputHdl(Link<Edit&, bool>());
|
||||
m_xButton->SetLoseFocusHdl(Link<Control&, void>());
|
||||
m_xButton->SetDownHdl(Link<SpinField&, void>());
|
||||
m_xButton->SetUpHdl(Link<SpinField&, void>());
|
||||
}
|
||||
};
|
||||
unsigned int SalInstanceSpinButton::get_digits() const
|
||||
{
|
||||
return m_xButton->GetDecimalDigits();
|
||||
}
|
||||
|
||||
SalInstanceSpinButton::~SalInstanceSpinButton()
|
||||
{
|
||||
if (Edit* pEdit = m_xButton->GetSubEdit())
|
||||
pEdit->SetActivateHdl(Link<Edit&, bool>());
|
||||
else
|
||||
m_xButton->SetActivateHdl(Link<Edit&, bool>());
|
||||
m_xButton->SetInputHdl(Link<sal_Int64*, TriState>());
|
||||
m_xButton->SetOutputHdl(Link<Edit&, bool>());
|
||||
m_xButton->SetLoseFocusHdl(Link<Control&, void>());
|
||||
m_xButton->SetDownHdl(Link<SpinField&, void>());
|
||||
m_xButton->SetUpHdl(Link<SpinField&, void>());
|
||||
}
|
||||
|
||||
IMPL_LINK_NOARG(SalInstanceSpinButton, ActivateHdl, Edit&, bool)
|
||||
|
Reference in New Issue
Block a user