tdf#108765 DOCX: after import, allow default styles again

During import, we don't want LO's style defaults to intermingle
with those of MSO [1]. However, if any styles are NOT defined by
the document itself, then we want to use that new style with
appropriate defaults.

For example, if footnotes were never used, that style might not be
defined in the .docx file. Later, if a user inserts a footnote
for the first time, we certainly don't want the "default paragraph"
settings. Instead, we want the default "Footnote" settings.

[1]: see commit b95d203bc1

Change-Id: Ia71490e795885d3c16f764d0f716f6499765cb67
Reviewed-on: https://gerrit.libreoffice.org/41546
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Justin Luth <justin_luth@sil.org>
This commit is contained in:
Justin Luth
2017-08-24 22:17:18 -04:00
parent b55d866101
commit c071e5f685
2 changed files with 7 additions and 0 deletions

View File

@@ -359,6 +359,10 @@ DECLARE_OOXMLEXPORT_TEST(testTdf104713_undefinedStyles, "tdf104713_undefinedStyl
// Normal paragraph style was not defined, so don't replace conflicting styles
uno::Reference<beans::XPropertySet> xStyle(getStyles("ParagraphStyles")->getByName("Heading 1"), uno::UNO_QUERY);
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(212), getProperty<sal_Int32>(xStyle, "ParaBottomMargin"));
// tdf108765: once importing is finished, use default values for any styles not yet defined.
xStyle.set( getStyles("ParagraphStyles")->getByName("Footnote"), uno::UNO_QUERY );
CPPUNIT_ASSERT_EQUAL_MESSAGE("Font size", 10.f, getProperty<float>(xStyle, "CharHeight"));
}
DECLARE_OOXMLEXPORT_TEST(testDrawingmlFlipv, "drawingml-flipv.docx")

View File

@@ -201,6 +201,9 @@ DomainMapper::~DomainMapper()
// Apply the document settings after everything else
m_pImpl->GetSettingsTable()->ApplyProperties( m_pImpl->GetTextDocument( ) );
// now that importing is finished, re-enable default styles for any that were never defined/imported.
m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::makeAny(false));
// Grab-bag handling
comphelper::SequenceAsHashMap aProperties;
// Add the saved w:themeFontLang setting