basctl/source/basicide/macrodlg.cxx | 35 ++- comphelper/source/misc/configuration.cxx | 105 ++-------- dev/null |binary hwpfilter/source/hbox.cxx | 15 - include/comphelper/configuration.hxx | 22 -- lingucomponent/source/spellcheck/macosxspell/macspellimp.mm | 14 + offapi/com/sun/star/text/IllustrationsIndex.idl | 6 offapi/com/sun/star/text/ObjectIndex.idl | 6 offapi/com/sun/star/text/TableIndex.idl | 6 sc/source/ui/app/inputwin.cxx | 27 +- sc/source/ui/inc/inputwin.hxx | 2 sd/uiconfig/simpress/ui/pmsummarypage.ui | 1 svx/uiconfig/ui/dockingcolorreplace.ui | 11 - sw/inc/unomap.hxx | 1 sw/inc/unoprnms.hxx | 1 sw/qa/extras/odfexport/odfexport.cxx | 4 sw/qa/extras/ooxmlexport/data/chart.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 8 sw/qa/extras/ooxmlexport/ooxmlexport18.cxx | 13 + sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx | 13 + sw/qa/extras/ww8export/ww8export4.cxx | 11 - sw/source/core/edit/autofmt.cxx | 5 sw/source/core/unocore/unoidx.cxx | 41 ++++ sw/source/core/unocore/unomap.cxx | 3 sw/source/core/unocore/unosrch.cxx | 10 sw/source/filter/html/parcss1.cxx | 33 ++- sw/source/filter/ww8/docxattributeoutput.cxx | 54 +++-- sw/source/filter/ww8/ww8atr.cxx | 10 sw/source/filter/ww8/ww8par.cxx | 1 vcl/skia/skia_denylist_vulkan.xml | 3 vcl/source/control/button.cxx | 2 vcl/source/font/fontmetric.cxx | 2 vcl/source/window/decoview.cxx | 18 - writerfilter/source/dmapper/DomainMapper_Impl.cxx | 79 +++++++ writerfilter/source/dmapper/DomainMapper_Impl.hxx | 2 writerfilter/source/dmapper/GraphicImport.cxx | 1 writerfilter/source/dmapper/StyleSheetTable.cxx | 121 +++++++++--- writerfilter/source/dmapper/StyleSheetTable.hxx | 5 38 files changed, 469 insertions(+), 222 deletions(-)
New commits: commit adb2f691d4352df13751963171fcbd5750440b88 Author: Justin Luth <jl...@mail.com> AuthorDate: Wed Feb 8 11:55:42 2023 -0500 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:24 2023 +0100 Revert "tdf#148360 doc import: add NO_NUMBERING_SHOW_FOLLOWBY(true)" This reverts commit 2405a36f3bcd43f80371ccaed47f7523ff0d8757 which was backported to 7.4.1. This solves the regression report for DOC in tdf#153042. The problem is that the tab-without-numbering is displaying in cases where it shouldn't (i.e. when the tabstop position matches the first line indent). Although the patch itself is fine (DOC should do the same thing as DOCX) the feature is incomplete, even for DOCX/RTF. So just remove DOC from this mix - especially since there seem to be a LOT more instances of DOC files that need the incomplete aspect. Once it is proven to work OK for DOCX, we can add DOC back in. Change-Id: I3c550fc2ca29cf1490ec0a5e3979a6acbd102385 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146670 Tested-by: Justin Luth <jl...@mail.com> Reviewed-by: Justin Luth <jl...@mail.com> (cherry picked from commit 7b3e0639962bab6e757381ad2b3e4868c61ed3b7) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146625 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/ww8export/data/tdf148360.doc b/sw/qa/extras/ww8export/data/tdf148360.doc deleted file mode 100644 index 3969a560999f..000000000000 Binary files a/sw/qa/extras/ww8export/data/tdf148360.doc and /dev/null differ diff --git a/sw/qa/extras/ww8export/ww8export4.cxx b/sw/qa/extras/ww8export/ww8export4.cxx index 1910178d0ac8..5ee7253ffd5e 100644 --- a/sw/qa/extras/ww8export/ww8export4.cxx +++ b/sw/qa/extras/ww8export/ww8export4.cxx @@ -33,17 +33,6 @@ public: } }; -CPPUNIT_TEST_FIXTURE(Test, testTdf148360) -{ - loadAndReload("tdf148360.doc"); - const auto& pLayout = parseLayoutDump(); - - // Ensure first element is a tab - assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[1]", "type", "PortionType::TabLeft"); - // and only then goes content - assertXPath(pLayout, "/root/page[1]/body/txt[1]/SwParaPortion/SwLineLayout/child::*[2]", "type", "PortionType::Text"); -} - CPPUNIT_TEST_FIXTURE(Test, testTdf77964) { loadAndReload("tdf77964.doc"); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index 448057636fab..48ad05bc1681 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -1890,7 +1890,6 @@ void SwWW8ImplReader::ImportDop() m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::SURROUND_TEXT_WRAP_SMALL, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::PROP_LINE_SPACING_SHRINKS_FIRST_LINE, true); m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::CONTINUOUS_ENDNOTES, true); - m_rDoc.getIDocumentSettingAccess().set(DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY, true); // rely on default for HYPHENATE_URLS=false // COMPATIBILITY FLAGS END commit c5a433b24f902c5f8636a9acf2e6b88bccb612e0 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Feb 8 16:37:33 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:24 2023 +0100 Related: tdf#152486 infobar is white text on light button in light mode background isn't "bright" or "dark" enough to be considered one or the other. This is only used for the infobars, so black text is good enough for the current bg colors in use. Change-Id: I4c2c4fadac72cc35aebeadec417186c6358c0a77 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146624 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index 46d7b5123d82..98dc12397361 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -908,8 +908,6 @@ void PushButton::ImplDrawPushButtonContent(OutputDevice *pDev, SystemTextColorFl { if (aColor.IsBright() && !pParent->GetControlBackground().IsDark()) aColor = COL_BLACK; - else if (aColor.IsDark() && !pParent->GetControlBackground().IsBright()) - aColor = COL_WHITE; } } #endif commit 35ff30be9f1a6d0ec88ef27689498cf2e0c7c249 Author: Justin Luth <jl...@mail.com> AuthorDate: Wed Feb 8 13:48:04 2023 -0500 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:24 2023 +0100 tdf#153423 tdf#150197: use getToken in proper order This fixes a LO 7.5 regression from my commit 727c5ed30f68abc28bb04531b25a1df30810760f getToken steps along the string and consumes it, so these needed to remain in the same order as they had been originally. Dumb thing to overlook. Change-Id: I483980eafb7deb0c224063ad41616bb21ddb2191 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146672 Tested-by: Jenkins Reviewed-by: Justin Luth <jl...@mail.com> (cherry picked from commit 6bc6da1d03327450571b6811e192787ad90ecea2) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146628 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/source/core/edit/autofmt.cxx b/sw/source/core/edit/autofmt.cxx index 4be8c9711188..a4c6e02dbc30 100644 --- a/sw/source/core/edit/autofmt.cxx +++ b/sw/source/core/edit/autofmt.cxx @@ -1616,8 +1616,9 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) if( !nDigitLevel ) { SwNumFormat aFormat( aRule.Get( nLvl ) ); + const OUString sPrefix = aPrefix.getToken(0, u'\x0001', nPrefixIdx); aFormat.SetStart( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )))); - aFormat.SetListFormat(aPrefix.getToken(0, u'\x0001', nPrefixIdx), aPostfix.getToken(0, u'\x0001'), nLvl); + aFormat.SetListFormat(sPrefix, aPostfix.getToken(0, u'\x0001'), nLvl); aFormat.SetIncludeUpperLevels( 0 ); if( !aFormat.GetCharFormat() ) @@ -1639,8 +1640,8 @@ void SwAutoFormat::BuildEnum( sal_uInt16 nLvl, sal_uInt16 nDigitLevel ) { SwNumFormat aFormat( aRule.Get( n ) ); - aFormat.SetStart( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )) )); const OUString sPrefix = n ? "" : aPrefix.getToken(0, u'\x0001', nPrefixIdx); + aFormat.SetStart( o3tl::narrowing<sal_uInt16>(o3tl::toInt32(o3tl::getToken(aPrefix, 0, u'\x0001', nPrefixIdx )) )); aFormat.SetListFormat(sPrefix, aPostfix.getToken(0, u'\x0001', nPostfixIdx), n); aFormat.SetIncludeUpperLevels( MAXLEVEL ); if( n < aNumTypes.getLength() ) commit 89941c3be3231432c6aa4c16b59dc70699692df8 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Feb 7 14:17:11 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:24 2023 +0100 tdf#153083 writerfilter,sw: DOCX locale-dependent TOC \t style names, 3 The import crashed on fdo85740-1.docx with an unhandled exception. This is because it mapped the TOC style "Table of Figures" from "table of figures", but the ApplyStyleSheetsImpl() actually uses the converted name "Drawing" instead, so "Table of Figures" didn't exist. (regression from commit ca71482237d31703454062b8b2f544a8bacd2831) It turns out that once that is fixed, the DOCX export needs to convert "Drawing" back to "Table of Figures" in the TOC field. -- but apparently not on the libreoffice-7-5 branch, as here the style names are written unconverted; that is only needed since commit 319e2e0cbc6a1d25abd01fb27d6250cee825c072 so omit export changes here. Change-Id: I4858c79dd74154b229b7568610c0b8ba7b3e2b6a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146610 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 345f23474845da0defa4a9276228f54b5ded5736) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146639 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 802f0c9903cc..32b937cbf137 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6158,8 +6158,7 @@ OUString DomainMapper_Impl::ConvertTOCStyleName(OUString const& rTOCStyleName) { // practical case: Word wrote i18n name to TOC field, but it doesn't // exist in styles.xml; tdf#153083 clone it for best roundtrip SAL_INFO("writerfilter.dmapper", "cloning TOC paragraph style (presumed built-in) " << rTOCStyleName << " from " << pStyle->sStyleName); - GetStyleSheetTable()->CloneTOCStyle(GetFontTable(), pStyle, rTOCStyleName); - return rTOCStyleName; + return GetStyleSheetTable()->CloneTOCStyle(GetFontTable(), pStyle, rTOCStyleName); } else { diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 52c14f2bf04d..1b7874e1c5fc 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -1062,7 +1062,7 @@ void StyleSheetTable::ApplyClonedTOCStyles() m_pImpl->ApplyClonedTOCStylesToXText(xBody); } -void StyleSheetTable::CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rNewName) +OUString StyleSheetTable::CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rNewName) { StyleSheetEntryPtr const pClone(new StyleSheetEntry(*pStyle)); pClone->sStyleIdentifierD = rNewName; @@ -1071,9 +1071,10 @@ void StyleSheetTable::CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEn m_pImpl->m_aStyleSheetEntries.push_back(pClone); // add it so it will be found if referenced from another TOC m_pImpl->m_aStyleSheetEntriesMap.emplace(rNewName, pClone); - m_pImpl->m_ClonedTOCStylesMap.emplace(pStyle->sStyleName, rNewName); + m_pImpl->m_ClonedTOCStylesMap.emplace(pStyle->sStyleName, pClone->sConvertedStyleName); std::vector<StyleSheetEntryPtr> const styles{ pClone }; - return ApplyStyleSheetsImpl(rFontTable, styles); + ApplyStyleSheetsImpl(rFontTable, styles); + return pClone->sConvertedStyleName; } void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index e2f79d863e8f..0ee33b8d8056 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -99,7 +99,7 @@ public: StyleSheetEntryPtr FindDefaultParaStyle(); OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false ); - void CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rName); + OUString CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rName); void ApplyClonedTOCStyles(); OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); commit dbc9757d4a742f68e400c6a1bdaac04cbb98fbd0 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Feb 1 19:45:54 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:23 2023 +0100 tdf#130782 tdf#153203 writerfilter,sw: DOCX import/export of a11y ... related attributes name/title/description on Chart embedded objects. DomainMapper first needs to apply the properties to an SdrOLE2Obj, then later copy it to SwXEmbeddedObject. Change-Id: Id766be1eedf348caf22640ab6c177d81a0971749 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146494 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit fa1f2b7f5c65d66eaa5887acc9da5eb526570b18) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146509 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/odfexport/odfexport.cxx b/sw/qa/extras/odfexport/odfexport.cxx index f8c774b3053d..bfc75df25ad7 100644 --- a/sw/qa/extras/odfexport/odfexport.cxx +++ b/sw/qa/extras/odfexport/odfexport.cxx @@ -954,7 +954,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134987) } // checking second object (chart) { - uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier(xAccess->getByName("Object2"), uno::UNO_QUERY); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier(xAccess->getByName("Diagram 1"), uno::UNO_QUERY); uno::Reference<lang::XComponent> xObj(xEOSupplier->getEmbeddedObject()); CPPUNIT_ASSERT(xObj.is()); @@ -968,7 +968,7 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf134987) } // checking third object (chart) { - uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier(xAccess->getByName("Object3"), uno::UNO_QUERY); + uno::Reference<document::XEmbeddedObjectSupplier> xEOSupplier(xAccess->getByName("Diagram 2"), uno::UNO_QUERY); uno::Reference<lang::XComponent> xObj(xEOSupplier->getEmbeddedObject()); CPPUNIT_ASSERT(xObj.is()); diff --git a/sw/qa/extras/ooxmlexport/data/chart.docx b/sw/qa/extras/ooxmlexport/data/chart.docx new file mode 100644 index 000000000000..f984f0b17eea Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/chart.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx index e27a1f085b11..4efc1a5e8052 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport18.cxx @@ -127,6 +127,19 @@ DECLARE_OOXMLEXPORT_TEST(testTdf147724, "tdf147724.docx") CPPUNIT_ASSERT(sFieldResult == "Placeholder -> *HERUNTERLADEN*" || sFieldResult == "Placeholder -> *ABC*"); } +DECLARE_OOXMLEXPORT_TEST(testTdf130782, "chart.docx") +{ + uno::Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xAccess(xTEOSupplier->getEmbeddedObjects(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xAccess->getCount()); + uno::Reference<container::XNamed> xObj(xAccess->getByIndex(0), uno::UNO_QUERY); + + // these properties were not imported + CPPUNIT_ASSERT_EQUAL(OUString("Diagramm 1"), xObj->getName()); + CPPUNIT_ASSERT_EQUAL(OUString("uninspired default chart"), getProperty<OUString>(xObj, "Title")); + CPPUNIT_ASSERT_EQUAL(OUString("the description is here"), getProperty<OUString>(xObj, "Description")); +} + CPPUNIT_TEST_FIXTURE(Test, testNumberPortionFormatFromODT) { // Given a document with a single paragraph, direct formatting asks 24pt font size for the diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 5bc80127f6a7..e95268b272ac 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -5641,6 +5641,30 @@ uno::Reference<css::text::XTextFrame> DocxAttributeOutput::GetUnoTextFrame( return SwTextBoxHelper::getUnoTextFrame(xShape); } +static rtl::Reference<::sax_fastparser::FastAttributeList> CreateDocPrAttrList( + DocxExport & rExport, int const nAnchorId, std::u16string_view const& rName, + std::u16string_view const& rTitle, std::u16string_view const& rDescription) +{ + rtl::Reference<::sax_fastparser::FastAttributeList> const pAttrs(FastSerializerHelper::createAttrList()); + pAttrs->add(XML_id, OString::number(nAnchorId).getStr()); + pAttrs->add(XML_name, OUStringToOString(rName, RTL_TEXTENCODING_UTF8)); + if (rExport.GetFilter().getVersion() != oox::core::ECMA_DIALECT) + { + pAttrs->add(XML_descr, OUStringToOString(rDescription, RTL_TEXTENCODING_UTF8)); + pAttrs->add(XML_title, OUStringToOString(rTitle, RTL_TEXTENCODING_UTF8)); + } + else + { // tdf#148952 no title attribute, merge it into descr + OUString const value(rTitle.empty() + ? OUString(rDescription) + : rDescription.empty() + ? OUString(rTitle) + : OUString::Concat(rTitle) + OUString::Concat("\n") + OUString::Concat(rDescription)); + pAttrs->add(XML_descr, OUStringToOString(value, RTL_TEXTENCODING_UTF8)); + } + return pAttrs; +} + void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrameFormat* pOLEFrameFormat, SwOLENode* pOLENode, const SdrObject* pSdrObj ) { SAL_INFO("sw.ww8", "TODO DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size& rSize, const SwFlyFrameFormat* pOLEFrameFormat, SwOLENode* pOLENode, const SdrObject* pSdrObj ) - some stuff still missing" ); @@ -5739,25 +5763,10 @@ void DocxAttributeOutput::FlyFrameGraphic( const SwGrfNode* pGrfNode, const Size m_rExport.SdrExporter().startDMLAnchorInline(pFrameFormat, aSize); // picture description (used for pic:cNvPr later too) - rtl::Reference<::sax_fastparser::FastAttributeList> docPrattrList = FastSerializerHelper::createAttrList(); - docPrattrList->add( XML_id, OString::number( m_anchorId++).getStr()); - docPrattrList->add( XML_name, OUStringToOString( pFrameFormat->GetName(), RTL_TEXTENCODING_UTF8 ) ); OUString const descr(pGrfNode ? pGrfNode->GetDescription() : pOLEFrameFormat->GetObjDescription()); OUString const title(pGrfNode ? pGrfNode->GetTitle() : pOLEFrameFormat->GetObjTitle()); - if( GetExport().GetFilter().getVersion( ) != oox::core::ECMA_DIALECT ) - { - docPrattrList->add(XML_descr, OUStringToOString(descr, RTL_TEXTENCODING_UTF8)); - docPrattrList->add(XML_title, OUStringToOString(title, RTL_TEXTENCODING_UTF8)); - } - else - { // tdf#148952 no title attribute, merge it into descr - OUString const value(title.isEmpty() - ? descr - : descr.isEmpty() - ? title - : title + OUString::Concat("\n") + descr); - docPrattrList->add(XML_descr, OUStringToOString(value, RTL_TEXTENCODING_UTF8)); - } + auto const docPrattrList(CreateDocPrAttrList( + GetExport(), m_anchorId++, pFrameFormat->GetName(), title, descr)); m_pSerializer->startElementNS( XML_wp, XML_docPr, docPrattrList ); OUString sURL, sRelId; @@ -5960,14 +5969,19 @@ void DocxAttributeOutput::WritePostponedChart() if( xNamed.is() ) sName = xNamed->getName(); + // tdf#153203 export a11y related properties + uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY); + OUString const title(xShapeProps->getPropertyValue("Title").get<OUString>()); + OUString const descr(xShapeProps->getPropertyValue("Description").get<OUString>()); + /* If there is a scenario where a chart is followed by a shape which is being exported as an alternate content then, the docPr Id is being repeated, ECMA 20.4.2.5 says that the docPr Id should be unique, ensuring the same here. */ - m_pSerializer->singleElementNS( XML_wp, XML_docPr, - XML_id, OString::number(m_anchorId++), - XML_name, sName ); + auto const docPrattrList(CreateDocPrAttrList( + GetExport(), m_anchorId++, sName, title, descr)); + m_pSerializer->singleElementNS(XML_wp, XML_docPr, docPrattrList); m_pSerializer->singleElementNS(XML_wp, XML_cNvGraphicFramePr); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index d6e59f5cc3ea..802f0c9903cc 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -4157,9 +4157,28 @@ void DomainMapper_Impl::UpdateEmbeddedShapeProps(const uno::Reference< drawing:: awt::Size aSize = xShape->getSize( ); xEmbeddedProperties->setPropertyValue(getPropertyName(PROP_WIDTH), uno::Any(sal_Int32(aSize.Width))); xEmbeddedProperties->setPropertyValue(getPropertyName(PROP_HEIGHT), uno::Any(sal_Int32(aSize.Height))); + uno::Reference<beans::XPropertySet> const xShapeProps(xShape, uno::UNO_QUERY); + // tdf#130782 copy a11y related properties + xEmbeddedProperties->setPropertyValue(getPropertyName(PROP_DESCRIPTION), + xShapeProps->getPropertyValue(getPropertyName(PROP_DESCRIPTION))); + xEmbeddedProperties->setPropertyValue(getPropertyName(PROP_TITLE), + xShapeProps->getPropertyValue(getPropertyName(PROP_TITLE))); + uno::Reference<container::XNamed> const xEmbedName(m_xEmbedded, uno::UNO_QUERY); + uno::Reference<container::XNamed> const xShapeName(xShape, uno::UNO_QUERY); + OUString const name(xShapeName->getName()); + if (!name.isEmpty()) // setting empty name will throw + { + try + { + xEmbedName->setName(name); + } + catch (uno::RuntimeException const&) + { + // ignore - document may contain duplicates (testchartoleobjectembeddings.docx) + } + } } - void DomainMapper_Impl::PopShapeContext() { if (hasTableManager()) diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index ba1408f2093e..31efcfe068d5 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -1347,6 +1347,7 @@ void GraphicImport::lcl_attribute(Id nName, Value& rValue) uno::Reference< beans::XPropertySet > xShapeProps(m_xShape, uno::UNO_QUERY_THROW); m_pImpl->applyMargins(xShapeProps); m_pImpl->applyZOrder(xShapeProps); + m_pImpl->applyName(xShapeProps); comphelper::SequenceAsHashMap aInteropGrabBag(xShapeProps->getPropertyValue("InteropGrabBag")); aInteropGrabBag.update(m_pImpl->getInteropGrabBag()); xShapeProps->setPropertyValue("InteropGrabBag", uno::Any(aInteropGrabBag.getAsConstPropertyValueList())); commit a676ef770c9740fc067335c72f5d1e11404676ae Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jan 31 15:05:44 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:22:10 2023 +0100 tdf#153083 writerfilter: import locale-dependent TOC \t style names, 2 There was a problem with commit ecbad22fdf81c6f072b6c9f9c16dbba47fe4748c while it now worked in Writer, the roundtripped DOCX with the en-US built-in style name in the TOC field no longer worked in Word in the original locale (but started to work in en-US locale). Let's try a slightly different approach: use the same style name as-is from the TOC field, and if it doesn't exist as a style, then clone the en-US built-in style with that name, and at the end of the import, iterate all paragraphs in the document and replace any application of the en-US style with the localised style. So both the en-US style and the localised style exist, and for references that aren't fields (e.g. basedOn in other styles) it should hopefully not matter which one is referenced. The DOCX exported from Writer now has a TOC field that works in Word in the original locale. Change-Id: Ibcc3c5899e31295b5704ebefb548f40b67eda9bf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146414 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit ca71482237d31703454062b8b2f544a8bacd2831) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146420 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index bfc09d934343..fbfe633fd55e 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -725,8 +725,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153082_semicolon, "custom-styles-TOC-semicolon.d xParaStyles->getByIndex(1) >>= styles; CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{}, styles); xParaStyles->getByIndex(2) >>= styles; - // the first one is built-in Word style that was localised DE "Intensives Zitat" in the file - CPPUNIT_ASSERT_EQUAL((uno::Sequence<OUString>{"Intense Quote", "Custom1", "_MyStyle0"}), styles); + // the first one is built-in Word style "Intense Quote" that was localised DE "Intensives Zitat" in the file + CPPUNIT_ASSERT_EQUAL((uno::Sequence<OUString>{"Intensives Zitat", "Custom1", "_MyStyle0"}), styles); xTOC->update(); OUString const tocContent(xTOC->getAnchor()->getString()); CPPUNIT_ASSERT(tocContent.startsWith("Table of Contents")); @@ -749,8 +749,8 @@ DECLARE_OOXMLEXPORT_TEST(testTdf153082_comma, "custom-styles-TOC-comma.docx") xParaStyles->getByIndex(1) >>= styles; CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Custom1"}, styles); xParaStyles->getByIndex(2) >>= styles; - // the first one is built-in Word style that was localised DE "Intensives Zitat" in the file - CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Intense Quote"}, styles); + // the first one is built-in Word style "Intense Quote" that was localised DE "Intensives Zitat" in the file + CPPUNIT_ASSERT_EQUAL(uno::Sequence<OUString>{"Intensives Zitat"}, styles); xTOC->update(); OUString const tocContent(xTOC->getAnchor()->getString()); CPPUNIT_ASSERT(tocContent.startsWith("Table of Contents")); diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 5f31fb2dec14..d6e59f5cc3ea 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -89,6 +89,7 @@ #include <oox/mathml/import.hxx> #include <utility> #include <xmloff/odffields.hxx> +#include <rtl/character.hxx> #include <rtl/uri.hxx> #include <unotools/ucbstreamhelper.hxx> #include <unotools/streamwrap.hxx> @@ -449,7 +450,10 @@ DomainMapper_Impl::~DomainMapper_Impl() ChainTextFrames(); // Don't remove last paragraph when pasting, sw expects that empty paragraph. if (m_bIsNewDoc) + { RemoveLastParagraph(); + GetStyleSheetTable()->ApplyClonedTOCStyles(); + } if (hasTableManager()) { getTableManager().endLevel(); @@ -6099,6 +6103,51 @@ DomainMapper_Impl::StartIndexSectionChecked(const OUString& sServiceName) return xRet; } +/** + This is a heuristic to find Word's w:styleId value from localised style name. + It's not clear how exactly it works, but apparently Word stores into + w:styleId some filtered representation of the localised style name. + Tragically there are references to the localised style name itself in TOC + fields. + Hopefully this works and a complete map of >100 built-in style names + localised to all languages isn't needed. +*/ +static auto FilterChars(OUString const& rStyleName) -> OUString +{ + OUStringBuffer ret; + sal_Int32 index(0); + while (index < rStyleName.getLength()) + { + auto const c(rStyleName.iterateCodePoints(&index)); + if (rtl::isAsciiAlphanumeric(c)) + { + ret.appendUtf32(c); + } + } + return ret.makeStringAndClear(); +} + +OUString DomainMapper_Impl::ConvertTOCStyleName(OUString const& rTOCStyleName) +{ + assert(!rTOCStyleName.isEmpty()); + if (auto const pStyle = GetStyleSheetTable()->FindStyleSheetByISTD(rTOCStyleName)) + { // theoretical case: what OOXML says + return pStyle->sStyleName; + } + auto const pStyle = GetStyleSheetTable()->FindStyleSheetByISTD(FilterChars(rTOCStyleName)); + if (pStyle && m_bIsNewDoc) + { // practical case: Word wrote i18n name to TOC field, but it doesn't + // exist in styles.xml; tdf#153083 clone it for best roundtrip + SAL_INFO("writerfilter.dmapper", "cloning TOC paragraph style (presumed built-in) " << rTOCStyleName << " from " << pStyle->sStyleName); + GetStyleSheetTable()->CloneTOCStyle(GetFontTable(), pStyle, rTOCStyleName); + return rTOCStyleName; + } + else + { + return GetStyleSheetTable()->ConvertStyleName(rTOCStyleName); + } +} + void DomainMapper_Impl::handleToc (const FieldContextPtr& pContext, const OUString & sTOCServiceName) @@ -6300,8 +6349,8 @@ void DomainMapper_Impl::handleToc uno::Sequence< OUString> aStyles( nLevelCount ); for ( auto& rStyle : asNonConstRange(aStyles) ) { - // tdf#153082 must map w:styleId to w:name - rStyle = GetStyleSheetTable()->ConvertStyleName(aTOCStyleIter->second, true); + // tdf#153083 must map w:styleId to w:name + rStyle = ConvertTOCStyleName(aTOCStyleIter->second); ++aTOCStyleIter; } xParaStyles->replaceByIndex(nLevel - 1, uno::Any(aStyles)); @@ -6336,7 +6385,7 @@ void DomainMapper_Impl::handleToc if (!sTemplate.isEmpty()) { - OUString const sConvertedStyleName(GetStyleSheetTable()->ConvertStyleName(sTemplate, true)); + OUString const sConvertedStyleName(ConvertTOCStyleName(sTemplate)); xTOC->setPropertyValue("CreateFromParagraphStyle", uno::Any(sConvertedStyleName)); } diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.hxx b/writerfilter/source/dmapper/DomainMapper_Impl.hxx index 0c6c8cd75f31..bb5c00e77080 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.hxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.hxx @@ -1209,6 +1209,8 @@ public: OUString getFontNameForTheme(const Id id); + OUString ConvertTOCStyleName(OUString const&); + private: void PushPageHeaderFooter(bool bHeader, SectionPropertyMap::PageType eType); // Start a new index section; if needed, finish current paragraph diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index c0a8e32845c9..52c14f2bf04d 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -30,9 +30,13 @@ #include <com/sun/star/beans/XMultiPropertySet.hpp> #include <com/sun/star/beans/XPropertyState.hpp> #include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/container/XEnumerationAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> #include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/text/XTextDocument.hpp> +#include <com/sun/star/text/XTextFramesSupplier.hpp> +#include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/style/NumberingType.hpp> #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/style/XStyle.hpp> @@ -42,7 +46,6 @@ #include <map> #include <osl/diagnose.h> #include <rtl/ustrbuf.hxx> -#include <rtl/character.hxx> #include <sal/log.hxx> #include <comphelper/propertyvalue.hxx> #include <comphelper/string.hxx> @@ -272,6 +275,7 @@ struct StyleSheetTable_Impl uno::Reference< beans::XPropertySet> m_xTextDefaults; std::vector< StyleSheetEntryPtr > m_aStyleSheetEntries; std::map< OUString, StyleSheetEntryPtr > m_aStyleSheetEntriesMap; + std::map<OUString, OUString> m_ClonedTOCStylesMap; StyleSheetEntryPtr m_pCurrentEntry; PropertyMapPtr m_pDefaultParaProps, m_pDefaultCharProps; OUString m_sDefaultParaStyleName; //WW8 name @@ -287,6 +291,7 @@ struct StyleSheetTable_Impl void AppendLatentStyleProperty(const OUString& aName, Value const & rValue); /// Sets all properties of xStyle back to default. static void SetPropertiesToDefault(const uno::Reference<style::XStyle>& xStyle); + void ApplyClonedTOCStylesToXText(uno::Reference<text::XText> const& xText); }; @@ -993,7 +998,90 @@ void StyleSheetTable::ReApplyInheritedOutlineLevelFromChapterNumbering() } } +void StyleSheetTable_Impl::ApplyClonedTOCStylesToXText(uno::Reference<text::XText> const& xText) +{ + uno::Reference<container::XEnumerationAccess> const xEA(xText, uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumeration> const xParaEnum(xEA->createEnumeration()); + + while (xParaEnum->hasMoreElements()) + { + uno::Reference<lang::XServiceInfo> const xElem(xParaEnum->nextElement(), uno::UNO_QUERY_THROW); + if (xElem->supportsService(u"com.sun.star.text.Paragraph")) + { + uno::Reference<beans::XPropertySet> const xPara(xElem, uno::UNO_QUERY_THROW); + OUString styleName; + if (xPara->getPropertyValue(u"ParaStyleName") >>= styleName) + { + auto const it(m_ClonedTOCStylesMap.find(styleName)); + if (it != m_ClonedTOCStylesMap.end()) + { + xPara->setPropertyValue(u"ParaStyleName", uno::Any(it->second)); + } + } + } + else if (xElem->supportsService(u"com.sun.star.text.TextTable")) + { + uno::Reference<text::XTextTable> const xTable(xElem, uno::UNO_QUERY_THROW); + uno::Sequence<OUString> const cells(xTable->getCellNames()); + for (OUString const& rCell : cells) + { + uno::Reference<text::XText> const xCell(xTable->getCellByName(rCell), uno::UNO_QUERY_THROW); + ApplyClonedTOCStylesToXText(xCell); + } + } + } +} + +/** + Replace the applied en-US Word built-in styles that were referenced from + TOC fields (also STYLEREF and likely AUTOTEXTLIST) with the localised clones. + + With the style cloned, and the clone referenced, the ToX should work in + Writer and also, when exported to DOCX, in Word. + */ +void StyleSheetTable::ApplyClonedTOCStyles() +{ + if (m_pImpl->m_ClonedTOCStylesMap.empty() + || !m_pImpl->m_bIsNewDoc) // avoid modifying pre-existing content + { + return; + } + SAL_INFO("writerfilter.dmapper", "Applying cloned styles to make TOC work"); + // ignore header / footer, irrelevant for ToX + // text frames + uno::Reference<text::XTextFramesSupplier> const xDocTFS(m_pImpl->m_xTextDocument, uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumerationAccess> const xFrames(xDocTFS->getTextFrames(), uno::UNO_QUERY_THROW); + uno::Reference<container::XEnumeration> const xFramesEnum(xFrames->createEnumeration()); + while (xFramesEnum->hasMoreElements()) + { + uno::Reference<text::XText> const xFrame(xFramesEnum->nextElement(), uno::UNO_QUERY_THROW); + m_pImpl->ApplyClonedTOCStylesToXText(xFrame); + } + // body + uno::Reference<text::XText> const xBody(m_pImpl->m_xTextDocument->getText()); + m_pImpl->ApplyClonedTOCStylesToXText(xBody); +} + +void StyleSheetTable::CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rNewName) +{ + StyleSheetEntryPtr const pClone(new StyleSheetEntry(*pStyle)); + pClone->sStyleIdentifierD = rNewName; + pClone->sStyleName = rNewName; + pClone->sConvertedStyleName = ConvertStyleName(rNewName); + m_pImpl->m_aStyleSheetEntries.push_back(pClone); + // add it so it will be found if referenced from another TOC + m_pImpl->m_aStyleSheetEntriesMap.emplace(rNewName, pClone); + m_pImpl->m_ClonedTOCStylesMap.emplace(pStyle->sStyleName, rNewName); + std::vector<StyleSheetEntryPtr> const styles{ pClone }; + return ApplyStyleSheetsImpl(rFontTable, styles); +} + void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) +{ + return ApplyStyleSheetsImpl(rFontTable, m_pImpl->m_aStyleSheetEntries); +} + +void StyleSheetTable::ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries) { try { @@ -1013,7 +1101,7 @@ void StyleSheetTable::ApplyStyleSheets( const FontTablePtr& rFontTable ) std::vector< ::std::pair<OUString, uno::Reference<style::XStyle>> > aMissingFollow; std::vector<std::pair<OUString, uno::Reference<style::XStyle>>> aMissingLink; std::vector<beans::PropertyValue> aTableStylesVec; - for( auto& pEntry : m_pImpl->m_aStyleSheetEntries ) + for (auto& pEntry : rEntries) { if( pEntry->nStyleTypeCode == STYLE_TYPE_UNKNOWN && !pEntry->sStyleName.isEmpty() ) pEntry->nStyleTypeCode = STYLE_TYPE_PARA; // unspecified style types are considered paragraph styles @@ -1413,30 +1501,6 @@ const StyleSheetEntryPtr & StyleSheetTable::GetCurrentEntry() const return m_pImpl->m_pCurrentEntry; } -/** - This is a heuristic to find Word's w:styleId value from localised style name. - It's not clear how exactly it works, but apparently Word stores into - w:styleId some filtered representation of the localised style name. - Tragically there are references to the localised style name itself in TOC - fields. - Hopefully this works and a complete map of >100 built-in style names - localised to all langauges isn't needed. -*/ -static auto FilterChars(OUString const& rStyleName) -> OUString -{ - OUStringBuffer ret; - sal_Int32 index(0); - while (index < rStyleName.getLength()) - { - auto const c(rStyleName.iterateCodePoints(&index)); - if (rtl::isAsciiAlphanumeric(c)) - { - ret.appendUtf32(c); - } - } - return ret.makeStringAndClear(); -} - OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExtendedSearch) { OUString sRet( rWWName ); @@ -1444,10 +1508,6 @@ OUString StyleSheetTable::ConvertStyleName( const OUString& rWWName, bool bExten { //search for the rWWName in the IdentifierD of the existing styles and convert the sStyleName member auto findIt = m_pImpl->m_aStyleSheetEntriesMap.find(rWWName); - if (findIt == m_pImpl->m_aStyleSheetEntriesMap.end()) - { - findIt = m_pImpl->m_aStyleSheetEntriesMap.find(FilterChars(rWWName)); - } if (findIt != m_pImpl->m_aStyleSheetEntriesMap.end()) { if (!findIt->second->sConvertedStyleName.isEmpty()) diff --git a/writerfilter/source/dmapper/StyleSheetTable.hxx b/writerfilter/source/dmapper/StyleSheetTable.hxx index 5dcf84b789bb..e2f79d863e8f 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.hxx +++ b/writerfilter/source/dmapper/StyleSheetTable.hxx @@ -74,6 +74,7 @@ public: PropertyMapPtr GetMergedInheritedProperties(const StyleSheetTablePtr& pStyleSheetTable); StyleSheetEntry(); + StyleSheetEntry(StyleSheetEntry const&) = default; virtual ~StyleSheetEntry() override; }; @@ -98,6 +99,8 @@ public: StyleSheetEntryPtr FindDefaultParaStyle(); OUString ConvertStyleName( const OUString& rWWName, bool bExtendedSearch = false ); + void CloneTOCStyle(FontTablePtr const& rFontTable, StyleSheetEntryPtr const pStyle, OUString const& rName); + void ApplyClonedTOCStyles(); OUString getOrCreateCharStyle( PropertyValueVector_t& rCharProperties, bool bAlwaysCreate ); @@ -117,6 +120,8 @@ private: virtual void lcl_entry(writerfilter::Reference<Properties>::Pointer_t ref) override; void applyDefaults(bool bParaProperties); + + void ApplyStyleSheetsImpl(const FontTablePtr& rFontTable, std::vector<StyleSheetEntryPtr> const& rEntries); }; commit be49b04546d06214419042af123b9681c3c816f0 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Jan 20 15:15:32 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:54 2023 +0100 tdf#153090 writerfilter,sw: DOCX/RTF import/export of TOC \c \t This is for Table of Figures/Objects/Tables. The core will happily generate entries from paragraph styles by simply setting the Template flag and adding the style name. In Word, this feature differs from ToC in that only a single paragraph style is allowed, and there is only one level to assign to so that is omitted and \t is simply the style name (presumably suffering the usual i18n disaster, see tdf#153083). So implement it with the same limitations, not reusing the CreateFromLevelParagraphStyles property on SwXDocumentIndex but instead add new property CreateFromParagraphStyle. Change-Id: Ic8ab1fa9e81bdc85cc932f6bba8724d560e0fbc1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145904 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit 5ef8d07fe04717dc4a5b8846a3b324381b2c8efd) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145953 Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/offapi/com/sun/star/text/IllustrationsIndex.idl b/offapi/com/sun/star/text/IllustrationsIndex.idl index 433d1503bd9b..d58392ded2bc 100644 --- a/offapi/com/sun/star/text/IllustrationsIndex.idl +++ b/offapi/com/sun/star/text/IllustrationsIndex.idl @@ -36,6 +36,12 @@ published service IllustrationsIndex /* determines the way the paragraph containing a label is included in the index. @see ChapterFormat*/ [optional, property] short LabelDisplayType;//tables, illustrations + + /** determines if paragraphs with one particular style applied are + included in the index. + @since LibreOffice 7.6 + */ + [optional, property, maybevoid] string CreateFromParagraphStyle; }; diff --git a/offapi/com/sun/star/text/ObjectIndex.idl b/offapi/com/sun/star/text/ObjectIndex.idl index 2aea50204be2..3df13f2abd63 100644 --- a/offapi/com/sun/star/text/ObjectIndex.idl +++ b/offapi/com/sun/star/text/ObjectIndex.idl @@ -45,6 +45,12 @@ published service ObjectIndex /** Determines if external embedded objects are included in the office. */ [optional, property] boolean CreateFromOtherEmbeddedObjects;//objects + + /** determines if paragraphs with one particular style applied are + included in the index. + @since LibreOffice 7.6 + */ + [optional, property, maybevoid] string CreateFromParagraphStyle; }; diff --git a/offapi/com/sun/star/text/TableIndex.idl b/offapi/com/sun/star/text/TableIndex.idl index 166748573370..e65f86233111 100644 --- a/offapi/com/sun/star/text/TableIndex.idl +++ b/offapi/com/sun/star/text/TableIndex.idl @@ -42,6 +42,12 @@ published service TableIndex ONLY_CAPTION */ [optional, property] short LabelDisplayType;//tables, illustrations + + /** determines if paragraphs with one particular style applied are + included in the index. + @since LibreOffice 7.6 + */ + [optional, property, maybevoid] string CreateFromParagraphStyle; }; diff --git a/sw/inc/unomap.hxx b/sw/inc/unomap.hxx index d3cfcb862937..689fa87063a1 100644 --- a/sw/inc/unomap.hxx +++ b/sw/inc/unomap.hxx @@ -226,6 +226,7 @@ class SfxItemPropertySet; #define WID_TOC_BOOKMARK 1061 #define WID_TOC_NEWLINE 1062 #define WID_TOC_PARAGRAPH_OUTLINE_LEVEL 1063 +#define WID_CREATE_FROM_PARAGRAPH_STYLE 1064 // Text document #define WID_DOC_CHAR_COUNT 1000 diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx index 42a38fdef0aa..2bdcc09a6ad9 100644 --- a/sw/inc/unoprnms.hxx +++ b/sw/inc/unoprnms.hxx @@ -470,6 +470,7 @@ inline constexpr OUStringLiteral UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS inline constexpr OUStringLiteral UNO_NAME_INDEX_AUTO_MARK_FILE_U_R_L = u"IndexAutoMarkFileURL"; inline constexpr OUStringLiteral UNO_NAME_IS_COMMA_SEPARATED = u"IsCommaSeparated"; inline constexpr OUStringLiteral UNO_NAME_IS_RELATIVE_TABSTOPS = u"IsRelativeTabstops"; +inline constexpr OUStringLiteral UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE = u"CreateFromParagraphStyle"; inline constexpr OUStringLiteral UNO_NAME_CREATE_FROM_LEVEL_PARAGRAPH_STYLES = u"CreateFromLevelParagraphStyles"; inline constexpr OUStringLiteral UNO_NAME_SHOW_CHANGES = u"ShowChanges"; diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index 1073f28dd30f..2c542e87309f 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -9,6 +9,7 @@ #include <swmodeltestbase.hxx> +#include <com/sun/star/text/XDocumentIndex.hpp> #include <com/sun/star/text/XTextFieldsSupplier.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/XTextTable.hpp> @@ -165,7 +166,17 @@ CPPUNIT_TEST_FIXTURE(Test, testFDO77715) loadAndReload("FDO77715.docx"); xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"); - assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c \\h "); + // tdf#153090 check that para style is preserved + assertXPathContent(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[2]/w:instrText[1]", " TOC \\c \\h \\t \"Block Header\" "); + + uno::Reference<text::XDocumentIndexesSupplier> xIndexSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xIndexes = xIndexSupplier->getDocumentIndexes(); + uno::Reference<text::XDocumentIndex> xTOC(xIndexes->getByIndex(0), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(OUString("Block Header"), getProperty<OUString>(xTOC, "CreateFromParagraphStyle")); + // tdf#153090 check that update uses the style + xTOC->update(); + OUString const tocContent(xTOC->getAnchor()->getString()); + CPPUNIT_ASSERT(tocContent.startsWith("National Infrastructure Bank Aff/Neg Index")); } CPPUNIT_TEST_FIXTURE(Test, testTOCFlag_u) diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index b2b4f1618068..b36fc7814817 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -792,6 +792,30 @@ SwXDocumentIndex::setPropertyValue( case WID_CREATE_FROM_PARAGRAPH_STYLES: lcl_AnyToBitMask(rValue, nCreate, SwTOXElement::Template); break; + case WID_CREATE_FROM_PARAGRAPH_STYLE: + { + OUString style; + if (rValue >>= style) + { + if (style.indexOf(TOX_STYLE_DELIMITER) != -1) + { + throw lang::IllegalArgumentException(); + } + lcl_AnyToBitMask(uno::Any(true), nCreate, SwTOXElement::Template); + OUString uiStyle; + SwStyleNameMapper::FillUIName(style, uiStyle, SwGetPoolIdFromName::TxtColl); + rTOXBase.SetStyleNames(uiStyle, 0); + } + else if (!rValue.hasValue()) + { + lcl_AnyToBitMask(uno::Any(false), nCreate, SwTOXElement::Template); + } + else + { + throw lang::IllegalArgumentException(); + } + } + break; case WID_PARA_LEV1: case WID_PARA_LEV2: @@ -1101,6 +1125,23 @@ SwXDocumentIndex::getPropertyValue(const OUString& rPropertyName) case WID_CREATE_FROM_PARAGRAPH_STYLES: lcl_BitMaskToAny(aRet, nCreate, SwTOXElement::Template); break; + case WID_CREATE_FROM_PARAGRAPH_STYLE: + { + if (nCreate & SwTOXElement::Template) + { // there is only one style, at top level + OUString const& rStyle(pTOXBase->GetStyleNames(0)); + if (!rStyle.isEmpty()) + { + assert(rStyle.indexOf(TOX_STYLE_DELIMITER) == -1); + OUString ret; + SwStyleNameMapper::FillProgName(rStyle, ret, + SwGetPoolIdFromName::TxtColl); + aRet <<= ret; + } + } + } + break; + case WID_PARA_HEAD: { //Header is at position 0 diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 0e036bff1884..e3bd80e58b03 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -443,6 +443,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM BASE_INDEX_PROPERTIES_ { UNO_NAME_CREATE_FROM_CHAPTER, WID_CREATE_FROM_CHAPTER , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_LABELS, WID_CREATE_FROM_LABELS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_IS_PROTECTED, WID_PROTECTED , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_CATEGORY, WID_LABEL_CATEGORY , cppu::UnoType<OUString>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_DISPLAY_TYPE, WID_LABEL_DISPLAY_TYPE , cppu::UnoType<sal_Int16>::get() , PROPERTY_NONE, 0}, @@ -475,6 +476,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM { UNO_NAME_CREATE_FROM_STAR_CALC, WID_CREATE_FROM_STAR_CALC , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_STAR_DRAW, WID_CREATE_FROM_STAR_DRAW , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_OTHER_EMBEDDED_OBJECTS, WID_CREATE_FROM_OTHER_EMBEDDED_OBJECTS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_TEXT_COLUMNS, RES_COL, cppu::UnoType<css::text::XTextColumns>::get(), PROPERTY_NONE, MID_COLUMNS}, { UNO_NAME_BACK_GRAPHIC_URL, RES_BACKGROUND, cppu::UnoType<OUString>::get(), PROPERTY_NONE ,MID_GRAPHIC_URL }, { UNO_NAME_BACK_GRAPHIC, RES_BACKGROUND, cppu::UnoType<graphic::XGraphic>::get(), PROPERTY_NONE, MID_GRAPHIC }, @@ -496,6 +498,7 @@ o3tl::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyM BASE_INDEX_PROPERTIES_ { UNO_NAME_CREATE_FROM_CHAPTER, WID_CREATE_FROM_CHAPTER , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_CREATE_FROM_LABELS, WID_CREATE_FROM_LABELS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, + { UNO_NAME_CREATE_FROM_PARAGRAPH_STYLE, WID_CREATE_FROM_PARAGRAPH_STYLE, cppu::UnoType<OUString>::get(), PropertyAttribute::MAYBEVOID, 0}, { UNO_NAME_IS_PROTECTED, WID_PROTECTED , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_USE_ALPHABETICAL_SEPARATORS, WID_USE_ALPHABETICAL_SEPARATORS , cppu::UnoType<bool>::get() , PROPERTY_NONE, 0}, { UNO_NAME_LABEL_CATEGORY, WID_LABEL_CATEGORY , cppu::UnoType<OUString>::get() , PROPERTY_NONE, 0}, diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 7c3d9e0879b9..172406e612c1 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -2368,6 +2368,16 @@ void AttributeOutputBase::StartTOX( const SwSection& rSect ) { sStr += "\\h "; } + if (pTOX->GetCreateType() & SwTOXElement::Template) + { + OUString const& rStyle(pTOX->GetStyleNames(0)); + assert(rStyle.indexOf(TOX_STYLE_DELIMITER) == -1); + SwTextFormatColl const*const pColl = GetExport().m_rDoc.FindTextFormatCollByName(rStyle); + if (pColl) + { + sStr += "\\t \"" + rStyle + sEntryEnd; + } + } break; case TOX_AUTHORITIES: diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 6417b858a2f3..5f31fb2dec14 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -6334,6 +6334,12 @@ void DomainMapper_Impl::handleToc xTOC->setPropertyValue(getPropertyName(PROP_LABEL_CATEGORY), uno::Any(sFigureSequence)); + if (!sTemplate.isEmpty()) + { + OUString const sConvertedStyleName(GetStyleSheetTable()->ConvertStyleName(sTemplate, true)); + xTOC->setPropertyValue("CreateFromParagraphStyle", uno::Any(sConvertedStyleName)); + } + if ( bHyperlinks ) { uno::Reference< container::XIndexReplace> xLevelFormats; commit aaa8bc1c424eb5d7a8f85fde538a911f504d9e91 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 7 20:48:44 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:54 2023 +0100 Related: tdf#153438 this toplevel needs to be a GtkBox Change-Id: I04a503f77dcbfb03cfcfce26f0a94d3cb7f54b68 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146619 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/svx/uiconfig/ui/dockingcolorreplace.ui b/svx/uiconfig/ui/dockingcolorreplace.ui index ada7d202e1f6..50724d15c3b3 100644 --- a/svx/uiconfig/ui/dockingcolorreplace.ui +++ b/svx/uiconfig/ui/dockingcolorreplace.ui @@ -27,12 +27,13 @@ <property name="page_increment">10</property> </object> <!-- n-columns=1 n-rows=1 --> - <object class="GtkGrid" id="DockingColorReplace"> + <object class="GtkBox" id="DockingColorReplace"> <property name="visible">True</property> <property name="can_focus">False</property> <property name="hexpand">True</property> <property name="vexpand">True</property> - <property name="row_spacing">24</property> + <property name="orientation">vertical</property> + <property name="spacing">24</property> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> @@ -451,8 +452,7 @@ </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">1</property> + <property name="position">1</property> </packing> </child> <child> @@ -560,8 +560,7 @@ </child> </object> <packing> - <property name="left_attach">0</property> - <property name="top_attach">0</property> + <property name="position">0</property> </packing> </child> <child internal-child="accessible"> commit 52031148a9a8fd15e08a1a0224f0166544412ce5 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Tue Feb 7 20:37:37 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:54 2023 +0100 tdf#153434 crash on "new" macro with no cursor probably good in trunk since: commit 6e2bd11251afbe64f9889ede36b28b00f47aaff5 Date: Sun Aug 7 12:49:11 2022 +0100 tdf#150291 Revert "Fix crash when no valid EntryDescriptor found" but still visible in 7-4 Change-Id: I63898ed3e33f73f8a93528872449539c5df6574f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146617 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx index b1097b9ad8c8..e2511ee53b6b 100644 --- a/basctl/source/basicide/macrodlg.cxx +++ b/basctl/source/basicide/macrodlg.cxx @@ -295,7 +295,11 @@ void MacroChooser::DeleteMacro() SbMethod* MacroChooser::CreateMacro() { SbMethod* pMethod = nullptr; - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); + if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter)) + { + SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback"); + return nullptr; + } EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); const ScriptDocument& aDocument( aDesc.GetDocument() ); OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" ); @@ -474,8 +478,9 @@ IMPL_LINK_NOARG(MacroChooser, MacroSelectHdl, weld::TreeView&, void) IMPL_LINK_NOARG(MacroChooser, BasicSelectHdl, weld::TreeView&, void) { - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); - SbModule* pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get()); + SbModule* pModule = nullptr; + if (m_xBasicBox->get_cursor(m_xBasicBoxIter.get())) + pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get()); m_xMacroBox->clear(); if (pModule) { @@ -614,7 +619,11 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void) } else if (&rButton == m_xEditButton.get() || &rButton == m_xDelButton.get() || &rButton == m_xNewButton.get()) { - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); + if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter)) + { + SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback"); + return; + } EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); const ScriptDocument& aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); @@ -697,7 +706,11 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void) } else if (&rButton == m_xAssignButton.get()) { - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); + if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter)) + { + SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback"); + return; + } EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); const ScriptDocument& aDocument( aDesc.GetDocument() ); DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" ); @@ -724,14 +737,22 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void) } else if (&rButton == m_xNewLibButton.get()) { - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); + if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter)) + { + SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback"); + return; + } EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); const ScriptDocument& aDocument( aDesc.GetDocument() ); createLibImpl(m_xDialog.get(), aDocument, nullptr, m_xBasicBox.get()); } else if (&rButton == m_xNewModButton.get()) { - m_xBasicBox->get_cursor(m_xBasicBoxIter.get()); + if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter)) + { + SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback"); + return; + } EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get()); const ScriptDocument& aDocument( aDesc.GetDocument() ); const OUString& aLibName( aDesc.GetLibName() ); commit 627f011d9a45834329b664fb1e22278c57ae8a33 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Tue Feb 7 21:29:12 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 tdf#153436: Improve handling of Arabic system spell dictionary on macOS The system has only a generic “ar” spell dictionary, but LibreOffice wants country code as well. Since it is the same dictionary for all Arabic locales, we now add entries to all Arabic country codes we know about. Change-Id: Iaf5a8f495b3d1023d7fe40654afa0cce3fe9fbdc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146616 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm index c20871b1e127..448870e9125c 100644 --- a/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm +++ b/lingucomponent/source/spellcheck/macosxspell/macspellimp.mm @@ -125,7 +125,19 @@ Sequence< Locale > SAL_CALL MacSpellChecker::getLocales() // Fix up generic languages (without territory code) and odd combinations that LO // doesn't handle. - if ([pLangStr isEqualToString:@"da"]) + if ([pLangStr isEqualToString:@"ar"]) + { + const std::vector<NSString*> aAR + { @"AE", @"BH", @"DJ", @"DZ", @"EG", @"ER", @"IL", @"IQ", @"JO", + @"KM", @"KW", @"LB", @"LY", @"MA", @"MR", @"OM", @"PS", @"QA", + @"SA", @"SD", @"SO", @"SY", @"TD", @"TN", @"YE" }; + for (auto c: aAR) + { + pLangStr = [@"ar_" stringByAppendingString: c]; + postspdict.push_back( pLangStr ); + } + } + else if ([pLangStr isEqualToString:@"da"]) { postspdict.push_back( @"da_DK" ); } commit 73a68d5713dfa5e8921c85db162586e324262fb1 Author: Khaled Hosny <kha...@aliftype.com> AuthorDate: Tue Feb 7 16:40:49 2023 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 tdf#153376: Fix reading USE_TYPO_METRICS flag Font data is big endian while SvStream defaults to little endian. Regression from: commit fb417ee082afdd2e80a1f48aa420bb8d5cb97686 Author: Khaled Hosny <kha...@aliftype.com> Date: Fri Sep 30 12:35:10 2022 +0200 vcl: Apply variations to font metrics Change-Id: I474ec2a76057baca93f350e23c3779985abdf9da Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146615 Tested-by: خالد حسني <kha...@aliftype.com> Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx index 4ee3020b23f4..84c783b83474 100644 --- a/vcl/source/font/fontmetric.cxx +++ b/vcl/source/font/fontmetric.cxx @@ -520,6 +520,8 @@ void ImplFontMetricData::ImplCalcLineSpacing(LogicalFontInstance* pFontInstance) auto aOS2(pFace->GetRawFontData(HB_TAG('O', 'S', '/', '2'))); SvMemoryStream aStream(const_cast<uint8_t*>(aOS2.data()), aOS2.size(), StreamMode::READ); + // Font data are big endian. + aStream.SetEndian(SvStreamEndian::BIG); if (aStream.Seek(vcl::OS2_fsSelection_offset) == vcl::OS2_fsSelection_offset) aStream.ReadUInt16(fsSelection); bUseTypoMetrics = fsSelection & (1 << 7); commit b3be33107c1c901c45081ec70a184b12a676f82e Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Fri Feb 3 19:01:54 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 tdf#153341: try to parse alpha value when copying HTML text Change-Id: Ic7240358be19e73f3c3f021e0de9414e3e988aa6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146546 (cherry picked from commit a21aad5e084e3901a1e216ef9006b0f8b6132c39) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146524 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/sw/source/filter/html/parcss1.cxx b/sw/source/filter/html/parcss1.cxx index 0fa73d455fbc..2b03e0485195 100644 --- a/sw/source/filter/html/parcss1.cxx +++ b/sw/source/filter/html/parcss1.cxx @@ -633,7 +633,8 @@ CSS1Token CSS1Parser::GetNextToken() ( (('u'==m_aToken[0] || 'U'==m_aToken[0]) && m_aToken.equalsIgnoreAsciiCase( "url" )) || (('r'==m_aToken[0] || 'R'==m_aToken[0]) && - m_aToken.equalsIgnoreAsciiCase( "rgb" )) ) ) + (m_aToken.equalsIgnoreAsciiCase( "rgb" ) || m_aToken.equalsIgnoreAsciiCase( "rgba" ) ) + ) ) ) { int nNestCnt = 0; OUStringBuffer sTmpBuffer2(64); @@ -1268,18 +1269,24 @@ bool CSS1Expression::GetColor( Color &rColor ) const { case CSS1_RGB: { - sal_uInt8 aColors[3] = { 0, 0, 0 }; + // fourth value to 255 means no alpha transparency + // so the right by default value + sal_uInt8 aColors[4] = { 0, 0, 0, 255 }; + // it can be "rgb" or "rgba" if (!aValue.startsWithIgnoreAsciiCase( "rgb" ) || aValue.getLength() < 6 || - aValue[3] != '(' || aValue[aValue.getLength()-1] != ')') + (aValue[3] != '(' && aValue[4] != '(' ) || aValue[aValue.getLength()-1] != ')') { break; } - sal_Int32 nPos = 4; // start after "rgb(" - for ( int nCol = 0; nCol < 3 && nPos > 0; ++nCol ) + sal_Int32 nPos = aValue.startsWithIgnoreAsciiCase( "rgba" )?5:4; // start after "rgba(" or "rgb(" + char cSep = (aValue.indexOf(',') != -1)?',':' '; + // alpha value can be after a "/" or "," + bool bIsSepAlphaDiv = (aValue.indexOf('/') != -1)?true:false; + for ( int nCol = 0; nCol < 4 && nPos > 0; ++nCol ) { - const std::u16string_view aNumber = o3tl::getToken(aValue, 0, ',', nPos); + const std::u16string_view aNumber = o3tl::getToken(aValue, 0, cSep, nPos); sal_Int32 nNumber = o3tl::toInt32(aNumber); if( nNumber<0 ) @@ -1295,13 +1302,25 @@ bool CSS1Expression::GetColor( Color &rColor ) const } else if( nNumber > 255 ) nNumber = 255; - + else if( aNumber.find('.') != std::u16string_view::npos ) + { + // in this case aNumber contains something like "0.3" so not an sal_Int32 + nNumber = static_cast<sal_Int32>(255.0*o3tl::toDouble(aNumber)); + } aColors[nCol] = static_cast<sal_uInt8>(nNumber); + // rgb with alpha and '/' has this form: rgb(255 0 0 / 50%) + if (bIsSepAlphaDiv && nCol == 2) + { + // but there can be some spaces or not before and after the "/", so skip them + while (aValue[nPos] == '/' || aValue[nPos] == ' ') + ++nPos; + } } rColor.SetRed( aColors[0] ); rColor.SetGreen( aColors[1] ); rColor.SetBlue( aColors[2] ); + rColor.SetAlpha( aColors[3] ); bRet = true; // something different than a colour isn't possible } commit 0d1e9082ca2534d0972dc99380cdcf6f95a083da Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 6 19:58:40 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 ofz#55751 check that level is valid Change-Id: I971bdcc62fd3775f8f75bf69db41182afc4baefc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146527 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index 16236bb8fc41..b498fa31cfbb 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -467,7 +467,7 @@ static hchar olHanglJaso(int num, int type) static const hchar *GetOutlineStyleChars(int style) { - static const hchar out_bul_style_entry[5][8] = // extern + static const hchar out_bul_style_entry[5][MAX_OUTLINE_LEVEL+1] = // extern { { // 0 OLSTY_BULLET1 0x2f18, 0x2f12, 0x2f08, 0x2f02, 0x2f06, 0x2f00, 0x2043, 0x0000 @@ -482,7 +482,7 @@ static const hchar *GetOutlineStyleChars(int style) 0x2f18, 0x2f16, 0x2f12, 0x2f10, 0x2f06, 0x2f00, 0x2043, 0x0000 }, { - 0xAC61, 0xB677, 0xB861, 0xB8F7, 0xB781, 0x0000 + 0xAC61, 0xB677, 0xB861, 0xB8F7, 0xB781, 0x0000, 0x0000, 0x0000 }, }; if (style >= OLSTY_BULLET1 && style <= OLSTY_BULLET5) @@ -605,12 +605,15 @@ OUString Outline::GetUnicode() const case OLSTY_BULLET3: case OLSTY_BULLET4: case OLSTY_BULLET5: + { + if (level < MAX_OUTLINE_LEVEL) { - p = GetOutlineStyleChars(shape); - buffer[0] = p[level]; - buffer[1] = 0; - return hstr2OUString(buffer); + p = GetOutlineStyleChars(shape); + buffer[0] = p[level]; + buffer[1] = 0; } + return hstr2OUString(buffer); + } case OLSTY_USER: case OLSTY_BULUSER: { commit 7fd35303c243ba1d03b16d4c0ed122ccd9905e30 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Mon Feb 6 20:33:41 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 tdf#153321 use SeparatorColor for FixedLine so the separators as seen in NotebookBar, etc are drawn the same as the separators seen in the normal toolbar Change-Id: I22f4f5e5506e325f78951011f0574653ff5758e0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146530 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/vcl/source/window/decoview.cxx b/vcl/source/window/decoview.cxx index d6bbd2d61982..e9000090086c 100644 --- a/vcl/source/window/decoview.cxx +++ b/vcl/source/window/decoview.cxx @@ -996,24 +996,10 @@ void DecorationView::DrawSeparator( const Point& rStart, const Point& rStop, boo if ( rStyleSettings.GetOptions() & StyleSettingsOptions::Mono ) mpOutDev->SetLineColor( COL_BLACK ); else - mpOutDev->SetLineColor( rStyleSettings.GetShadowColor() ); + mpOutDev->SetLineColor( rStyleSettings.GetSeparatorColor() ); mpOutDev->DrawLine( aStart, aStop ); - if ( !(rStyleSettings.GetOptions() & StyleSettingsOptions::Mono) ) - { - mpOutDev->SetLineColor( rStyleSettings.GetLightColor() ); - if( bVertical ) - { - aStart.AdjustX( 1 ); - aStop.AdjustX( 1 ); - } - else - { - aStart.AdjustY( 1 ); - aStop.AdjustY( 1 ); - } - mpOutDev->DrawLine( aStart, aStop ); - } + mpOutDev->Pop(); } commit 620b8992e321ddc94f5e643f55a94380dc447930 Author: Xisco Fauli <xiscofa...@libreoffice.org> AuthorDate: Mon Feb 6 16:05:05 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:53 2023 +0100 Revert "optimize ConfigurationProperty::get()" This reverts commit 7df433cdc33b4d6ba38eafad9282d015571433ef and its follow-ups: * b4b63d0c46979ad6b6aae5d6a4ea6672ea248e10 "try to fix some shutdown crashes" * 203ad037ccb9fdebffea4f622229ded90635eb8b "try to fix shutdown crashes in ConfigurationWrapper" since it introduced a crash starting with LibreOffice 7.4 See https://crashreport.libreoffice.org/stats/signature/void%20rtl::str::release%3C_rtl_uString%3E(_rtl_uString*) Later, it was reverted in libreoffice-7-4 branch with df79a29ea20fb698d650be45a48c607f54476dea "Revert "optimize ConfigurationProperty::get()" (7.4 only)" so the crash is no longer reported in that branch. OTOH, Noel tried to fix it in master/libreoffice-7-5 branches with the two commits mentioned above but the crash is still being reported in LibreOffice 7.5 After talking to him, he suggested to revert it all Finally, adapt code to make loplugin:stringviewparam happy with getPropertyValue Change-Id: Id9fa97d2a81a590e53abd027e978d2d6179222b8 Change-Id: Id2e3475c342770be5705a74b9c0b45f45d6be5ad Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146586 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit 05b2bfc289df8712097cc1e640bf7d3bc6b86a84) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146529 diff --git a/comphelper/source/misc/configuration.cxx b/comphelper/source/misc/configuration.cxx index b84f705f1db0..59631dbccd83 100644 --- a/comphelper/source/misc/configuration.cxx +++ b/comphelper/source/misc/configuration.cxx @@ -10,8 +10,11 @@ #include <sal/config.h> #include <cassert> +#include <map> +#include <memory> +#include <mutex> +#include <string_view> -#include <com/sun/star/beans/NamedValue.hpp> #include <com/sun/star/beans/PropertyAttribute.hpp> #include <com/sun/star/configuration/ReadOnlyAccess.hpp> #include <com/sun/star/configuration/ReadWriteAccess.hpp> @@ -21,16 +24,12 @@ #include <com/sun/star/container/XHierarchicalNameReplace.hpp> #include <com/sun/star/container/XNameAccess.hpp> #include <com/sun/star/container/XNameContainer.hpp> -#include <com/sun/star/util/XChangesListener.hpp> -#include <com/sun/star/util/XChangesNotifier.hpp> -#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/XLocalizable.hpp> #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.hxx> #include <comphelper/solarmutex.hxx> #include <comphelper/configuration.hxx> #include <comphelper/configurationlistener.hxx> -#include <cppuhelper/implbase.hxx> #include <rtl/ustring.hxx> #include <sal/log.hxx> #include <i18nlangtag/languagetag.hxx> @@ -107,65 +106,12 @@ comphelper::detail::ConfigurationWrapper::get() return WRAPPER; } -class comphelper::detail::ConfigurationChangesListener - : public ::cppu::WeakImplHelper<css::util::XChangesListener> -{ - comphelper::detail::ConfigurationWrapper& mrConfigurationWrapper; -public: - ConfigurationChangesListener(comphelper::detail::ConfigurationWrapper& rWrapper) - : mrConfigurationWrapper(rWrapper) - {} - // util::XChangesListener - virtual void SAL_CALL changesOccurred( const css::util::ChangesEvent& ) override - { - std::scoped_lock aGuard(mrConfigurationWrapper.maMutex); - mrConfigurationWrapper.maPropertyCache.clear(); - } - virtual void SAL_CALL disposing(const css::lang::EventObject&) override - { - std::scoped_lock aGuard(mrConfigurationWrapper.maMutex); - mrConfigurationWrapper.mbDisposed = true; - mrConfigurationWrapper.maPropertyCache.clear(); - } -}; - comphelper::detail::ConfigurationWrapper::ConfigurationWrapper(): context_(comphelper::getProcessComponentContext()), - access_(css::configuration::ReadWriteAccess::create(context_, "*")), - mbDisposed(false) -{ - // Set up a configuration notifier to invalidate the cache as needed. - try - { - css::uno::Reference< css::lang::XMultiServiceFactory > xConfigProvider( - css::configuration::theDefaultProvider::get( context_ ) ); - - // set root path - css::uno::Sequence< css::uno::Any > params { - css::uno::Any( css::beans::NamedValue{ "nodepath", css::uno::Any( OUString("/"))} ), - css::uno::Any( css::beans::NamedValue{ "locale", css::uno::Any( OUString("*"))} ) }; - - css::uno::Reference< css::uno::XInterface > xCfg - = xConfigProvider->createInstanceWithArguments(u"com.sun.star.configuration.ConfigurationAccess", - params); - - maNotifier = css::uno::Reference< css::util::XChangesNotifier >(xCfg, css::uno::UNO_QUERY); - assert(maNotifier.is()); - maListener = css::uno::Reference< ConfigurationChangesListener >(new ConfigurationChangesListener(*this)); - maNotifier->addChangesListener(maListener); - } - catch(const css::uno::Exception&) - { - assert(false); - } -} + access_(css::configuration::ReadWriteAccess::create(context_, "*")) +{} -comphelper::detail::ConfigurationWrapper::~ConfigurationWrapper() -{ - maPropertyCache.clear(); - maNotifier.clear(); - maListener.clear(); -} +comphelper::detail::ConfigurationWrapper::~ConfigurationWrapper() {} bool comphelper::detail::ConfigurationWrapper::isReadOnly(OUString const & path) const @@ -176,26 +122,31 @@ bool comphelper::detail::ConfigurationWrapper::isReadOnly(OUString const & path) != 0; } -css::uno::Any comphelper::detail::ConfigurationWrapper::getPropertyValue(OUString const& path) const +css::uno::Any comphelper::detail::ConfigurationWrapper::getPropertyValue(std::u16string_view path) const { - std::scoped_lock aGuard(maMutex); - if (mbDisposed) - throw css::lang::DisposedException(); // Cache the configuration access, since some of the keys are used in hot code. - auto it = maPropertyCache.find(path); - if( it != maPropertyCache.end()) - return it->second; + // Note that this cache is only used by the officecfg:: auto-generated code, using it for anything + // else would be unwise because the cache could end up containing stale entries. + static std::mutex gMutex; + static std::map<OUString, css::uno::Reference< css::container::XNameAccess >> gAccessMap; - sal_Int32 idx = path.lastIndexOf("/"); + sal_Int32 idx = path.rfind('/'); assert(idx!=-1); - OUString parentPath = path.copy(0, idx); - OUString childName = path.copy(idx+1); - - css::uno::Reference<css::container::XNameAccess> access( - access_->getByHierarchicalName(parentPath), css::uno::UNO_QUERY_THROW); - css::uno::Any property = access->getByName(childName); - maPropertyCache.emplace(path, property); - return property; + OUString parentPath(path.substr(0, idx)); + OUString childName(path.substr(idx+1)); + + std::scoped_lock aGuard(gMutex); + + // check cache + auto it = gAccessMap.find(parentPath); + if (it == gAccessMap.end()) + { + // not in the cache, look it up + css::uno::Reference<css::container::XNameAccess> access( + access_->getByHierarchicalName(parentPath), css::uno::UNO_QUERY_THROW); + it = gAccessMap.emplace(parentPath, access).first; + } + return it->second->getByName(childName); } void comphelper::detail::ConfigurationWrapper::setPropertyValue( diff --git a/include/comphelper/configuration.hxx b/include/comphelper/configuration.hxx index 45228b700944..222b9d5af124 100644 --- a/include/comphelper/configuration.hxx +++ b/include/comphelper/configuration.hxx @@ -12,16 +12,15 @@ #include <sal/config.h> +#include <optional> +#include <string_view> + #include <com/sun/star/uno/Any.hxx> #include <com/sun/star/uno/Reference.h> #include <comphelper/comphelperdllapi.h> #include <comphelper/processfactory.hxx> #include <sal/types.h> #include <memory> -#include <mutex> -#include <optional> -#include <string_view> -#include <unordered_map> namespace com::sun::star { namespace configuration { class XReadWriteAccess; } @@ -32,10 +31,6 @@ namespace com::sun::star { class XNameContainer; } namespace uno { class XComponentContext; } - namespace util { - class XChangesListener; - class XChangesNotifier; - } } namespace comphelper { @@ -85,17 +80,14 @@ private: namespace detail { -class ConfigurationChangesListener; - /// @internal class COMPHELPER_DLLPUBLIC ConfigurationWrapper { -friend class ConfigurationChangesListener; public: static ConfigurationWrapper const & get(); bool isReadOnly(OUString const & path) const; - css::uno::Any getPropertyValue(OUString const & path) const; + css::uno::Any getPropertyValue(std::u16string_view path) const; static void setPropertyValue( std::shared_ptr< ConfigurationChanges > const & batch, @@ -143,12 +135,6 @@ private: // css.beans.XHierarchicalPropertySetInfo), but then // configmgr::Access::asProperty() would report all properties as // READONLY, so isReadOnly() would not work - - mutable std::mutex maMutex; - bool mbDisposed; - mutable std::unordered_map<OUString, css::uno::Any> maPropertyCache; - css::uno::Reference< css::util::XChangesNotifier > maNotifier; - css::uno::Reference< css::util::XChangesListener > maListener; }; /// @internal commit 44e7c3f0d113cc19be4acbd815e319be5b8cbfb5 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Sat Dec 17 13:18:59 2022 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:52 2023 +0100 tdf#151627 + tdf#152559: blacklist Nvidia device id="0x1402" Change-Id: I37430b38cd8d5daaca39b783c59bc10cd571c552 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144377 Reviewed-by: Julien Nabet <serval2...@yahoo.fr> (cherry picked from commit f7b94d7ffd785470962e73408f6fd7f7728f8ec5) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144367 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> diff --git a/vcl/skia/skia_denylist_vulkan.xml b/vcl/skia/skia_denylist_vulkan.xml index 8170f60febcc..5ac2c426594c 100644 --- a/vcl/skia/skia_denylist_vulkan.xml +++ b/vcl/skia/skia_denylist_vulkan.xml @@ -42,6 +42,9 @@ <entry os="windows" vendor="nvidia"> <!-- tdf#150232 --> <device id="0x1401"/> </entry> + <entry os="windows" vendor="nvidia"> <!-- tdf#151627 + tdf#152559 --> + <device id="0x1402"/> + </entry> <entry os="7" vendor="all"> <device id="all"/> </entry> commit 3e985421317d88118994ae490139f98db0d1bfd9 Author: Julien Nabet <serval2...@yahoo.fr> AuthorDate: Wed Feb 1 12:10:13 2023 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:52 2023 +0100 Related tdf#153272: add some missing properties in SwSearchProperties RES_PARATR_ORPHANS RES_PARATR_WIDOWS Change-Id: Ied760289e1ef8d60602991e5cdc0c743a31fd236 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146435 Tested-by: Jenkins Reviewed-by: Julien Nabet <serval2...@yahoo.fr> (cherry picked from commit 52ebc632b3cfa122dcb178cf28d8dbc7c7c57007) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146525 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> diff --git a/sw/source/core/unocore/unosrch.cxx b/sw/source/core/unocore/unosrch.cxx index 646d5955ba90..fe35dba300be 100644 --- a/sw/source/core/unocore/unosrch.cxx +++ b/sw/source/core/unocore/unosrch.cxx @@ -144,7 +144,9 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) pCharReliefItem, pCharRotate, pCharScaleWidth, - pParaVertAlign; + pParaVertAlign, + pParaOrphans, + pParaWidows; auto funcClone = [&rSet](sal_uInt16 nWID, std::unique_ptr<SfxPoolItem> & rpPoolItem) { @@ -314,6 +316,12 @@ void SwSearchProperties_Impl::FillItemSet(SfxItemSet& rSet, bool bIsValueSearch) case RES_PARATR_VERTALIGN: pTempItem = funcClone(nWID, pParaVertAlign); break; + case RES_PARATR_ORPHANS: + pTempItem = funcClone(nWID, pParaOrphans); + break; + case RES_PARATR_WIDOWS: + pTempItem = funcClone(nWID, pParaWidows); + break; } if(pTempItem) { commit 7dca48d3418b72977b677b4aac99d285638a1230 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Wed Feb 1 19:59:25 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:52 2023 +0100 leader of group should default to active Change-Id: I1c49b227e63f01ffdd1c3b427ef780ea38a6d1ba Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146409 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sd/uiconfig/simpress/ui/pmsummarypage.ui b/sd/uiconfig/simpress/ui/pmsummarypage.ui index 51ec684ac6b6..112b25447c75 100644 --- a/sd/uiconfig/simpress/ui/pmsummarypage.ui +++ b/sd/uiconfig/simpress/ui/pmsummarypage.ui @@ -66,6 +66,7 @@ <property name="receives-default">False</property> <property name="use-underline">True</property> <property name="draw-indicator">True</property> + <property name="active">True</property> </object> <packing> <property name="left-attach">0</property> commit 6de692511bcb7e16fb143a23e6032f5db39f86fa Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Fri Feb 3 16:18:35 2023 +0000 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Thu Feb 9 11:20:31 2023 +0100 Resolves: tdf#153353 formula bar border area bg didn't change on theme change Change-Id: I720054d540a6352b8248aa59e231878c1832d998 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146521 Tested-by: Jenkins Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 039d5b97ffa1..0f159ad0b4c6 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -850,14 +850,8 @@ ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, ScTabViewShell* pViewSh) { InitControlBase(m_xContainer.get()); - const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); - SetPaintTransparent(false); - SetBackground(rStyleSettings.GetFaceColor()); - - // match to bg used in ScTextWnd::SetDrawingArea to the margin area is drawn with the - // same desired bg - mxBackground->set_background(rStyleSettings.GetWindowColor()); + SetBackgrounds(); mxButtonUp->connect_clicked(LINK(this, ScInputBarGroup, ClickHdl)); mxButtonDown->connect_clicked(LINK(this, ScInputBarGroup, ClickHdl)); @@ -878,6 +872,25 @@ ScInputBarGroup::ScInputBarGroup(vcl::Window* pParent, ScTabViewShell* pViewSh) mxButtonDown->show(); } +void ScInputBarGroup::SetBackgrounds() +{ + const StyleSettings& rStyleSettings = Application::GetSettings().GetStyleSettings(); + SetBackground(rStyleSettings.GetFaceColor()); + // match to bg used in ScTextWnd::SetDrawingArea to the margin area is drawn with the + // same desired bg + mxBackground->set_background(rStyleSettings.GetWindowColor()); +} + +void ScInputBarGroup::DataChanged(const DataChangedEvent& rDCEvt) +{ + InterimItemWindow::DataChanged(rDCEvt); + if ((rDCEvt.GetType() == DataChangedEventType::SETTINGS) && (rDCEvt.GetFlags() & AllSettingsFlags::STYLE)) + { + SetBackgrounds(); + Invalidate(); + } +} + Point ScInputBarGroup::GetCursorScreenPixelPos(bool bBelow) { return mxTextWndGroup->GetCursorScreenPixelPos(bBelow); diff --git a/sc/source/ui/inc/inputwin.hxx b/sc/source/ui/inc/inputwin.hxx index ac96062af137..e8e63855ffd6 100644 --- a/sc/source/ui/inc/inputwin.hxx +++ b/sc/source/ui/inc/inputwin.hxx @@ -252,6 +252,7 @@ public: virtual bool HasEditView() const override; Point GetCursorScreenPixelPos(bool bBelowLine); virtual void Resize() override; + virtual void DataChanged(const DataChangedEvent& rDCEvt) override; virtual const OUString& GetTextString() const override; virtual void StopEditEngine(bool bAll) override; virtual void TextGrabFocus() override; @@ -272,6 +273,7 @@ public: private: void TriggerToolboxLayout(); + void SetBackgrounds(); std::unique_ptr<weld::Container> mxBackground; std::unique_ptr<ScTextWndGroup> mxTextWndGroup;