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

tdf#123912 ww8 export: re-protect implicit section

Sections should retain their protected on/off status
regardless of the value of PROTECT_FORM. However, if there
ARE no sections, then the implicit section should use the
document settings. The same is true for the pseudo -1 section
which I believe can only be the last section (the fragment
of the implicit section that follows the last real section).

This is basically a revert of LO 6.2 commit
fa667b6d, restoring
the previous behaviour in the case of the implicit section.

Change-Id: If0b473445e0add017504a3cb61b63116f92be5ce
Reviewed-on: https://gerrit.libreoffice.org/69957
Tested-by: Jenkins
Reviewed-by: 's avatarJustin Luth <justin_luth@sil.org>
üst a16e16a3
......@@ -16,6 +16,7 @@
#include <com/sun/star/text/XTextFramesSupplier.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
#include <IDocumentSettingAccess.hxx>
#include <sfx2/docfile.hxx>
#include <sfx2/docfilt.hxx>
......@@ -70,6 +71,21 @@ DECLARE_OOXMLEXPORT_TEST(testendingSectionProps, "endingSectionProps.docx")
CPPUNIT_ASSERT_EQUAL_MESSAGE("Section Left Margin", sal_Int32(2540), getProperty<sal_Int32>(xSect, "SectionLeftMargin"));
}
DECLARE_OOXMLEXPORT_TEST(tdf123912_protectedForm, "tdf123912_protectedForm.odt")
{
SwXTextDocument* pTextDoc = dynamic_cast<SwXTextDocument *>(mxComponent.get());
CPPUNIT_ASSERT(pTextDoc);
SwDoc* pDoc = pTextDoc->GetDocShell()->GetDoc();
CPPUNIT_ASSERT_EQUAL_MESSAGE("Compatibility: Protect form", true,
pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM ) );
uno::Reference<text::XTextSectionsSupplier> xTextSectionsSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xSections(xTextSectionsSupplier->getTextSections(), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xSect(xSections->getByIndex(0), uno::UNO_QUERY);
if ( xSect.is() )
CPPUNIT_ASSERT_EQUAL_MESSAGE("Section1 is protected", true, getProperty<bool>(xSect, "IsProtected"));
}
DECLARE_OOXMLEXPORT_TEST(testDateControl, "empty-date-control.odt")
{
// Check that we did not lost the date control
......
......@@ -1526,7 +1526,11 @@ void MSWordExportBase::SectionProperties( const WW8_SepInfo& rSepInfo, WW8_PdAtt
AttrOutput().SectFootnoteEndnotePr();
// forms
AttrOutput().SectionFormProtection( rSepInfo.IsProtected() );
bool bFormProtection = rSepInfo.IsProtected();
// use document settings when SepInfo has no protect settings (last section fragment or no sections at all)
if ( !rSepInfo.pSectionFormat || (reinterpret_cast<SwSectionFormat*>(sal_IntPtr(-1)) == rSepInfo.pSectionFormat) )
bFormProtection |= m_pDoc->getIDocumentSettingAccess().get( DocumentSettingId::PROTECT_FORM );
AttrOutput().SectionFormProtection( bFormProtection );
// line numbers
const SwLineNumberInfo& rLnNumInfo = m_pDoc->GetLineNumberInfo();
......
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