summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-04-14 21:15:28 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-04-16 14:50:22 +0200
commit77a59cabf33d5d6ccc80ea62ee07162abc1b4e52 (patch)
tree57124d72a996510b4f6ab3f39a3732a9d4dfeff6 /vcl
parenta9a94b744e9d61a3ff56c0b1830a56145607758f (diff)
weld SvxPostItDialog
Change-Id: I0aa88270aa604180223f2b35829b45e5828f792a Reviewed-on: https://gerrit.libreoffice.org/52896 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/app/salvtables.cxx26
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx22
2 files changed, 39 insertions, 9 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 56da3de4c49b..d06590dace91 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -528,6 +528,21 @@ public:
m_xWindow->SetPosPixel(Point(x, y));
}
+ SystemWindow* getWindow()
+ {
+ return m_xWindow.get();
+ }
+
+ virtual bool get_extents_relative_to(Window& rRelative, int& x, int &y, int& width, int &height) override
+ {
+ tools::Rectangle aRect(m_xWindow->GetWindowExtentsRelative(dynamic_cast<SalInstanceWindow&>(rRelative).getWindow()));
+ x = aRect.Left();
+ y = aRect.Top();
+ width = aRect.GetWidth();
+ height = aRect.GetHeight();
+ return true;
+ }
+
virtual ~SalInstanceWindow() override
{
clear_child_help(m_xWindow);
@@ -1373,14 +1388,17 @@ public:
return m_xTextView->GetText();
}
- virtual Selection get_selection() const override
+ bool get_selection_bounds(int& rStartPos, int &rEndPos) override
{
- return m_xTextView->GetSelection();
+ const Selection& rSelection = m_xTextView->GetSelection();
+ rStartPos = rSelection.Min();
+ rEndPos = rSelection.Max();
+ return rSelection.Len();
}
- virtual void set_selection(const Selection& rSelection) override
+ virtual void select_region(int nStartPos, int nEndPos) override
{
- m_xTextView->SetSelection(rSelection);
+ m_xTextView->SetSelection(Selection(nStartPos, nEndPos < 0 ? SELECTION_MAX : nEndPos));
}
virtual void set_editable(bool bEditable) override
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 9425d93fa63e..3eded538f3cb 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -1700,6 +1700,16 @@ public:
gtk_window_move(m_pWindow, x, y);
}
+ virtual bool get_extents_relative_to(Window& rRelative, int& x, int &y, int& width, int &height) override
+ {
+ //this is sadly futile under wayland, so we can't tell where a dialog is in order to allow
+ //the document underneath to auto-scroll to place content in a visible location
+ gboolean ret = gtk_widget_translate_coordinates(dynamic_cast<GtkInstanceWindow&>(rRelative).getWidget(), m_pWidget, 0, 0, &x, &y);
+ width = gtk_widget_get_allocated_width(m_pWidget);
+ height = gtk_widget_get_allocated_height(m_pWidget);
+ return ret;
+ }
+
virtual ~GtkInstanceWindow() override
{
if (m_xWindow.is())
@@ -3176,20 +3186,22 @@ public:
return sRet;
}
- virtual Selection get_selection() const override
+ virtual bool get_selection_bounds(int& rStartPos, int& rEndPos) override
{
GtkTextBuffer* pBuffer = gtk_text_view_get_buffer(m_pTextView);
GtkTextIter start, end;
gtk_text_buffer_get_selection_bounds(pBuffer, &start, &end);
- return Selection(gtk_text_iter_get_offset(&start), gtk_text_iter_get_offset(&end));
+ rStartPos = gtk_text_iter_get_offset(&start);
+ rEndPos = gtk_text_iter_get_offset(&end);
+ return rStartPos != rEndPos;
}
- virtual void set_selection(const Selection& rSelection) override
+ virtual void select_region(int nStartPos, int nEndPos) override
{
GtkTextBuffer* pBuffer = gtk_text_view_get_buffer(m_pTextView);
GtkTextIter start, end;
- gtk_text_buffer_get_iter_at_offset(pBuffer, &start, rSelection.Min());
- gtk_text_buffer_get_iter_at_offset(pBuffer, &end, rSelection.Max());
+ gtk_text_buffer_get_iter_at_offset(pBuffer, &start, nStartPos);
+ gtk_text_buffer_get_iter_at_offset(pBuffer, &end, nEndPos);
gtk_text_buffer_select_range(pBuffer, &start, &end);
GtkTextMark* mark = gtk_text_buffer_create_mark(pBuffer, "scroll", &end, true);
gtk_text_view_scroll_mark_onscreen(m_pTextView, mark);