summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-02-22 11:38:29 +0100
committerMiklos Vajna <vmiklos@suse.cz>2012-02-22 12:06:22 +0100
commit343b52ee76f1a88a27007319af644dcce76536cc (patch)
treeafeddd297eccf2f8e21abb4bd5c2395e33651093 /writerfilter
parentf9ddb32de8c00cd12485478f21f41e2a28d7564a (diff)
implement RTF import of non-box paragraph borders
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx30
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1
2 files changed, 29 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 806b43f6ca8f..4b1a1a71d2df 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -146,7 +146,7 @@ static RTFSprms& lcl_getLastAttributes(RTFSprms& rSprms, Id nId)
static void lcl_putBorderProperty(std::stack<RTFParserState>& aStates, Id nId, RTFValue::Pointer_t pValue)
{
- if (aStates.top().nBorderState == BORDER_PARAGRAPH)
+ if (aStates.top().nBorderState == BORDER_PARAGRAPH_BOX)
for (int i = 0; i < 4; i++)
{
RTFValue::Pointer_t p = aStates.top().aParagraphSprms.find(lcl_getParagraphBorder(i));
@@ -156,6 +156,12 @@ static void lcl_putBorderProperty(std::stack<RTFParserState>& aStates, Id nId, R
rAttributes->push_back(make_pair(nId, pValue));
}
}
+ 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));
+ }
else if (aStates.top().nBorderState == BORDER_CELL)
{
// Attributes of the last border type
@@ -1772,7 +1778,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PBrcLeft, pValue));
m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PBrcBottom, pValue));
m_aStates.top().aParagraphSprms->push_back(make_pair(NS_sprm::LN_PBrcRight, pValue));
- m_aStates.top().nBorderState = BORDER_PARAGRAPH;
+ m_aStates.top().nBorderState = BORDER_PARAGRAPH_BOX;
}
break;
case RTF_LTRSECT:
@@ -1849,6 +1855,26 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().nBorderState = BORDER_PAGE;
}
break;
+ case RTF_BRDRT:
+ case RTF_BRDRL:
+ case RTF_BRDRB:
+ case RTF_BRDRR:
+ {
+ RTFSprms aAttributes;
+ RTFSprms aSprms;
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+ switch (nKeyword)
+ {
+ case RTF_BRDRT: nParam = lcl_getParagraphBorder(0); break;
+ case RTF_BRDRL: nParam = lcl_getParagraphBorder(1); break;
+ case RTF_BRDRB: nParam = lcl_getParagraphBorder(2); break;
+ case RTF_BRDRR: nParam = lcl_getParagraphBorder(3); break;
+ default: break;
+ }
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue);
+ m_aStates.top().nBorderState = BORDER_PARAGRAPH;
+ }
+ break;
case RTF_CLVMGF:
{
RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart));
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index a6c09951c828..3644375adcb6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -116,6 +116,7 @@ namespace writerfilter {
{
BORDER_NONE,
BORDER_PARAGRAPH,
+ BORDER_PARAGRAPH_BOX,
BORDER_CELL,
BORDER_PAGE
};