summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-04-11 11:53:05 +0200
committerCaolán McNamara <caolanm@redhat.com>2012-04-11 13:10:52 +0100
commit586d6a57564c4c75c6464ec91c6f676aa66b0638 (patch)
treef44a04960d55545ee8fbe00c4b695797a7e02ac0
parentd7e0c3e1d0fc155402d0d8f3ddbd12077005e5dd (diff)
fdo#47107 rtftok: support bullet points in paragraph numberings
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx33
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1
2 files changed, 32 insertions, 2 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8e0cbced9754..04160e679ba2 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -921,6 +921,7 @@ void RTFDocumentImpl::text(OUString& rString)
case DESTINATION_ANNOTATIONAUTHOR:
case DESTINATION_FALT:
case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
+ case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
m_aStates.top().aDestinationText.append(rString);
break;
case DESTINATION_EQINSTRUCTION:
@@ -1349,6 +1350,9 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
case RTF_PNTXTA:
m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER;
break;
+ case RTF_PNTXTB:
+ m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE;
+ break;
default:
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE("%s: TODO handle destination '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword));
@@ -2089,6 +2093,12 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aTableSprms->push_back(make_pair(NS_rtf::LN_NFC, pValue));
}
break;
+ case RTF_PNLVLBLT:
+ {
+ m_aStates.top().aTableAttributes->push_back(make_pair(NS_rtf::LN_LSID, RTFValue::Pointer_t(new RTFValue(1))));
+ m_aStates.top().aTableSprms->push_back(make_pair(NS_rtf::LN_NFC, RTFValue::Pointer_t(new RTFValue(23)))); // bullets, same as \levelnfc23
+ }
+ break;
default:
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE("%s: TODO handle flag '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword));
@@ -2744,6 +2754,13 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_PNSTART:
m_aStates.top().aTableSprms->push_back(make_pair(NS_rtf::LN_ISTARTAT, pIntValue));
break;
+ case RTF_PNF:
+ {
+ int nFontIndex = getFontIndex(nParam);
+ RTFValue::Pointer_t pValue(new RTFValue(nFontIndex));
+ lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_sprm::LN_CRgFtc0, pValue);
+ }
+ break;
default:
#if OSL_DEBUG_LEVEL > 1
OSL_TRACE("%s: TODO handle value '%s'", OSL_THIS_FUNC, lcl_RtfToString(nKeyword));
@@ -3352,8 +3369,12 @@ int RTFDocumentImpl::popState()
{
// Abstract numbering
RTFSprms aLeveltextAttributes;
- OUString aTextValue(RTL_CONSTASCII_USTRINGPARAM("%1"));
- RTFValue::Pointer_t pTextAfter = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val);
+ OUString aTextValue;
+ RTFValue::Pointer_t pTextBefore = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val);
+ if (pTextBefore.get())
+ aTextValue += pTextBefore->getString();
+ aTextValue += OUString(RTL_CONSTASCII_USTRINGPARAM("%1"));
+ RTFValue::Pointer_t pTextAfter = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelSuffix_val);
if (pTextAfter.get())
aTextValue += pTextAfter->getString();
RTFValue::Pointer_t pTextValue(new RTFValue(aTextValue));
@@ -3374,6 +3395,9 @@ int RTFDocumentImpl::popState()
RTFValue::Pointer_t pLeveltextValue(new RTFValue(aLeveltextAttributes));
aLevelSprms->push_back(make_pair(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue));
+ RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr);
+ if (pRunProps.get())
+ aLevelSprms->push_back(make_pair(NS_ooxml::LN_CT_Lvl_rPr, pRunProps));
RTFSprms aAbstractAttributes;
RTFSprms aAbstractSprms;
@@ -3410,6 +3434,11 @@ int RTFDocumentImpl::popState()
else if (aState.nDestinationState == DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER)
{
RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
+ m_aStates.top().aTableAttributes->push_back(make_pair(NS_ooxml::LN_CT_LevelSuffix_val, pValue));
+ }
+ else if (aState.nDestinationState == DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE)
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
m_aStates.top().aTableAttributes->push_back(make_pair(NS_ooxml::LN_CT_LevelText_val, pValue));
}
else if (bListLevelEnd)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index f81cd7f4802b..4a7551d6864c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -111,6 +111,7 @@ namespace writerfilter {
DESTINATION_FLYMAINCONTENT,
DESTINATION_DRAWINGOBJECT,
DESTINATION_PARAGRAPHNUMBERING,
+ DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE,
DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER
};