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 f9fe831af976fe1883c743f4672514eb804fdcef Author: Caolán McNamara <[email protected]> AuthorDate: Wed Feb 4 13:54:11 2026 +0000 Commit: Adolfo Jayme Barrientos <[email protected]> CommitDate: Wed Feb 4 20:34:12 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/+/198687 Reviewed-by: Adolfo Jayme Barrientos <[email protected]> Tested-by: Jenkins diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index e446e9164694..f711235eb4ee 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -254,7 +254,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(); @@ -1217,6 +1217,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) @@ -1689,6 +1694,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 c7f8c0ce722a..67c96a06e008 100644 --- a/cui/source/inc/SpellDialog.hxx +++ b/cui/source/inc/SpellDialog.hxx @@ -70,6 +70,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 c18353fc1557..e4b2d822c253 100644 --- a/cui/uiconfig/ui/spellingdialog.ui +++ b/cui/uiconfig/ui/spellingdialog.ui @@ -278,8 +278,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"> @@ -290,6 +292,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>
