summaryrefslogtreecommitdiff
path: root/sw/qa
diff options
context:
space:
mode:
authorJustin Luth <justin.luth@collabora.com>2018-10-18 08:17:40 +0300
committerJustin Luth <justin_luth@sil.org>2018-10-18 08:36:21 +0200
commit8ba20167034f38ea2984bc8fb0e785da107cb82b (patch)
treeecc0a90ee340e431e4b2ee1d248a39483bf71c21 /sw/qa
parentc0f0592bd55a865c5bbde9729ec75e8c18562597 (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/qa')
-rw-r--r--sw/qa/extras/ww8export/data/tdf37778_readonlySection.docbin0 -> 29696 bytes
-rw-r--r--sw/qa/extras/ww8export/ww8export3.cxx12
2 files changed, 12 insertions, 0 deletions
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
--- /dev/null
+++ b/sw/qa/extras/ww8export/data/tdf37778_readonlySection.doc
Binary files 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);