cui/source/dialogs/SpellDialog.cxx | 11 ++++++++++- cui/source/inc/SpellDialog.hxx | 1 + cui/uiconfig/ui/spellingdialog.ui | 3 +++ 3 files changed, 14 insertions(+), 1 deletion(-)
New commits: commit 793d56f34df8adf0acb188375b670ef5cdc040d4 Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 4 13:54:11 2026 +0000 Commit: Miklos Vajna <[email protected]> CommitDate: Thu Feb 5 08:27:56 2026 +0100 Resolves: tdf#170524 Lock in the start size request including scrollbar width Turn vertical scrollbar on by default, at dialog start measure width including the vertical scrollbar that might be needed later in the lifetime of the dialog even if it doesn't need it at startup time and lock that width in as the widget size request. That way it the scrollbar is needed later there is space for it without obscuring the text area. Change-Id: If4ad912d3d6eb6650ae1c891ffd7fdbbf12c0c39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/198690 Reviewed-by: Miklos Vajna <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Jenkins CollaboraOffice <[email protected]> diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 6e14d14575b9..1abdf4a1b1e0 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -208,7 +208,7 @@ SpellDialog::SpellDialog(SpellDialogChildWindow* pChildWindow, Size aEdSize(m_xSuggestionLB->get_approximate_digit_width() * 60, m_xSuggestionLB->get_height_rows(6)); - m_xSuggestionLB->set_size_request(aEdSize.Width(), -1); + m_xSuggestionLB->set_size_request(aEdSize.Width(), aEdSize.Height()); m_sIgnoreOnceST = m_xIgnorePB->get_label(); m_xAddToDictMB->set_help_id(m_xAddToDictPB->get_help_id()); xSpell = LinguMgr::GetSpellChecker(); @@ -1144,6 +1144,11 @@ void SentenceEditWindow_Impl::SetDrawingArea(weld::DrawingArea* pDrawingArea) SetDocumentColor(pDrawingArea); } +void SentenceEditWindow_Impl::SetSizeRequest() +{ + m_xScrolledWindow->set_size_request(m_xScrolledWindow->get_preferred_size().Width(), -1); +} + void SentenceEditWindow_Impl::SetDocumentColor(weld::DrawingArea* pDrawingArea) { if (!pDrawingArea || !m_xEditView || !m_xEditEngine) @@ -1607,6 +1612,10 @@ void SentenceEditWindow_Impl::Init(weld::Toolbar* pToolbar) { m_pToolbar = pToolbar; m_pToolbar->connect_clicked(LINK(this,SentenceEditWindow_Impl,ToolbarHdl)); + // tdf#170524 Lock in the starting size request including space required + // for a vertical scrollbar that might be needed later in the lifetime of + // the dialog even if it doesn't need it at startup time. + SetSizeRequest(); } IMPL_LINK(SentenceEditWindow_Impl, ToolbarHdl, const OUString&, rCurItemId, void) diff --git a/cui/source/inc/SpellDialog.hxx b/cui/source/inc/SpellDialog.hxx index 13212ac8cac2..1ce2487e9d1c 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -68,6 +68,7 @@ private: void DoScroll(); void SetScrollBarRange(); + void SetSizeRequest(); protected: virtual bool KeyInput( const KeyEvent& rKEvt ) override; diff --git a/cui/uiconfig/ui/spellingdialog.ui b/cui/uiconfig/ui/spellingdialog.ui index 80103891ba71..b796f9c6ed1d 100644 --- a/cui/uiconfig/ui/spellingdialog.ui +++ b/cui/uiconfig/ui/spellingdialog.ui @@ -157,8 +157,10 @@ <object class="GtkScrolledWindow" id="scrolledwindow"> <property name="visible">True</property> <property name="can-focus">True</property> + <property name="hexpand">True</property> <property name="border-width">0</property> <property name="hscrollbar-policy">never</property> + <property name="vscrollbar-policy">always</property> <property name="shadow-type">in</property> <child> <object class="GtkViewport"> @@ -169,6 +171,7 @@ <property name="visible">True</property> <property name="can-focus">True</property> <property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK</property> + <property name="hexpand">True</property> <child internal-child="accessible"> <object class="AtkObject" id="errorsentence-atkobject"> <property name="AtkObject::accessible-description" translatable="yes" context="spellingdialog|extended_tip|sentence">Displays the sentence with the misspelled word highlighted. Edit the word or the sentence, or click one of the suggestions in the text box below.</property>
