diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2013-03-28 12:19:23 +0100 |
---|---|---|
committer | Luboš Luňák <l.lunak@suse.cz> | 2013-03-28 15:23:40 +0000 |
commit | aef51dc739737440c07c11c8cd88015335c5bb8c (patch) | |
tree | 4ed4eb2408a49f3184b4a83335107d987d5a9796 | |
parent | 60e8f1f5f44a140fc044d7178198adba5acbe32d (diff) |
fdo#37716 implement import of RTF_NOWRAP
(cherry picked from commit 9c06d2bd253ad6a50141a5b51409dbdffcfd9e6d)
Conflicts:
writerfilter/source/rtftok/rtfdocumentimpl.cxx
Change-Id: Ic2c0f4c1924811a6ee1c40221db447babdd74a3a
Reviewed-on: https://gerrit.libreoffice.org/3113
Reviewed-by: Luboš Luňák <l.lunak@suse.cz>
Tested-by: Luboš Luňák <l.lunak@suse.cz>
-rw-r--r-- | sw/qa/extras/rtfimport/data/fdo37716.rtf | 5 | ||||
-rw-r--r-- | sw/qa/extras/rtfimport/rtfimport.cxx | 10 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 12 | ||||
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 |
4 files changed, 27 insertions, 1 deletions
diff --git a/sw/qa/extras/rtfimport/data/fdo37716.rtf b/sw/qa/extras/rtfimport/data/fdo37716.rtf new file mode 100644 index 000000000000..489bdb7fcd72 --- /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 e54812f1c3cc..ae13ca18f8bc 100644 --- a/sw/qa/extras/rtfimport/rtfimport.cxx +++ b/sw/qa/extras/rtfimport/rtfimport.cxx @@ -143,6 +143,7 @@ public: void testFdo60722(); void testFdo61909(); void testFdo62288(); + void testFdo37716(); CPPUNIT_TEST_SUITE(Test); #if !defined(MACOSX) && !defined(WNT) @@ -236,6 +237,7 @@ void Test::run() {"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 @@ void Test::testFdo62288() 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 7e9c8b0217ef..7969b98eb16c 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -2608,6 +2608,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) // 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 @@ void RTFFrame::setSprm(Id nId, Id nValue) 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 @@ RTFSprms RTFFrame::getSprms() 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 a96ad9add55d..e3b84020b398 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx @@ -308,6 +308,7 @@ namespace writerfilter { sal_Int32 nHoriPadding, nVertPadding; sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor; Id nHRule; + boost::optional<Id> oWrap; public: RTFFrame(RTFParserState* pParserState); sal_Int16 nAnchorType; |