Kaydet (Commit) aef51dc7 authored tarafından Miklos Vajna's avatar Miklos Vajna Kaydeden (comit) Luboš Luňák

fdo#37716 implement import of RTF_NOWRAP

(cherry picked from commit 9c06d2bd)

Conflicts:
	writerfilter/source/rtftok/rtfdocumentimpl.cxx

Change-Id: Ic2c0f4c1924811a6ee1c40221db447babdd74a3a
Reviewed-on: https://gerrit.libreoffice.org/3113Reviewed-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
Tested-by: 's avatarLuboš Luňák <l.lunak@suse.cz>
üst 60e8f1f5
{\rtf1
\pard\plain \pvpg\phpg\posx1143\posy4743\absw9615\absh-2922\dfrmtxtx72\dfrmtxty72\nowrap
Hello\par
\pard\plain\par
}
...@@ -143,6 +143,7 @@ public: ...@@ -143,6 +143,7 @@ public:
void testFdo60722(); void testFdo60722();
void testFdo61909(); void testFdo61909();
void testFdo62288(); void testFdo62288();
void testFdo37716();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -236,6 +237,7 @@ void Test::run() ...@@ -236,6 +237,7 @@ void Test::run()
{"fdo60722.rtf", &Test::testFdo60722}, {"fdo60722.rtf", &Test::testFdo60722},
{"fdo61909.rtf", &Test::testFdo61909}, {"fdo61909.rtf", &Test::testFdo61909},
{"fdo62288.rtf", &Test::testFdo62288}, {"fdo62288.rtf", &Test::testFdo62288},
{"fdo37716.rtf", &Test::testFdo37716},
}; };
for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i) for (unsigned int i = 0; i < SAL_N_ELEMENTS(aMethods); ++i)
{ {
...@@ -1157,6 +1159,14 @@ void Test::testFdo62288() ...@@ -1157,6 +1159,14 @@ void Test::testFdo62288()
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xPara, "ParaLeftMargin")); 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_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -2608,6 +2608,9 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -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 // 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))); m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", uno::makeAny(sal_Int32(83)));
break; break;
case RTF_NOWRAP:
m_aStates.top().aFrame.setSprm(NS_sprm::LN_PWr, NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside);
break;
default: default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'"); SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false); aSkip.setParsed(false);
...@@ -4518,6 +4521,9 @@ void RTFFrame::setSprm(Id nId, Id nValue) ...@@ -4518,6 +4521,9 @@ void RTFFrame::setSprm(Id nId, Id nValue)
case NS_ooxml::LN_CT_FramePr_vAnchor: case NS_ooxml::LN_CT_FramePr_vAnchor:
nVertAnchor = nValue; nVertAnchor = nValue;
break; break;
case NS_sprm::LN_PWr:
oWrap.reset(nValue);
break;
default: default:
break; break;
} }
...@@ -4604,8 +4610,12 @@ RTFSprms RTFFrame::getSprms() ...@@ -4604,8 +4610,12 @@ RTFSprms RTFFrame::getSprms()
else if ( nH > 0 ) else if ( nH > 0 )
nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast; nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
pValue.reset(new RTFValue(nHRule)); pValue.reset(new RTFValue(nHRule));
break;
} }
break;
case NS_sprm::LN_PWr:
if (oWrap)
pValue.reset(new RTFValue(*oWrap));
break;
default: default:
break; break;
} }
......
...@@ -308,6 +308,7 @@ namespace writerfilter { ...@@ -308,6 +308,7 @@ namespace writerfilter {
sal_Int32 nHoriPadding, nVertPadding; sal_Int32 nHoriPadding, nVertPadding;
sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor; sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
Id nHRule; Id nHRule;
boost::optional<Id> oWrap;
public: public:
RTFFrame(RTFParserState* pParserState); RTFFrame(RTFParserState* pParserState);
sal_Int16 nAnchorType; sal_Int16 nAnchorType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment