editeng/source/uno/unoipset.cxx | 2 editeng/source/uno/unotext.cxx | 6 include/editeng/unoipset.hxx | 2 include/editeng/unotext.hxx | 2 include/svl/itemprop.hxx | 18 + linguistic/source/lngopt.cxx | 2 reportdesign/source/ui/misc/UITools.cxx | 6 sc/inc/optuno.hxx | 4 sc/inc/styleuno.hxx | 10 sc/source/ui/unoobj/optuno.cxx | 4 sc/source/ui/unoobj/styleuno.cxx | 10 sc/source/ui/view/viewfunc.cxx | 3 sd/inc/stlsheet.hxx | 2 sd/source/core/stlsheet.cxx | 2 sd/source/ui/unoidl/unopage.cxx | 3 sd/source/ui/unoidl/unopback.cxx | 5 sd/source/ui/unoidl/unopback.hxx | 2 svl/source/items/itemprop.cxx | 26 +- svx/source/unodraw/unoshape.cxx | 6 sw/inc/unocrsrhelper.hxx | 6 sw/qa/extras/layout/data/table-in-section-split-loop.fodt | 161 ++++++++++++++ sw/qa/extras/layout/layout.cxx | 21 + sw/qa/extras/unowriter/data/hyperlink.fodt | 9 sw/qa/extras/unowriter/unowriter.cxx | 105 +++++++++ sw/source/core/access/accpara.cxx | 6 sw/source/core/docnode/node2lay.cxx | 7 sw/source/core/inc/layouter.hxx | 1 sw/source/core/layout/layact.cxx | 24 +- sw/source/core/layout/layouter.cxx | 14 + sw/source/core/layout/wsfrm.cxx | 24 ++ sw/source/core/unocore/unocrsrhelper.cxx | 3 sw/source/core/unocore/unofield.cxx | 2 sw/source/core/unocore/unoobj.cxx | 6 sw/source/core/unocore/unostyle.cxx | 5 sw/source/uibase/wrtsh/wrtsh2.cxx | 11 35 files changed, 440 insertions(+), 80 deletions(-)
New commits: commit 339f3173e09434fdc49046cc2277b864167dedd3 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Jan 29 20:43:58 2025 +0500 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Thu Jan 30 09:24:00 2025 +0100 tdf#164885: use SfxBindings::Execute instead of SfxDispatcher::ExecuteList Commit 502f7958d99e3aa27f4c1c1f33f4827055459da8 (pass a frame to use as parent for any dialog that may need to appear, 2023-11-16) switched to SfxDispatcher::ExecuteList, in order to pass there frame to be used as parent for dialogs. Later, in commit d7b33b1be8fee684e906f170f4001735c095056e (use SID_DOCFRAME for dialog parents if there is no SID_FILLFRAME, 2023-11-23), the fix was changed, and passing the frame got not needed. Since the change to SfxDispatcher::ExecuteList caused the regression (likely because SfxDispatcher unexpectedly uses a bit different method to find the slot server), and the original reason for the change is no more actual, let's revert to the older method. Change-Id: I6b126bf336dcf8cd3f49a3ce9682f3adc3bc208f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180909 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins (cherry picked from commit 0e9785ef0a3f0c350f8e719d2062f1c7beb801ad) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180922 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/sw/qa/extras/unowriter/data/hyperlink.fodt b/sw/qa/extras/unowriter/data/hyperlink.fodt new file mode 100644 index 000000000000..d3d73c750d15 --- /dev/null +++ b/sw/qa/extras/unowriter/data/hyperlink.fodt @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:body> + <office:text> + <text:p>A <text:a xlink:type="simple" xlink:href="https://www.libreoffice.org/" text:style-name="Internet_20_link" text:visited-style-name="Visited_20_Internet_20_Link">hyperlink</text:a> here.</text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/unowriter/unowriter.cxx b/sw/qa/extras/unowriter/unowriter.cxx index 51bd211a0a87..abcda606ec69 100644 --- a/sw/qa/extras/unowriter/unowriter.cxx +++ b/sw/qa/extras/unowriter/unowriter.cxx @@ -12,6 +12,9 @@ #include <com/sun/star/awt/FontSlant.hpp> #include <com/sun/star/datatransfer/XTransferableSupplier.hpp> #include <com/sun/star/datatransfer/XTransferableTextSupplier.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/frame/XDispatchProviderInterception.hpp> +#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp> #include <com/sun/star/table/XCellRange.hpp> #include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/text/AutoTextContainer.hpp> @@ -43,6 +46,7 @@ #include <comphelper/sequenceashashmap.hxx> #include <comphelper/processfactory.hxx> #include <comphelper/propertysequence.hxx> +#include <comphelper/compbase.hxx> #include <wrtsh.hxx> #include <ndtxt.hxx> @@ -1411,6 +1415,107 @@ CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf162480) CPPUNIT_ASSERT_EQUAL(xCellText, xAnchorRange->getText()); } +CPPUNIT_TEST_FIXTURE(SwUnoWriter, testTdf164885) +{ + class LocalDispatch : public comphelper::WeakImplHelper<css::frame::XDispatch> + { + public: + LocalDispatch() = default; + + void SAL_CALL dispatch(const css::util::URL& URL, + const css::uno::Sequence<css::beans::PropertyValue>&) override + { + sLastCommand = URL.Complete; + } + void SAL_CALL addStatusListener(const css::uno::Reference<css::frame::XStatusListener>&, + const css::util::URL&) override + { + // empty + } + void SAL_CALL removeStatusListener(const css::uno::Reference<css::frame::XStatusListener>&, + const css::util::URL&) override + { + // empty + } + + OUString sLastCommand; + }; + + class LocalInterceptor + : public comphelper::WeakImplHelper<css::frame::XDispatchProviderInterceptor> + { + public: + LocalInterceptor() = default; + + // XDispatchProvider + css::uno::Reference<css::frame::XDispatch> + SAL_CALL queryDispatch(const css::util::URL& URL, const OUString& TargetFrameName, + sal_Int32 SearchFlags) override + { + if (URL.Complete == ".uno:Open") + return pDispatch; + if (m_slave) + return m_slave->queryDispatch(URL, TargetFrameName, SearchFlags); + return {}; + } + css::uno::Sequence<css::uno::Reference<css::frame::XDispatch>> SAL_CALL + queryDispatches(const css::uno::Sequence<css::frame::DispatchDescriptor>&) override + { + return {}; + } + + // XDispatchProviderInterceptor + css::uno::Reference<css::frame::XDispatchProvider> + SAL_CALL getSlaveDispatchProvider() override + { + return m_slave; + } + void SAL_CALL setSlaveDispatchProvider( + const css::uno::Reference<css::frame::XDispatchProvider>& val) override + { + m_slave = val; + } + css::uno::Reference<css::frame::XDispatchProvider> + SAL_CALL getMasterDispatchProvider() override + { + return m_master; + } + void SAL_CALL setMasterDispatchProvider( + const css::uno::Reference<css::frame::XDispatchProvider>& val) override + { + m_master = val; + } + + rtl::Reference<LocalDispatch> pDispatch{ new LocalDispatch }; + + private: + css::uno::Reference<css::frame::XDispatchProvider> m_master; + css::uno::Reference<css::frame::XDispatchProvider> m_slave; + }; + + // Given a document with a hyperlink + createSwDoc("hyperlink.fodt"); + auto controller(mxComponent.queryThrow<frame::XModel>()->getCurrentController()); + auto xProvider(controller->getFrame().queryThrow<css::frame::XDispatchProviderInterception>()); + + rtl::Reference<LocalInterceptor> interceptor(new LocalInterceptor); + xProvider->registerDispatchProviderInterceptor(interceptor); + + auto xCursor = controller.queryThrow<text::XTextViewCursorSupplier>()->getViewCursor(); + xCursor->goRight(5, false); // put cursor inside the hyperlink + + // Initiale "open hyperlink" + dispatchCommand(mxComponent, u".uno:OpenHyperlinkOnCursor"_ustr, {}); + + xProvider->releaseDispatchProviderInterceptor(interceptor); + + // Without the fix, this failed with + // - Expected: .uno:Open + // - Actual : + // because the interception didn't happen + CPPUNIT_ASSERT_EQUAL(u".uno:Open"_ustr, interceptor->pDispatch->sLastCommand); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index c7f8e2eb6182..12f04b8d3f8b 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -602,15 +602,16 @@ static void LoadURL(SwView& rView, const OUString& rURL, LoadUrlFlags nFilter, if ((nFilter & LoadUrlFlags::NewView) && !comphelper::LibreOfficeKit::isActive()) aTargetFrameName.SetValue( u"_blank"_ustr ); - rViewFrame.GetDispatcher()->ExecuteList(SID_OPENDOC, - SfxCallMode::ASYNCHRON|SfxCallMode::RECORD, - { + const SfxPoolItem* aArr[] = { &aName, &aNewView, /*&aSilent,*/ &aReferer, &aView, &aTargetFrameName, - &aBrowse - }); + &aBrowse, + nullptr + }; + rViewFrame.GetDispatcher()->GetBindings()->Execute( + SID_OPENDOC, aArr, SfxCallMode::ASYNCHRON | SfxCallMode::RECORD); } void LoadURL( SwViewShell& rVSh, const OUString& rURL, LoadUrlFlags nFilter, commit a306549cd72c8a3d0435d08d81b1588c8bb7eb41 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Wed Jan 29 17:36:41 2025 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Thu Jan 30 02:35:14 2025 +0100 tdf#156348 sw: fix crash on converting text to table with SwSetExpField The problem is that the table node only gets a SwFrameFormat assigned at the end of the operation after all the nodes have been split etc., and moving a field into a newly split node calls sw::FindNeighbourFrameForNode() which needs to handle table node without SwFrameFormat now when going backwards (not when going forwards because the table node is always before the nodes in the table). (regression from commit 9dc6e2c9062725ef1f9d7e321cae5f4dbe8ca749) Change-Id: Ia0c1f7d7b14f525aa8de4a2b6492c39b59f31052 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180914 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> Tested-by: Jenkins (cherry picked from commit b5967157b37904219865fd847b20938b3ccfbd72) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180918 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/source/core/docnode/node2lay.cxx b/sw/source/core/docnode/node2lay.cxx index 312ce2dff440..3efaea7f08ff 100644 --- a/sw/source/core/docnode/node2lay.cxx +++ b/sw/source/core/docnode/node2lay.cxx @@ -115,7 +115,12 @@ static SwNode* GoPreviousWithFrame(SwNodeIndex *pIdx, SwFlowFrame const**const p // frame as the caller's one pFound = SwIterator<SwFrame, SwContentNode, sw::IteratorMode::UnwrapMulti>(*static_cast<SwContentNode*>(pNd)).First(); else if ( pNd->IsTableNode() ) - pFound = SwIterator<SwFrame,SwFormat>(*static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat()).First(); + { + if (SwFrameFormat *const pFormat{static_cast<SwTableNode*>(pNd)->GetTable().GetFrameFormat()}) + { + pFound = SwIterator<SwFrame,SwFormat>(*pFormat).First(); + } + } else if( pNd->IsStartNode() && !pNd->IsSectionNode() ) { pNd = nullptr; commit 1d61a66a95a4261229bc6ffa9a701675ef9d9a73 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Tue Jan 28 18:10:55 2025 +0100 Commit: Adolfo Jayme Barrientos <fit...@ubuntu.com> CommitDate: Thu Jan 30 02:34:45 2025 +0100 sw: layout: fix loop with table at the end of a section There is a table alone in a section, and there are 2 rows in the table, with the 2nd row split across page 1 and page 2. Due to space for another line of text being available, the table frame first does RemoveFollowFlowLine() etc and grows much higher than the section frame upper. Then in SwTabFrame::Join(), the section frame on page 2 is destroyed via SwSectionFrame::DelEmpty() so the section frame on page 1 doesn't have a follow. Then a SwTabFrame::Split() happens, and lcl_ShrinkCellsAndAllContent() ends up shrinking the section frame to 0 height (because there is no follow currently seen by SwSectionFrame::ToMaximize()), which is wrong as there is a 1st row in the table, so the table is still height 3712. If the table is directly in the body, then this works because the body frame doesn't shrink or grow. Then when the text frame in the 2nd row is formatted, it can't grow because SetRestrictTableGrowth(true) was called as a follow flow line exists, and in SwTabFrame::GrowFrame() nReal is -2777 due to the SwTabFrame being higher than the upper; the result is that the text frame is the same height/split at the same line as before SwTabFrame::MakeAll(). Then the whole thing happens again until eventually warn:sw.layout:875613:875613:sw/source/core/layout/layouter.cxx:194: Looping Louie: Stage 1! Try to detect situation of too high table in section and propagate Shrink only until the section is the same height as the table. Change-Id: If4b6db8b03d93a3227ad223203f2b0c3f73d3cc8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180857 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit f747378c4d5c3b2af0dc6ed2dc8cdbd2c4bf09c9) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180906 Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com> diff --git a/sw/qa/extras/layout/data/table-in-section-split-loop.fodt b/sw/qa/extras/layout/data/table-in-section-split-loop.fodt new file mode 100644 index 000000000000..c56254aba03a --- /dev/null +++ b/sw/qa/extras/layout/data/table-in-section-split-loop.fodt @@ -0,0 +1,161 @@ +<?xml version='1.0' encoding='UTF-8'?> +<office:document xmlns:css3t="http://www.w3.org/TR/css3-text/" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:c alcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:rpt="http://openoffice.org/2005/report" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns: meta:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" office:version="1.4" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:initial-creator>gcc</meta:initial-creator><meta:creation-date>2025-01-28T13:52:39.048482856</meta:creation-date><dc:date>2025-01-28T14:44:09.682881525</dc:date><dc:creator>gcc</dc:creator><meta:editing-duration>PT12M50S</meta:editing-duration><meta:editing-cycles>7</meta:editing-cycles><meta:generator>LibreOfficeDev/25.8.0.0.alpha0$Linux_X86_64 LibreOffice_project/4b681ded88231674d8b7c133dd211f3c024a7118</meta:generator><meta:document-statistic meta:table-count="1" meta:image-count="0" meta:object-count="0" meta:page-count="2" meta:paragraph-count="2" meta:word-count="157" meta:character-count="834" meta:non-whitespace-character-count="663"/></office:meta> + <office:font-face-decls> + <style:font-face style:name="Liberation Serif" svg:font-family="'Liberation Serif'" style:font-family-generic="roman" style:font-pitch="variable"/> + <style:font-face style:name="Lucida Sans1" svg:font-family="'Lucida Sans'" style:font-family-generic="system" style:font-pitch="variable"/> + <style:font-face style:name="Noto Serif CJK SC" svg:font-family="'Noto Serif CJK SC'" style:font-family-generic="system" style:font-pitch="variable"/> + </office:font-face-decls> + <office:styles> + <style:default-style style:family="graphic"> + <style:graphic-properties svg:stroke-color="#3465a4" draw:fill-color="#729fcf" fo:wrap-option="no-wrap" draw:shadow-offset-x="0.3cm" draw:shadow-offset-y="0.3cm" draw:start-line-spacing-horizontal="0.283cm" draw:start-line-spacing-vertical="0.283cm" draw:end-line-spacing-horizontal="0.283cm" draw:end-line-spacing-vertical="0.283cm" style:writing-mode="lr-tb" style:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" loext:tab-stop-distance="0cm" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN"/> + </style:default-style> + <style:default-style style:family="paragraph"> + <style:paragraph-properties fo:orphans="2" fo:widows="2" fo:hyphenation-ladder-count="no-limit" fo:hyphenation-keep="auto" loext:hyphenation-keep-type="column" style:text-autospace="ideograph-alpha" style:punctuation-wrap="hanging" style:line-break="strict" style:tab-stop-distance="1.251cm" style:writing-mode="page"/> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" style:font-name="Liberation Serif" fo:font-size="12pt" fo:language="de" fo:country="DE" style:letter-kerning="true" style:font-name-asian="Noto Serif CJK SC" style:font-size-asian="10.5pt" style:language-asian="zh" style:country-asian="CN" style:font-name-complex="Lucida Sans1" style:font-size-complex="12pt" style:language-complex="hi" style:country-complex="IN" fo:hyphenate="false" fo:hyphenation-remain-char-count="2" fo:hyphenation-push-char-count="2" loext:hyphenation-no-caps="false" loext:hyphenation-no-last-word="false" loext:hyphenation-word-char-count="5" loext:hyphenation-zone="no-limit"/> + </style:default-style> + <style:default-style style:family="table"> + <style:table-properties table:border-model="collapsing"/> + </style:default-style> + <style:default-style style:family="table-row"> + <style:table-row-properties fo:keep-together="auto"/> + </style:default-style> + <style:style style:name="Standard" style:family="paragraph" style:class="text"/> + <style:style style:name="Table_20_Contents" style:display-name="Table Contents" style:family="paragraph" style:parent-style-name="Standard" style:class="extra"> + <style:paragraph-properties fo:orphans="0" fo:widows="0" text:number-lines="false" text:line-number="0"/> + </style:style> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="1" loext:num-list-format="%1%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="2" loext:num-list-format="%2%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="3" loext:num-list-format="%3%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="4" loext:num-list-format="%4%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="5" loext:num-list-format="%5%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="6" loext:num-list-format="%6%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="7" loext:num-list-format="%7%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="8" loext:num-list-format="%8%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="9" loext:num-list-format="%9%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + <text:outline-level-style text:level="10" loext:num-list-format="%10%" style:num-format=""> + <style:list-level-properties text:list-level-position-and-space-mode="label-alignment"> + <style:list-level-label-alignment text:label-followed-by="listtab"/> + </style:list-level-properties> + </text:outline-level-style> + </text:outline-style> + <text:notes-configuration text:note-class="footnote" style:num-format="1" text:start-value="0" text:footnotes-position="page" text:start-numbering-at="document"/> + <text:notes-configuration text:note-class="endnote" style:num-format="i" text:start-value="0"/> + <text:linenumbering-configuration text:number-lines="false" text:offset="0.499cm" style:num-format="1" text:number-position="left" text:increment="5"/> + </office:styles> + <office:automatic-styles> + <style:style style:name="Table1" style:family="table"> + <style:table-properties style:width="6.5cm" table:align="margins"/> + </style:style> + <style:style style:name="Table1.A" style:family="table-column"> + <style:table-column-properties style:column-width="6.5cm" style:rel-column-width="65535*"/> + </style:style> + <style:style style:name="Table1.1" style:family="table-row"> + <style:table-row-properties style:min-row-height="0.002cm"/> + </style:style> + <style:style style:name="Table1.A1" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="0.5pt solid #000000" fo:border-bottom="none"/> + </style:style> + <style:style style:name="Table1.2" style:family="table-row"> + <style:table-row-properties style:min-row-height="1.644cm"/> + </style:style> + <style:style style:name="Table1.A2" style:family="table-cell"> + <style:table-cell-properties fo:padding="0.097cm" fo:border-left="0.5pt solid #000000" fo:border-right="0.5pt solid #000000" fo:border-top="none" fo:border-bottom="0.5pt solid #000000"/> + </style:style> + <style:style style:name="P1" style:family="paragraph" style:parent-style-name="Table_20_Contents"> + <style:text-properties/> + </style:style> + <style:style style:name="P2" style:family="paragraph" style:parent-style-name="Table_20_Contents"> + <style:text-properties/> + </style:style> + <style:style style:name="Sect1" style:family="section"> + <style:section-properties fo:background-color="#158466" text:dont-balance-text-columns="false" style:editable="false"> + <style:columns fo:column-count="1" fo:column-gap="0cm"/> + <style:background-image/> + </style:section-properties> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="10.5cm" fo:page-height="14.801cm" style:num-format="1" style:print-orientation="portrait" fo:margin-top="2cm" fo:margin-bottom="2cm" fo:margin-left="2cm" fo:margin-right="2cm" style:writing-mode="lr-tb" style:layout-grid-color="#c0c0c0" style:layout-grid-lines="20" style:layout-grid-base-height="0.706cm" style:layout-grid-ruby-height="0.353cm" style:layout-grid-mode="none" style:layout-grid-ruby-below="false" style:layout-grid-print="false" style:layout-grid-display="false" style:footnote-max-height="0cm" loext:margin-gutter="0cm"> + <style:footnote-sep style:width="0.018cm" style:distance-before-sep="0.101cm" style:distance-after-sep="0.101cm" style:line-style="solid" style:adjustment="left" style:rel-width="25%" style:color="#000000"/> + </style:page-layout-properties> + <style:header-style/> + <style:footer-style/> + </style:page-layout> + <style:style style:name="dp1" style:family="drawing-page"> + <style:drawing-page-properties draw:background-size="full"/> + </style:style> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1" draw:style-name="dp1"/> + </office:master-styles> + <office:body> + <office:text text:use-soft-page-breaks="true"> + <text:sequence-decls> + <text:sequence-decl text:display-outline-level="0" text:name="Illustration"/> + <text:sequence-decl text:display-outline-level="0" text:name="Table"/> + <text:sequence-decl text:display-outline-level="0" text:name="Text"/> + <text:sequence-decl text:display-outline-level="0" text:name="Drawing"/> + <text:sequence-decl text:display-outline-level="0" text:name="Figure"/> + </text:sequence-decls> + <text:p text:style-name="Standard"/> + <text:p text:style-name="Standard"/> + <text:section text:style-name="Sect1" text:name="Section1"> + <table:table table:name="Table1" table:style-name="Table1"> + <table:table-column table:style-name="Table1.A"/> + <table:table-row table:style-name="Table1.1"> + <table:table-cell table:style-name="Table1.A1" office:value-type="string"> + <text:p text:style-name="P1">There<text:line-break/> is<text:line-break/> quite<text:line-break/> some<text:line-break/> text<text:line-break/> here<text:line-break/> to<text:line-break/> take<text:line-break/> up<text:line-break/> some<text:line-break/> but<text:line-break/> not<text:line-break/> all<text:line-break/> of<text:line-break/> the<text:line-break/> available<text:line-break/> space</text:p> + </table:table-cell> + </table:table-row> + <table:table-row table:style-name="Table1.2"> + <table:table-cell table:style-name="Table1.A2" office:value-type="string"> + <text:p text:style-name="P2">He heard quiet steps behind him. That didn't bode well. Who could be <text:soft-page-break/>following him this late at night and in this deadbeat part of town? And at this particular moment, just after he pulled off the big time and was making off with the greenbacks. Was there another crook who'd had the same idea, and was now watching him and waiting for a chance to grab the fruit of his labor? Or did the steps behind him mean that one of many law officers in town was on to him and just waiting to pounce and snap those cuffs on his wrists? He nervously looked all around. Suddenly he saw the alley. Like lightning he darted off to the left and disappeared between the two warehouses almost falling over the trash can lying in the middle of the sidewalk.</text:p> + </table:table-cell> + </table:table-row> + </table:table> + </text:section> + <text:p text:style-name="Standard"/> + </office:text> + </office:body> +</office:document> diff --git a/sw/qa/extras/layout/layout.cxx b/sw/qa/extras/layout/layout.cxx index d0f31b59ced7..838ab2b5b760 100644 --- a/sw/qa/extras/layout/layout.cxx +++ b/sw/qa/extras/layout/layout.cxx @@ -8,10 +8,14 @@ */ #include <swmodeltestbase.hxx> + +#include <osl/process.h> +#include <comphelper/scopeguard.hxx> #include <comphelper/propertysequence.hxx> #include <vcl/scheduler.hxx> #include <svx/svddef.hxx> +#include <layouter.hxx> #include <fmtanchr.hxx> #include <fmtfsize.hxx> #include <fmtcntnt.hxx> @@ -318,6 +322,23 @@ CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableSplitBug) } } +CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testTableInSectionSplitLoop) +{ + createSwDoc("table-in-section-split-loop.fodt"); + + static OUString constexpr var{ u"TEST_NO_LOOP_CONTROLS"_ustr }; + osl_setEnvironment(var.pData, u"1"_ustr.pData); + comphelper::ScopeGuard g([] { osl_clearEnvironment(var.pData); }); + + CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage()); + + SwWrtShell* pWrtShell = getSwDocShell()->GetWrtShell(); + pWrtShell->Right(SwCursorSkipMode::Chars, /*bSelect=*/true, 1, /*bBasicCall=*/false); + pWrtShell->Delete(); + + CPPUNIT_ASSERT_EQUAL(0, SwLayouter::GetLastLoopControlStage()); +} + CPPUNIT_TEST_FIXTURE(SwLayoutWriter, testRedlineFlysInBody) { createSwDoc(); diff --git a/sw/source/core/inc/layouter.hxx b/sw/source/core/inc/layouter.hxx index a3979cf4670a..34d025843ccd 100644 --- a/sw/source/core/inc/layouter.hxx +++ b/sw/source/core/inc/layouter.hxx @@ -102,6 +102,7 @@ public: void LoopControl( SwPageFrame* pPage ); void EndLoopControl(); + SW_DLLPUBLIC static int GetLastLoopControlStage(); void LoopingLouieLight( const SwDoc& rDoc, const SwTextFrame& rFrame ); static void CollectEndnotes( SwDoc* pDoc, SwSectionFrame* pSect ); diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx index 98de8dc1370d..db71081a8e49 100644 --- a/sw/source/core/layout/layact.cxx +++ b/sw/source/core/layout/layact.cxx @@ -519,7 +519,11 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) // maximum number of loops like is done in the nested while loops. if (++nOuterLoopControlRuns > nOuterLoopControlMax) { - SAL_WARN("sw", "SwLayAction::InternalAction has run too many loops"); + SAL_WARN("sw.layout", "SwLayAction::InternalAction has run too many loops"); + if (::std::getenv("TEST_NO_LOOP_CONTROLS")) + { + throw std::exception{}; // => fail test + } m_bInterrupt = true; } @@ -594,7 +598,11 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( ++nLoopControlRuns_1 > nLoopControlMax ) { - OSL_FAIL( "LoopControl_1 in SwLayAction::InternalAction" ); + SAL_WARN("sw.layout", "LoopControl_1 in SwLayAction::InternalAction"); + if (::std::getenv("TEST_NO_LOOP_CONTROLS")) + { + throw std::exception{}; // => fail test + } break; } @@ -780,7 +788,11 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( ++nLoopControlRuns_3 > nLoopControlMax ) { - OSL_FAIL( "LoopControl_3 in Interrupt formatting in SwLayAction::InternalAction" ); + SAL_WARN("sw.layout", "LoopControl_3 in Interrupt formatting in SwLayAction::InternalAction"); + if (::std::getenv("TEST_NO_LOOP_CONTROLS")) + { + throw std::exception{}; // => fail test + } break; } @@ -799,7 +811,11 @@ void SwLayAction::InternalAction(OutputDevice* pRenderContext) if ( ++nLoopControlRuns_2 > nLoopControlMax ) { - OSL_FAIL( "LoopControl_2 in Interrupt formatting in SwLayAction::InternalAction" ); + SAL_WARN("sw.layout", "LoopControl_2 in Interrupt formatting in SwLayAction::InternalAction"); + if (::std::getenv("TEST_NO_LOOP_CONTROLS")) + { + throw std::exception{}; // => fail test + } break; } diff --git a/sw/source/core/layout/layouter.cxx b/sw/source/core/layout/layouter.cxx index 5bed8fcba2b5..a9dcd3a45e5d 100644 --- a/sw/source/core/layout/layouter.cxx +++ b/sw/source/core/layout/layouter.cxx @@ -34,11 +34,11 @@ class SwLooping { +public: sal_uInt16 mnMinPage; sal_uInt16 mnMaxPage; sal_uInt16 mnCount; sal_uInt16 mnLoopControlStage; -public: explicit SwLooping( SwPageFrame const * pPage ); void Control( SwPageFrame* pPage ); void Drastic( SwFrame* pFrame ); @@ -247,6 +247,14 @@ void SwLayouter::LoopingLouieLight( const SwDoc& rDoc, const SwTextFrame& rFrame } } +// this is just for tests +static int g_LastLoopControlStage; + +int SwLayouter::GetLastLoopControlStage() +{ + return g_LastLoopControlStage; +} + bool SwLayouter::StartLooping( SwPageFrame const * pPage ) { if( mpLooping ) @@ -257,6 +265,10 @@ bool SwLayouter::StartLooping( SwPageFrame const * pPage ) void SwLayouter::EndLoopControl() { + if (mpLooping) + { + g_LastLoopControlStage = mpLooping->mnLoopControlStage; + } mpLooping.reset(); } diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx index cef7c0c9d2dc..68ea98446e6b 100644 --- a/sw/source/core/layout/wsfrm.cxx +++ b/sw/source/core/layout/wsfrm.cxx @@ -3020,6 +3020,30 @@ SwTwips SwLayoutFrame::ShrinkFrame( SwTwips nDist, bool bTst, bool bInfo ) } } + // A table frame may have grown beyond its parent frame after + // RemoveFollowFlowLine(), which is a problem in case the parent is a + // section: prevent shrinking the section smaller than the contained + // table. + if (IsTabFrame() + && static_cast<SwTabFrame*>(this)->IsRebuildLastLine() + && pToShrink == GetUpper() + && pToShrink->IsSctFrame()) // not required for page body, unsure about others + { + SwTwips nUpperMin{0}; + for (SwFrame const* pFrame = pToShrink->GetLower(); + pFrame != GetNext(); pFrame = pFrame->GetNext()) + { + nUpperMin += aRectFnSet.GetHeight(pFrame->getFrameArea()); + } + if (aRectFnSet.GetHeight(pToShrink->getFramePrintArea()) - nShrink < nUpperMin) + { + nShrink = aRectFnSet.GetHeight(pToShrink->getFramePrintArea()) - nUpperMin; + if (nShrink <= 0) + { + return 0; // nothing to do + } + } + } nReal = pToShrink ? pToShrink->Shrink( nShrink, bTst, bInfo ) : 0; if( ( SwNeighbourAdjust::GrowAdjust == nAdjust || SwNeighbourAdjust::AdjustGrow == nAdjust ) && nReal < nShrink ) commit b37d2d5d5678bab83f19949d49c886e2d006d1f4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Wed Jan 29 15:26:07 2025 +0200 Commit: Xisco Fauli <xiscofa...@libreoffice.org> CommitDate: Wed Jan 29 17:08:35 2025 +0100 tdf#164900 table text in different columns no longer lined up Revert "tdf#161846 use unordered_map in SfxItemPropertyMap" This reverts commit c39978f41dccbeb2e973c919a67d9b1d974f8f3c. Change-Id: I26cadb32b426fd3b48179b67c677213a78b4999c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180903 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> (cherry picked from commit a8aa8d76dba4a32b1d082a87a188c3f0b1f666b4) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180907 Reviewed-by: Xisco Fauli <xiscofa...@libreoffice.org> diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx index 43cb71aa0a86..60d73b7653fb 100644 --- a/editeng/source/uno/unoipset.cxx +++ b/editeng/source/uno/unoipset.cxx @@ -209,7 +209,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertyMapEntry* pMap, } -const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(const OUString& rName) const +const SfxItemPropertyMapEntry* SvxItemPropertySet::getPropertyMapEntry(std::u16string_view rName) const { return m_aPropertyMap.getByName( rName ); } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 6f149cdc67e1..9a63a0776318 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -1058,7 +1058,7 @@ beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const SfxItemPropert throw beans::UnknownPropertyException(); } -beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(const OUString& PropertyName, sal_Int32 nPara /* = -1 */) +beans::PropertyState SvxUnoTextRangeBase::_getPropertyState(std::u16string_view PropertyName, sal_Int32 nPara /* = -1 */) { SolarMutexGuard aGuard; @@ -1364,9 +1364,9 @@ void SAL_CALL SvxUnoTextRangeBase::setAllPropertiesToDefault() if( pForwarder ) { - for (auto const & rPair : mpPropSet->getPropertyMap().getPropertyEntries()) + for (const SfxItemPropertyMapEntry* entry : mpPropSet->getPropertyMap().getPropertyEntries()) { - _setPropertyToDefault( pForwarder, rPair.second, -1 ); + _setPropertyToDefault( pForwarder, entry, -1 ); } } } diff --git a/include/editeng/unoipset.hxx b/include/editeng/unoipset.hxx index e1e84b8270ac..ee19177d92b3 100644 --- a/include/editeng/unoipset.hxx +++ b/include/editeng/unoipset.hxx @@ -53,7 +53,7 @@ public: rtl::Reference< SfxItemPropertySetInfo > const & getPropertySetInfo() const; const SfxItemPropertyMap& getPropertyMap() const { return m_aPropertyMap;} - const SfxItemPropertyMapEntry* getPropertyMapEntry(const OUString& rName) const; + const SfxItemPropertyMapEntry* getPropertyMapEntry(std::u16string_view rName) const; }; struct SvxIDPropertyCombine diff --git a/include/editeng/unotext.hxx b/include/editeng/unotext.hxx index 168b9ce063ee..f119c6c664aa 100644 --- a/include/editeng/unotext.hxx +++ b/include/editeng/unotext.hxx @@ -291,7 +291,7 @@ protected: SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const SfxItemPropertyMapEntry* pMap, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException - SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( const OUString& PropertyName, sal_Int32 nPara = -1 ); + SAL_DLLPRIVATE css::beans::PropertyState _getPropertyState( std::u16string_view PropertyName, sal_Int32 nPara = -1 ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyState > _getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName, sal_Int32 nPara = -1 ); diff --git a/include/svl/itemprop.hxx b/include/svl/itemprop.hxx index ff12f4060551..af48da4ed696 100644 --- a/include/svl/itemprop.hxx +++ b/include/svl/itemprop.hxx @@ -70,23 +70,29 @@ struct SfxItemPropertyMapEntry } }; +struct SfxItemPropertyMapCompare +{ + bool operator() ( const SfxItemPropertyMapEntry * lhs, const SfxItemPropertyMapEntry * rhs ) const + { + return lhs->aName < rhs->aName; + } +}; class SVL_DLLPUBLIC SfxItemPropertyMap { + o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare > m_aMap; + mutable css::uno::Sequence< css::beans::Property > m_aPropSeq; public: SfxItemPropertyMap( std::span<const SfxItemPropertyMapEntry> pEntries ); SfxItemPropertyMap( const SfxItemPropertyMap& rSource ); ~SfxItemPropertyMap(); - const SfxItemPropertyMapEntry* getByName( const OUString & rName ) const; + const SfxItemPropertyMapEntry* getByName( std::u16string_view rName ) const; css::uno::Sequence< css::beans::Property > const & getProperties() const; /// @throws css::beans::UnknownPropertyException css::beans::Property getPropertyByName( const OUString & rName ) const; - bool hasPropertyByName( const OUString & rName ) const; + bool hasPropertyByName( std::u16string_view rName ) const; - const std::unordered_map< OUString, const SfxItemPropertyMapEntry* >& getPropertyEntries() const { return m_aMap; } -private: - std::unordered_map< OUString, const SfxItemPropertyMapEntry* > m_aMap; - mutable css::uno::Sequence< css::beans::Property > m_aPropSeq; + const o3tl::sorted_vector< const SfxItemPropertyMapEntry*, SfxItemPropertyMapCompare >& getPropertyEntries() const { return m_aMap; } }; class SfxItemPropertySetInfo; diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index 6cee920595ab..6f70aae74724 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -308,7 +308,7 @@ Sequence< PropertyValue > SAL_CALL std::vector<PropertyValue> aProps; aProps.reserve(aPropertyMap.getPropertyEntries().size()); - for(auto const & [aName, pEntry] : aPropertyMap.getPropertyEntries()) + for(auto pEntry : aPropertyMap.getPropertyEntries()) aProps.push_back(PropertyValue(pEntry->aName, pEntry->nWID, aConfig.GetProperty(pEntry->nWID), css::beans::PropertyState_DIRECT_VALUE)); diff --git a/reportdesign/source/ui/misc/UITools.cxx b/reportdesign/source/ui/misc/UITools.cxx index ba51cb2ccc6a..d63a50e3ddb7 100644 --- a/reportdesign/source/ui/misc/UITools.cxx +++ b/reportdesign/source/ui/misc/UITools.cxx @@ -280,9 +280,8 @@ namespace uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto & rPair : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pProp = rPair.second; if ( xInfo->hasPropertyByName(pProp->aName) ) { const SfxPoolItem* pItem = _rItemSet.GetItem(pProp->nWID); @@ -301,9 +300,8 @@ namespace const uno::Reference< beans::XPropertySetInfo> xInfo = _xShape->getPropertySetInfo(); SvxUnoPropertyMapProvider aMap; const SfxItemPropertyMap& rPropertyMap = aMap.GetPropertySet(SVXMAP_CUSTOMSHAPE, SdrObject::GetGlobalDrawObjectItemPool())->getPropertyMap(); - for (const auto & rPair : rPropertyMap.getPropertyEntries()) + for (const auto pProp : rPropertyMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pProp = rPair.second; const SfxPoolItem* pItem = nullptr; if ( SfxItemState::SET == _rItemSet.GetItemState(pProp->nWID, true, &pItem) && xInfo->hasPropertyByName(pProp->aName) ) { diff --git a/sc/inc/optuno.hxx b/sc/inc/optuno.hxx index 6e28c6dad6cb..27b0c3d6dc56 100644 --- a/sc/inc/optuno.hxx +++ b/sc/inc/optuno.hxx @@ -40,12 +40,12 @@ class ScDocOptionsHelper public: static bool setPropertyValue( ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& rPropertyName, + std::u16string_view aPropertyName, const css::uno::Any& aValue ); static css::uno::Any getPropertyValue( const ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& rPropertyName ); + std::u16string_view PropertyName ); }; // empty doc object to supply only doc options diff --git a/sc/inc/styleuno.hxx b/sc/inc/styleuno.hxx index 550e712fe9fa..f524cf8bc615 100644 --- a/sc/inc/styleuno.hxx +++ b/sc/inc/styleuno.hxx @@ -169,21 +169,21 @@ private: OUString aStyleName; SfxStyleSheetBase* pStyle_cached; - const SfxItemSet* GetStyleItemSet_Impl( const OUString& rPropName, const SfxItemPropertyMapEntry*& rpEntry ); + const SfxItemSet* GetStyleItemSet_Impl( std::u16string_view rPropName, const SfxItemPropertyMapEntry*& rpEntry ); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException - css::beans::PropertyState getPropertyState_Impl( const OUString& PropertyName ); + css::beans::PropertyState getPropertyState_Impl( std::u16string_view PropertyName ); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException - css::uno::Any getPropertyDefault_Impl( const OUString& aPropertyName ); + css::uno::Any getPropertyDefault_Impl( std::u16string_view aPropertyName ); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException - css::uno::Any getPropertyValue_Impl( const OUString& aPropertyName ); + css::uno::Any getPropertyValue_Impl( std::u16string_view aPropertyName ); /// @throws css::lang::IllegalArgumentException /// @throws css::uno::RuntimeException - void setPropertyValue_Impl( const OUString& rPropertyName, + void setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertyMapEntry* pEntry, const css::uno::Any* pValue ); diff --git a/sc/source/ui/unoobj/optuno.cxx b/sc/source/ui/unoobj/optuno.cxx index 3d475f74ef8c..ce885684a254 100644 --- a/sc/source/ui/unoobj/optuno.cxx +++ b/sc/source/ui/unoobj/optuno.cxx @@ -30,7 +30,7 @@ using namespace com::sun::star; bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& aPropertyName, const uno::Any& aValue ) + std::u16string_view aPropertyName, const uno::Any& aValue ) { //! use map (with new identifiers) @@ -103,7 +103,7 @@ bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions, uno::Any ScDocOptionsHelper::getPropertyValue( const ScDocOptions& rOptions, const SfxItemPropertyMap& rPropMap, - const OUString& aPropertyName ) + std::u16string_view aPropertyName ) { uno::Any aRet; const SfxItemPropertyMapEntry* pEntry = rPropMap.getByName( aPropertyName ); diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 659a271a05e0..417fded19368 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -1161,7 +1161,7 @@ uno::Reference<container::XIndexReplace> ScStyleObj::CreateEmptyNumberingRules() // beans::XPropertyState -const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, +const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( std::u16string_view rPropName, const SfxItemPropertyMapEntry*& rpResultEntry ) { SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); @@ -1195,7 +1195,7 @@ const SfxItemSet* ScStyleObj::GetStyleItemSet_Impl( const OUString& rPropName, return nullptr; } -beans::PropertyState ScStyleObj::getPropertyState_Impl( const OUString& aPropertyName ) +beans::PropertyState ScStyleObj::getPropertyState_Impl( std::u16string_view aPropertyName ) { beans::PropertyState eRet = beans::PropertyState_DIRECT_VALUE; @@ -1279,7 +1279,7 @@ void SAL_CALL ScStyleObj::setPropertyToDefault( const OUString& aPropertyName ) setPropertyValue_Impl( aPropertyName, pEntry, nullptr ); } -uno::Any ScStyleObj::getPropertyDefault_Impl( const OUString& aPropertyName ) +uno::Any ScStyleObj::getPropertyDefault_Impl( std::u16string_view aPropertyName ) { uno::Any aAny; @@ -1531,7 +1531,7 @@ void SAL_CALL ScStyleObj::setPropertyValue( const OUString& aPropertyName, const setPropertyValue_Impl( aPropertyName, pEntry, &aValue ); } -void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue ) +void ScStyleObj::setPropertyValue_Impl( std::u16string_view rPropertyName, const SfxItemPropertyMapEntry* pEntry, const uno::Any* pValue ) { SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); if ( !(pStyle && pEntry) ) @@ -1872,7 +1872,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx static_cast<SfxStyleSheet*>(GetStyle_Impl())->Broadcast(SfxHint(SfxHintId::DataChanged)); } -uno::Any ScStyleObj::getPropertyValue_Impl( const OUString& aPropertyName ) +uno::Any ScStyleObj::getPropertyValue_Impl( std::u16string_view aPropertyName ) { uno::Any aAny; SfxStyleSheetBase* pStyle = GetStyle_Impl( true ); diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index fff197680f86..1d766741cd99 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -1485,9 +1485,8 @@ void ScViewFunc::ApplySelectionPattern( const ScPatternAttr& rAttr, bool bCursor const SfxPoolItem* pItem = nullptr; if ( rNewSet.GetItemState( nWhich, true, &pItem ) == SfxItemState::SET && pItem ) { - for ( const auto & rPair : rMap.getPropertyEntries()) + for ( const auto pEntry : rMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if ( pEntry->nWID == nWhich ) { css::uno::Any aVal; diff --git a/sd/inc/stlsheet.hxx b/sd/inc/stlsheet.hxx index f11500b620f7..89646915f24b 100644 --- a/sd/inc/stlsheet.hxx +++ b/sd/inc/stlsheet.hxx @@ -138,7 +138,7 @@ public: private: /// @throws css::uno::RuntimeException - static const SfxItemPropertyMapEntry* getPropertyMapEntry( const OUString& rPropertyName ); + static const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ); void setPropertyValue_Impl(const OUString& aPropertyName, const css::uno::Any& aValue); css::uno::Any getPropertyValue_Impl(const OUString& PropertyName); diff --git a/sd/source/core/stlsheet.cxx b/sd/source/core/stlsheet.cxx index 8fcc2cbd1440..29aad0b25273 100644 --- a/sd/source/core/stlsheet.cxx +++ b/sd/source/core/stlsheet.cxx @@ -1493,7 +1493,7 @@ Any SAL_CALL SdStyleSheet::getPropertyDefault( const OUString& aPropertyName ) } /** this is used because our property map is not sorted yet */ -const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( const OUString& rPropertyName ) +const SfxItemPropertyMapEntry* SdStyleSheet::getPropertyMapEntry( std::u16string_view rPropertyName ) { return GetStylePropertySet().getPropertyMapEntry(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index a5899460e754..19745fb47add 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2831,9 +2831,8 @@ void SdMasterPage::setBackground( const Any& rValue ) Reference< beans::XPropertySetInfo > xSetInfo( xInputSet->getPropertySetInfo(), UNO_SET_THROW ); Reference< beans::XPropertyState > xSetStates( xInputSet, UNO_QUERY ); - for( const auto & rPair : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : ImplGetPageBackgroundPropertySet()->getPropertyMap().getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pProp = rPair.second; const OUString& rPropName = pProp->aName; if( xSetInfo->hasPropertyByName( rPropName ) ) { diff --git a/sd/source/ui/unoidl/unopback.cxx b/sd/source/ui/unoidl/unopback.cxx index c4fc95421dc4..769582e82347 100644 --- a/sd/source/ui/unoidl/unopback.cxx +++ b/sd/source/ui/unoidl/unopback.cxx @@ -97,9 +97,8 @@ void SdUnoPageBackground::fillItemSet( SdDrawDocument* pDoc, SfxItemSet& rSet ) if( maUsrAnys.AreThereOwnUsrAnys() ) { - for( const auto & rPair : mpPropSet->getPropertyMap().getPropertyEntries() ) + for( const auto pProp : mpPropSet->getPropertyMap().getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pProp = rPair.second; uno::Any* pAny = maUsrAnys.GetUsrAnyForID( *pProp ); if( pAny ) { @@ -399,7 +398,7 @@ uno::Any SAL_CALL SdUnoPageBackground::getPropertyDefault( const OUString& aProp } /** this is used because our property map is not sorted yet */ -const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( const OUString& rPropertyName ) const noexcept +const SfxItemPropertyMapEntry* SdUnoPageBackground::getPropertyMapEntry( std::u16string_view rPropertyName ) const noexcept { return mpPropSet->getPropertyMap().getByName(rPropertyName); } diff --git a/sd/source/ui/unoidl/unopback.hxx b/sd/source/ui/unoidl/unopback.hxx index 59b4b73bba67..c2834d9298ee 100644 --- a/sd/source/ui/unoidl/unopback.hxx +++ b/sd/source/ui/unoidl/unopback.hxx @@ -51,7 +51,7 @@ class SdUnoPageBackground final : public ::cppu::WeakImplHelper< std::unique_ptr<SfxItemSet> mpSet; SdrModel* mpDoc; - const SfxItemPropertyMapEntry* getPropertyMapEntry( const OUString& rPropertyName ) const noexcept; + const SfxItemPropertyMapEntry* getPropertyMapEntry( std::u16string_view rPropertyName ) const noexcept; public: SdUnoPageBackground( SdDrawDocument* pDoc = nullptr, const SfxItemSet* pSet = nullptr); virtual ~SdUnoPageBackground() noexcept override; diff --git a/svl/source/items/itemprop.cxx b/svl/source/items/itemprop.cxx index 329f84df722e..128bc190c390 100644 --- a/svl/source/items/itemprop.cxx +++ b/svl/source/items/itemprop.cxx @@ -41,7 +41,7 @@ SfxItemPropertyMap::SfxItemPropertyMap( std::span<const SfxItemPropertyMapEntry> for (const auto & pEntry : pEntries) { assert(!pEntry.aName.isEmpty() && "empty name? might be something left an empty entry at the end of this array"); - m_aMap.insert( { pEntry.aName, &pEntry } ); + m_aMap.insert( &pEntry ); } } @@ -51,12 +51,23 @@ SfxItemPropertyMap::~SfxItemPropertyMap() { } -const SfxItemPropertyMapEntry* SfxItemPropertyMap::getByName( const OUString & rName ) const +const SfxItemPropertyMapEntry* SfxItemPropertyMap::getByName( std::u16string_view rName ) const { - auto it = m_aMap.find(rName); - if (it == m_aMap.end()) + struct Compare + { + bool operator() ( const SfxItemPropertyMapEntry* lhs, std::u16string_view rhs ) const + { + return lhs->aName < rhs; + } + bool operator() ( std::u16string_view lhs, const SfxItemPropertyMapEntry* rhs ) const + { + return lhs < rhs->aName; + } + }; + auto it = std::lower_bound(m_aMap.begin(), m_aMap.end(), rName, Compare()); + if (it == m_aMap.end() || Compare()(rName, *it)) return nullptr; - return it->second; + return *it; } uno::Sequence<beans::Property> const & SfxItemPropertyMap::getProperties() const @@ -66,9 +77,8 @@ uno::Sequence<beans::Property> const & SfxItemPropertyMap::getProperties() const m_aPropSeq.realloc( m_aMap.size() ); beans::Property* pPropArray = m_aPropSeq.getArray(); sal_uInt32 n = 0; - for( const auto & rPair : m_aMap ) + for( const SfxItemPropertyMapEntry* pEntry : m_aMap ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; pPropArray[n].Name = pEntry->aName; pPropArray[n].Handle = pEntry->nWID; pPropArray[n].Type = pEntry->aType; @@ -94,7 +104,7 @@ beans::Property SfxItemPropertyMap::getPropertyByName( const OUString& rName ) c return aProp; } -bool SfxItemPropertyMap::hasPropertyByName( const OUString & rName ) const +bool SfxItemPropertyMap::hasPropertyByName( std::u16string_view rName ) const { return getByName(rName) != nullptr; } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 9ae9b9d69e09..abe48784d1e1 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -523,9 +523,8 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper const SfxItemPropertyMap& rSrc = rPropSet.getPropertyMap(); - for(const auto & rPair : rSrc.getPropertyEntries()) + for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pSrcProp = rPair.second; const sal_uInt16 nWID = pSrcProp->nWID; if(SfxItemPool::IsWhich(nWID) && (nWID < OWN_ATTR_VALUE_START || nWID > OWN_ATTR_VALUE_END) @@ -533,9 +532,8 @@ static void SvxItemPropertySet_ObtainSettingsFromPropertySet(const SvxItemProper rSet.Put(rSet.GetPool()->GetUserOrPoolDefaultItem(nWID)); } - for(const auto & rPair : rSrc.getPropertyEntries()) + for(const SfxItemPropertyMapEntry* pSrcProp : rSrc.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pSrcProp = rPair.second; if(pSrcProp->nWID) { uno::Any* pUsrAny = rAnys.GetUsrAnyForID(*pSrcProp); diff --git a/sw/inc/unocrsrhelper.hxx b/sw/inc/unocrsrhelper.hxx index a510216641f8..922bff3ad046 100644 --- a/sw/inc/unocrsrhelper.hxx +++ b/sw/inc/unocrsrhelper.hxx @@ -183,7 +183,7 @@ namespace SwUnoCursorHelper css::uno::Any GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::uno::RuntimeException css::uno::Sequence< css::beans::PropertyState > GetPropertyStates( @@ -204,14 +204,14 @@ namespace SwUnoCursorHelper void SetPropertyToDefault( SwPaM & rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); /// @throws css::beans::UnknownPropertyException /// @throws css::lang::WrappedTargetException /// @throws css::uno::RuntimeException css::uno::Any GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet & rPropSet, - const OUString& rPropertyName); + std::u16string_view rPropertyName); bool SetPageDesc( const css::uno::Any& rValue, diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index b41583a78a38..67578811a996 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1502,9 +1502,8 @@ void SwAccessibleParagraph::_getDefaultAttributesImpl( { const SfxItemPropertyMap& rPropMap = aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); - for ( const auto & rPair : rPropMap.getPropertyEntries() ) + for ( const auto pEntry : rPropMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; const SfxPoolItem* pItem = pSet->GetItem( pEntry->nWID ); if ( pItem ) { @@ -1692,9 +1691,8 @@ void SwAccessibleParagraph::_getRunAttributesImpl( const SfxItemPropertyMap& rPropMap = aSwMapProvider.GetPropertySet( PROPERTY_MAP_TEXT_CURSOR )->getPropertyMap(); - for ( const auto & rPair : rPropMap.getPropertyEntries() ) + for ( const auto pEntry : rPropMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; const SfxPoolItem* pItem( nullptr ); // #i82637# - Found character attributes, whose value equals the value of // the corresponding default character attributes, are excluded. diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index 7a019bf98bd3..10c871222a23 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -303,9 +303,8 @@ static uno::Any GetParaListAutoFormat(SwTextNode const& rNode) SfxItemPropertyMap const& rMap(rPropSet.getPropertyMap()); std::vector<beans::NamedValue> props; // have to iterate the map, not the item set? - for (auto const & rPair : rMap.getPropertyEntries()) + for (auto const pEntry : rMap.getPropertyEntries()) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if (SfxItemPropertySet::getPropertyState(*pEntry, *pSet) == PropertyState_DIRECT_VALUE) { Any value; diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index 81f2b436d081..da2354f29636 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -308,7 +308,7 @@ static sal_Int32 lcl_PropName2TokenPos(std::u16string_view rPropertyName) return SAL_MAX_INT32; } -static sal_uInt16 GetFieldTypeMId( const OUString& rProperty, const SwFieldType& rTyp ) +static sal_uInt16 GetFieldTypeMId( std::u16string_view rProperty, const SwFieldType& rTyp ) { sal_uInt16 nId = lcl_GetPropMapIdForFieldType( rTyp.Which() ); const SfxItemPropertySet* pSet = aSwMapProvider.GetPropertySet( nId ); diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 0d7b29bf9ccf..ec33b73ea106 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -1870,7 +1870,7 @@ SwXTextCursor::setString(const OUString& aString) uno::Any SwUnoCursorHelper::GetPropertyValue( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { uno::Any aAny; SfxItemPropertyMapEntry const*const pEntry = @@ -2162,7 +2162,7 @@ lcl_SelectParaAndReset( SwPaM &rPaM, SwDoc & rDoc, void SwUnoCursorHelper::SetPropertyToDefault( SwPaM& rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SwDoc& rDoc = rPaM.GetDoc(); SfxItemPropertyMapEntry const*const pEntry = @@ -2200,7 +2200,7 @@ void SwUnoCursorHelper::SetPropertyToDefault( uno::Any SwUnoCursorHelper::GetPropertyDefault( SwPaM const & rPaM, const SfxItemPropertySet& rPropSet, - const OUString& rPropertyName) + std::u16string_view rPropertyName) { SfxItemPropertyMapEntry const*const pEntry = rPropSet.getPropertyMap().getByName(rPropertyName); diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 97db183dc17f..d4cb489867ec 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -525,7 +525,7 @@ public: : mrMap(rMap) { } - bool AllowsKey(const OUString& rName) + bool AllowsKey(std::u16string_view rName) { return mrMap.hasPropertyByName(rName); } @@ -4392,9 +4392,8 @@ uno::Sequence< beans::PropertyValue > SwXAutoStyle::getProperties() // TODO: Optimize - and fix! the old iteration filled each WhichId // only once but there are more properties than WhichIds - for( const auto & rPair : rMap.getPropertyEntries() ) + for( const auto pEntry : rMap.getPropertyEntries() ) { - const SfxItemPropertyMapEntry* pEntry = rPair.second; if ( pEntry->nWID == nWID ) { beans::PropertyValue aPropertyValue;