Kaydet (Commit) 7c53577f authored tarafından Miklos Vajna's avatar Miklos Vajna

RTF import: fix dobxpage before dptxbx

The problem was that dobxpage arrived first, set HoriOrientRelation to
FRAME, then dptxbx tried to apply defaults, which overwrote the already
set HoriOrientRelation. Fix this by only applying properties which are
not set yet.

Change-Id: I108f3363a2758eee0242533fe92e511e8c522b68
üst af88ab2e
{\rtf1
{\*\do\dobxpage\dobypara\dodhgt8192\dptxbx\dptxbxmar0
{\dptxbxtext\ltrpar\f4\fs20\cf1\vertalc\qc\ltrch To:\par}
\dpx941\dpy2114\dpxsize1349\dpysize221\dplinehollow0}
}
......@@ -1528,6 +1528,12 @@ DECLARE_RTFIMPORT_TEST(testFdo69289, "fdo69289.rtf")
CPPUNIT_ASSERT_EQUAL(sal_Int32(2), getProperty< uno::Sequence<text::TableColumnSeparator> >(xTableRows->getByIndex(0), "TableColumnSeparators").getLength());
}
DECLARE_RTFIMPORT_TEST(testDptxbxRelation, "dptxbx-relation.rtf")
{
// This was FRAME, not PAGE_FRAME, even if dobxpage is in the document.
CPPUNIT_ASSERT_EQUAL(text::RelOrientation::PAGE_FRAME, getProperty<sal_Int16>(getShape(1), "HoriOrientRelation"));
}
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -2237,6 +2237,17 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
return 0;
}
// Checks if rName is contained at least once in rProperties as a key.
bool lcl_findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName)
{
for (std::vector<beans::PropertyValue>::const_iterator it = rProperties.begin(); it != rProperties.end(); ++it)
{
if (it->Name == rName)
return true;
}
return false;
}
int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{
setNeedSect();
......@@ -2848,7 +2859,10 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY);
std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(false);
for (size_t i = 0; i < aDefaults.size(); ++i)
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
{
if (!lcl_findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, aDefaults[i].Name))
m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
}
checkFirstRun();
Mapper().startShape(m_aStates.top().aDrawingObject.xShape);
m_aStates.top().aDrawingObject.bHadShapeText = true;
......
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