[Libreoffice-commits] core.git: include/vcl vcl/source vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Mon Jul 6 18:30:24 UTC 2020
include/vcl/weld.hxx | 2 +
vcl/source/app/salvtables.cxx | 43 +++++++++++++++++++++++++++---------------
vcl/unx/gtk3/gtk3gtkinst.cxx | 18 +++++++++++++++++
3 files changed, 48 insertions(+), 15 deletions(-)
New commits:
commit 15682c2338e2fee0b3965c20bba0c0869975eaca
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jul 6 12:22:36 2020 +0100
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jul 6 20:29:33 2020 +0200
add alignment to TextView
Change-Id: I10a4c97ccaa927c14d62f4f22b50a0b5cdfd757e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98208
Tested-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 73b1abc48efb..d73b24936734 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -2037,6 +2037,8 @@ public:
virtual void copy_clipboard() = 0;
virtual void paste_clipboard() = 0;
+ virtual void set_alignment(TxtAlign eXAlign) = 0;
+
virtual int vadjustment_get_value() const = 0;
virtual int vadjustment_get_upper() const = 0;
virtual int vadjustment_get_lower() const = 0;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 1ba191364a6a..d7d7d315f731 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -3165,24 +3165,32 @@ void SalInstanceEntry::paste_clipboard()
m_xEntry->Paste();
}
-void SalInstanceEntry::set_alignment(TxtAlign eXAlign)
+namespace
{
- WinBits nAlign(0);
- switch (eXAlign)
+ void set_alignment(Edit& rEntry, TxtAlign eXAlign)
{
- case TxtAlign::Left:
- nAlign = WB_LEFT;
- break;
- case TxtAlign::Center:
- nAlign = WB_CENTER;
- break;
- case TxtAlign::Right:
- nAlign = WB_RIGHT;
- break;
+ WinBits nAlign(0);
+ switch (eXAlign)
+ {
+ case TxtAlign::Left:
+ nAlign = WB_LEFT;
+ break;
+ case TxtAlign::Center:
+ nAlign = WB_CENTER;
+ break;
+ case TxtAlign::Right:
+ nAlign = WB_RIGHT;
+ break;
+ }
+ WinBits nBits = rEntry.GetStyle();
+ nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
+ rEntry.SetStyle(nBits | nAlign);
}
- WinBits nBits = m_xEntry->GetStyle();
- nBits &= ~(WB_LEFT | WB_CENTER | WB_RIGHT);
- m_xEntry->SetStyle(nBits | nAlign);
+}
+
+void SalInstanceEntry::set_alignment(TxtAlign eXAlign)
+{
+ ::set_alignment(*m_xEntry, eXAlign);
}
SalInstanceEntry::~SalInstanceEntry()
@@ -5502,6 +5510,11 @@ public:
m_xTextView->Paste();
}
+ virtual void set_alignment(TxtAlign eXAlign) override
+ {
+ ::set_alignment(*m_xTextView, eXAlign);
+ }
+
virtual int vadjustment_get_value() const override
{
ScrollBar& rVertScrollBar = m_xTextView->GetVScrollBar();
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index bd7d718c1945..bf81847a3a80 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -12557,6 +12557,24 @@ public:
gtk_text_buffer_paste_clipboard(m_pTextBuffer, pClipboard, nullptr, get_editable());
}
+ virtual void set_alignment(TxtAlign eXAlign) override
+ {
+ GtkJustification eJust;
+ switch (eXAlign)
+ {
+ case TxtAlign::Left:
+ eJust = GTK_JUSTIFY_LEFT;
+ break;
+ case TxtAlign::Center:
+ eJust = GTK_JUSTIFY_CENTER;
+ break;
+ case TxtAlign::Right:
+ eJust = GTK_JUSTIFY_RIGHT;
+ break;
+ }
+ gtk_text_view_set_justification(m_pTextView, eJust);
+ }
+
virtual int vadjustment_get_value() const override
{
return gtk_adjustment_get_value(m_pVAdjustment);
More information about the Libreoffice-commits
mailing list