[Libreoffice-commits] core.git: Branch 'libreoffice-4-2' - sw/qa writerfilter/source

Miklos Vajna vmiklos at collabora.co.uk
Tue Apr 15 12:47:14 PDT 2014


 sw/qa/extras/rtfimport/data/fdo74599.rtf     |    8 ++++++++
 sw/qa/extras/rtfimport/rtfimport.cxx         |    7 +++++++
 writerfilter/source/dmapper/DomainMapper.cxx |    3 +++
 writerfilter/source/filter/ImportFilter.cxx  |    3 ---
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit c76886856411a074a63b273c1709fbeeb005711a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Sat Apr 12 16:15:28 2014 +0200

    fdo#74599 RTF import: enable StylesNoDefault compat setting
    
    The Writer 'Heading 3' paragraph style is gray by default, but (just
    like in case of DOCX) that shouldn't have any influence on the RTF
    import result.
    
    Fix this by moving the compat setting from the DOCX filter
    implementation to the common dmapper.
    
    Change-Id: I86c7cf1a66f82b438ce8379467773a88c9e229af
    (cherry picked from commit 2df53ef5002270bfe788e383e95002f636a242d9)
    Reviewed-on: https://gerrit.libreoffice.org/8945
    Tested-by: Michael Stahl <mstahl at redhat.com>
    Reviewed-by: Michael Stahl <mstahl at redhat.com>

diff --git a/sw/qa/extras/rtfimport/data/fdo74599.rtf b/sw/qa/extras/rtfimport/data/fdo74599.rtf
new file mode 100644
index 0000000..b47728f
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo74599.rtf
@@ -0,0 +1,8 @@
+{\rtf1
+{\stylesheet
+{\s3 heading 3;}
+}
+\pard\plain \s3
+This is gray
+\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index 7961519..5bcdcb4 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1615,6 +1615,13 @@ DECLARE_RTFIMPORT_TEST(testFdo74823, "fdo74823.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int16(5391), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(1), "TableColumnSeparators")[2].Position);
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo74599, "fdo74599.rtf")
+{
+    uno::Reference<beans::XPropertySet> xPropertySet(getStyles("ParagraphStyles")->getByName("Heading 3"), uno::UNO_QUERY);
+    // Writer default styles weren't disabled, so the color was gray, not default (black).
+    CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(-1), getProperty<sal_Int32>(xPropertySet, "CharColor"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx
index 2532942..dbb16d0 100644
--- a/writerfilter/source/dmapper/DomainMapper.cxx
+++ b/writerfilter/source/dmapper/DomainMapper.cxx
@@ -107,6 +107,9 @@ LoggedStream(dmapper_logger, "DomainMapper"),
         PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_SURROUND_TEXT_WRAP_SMALL ),
         uno::makeAny( true ) );
 
+    // Don't load the default style definitions to avoid weird mix
+    m_pImpl->SetDocumentSettingsProperty("StylesNoDefault", uno::makeAny(true));
+
     //import document properties
     try
     {
diff --git a/writerfilter/source/filter/ImportFilter.cxx b/writerfilter/source/filter/ImportFilter.cxx
index cbbcd3a..0fa211c 100644
--- a/writerfilter/source/filter/ImportFilter.cxx
+++ b/writerfilter/source/filter/ImportFilter.cxx
@@ -284,9 +284,6 @@ void WriterFilter::setTargetDocument( const uno::Reference< lang::XComponent >&
    xSettings->setPropertyValue( "TabOverflow", uno::makeAny( sal_True ) );
    xSettings->setPropertyValue( "UnbreakableNumberings", uno::makeAny( sal_True ) );
 
-   // Don't load the default style definitions to avoid weird mix
-   xSettings->setPropertyValue( "StylesNoDefault", uno::makeAny( sal_True ) );
-
    xSettings->setPropertyValue("FloattableNomargins", uno::makeAny( sal_True ));
    xSettings->setPropertyValue( "ClippedPictures", uno::makeAny( sal_True ) );
    xSettings->setPropertyValue( "BackgroundParaOverDrawings", uno::makeAny( sal_True ) );


More information about the Libreoffice-commits mailing list