diff options
author | Miklos Vajna <vmiklos@suse.cz> | 2012-02-22 11:43:25 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@suse.cz> | 2012-02-22 12:06:32 +0100 |
commit | fe4cea3e8b7416151f67bc6e72e12cc6cf6a0f6d (patch) | |
tree | 2e0cf9cdc95983ecd1d4a5e43b94c01b12a2d371 | |
parent | 343b52ee76f1a88a27007319af644dcce76536cc (diff) |
RTF: clean up border property handling
-rw-r--r-- | writerfilter/source/rtftok/rtfdocumentimpl.cxx | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx index 4b1a1a71d2df..581f9123f8ad 100644 --- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx +++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx @@ -146,6 +146,7 @@ static RTFSprms& lcl_getLastAttributes(RTFSprms& rSprms, Id nId) static void lcl_putBorderProperty(std::stack<RTFParserState>& aStates, Id nId, RTFValue::Pointer_t pValue) { + RTFSprms* pAttributes = 0; if (aStates.top().nBorderState == BORDER_PARAGRAPH_BOX) for (int i = 0; i < 4; i++) { @@ -156,24 +157,15 @@ static void lcl_putBorderProperty(std::stack<RTFParserState>& aStates, Id nId, R rAttributes->push_back(make_pair(nId, pValue)); } } + // Attributes of the last border type else if (aStates.top().nBorderState == BORDER_PARAGRAPH) - { - // Attributes of the last border type - RTFSprms& rAttributes = lcl_getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); - rAttributes->push_back(make_pair(nId, pValue)); - } + pAttributes = &lcl_getLastAttributes(aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr); else if (aStates.top().nBorderState == BORDER_CELL) - { - // Attributes of the last border type - RTFSprms& rAttributes = lcl_getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders); - rAttributes->push_back(make_pair(nId, pValue)); - } + pAttributes = &lcl_getLastAttributes(aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders); else if (aStates.top().nBorderState == BORDER_PAGE) - { - // Attributes of the last border type - RTFSprms& rAttributes = lcl_getLastAttributes(aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders); - rAttributes->push_back(make_pair(nId, pValue)); - } + pAttributes = &lcl_getLastAttributes(aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders); + if (pAttributes) + (*pAttributes)->push_back(make_pair(nId, pValue)); } // NEEDSWORK: DocxAttributeOutput's impl_AppendTwoDigits does the same. |