[Libreoffice-commits] core.git: 2 commits - sw/CppunitTest_sw_filters_test.mk sw/qa sw/source

Miklos Vajna vmiklos at collabora.co.uk
Wed Dec 18 10:21:27 PST 2013


 dev/null                                     |binary
 sw/CppunitTest_sw_filters_test.mk            |    2 ++
 sw/qa/core/exportdata/rtf/pass/i23357.odt    |binary
 sw/qa/core/filters-test.cxx                  |   19 +++++++++++++++++--
 sw/qa/extras/rtfexport/rtfexport.cxx         |    5 -----
 sw/source/filter/ww8/docxattributeoutput.cxx |   13 ++++++++++++-
 sw/source/filter/ww8/docxattributeoutput.hxx |    2 ++
 7 files changed, 33 insertions(+), 8 deletions(-)

New commits:
commit d0f8b0262707529f36a7317663df1b1035d0c62a
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Dec 18 19:14:54 2013 +0100

    SwFiltersTest::filter: detect import filter on export test
    
    This allows e.g. crash-testing the RTF export, even if the input source
    is not RTF but ODT.
    
    Change-Id: I3cf6afd1bc44bb475f1bd8da622d10dac0d3baa6

diff --git a/sw/CppunitTest_sw_filters_test.mk b/sw/CppunitTest_sw_filters_test.mk
index 95be87c..102b8a0 100644
--- a/sw/CppunitTest_sw_filters_test.mk
+++ b/sw/CppunitTest_sw_filters_test.mk
@@ -73,6 +73,8 @@ $(eval $(call gb_CppunitTest_use_components,sw_filters_test,\
     svtools/util/svt \
     sw/util/msword \
     sw/util/sw \
+	sw/util/swd \
+	uui/util/uui \
     toolkit/util/tk \
     ucb/source/core/ucb1 \
     ucb/source/ucp/file/ucpfile1 \
diff --git a/sw/qa/extras/rtfexport/data/i23357.odt b/sw/qa/core/exportdata/rtf/pass/i23357.odt
similarity index 100%
rename from sw/qa/extras/rtfexport/data/i23357.odt
rename to sw/qa/core/exportdata/rtf/pass/i23357.odt
diff --git a/sw/qa/core/filters-test.cxx b/sw/qa/core/filters-test.cxx
index 7c811a4..7caa99f 100644
--- a/sw/qa/core/filters-test.cxx
+++ b/sw/qa/core/filters-test.cxx
@@ -91,7 +91,18 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL,
 
     SwDocShellRef xDocShRef = new SwDocShell;
     SfxMedium* pSrcMed = new SfxMedium(rURL, STREAM_STD_READ);
-    pSrcMed->SetFilter(pFilter);
+
+    const SfxFilter* pImportFilter = 0;
+    SfxFilter* pExportFilter = 0;
+    if (bExport)
+    {
+        SFX_APP()->GetFilterMatcher().GuessFilter(*pSrcMed, &pImportFilter, SFX_FILTER_IMPORT, 0);
+        pExportFilter = pFilter;
+    }
+    else
+        pImportFilter = pFilter;
+
+    pSrcMed->SetFilter(pImportFilter);
 
     if (rUserData == FILTER_TEXT_DLG)
     {
@@ -107,10 +118,14 @@ bool SwFiltersTest::filter(const OUString &rFilter, const OUString &rURL,
         return bLoaded;
     }
 
+    // How come an error may be set, and still DoLoad() returns success? Strange...
+    if (bLoaded)
+        xDocShRef->ResetError();
+
     utl::TempFile aTempFile;
     aTempFile.EnableKillingFile();
     SfxMedium aDstMed(aTempFile.GetURL(), STREAM_STD_WRITE);
-    aDstMed.SetFilter(pFilter);
+    aDstMed.SetFilter(pExportFilter);
     bool bSaved = xDocShRef->DoSaveAs(aDstMed);
     if (xDocShRef.Is())
         xDocShRef->DoClose();
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx b/sw/qa/extras/rtfexport/rtfexport.cxx
index b4d7254..b6084cb 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -579,11 +579,6 @@ DECLARE_RTFEXPORT_TEST(testFdo66743, "fdo66743.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0xd8d8d8), getProperty<sal_Int32>(xCell, "BackColor"));
 }
 
-DECLARE_RTFEXPORT_TEST(testI23357, "i23357.odt")
-{
-    // crashtest
-}
-
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
commit 5fbea544470d1a3edc51e881c12063ef1bf56dda
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date:   Wed Dec 18 15:33:50 2013 +0100

    drawingml export of sw textframe inset
    
    This is triggered by testFdo66929 in CppunitTest_sw_ooxmlexport when DML
    export of TextFrames is enabled in non-experimental mode.
    
    Change-Id: I39481c55fc101aa9c61984cc5646911b4c207bc9

diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 81f6479..725a579 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -462,6 +462,7 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame)
             XML_prst, "rect",
             FSEND);
     m_bDMLTextFrameSyntax = true;
+    m_pBodyPrAttrList = m_pSerializer->createAttrList();
     m_rExport.OutputFormat( pParentFrame->GetFrmFmt(), false, false, true );
     m_bDMLTextFrameSyntax = false;
     m_pSerializer->endElementNS(XML_wps, XML_spPr);
@@ -472,7 +473,9 @@ void DocxAttributeOutput::WriteDMLTextFrame(sw::Frame* pParentFrame)
     m_rExport.WriteText( );
     m_pSerializer->endElementNS( XML_w, XML_txbxContent );
     m_pSerializer->endElementNS( XML_wps, XML_txbx );
-    m_pSerializer->singleElementNS( XML_wps, XML_bodyPr, FSEND );
+    XFastAttributeListRef xBodyPrAttrList(m_pBodyPrAttrList);
+    m_pBodyPrAttrList = NULL;
+    m_pSerializer->singleElementNS( XML_wps, XML_bodyPr, xBodyPrAttrList );
 
     m_pSerializer->endElementNS(XML_wps, XML_wsp);
     m_pSerializer->endElementNS(XML_a, XML_graphicData);
@@ -5891,7 +5894,13 @@ void DocxAttributeOutput::FormatBox( const SvxBoxItem& rBox )
         }
 
         if (m_bDMLTextFrameSyntax)
+        {
+            m_pBodyPrAttrList->add(XML_lIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_LEFT))));
+            m_pBodyPrAttrList->add(XML_tIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_TOP))));
+            m_pBodyPrAttrList->add(XML_rIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_RIGHT))));
+            m_pBodyPrAttrList->add(XML_bIns, OString::number(TwipsToEMU(rBox.GetDistance(BOX_LINE_BOTTOM))));
             return;
+        }
 
         // v:textbox's inset attribute: inner margin values for textbox text - write only non-default values
         double fDistanceLeftTwips = double(rBox.GetDistance(BOX_LINE_LEFT));
@@ -6235,6 +6244,7 @@ DocxAttributeOutput::DocxAttributeOutput( DocxExport &rExport, FSHelperPtr pSeri
       m_pParagraphSpacingAttrList( NULL ),
       m_pHyperlinkAttrList( NULL ),
       m_pFlyAttrList( NULL ),
+      m_pBodyPrAttrList( NULL ),
       m_pFlyFillAttrList( NULL ),
       m_pFlyWrapAttrList( NULL ),
       m_pTextboxAttrList( NULL ),
@@ -6293,6 +6303,7 @@ DocxAttributeOutput::~DocxAttributeOutput()
     delete m_pParagraphSpacingAttrList, m_pParagraphSpacingAttrList = NULL;
     delete m_pHyperlinkAttrList, m_pHyperlinkAttrList = NULL;
     delete m_pFlyAttrList, m_pFlyAttrList = NULL;
+    delete m_pBodyPrAttrList, m_pBodyPrAttrList = NULL;
     delete m_pTextboxAttrList, m_pTextboxAttrList = NULL;
     delete m_pColorAttrList, m_pColorAttrList = NULL;
 
diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx
index 99bb35c..8ebf31e 100644
--- a/sw/source/filter/ww8/docxattributeoutput.hxx
+++ b/sw/source/filter/ww8/docxattributeoutput.hxx
@@ -678,6 +678,8 @@ private:
     ::sax_fastparser::FastAttributeList *m_pParagraphSpacingAttrList;
     ::sax_fastparser::FastAttributeList *m_pHyperlinkAttrList;
     ::sax_fastparser::FastAttributeList *m_pFlyAttrList;
+    /// Attributes of <wps:bodyPr>, used during DML export of text frames.
+    ::sax_fastparser::FastAttributeList *m_pBodyPrAttrList;
     ::sax_fastparser::FastAttributeList *m_pFlyFillAttrList;
     ::sax_fastparser::FastAttributeList *m_pFlyWrapAttrList;
     /// Attributes of the next v:textbox element.


More information about the Libreoffice-commits mailing list