sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc |binary sw/qa/extras/ww8export/ww8export3.cxx | 12 ++++++++++++ sw/source/filter/ww8/ww8par.cxx | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-)
New commits: commit 8ba20167034f38ea2984bc8fb0e785da107cb82b Author: Justin Luth <justin.l...@collabora.com> AuthorDate: Thu Oct 18 08:17:40 2018 +0300 Commit: Justin Luth <justin_l...@sil.org> CommitDate: Thu Oct 18 08:36:21 2018 +0200 tdf#37778 ww8import: protect section only if protEnabled Protection is not related to fReadOnlyRecommended In Word, documentProtection enforcement is a document level setting which is required for the section protection setting to be enforced. formprot: "The enforcement of this property is determined by the documentProtection element (ยง17.15.1.29), as it is possible to specify protection without turning it on." In LO, section protection is honored if it is simply enabled, so only enable a section's protection if the enforcement variable is set. Round-tripping will lose the fact that sections are marked as protected if the enforcement is off. patch initially developed to support tdf#120499 where the focus is on sections, not on read-only and the fake section that was being created. Change-Id: I08c37ea6a9cc8fd1bdf7f36771b2d719bf9c93d6 Reviewed-on: https://gerrit.libreoffice.org/61899 Reviewed-by: Justin Luth <justin_l...@sil.org> Tested-by: Justin Luth <justin_l...@sil.org> diff --git a/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc new file mode 100644 index 000000000000..5e4fcdd760f4 Binary files /dev/null and b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc differ diff --git a/sw/qa/extras/ww8export/ww8export3.cxx b/sw/qa/extras/ww8export/ww8export3.cxx index 41d4ddcfe84f..8d0475975eb4 100644 --- a/sw/qa/extras/ww8export/ww8export3.cxx +++ b/sw/qa/extras/ww8export/ww8export3.cxx @@ -32,6 +32,18 @@ public: } }; +DECLARE_WW8EXPORT_TEST(testTdf37778_readonlySection, "tdf37778_readonlySection.doc") +{ + uno::Reference<frame::XStorable> xStorable(mxComponent, uno::UNO_QUERY); + CPPUNIT_ASSERT( xStorable->isReadonly() ); + + uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY); + uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY); + // The problem was that section protection was being enabled in addition to being read-only. + // This created an explicit section with protection. There should be just the default, non-explicit section. + CPPUNIT_ASSERT_EQUAL_MESSAGE("Number of Sections", sal_Int32(0), xSections->getCount()); + } + DECLARE_WW8EXPORT_TEST(testTdf120225_textControlCrossRef, "tdf120225_textControlCrossRef.doc") { uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index d44c84ad14bd..2cd0cd918c59 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -2361,7 +2361,7 @@ void SwWW8ImplReader::Read_HdFt(int nSect, const SwPageDesc *pPrev, bool wwSectionManager::SectionIsProtected(const wwSection &rSection) const { - return (mrReader.m_xWwFib->m_fReadOnlyRecommended && !rSection.IsNotProtected()); + return ( mrReader.m_xWDop->fProtEnabled && !rSection.IsNotProtected() ); } void wwSectionManager::SetHdFt(wwSection const &rSection, int nSect, _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits