sw/qa/extras/inc/swmodeltestbase.hxx           |   12 +++
 sw/qa/extras/rtfexport/data/abi10039.odt       |binary
 sw/qa/extras/rtfexport/data/fdo32613.odt       |binary
 sw/qa/extras/rtfexport/rtfexport.cxx           |   17 ++++-
 sw/qa/extras/rtfimport/data/fdo74229.rtf       |   33 +++++++++
 sw/qa/extras/rtfimport/data/fdo79959.rtf       |    4 +
 sw/qa/extras/rtfimport/rtfimport.cxx           |   16 ++++
 sw/source/filter/ww8/rtfattributeoutput.cxx    |   85 +++++++++++++++++++++++--
 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   15 +++-
 9 files changed, 173 insertions(+), 9 deletions(-)

New commits:
commit f16f40089db8ba59c6ac67f1b85438c8c62b5285
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Aug 29 17:40:51 2014 +0200

    fdo#79959 RTF import: trim whitespace around style names
    
    (cherry picked from commit 305ecd1848a802a6c43ecc6e76f4c6bc36a03418)
    
    Conflicts:
        writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: Id23cbd62b057442c577fef124a5705e4d551076f

diff --git a/sw/qa/extras/rtfimport/data/fdo79959.rtf 
b/sw/qa/extras/rtfimport/data/fdo79959.rtf
new file mode 100644
index 0000000..231f39a
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo79959.rtf
@@ -0,0 +1,4 @@
+{\rtf1\ansi\ansicpg1251\deff0\deflang1049{\fonttbl{\f0\fnil\fcharset0 
Calibri;}}
+{\stylesheet{\s0  Test;}}
+\viewkind4\uc1\pard\s0\slmult1\lang9\f0\fs22 Hello world!\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index a9c3cb8..b3349f1 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1689,6 +1689,12 @@ DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf")
     CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(67)), 
getProperty<sal_Int32>(xCell, "RightBorderDistance"));
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo79959, "fdo79959.rtf")
+{
+    // This was false, as the style was imported as " Test", i.e. no 
whitespace stripping.
+    CPPUNIT_ASSERT_EQUAL(true, 
static_cast<bool>(getStyles("ParagraphStyles")->hasByName("Test")));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index fd1d718..649b3fc 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1121,8 +1121,8 @@ void RTFDocumentImpl::text(OUString& rString)
                             if 
(m_aStates.top().aTableAttributes.find(NS_rtf::LN_SGC))
                             {
                                 OUString aName = 
m_aStates.top().aDestinationText.makeStringAndClear();
-                                m_aStyleNames[m_nCurrentStyleIndex] = aName;
-                                RTFValue::Pointer_t pValue(new 
RTFValue(aName));
+                                m_aStyleNames[m_nCurrentStyleIndex] = 
aName.trim();
+                                RTFValue::Pointer_t pValue(new 
RTFValue(aName.trim()));
                                 
m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue);
                                 
m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue);
 
commit ed0af187f9e9fb63b311684369e3f2fe1aba700b
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Sep 5 10:36:08 2014 +0200

    abi#10039 RTF export: support page-anchored frames
    
    (cherry picked from commit 845fb7bf6753ec9582d0b1d1c9b4276aa9e6c65e)
    
    Conflicts:
        sw/qa/extras/rtfexport/rtfexport.cxx
    
    Change-Id: I71c961799f76446cdf24faeba86f881ae02ffe3b

diff --git a/sw/qa/extras/rtfexport/data/abi10039.odt 
b/sw/qa/extras/rtfexport/data/abi10039.odt
new file mode 100644
index 0000000..4d5dde5
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/abi10039.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index c10def0..593dc98 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -617,6 +617,12 @@ DECLARE_RTFEXPORT_TEST(testFdo32613, "fdo32613.odt")
     CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, 
getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
 }
 
+DECLARE_RTFEXPORT_TEST(testAbi10039, "abi10039.odt")
+{
+    // Make sure we don't just crash on export, and additionally the shape 
should not be inline (as it's at-page anchored originally).
+    CPPUNIT_ASSERT(text::TextContentAnchorType_AS_CHARACTER != 
getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index ff482d9..ec3c748 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -3706,8 +3706,16 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
         aRendered.Height() = rS.GetHeight();
     }
 
-    const SwPosition* pAnchor = pFlyFrmFmt->GetAnchor().GetCntntAnchor();
-    sw::Frame aFrame(*pFlyFrmFmt, *pAnchor);
+    sw::Frame* pFrame = 0;
+    for (sw::FrameIter it = m_rExport.maFrames.begin(); it != 
m_rExport.maFrames.end(); ++it)
+    {
+        if (pFlyFrmFmt == &it->GetFrmFmt())
+        {
+            pFrame = &(*it);
+            break;
+        }
+    }
+    assert(pFrame);
 
     /*
        If the graphic is not of type WMF then we will have to store two
@@ -3716,7 +3724,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
        a wmf already then we don't need any such wrapping
        */
     bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, 
OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
-    if (aFrame.IsInline())
+    if (pFrame->IsInline())
     {
     if (!bIsWMF)
         m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE 
OOO_STRING_SVTOOLS_RTF_SHPPICT;
@@ -3725,9 +3733,9 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
     {
         m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SHP "{" 
OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST;
         m_pFlyFrameSize = &aRendered;
-        m_rExport.mpParentFrame = &aFrame;
+        m_rExport.mpParentFrame = pFrame;
         m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true;
-        m_rExport.OutputFormat(aFrame.GetFrmFmt(), false, false, true);
+        m_rExport.OutputFormat(pFrame->GetFrmFmt(), false, false, true);
         m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false;
         m_rExport.mpParentFrame = NULL;
         m_pFlyFrameSize = 0;
@@ -3748,7 +3756,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
         m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{" 
OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " ";
     }
 
-    bool bWritePicProp = aFrame.IsInline();
+    bool bWritePicProp = pFrame->IsInline();
     if (pBLIPType)
         ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
     else
@@ -3763,7 +3771,7 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
         ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
     }
 
-    if (aFrame.IsInline())
+    if (pFrame->IsInline())
     {
     if (!bIsWMF)
     {
commit 5a43ee13e3d1153939bc6bbdcf948806e164d757
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Fri Aug 29 14:26:11 2014 +0200

    fdo#32613 RTF export: implemented anchored picture export
    
    RTF originally didn't support anchored pictures: they were always
    inline. Then it was invented that pictures can be exported anchored, if
    they are in fact shapes, but their "pib" property is set to the hexdump
    of the picture contents.
    
    The RTF importer handled this situation for quite some time, but not the
    exporter -- this commit implements that.
    
    (cherry picked from commit cb01957aa0ac3caea8e87522116086ac256d4ee2)
    
    Conflicts:
        sw/qa/extras/inc/swmodeltestbase.hxx
        sw/qa/extras/rtfexport/rtfexport.cxx
        sw/source/filter/ww8/rtfattributeoutput.cxx
    
    Change-Id: I173ad9f4f2e24620508ca63c0b892b7d5da4e5b2

diff --git a/sw/qa/extras/inc/swmodeltestbase.hxx 
b/sw/qa/extras/inc/swmodeltestbase.hxx
index dc5a750..f59d14e 100644
--- a/sw/qa/extras/inc/swmodeltestbase.hxx
+++ b/sw/qa/extras/inc/swmodeltestbase.hxx
@@ -70,6 +70,18 @@ using namespace com::sun::star;
     CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \
     void TestName::verify()
 
+#if 1
+#define DECLARE_RTFEXPORT_TEST(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
+
+// For testing during development of a test, you want to use
+// DECLARE_OOXMLEXPORT_TEST_ONLY, and change the above to #if 0
+// Of course, don't forget to set back to #if 1 when you are done :-)
+#else
+#define DECLARE_RTFEXPORT_TEST_ONLY(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
+
+#define DECLARE_RTFEXPORT_TEST(TestName, filename) class disabled##TestName : 
public Test { void disabled(); }; void disabled##TestName::disabled()
+#endif
+
 #define DECLARE_SW_IMPORT_TEST(TestName, filename, BaseClass) \
     class TestName : public BaseClass { \
         public:\
diff --git a/sw/qa/extras/rtfexport/data/fdo32613.odt 
b/sw/qa/extras/rtfexport/data/fdo32613.odt
new file mode 100644
index 0000000..bd1e950
Binary files /dev/null and b/sw/qa/extras/rtfexport/data/fdo32613.odt differ
diff --git a/sw/qa/extras/rtfexport/rtfexport.cxx 
b/sw/qa/extras/rtfexport/rtfexport.cxx
index 5b026c6..c10def0 100644
--- a/sw/qa/extras/rtfexport/rtfexport.cxx
+++ b/sw/qa/extras/rtfexport/rtfexport.cxx
@@ -17,11 +17,12 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/table/BorderLine2.hpp>
 #include <com/sun/star/table/ShadowFormat.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
+#include <com/sun/star/text/TextContentAnchorType.hpp>
 #include <com/sun/star/text/XFootnotesSupplier.hpp>
 #include <com/sun/star/text/XPageCursor.hpp>
 #include <com/sun/star/text/XTextViewCursorSupplier.hpp>
 #include <com/sun/star/view/XViewSettingsSupplier.hpp>
-#include <com/sun/star/text/RelOrientation.hpp>
 
 #include <vcl/svapp.hxx>
 
@@ -49,8 +50,6 @@ public:
     }
 };
 
-#define DECLARE_RTFEXPORT_TEST(TestName, filename) 
DECLARE_SW_ROUNDTRIP_TEST(TestName, filename, Test)
-
 DECLARE_RTFEXPORT_TEST(testZoom, "zoom.rtf")
 {
     uno::Reference<frame::XModel> xModel(mxComponent, uno::UNO_QUERY);
@@ -612,6 +611,12 @@ DECLARE_RTFEXPORT_TEST(testFdo77600, "fdo77600.rtf")
     CPPUNIT_ASSERT_EQUAL(OUString("Arial"), 
getProperty<OUString>(getRun(getParagraph(1), 3), "CharFontName"));
 }
 
+DECLARE_RTFEXPORT_TEST(testFdo32613, "fdo32613.odt")
+{
+    // This was AS_CHARACTER, RTF export did not support writing anchored 
pictures.
+    CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER, 
getProperty<text::TextContentAnchorType>(getShape(1), "AnchorType"));
+}
+
 #endif
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/sw/source/filter/ww8/rtfattributeoutput.cxx 
b/sw/source/filter/ww8/rtfattributeoutput.cxx
index 9b3887f..ff482d9 100644
--- a/sw/source/filter/ww8/rtfattributeoutput.cxx
+++ b/sw/source/filter/ww8/rtfattributeoutput.cxx
@@ -2847,6 +2847,37 @@ void RtfAttributeOutput::FormatSurround( const 
SwFmtSurround& rSurround )
         m_aRunText->append(OOO_STRING_SVTOOLS_RTF_FLYMAINCNT);
         m_aRunText->append( (sal_Int32) aMC.GetValue() );
     }
+    else if (m_rExport.bOutFlyFrmAttrs && m_rExport.bRTFFlySyntax)
+    {
+        // See DocxSdrExport::startDMLAnchorInline() for SwFmtSurround -> WR / 
WRK mappings.
+        sal_Int32 nWr = -1;
+        boost::optional<sal_Int32> oWrk;
+        switch (rSurround.GetValue())
+        {
+        case SURROUND_NONE:
+            nWr = 1; // top and bottom
+            break;
+        case SURROUND_THROUGHT:
+            nWr = 3; // none
+            break;
+        case SURROUND_PARALLEL:
+            nWr = 2; // around
+            oWrk = 0; // both sides
+            break;
+        case SURROUND_IDEAL:
+        default:
+            nWr = 2; // around
+            oWrk = 3; // largest
+            break;
+        }
+        m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_SHPWR;
+        m_rExport.OutLong(nWr);
+        if (oWrk)
+        {
+            m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_SHPWRK;
+            m_rExport.OutLong(*oWrk);
+        }
+    }
 }
 
 void RtfAttributeOutput::FormatVertOrientation( const SwFmtVertOrient& 
rFlyVert )
@@ -3454,7 +3485,7 @@ static void lcl_AppendSP( OStringBuffer& rBuffer,
 
 static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, const Size &rOrig, 
const Size &rRendered, const Size &rMapped,
     const SwCropGrf &rCr, const char *pBLIPType, const sal_uInt8 *pGraphicAry,
-    unsigned long nSize, const RtfExport& rExport, SvStream *pStream = 0 )
+                          unsigned long nSize, const RtfExport& rExport, 
SvStream* pStream = 0, bool bWritePicProp = true)
 {
     OStringBuffer aRet;
     bool bIsWMF = std::strcmp(pBLIPType, OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 
0;
@@ -3462,7 +3493,7 @@ static OString ExportPICT( const SwFlyFrmFmt* pFlyFrmFmt, 
const Size &rOrig, con
     {
         aRet.append("{" OOO_STRING_SVTOOLS_RTF_PICT);
 
-        if( pFlyFrmFmt )
+        if (pFlyFrmFmt && bWritePicProp)
         {
             OUString sDescription = pFlyFrmFmt->GetObjDescription();
             //write picture properties - wzDescription at first
@@ -3675,6 +3706,9 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
         aRendered.Height() = rS.GetHeight();
     }
 
+    const SwPosition* pAnchor = pFlyFrmFmt->GetAnchor().GetCntntAnchor();
+    sw::Frame aFrame(*pFlyFrmFmt, *pAnchor);
+
     /*
        If the graphic is not of type WMF then we will have to store two
        graphics, one in the native format wrapped in shppict, and the other in
@@ -3682,11 +3716,41 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
        a wmf already then we don't need any such wrapping
        */
     bool bIsWMF = pBLIPType && std::strcmp(pBLIPType, 
OOO_STRING_SVTOOLS_RTF_WMETAFILE) == 0;
+    if (aFrame.IsInline())
+    {
     if (!bIsWMF)
         m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_IGNORE 
OOO_STRING_SVTOOLS_RTF_SHPPICT;
+    }
+    else
+    {
+        m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SHP "{" 
OOO_STRING_SVTOOLS_RTF_IGNORE OOO_STRING_SVTOOLS_RTF_SHPINST;
+        m_pFlyFrameSize = &aRendered;
+        m_rExport.mpParentFrame = &aFrame;
+        m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = true;
+        m_rExport.OutputFormat(aFrame.GetFrmFmt(), false, false, true);
+        m_rExport.bOutFlyFrmAttrs = m_rExport.bRTFFlySyntax = false;
+        m_rExport.mpParentFrame = NULL;
+        m_pFlyFrameSize = 0;
+
+        std::vector< std::pair<OString, OString> > aFlyProperties;
+        aFlyProperties.push_back(std::make_pair<OString, OString>("shapeType", 
OString::number(ESCHER_ShpInst_PictureFrame)));
+        aFlyProperties.push_back(std::make_pair<OString, 
OString>("wzDescription", 
msfilter::rtfutil::OutString(pFlyFrmFmt->GetObjDescription(), 
m_rExport.eCurrentEncoding)));
+        aFlyProperties.push_back(std::make_pair<OString, OString>("wzName", 
msfilter::rtfutil::OutString(pFlyFrmFmt->GetObjTitle(), 
m_rExport.eCurrentEncoding)));
+        for (size_t i = 0; i < aFlyProperties.size(); ++i)
+        {
+            m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{";
+            m_rExport.Strm() << OOO_STRING_SVTOOLS_RTF_SN " ";
+            m_rExport.Strm() << aFlyProperties[i].first.getStr();
+            m_rExport.Strm() << "}{" OOO_STRING_SVTOOLS_RTF_SV " ";
+            m_rExport.Strm() << aFlyProperties[i].second.getStr();
+            m_rExport.Strm() << "}}";
+        }
+        m_rExport.Strm() << "{" OOO_STRING_SVTOOLS_RTF_SP "{" 
OOO_STRING_SVTOOLS_RTF_SN " pib" "}{" OOO_STRING_SVTOOLS_RTF_SV " ";
+    }
 
+    bool bWritePicProp = aFrame.IsInline();
     if (pBLIPType)
-        ExportPICT( pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm() );
+        ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
     else
     {
         aStream.Seek(0);
@@ -3696,9 +3760,11 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
         nSize = aStream.Tell();
         pGraphicAry = (sal_uInt8*)aStream.GetData();
 
-        ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm() );
+        ExportPICT(pFlyFrmFmt, aSize, aRendered, aMapped, rCr, pBLIPType, 
pGraphicAry, nSize, m_rExport, &m_rExport.Strm(), bWritePicProp);
     }
 
+    if (aFrame.IsInline())
+    {
     if (!bIsWMF)
     {
         m_rExport.Strm() << "}" "{" OOO_STRING_SVTOOLS_RTF_NONSHPPICT;
@@ -3714,6 +3780,9 @@ void RtfAttributeOutput::FlyFrameGraphic( const 
SwFlyFrmFmt* pFlyFrmFmt, const S
 
         m_rExport.Strm() << '}';
     }
+    }
+    else
+        m_rExport.Strm() << "}}}}"; // Close SV, SP, SHPINST and SHP.
 
     if (bSwapped)
         const_cast<Graphic&>(rGraphic).SwapOut();
commit edbeda30c40e98b1ce771c3090148776f442b6a7
Author: Miklos Vajna <vmik...@collabora.co.uk>
Date:   Thu Aug 28 15:45:21 2014 +0200

    fdo#74229 import RTF_TRGAPH
    
    Regression from commit c4b91ae3178011c66c76c711c1a6469ba658872e
    (fdo#55525 import RTF_TRLEFT, 2012-11-13).
    
    (cherry picked from commit 54bdfe0a891f2119bc35c5d82ecbc94c8cb13c0b)
    
    Conflicts:
        sw/qa/extras/rtfimport/rtfimport.cxx
        writerfilter/source/rtftok/rtfdocumentimpl.cxx
    
    Change-Id: I90f2c6399cfaf8399de0cf3488a23af6cc84710d

diff --git a/sw/qa/extras/rtfimport/data/fdo74229.rtf 
b/sw/qa/extras/rtfimport/data/fdo74229.rtf
new file mode 100644
index 0000000..f425f08
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo74229.rtf
@@ -0,0 +1,33 @@
+{\rtf1\ansi\ansicpg1252\uc1\deff0\deflang1036
+{\fonttbl
+{\f1\fmodern\fprq1\fcharset0 Courier new;}
+}
+{\colortbl;
+\red0\green0\blue0;
+\red0\green0\blue255;
+\red0\green255\blue255;
+\red0\green255\blue0;
+\red255\green0\blue255;
+\red255\green0\blue0;
+\red255\green255\blue0;
+\red255\green255\blue255;
+\red0\green0\blue128;
+\red0\green128\blue128;
+\red0\green128\blue0;
+\red128\green0\blue128;
+\red128\green0\blue0;
+\red128\green128\blue0;
+\red128\green128\blue128;
+\red192\green192\blue192;
+}
+\pard
+\trowd\trkeep\trql\trgaph67
+\clbrdrb\brdrs\brdrw10\brdrcf1\cltxlrtb\clvertalt\clcbpat8\cellx731
+\clbrdrb\brdrs\brdrw10\brdrcf1\cltxlrtb\clvertalt\clcbpat8\cellx1462
+\pard\plain\intbl\b\sb67\sa67\qc\f1\fs16\cf1
+{A1\cell}
+\pard\plain\intbl\sb67\sa67\qr\f1\fs16\cf1
+{A2\cell}
+{\row}
+\pard\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx 
b/sw/qa/extras/rtfimport/rtfimport.cxx
index af84c77..a9c3cb8 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -1679,6 +1679,16 @@ DECLARE_RTFIMPORT_TEST(testFdo73241, "fdo73241.rtf")
     CPPUNIT_ASSERT_EQUAL(1, getPages());
 }
 
+DECLARE_RTFIMPORT_TEST(testFdo74229, "fdo74229.rtf")
+{
+    uno::Reference<text::XTextTablesSupplier> xTextTablesSupplier(mxComponent, 
uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> 
xTables(xTextTablesSupplier->getTextTables(), uno::UNO_QUERY);
+    uno::Reference<text::XTextTable> xTable(xTables->getByIndex(0), 
uno::UNO_QUERY);
+    uno::Reference<text::XTextRange> xCell(xTable->getCellByName("A1"), 
uno::UNO_QUERY);
+    // This was 0, due to ignoring RTF_TRGAPH.
+    CPPUNIT_ASSERT_EQUAL(sal_Int32(TWIP_TO_MM100(67)), 
getProperty<sal_Int32>(xCell, "RightBorderDistance"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index ca34825..fd1d718 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -4019,6 +4019,17 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, 
int nParam)
                 lcl_putNestedSprm(m_aStates.top().aTableCellSprms, 
NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, RTFValue::Pointer_t(new 
RTFValue(aAttributes)));
             }
             break;
+        case RTF_TRGAPH:
+            // Half of the space between the cells of a table row: default 
left/right table cell margin.
+            if (nParam > 0)
+            {
+                RTFSprms aAttributes;
+                aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, 
RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+                aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, pIntValue);
+                lcl_putNestedSprm(m_aStates.top().aTableRowSprms, 
NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_left, 
RTFValue::Pointer_t(new RTFValue(aAttributes)));
+                lcl_putNestedSprm(m_aStates.top().aTableRowSprms, 
NS_ooxml::LN_CT_TblPrBase_tblCellMar, NS_ooxml::LN_CT_TblCellMar_right, 
RTFValue::Pointer_t(new RTFValue(aAttributes)));
+            }
+            break;
         default:
             {
                 SAL_INFO("writerfilter", "TODO handle value '" << 
lcl_RtfToString(nKeyword) << "'");
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to