writerfilter: use auto where it improves code readability
for (std::vector< std::pair<Id, RTFValue::Pointer_t> >::const_iterator i = m_pSprms->begin(); i != m_pSprms->end(); ++i) vs for (auto& rSprm : *m_pSprms) and so on. Change-Id: I2b4d975af096fb59815b074cbcb9934bead9e6f0 Reviewed-on: https://gerrit.libreoffice.org/25350 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> Tested-by: Jenkins <ci@libreoffice.org>
This commit is contained in:
@@ -917,8 +917,8 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
|
|||||||
}
|
}
|
||||||
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
|
m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
|
||||||
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 (auto& rPendingProperty : rPendingProperties)
|
||||||
m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(i->Name, i->Value);
|
m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(rPendingProperty.Name, rPendingProperty.Value);
|
||||||
m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true);
|
m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -419,27 +419,27 @@ void RTFDocumentImpl::setNeedSect(bool bNeedSect)
|
|||||||
/// Copy rProps to rStyleAttributes and rStyleSprms, but in case of nested sprms, copy their children as toplevel sprms/attributes.
|
/// Copy rProps to rStyleAttributes and rStyleSprms, but in case of nested sprms, copy their children as toplevel sprms/attributes.
|
||||||
static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttributes, RTFSprms& rStyleSprms)
|
static void lcl_copyFlatten(RTFReferenceProperties& rProps, RTFSprms& rStyleAttributes, RTFSprms& rStyleSprms)
|
||||||
{
|
{
|
||||||
for (RTFSprms::Iterator_t it = rProps.getSprms().begin(); it != rProps.getSprms().end(); ++it)
|
for (auto& rSprm : rProps.getSprms())
|
||||||
{
|
{
|
||||||
// createStyleProperties() puts properties to rPr, but here we need a flat list.
|
// createStyleProperties() puts properties to rPr, but here we need a flat list.
|
||||||
if (it->first == NS_ooxml::LN_CT_Style_rPr)
|
if (rSprm.first == NS_ooxml::LN_CT_Style_rPr)
|
||||||
{
|
{
|
||||||
// rPr can have both attributes and SPRMs, copy over both types.
|
// rPr can have both attributes and SPRMs, copy over both types.
|
||||||
RTFSprms& rRPrSprms = it->second->getSprms();
|
RTFSprms& rRPrSprms = rSprm.second->getSprms();
|
||||||
for (RTFSprms::Iterator_t itRPrSprm = rRPrSprms.begin(); itRPrSprm != rRPrSprms.end(); ++itRPrSprm)
|
for (auto& rRPrSprm : rRPrSprms)
|
||||||
rStyleSprms.set(itRPrSprm->first, itRPrSprm->second);
|
rStyleSprms.set(rRPrSprm.first, rRPrSprm.second);
|
||||||
|
|
||||||
RTFSprms& rRPrAttributes = it->second->getAttributes();
|
RTFSprms& rRPrAttributes = rSprm.second->getAttributes();
|
||||||
for (RTFSprms::Iterator_t itRPrAttribute = rRPrAttributes.begin(); itRPrAttribute != rRPrAttributes.end(); ++itRPrAttribute)
|
for (auto& rRPrAttribute : rRPrAttributes)
|
||||||
rStyleAttributes.set(itRPrAttribute->first, itRPrAttribute->second);
|
rStyleAttributes.set(rRPrAttribute.first, rRPrAttribute.second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rStyleSprms.set(it->first, it->second);
|
rStyleSprms.set(rSprm.first, rSprm.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
RTFSprms& rAttributes = rProps.getAttributes();
|
RTFSprms& rAttributes = rProps.getAttributes();
|
||||||
for (RTFSprms::Iterator_t itAttr = rAttributes.begin(); itAttr != rAttributes.end(); ++itAttr)
|
for (auto& rAttribute : rAttributes)
|
||||||
rStyleAttributes.set(itAttr->first, itAttr->second);
|
rStyleAttributes.set(rAttribute.first, rAttribute.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms& rSprms)
|
writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RTFSprms& rAttributes, RTFSprms& rSprms)
|
||||||
@@ -447,14 +447,14 @@ writerfilter::Reference<Properties>::Pointer_t RTFDocumentImpl::getProperties(RT
|
|||||||
int nStyle = 0;
|
int nStyle = 0;
|
||||||
if (!m_aStates.empty())
|
if (!m_aStates.empty())
|
||||||
nStyle = m_aStates.top().nCurrentStyleIndex;
|
nStyle = m_aStates.top().nCurrentStyleIndex;
|
||||||
RTFReferenceTable::Entries_t::iterator it = m_aStyleTableEntries.find(nStyle);
|
auto it = m_aStyleTableEntries.find(nStyle);
|
||||||
if (it != m_aStyleTableEntries.end())
|
if (it != m_aStyleTableEntries.end())
|
||||||
{
|
{
|
||||||
RTFReferenceProperties& rProps = *static_cast<RTFReferenceProperties*>(it->second.get());
|
RTFReferenceProperties& rProps = *static_cast<RTFReferenceProperties*>(it->second.get());
|
||||||
|
|
||||||
// cloneAndDeduplicate() wants to know about only a single "style", so
|
// cloneAndDeduplicate() wants to know about only a single "style", so
|
||||||
// let's merge paragraph and character style properties here.
|
// let's merge paragraph and character style properties here.
|
||||||
RTFReferenceTable::Entries_t::iterator itChar = m_aStyleTableEntries.end();
|
auto itChar = m_aStyleTableEntries.end();
|
||||||
if (!m_aStates.empty())
|
if (!m_aStates.empty())
|
||||||
{
|
{
|
||||||
int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex;
|
int nCharStyle = m_aStates.top().nCurrentCharacterStyleIndex;
|
||||||
@@ -654,7 +654,7 @@ rtl_TextEncoding RTFDocumentImpl::getEncoding(int nFontIndex)
|
|||||||
{
|
{
|
||||||
if (!m_pSuperstream)
|
if (!m_pSuperstream)
|
||||||
{
|
{
|
||||||
std::map<int, rtl_TextEncoding>::iterator it = m_aFontEncodings.find(nFontIndex);
|
auto it = m_aFontEncodings.find(nFontIndex);
|
||||||
if (it != m_aFontEncodings.end())
|
if (it != m_aFontEncodings.end())
|
||||||
// We have a font encoding associated to this font.
|
// We have a font encoding associated to this font.
|
||||||
return it->second;
|
return it->second;
|
||||||
@@ -949,9 +949,9 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
|
|||||||
auto pExtentValue = std::make_shared<RTFValue>(aExtentAttributes);
|
auto pExtentValue = std::make_shared<RTFValue>(aExtentAttributes);
|
||||||
// docpr sprm
|
// docpr sprm
|
||||||
RTFSprms aDocprAttributes;
|
RTFSprms aDocprAttributes;
|
||||||
for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i)
|
for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes)
|
||||||
if (i->first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || i->first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr)
|
if (rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_name || rCharacterAttribute.first == NS_ooxml::LN_CT_NonVisualDrawingProps_descr)
|
||||||
aDocprAttributes.set(i->first, i->second);
|
aDocprAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second);
|
||||||
auto pDocprValue = std::make_shared<RTFValue>(aDocprAttributes);
|
auto pDocprValue = std::make_shared<RTFValue>(aDocprAttributes);
|
||||||
if (bInline)
|
if (bInline)
|
||||||
{
|
{
|
||||||
@@ -974,23 +974,23 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS
|
|||||||
RTFSprms aAnchorWrapAttributes;
|
RTFSprms aAnchorWrapAttributes;
|
||||||
m_aStates.top().aShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_behindDoc, std::make_shared<RTFValue>((m_aStates.top().aShape.bInBackground) ? 1 : 0));
|
m_aStates.top().aShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_behindDoc, std::make_shared<RTFValue>((m_aStates.top().aShape.bInBackground) ? 1 : 0));
|
||||||
RTFSprms aAnchorSprms;
|
RTFSprms aAnchorSprms;
|
||||||
for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterAttributes.begin(); i != m_aStates.top().aCharacterAttributes.end(); ++i)
|
for (auto& rCharacterAttribute : m_aStates.top().aCharacterAttributes)
|
||||||
{
|
{
|
||||||
if (i->first == NS_ooxml::LN_CT_WrapSquare_wrapText)
|
if (rCharacterAttribute.first == NS_ooxml::LN_CT_WrapSquare_wrapText)
|
||||||
aAnchorWrapAttributes.set(i->first, i->second);
|
aAnchorWrapAttributes.set(rCharacterAttribute.first, rCharacterAttribute.second);
|
||||||
}
|
}
|
||||||
sal_Int32 nWrap = -1;
|
sal_Int32 nWrap = -1;
|
||||||
for (RTFSprms::Iterator_t i = m_aStates.top().aCharacterSprms.begin(); i != m_aStates.top().aCharacterSprms.end(); ++i)
|
for (auto& rCharacterSprm : m_aStates.top().aCharacterSprms)
|
||||||
{
|
{
|
||||||
if (i->first == NS_ooxml::LN_EG_WrapType_wrapNone || i->first == NS_ooxml::LN_EG_WrapType_wrapTight)
|
if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapNone || rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight)
|
||||||
{
|
{
|
||||||
nWrap = i->first;
|
nWrap = rCharacterSprm.first;
|
||||||
|
|
||||||
// If there is a wrap polygon prepared by RTFSdrImport, pick it up here.
|
// If there is a wrap polygon prepared by RTFSdrImport, pick it up here.
|
||||||
if (i->first == NS_ooxml::LN_EG_WrapType_wrapTight && !m_aStates.top().aShape.aWrapPolygonSprms.empty())
|
if (rCharacterSprm.first == NS_ooxml::LN_EG_WrapType_wrapTight && !m_aStates.top().aShape.aWrapPolygonSprms.empty())
|
||||||
i->second->getSprms().set(NS_ooxml::LN_CT_WrapTight_wrapPolygon, std::make_shared<RTFValue>(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms));
|
rCharacterSprm.second->getSprms().set(NS_ooxml::LN_CT_WrapTight_wrapPolygon, std::make_shared<RTFValue>(RTFSprms(), m_aStates.top().aShape.aWrapPolygonSprms));
|
||||||
|
|
||||||
aAnchorSprms.set(i->first, i->second);
|
aAnchorSprms.set(rCharacterSprm.first, rCharacterSprm.second);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto pAnchorWrapValue = std::make_shared<RTFValue>(aAnchorWrapAttributes);
|
auto pAnchorWrapValue = std::make_shared<RTFValue>(aAnchorWrapAttributes);
|
||||||
@@ -1237,7 +1237,7 @@ void RTFDocumentImpl::text(OUString& rString)
|
|||||||
//See fdo#47347 initial invalid font entry properties are inserted first,
|
//See fdo#47347 initial invalid font entry properties are inserted first,
|
||||||
//so when we attempt to insert the correct ones, there's already an
|
//so when we attempt to insert the correct ones, there's already an
|
||||||
//entry in the map for them, so the new ones aren't inserted.
|
//entry in the map for them, so the new ones aren't inserted.
|
||||||
RTFReferenceTable::Entries_t::iterator lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex);
|
auto lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex);
|
||||||
if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first)))
|
if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first)))
|
||||||
lb->second = pProp;
|
lb->second = pProp;
|
||||||
else
|
else
|
||||||
@@ -1539,9 +1539,9 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
|
|||||||
|
|
||||||
bool findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName)
|
bool findPropertyName(const std::vector<beans::PropertyValue>& rProperties, const OUString& rName)
|
||||||
{
|
{
|
||||||
for (std::vector<beans::PropertyValue>::const_iterator it = rProperties.begin(); it != rProperties.end(); ++it)
|
for (auto& rProperty : rProperties)
|
||||||
{
|
{
|
||||||
if (it->Name == rName)
|
if (rProperty.Name == rName)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1918,8 +1918,8 @@ RTFError RTFDocumentImpl::popState()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case Destination::LISTENTRY:
|
case Destination::LISTENTRY:
|
||||||
for (RTFSprms::Iterator_t i = aState.aListLevelEntries.begin(); i != aState.aListLevelEntries.end(); ++i)
|
for (auto& rListLevelEntry : aState.aListLevelEntries)
|
||||||
aState.aTableSprms.set(i->first, i->second, RTFOverwrite::NO_APPEND);
|
aState.aTableSprms.set(rListLevelEntry.first, rListLevelEntry.second, RTFOverwrite::NO_APPEND);
|
||||||
break;
|
break;
|
||||||
case Destination::FIELDINSTRUCTION:
|
case Destination::FIELDINSTRUCTION:
|
||||||
{
|
{
|
||||||
@@ -2071,8 +2071,8 @@ RTFError RTFDocumentImpl::popState()
|
|||||||
else if (aState.bInShapeGroup && !aState.bInShape)
|
else if (aState.bInShapeGroup && !aState.bInShape)
|
||||||
{
|
{
|
||||||
// End of a groupshape, as we're in shapegroup, but not in a real shape.
|
// End of a groupshape, as we're in shapegroup, but not in a real shape.
|
||||||
for (std::vector< std::pair<OUString, OUString> >::iterator i = aState.aShape.aGroupProperties.begin(); i != aState.aShape.aGroupProperties.end(); ++i)
|
for (auto& rGroupProperty : aState.aShape.aGroupProperties)
|
||||||
m_pSdrImport->appendGroupProperty(i->first, i->second);
|
m_pSdrImport->appendGroupProperty(rGroupProperty.first, rGroupProperty.second);
|
||||||
aState.aShape.aGroupProperties.clear();
|
aState.aShape.aGroupProperties.clear();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -30,11 +30,11 @@ RTFReferenceProperties::~RTFReferenceProperties() = default;
|
|||||||
|
|
||||||
void RTFReferenceProperties::resolve(Properties& rHandler)
|
void RTFReferenceProperties::resolve(Properties& rHandler)
|
||||||
{
|
{
|
||||||
for (RTFSprms::Iterator_t i = m_aAttributes.begin(); i != m_aAttributes.end(); ++i)
|
for (auto& rAttribute : m_aAttributes)
|
||||||
rHandler.attribute(i->first, *i->second.get());
|
rHandler.attribute(rAttribute.first, *rAttribute.second.get());
|
||||||
for (RTFSprms::Iterator_t i = m_aSprms.begin(); i != m_aSprms.end(); ++i)
|
for (auto& rSprm : m_aSprms)
|
||||||
{
|
{
|
||||||
RTFSprm aSprm(i->first, i->second);
|
RTFSprm aSprm(rSprm.first, rSprm.second);
|
||||||
rHandler.sprm(aSprm);
|
rHandler.sprm(aSprm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,8 +23,8 @@ RTFReferenceTable::~RTFReferenceTable() = default;
|
|||||||
|
|
||||||
void RTFReferenceTable::resolve(Table& rHandler)
|
void RTFReferenceTable::resolve(Table& rHandler)
|
||||||
{
|
{
|
||||||
for (Entries_t::const_iterator i = m_aEntries.begin(); i != m_aEntries.end(); ++i)
|
for (auto& rEntry : m_aEntries)
|
||||||
rHandler.entry(i->first, i->second);
|
rHandler.entry(rEntry.first, rEntry.second);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace rtftok
|
} // namespace rtftok
|
||||||
|
@@ -353,33 +353,32 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
bool bCustom(false);
|
bool bCustom(false);
|
||||||
int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict);
|
int const nType = initShape(xShape, xPropertySet, bCustom, rShape, bClose, shapeOrPict);
|
||||||
|
|
||||||
for (std::vector< std::pair<OUString, OUString> >::iterator i = rShape.aProperties.begin();
|
for (auto& rProperty : rShape.aProperties)
|
||||||
i != rShape.aProperties.end(); ++i)
|
|
||||||
{
|
{
|
||||||
if (i->first == "shapeType")
|
if (rProperty.first == "shapeType")
|
||||||
{
|
{
|
||||||
continue; // ignore: already handled by initShape
|
continue; // ignore: already handled by initShape
|
||||||
}
|
}
|
||||||
else if (i->first == "wzName")
|
else if (rProperty.first == "wzName")
|
||||||
{
|
{
|
||||||
if (m_bTextFrame)
|
if (m_bTextFrame)
|
||||||
{
|
{
|
||||||
uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
|
uno::Reference<container::XNamed> xNamed(xShape, uno::UNO_QUERY);
|
||||||
xNamed->setName(i->second);
|
xNamed->setName(rProperty.second);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
xPropertySet->setPropertyValue("Name", uno::makeAny(i->second));
|
xPropertySet->setPropertyValue("Name", uno::makeAny(rProperty.second));
|
||||||
}
|
}
|
||||||
else if (i->first == "wzDescription")
|
else if (rProperty.first == "wzDescription")
|
||||||
xPropertySet->setPropertyValue("Description", uno::makeAny(i->second));
|
xPropertySet->setPropertyValue("Description", uno::makeAny(rProperty.second));
|
||||||
else if (i->first == "pib")
|
else if (rProperty.first == "pib")
|
||||||
{
|
{
|
||||||
m_rImport.setDestinationText(i->second);
|
m_rImport.setDestinationText(rProperty.second);
|
||||||
bPib = true;
|
bPib = true;
|
||||||
}
|
}
|
||||||
else if (i->first == "fillColor" && xPropertySet.is())
|
else if (rProperty.first == "fillColor" && xPropertySet.is())
|
||||||
{
|
{
|
||||||
aAny <<= msfilter::util::BGRToRGB(i->second.toUInt32());
|
aAny <<= msfilter::util::BGRToRGB(rProperty.second.toUInt32());
|
||||||
if (m_bTextFrame)
|
if (m_bTextFrame)
|
||||||
xPropertySet->setPropertyValue("BackColor", aAny);
|
xPropertySet->setPropertyValue("BackColor", aAny);
|
||||||
else
|
else
|
||||||
@@ -388,28 +387,28 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
// fillType will decide, possible it'll be the start color of a gradient.
|
// fillType will decide, possible it'll be the start color of a gradient.
|
||||||
aFillModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(aAny.get<sal_Int32>())));
|
aFillModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(aAny.get<sal_Int32>())));
|
||||||
}
|
}
|
||||||
else if (i->first == "fillBackColor")
|
else if (rProperty.first == "fillBackColor")
|
||||||
// fillType will decide, possible it'll be the end color of a gradient.
|
// fillType will decide, possible it'll be the end color of a gradient.
|
||||||
aFillModel.moColor2.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(i->second.toInt32()))));
|
aFillModel.moColor2.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(rProperty.second.toInt32()))));
|
||||||
else if (i->first == "lineColor")
|
else if (rProperty.first == "lineColor")
|
||||||
aLineColor <<= msfilter::util::BGRToRGB(i->second.toInt32());
|
aLineColor <<= msfilter::util::BGRToRGB(rProperty.second.toInt32());
|
||||||
else if (i->first == "lineBackColor")
|
else if (rProperty.first == "lineBackColor")
|
||||||
; // Ignore: complementer of lineColor
|
; // Ignore: complementer of lineColor
|
||||||
else if (i->first == "txflTextFlow" && xPropertySet.is())
|
else if (rProperty.first == "txflTextFlow" && xPropertySet.is())
|
||||||
{
|
{
|
||||||
if (i->second.toInt32() == 1)
|
if (rProperty.second.toInt32() == 1)
|
||||||
eWritingMode = text::WritingMode_TB_RL;
|
eWritingMode = text::WritingMode_TB_RL;
|
||||||
}
|
}
|
||||||
else if (i->first == "fLine" && xPropertySet.is())
|
else if (rProperty.first == "fLine" && xPropertySet.is())
|
||||||
resolveFLine(xPropertySet, i->second.toInt32());
|
resolveFLine(xPropertySet, rProperty.second.toInt32());
|
||||||
else if (i->first == "fillOpacity" && xPropertySet.is())
|
else if (rProperty.first == "fillOpacity" && xPropertySet.is())
|
||||||
{
|
{
|
||||||
int opacity = 100 - (i->second.toInt32())*100/65536;
|
int opacity = 100 - (rProperty.second.toInt32())*100/65536;
|
||||||
xPropertySet->setPropertyValue("FillTransparence", uno::Any(sal_uInt32(opacity)));
|
xPropertySet->setPropertyValue("FillTransparence", uno::Any(sal_uInt32(opacity)));
|
||||||
}
|
}
|
||||||
else if (i->first == "lineWidth")
|
else if (rProperty.first == "lineWidth")
|
||||||
aLineWidth <<= i->second.toInt32()/360;
|
aLineWidth <<= rProperty.second.toInt32()/360;
|
||||||
else if (i->first == "pVerticies")
|
else if (rProperty.first == "pVerticies")
|
||||||
{
|
{
|
||||||
std::vector<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
|
std::vector<drawing::EnhancedCustomShapeParameterPair> aCoordinates;
|
||||||
sal_Int32 nSize = 0; // Size of a token (its value is hardwired in the exporter)
|
sal_Int32 nSize = 0; // Size of a token (its value is hardwired in the exporter)
|
||||||
@@ -417,7 +416,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
sal_Int32 nCharIndex = 0; // Character index
|
sal_Int32 nCharIndex = 0; // Character index
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
OUString aToken = i->second.getToken(0, ';', nCharIndex);
|
OUString aToken = rProperty.second.getToken(0, ';', nCharIndex);
|
||||||
if (!nSize)
|
if (!nSize)
|
||||||
nSize = aToken.toInt32();
|
nSize = aToken.toInt32();
|
||||||
else if (!nCount)
|
else if (!nCount)
|
||||||
@@ -449,7 +448,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
aPropertyValue.Value <<= comphelper::containerToSequence(aCoordinates);
|
aPropertyValue.Value <<= comphelper::containerToSequence(aCoordinates);
|
||||||
aPath.push_back(aPropertyValue);
|
aPath.push_back(aPropertyValue);
|
||||||
}
|
}
|
||||||
else if (i->first == "pSegmentInfo")
|
else if (rProperty.first == "pSegmentInfo")
|
||||||
{
|
{
|
||||||
std::vector<drawing::EnhancedCustomShapeSegment> aSegments;
|
std::vector<drawing::EnhancedCustomShapeSegment> aSegments;
|
||||||
sal_Int32 nSize = 0;
|
sal_Int32 nSize = 0;
|
||||||
@@ -457,7 +456,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
sal_Int32 nCharIndex = 0;
|
sal_Int32 nCharIndex = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
sal_Int32 nSeg = i->second.getToken(0, ';', nCharIndex).toInt32();
|
sal_Int32 nSeg = rProperty.second.getToken(0, ';', nCharIndex).toInt32();
|
||||||
if (!nSize)
|
if (!nSize)
|
||||||
nSize = nSeg;
|
nSize = nSeg;
|
||||||
else if (!nCount)
|
else if (!nCount)
|
||||||
@@ -517,98 +516,98 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
aPropertyValue.Value <<= comphelper::containerToSequence(aSegments);
|
aPropertyValue.Value <<= comphelper::containerToSequence(aSegments);
|
||||||
aPath.push_back(aPropertyValue);
|
aPath.push_back(aPropertyValue);
|
||||||
}
|
}
|
||||||
else if (i->first == "geoLeft")
|
else if (rProperty.first == "geoLeft")
|
||||||
aViewBox.X = i->second.toInt32();
|
aViewBox.X = rProperty.second.toInt32();
|
||||||
else if (i->first == "geoTop")
|
else if (rProperty.first == "geoTop")
|
||||||
aViewBox.Y = i->second.toInt32();
|
aViewBox.Y = rProperty.second.toInt32();
|
||||||
else if (i->first == "geoRight")
|
else if (rProperty.first == "geoRight")
|
||||||
aViewBox.Width = i->second.toInt32();
|
aViewBox.Width = rProperty.second.toInt32();
|
||||||
else if (i->first == "geoBottom")
|
else if (rProperty.first == "geoBottom")
|
||||||
aViewBox.Height = i->second.toInt32();
|
aViewBox.Height = rProperty.second.toInt32();
|
||||||
else if (i->first == "dhgt")
|
else if (rProperty.first == "dhgt")
|
||||||
{
|
{
|
||||||
// dhgt is Word 2007, \shpz is Word 97-2003, the later has priority.
|
// dhgt is Word 2007, \shpz is Word 97-2003, the later has priority.
|
||||||
if (!rShape.oZ)
|
if (!rShape.oZ)
|
||||||
resolveDhgt(xPropertySet, i->second.toInt32(), /*bOldStyle=*/false);
|
resolveDhgt(xPropertySet, rProperty.second.toInt32(), /*bOldStyle=*/false);
|
||||||
}
|
}
|
||||||
// These are in EMU, convert to mm100.
|
// These are in EMU, convert to mm100.
|
||||||
else if (i->first == "dxTextLeft")
|
else if (rProperty.first == "dxTextLeft")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("LeftBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dyTextTop")
|
else if (rProperty.first == "dyTextTop")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("TopBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dxTextRight")
|
else if (rProperty.first == "dxTextRight")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("RightBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dyTextBottom")
|
else if (rProperty.first == "dyTextBottom")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("BottomBorderDistance", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dxWrapDistLeft")
|
else if (rProperty.first == "dxWrapDistLeft")
|
||||||
{
|
{
|
||||||
if (m_bTextGraphicObject)
|
if (m_bTextGraphicObject)
|
||||||
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distL, std::make_shared<RTFValue>(i->second.toInt32()));
|
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distL, std::make_shared<RTFValue>(rProperty.second.toInt32()));
|
||||||
else if (xPropertySet.is())
|
else if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("LeftMargin", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dyWrapDistTop")
|
else if (rProperty.first == "dyWrapDistTop")
|
||||||
{
|
{
|
||||||
if (m_bTextGraphicObject)
|
if (m_bTextGraphicObject)
|
||||||
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distT, std::make_shared<RTFValue>(i->second.toInt32()));
|
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distT, std::make_shared<RTFValue>(rProperty.second.toInt32()));
|
||||||
else if (xPropertySet.is())
|
else if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("TopMargin", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("TopMargin", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dxWrapDistRight")
|
else if (rProperty.first == "dxWrapDistRight")
|
||||||
{
|
{
|
||||||
if (m_bTextGraphicObject)
|
if (m_bTextGraphicObject)
|
||||||
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distR, std::make_shared<RTFValue>(i->second.toInt32()));
|
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distR, std::make_shared<RTFValue>(rProperty.second.toInt32()));
|
||||||
else if (xPropertySet.is())
|
else if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("RightMargin", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("RightMargin", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "dyWrapDistBottom")
|
else if (rProperty.first == "dyWrapDistBottom")
|
||||||
{
|
{
|
||||||
if (m_bTextGraphicObject)
|
if (m_bTextGraphicObject)
|
||||||
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distB, std::make_shared<RTFValue>(i->second.toInt32()));
|
rShape.aAnchorAttributes.set(NS_ooxml::LN_CT_Anchor_distB, std::make_shared<RTFValue>(rProperty.second.toInt32()));
|
||||||
else if (xPropertySet.is())
|
else if (xPropertySet.is())
|
||||||
xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(i->second.toInt32() / 360));
|
xPropertySet->setPropertyValue("BottomMargin", uno::makeAny(rProperty.second.toInt32() / 360));
|
||||||
}
|
}
|
||||||
else if (i->first == "fillType")
|
else if (rProperty.first == "fillType")
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 7: // Shade using the fillAngle
|
case 7: // Shade using the fillAngle
|
||||||
aFillModel.moType.set(oox::XML_gradient);
|
aFillModel.moType.set(oox::XML_gradient);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SAL_INFO("writerfilter", "TODO handle fillType value '" << i->second << "'");
|
SAL_INFO("writerfilter", "TODO handle fillType value '" << rProperty.second << "'");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "fillFocus")
|
else if (rProperty.first == "fillFocus")
|
||||||
aFillModel.moFocus.set(i->second.toDouble() / 100); // percent
|
aFillModel.moFocus.set(rProperty.second.toDouble() / 100); // percent
|
||||||
else if (i->first == "fShadow" && xPropertySet.is())
|
else if (rProperty.first == "fShadow" && xPropertySet.is())
|
||||||
{
|
{
|
||||||
if (i->second.toInt32() == 1)
|
if (rProperty.second.toInt32() == 1)
|
||||||
aShadowModel.mbHasShadow = true;
|
aShadowModel.mbHasShadow = true;
|
||||||
}
|
}
|
||||||
else if (i->first == "shadowColor")
|
else if (rProperty.first == "shadowColor")
|
||||||
aShadowModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(i->second.toInt32()))));
|
aShadowModel.moColor.set("#" + OUString::fromUtf8(msfilter::util::ConvertColor(msfilter::util::BGRToRGB(rProperty.second.toInt32()))));
|
||||||
else if (i->first == "shadowOffsetX")
|
else if (rProperty.first == "shadowOffsetX")
|
||||||
// EMUs to points
|
// EMUs to points
|
||||||
aShadowModel.moOffset.set(OUString::number(i->second.toDouble() / 12700) + "pt");
|
aShadowModel.moOffset.set(OUString::number(rProperty.second.toDouble() / 12700) + "pt");
|
||||||
else if (i->first == "posh" || i->first == "posv" || i->first == "fFitShapeToText" || i->first == "fFilled" || i->first == "rotation")
|
else if (rProperty.first == "posh" || rProperty.first == "posv" || rProperty.first == "fFitShapeToText" || rProperty.first == "fFilled" || rProperty.first == "rotation")
|
||||||
applyProperty(xShape, i->first, i->second);
|
applyProperty(xShape, rProperty.first, rProperty.second);
|
||||||
else if (i->first == "posrelh")
|
else if (rProperty.first == "posrelh")
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
rShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
|
rShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
|
||||||
@@ -617,9 +616,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "posrelv")
|
else if (rProperty.first == "posrelv")
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 1:
|
case 1:
|
||||||
rShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
|
rShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
|
||||||
@@ -628,36 +627,36 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "groupLeft")
|
else if (rProperty.first == "groupLeft")
|
||||||
oGroupLeft.reset(convertTwipToMm100(i->second.toInt32()));
|
oGroupLeft.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "groupTop")
|
else if (rProperty.first == "groupTop")
|
||||||
oGroupTop.reset(convertTwipToMm100(i->second.toInt32()));
|
oGroupTop.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "groupRight")
|
else if (rProperty.first == "groupRight")
|
||||||
oGroupRight.reset(convertTwipToMm100(i->second.toInt32()));
|
oGroupRight.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "groupBottom")
|
else if (rProperty.first == "groupBottom")
|
||||||
oGroupBottom.reset(convertTwipToMm100(i->second.toInt32()));
|
oGroupBottom.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "relLeft")
|
else if (rProperty.first == "relLeft")
|
||||||
oRelLeft.reset(convertTwipToMm100(i->second.toInt32()));
|
oRelLeft.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "relTop")
|
else if (rProperty.first == "relTop")
|
||||||
oRelTop.reset(convertTwipToMm100(i->second.toInt32()));
|
oRelTop.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "relRight")
|
else if (rProperty.first == "relRight")
|
||||||
oRelRight.reset(convertTwipToMm100(i->second.toInt32()));
|
oRelRight.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "relBottom")
|
else if (rProperty.first == "relBottom")
|
||||||
oRelBottom.reset(convertTwipToMm100(i->second.toInt32()));
|
oRelBottom.reset(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
else if (i->first == "fBehindDocument")
|
else if (rProperty.first == "fBehindDocument")
|
||||||
bOpaque = !i->second.toInt32();
|
bOpaque = !rProperty.second.toInt32();
|
||||||
else if (i->first == "pctHoriz" || i->first == "pctVert")
|
else if (rProperty.first == "pctHoriz" || rProperty.first == "pctVert")
|
||||||
{
|
{
|
||||||
sal_Int16 nPercentage = rtl::math::round(i->second.toDouble() / 10);
|
sal_Int16 nPercentage = rtl::math::round(rProperty.second.toDouble() / 10);
|
||||||
boost::optional<sal_Int16>& rPercentage = i->first == "pctHoriz" ? oRelativeWidth : oRelativeHeight;
|
boost::optional<sal_Int16>& rPercentage = rProperty.first == "pctHoriz" ? oRelativeWidth : oRelativeHeight;
|
||||||
if (nPercentage)
|
if (nPercentage)
|
||||||
rPercentage = nPercentage;
|
rPercentage = nPercentage;
|
||||||
}
|
}
|
||||||
else if (i->first == "sizerelh")
|
else if (rProperty.first == "sizerelh")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 0: // margin
|
case 0: // margin
|
||||||
nRelativeWidthRelation = text::RelOrientation::FRAME;
|
nRelativeWidthRelation = text::RelOrientation::FRAME;
|
||||||
@@ -666,16 +665,16 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME;
|
nRelativeWidthRelation = text::RelOrientation::PAGE_FRAME;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelh value: " << i->second);
|
SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelh value: " << rProperty.second);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "sizerelv")
|
else if (rProperty.first == "sizerelv")
|
||||||
{
|
{
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
{
|
{
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 0: // margin
|
case 0: // margin
|
||||||
nRelativeHeightRelation = text::RelOrientation::FRAME;
|
nRelativeHeightRelation = text::RelOrientation::FRAME;
|
||||||
@@ -684,12 +683,12 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
|
nRelativeHeightRelation = text::RelOrientation::PAGE_FRAME;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelv value: " << i->second);
|
SAL_WARN("writerfilter", "RTFSdrImport::resolve: unhandled sizerelv value: " << rProperty.second);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "fHorizRule") // TODO: what does "fStandardHR" do?
|
else if (rProperty.first == "fHorizRule") // TODO: what does "fStandardHR" do?
|
||||||
{
|
{
|
||||||
// horizontal rule: relative width defaults to 100% of paragraph
|
// horizontal rule: relative width defaults to 100% of paragraph
|
||||||
// TODO: does it have a default height?
|
// TODO: does it have a default height?
|
||||||
@@ -704,28 +703,28 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
|
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "pctHR")
|
else if (rProperty.first == "pctHR")
|
||||||
{
|
{
|
||||||
// horizontal rule relative width in permille
|
// horizontal rule relative width in permille
|
||||||
oRelativeWidth = i->second.toInt32() / 10;
|
oRelativeWidth = rProperty.second.toInt32() / 10;
|
||||||
}
|
}
|
||||||
else if (i->first == "dxHeightHR")
|
else if (rProperty.first == "dxHeightHR")
|
||||||
{
|
{
|
||||||
// horizontal rule height
|
// horizontal rule height
|
||||||
sal_uInt32 const nHeight(convertTwipToMm100(i->second.toInt32()));
|
sal_uInt32 const nHeight(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
rShape.nBottom = rShape.nTop + nHeight;
|
rShape.nBottom = rShape.nTop + nHeight;
|
||||||
}
|
}
|
||||||
else if (i->first == "dxWidthHR")
|
else if (rProperty.first == "dxWidthHR")
|
||||||
{
|
{
|
||||||
// horizontal rule width
|
// horizontal rule width
|
||||||
sal_uInt32 const nWidth(convertTwipToMm100(i->second.toInt32()));
|
sal_uInt32 const nWidth(convertTwipToMm100(rProperty.second.toInt32()));
|
||||||
rShape.nRight = rShape.nLeft + nWidth;
|
rShape.nRight = rShape.nLeft + nWidth;
|
||||||
}
|
}
|
||||||
else if (i->first == "alignHR")
|
else if (rProperty.first == "alignHR")
|
||||||
{
|
{
|
||||||
// horizontal orientation *for horizontal rule*
|
// horizontal orientation *for horizontal rule*
|
||||||
sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
|
sal_Int16 nHoriOrient = text::HoriOrientation::NONE;
|
||||||
switch (i->second.toInt32())
|
switch (rProperty.second.toInt32())
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
nHoriOrient = text::HoriOrientation::LEFT;
|
nHoriOrient = text::HoriOrientation::LEFT;
|
||||||
@@ -742,7 +741,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
|
xPropertySet->setPropertyValue("HoriOrient", uno::makeAny(nHoriOrient));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (i->first == "pWrapPolygonVertices")
|
else if (rProperty.first == "pWrapPolygonVertices")
|
||||||
{
|
{
|
||||||
RTFSprms aPolygonSprms;
|
RTFSprms aPolygonSprms;
|
||||||
sal_Int32 nSize = 0; // Size of a token
|
sal_Int32 nSize = 0; // Size of a token
|
||||||
@@ -750,7 +749,7 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
sal_Int32 nCharIndex = 0; // Character index
|
sal_Int32 nCharIndex = 0; // Character index
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
OUString aToken = i->second.getToken(0, ';', nCharIndex);
|
OUString aToken = rProperty.second.getToken(0, ';', nCharIndex);
|
||||||
if (!nSize)
|
if (!nSize)
|
||||||
nSize = aToken.toInt32();
|
nSize = aToken.toInt32();
|
||||||
else if (!nCount)
|
else if (!nCount)
|
||||||
@@ -780,10 +779,10 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
|
|||||||
while (nCharIndex >= 0);
|
while (nCharIndex >= 0);
|
||||||
rShape.aWrapPolygonSprms = aPolygonSprms;
|
rShape.aWrapPolygonSprms = aPolygonSprms;
|
||||||
}
|
}
|
||||||
else if (i->first == "fRelFlipV")
|
else if (rProperty.first == "fRelFlipV")
|
||||||
obRelFlipV = i->second.toInt32() == 1;
|
obRelFlipV = rProperty.second.toInt32() == 1;
|
||||||
else
|
else
|
||||||
SAL_INFO("writerfilter", "TODO handle shape property '" << i->first << "':'" << i->second << "'");
|
SAL_INFO("writerfilter", "TODO handle shape property '" << rProperty.first << "':'" << rProperty.second << "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xPropertySet.is())
|
if (xPropertySet.is())
|
||||||
|
@@ -74,13 +74,13 @@ RTFValue::Pointer_t RTFSprms::find(Id nKeyword, bool bFirst, bool bForWrite)
|
|||||||
if (bForWrite)
|
if (bForWrite)
|
||||||
ensureCopyBeforeWrite();
|
ensureCopyBeforeWrite();
|
||||||
|
|
||||||
for (RTFSprms::Iterator_t i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
|
for (auto& rSprm : *m_pSprms)
|
||||||
if (i->first == nKeyword)
|
if (rSprm.first == nKeyword)
|
||||||
{
|
{
|
||||||
if (bFirst)
|
if (bFirst)
|
||||||
return i->second;
|
return rSprm.second;
|
||||||
else
|
else
|
||||||
pValue = i->second;
|
pValue = rSprm.second;
|
||||||
}
|
}
|
||||||
return pValue;
|
return pValue;
|
||||||
}
|
}
|
||||||
@@ -91,12 +91,12 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr
|
|||||||
bool bFound = false;
|
bool bFound = false;
|
||||||
if (eOverwrite == RTFOverwrite::YES || eOverwrite == RTFOverwrite::NO_IGNORE)
|
if (eOverwrite == RTFOverwrite::YES || eOverwrite == RTFOverwrite::NO_IGNORE)
|
||||||
{
|
{
|
||||||
for (RTFSprms::Iterator_t i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
|
for (auto& rSprm : *m_pSprms)
|
||||||
if (i->first == nKeyword)
|
if (rSprm.first == nKeyword)
|
||||||
{
|
{
|
||||||
if (eOverwrite == RTFOverwrite::YES)
|
if (eOverwrite == RTFOverwrite::YES)
|
||||||
{
|
{
|
||||||
i->second = pValue;
|
rSprm.second = pValue;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -113,7 +113,7 @@ void RTFSprms::set(Id nKeyword, RTFValue::Pointer_t pValue, RTFOverwrite eOverwr
|
|||||||
bool RTFSprms::erase(Id nKeyword)
|
bool RTFSprms::erase(Id nKeyword)
|
||||||
{
|
{
|
||||||
ensureCopyBeforeWrite();
|
ensureCopyBeforeWrite();
|
||||||
for (RTFSprms::Iterator_t i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
|
for (auto i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
|
||||||
{
|
{
|
||||||
if (i->first == nKeyword)
|
if (i->first == nKeyword)
|
||||||
{
|
{
|
||||||
@@ -127,7 +127,7 @@ bool RTFSprms::erase(Id nKeyword)
|
|||||||
void RTFSprms::eraseLast(Id nKeyword)
|
void RTFSprms::eraseLast(Id nKeyword)
|
||||||
{
|
{
|
||||||
ensureCopyBeforeWrite();
|
ensureCopyBeforeWrite();
|
||||||
for (RTFSprms::ReverseIterator_t i = m_pSprms->rbegin(); i != m_pSprms->rend(); ++i)
|
for (auto i = m_pSprms->rbegin(); i != m_pSprms->rend(); ++i)
|
||||||
{
|
{
|
||||||
if (i->first == nKeyword)
|
if (i->first == nKeyword)
|
||||||
{
|
{
|
||||||
@@ -158,42 +158,37 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference) const
|
|||||||
|
|
||||||
// Note: apparently some attributes are set with OVERWRITE_NO_APPEND;
|
// Note: apparently some attributes are set with OVERWRITE_NO_APPEND;
|
||||||
// it is probably a bad idea to mess with those in any way here?
|
// it is probably a bad idea to mess with those in any way here?
|
||||||
for (RTFSprms::Iterator_t i = rReference.begin(); i != rReference.end(); ++i)
|
for (auto& rSprm : rReference)
|
||||||
{
|
{
|
||||||
RTFValue::Pointer_t const pValue(ret.find(i->first));
|
RTFValue::Pointer_t const pValue(ret.find(rSprm.first));
|
||||||
if (pValue)
|
if (pValue)
|
||||||
{
|
{
|
||||||
if (i->second->equals(*pValue))
|
if (rSprm.second->equals(*pValue))
|
||||||
{
|
{
|
||||||
ret.erase(i->first); // duplicate to style
|
ret.erase(rSprm.first); // duplicate to style
|
||||||
}
|
}
|
||||||
else if (!i->second->getSprms().empty() || !i->second->getAttributes().empty())
|
else if (!rSprm.second->getSprms().empty() || !rSprm.second->getAttributes().empty())
|
||||||
{
|
{
|
||||||
RTFSprms const sprms(
|
RTFSprms const sprms(pValue->getSprms().cloneAndDeduplicate(rSprm.second->getSprms()));
|
||||||
pValue->getSprms().cloneAndDeduplicate(i->second->getSprms()));
|
RTFSprms const attributes(pValue->getAttributes().cloneAndDeduplicate(rSprm.second->getAttributes()));
|
||||||
RTFSprms const attributes(
|
ret.set(rSprm.first, RTFValue::Pointer_t(pValue->CloneWithSprms(attributes, sprms)));
|
||||||
pValue->getAttributes().cloneAndDeduplicate(i->second->getAttributes()));
|
|
||||||
ret.set(i->first, RTFValue::Pointer_t(
|
|
||||||
pValue->CloneWithSprms(attributes, sprms)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// not found - try to override style with default
|
// not found - try to override style with default
|
||||||
RTFValue::Pointer_t const pDefault(getDefaultSPRM(i->first));
|
RTFValue::Pointer_t const pDefault(getDefaultSPRM(rSprm.first));
|
||||||
if (pDefault)
|
if (pDefault)
|
||||||
{
|
{
|
||||||
ret.set(i->first, pDefault);
|
ret.set(rSprm.first, pDefault);
|
||||||
}
|
}
|
||||||
else if (!i->second->getSprms().empty() || !i->second->getAttributes().empty())
|
else if (!rSprm.second->getSprms().empty() || !rSprm.second->getAttributes().empty())
|
||||||
{
|
{
|
||||||
RTFSprms const sprms(
|
RTFSprms const sprms(RTFSprms().cloneAndDeduplicate(rSprm.second->getSprms()));
|
||||||
RTFSprms().cloneAndDeduplicate(i->second->getSprms()));
|
RTFSprms const attributes(RTFSprms().cloneAndDeduplicate(rSprm.second->getAttributes()));
|
||||||
RTFSprms const attributes(
|
|
||||||
RTFSprms().cloneAndDeduplicate(i->second->getAttributes()));
|
|
||||||
if (!sprms.empty() || !attributes.empty())
|
if (!sprms.empty() || !attributes.empty())
|
||||||
{
|
{
|
||||||
ret.set(i->first, std::make_shared<RTFValue>(attributes, sprms));
|
ret.set(rSprm.first, std::make_shared<RTFValue>(attributes, sprms));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,9 +198,8 @@ RTFSprms RTFSprms::cloneAndDeduplicate(RTFSprms& rReference) const
|
|||||||
|
|
||||||
bool RTFSprms::equals(RTFValue& rOther)
|
bool RTFSprms::equals(RTFValue& rOther)
|
||||||
{
|
{
|
||||||
RTFSprms::Iterator_t i = m_pSprms->begin();
|
for (auto& rSprm : *m_pSprms)
|
||||||
while (i != m_pSprms->end())
|
if (!rSprm.second->equals(rOther))
|
||||||
if (!i->second->equals(rOther))
|
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -215,8 +209,8 @@ void RTFSprms::ensureCopyBeforeWrite()
|
|||||||
if (m_pSprms->m_nRefCount > 1)
|
if (m_pSprms->m_nRefCount > 1)
|
||||||
{
|
{
|
||||||
boost::intrusive_ptr<RTFSprmsImpl> pClone(new RTFSprmsImpl());
|
boost::intrusive_ptr<RTFSprmsImpl> pClone(new RTFSprmsImpl());
|
||||||
for (std::vector< std::pair<Id, RTFValue::Pointer_t> >::const_iterator i = m_pSprms->begin(); i != m_pSprms->end(); ++i)
|
for (auto& rSprm : *m_pSprms)
|
||||||
pClone->push_back(std::make_pair(i->first, RTFValue::Pointer_t(i->second->Clone())));
|
pClone->push_back(std::make_pair(rSprm.first, RTFValue::Pointer_t(rSprm.second->Clone())));
|
||||||
m_pSprms = pClone;
|
m_pSprms = pClone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -268,7 +268,7 @@ RTFError RTFTokenizer::resolveKeyword()
|
|||||||
|
|
||||||
bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol)
|
bool RTFTokenizer::lookupMathKeyword(RTFMathSymbol& rSymbol)
|
||||||
{
|
{
|
||||||
std::vector<RTFMathSymbol>::iterator low = std::lower_bound(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end(), rSymbol);
|
auto low = std::lower_bound(s_aRTFMathControlWords.begin(), s_aRTFMathControlWords.end(), rSymbol);
|
||||||
int i = low - s_aRTFMathControlWords.begin();
|
int i = low - s_aRTFMathControlWords.begin();
|
||||||
if (low == s_aRTFMathControlWords.end() || rSymbol < *low)
|
if (low == s_aRTFMathControlWords.end() || rSymbol < *low)
|
||||||
return false;
|
return false;
|
||||||
@@ -290,7 +290,7 @@ RTFError RTFTokenizer::dispatchKeyword(OString& rKeyword, bool bParam, int nPara
|
|||||||
"' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'");
|
"' with param? " << (bParam ? 1 : 0) <<" param val: '" << (bParam ? nParam : 0) << "'");
|
||||||
RTFSymbol aSymbol;
|
RTFSymbol aSymbol;
|
||||||
aSymbol.sKeyword = rKeyword.getStr();
|
aSymbol.sKeyword = rKeyword.getStr();
|
||||||
std::vector<RTFSymbol>::iterator low = std::lower_bound(s_aRTFControlWords.begin(), s_aRTFControlWords.end(), aSymbol);
|
auto low = std::lower_bound(s_aRTFControlWords.begin(), s_aRTFControlWords.end(), aSymbol);
|
||||||
int i = low - s_aRTFControlWords.begin();
|
int i = low - s_aRTFControlWords.begin();
|
||||||
if (low == s_aRTFControlWords.end() || aSymbol < *low)
|
if (low == s_aRTFControlWords.end() || aSymbol < *low)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user