Kaydet (Commit) 8ba20167 authored tarafından Justin Luth's avatar Justin Luth Kaydeden (comit) Justin Luth

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/61899Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
Tested-by: 's avatarJustin Luth <justin_luth@sil.org>
üst c0f0592b
This diff was suppressed by a .gitattributes entry.
......@@ -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);
......
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment