import RTF_DPPOLYLINE
Change-Id: I65f1ddb9d0d691c126c8e94b2e60c8309b0d33ff
This commit is contained in:
parent
9e51601833
commit
1becc60df9
6
sw/qa/extras/rtfimport/data/dppolyline.rtf
Normal file
6
sw/qa/extras/rtfimport/data/dppolyline.rtf
Normal file
@ -0,0 +1,6 @@
|
||||
{\rtf1
|
||||
{\*\do\dobxpage\dobypara\dodhgt8192\dppolyline\dppolycount2\dpptx11\dppty11\dpptx11\dppty209\dpx10885\dpy8458\dpxsize22\dpysize221}
|
||||
{\*\do\dobxpage\dobypara\dodhgt8192\dppolyline\dppolycount2\dpptx1258\dppty11\dpptx11\dppty11\dpx9637\dpy8657\dpxsize1269\dpysize22}
|
||||
{\*\do\dobxpage\dobypara\dodhgt8192\dppolyline\dppolycount2\dpptx11\dppty11\dpptx294\dppty68\dpx9637\dpy8657\dpxsize306\dpysize79}
|
||||
{\*\do\dobxpage\dobypara\dodhgt8192\dppolyline\dppolycount2\dpptx11\dppty68\dpptx294\dppty11\dpx9637\dpy8600\dpxsize306\dpysize79}
|
||||
}
|
@ -120,6 +120,7 @@ public:
|
||||
void testDoDhgt();
|
||||
void testDplinehollow();
|
||||
void testLeftmarginDefault();
|
||||
void testDppolyline();
|
||||
|
||||
CPPUNIT_TEST_SUITE(Test);
|
||||
#if !defined(MACOSX) && !defined(WNT)
|
||||
@ -178,6 +179,7 @@ public:
|
||||
CPPUNIT_TEST(testDoDhgt);
|
||||
CPPUNIT_TEST(testDplinehollow);
|
||||
CPPUNIT_TEST(testLeftmarginDefault);
|
||||
CPPUNIT_TEST(testDppolyline);
|
||||
#endif
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
@ -945,6 +947,15 @@ void Test::testLeftmarginDefault()
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(2540), getProperty<sal_Int32>(getStyles("PageStyles")->getByName("Default"), "LeftMargin"));
|
||||
}
|
||||
|
||||
void Test::testDppolyline()
|
||||
{
|
||||
// This was completely ignored, for now, just make sure we have all 4 lines.
|
||||
load("dppolyline.rtf");
|
||||
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
|
||||
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
|
||||
CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xDraws->getCount());
|
||||
}
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
@ -2273,6 +2273,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
|
||||
case RTF_DPRECT:
|
||||
case RTF_DPELLIPSE:
|
||||
case RTF_DPTXBX:
|
||||
case RTF_DPPOLYLINE:
|
||||
{
|
||||
sal_Int32 nType = 0;
|
||||
switch (nKeyword)
|
||||
@ -2280,6 +2281,10 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
|
||||
case RTF_DPLINE:
|
||||
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY);
|
||||
break;
|
||||
case RTF_DPPOLYLINE:
|
||||
// The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info.
|
||||
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"), uno::UNO_QUERY);
|
||||
break;
|
||||
case RTF_DPRECT:
|
||||
nType = ESCHER_ShpInst_Rectangle;
|
||||
break;
|
||||
@ -3143,6 +3148,32 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
|
||||
case RTF_DODHGT:
|
||||
m_aStates.top().aDrawingObject.nDhgt = nParam;
|
||||
break;
|
||||
case RTF_DPPOLYCOUNT:
|
||||
if (nParam >= 0)
|
||||
{
|
||||
m_aStates.top().aDrawingObject.nPolyLineCount = nParam;
|
||||
m_aStates.top().aDrawingObject.aPolyLinePoints.realloc(nParam);
|
||||
}
|
||||
break;
|
||||
case RTF_DPPTX:
|
||||
{
|
||||
RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
|
||||
rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].X = TWIP_TO_MM100(nParam);
|
||||
}
|
||||
break;
|
||||
case RTF_DPPTY:
|
||||
{
|
||||
RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
|
||||
rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].Y = TWIP_TO_MM100(nParam);
|
||||
rDrawingObject.nPolyLineCount--;
|
||||
if (rDrawingObject.nPolyLineCount == 0)
|
||||
{
|
||||
uno::Sequence< uno::Sequence<awt::Point> >aPointSequenceSequence(1);
|
||||
aPointSequenceSequence[0] = rDrawingObject.aPolyLinePoints;
|
||||
rDrawingObject.xPropertySet->setPropertyValue("PolyPolygon", uno::Any(aPointSequenceSequence));
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
|
||||
aSkip.setParsed(false);
|
||||
@ -4133,7 +4164,8 @@ RTFDrawingObject::RTFDrawingObject()
|
||||
nFillColorB(0),
|
||||
bHasFillColor(false),
|
||||
nDhgt(0),
|
||||
nFLine(-1)
|
||||
nFLine(-1),
|
||||
nPolyLineCount(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -274,6 +274,8 @@ namespace writerfilter {
|
||||
bool bHasFillColor;
|
||||
sal_Int32 nDhgt;
|
||||
sal_Int32 nFLine;
|
||||
sal_Int32 nPolyLineCount;
|
||||
uno::Sequence<awt::Point> aPolyLinePoints;
|
||||
};
|
||||
|
||||
/// Stores the properties of a picture.
|
||||
|
Loading…
x
Reference in New Issue
Block a user