summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-08-02 11:57:25 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-08-02 12:40:02 +0200
commitb6e6ea341d1bd1577f5219ef08403fad58887715 (patch)
tree42e79abc41cb27a503cd4283bcf78bbabb608b10
parent5cd8770cbe39f124c69cbceaf745453b7fd63839 (diff)
RTFDocumentImpl::popState: drop unnecessary state copies
First only parts of the parser state was copied, then later the whole state, but code not using the full copy was still there. Remove it now. Change-Id: I2c5507e74a24b8dac74552c61d69ba0be7257d6b
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx59
1 files changed, 19 insertions, 40 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1e6761609fc0..530554b7e0b6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3230,15 +3230,6 @@ int RTFDocumentImpl::popState()
// ", dest state: " << m_aStates.top().nDestinationState);
checkUnicode();
- RTFSprms aSprms;
- RTFSprms aAttributes;
- OUStringBuffer aDestinationText;
- RTFShape aShape;
- RTFPicture aPicture;
- bool bPopShapeProperties = false;
- bool bPopPictureProperties = false;
- bool bFaltEnd = false;
- bool bPopFrame = false;
RTFParserState aState(m_aStates.top());
sal_Int32 nMathToken = 0;
@@ -3328,14 +3319,10 @@ int RTFDocumentImpl::popState()
case DESTINATION_SHAPEPROPERTYVALUE:
case DESTINATION_SHAPEPROPERTY:
{
- aShape = m_aStates.top().aShape;
- aPicture = m_aStates.top().aPicture;
- aAttributes = m_aStates.top().aCharacterAttributes;
if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME)
- aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(), OUString()));
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE && aShape.aProperties.size())
- aShape.aProperties.back().second = m_aStates.top().aDestinationText.makeStringAndClear();
- bPopShapeProperties = true;
+ 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();
}
break;
case DESTINATION_PICPROP:
@@ -3357,11 +3344,6 @@ int RTFDocumentImpl::popState()
case DESTINATION_PICT:
resolvePict(true);
break;
- case DESTINATION_SHAPEPROPERTYVALUEPICT:
- bPopPictureProperties = true;
- aPicture = m_aStates.top().aPicture;
- aDestinationText = m_aStates.top().aDestinationText;
- break;
case DESTINATION_SHAPETEXT:
m_pCurrentBuffer = 0; // Just disable buffering, don't empty it yet.
break;
@@ -3567,15 +3549,9 @@ int RTFDocumentImpl::popState()
{
OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());
RTFValue::Pointer_t pValue(new RTFValue(aStr));
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
- aSprms = m_aStates.top().aTableSprms;
- bFaltEnd = true;
+ aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
}
break;
- case DESTINATION_FLYMAINCONTENT:
- case DESTINATION_SHPPICT:
- bPopFrame = true;
- break;
case DESTINATION_DRAWINGOBJECT:
if (m_aStates.top().aDrawingObject.xShape.is())
{
@@ -3826,23 +3802,26 @@ int RTFDocumentImpl::popState()
if (aState.nFieldStatus == FIELD_INSTRUCTION)
singleChar(0x15);
}
+ else if (aState.nDestinationState == DESTINATION_SHAPEPROPERTYVALUEPICT)
+ {
+ m_aStates.top().aPicture = aState.aPicture;
+ m_aStates.top().aDestinationText = aState.aDestinationText;
+ }
+ else if (aState.nDestinationState == DESTINATION_FALT)
+ m_aStates.top().aTableSprms = aState.aTableSprms;
else if (m_aStates.size() && m_aStates.top().nDestinationState == DESTINATION_PICT)
m_aStates.top().aPicture = aState.aPicture;
- else if (bPopShapeProperties)
+ else if (aState.nDestinationState == DESTINATION_SHAPEPROPERTYNAME ||
+ aState.nDestinationState == DESTINATION_SHAPEPROPERTYVALUE ||
+ aState.nDestinationState == DESTINATION_SHAPEPROPERTY)
{
- m_aStates.top().aShape = aShape;
- m_aStates.top().aPicture = aPicture;
- m_aStates.top().aCharacterAttributes = aAttributes;
+ m_aStates.top().aShape = aState.aShape;
+ m_aStates.top().aPicture = aState.aPicture;
+ m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
}
- else if (bFaltEnd)
- m_aStates.top().aTableSprms = aSprms;
- else if (bPopFrame)
+ else if (aState.nDestinationState == DESTINATION_FLYMAINCONTENT ||
+ aState.nDestinationState == DESTINATION_SHPPICT)
m_aStates.top().aFrame = aState.aFrame;
- if (bPopPictureProperties)
- {
- m_aStates.top().aPicture = aPicture;
- m_aStates.top().aDestinationText = aDestinationText;
- }
if (m_pCurrentBuffer == &m_aSuperBuffer)
{
if (!m_bHasFootnote)