[PATCH 2/2] fdo#47107 rtftok: support bullet points in paragraph numberings
Miklos Vajna
vmiklos at suse.cz
Wed Apr 11 02:53:05 PDT 2012
---
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 33 ++++++++++++++++++++++-
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 1 +
2 files changed, 32 insertions(+), 2 deletions(-)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8e0cbce..04160e6 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 f81cd7f..4a7551d 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
};
--
1.7.7
--opJtzjQTFsWo+cga--
More information about the LibreOffice
mailing list