diff --git a/svx/source/tbxctrls/StylesPreviewWindow.cxx b/svx/source/tbxctrls/StylesPreviewWindow.cxx index 90f6bbebfa5f..64246e3ba65f 100644 --- a/svx/source/tbxctrls/StylesPreviewWindow.cxx +++ b/svx/source/tbxctrls/StylesPreviewWindow.cxx @@ -451,7 +451,7 @@ StylesPreviewWindow_Base::StylesPreviewWindow_Base( IMPL_LINK(StylesPreviewWindow_Base, Selected, weld::ItemView&, rIconView, void) { - OUString sStyleName = rIconView.get_selected_text(); + OUString sStyleName = rIconView.get_selected_id(); css::uno::Sequence aArgs{ comphelper::makePropertyValue(u"Template"_ustr, sStyleName), @@ -654,11 +654,15 @@ void StylesPreviewWindow_Base::UpdateStylesList() // for online we can skip inserting the preview into the IconView and rely // on DoJsonProperty to provide the image to clients const bool bNeedInsertPreview = !comphelper::LibreOfficeKit::isActive(); + int nIndex = 0; for (const auto& rStyle : m_aAllStyles) { Bitmap aPreview = GetCachedPreview(rStyle); Bitmap* pPreview = bNeedInsertPreview ? &aPreview : nullptr; - m_xStylesView->append(rStyle.commonName, rStyle.translatedName, pPreview); + m_xStylesView->insert(nIndex, nullptr, &rStyle.translatedName, pPreview, nullptr); + m_xStylesView->set_item_tooltip_text(nIndex, rStyle.translatedName); + m_xStylesView->set_item_accessible_name(nIndex, rStyle.translatedName); + nIndex++; } m_xStylesView->thaw(); } diff --git a/svx/uiconfig/ui/stylespreview.ui b/svx/uiconfig/ui/stylespreview.ui index 001e5bb967ec..894d2493d5a1 100644 --- a/svx/uiconfig/ui/stylespreview.ui +++ b/svx/uiconfig/ui/stylespreview.ui @@ -1,6 +1,8 @@ - - + + + + @@ -13,36 +15,37 @@ - True - False + False True 6 + True - True - False + False 3 + True - 360 - 65 - True - True + True + 65 + never + 70 + in center - never - always - in - 70 + True + always + 360 - True - True + True + 0 + 0 + 70 0 liststore1 - 3 - 70 0 - 1 + 1 + True diff --git a/sw/qa/uitest/writer_tests4/tdf167956.py b/sw/qa/uitest/writer_tests4/tdf167956.py index ddf182ddc183..9d0159577059 100644 --- a/sw/qa/uitest/writer_tests4/tdf167956.py +++ b/sw/qa/uitest/writer_tests4/tdf167956.py @@ -28,7 +28,7 @@ class tdf167956(UITestCase): xStylesView = xWriterDoc.getChild("stylesview") self.wait_until_styles_are_displayed(xStylesView) self.assertLessEqual("10", get_state_as_dict(xStylesView)["Children"]) - self.assertEqual("Default Paragraph Style", get_state_as_dict(xStylesView)["SelectEntryText"]) + self.assertEqual("Default Paragraph Style", get_state_as_dict(xStylesView)["SelectedItemId"]) with self.ui_test.load_file(get_url_for_data_file("tdf167956.docx")): xWriterDoc = self.xUITest.getTopFocusWindow() @@ -37,7 +37,7 @@ class tdf167956(UITestCase): # Without the fix in place, this test would have crashed here self.wait_until_styles_are_displayed(xStylesView) self.assertLessEqual("10", get_state_as_dict(xStylesView)["Children"]) - self.assertEqual("Intense Quote", get_state_as_dict(xStylesView)["SelectEntryText"]) + self.assertEqual("Intense Quote", get_state_as_dict(xStylesView)["SelectedItemId"]) # Reset to the default toolbar self.xUITest.executeCommand(".uno:ToolbarMode?Mode:string=Default")