external/liborcus/UnpackedTarball_liborcus.mk | 1 external/liborcus/include.patch.0 | 30 +++++ include/sal/log.hxx | 5 sc/Module_sc.mk | 2 sw/qa/extras/uiwriter/data/placeholder-bold.fodt | 114 +++++++++++++++++++++ sw/qa/extras/uiwriter/uiwriter.cxx | 47 ++++++++ sw/source/core/txtnode/ndtxt.cxx | 23 +++- sw/source/filter/html/swhtml.cxx | 14 ++ sw/source/filter/html/swhtml.hxx | 2 vbahelper/source/vbahelper/vbacommandbarhelper.cxx | 1 vcl/inc/salinst.hxx | 1 vcl/opengl/x11/X11DeviceInfo.cxx | 1 vcl/source/components/dtranscomp.cxx | 27 ++++ xmloff/Module_xmloff.mk | 2 xmloff/source/text/txtlists.cxx | 1 xmlsecurity/source/helper/ooxmlsecparser.hxx | 1 xmlsecurity/source/helper/xsecparser.hxx | 1 17 files changed, 262 insertions(+), 11 deletions(-)
New commits: commit b46c615c7ef03aae943270617b54668edc421462 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Aug 8 17:41:05 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 16:58:13 2024 +0200 sw: HTML import: apply existing hard formatting at insert position When selecting a placeholder field and pasting some HTML over it, the existing formatting of the placeholder field is inconsistently retained on the first paragraph of the pasted text, but not on subsequent ones. Fix this by retaining it on all of the pasted text; copy it after doing the 2 SplitNode() calls in SwHTMLParser::CallParser() and apply it directly to new paragraphs in SwHTMLParser::SetTextCollAttrs() after applying the paragraph style (which resets hard formatting). Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171648 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit f45d2fa85ba89eb7d71b51c3324f5938509b3201) Change-Id: I8c3596372b415fece46f6bb018cb8c26ff89c5ad diff --git a/sw/qa/extras/uiwriter/data/placeholder-bold.fodt b/sw/qa/extras/uiwriter/data/placeholder-bold.fodt new file mode 100644 index 000000000000..55ecf66df714 --- /dev/null +++ b/sw/qa/extras/uiwriter/data/placeholder-bold.fodt @@ -0,0 +1,114 @@ +<?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.3" office:mimetype="application/vnd.oasis.opendocument.text"> + <office:meta><meta:creation-date>2024-08-08T18:32:28.420082817</meta:creation-date><dc:date>2024-08-08T18:33:51.021911316</dc:date><meta:editing-duration>PT1M27S</meta:editing-duration><meta:editing-cycles>1</meta:editing-cycles><meta:document-statistic meta:table-count="0" meta:image-count="0" meta:object-count="0" meta:page-count="1" meta:paragraph-count="1" meta:word-count="3" meta:character-count="21" meta:non-whitespace-character-count="19"/><meta:generator>ZetaOffice/7.4.8.0.0$Linux_X86_64 LibreOffice_project/ab7057b1137e2241f51e62b58a0c605ec9a4b29c</meta:generator></office:meta> + <office:font-face-decls> + <style:font-face style:name="Arial Unicode MS1" svg:font-family="'Arial Unicode MS'" style:font-family-generic="system" style:font-pitch="variable"/> + <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="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:flow-with-text="false"/> + <style:paragraph-properties style:text-autospace="ideograph-alpha" style:line-break="strict" style:writing-mode="lr-tb" style:font-independent-line-spacing="false"> + <style:tab-stops/> + </style:paragraph-properties> + <style:text-properties style:use-window-font-color="true" loext:opacity="0%" loext:color-lum-mod="100%" loext:color-lum-off="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="Arial Unicode MS1" 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" 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="Arial Unicode MS1" 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"/> + <text:outline-style style:name="Outline"> + <text:outline-level-style text:level="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" 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" 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" 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" 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" 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" 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" 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" 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" 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="P1" style:family="paragraph" style:parent-style-name="Standard"> + <style:text-properties/> + </style:style> + <style:style style:name="T1" style:family="text"> + <style:text-properties fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"/> + </style:style> + <style:page-layout style:name="pm1"> + <style:page-layout-properties fo:page-width="21.001cm" fo:page-height="29.7cm" 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: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> + </office:automatic-styles> + <office:master-styles> + <style:master-page style:name="Standard" style:page-layout-name="pm1"/> + </office:master-styles> + <office:body> + <office:text> + <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="P1">Test <text:span text:style-name="T1"><text:placeholder text:placeholder-type="text" text:description="to be replaced"><replaceme></text:placeholder></text:span><text:s/>test</text:p> + </office:text> + </office:body> +</office:document> \ No newline at end of file diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index d11cf4e2d3f8..8fd1cd5fe81c 100755 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -262,6 +262,7 @@ public: void testTdf113877NoMerge(); void testTdf113877_default_style(); void testTdf113877_Standard_style(); + void testPlaceholderHTMLPaste(); CPPUNIT_TEST_SUITE(SwUiWriterTest); CPPUNIT_TEST(testReplaceForward); @@ -408,6 +409,7 @@ public: CPPUNIT_TEST(testTdf113877NoMerge); CPPUNIT_TEST(testTdf113877_default_style); CPPUNIT_TEST(testTdf113877_Standard_style); + CPPUNIT_TEST(testPlaceholderHTMLPaste); CPPUNIT_TEST_SUITE_END(); private: @@ -5168,6 +5170,51 @@ void SwUiWriterTest::testTdf113877_blank_bold_off() CPPUNIT_ASSERT_EQUAL(listId1, listId3); } +void SwUiWriterTest::testPlaceholderHTMLPaste() +{ + { + SwDoc* const pDoc = createDoc(); + SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell->Insert("AAA"); + pWrtShell->SplitNode(); + pWrtShell->Insert("BBB"); + pWrtShell->SplitNode(); + pWrtShell->Insert("CCC"); + + lcl_dispatchCommand(mxComponent, ".uno:SelectAll", {}); + lcl_dispatchCommand(mxComponent, ".uno:Copy", {}); + } + + SwDoc* const pDoc = createDoc("placeholder-bold.fodt"); + + // select placeholder field + SwWrtShell* const pWrtShell = pDoc->GetDocShell()->GetWrtShell(); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/false, 5, /*bBasicCall=*/false); + pWrtShell->Right(CRSR_SKIP_CHARS, /*bSelect=*/true, 1, /*bBasicCall=*/false); + + // Paste special as HTML + uno::Sequence<beans::PropertyValue> aPropertyValues = comphelper::InitPropertySequence( + { { "SelectedFormat", uno::Any(static_cast<sal_uInt32>(SotClipboardFormatId::HTML)) } }); + + lcl_dispatchCommand(mxComponent, ".uno:ClipboardFormatItems", aPropertyValues); + + CPPUNIT_ASSERT_EQUAL(int(4), getParagraphs()); + + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::NORMAL, + getProperty<float>(getRun(getParagraph(1), 1, "Test "), "CharWeight")); + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::BOLD, + getProperty<float>(getRun(getParagraph(1), 2, "AAA"), "CharWeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty<float>(getParagraph(2), "CharWeight")); + CPPUNIT_ASSERT_EQUAL(awt::FontWeight::BOLD, + getProperty<float>(getParagraph(3), "CharWeight")); + CPPUNIT_ASSERT_EQUAL( + awt::FontWeight::NORMAL, + getProperty<float>(getRun(getParagraph(4), 1, " test"), "CharWeight")); +} + CPPUNIT_TEST_SUITE_REGISTRATION(SwUiWriterTest); CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/html/swhtml.cxx b/sw/source/filter/html/swhtml.cxx index f4b40ae996de..9010e394357b 100644 --- a/sw/source/filter/html/swhtml.cxx +++ b/sw/source/filter/html/swhtml.cxx @@ -519,6 +519,13 @@ SvParserState SwHTMLParser::CallParser() aInsertionRangePam.Move( fnMoveBackward ); m_xDoc->getIDocumentRedlineAccess().SplitRedline( aInsertionRangePam ); + if (SwAttrSet const*const pAttrs = pPos->nNode.GetNode().GetTextNode()->GetpSwAttrSet()) + { + m_pTargetCharAttrs.reset(new SfxItemSet(*pAttrs->GetPool(), + RES_CHRATR_BEGIN, RES_CHRATR_END-1)); + m_pTargetCharAttrs->Put(*pAttrs); + } + m_xDoc->SetTextFormatColl( *m_pPam, m_pCSS1Parser->GetTextCollFromPool( RES_POOLCOLL_STANDARD )); } @@ -4711,6 +4718,13 @@ void SwHTMLParser::SetTextCollAttrs( HTMLAttrContext *pContext ) // Die Vorlage setzen m_xDoc->SetTextFormatColl( *m_pPam, pCollToSet ); + if (m_pTargetCharAttrs) + { + std::unique_ptr<SfxItemSet> const pCharSet(new SfxItemSet(*m_pTargetCharAttrs)); + pCharSet->Differentiate(pCollToSet->GetAttrSet()); + m_xDoc->getIDocumentContentOperations().InsertItemSet(*m_pPam, *pCharSet); + } + // ggf. noch den Absatz-Einzug korrigieren const SvxLRSpaceItem& rLRItem = pCollToSet->GetLRSpace(); bool bSetLRSpace; diff --git a/sw/source/filter/html/swhtml.hxx b/sw/source/filter/html/swhtml.hxx index 04f0eb54cf16..632fce984896 100644 --- a/sw/source/filter/html/swhtml.hxx +++ b/sw/source/filter/html/swhtml.hxx @@ -485,6 +485,8 @@ class SwHTMLParser : public SfxHTMLParser, public SwClient SfxViewFrame* m_pTempViewFrame; + std::unique_ptr<SfxItemSet> m_pTargetCharAttrs; + void DeleteFormImpl(); void DocumentDetected(); commit 256c9c02fc473853fe8e176e86e680e8cb1b38bd Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Thu Aug 8 17:39:02 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 16:58:13 2024 +0200 sw: fix SwTextNode::MoveTextAttr_To_AttrSet() ... and use it on both on the SwTextNodes after the split. The problem is that it doesn't do anything because it puts a RES_TXTATR_AUTOFMT directly into the node's item set, but that can contain only RES_CHRATR* items. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171644 Tested-by: Jenkins Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit e14fc683536ec2926c70ea94dfd7a549a9bc1460) Change-Id: I0274652651d1223e905cbd42f4da5458f0106d95 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index d86005954878..53c4f0f07e81 100755 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -522,6 +522,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos ) if ( HasHints() ) { MoveTextAttr_To_AttrSet(); + pNode->MoveTextAttr_To_AttrSet(); } pNode->MakeFrames( *this ); lcl_ChangeFootnoteRef( *this ); @@ -560,6 +561,7 @@ SwContentNode *SwTextNode::SplitContentNode( const SwPosition &rPos ) } } MoveTextAttr_To_AttrSet(); + pNode->MoveTextAttr_To_AttrSet(); } if( pList ) @@ -619,12 +621,23 @@ void SwTextNode::MoveTextAttr_To_AttrSet() if (*pHtEndIdx < m_Text.getLength() || pHt->IsCharFormatAttr()) break; - if( !pHt->IsDontMoveAttr() && - SetAttr( pHt->GetAttr() ) ) + if (!pHt->IsDontMoveAttr()) { - m_pSwpHints->DeleteAtPos(i); - DestroyAttr( pHt ); - --i; + bool isInserted(false); + if (pHt->Which() == RES_TXTATR_AUTOFMT) + { + isInserted = SetAttr(*pHt->GetAutoFormat().GetStyleHandle()); + } + else + { + isInserted = SetAttr(pHt->GetAttr()); + } + if (isInserted) + { + m_pSwpHints->DeleteAtPos(i); + DestroyAttr( pHt ); + --i; + } } } commit 202959d4ba06a5a564044e4d6049dc0e5d06ec01 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Apr 8 09:26:38 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 16:58:13 2024 +0200 Make SalInstance::CreateClipboard return a single instance in the non-LOK case I came across this when seeing UITest_calc_tests2's tdf118189.tdf118189.test_tdf118189 fail on Linux with SAL_USE_VCLPLUGIN=gen and also on Windows, see the mailing list thread starting at <https://lists.freedesktop.org/archives/libreoffice/2020-April/084822.html> "Linux SAL_USE_VCLPLUGIN=svp and the clipboard". That email thread clarified that the codified behavior of that non-LOK test was wrong. (While the LOK test ScTiledRenderingTest::testMultiViewCopyPaste in sc/qa/unit/tiledrendering/tiledrendering.cxx keeps working as intended.) I did not find documentation for what arguments CreateClipboard shall support, but things seem to work if anything but empty arguments is rejected with an IllegalArgumentException. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/91869 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 68c3d3e46bf731c93fe5eca2e35042484f77d650) Change-Id: I1918254cc15878ad43b8aa22aff7eb1c4bea73fe diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 3384b3a55c20..1ceb56b8b1ad 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -66,6 +66,7 @@ class VCL_PLUGIN_PUBLIC SalInstance { private: rtl::Reference< vcl::DisplayConnectionDispatch > m_pEventInst; + css::uno::Reference<css::uno::XInterface> m_clipboard; public: SalInstance() {} diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx index 0946b0e34fa5..80dc58151dcb 100644 --- a/vcl/source/components/dtranscomp.cxx +++ b/vcl/source/components/dtranscomp.cxx @@ -17,14 +17,18 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include "osl/mutex.hxx" +#include <sal/config.h> +#include <comphelper/lok.hxx> +#include <osl/mutex.hxx> +#include <tools/debug.hxx> #include <vcl/svapp.hxx> #include "factory.hxx" #include "svdata.hxx" #include "salinst.hxx" +#include <com/sun/star/lang/IllegalArgumentException.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp> #include "com/sun/star/lang/XServiceInfo.hpp" #include "com/sun/star/lang/XSingleServiceFactory.hpp" @@ -441,9 +445,26 @@ Reference< XInterface > SAL_CALL DropTarget_createInstance( const Reference< XMu /* * SalInstance generic */ -Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& ) +Reference< XInterface > SalInstance::CreateClipboard( const Sequence< Any >& arguments ) { - return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()) ); + if (arguments.hasElements()) { + throw css::lang::IllegalArgumentException( + "non-empty SalInstance::CreateClipboard arguments", {}, -1); + } + if (comphelper::LibreOfficeKit::isActive()) { + // In LOK, each document view shall have its own clipboard instance, and the way that + // (happens to?) work is that apparently this function is called at most once for each such + // document view, so it is OK if we hand out a fresh instance on each call in LOK (whereas + // in non-LOK below we keep handing out one single instance; see also + // <https://lists.freedesktop.org/archives/libreoffice/2020-April/084824.html> "Re: Linux + // SAL_USE_VCLPLUGIN=svp and the clipboard"): + return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()) ); + } + DBG_TESTSOLARMUTEX(); + if (!m_clipboard.is()) { + m_clipboard = static_cast<cppu::OWeakObject *>(new vcl::GenericClipboard()); + } + return m_clipboard; } Reference< XInterface > SalInstance::CreateDragSource() commit b0d611c2971090dd928dd3d436a97d30133a6ca8 Author: Michael Stahl <michael.st...@allotropia.de> AuthorDate: Fri Aug 9 11:32:28 2024 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 11:32:28 2024 +0200 fix bunch of missing includes etc. Change-Id: If29e77eeaac9e437b81e29207f326ecc60c7bd25 diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 67407eb5ec25..543701e27642 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -94,7 +94,7 @@ $(eval $(call gb_Module_add_subsequentcheck_targets,sc,\ JunitTest_sc_unoapi_5 \ JunitTest_sc_unoapi_6 \ JunitTest_sc_unoapi_7 \ - CppunitTest_sc_opencl_test \ + $(call gb_Helper_optional,OPENCL,CppunitTest_sc_opencl_test) \ CppunitTest_sc_anchor_test \ CppunitTest_sc_annotationshapeobj \ CppunitTest_sc_outlineobj \ diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx index 777e7a3695b7..3ad9201a6f2d 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx @@ -31,6 +31,7 @@ #include <vbahelper/vbahelper.hxx> #include <rtl/ustrbuf.hxx> #include <time.h> +#include <limits> #include <map> using namespace com::sun::star; diff --git a/vcl/opengl/x11/X11DeviceInfo.cxx b/vcl/opengl/x11/X11DeviceInfo.cxx index 8b8b88e0cba7..ee8d262a705d 100644 --- a/vcl/opengl/x11/X11DeviceInfo.cxx +++ b/vcl/opengl/x11/X11DeviceInfo.cxx @@ -18,6 +18,7 @@ #include <sys/types.h> #include <sys/wait.h> #include <errno.h> +#include <stdint.h> #include <sys/utsname.h> #include <desktop/crashreport.hxx> diff --git a/xmloff/Module_xmloff.mk b/xmloff/Module_xmloff.mk index 8b1ced43396f..ade45ce7ce31 100644 --- a/xmloff/Module_xmloff.mk +++ b/xmloff/Module_xmloff.mk @@ -26,7 +26,7 @@ $(eval $(call gb_Module_add_targets,xmloff,\ Package_dtd \ )) -$(eval $(call gb_Module_add_check_targets,xmloff,\ +$(eval $(call gb_Module_add_subsequentcheck_targets,xmloff,\ $(if $(MERGELIBS),, \ CppunitTest_xmloff_uxmloff) \ )) diff --git a/xmloff/source/text/txtlists.cxx b/xmloff/source/text/txtlists.cxx index 420563cf6b7b..758c01507dcd 100644 --- a/xmloff/source/text/txtlists.cxx +++ b/xmloff/source/text/txtlists.cxx @@ -22,6 +22,7 @@ #include <comphelper/random.hxx> #include <o3tl/make_unique.hxx> +#include <limits> #include <tools/date.hxx> #include <tools/time.hxx> diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx b/xmlsecurity/source/helper/ooxmlsecparser.hxx index 1d8da9da4505..6c33d6e8f45a 100644 --- a/xmlsecurity/source/helper/ooxmlsecparser.hxx +++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx @@ -21,6 +21,7 @@ #include <xmloff/nmspmap.hxx> +#include <memory> #include <stack> diff --git a/xmlsecurity/source/helper/xsecparser.hxx b/xmlsecurity/source/helper/xsecparser.hxx index a2eb86878648..5ac954fde8dc 100644 --- a/xmlsecurity/source/helper/xsecparser.hxx +++ b/xmlsecurity/source/helper/xsecparser.hxx @@ -31,6 +31,7 @@ #include <xmloff/nmspmap.hxx> +#include <memory> #include <stack> class XSecParser: public cppu::WeakImplHelper commit 5e31979799ca4d3c48a5f471bbe055ef5cc5e3fb Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed May 5 08:20:18 2021 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 10:41:55 2024 +0200 Adapt to "libstdc++: Implement LWG 1203 for rvalue iostreams" <https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=aa475c4ac80733f85ba47b109fc1900f05e810e2> towards GCC 12, so that now "the return type is the original rvalue stream type not its base class." (And which would thus have caused issues like > sfx2/source/control/bindings.cxx:1323:19: error: dynamic_cast from rvalue to reference type '::std::ostringstream &' (aka 'basic_ostringstream<char> &') > ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : "")); > ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > include/sal/log.hxx:198:6: note: expanded from macro 'SAL_STREAM' > (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str()) > ^ > include/sal/log.hxx:341:20: note: expanded from macro 'SAL_INFO' > SAL_WHERE, stream) > ~~~~~~~~~~~^~~~~~~ > include/sal/log.hxx:155:68: note: expanded from macro 'SAL_DETAIL_LOG_STREAM' > SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ > include/sal/log.hxx:133:45: note: expanded from macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_' > ::sal::detail::StreamStart() << stream) == 1) \ > ^~~~~~ now. While the issue with old libstdc++ that originally prompted the dynamic_cast was > sfx2/source/control/bindings.cxx:1323:19: error: no member named 'str' in 'std::basic_ostream<char>' > ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : "")); > ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > include/sal/log.hxx:194:40: note: expanded from macro 'SAL_STREAM' > (::std::ostringstream() << stream).str() > ^ > include/sal/log.hxx:336:20: note: expanded from macro 'SAL_INFO' > SAL_WHERE, stream) > ~~~~~~~~~~~^~~~~~~ > include/sal/log.hxx:155:68: note: expanded from macro 'SAL_DETAIL_LOG_STREAM' > SAL_DETAIL_LOG_STREAM_PRIVATE_(level, area, where, stream); \ > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ > include/sal/log.hxx:133:45: note: expanded from macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_' > ::sal::detail::StreamStart() << stream) == 1) \ > ^~~~~~ .) The libstdc++ macro _GLIBCXX_RELEASE is reportedly available since GCC 7.1. Change-Id: I1ee6eabb66355c1f28b9d305cbd85bac50d6b0e1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115121 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 1f3dddd6f21d91c429190ae314dadeec409f35f4, plus follow-up 95e26d3dce4f5a3b2d010d5ca47b4e450905a100 "tdf#142326: Adapt to 'libstdc++: Implement LWG 1203 for rvalue iostreams'") Change-Id: I7c8fef25e15fcfa9b83924467dc86dc2957fbd7d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116447 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caol...@redhat.com> (cherry picked from commit 428206c3c1c54d01435cf4e4a07174cfbd567335) (cherry picked from commit 77b2e1c491d00d425c591bdf4486ea4b721297b7) diff --git a/include/sal/log.hxx b/include/sal/log.hxx index 734642097156..779a864d33ca 100644 --- a/include/sal/log.hxx +++ b/include/sal/log.hxx @@ -161,7 +161,10 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { @since LibreOffice 3.5 */ -#if defined _LIBCPP_VERSION || (defined _MSC_VER && _MSC_VER >= 1915) +#if defined _LIBCPP_VERSION \ + || (defined _GLIBCXX_RELEASE \ + && (_GLIBCXX_RELEASE >= 12 || (_GLIBCXX_RELEASE == 11 && __GLIBCXX__ > 20210428))) \ + || (defined _MSC_VER && _MSC_VER >= 1915) #define SAL_STREAM(stream) \ (::std::ostringstream() << stream).str() #else commit a322bc3320ac05f35ee3387f1d02f13d1cdeff44 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Thu Aug 30 18:31:33 2018 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Fri Aug 9 10:41:43 2024 +0200 At least MSVC 19.15.26726 (VS 2017 15.8.1) needs the SAL_STREAM fix too ...that was originally introduced for libc++ in 691b6ea8e100fc55f0ff70a82511722733113a07 "Make the SAL_STREAM thing compile with clang++ -std=c++11 -stdlib=libc++". MSVC and clang-cl builds now started to fail like > [build CXX] sfx2/source/control/bindings.cxx > C:/lo-clang/core/sfx2/source/control/bindings.cxx(1333,19): error: dynamic_cast from rvalue to reference type '::std::ostringstream &' (aka 'basic_ostringstream<char, char_traits<char>, allocator<char> > &') > ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : "")); > ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > C:/lo-clang/core/include\sal/log.hxx(169,6): note: expanded from macro 'SAL_STREAM' > (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str()) > ^ > C:/lo-clang/core/include\sal/log.hxx(306,20): note: expanded from macro 'SAL_INFO' > SAL_WHERE, stream) > ~~~~~~~~~~~^~~~~~~ > C:/lo-clang/core/include\sal/log.hxx(120,53): note: expanded from macro 'SAL_DETAIL_LOG_STREAM' > ::sal::detail::StreamStart() << stream) == 1) \ > ^~~~~~ [...] Change-Id: Icb311c8a61cd7e7f450a45fc7f07327e94b5d186 Reviewed-on: https://gerrit.libreoffice.org/59833 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit 965ac9915280e3d570d7b32ff20799507f4e42eb) diff --git a/include/sal/log.hxx b/include/sal/log.hxx index c096d52a0e47..734642097156 100644 --- a/include/sal/log.hxx +++ b/include/sal/log.hxx @@ -161,7 +161,7 @@ inline char const * unwrapStream(SAL_UNUSED_PARAMETER StreamIgnore const &) { @since LibreOffice 3.5 */ -#ifdef _LIBCPP_VERSION +#if defined _LIBCPP_VERSION || (defined _MSC_VER && _MSC_VER >= 1915) #define SAL_STREAM(stream) \ (::std::ostringstream() << stream).str() #else commit 43d445f54569c147b9c4d6aae0caaa2071c016cc Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Wed Oct 7 22:29:46 2020 +0200 Commit: Michael Stahl <michael.st...@allotropia.de> CommitDate: Thu Aug 8 18:31:23 2024 +0200 external/liborcus: Missing includes ...as seen with recent GCC 11 trunk libstdc++: > orcus_xlsx.cpp: In function ‘size_t orcus::{anonymous}::get_schema_rank(orcus::schema_t)’: > orcus_xlsx.cpp:313:59: error: incomplete type ‘std::numeric_limits<long unsigned int>’ used in nested name specifier > 313 | return it == rank_map.end() ? numeric_limits<size_t>::max() : it->second; > | ^~~ etc. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/104074 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> (cherry picked from commit a9976a958b2857e308c6598532151878615bfd9f) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114997 Reviewed-by: Michael Stahl <michael.st...@allotropia.de> (cherry picked from commit eaa9f84465eb330aa4c68711e8c8ec609503c5d3) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115500 Tested-by: Thorsten Behrens <thorsten.behr...@allotropia.de> Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit aed21ef623820b36d4ced1fda5c20e2d0fa683a7) Change-Id: If92cfb565ed9344b2ec1403793d7aeff8bd019ad diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk index 791436e66016..4c0ec1ca77e2 100644 --- a/external/liborcus/UnpackedTarball_liborcus.mk +++ b/external/liborcus/UnpackedTarball_liborcus.mk @@ -19,6 +19,7 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ external/liborcus/visibility.patch.0 \ external/liborcus/nullptr-in-ostringstream.patch.1 \ external/liborcus/0001-protect-the-self-closing-xml-element-code-against-se.patch \ + external/liborcus/include.patch.0 \ )) ifeq ($(OS),WNT) diff --git a/external/liborcus/include.patch.0 b/external/liborcus/include.patch.0 new file mode 100644 index 000000000000..a5c5fd12af56 --- /dev/null +++ b/external/liborcus/include.patch.0 @@ -0,0 +1,30 @@ +--- src/liborcus/orcus_xlsx.cpp ++++ src/liborcus/orcus_xlsx.cpp +@@ -32,6 +32,7 @@ + + #include <cstdlib> + #include <iostream> ++#include <limits> + #include <string> + #include <cstring> + #include <sstream> +--- src/liborcus/xls_xml_context.cpp ++++ src/liborcus/xls_xml_context.cpp +@@ -16,6 +16,7 @@ + #include "orcus/measurement.hpp" + + #include <iostream> ++#include <limits> + + using namespace std; + +--- src/liborcus/xlsx_revision_context.cpp ++++ src/liborcus/xlsx_revision_context.cpp +@@ -16,6 +16,7 @@ + #include "orcus/global.hpp" + + #include <iostream> ++#include <limits> + + using namespace std; +