desktop/source/lib/init.cxx | 2 - sw/inc/ndtxt.hxx | 1 sw/qa/extras/ooxmlexport/data/tdf165933.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport22.cxx | 12 ++++++ sw/qa/extras/uiwriter/data/tdf163340.odt |binary sw/qa/extras/uiwriter/uiwriter9.cxx | 30 ++++++++++++++++ sw/source/core/doc/DocumentContentOperationsManager.cxx | 27 ++++++++------ sw/source/core/txtnode/ndtxt.cxx | 11 +++++ sw/source/filter/ww8/docxattributeoutput.cxx | 9 ++++ vcl/source/window/toolbox2.cxx | 2 + 10 files changed, 81 insertions(+), 13 deletions(-)
New commits: commit 6a032168086087dc9497cdbf3aa3f12340ca0a64 Author: Parth Raiyani <parth.raiy...@collabora.com> AuthorDate: Wed Apr 2 12:52:25 2025 +0530 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 2 19:29:35 2025 +0200 fix: added tooltip property to ToolBox items in DumpAsPropertyTree Change-Id: Ie58b40df116d90253aca9d51061e5af92a0a61f3 Signed-off-by: Parth Raiyani <parth.raiy...@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183456 Reviewed-by: Szymon Kłos <szymon.k...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/vcl/source/window/toolbox2.cxx b/vcl/source/window/toolbox2.cxx index 359813c13662..b54dbf3dd895 100644 --- a/vcl/source/window/toolbox2.cxx +++ b/vcl/source/window/toolbox2.cxx @@ -1729,6 +1729,8 @@ void ToolBox::DumpAsPropertyTree(tools::JsonWriter& rJsonWriter) rJsonWriter.put("type", "toolitem"); rJsonWriter.put("text", GetItemText(nId)); rJsonWriter.put("command", sCommand); + if (const OUString tooltip = GetQuickHelpText(nId); !tooltip.isEmpty()) + rJsonWriter.put("tooltip", tooltip); if (IsItemChecked(nId)) rJsonWriter.put("selected", true); if (!IsItemVisible(nId)) commit 60bf3ac101c4e8ecc35d04ce3cccfaa0494712ae Author: Aron Budea <aron.bu...@collabora.com> AuthorDate: Wed Apr 2 15:02:42 2025 +1030 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 2 19:29:35 2025 +0200 Revert "LOK: Use OOXML 2010+ format" This reverts commit 6f7e5f6c26a212c3fdbff3b97522d05a5ab896cb. In sync with f564a3f0d935735fd1bb1735f7352b916375610a, see reasons there. Change-Id: Ic9d39b1a3fd2fc5630e81eb0a0920480737716d7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183605 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 9b3de8876ca3..6ab038eb75fd 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -341,7 +341,7 @@ constexpr ExtensionMap aWriterExtensionMap[] = { { "doc", u"MS Word 97"_ustr }, { "docm", u"MS Word 2007 XML VBA"_ustr }, - { "docx", u"Office Open XML Text"_ustr }, + { "docx", u"MS Word 2007 XML"_ustr }, { "fodt", u"OpenDocument Text Flat XML"_ustr }, { "html", u"HTML (StarWriter)"_ustr }, { "odt", u"writer8"_ustr }, commit 76bfb8ba319c8a02fe9b2dac1f7419a164c774a2 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Tue Nov 12 11:55:25 2024 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 2 19:29:35 2025 +0200 tdf#163340 pasting paragraphs with lists changed again Pasting paragraph with a list into an empty or completely selected paragraph with lists has been changed: If the pasted paragraph(s) are all formatted with a list from the paragraph style then this list will be preferred. If some the pasted paragraphs including the first one are formatted with a hard list then these attributes will be preferred. If all paragraphs have a hard list or no list at all the list at the target position will be preferred. (cherry picked from commit 3e9658a201f60dee95bd1bd8421b18bf8905c308) Change-Id: I5aa6834d32f7c69b2eb9f8330b282c0ae6fca559 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183593 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 9d6b03ab6aa1..fb109e4b577e 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -840,6 +840,7 @@ public: void RemoveFromListRLHidden(); void RemoveFromListOrig(); bool IsInList() const; + bool IsInListFromStyle() const; bool IsFirstOfNumRule(SwRootFrame const& rLayout) const; diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 8175a960f6cd..25be8bf45f92 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -484,26 +484,28 @@ namespace } // #i86492# - bool lcl_ContainsOnlyParagraphsInList( const SwPaM& rPam ) + bool lcl_ShouldKeepSourceList( const SwPaM& rPam ) { - bool bRet = false; - const SwTextNode* pTextNd = rPam.Start()->GetNode().GetTextNode(); const SwTextNode* pEndTextNd = rPam.End()->GetNode().GetTextNode(); - if ( pTextNd && pTextNd->IsInList() && - pEndTextNd && pEndTextNd->IsInList() ) + bool bRet = pTextNd->IsInListFromStyle(); + //prefer list if it's a single paragraph with list from style + if (pTextNd == pEndTextNd && bRet) + return true; + + if (pTextNd && pTextNd->IsInList() && !pTextNd->IsInListFromStyle() && + pEndTextNd && pEndTextNd->IsInList() && !pEndTextNd->IsInListFromStyle()) { - bRet = true; + bRet = false; SwNodeIndex aIdx(rPam.Start()->GetNode()); - do { ++aIdx; pTextNd = aIdx.GetNode().GetTextNode(); - if ( !pTextNd || !pTextNd->IsInList() ) + if (!pTextNd || !pTextNd->IsInList() || pTextNd->IsInListFromStyle()) { - bRet = false; + bRet = true; break; } } while (pTextNd != pEndTextNd); @@ -5124,11 +5126,11 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo // or // - source is a table // - tdf#163340 overwrite list if source has a list + // - overwrite also if all source paragraphs have a list from a style if ( pNumRuleToPropagate && ((pDestTextNd && !pDestTextNd->GetText().getLength() && - (!pDestTextNd->IsInList() || rPam.GetPointNode().GetTextNode()->IsInList() ) && - !lcl_ContainsOnlyParagraphsInList(rPam)) || + (!pDestTextNd->IsInList() || lcl_ShouldKeepSourceList(rPam) )) || rPam.GetBound().nNode.GetNode().GetNodeType() == SwNodeType::Table) ) { pNumRuleToPropagate = nullptr; diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index ec2ad33d28c5..108994515b8d 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4659,6 +4659,17 @@ bool SwTextNode::IsInList() const return GetNum() != nullptr && GetNum()->GetParent() != nullptr; } +bool SwTextNode::IsInListFromStyle() const +{ + if (IsInList()) + { + const SwFormatColl* pFormatColl = GetFormatColl(); + if (pFormatColl->GetItemState(RES_PARATR_NUMRULE, true) == SfxItemState::SET) + return true; + } + return false; + +} bool SwTextNode::IsFirstOfNumRule(SwRootFrame const& rLayout) const { bool bResult = false; commit f164d07c9ef7daef830da982dc044ecb96960a00 Author: Oliver Specht <oliver.spe...@cib.de> AuthorDate: Mon Oct 7 15:14:10 2024 +0200 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 2 19:29:34 2025 +0200 tdf#163340 replace list on paste Pasting paragraph with list should apply the source list to the target paragraph if the target is empty or completely selected. (cherry picked from commit 2321626477d4ff930d8bc392efa6ea84e8825171) Conflicts: sw/qa/extras/uiwriter/uiwriter9.cxx Change-Id: I27d462f121c03b6c5625f8c0967bc975d3ac2f88 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183584 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Miklos Vajna <vmik...@collabora.com> diff --git a/sw/qa/extras/uiwriter/data/tdf163340.odt b/sw/qa/extras/uiwriter/data/tdf163340.odt new file mode 100644 index 000000000000..cae622e5b5f3 Binary files /dev/null and b/sw/qa/extras/uiwriter/data/tdf163340.odt differ diff --git a/sw/qa/extras/uiwriter/uiwriter9.cxx b/sw/qa/extras/uiwriter/uiwriter9.cxx index ca3943639ae6..507ee00a9078 100644 --- a/sw/qa/extras/uiwriter/uiwriter9.cxx +++ b/sw/qa/extras/uiwriter/uiwriter9.cxx @@ -16,6 +16,7 @@ #include <com/sun/star/text/XTextTable.hpp> #include <com/sun/star/text/XTextViewCursorSupplier.hpp> #include <com/sun/star/text/XPageCursor.hpp> +#include <com/sun/star/text/XParagraphCursor.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp> #include <comphelper/propertysequence.hxx> @@ -327,6 +328,35 @@ CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf144752) CPPUNIT_ASSERT_EQUAL(u"Word"_ustr, pWrtShell->GetSelText()); } +CPPUNIT_TEST_FIXTURE(SwUiWriterTest9, testTdf163340) +{ + createSwDoc("tdf163340.odt"); + uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); + uno::Reference<text::XText> xText = xTextDocument->getText(); + uno::Reference<view::XSelectionSupplier> xSelSupplier(xModel->getCurrentController(), + uno::UNO_QUERY_THROW); + uno::Reference<text::XParagraphCursor> xParaCursor(xTextDocument->getText()->createTextCursor(), + uno::UNO_QUERY); + + for (int i = 0; i < 14; i++) + xParaCursor->gotoNextParagraph(false); + xParaCursor->gotoEndOfParagraph(true); + xSelSupplier->select(uno::Any(xParaCursor)); + + CPPUNIT_ASSERT_EQUAL(u"A."_ustr, getProperty<OUString>(xParaCursor, u"ListLabelString"_ustr)); + dispatchCommand(mxComponent, u".uno:Copy"_ustr, {}); + + xParaCursor = uno::Reference<text::XParagraphCursor>(xText->createTextCursor(), uno::UNO_QUERY); + for (int i = 0; i < 3; i++) + xParaCursor->gotoNextParagraph(false); + xParaCursor->gotoEndOfParagraph(true); + CPPUNIT_ASSERT_EQUAL(u"1."_ustr, getProperty<OUString>(xParaCursor, u"ListLabelString"_ustr)); + xSelSupplier->select(uno::Any(xParaCursor)); + dispatchCommand(mxComponent, u".uno:Paste"_ustr, {}); + CPPUNIT_ASSERT_EQUAL(u"A."_ustr, getProperty<OUString>(xParaCursor, u"ListLabelString"_ustr)); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 234d73aecb05..8175a960f6cd 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -4932,7 +4932,6 @@ static void lcl_PopNumruleState( // #i86492# - restore also <ListId> item if ( lcl_MarksWholeNode(rPam) ) return; - if (aNumRuleItemHolderIfSet) { pDestTextNd->SetAttr(*aNumRuleItemHolderIfSet); @@ -5124,9 +5123,11 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo // - source contains at least one paragraph which is not in a list // or // - source is a table + // - tdf#163340 overwrite list if source has a list + if ( pNumRuleToPropagate && ((pDestTextNd && !pDestTextNd->GetText().getLength() && - !pDestTextNd->IsInList() && + (!pDestTextNd->IsInList() || rPam.GetPointNode().GetTextNode()->IsInList() ) && !lcl_ContainsOnlyParagraphsInList(rPam)) || rPam.GetBound().nNode.GetNode().GetNodeType() == SwNodeType::Table) ) { commit 80dee4624df67e31843a580e2123f69a89ed1fa7 Author: Jaume Pujantell <jaume.pujant...@collabora.com> AuthorDate: Thu Mar 27 15:21:12 2025 +0100 Commit: Andras Timar <andras.ti...@collabora.com> CommitDate: Wed Apr 2 19:29:34 2025 +0200 tdf#165933 avoid w:delText inside w:moveFrom w:delText should only be used inside a w:del, we differentiate if we use w:del or w:moveFrom by looking if the current redline is move and if it is inside a move bookmark. But sometimes the run contents are writen before the surrounding bookmarks, in that case we wrongly used delText. To avoid this we need to check not only the existing bookmarks but also the ones that will be opened in this run. Change-Id: I6653d18545cc5eb5f302c5753cdd7dfb24bee6fc (cherry picked from commit 29127079c3f01bb28f6007a3b883b749a068c435) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/183432 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> Reviewed-by: Jaume Pujantell <jaume.pujant...@collabora.com> diff --git a/sw/qa/extras/ooxmlexport/data/tdf165933.docx b/sw/qa/extras/ooxmlexport/data/tdf165933.docx new file mode 100644 index 000000000000..a5d40269b51c Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf165933.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx index 00ad9f1766dc..46991f634f85 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport22.cxx @@ -43,6 +43,18 @@ CPPUNIT_TEST_FIXTURE(Test, testTdf165642_glossaryFootnote) parseExport(u"word/glossary/footnotes.xml"_ustr); } +CPPUNIT_TEST_FIXTURE(Test, testTdf165933_noDelTextOnMove) +{ + loadAndSave("tdf165933.docx"); + xmlDocUniquePtr pXmlDoc = parseExport(u"word/document.xml"_ustr); + CPPUNIT_ASSERT(pXmlDoc); + // Wihtout the fix it fails with + // - Expected: 0 + // - Actual : 1 + // a w:delText is created inside a w:moveFrom, which is invalid + assertXPath(pXmlDoc, "//w:moveFrom/w:r/w:delText"_ostr, 0); +} + } // end of anonymous namespace CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 770da84aabc3..18162ccf88e6 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3812,6 +3812,15 @@ void DocxAttributeOutput::RunText( const OUString& rText, rtl_TextEncoding /*eCh break; } } + // Check also the bookmarks that will be opened just now + for (const OUString& bookmarkName : m_rBookmarksStart) + { + if (bookmarkName.startsWith(u"__RefMove")) + { + isInMoveBookmark = true; + break; + } + } bool bMoved = isInMoveBookmark && m_pRedlineData && m_pRedlineData->IsMoved() && // tdf#150166 save tracked moving around TOC as w:ins, w:del SwDoc::GetCurTOX(*m_rExport.m_pCurPam->GetPoint()) == nullptr;