diff options
author | Justin Luth <justin.luth@collabora.com> | 2018-10-18 08:17:40 +0300 |
---|---|---|
committer | Justin Luth <justin_luth@sil.org> | 2018-10-18 08:36:21 +0200 |
commit | 8ba20167034f38ea2984bc8fb0e785da107cb82b (patch) | |
tree | ecc0a90ee340e431e4b2ee1d248a39483bf71c21 /sw | |
parent | c0f0592bd55a865c5bbde9729ec75e8c18562597 (diff) |
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_luth@sil.org>
Tested-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc | bin | 0 -> 29696 bytes | |||
-rw-r--r-- | sw/qa/extras/ww8export/ww8export3.cxx | 12 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par.cxx | 2 |
3 files changed, 13 insertions, 1 deletions
diff --git a/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc Binary files differnew file mode 100644 index 000000000000..5e4fcdd760f4 --- /dev/null +++ b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc 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, |