Date: prev next · Thread: first prev next last
2013 Archives by date, by thread · List index


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3113

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/13/3113/1

fdo#37716 implement import of RTF_NOWRAP

(cherry picked from commit 9c06d2bd253ad6a50141a5b51409dbdffcfd9e6d)

Conflicts:
        writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: Ic2c0f4c1924811a6ee1c40221db447babdd74a3a
---
A sw/qa/extras/rtfimport/data/fdo37716.rtf
M sw/qa/extras/rtfimport/rtfimport.cxx
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
M writerfilter/source/rtftok/rtfdocumentimpl.hxx
4 files changed, 27 insertions(+), 1 deletion(-)



diff --git a/sw/qa/extras/rtfimport/data/fdo37716.rtf b/sw/qa/extras/rtfimport/data/fdo37716.rtf
new file mode 100644
index 0000000..489bdb7
--- /dev/null
+++ b/sw/qa/extras/rtfimport/data/fdo37716.rtf
@@ -0,0 +1,5 @@
+{\rtf1
+\pard\plain \pvpg\phpg\posx1143\posy4743\absw9615\absh-2922\dfrmtxtx72\dfrmtxty72\nowrap
+Hello\par
+\pard\plain\par
+}
diff --git a/sw/qa/extras/rtfimport/rtfimport.cxx b/sw/qa/extras/rtfimport/rtfimport.cxx
index e54812f..ae13ca1 100644
--- a/sw/qa/extras/rtfimport/rtfimport.cxx
+++ b/sw/qa/extras/rtfimport/rtfimport.cxx
@@ -143,6 +143,7 @@
     void testFdo60722();
     void testFdo61909();
     void testFdo62288();
+    void testFdo37716();
 
     CPPUNIT_TEST_SUITE(Test);
 #if !defined(MACOSX) && !defined(WNT)
@@ -236,6 +237,7 @@
         {"fdo60722.rtf", &Test::testFdo60722},
         {"fdo61909.rtf", &Test::testFdo61909},
         {"fdo62288.rtf", &Test::testFdo62288},
+        {"fdo37716.rtf", &Test::testFdo37716},
     };
     for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
     {
@@ -1157,6 +1159,14 @@
     CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin"));
 }
 
+void Test::testFdo37716()
+{
+    uno::Reference<text::XTextFramesSupplier> xTextFramesSupplier(mxComponent, uno::UNO_QUERY);
+    uno::Reference<container::XIndexAccess> xFrames(xTextFramesSupplier->getTextFrames(), 
uno::UNO_QUERY);
+    // \nowrap got ignored, so Surround was text::WrapTextMode_PARALLEL
+    CPPUNIT_ASSERT_EQUAL(text::WrapTextMode_NONE, 
getProperty<text::WrapTextMode>(xFrames->getByIndex(0), "Surround"));
+}
+
 CPPUNIT_TEST_SUITE_REGISTRATION(Test);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 7e9c8b0..7969b98 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2608,6 +2608,9 @@
                     // Seems this old syntax has no way to specify a custom radius, and this is 
the default
                     m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", 
uno::makeAny(sal_Int32(83)));
                 break;
+        case RTF_NOWRAP:
+                m_aStates.top().aFrame.setSprm(NS_sprm::LN_PWr, 
NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside);
+                break;
         default:
             SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << 
lcl_RtfToString(nKeyword) << "'");
             aSkip.setParsed(false);
@@ -4518,6 +4521,9 @@
         case NS_ooxml::LN_CT_FramePr_vAnchor:
             nVertAnchor = nValue;
             break;
+        case NS_sprm::LN_PWr:
+            oWrap.reset(nValue);
+            break;
         default:
             break;
     }
@@ -4604,8 +4610,12 @@
                     else if ( nH > 0 )
                         nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
                     pValue.reset(new RTFValue(nHRule));
-                    break;
                 }
+                break;
+            case NS_sprm::LN_PWr:
+                if (oWrap)
+                    pValue.reset(new RTFValue(*oWrap));
+                break;
             default:
                 break;
         }
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx 
b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index a96ad9a..e3b8402 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -308,6 +308,7 @@
                 sal_Int32 nHoriPadding, nVertPadding;
                 sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
                 Id nHRule;
+                boost::optional<Id> oWrap;
             public:
                 RTFFrame(RTFParserState* pParserState);
                 sal_Int16 nAnchorType;

-- 
To view, visit https://gerrit.libreoffice.org/3113
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic2c0f4c1924811a6ee1c40221db447babdd74a3a
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Miklos Vajna <vmiklos@suse.cz>


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.