Kaydet (Commit) 845e8478 authored tarafından Miklos Vajna's avatar Miklos Vajna

import RTF_DODHGT

Change-Id: I6e97c33569e46171ed702b573d42ced805cded78
üst a4e2e50c
{\rtf1
{\*\do\dobxcolumn\dobypara\dodhgt251658240\dprect\dpx1275\dpy-135\dpxsize1770\dpysize855
\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr79\dpfillbgcg129\dpfillbgcb189\dpfillpat1\dplinew60\dplinecor242\dplinecog242\dplinecob242}
{\*\do\dobxcolumn\dobypara\dodhgt251657727\dprect\dpx2475\dpy150\dpxsize2025\dpysize1080
\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr155\dpfillbgcg187\dpfillbgcb89\dpfillpat1\dplinew60\dplinecor242\dplinecog242\dplinecob242}
{\*\do\dobxcolumn\dobypara\dodhgt251657215\dprect\dpx1560\dpy420\dpxsize2325\dpysize1365
\dpfillfgcr255\dpfillfgcg255\dpfillfgcb255\dpfillbgcr192\dpfillbgcg80\dpfillbgcb77\dpfillpat1\dplinew60\dplinecor242\dplinecog242\dplinecob242}
\par
}
...@@ -116,6 +116,7 @@ public: ...@@ -116,6 +116,7 @@ public:
void testFdo55493(); void testFdo55493();
void testCopyPastePageStyle(); void testCopyPastePageStyle();
void testShptxtPard(); void testShptxtPard();
void testDoDhgt();
CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST_SUITE(Test);
#if !defined(MACOSX) && !defined(WNT) #if !defined(MACOSX) && !defined(WNT)
...@@ -171,6 +172,7 @@ public: ...@@ -171,6 +172,7 @@ public:
CPPUNIT_TEST(testFdo55493); CPPUNIT_TEST(testFdo55493);
CPPUNIT_TEST(testCopyPastePageStyle); CPPUNIT_TEST(testCopyPastePageStyle);
CPPUNIT_TEST(testShptxtPard); CPPUNIT_TEST(testShptxtPard);
CPPUNIT_TEST(testDoDhgt);
#endif #endif
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -905,6 +907,23 @@ void Test::testShptxtPard() ...@@ -905,6 +907,23 @@ void Test::testShptxtPard()
CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString()); CPPUNIT_ASSERT_EQUAL(OUString("shape text"), xText->getString());
} }
void Test::testDoDhgt()
{
load("do-dhgt.rtf");
uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY);
uno::Reference<container::XIndexAccess> xDraws(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY);
for (int i = 0; i < xDraws->getCount(); ++i)
{
sal_Int32 nFillColor = getProperty<sal_Int32>(xDraws->getByIndex(i), "FillColor");
if (nFillColor == 0xc0504d) // red
CPPUNIT_ASSERT_EQUAL(sal_Int32(0), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
else if (nFillColor == 0x9bbb59) // green
CPPUNIT_ASSERT_EQUAL(sal_Int32(1), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
else if (nFillColor == 0x4f81bd) // blue
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty<sal_Int32>(xDraws->getByIndex(i), "ZOrder"));
}
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test); CPPUNIT_TEST_SUITE_REGISTRATION(Test);
CPPUNIT_PLUGIN_IMPLEMENT(); CPPUNIT_PLUGIN_IMPLEMENT();
......
...@@ -2310,6 +2310,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -2310,6 +2310,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties; std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties;
for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i) for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i)
m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(i->Name, i->Value); m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(i->Name, i->Value);
m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt);
} }
break; break;
case RTF_DOBXMARGIN: case RTF_DOBXMARGIN:
...@@ -3136,6 +3137,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -3136,6 +3137,9 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
lcl_putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_val, RTFValue::Pointer_t(new RTFValue(nValue))); lcl_putNestedAttribute(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_val, RTFValue::Pointer_t(new RTFValue(nValue)));
} }
break; break;
case RTF_DODHGT:
m_aStates.top().aDrawingObject.nDhgt = nParam;
break;
default: default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'"); SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
aSkip.setParsed(false); aSkip.setParsed(false);
...@@ -4122,7 +4126,8 @@ RTFDrawingObject::RTFDrawingObject() ...@@ -4122,7 +4126,8 @@ RTFDrawingObject::RTFDrawingObject()
nFillColorR(0), nFillColorR(0),
nFillColorG(0), nFillColorG(0),
nFillColorB(0), nFillColorB(0),
bHasFillColor(false) bHasFillColor(false),
nDhgt(0)
{ {
} }
......
...@@ -272,6 +272,7 @@ namespace writerfilter { ...@@ -272,6 +272,7 @@ namespace writerfilter {
bool bHasLineColor; bool bHasLineColor;
sal_uInt8 nFillColorR, nFillColorG, nFillColorB; sal_uInt8 nFillColorR, nFillColorG, nFillColorB;
bool bHasFillColor; bool bHasFillColor;
sal_Int32 nDhgt;
}; };
/// Stores the properties of a picture. /// Stores the properties of a picture.
......
...@@ -71,6 +71,14 @@ void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& x ...@@ -71,6 +71,14 @@ void RTFSdrImport::createShape(OUString aStr, uno::Reference<drawing::XShape>& x
xPropertySet.set(xShape, uno::UNO_QUERY); xPropertySet.set(xShape, uno::UNO_QUERY);
} }
void RTFSdrImport::resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder)
{
writerfilter::dmapper::DomainMapper& rMapper = (writerfilter::dmapper::DomainMapper&)m_rImport.Mapper();
writerfilter::dmapper::GraphicZOrderHelper* pHelper = rMapper.graphicZOrderHelper();
xPropertySet->setPropertyValue("ZOrder", uno::makeAny(pHelper->findZOrder(nZOrder)));
pHelper->addItem(xPropertySet, nZOrder);
}
void RTFSdrImport::resolve(RTFShape& rShape) void RTFSdrImport::resolve(RTFShape& rShape)
{ {
int nType = -1; int nType = -1;
...@@ -281,13 +289,7 @@ void RTFSdrImport::resolve(RTFShape& rShape) ...@@ -281,13 +289,7 @@ void RTFSdrImport::resolve(RTFShape& rShape)
else if ( i->first == "geoBottom" ) else if ( i->first == "geoBottom" )
aViewBox.Height = i->second.toInt32(); aViewBox.Height = i->second.toInt32();
else if ( i->first == "dhgt" ) else if ( i->first == "dhgt" )
{ resolveDhgt(xPropertySet, i->second.toInt32());
writerfilter::dmapper::DomainMapper& rMapper = (writerfilter::dmapper::DomainMapper&)m_rImport.Mapper();
writerfilter::dmapper::GraphicZOrderHelper* pHelper = rMapper.graphicZOrderHelper();
sal_Int32 nZOrder = i->second.toInt32();
xPropertySet->setPropertyValue("ZOrder", uno::makeAny(pHelper->findZOrder(nZOrder)));
pHelper->addItem(xPropertySet, nZOrder);
}
else else
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle shape property '" << SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle shape property '" <<
OUStringToOString( i->first, RTL_TEXTENCODING_UTF8 ).getStr() << "':'" << OUStringToOString( i->first, RTL_TEXTENCODING_UTF8 ).getStr() << "':'" <<
......
...@@ -40,6 +40,7 @@ namespace writerfilter { ...@@ -40,6 +40,7 @@ namespace writerfilter {
virtual ~RTFSdrImport(); virtual ~RTFSdrImport();
void resolve(RTFShape& rShape); void resolve(RTFShape& rShape);
void resolveDhgt(uno::Reference<beans::XPropertySet> xPropertySet, sal_Int32 nZOrder);
private: private:
void createShape(rtl::OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet); void createShape(rtl::OUString aService, uno::Reference<drawing::XShape>& xShape, uno::Reference<beans::XPropertySet>& xPropertySet);
......
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