Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/3085
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/85/3085/1
use of aState instead of m_aStates.top in popState
Change-Id: I6814e48a92a1b24823c6884a151aa6a139410ff2
---
M writerfilter/source/rtftok/rtfdocumentimpl.cxx
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index e732688..d4896ef 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -209,10 +209,10 @@
return NULL;
}
-static util::DateTime lcl_getDateTime(std::stack<RTFParserState>& aStates)
+static util::DateTime lcl_getDateTime(RTFParserState& aState)
{
- return util::DateTime(0 /*100sec*/, 0 /*sec*/, aStates.top().nMinute, aStates.top().nHour,
- aStates.top().nDay, aStates.top().nMonth, aStates.top().nYear);
+ return util::DateTime(0 /*100sec*/, 0 /*sec*/, aState.nMinute, aState.nHour,
+ aState.nDay, aState.nMonth, aState.nYear);
}
static void lcl_DestinationToMath(OUStringBuffer& rDestinationText,
oox::formulaimport::XmlStreamBuilder& rMathBuffer)
@@ -3821,12 +3821,12 @@
sal_Int32 nReplaces = 1;
for (int i = 0; i < aOrig.getLength(); i++)
{
- if (std::find(m_aStates.top().aLevelNumbers.begin(),
m_aStates.top().aLevelNumbers.end(), i+1)
- != m_aStates.top().aLevelNumbers.end())
+ if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), i+1)
+ != aState.aLevelNumbers.end())
{
aBuf.append(sal_Unicode('%'));
// '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2.
- aBuf.append(sal_Int32(nReplaces++ + m_aStates.top().nListLevelNum + 1 -
m_aStates.top().aLevelNumbers.size()));
+ aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 -
aState.aLevelNumbers.size()));
}
else
aBuf.append(aOrig.copy(i, 1));
@@ -3836,14 +3836,11 @@
}
break;
case DESTINATION_SHAPEPROPERTYNAME:
+
aState.aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(),
OUString()));
+ break;
case DESTINATION_SHAPEPROPERTYVALUE:
- case DESTINATION_SHAPEPROPERTY:
- {
- if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME)
-
aState.aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(),
OUString()));
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE &&
aState.aShape.aProperties.size())
- aState.aShape.aProperties.back().second =
m_aStates.top().aDestinationText.makeStringAndClear();
- }
+ if (aState.aShape.aProperties.size())
+ aState.aShape.aProperties.back().second =
m_aStates.top().aDestinationText.makeStringAndClear();
break;
case DESTINATION_PICPROP:
case DESTINATION_SHAPEINSTRUCTION:
@@ -3878,7 +3875,7 @@
break;
case DESTINATION_DATAFIELD:
{
- OString aStr =
OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(),
m_aStates.top().nCurrentEncoding);
+ OString aStr =
OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), aState.nCurrentEncoding);
// decode hex dump
OStringBuffer aBuf;
const char *str = aStr.getStr();
@@ -3915,9 +3912,9 @@
nLength = aStr.toChar();
aStr = aStr.copy(1);
OString aDefaultText = aStr.copy(0, nLength);
- RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName,
m_aStates.top().nCurrentEncoding)));
+ RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName,
aState.nCurrentEncoding)));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
- RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText,
m_aStates.top().nCurrentEncoding)));
+ RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText,
aState.nCurrentEncoding)));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
m_bFormField = false;
@@ -3925,15 +3922,15 @@
break;
case DESTINATION_CREATIONTIME:
if (m_xDocumentProperties.is())
- m_xDocumentProperties->setCreationDate(lcl_getDateTime(m_aStates));
+ m_xDocumentProperties->setCreationDate(lcl_getDateTime(aState));
break;
case DESTINATION_REVISIONTIME:
if (m_xDocumentProperties.is())
- m_xDocumentProperties->setModificationDate(lcl_getDateTime(m_aStates));
+ m_xDocumentProperties->setModificationDate(lcl_getDateTime(aState));
break;
case DESTINATION_PRINTTIME:
if (m_xDocumentProperties.is())
- m_xDocumentProperties->setPrintDate(lcl_getDateTime(m_aStates));
+ m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
break;
case DESTINATION_AUTHOR:
if (m_xDocumentProperties.is())
@@ -3958,7 +3955,7 @@
case DESTINATION_OPERATOR:
case DESTINATION_COMPANY:
{
- OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ?
OUString("Operator") : OUString("Company");
+ OUString aName = aState.nDestinationState == DESTINATION_OPERATOR ?
OUString("Operator") : OUString("Company");
if (m_xDocumentProperties.is())
{
uno::Reference<beans::XPropertyContainer> xUserDefinedProperties =
m_xDocumentProperties->getUserDefinedProperties();
@@ -4052,7 +4049,7 @@
case DESTINATION_ANNOTATIONDATE:
{
OUString
aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().aDestinationText.makeStringAndClear().toInt32()),
- m_aStates.top().nCurrentEncoding));
+ aState.nCurrentEncoding));
RTFValue::Pointer_t pValue(new RTFValue(aStr));
RTFSprms aAnnAttributes;
aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue);
@@ -4110,8 +4107,9 @@
}
break;
case DESTINATION_SHAPE:
- if (m_aStates.top().aFrame.inFrame())
+ if (aState.aFrame.inFrame())
{
+ // parBreak modify m_aStates.top() so we can't apply resetFrame directly on aState
m_aStates.top().resetFrame();
parBreak();
// Save this state for later use, so we only reset frame status only for the first
shape inside a frame.
@@ -4344,7 +4342,7 @@
}
// See if we need to end a track change
- RTFValue::Pointer_t pTrackchange =
m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
+ RTFValue::Pointer_t pTrackchange = aState.aCharacterSprms.find(NS_ooxml::LN_trackchange);
if (pTrackchange.get())
{
RTFSprms aTCAttributes;
--
To view, visit https://gerrit.libreoffice.org/3085
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6814e48a92a1b24823c6884a151aa6a139410ff2
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Maxime de Roucy <mderoucy@linagora.com>
Context
- [PATCH] use of aState instead of m_aStates.top in popState · Maxime de Roucy (via Code Review)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.