[PATCH] minor update in rtfdocumentimpl.cxx
Maxime de Roucy (via Code Review)
gerrit at gerrit.libreoffice.org
Wed Mar 27 04:15:12 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3083
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/83/3083/1
minor update in rtfdocumentimpl.cxx
Change-Id: Ie32166edbc3efb603ccb5e98d8c2cac66ecc2f47
---
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
1 file changed, 27 insertions(+), 12 deletions(-)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index d2fb17f..c7fa7f1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -839,6 +839,7 @@
}
writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms));
checkFirstRun();
+
if (!m_aStates.top().pCurrentBuffer)
{
Mapper().props(pProperties);
@@ -850,6 +851,7 @@
RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
}
+
return 0;
}
@@ -948,7 +950,9 @@
void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
{
sal_uInt8 sValue[] = { nValue };
- if (!m_aStates.top().pCurrentBuffer)
+ RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
+
+ if (!pCurrentBuffer)
{
Mapper().startCharacterGroup();
// Should we send run properties?
@@ -959,10 +963,10 @@
}
else
{
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t()));
+ pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t()));
RTFValue::Pointer_t pValue(new RTFValue(*sValue));
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue));
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t()));
+ pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue));
+ pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t()));
}
}
@@ -1109,31 +1113,37 @@
return;
}
- if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
+ RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
+
+ if (!pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
Mapper().startCharacterGroup();
- else if (m_aStates.top().pCurrentBuffer)
+ else if (pCurrentBuffer)
{
RTFValue::Pointer_t pValue;
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue));
+ pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue));
}
+
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL
|| m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT
|| m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
runProps();
- if (!m_aStates.top().pCurrentBuffer)
+
+ if (!pCurrentBuffer)
Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength());
else
{
RTFValue::Pointer_t pValue(new RTFValue(rString));
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue));
+ pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue));
}
+
m_bNeedCr = true;
- if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
+
+ if (!pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
Mapper().endCharacterGroup();
- else if(m_aStates.top().pCurrentBuffer)
+ else if(pCurrentBuffer)
{
RTFValue::Pointer_t pValue;
- m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue));
+ pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue));
}
}
@@ -2371,6 +2381,7 @@
{
if (!m_aStates.top().pCurrentBuffer)
m_aStates.top().pCurrentBuffer = &m_aSuperBuffer;
+
RTFValue::Pointer_t pValue(new RTFValue("superscript"));
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
}
@@ -2707,12 +2718,14 @@
case RTF_POSY: nId = NS_ooxml::LN_CT_FramePr_y; m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); break;
default: break;
}
+
if (nId > 0)
{
m_bNeedPap = true;
// Don't try to support text frames inside tables for now.
if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer)
m_aStates.top().aFrame.setSprm(nId, nParam);
+
return 0;
}
@@ -4276,6 +4289,7 @@
else if (m_xDocumentProperties.is())
m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
}
+
if (aState.pCurrentBuffer == &m_aSuperBuffer)
{
OSL_ASSERT(m_aStates.top().pCurrentBuffer == 0);
@@ -4285,6 +4299,7 @@
m_bHasFootnote = false;
}
+
if (m_aStates.size())
{
m_aStates.top().nCells = aState.nCells;
--
To view, visit https://gerrit.libreoffice.org/3083
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie32166edbc3efb603ccb5e98d8c2cac66ecc2f47
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Maxime de Roucy <mderoucy at linagora.com>
More information about the LibreOffice
mailing list