sw/inc/IDocumentSettingAccess.hxx | 4 +++- sw/qa/extras/ooxmlexport/data/tdf148360.docx |binary sw/qa/extras/ooxmlexport/ooxmlexport17.cxx | 15 +++++++++++++++ sw/source/core/doc/DocumentSettingManager.cxx | 9 +++++++-- sw/source/core/inc/DocumentSettingManager.hxx | 1 + sw/source/core/text/txtfld.cxx | 3 ++- sw/source/core/txtnode/ndtxt.cxx | 18 ++++++++++++------ sw/source/uibase/uno/SwXDocumentSettings.cxx | 18 +++++++++++++++++- writerfilter/source/dmapper/DomainMapper.cxx | 2 +- 9 files changed, 58 insertions(+), 12 deletions(-)
New commits: commit 49b432d2c42000a561494c82fa56646424f3d288 Author: Vasily Melenchuk <vasily.melenc...@cib.de> AuthorDate: Thu May 26 12:05:58 2022 +0300 Commit: Thorsten Behrens <thorsten.behr...@allotropia.de> CommitDate: Wed Aug 3 21:56:29 2022 +0200 tdf#148360: sw: do not ignore list label followed by ...even if numbering is empty. Since this is a core change to avoid impact on other formats (mostly ODT) it is implemented as a new document setting. Change-Id: I35e1cec97eb40f9f3411e3ba74cb553bd8afac59 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134989 Tested-by: Jenkins Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de> (cherry picked from commit a7d9837a8aa6d1233f4c21e4db5d32428a3ffc58) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/137717 diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx index eee38ef7678e..548419576168 100644 --- a/sw/inc/IDocumentSettingAccess.hxx +++ b/sw/inc/IDocumentSettingAccess.hxx @@ -121,7 +121,9 @@ enum class DocumentSettingId FOOTNOTE_IN_COLUMN_TO_PAGEEND, // AsChar anchored flys wrapped differently in ooxml than normally so in case of // docx enable this flag. For details see ticket tdf#100680. - WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML + WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML, + // Should we display follow by symbol for numbered paragraph if numbering exists, but "None"? + NO_NUMBERING_SHOW_FOLLOWBY }; /** Provides access to settings of a document diff --git a/sw/qa/extras/ooxmlexport/data/tdf148360.docx b/sw/qa/extras/ooxmlexport/data/tdf148360.docx new file mode 100644 index 000000000000..8f09f685d26f Binary files /dev/null and b/sw/qa/extras/ooxmlexport/data/tdf148360.docx differ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx index 9ab04a6aa8c3..0ff6256fc3b8 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport17.cxx @@ -1016,6 +1016,21 @@ DECLARE_OOXMLEXPORT_TEST(testTdf149313, "tdf149313.docx") CPPUNIT_ASSERT_EQUAL(sal_Int32(8000), getXPath(pXmlDoc, "/root/page[2]/infos/bounds", "width").toInt32()); } +#include <docsh.hxx> +#include <unotxdoc.hxx> +#include <IDocumentLayoutAccess.hxx> +#include <rootfrm.hxx> + +DECLARE_OOXMLEXPORT_TEST(testTdf148360, "tdf148360.docx") +{ + const auto& pLayout = parseLayoutDump(); + + // Ensure first element is a tab + assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[1]", "nType", "PortionType::TabLeft"); + // and only then goes content + assertXPath(pLayout, "/root/page[1]/body/txt[1]/Text[2]", "nType", "PortionType::Text"); +} + DECLARE_OOXMLEXPORT_TEST(testTdf135923, "tdf135923-min.docx") { uno::Reference<text::XText> xShape(getShape(1), uno::UNO_QUERY); diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx index 851aec5b9e10..5f2a57099938 100644 --- a/sw/source/core/doc/DocumentSettingManager.cxx +++ b/sw/source/core/doc/DocumentSettingManager.cxx @@ -106,8 +106,8 @@ sw::DocumentSettingManager::DocumentSettingManager(SwDoc &rDoc) mbFootnoteInColumnToPageEnd(false), mnImagePreferredDPI(0), mbAutoFirstLineIndentDisregardLineSpace(true), - mbWrapAsCharFlysLikeInOOXML(false) - + mbWrapAsCharFlysLikeInOOXML(false), + mbNoNumberingShowFollowBy(false) // COMPATIBILITY FLAGS END { // COMPATIBILITY FLAGS START @@ -246,6 +246,7 @@ bool sw::DocumentSettingManager::get(/*[in]*/ DocumentSettingId id) const case DocumentSettingId::AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE: return mbAutoFirstLineIndentDisregardLineSpace; case DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML: return mbWrapAsCharFlysLikeInOOXML; + case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: return mbNoNumberingShowFollowBy; default: OSL_FAIL("Invalid setting id"); } @@ -428,6 +429,10 @@ void sw::DocumentSettingManager::set(/*[in]*/ DocumentSettingId id, /*[in]*/ boo mbWrapAsCharFlysLikeInOOXML = value; break; + case DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY: + mbNoNumberingShowFollowBy = value; + break; + // COMPATIBILITY FLAGS END case DocumentSettingId::BROWSE_MODE: //can be used temporary (load/save) when no SwViewShell is available diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx index b6656a934676..f37696df1a3e 100644 --- a/sw/source/core/inc/DocumentSettingManager.hxx +++ b/sw/source/core/inc/DocumentSettingManager.hxx @@ -176,6 +176,7 @@ class DocumentSettingManager final : bool mbAutoFirstLineIndentDisregardLineSpace; // If this is on as_char flys wrapping will be handled the same like in Word bool mbWrapAsCharFlysLikeInOOXML; + bool mbNoNumberingShowFollowBy; public: diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx index d9727deabeec..39ab18e404e2 100644 --- a/sw/source/core/text/txtfld.cxx +++ b/sw/source/core/text/txtfld.cxx @@ -764,7 +764,8 @@ SwNumberPortion *SwTextFormatter::NewNumberPortion( SwTextFormatInfo &rInf ) con aText += pTextNd->GetLabelFollowedBy(); } } - else if (!aText.isEmpty()) + else if (pTextNd->getIDocumentSettingAccess()->get(DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY) + || !aText.isEmpty()) aText += pTextNd->GetLabelFollowedBy(); // Not just an optimization ... diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 62d78bf87526..b76412efccb8 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4185,12 +4185,18 @@ bool SwTextNode::HasVisibleNumberingOrBullet() const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : nullptr; if ( pRule && IsCountedInList()) { - // #i87154# - // Correction of #newlistlevelattrs#: - // The numbering type has to be checked for bullet lists. - const SwNumFormat& rFormat = pRule->Get( lcl_BoundListLevel(GetActualListLevel()) ); - return SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() || - !pRule->MakeNumString( *(GetNum()) ).isEmpty(); + const SwNumFormat& rFormat = pRule->Get(lcl_BoundListLevel(GetActualListLevel())); + if (getIDocumentSettingAccess()->get(DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY)) + // True if we have something in label text or there is a non-empty + // FollowedBy separator (space, tab or whatsoever) + return rFormat.GetLabelFollowedBy() != SvxNumberFormat::LabelFollowedBy::NOTHING || + !pRule->MakeNumString(*GetNum()).isEmpty(); + else + // #i87154# + // Correction of #newlistlevelattrs#: + // The numbering type has to be checked for bullet lists. + return SVX_NUM_NUMBER_NONE != rFormat.GetNumberingType() || + !pRule->MakeNumString(*(GetNum())).isEmpty(); } return false; diff --git a/sw/source/uibase/uno/SwXDocumentSettings.cxx b/sw/source/uibase/uno/SwXDocumentSettings.cxx index 49e6baeb4b28..b58b20ea6cd1 100644 --- a/sw/source/uibase/uno/SwXDocumentSettings.cxx +++ b/sw/source/uibase/uno/SwXDocumentSettings.cxx @@ -152,7 +152,8 @@ enum SwDocumentSettingsPropertyHandles HANDLE_FOOTNOTE_IN_COLUMN_TO_PAGEEND, HANDLE_IMAGE_PREFERRED_DPI, HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, - HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS + HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, + HANDLE_NO_NUMBERING_SHOW_FOLLOWBY }; } @@ -252,6 +253,7 @@ static rtl::Reference<MasterPropertySetInfo> lcl_createSettingsInfo() { OUString("ImagePreferredDPI"), HANDLE_IMAGE_PREFERRED_DPI, cppu::UnoType<sal_Int32>::get(), 0 }, { OUString("AutoFirstLineIndentDisregardLineSpace"), HANDLE_AUTO_FIRST_LINE_INDENT_DISREGARD_LINE_SPACE, cppu::UnoType<bool>::get(), 0 }, { OUString("WordLikeWrapForAsCharFlys"), HANDLE_WORD_LIKE_WRAP_FOR_AS_CHAR_FLYS, cppu::UnoType<bool>::get(), 0 }, + { OUString("NoNumberingShowFollowBy"), HANDLE_NO_NUMBERING_SHOW_FOLLOWBY, cppu::UnoType<bool>::get(), 0 }, /* * As OS said, we don't have a view when we need to set this, so I have to @@ -1061,6 +1063,14 @@ void SwXDocumentSettings::_setSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML, bValue); } break; + case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY: + { + bool bValue = false; + if (rValue >>= bValue) + mpDoc->getIDocumentSettingAccess().set( + DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY, bValue); + } + break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } @@ -1590,6 +1600,12 @@ void SwXDocumentSettings::_getSingleValue( const comphelper::PropertyInfo & rInf DocumentSettingId::WRAP_AS_CHAR_FLYS_LIKE_IN_OOXML); } break; + case HANDLE_NO_NUMBERING_SHOW_FOLLOWBY: + { + rValue <<= mpDoc->getIDocumentSettingAccess().get( + DocumentSettingId::NO_NUMBERING_SHOW_FOLLOWBY); + } + break; default: throw UnknownPropertyException(OUString::number(rInfo.mnHandle)); } diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index cc05d84cef4a..ede7c4649899 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -131,8 +131,8 @@ DomainMapper::DomainMapper( const uno::Reference< uno::XComponentContext >& xCon uno::Any(true)); m_pImpl->SetDocumentSettingsProperty("FrameAutowidthWithMorePara", uno::Any(true)); m_pImpl->SetDocumentSettingsProperty("FootnoteInColumnToPageEnd", uno::Any(true)); - m_pImpl->SetDocumentSettingsProperty("TabAtLeftIndentForParagraphsInList", uno::Any(true)); + m_pImpl->SetDocumentSettingsProperty("NoNumberingShowFollowBy", uno::Any(true)); // Initialize RDF metadata, to be able to add statements during the import. try