[Libreoffice-commits] .: 4 commits - writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Tue Jul 24 05:16:13 PDT 2012
writerfilter/source/rtftok/rtfcontrolwords.cxx | 2
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 257 ++++++++++++++++---------
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 11 -
3 files changed, 183 insertions(+), 87 deletions(-)
New commits:
commit d93eba476b45ca99792e9963064160539a9ddc19
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jul 24 14:11:02 2012 +0200
implement import of RTF_{MM,MMPR,MMR}
Change-Id: I6e21159af832c5850db77a6dfe630a0fc0bb6238
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 015252d..5957194 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1493,6 +1493,18 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aMathBuffer.appendOpeningTag(M_TOKEN(lim));
m_aStates.top().nDestinationState = DESTINATION_MLIM;
break;
+ case RTF_MM:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(m));
+ m_aStates.top().nDestinationState = DESTINATION_MM;
+ break;
+ case RTF_MMPR:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(mPr));
+ m_aStates.top().nDestinationState = DESTINATION_MMPR;
+ break;
+ case RTF_MMR:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(mr));
+ m_aStates.top().nDestinationState = DESTINATION_MMR;
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
// Make sure we skip destinations (even without \*) till we don't handle them
@@ -3155,7 +3167,9 @@ int RTFDocumentImpl::pushState()
(m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION && !m_bEq) ||
m_aStates.top().nDestinationState == DESTINATION_MNUM ||
m_aStates.top().nDestinationState == DESTINATION_MDEN ||
- m_aStates.top().nDestinationState == DESTINATION_ME)
+ m_aStates.top().nDestinationState == DESTINATION_ME ||
+ m_aStates.top().nDestinationState == DESTINATION_MFNAME ||
+ m_aStates.top().nDestinationState == DESTINATION_MLIM)
m_aStates.top().nDestinationState = DESTINATION_NORMAL;
else if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION && m_bEq)
m_aStates.top().nDestinationState = DESTINATION_EQINSTRUCTION;
@@ -3659,6 +3673,9 @@ int RTFDocumentImpl::popState()
case DESTINATION_MLIMLOW: m_aMathBuffer.appendClosingTag(M_TOKEN(limLow)); break;
case DESTINATION_MLIMLOWPR: m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr)); break;
case DESTINATION_MLIM: m_aMathBuffer.appendClosingTag(M_TOKEN(lim)); break;
+ case DESTINATION_MM: m_aMathBuffer.appendClosingTag(M_TOKEN(m)); break;
+ case DESTINATION_MMPR: m_aMathBuffer.appendClosingTag(M_TOKEN(mPr)); break;
+ case DESTINATION_MMR: m_aMathBuffer.appendClosingTag(M_TOKEN(mr)); break;
default: break;
}
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 70d7c86..06f7f05 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -142,7 +142,10 @@ namespace writerfilter {
DESTINATION_MFNAME,
DESTINATION_MLIMLOW,
DESTINATION_MLIMLOWPR,
- DESTINATION_MLIM
+ DESTINATION_MLIM,
+ DESTINATION_MM,
+ DESTINATION_MMPR,
+ DESTINATION_MMR
};
enum RTFBorderState
commit 42922c40362f414ee06e65636f61798ef28cdcde
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jul 24 13:47:18 2012 +0200
RTFDocumentImpl::popState: use switch here
Change-Id: If03ae8a5b44f477471ddc33063af552b3f2cfc31
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index f1e2ef1..015252d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3230,17 +3230,21 @@ int RTFDocumentImpl::popState()
bool bPopFrame = false;
RTFParserState aState(m_aStates.top());
- if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE)
+ switch (m_aStates.top().nDestinationState)
+ {
+ case DESTINATION_FONTTABLE:
{
writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aFontTableEntries));
Mapper().table(NS_rtf::LN_FONTTABLE, pTable);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET)
+ break;
+ case DESTINATION_STYLESHEET:
{
writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStyleTableEntries));
Mapper().table(NS_rtf::LN_STYLESHEET, pTable);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDETABLE)
+ break;
+ case DESTINATION_LISTOVERRIDETABLE:
{
RTFSprms aListTableAttributes;
writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms));
@@ -3249,14 +3253,12 @@ int RTFDocumentImpl::popState()
writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries));
Mapper().table(NS_rtf::LN_LISTTABLE, pTable);
}
- else if (aState.nDestinationState == DESTINATION_LISTENTRY)
- {
+ break;
+ case DESTINATION_LISTENTRY:
for (RTFSprms::Iterator_t i = aState.aListLevelEntries.begin(); i != aState.aListLevelEntries.end(); ++i)
aState.aTableSprms.set(i->first, i->second, false);
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
- {
- if (m_aFormfieldAttributes.size() || m_aFormfieldSprms.size())
+ break;
+ case DESTINATION_FIELDINSTRUCTION:
{
RTFValue::Pointer_t pValue(new RTFValue(m_aFormfieldAttributes, m_aFormfieldSprms));
RTFSprms aFFAttributes;
@@ -3269,15 +3271,14 @@ int RTFDocumentImpl::popState()
}
if (!m_bEq)
singleChar(0x14);
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT)
- {
+ break;
+ case DESTINATION_FIELDRESULT:
if (!m_bEq)
singleChar(0x15);
else
m_bEq = false;
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_LEVELTEXT)
+ break;
+ case DESTINATION_LEVELTEXT:
{
OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
@@ -3291,7 +3292,8 @@ int RTFDocumentImpl::popState()
RTFValue::Pointer_t pValue(new RTFValue(aValue, true));
aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_LEVELNUMBERS)
+ break;
+ case DESTINATION_LEVELNUMBERS:
{
RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes();
RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val);
@@ -3313,9 +3315,10 @@ int RTFDocumentImpl::popState()
}
pValue->setString(aBuf.makeStringAndClear());
}
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYNAME
- || m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUE
- || m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTY)
+ break;
+ case DESTINATION_SHAPEPROPERTYNAME:
+ case DESTINATION_SHAPEPROPERTYVALUE:
+ case DESTINATION_SHAPEPROPERTY:
{
aShape = m_aStates.top().aShape;
aPicture = m_aStates.top().aPicture;
@@ -3326,42 +3329,47 @@ int RTFDocumentImpl::popState()
aShape.aProperties.back().second = m_aStates.top().aDestinationText.makeStringAndClear();
bPopShapeProperties = true;
}
- else if (m_aStates.top().nDestinationState == DESTINATION_PICPROP
- || m_aStates.top().nDestinationState == DESTINATION_SHAPEINSTRUCTION)
- {
+ break;
+ case DESTINATION_PICPROP:
+ case DESTINATION_SHAPEINSTRUCTION:
if (!m_bObject)
m_pSdrImport->resolve(m_aStates.top().aShape);
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKSTART)
+ break;
+ case DESTINATION_BOOKMARKSTART:
{
OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
int nPos = m_aBookmarks.size();
m_aBookmarks[aStr] = nPos;
Mapper().props(lcl_getBookmarkProperties(nPos, aStr));
}
- else if (m_aStates.top().nDestinationState == DESTINATION_BOOKMARKEND)
+ break;
+ case DESTINATION_BOOKMARKEND:
Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().aDestinationText.makeStringAndClear()]));
- else if (m_aStates.top().nDestinationState == DESTINATION_PICT)
+ break;
+ case DESTINATION_PICT:
resolvePict(true);
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPEPROPERTYVALUEPICT)
- {
+ break;
+ case DESTINATION_SHAPEPROPERTYVALUEPICT:
bPopPictureProperties = true;
aPicture = m_aStates.top().aPicture;
aDestinationText = m_aStates.top().aDestinationText;
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
+ break;
+ case DESTINATION_SHAPETEXT:
m_pCurrentBuffer = 0; // Just disable buffering, don't empty it yet.
- else if (m_aStates.top().nDestinationState == DESTINATION_FORMFIELDNAME)
+ break;
+ case DESTINATION_FORMFIELDNAME:
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pValue);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_FORMFIELDLIST)
+ break;
+ case DESTINATION_FORMFIELDLIST:
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_DATAFIELD && m_bFormField)
+ break;
+ case DESTINATION_DATAFIELD:
{
OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), m_aStates.top().nCurrentEncoding);
// decode hex dump
@@ -3407,26 +3415,45 @@ int RTFDocumentImpl::popState()
m_bFormField = false;
}
- else if (m_aStates.top().nDestinationState == DESTINATION_CREATIONTIME && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_CREATIONTIME:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setCreationDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_REVISIONTIME && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_REVISIONTIME:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setModificationDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_PRINTTIME && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_PRINTTIME:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setPrintDate(lcl_getDateTime(m_aStates));
- else if (m_aStates.top().nDestinationState == DESTINATION_AUTHOR && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_AUTHOR:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setAuthor(m_aStates.top().aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_KEYWORDS && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_KEYWORDS:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().aDestinationText.makeStringAndClear()));
- else if (m_aStates.top().nDestinationState == DESTINATION_COMMENT && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_COMMENT:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_TITLE && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_TITLE:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setTitle(m_aStates.top().aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_SUBJECT && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_SUBJECT:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_DOCCOMM && m_xDocumentProperties.is())
+ break;
+ case DESTINATION_DOCCOMM:
+ if (m_xDocumentProperties.is())
m_xDocumentProperties->setDescription(m_aStates.top().aDestinationText.makeStringAndClear());
- else if (m_aStates.top().nDestinationState == DESTINATION_OPERATOR
- || m_aStates.top().nDestinationState == DESTINATION_COMPANY)
+ break;
+ case DESTINATION_OPERATOR:
+ case DESTINATION_COMPANY:
{
OUString aName = m_aStates.top().nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
if (m_xDocumentProperties.is())
@@ -3436,7 +3463,8 @@ int RTFDocumentImpl::popState()
uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear()));
}
}
- else if (m_aStates.top().nDestinationState == DESTINATION_OBJDATA)
+ break;
+ case DESTINATION_OBJDATA:
{
m_pObjectData.reset(new SvMemoryStream());
int b = 0, count = 2;
@@ -3489,7 +3517,8 @@ int RTFDocumentImpl::popState()
RTFValue::Pointer_t pValue(new RTFValue(aOLEAttributes));
m_aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pValue);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_OBJECT)
+ break;
+ case DESTINATION_OBJECT:
{
RTFSprms aObjAttributes;
RTFSprms aObjSprms;
@@ -3508,7 +3537,8 @@ int RTFDocumentImpl::popState()
m_aObjectSprms.clear();
m_bObject = false;
}
- else if (m_aStates.top().nDestinationState == DESTINATION_ANNOTATIONDATE)
+ break;
+ case DESTINATION_ANNOTATIONDATE:
{
OUString aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().aDestinationText.makeStringAndClear().toInt32()),
m_aStates.top().nCurrentEncoding));
@@ -3518,11 +3548,14 @@ int RTFDocumentImpl::popState()
writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAnnAttributes));
Mapper().props(pProperties);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_ANNOTATIONAUTHOR)
+ break;
+ case DESTINATION_ANNOTATIONAUTHOR:
m_aAuthor = m_aStates.top().aDestinationText.makeStringAndClear();
- else if (m_aStates.top().nDestinationState == DESTINATION_ATNID)
+ break;
+ case DESTINATION_ATNID:
m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear();
- else if (m_aStates.top().nDestinationState == DESTINATION_FALT)
+ break;
+ case DESTINATION_FALT:
{
OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());
RTFValue::Pointer_t pValue(new RTFValue(aStr));
@@ -3530,10 +3563,13 @@ int RTFDocumentImpl::popState()
aSprms = m_aStates.top().aTableSprms;
bFaltEnd = true;
}
- else if (m_aStates.top().nDestinationState == DESTINATION_FLYMAINCONTENT
- || m_aStates.top().nDestinationState == DESTINATION_SHPPICT)
+ break;
+ case DESTINATION_FLYMAINCONTENT:
+ case DESTINATION_SHPPICT:
bPopFrame = true;
- else if (m_aStates.top().nDestinationState == DESTINATION_DRAWINGOBJECT && m_aStates.top().aDrawingObject.xShape.is())
+ break;
+ case DESTINATION_DRAWINGOBJECT:
+ if (m_aStates.top().aDrawingObject.xShape.is())
{
RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject;
uno::Reference<drawing::XShape> xShape(rDrawing.xShape);
@@ -3552,13 +3588,16 @@ int RTFDocumentImpl::popState()
Mapper().startShape(xShape);
Mapper().endShape();
}
- else if (m_aStates.top().nDestinationState == DESTINATION_SHAPE && m_aStates.top().aFrame.inFrame())
+ break;
+ case DESTINATION_SHAPE:
+ if (m_aStates.top().aFrame.inFrame())
{
m_aStates.top().resetFrame();
parBreak();
m_bNeedPap = true;
}
- else if (m_aStates.top().nDestinationState == DESTINATION_MOMATH)
+ break;
+ case DESTINATION_MOMATH:
{
m_aMathBuffer.appendClosingTag(M_TOKEN(oMath));
@@ -3576,31 +3615,24 @@ int RTFDocumentImpl::popState()
Mapper().props(pProperties);
m_aMathBuffer = oox::formulaimport::XmlStreamBuilder();
}
- else if (m_aStates.top().nDestinationState == DESTINATION_MR)
- {
+ break;
+ case DESTINATION_MR:
m_aMathBuffer.appendOpeningTag(M_TOKEN(r));
m_aMathBuffer.appendOpeningTag(M_TOKEN(t));
m_aMathBuffer.appendCharacters(m_aStates.top().aDestinationText.makeStringAndClear());
m_aMathBuffer.appendClosingTag(M_TOKEN(t));
m_aMathBuffer.appendClosingTag(M_TOKEN(r));
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_MF)
- m_aMathBuffer.appendClosingTag(M_TOKEN(f));
- else if (m_aStates.top().nDestinationState == DESTINATION_MFPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(fPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MCTRLPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(ctrlPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MNUM)
- m_aMathBuffer.appendClosingTag(M_TOKEN(num));
- else if (m_aStates.top().nDestinationState == DESTINATION_MDEN)
- m_aMathBuffer.appendClosingTag(M_TOKEN(den));
- else if (m_aStates.top().nDestinationState == DESTINATION_MACC)
- m_aMathBuffer.appendClosingTag(M_TOKEN(acc));
- else if (m_aStates.top().nDestinationState == DESTINATION_MACCPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(accPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MCHR ||
- m_aStates.top().nDestinationState == DESTINATION_MBEGCHR ||
- m_aStates.top().nDestinationState == DESTINATION_MENDCHR)
+ break;
+ case DESTINATION_MF: m_aMathBuffer.appendClosingTag(M_TOKEN(f)); break;
+ case DESTINATION_MFPR: m_aMathBuffer.appendClosingTag(M_TOKEN(fPr)); break;
+ case DESTINATION_MCTRLPR: m_aMathBuffer.appendClosingTag(M_TOKEN(ctrlPr)); break;
+ case DESTINATION_MNUM: m_aMathBuffer.appendClosingTag(M_TOKEN(num)); break;
+ case DESTINATION_MDEN: m_aMathBuffer.appendClosingTag(M_TOKEN(den)); break;
+ case DESTINATION_MACC: m_aMathBuffer.appendClosingTag(M_TOKEN(acc)); break;
+ case DESTINATION_MACCPR: m_aMathBuffer.appendClosingTag(M_TOKEN(accPr)); break;
+ case DESTINATION_MCHR:
+ case DESTINATION_MBEGCHR:
+ case DESTINATION_MENDCHR:
{
oox::formulaimport::XmlStream::AttributeList aAttribs;
aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
@@ -3615,28 +3647,20 @@ int RTFDocumentImpl::popState()
m_aMathBuffer.appendOpeningTag(nToken, aAttribs);
m_aMathBuffer.appendClosingTag(nToken);
}
- else if (m_aStates.top().nDestinationState == DESTINATION_ME)
- m_aMathBuffer.appendClosingTag(M_TOKEN(e));
- else if (m_aStates.top().nDestinationState == DESTINATION_MBAR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(bar));
- else if (m_aStates.top().nDestinationState == DESTINATION_MBARPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(barPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MD)
- m_aMathBuffer.appendClosingTag(M_TOKEN(d));
- else if (m_aStates.top().nDestinationState == DESTINATION_MDPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(dPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MFUNC)
- m_aMathBuffer.appendClosingTag(M_TOKEN(func));
- else if (m_aStates.top().nDestinationState == DESTINATION_MFUNCPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(funcPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MFNAME)
- m_aMathBuffer.appendClosingTag(M_TOKEN(fName));
- else if (m_aStates.top().nDestinationState == DESTINATION_MLIMLOW)
- m_aMathBuffer.appendClosingTag(M_TOKEN(limLow));
- else if (m_aStates.top().nDestinationState == DESTINATION_MLIMLOWPR)
- m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr));
- else if (m_aStates.top().nDestinationState == DESTINATION_MLIM)
- m_aMathBuffer.appendClosingTag(M_TOKEN(lim));
+ break;
+ case DESTINATION_ME: m_aMathBuffer.appendClosingTag(M_TOKEN(e)); break;
+ case DESTINATION_MBAR: m_aMathBuffer.appendClosingTag(M_TOKEN(bar)); break;
+ case DESTINATION_MBARPR: m_aMathBuffer.appendClosingTag(M_TOKEN(barPr)); break;
+ case DESTINATION_MD: m_aMathBuffer.appendClosingTag(M_TOKEN(d)); break;
+ case DESTINATION_MDPR: m_aMathBuffer.appendClosingTag(M_TOKEN(dPr)); break;
+ case DESTINATION_MFUNC: m_aMathBuffer.appendClosingTag(M_TOKEN(func)); break;
+ case DESTINATION_MFUNCPR: m_aMathBuffer.appendClosingTag(M_TOKEN(funcPr)); break;
+ case DESTINATION_MFNAME: m_aMathBuffer.appendClosingTag(M_TOKEN(fName)); break;
+ case DESTINATION_MLIMLOW: m_aMathBuffer.appendClosingTag(M_TOKEN(limLow)); break;
+ case DESTINATION_MLIMLOWPR: m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr)); break;
+ case DESTINATION_MLIM: m_aMathBuffer.appendClosingTag(M_TOKEN(lim)); break;
+ default: break;
+ }
// See if we need to end a track change
RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
commit 982d71f3c994cd271ac402646a2372c243ec895d
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jul 24 12:23:52 2012 +0200
implement import of RTF_{MFUNC,MFUNCPR,MFNAME,MLIMLOW,MLIMLOWPR,MLIM}
Change-Id: Ibdecafae7942a0c79804176aa24e448dc505a5bb
diff --git a/writerfilter/source/rtftok/rtfcontrolwords.cxx b/writerfilter/source/rtftok/rtfcontrolwords.cxx
index 516a9b8..77697a5 100644
--- a/writerfilter/source/rtftok/rtfcontrolwords.cxx
+++ b/writerfilter/source/rtftok/rtfcontrolwords.cxx
@@ -887,7 +887,9 @@ RTFSymbol aRTFControlWords[] = {
{"mlim", CONTROL_DESTINATION, RTF_MLIM},
{"mlimloc", CONTROL_DESTINATION, RTF_MLIMLOC},
{"mlimlow", CONTROL_DESTINATION, RTF_MLIMLOW},
+ {"mlimLow", CONTROL_DESTINATION, RTF_MLIMLOW},
{"mlimlowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR},
+ {"mlimLowPr", CONTROL_DESTINATION, RTF_MLIMLOWPR},
{"mlimupp", CONTROL_DESTINATION, RTF_MLIMUPP},
{"mlimuppPr", CONTROL_DESTINATION, RTF_MLIMUPPPR},
{"mlit", CONTROL_FLAG, RTF_MLIT},
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8e9d04d..f1e2ef1 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1469,6 +1469,30 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aMathBuffer.appendOpeningTag(M_TOKEN(dPr));
m_aStates.top().nDestinationState = DESTINATION_MDPR;
break;
+ case RTF_MFUNC:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(func));
+ m_aStates.top().nDestinationState = DESTINATION_MFUNC;
+ break;
+ case RTF_MFUNCPR:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(funcPr));
+ m_aStates.top().nDestinationState = DESTINATION_MFUNCPR;
+ break;
+ case RTF_MFNAME:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(fName));
+ m_aStates.top().nDestinationState = DESTINATION_MFNAME;
+ break;
+ case RTF_MLIMLOW:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(limLow));
+ m_aStates.top().nDestinationState = DESTINATION_MLIMLOW;
+ break;
+ case RTF_MLIMLOWPR:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(limLowPr));
+ m_aStates.top().nDestinationState = DESTINATION_MLIMLOWPR;
+ break;
+ case RTF_MLIM:
+ m_aMathBuffer.appendOpeningTag(M_TOKEN(lim));
+ m_aStates.top().nDestinationState = DESTINATION_MLIM;
+ break;
default:
SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
// Make sure we skip destinations (even without \*) till we don't handle them
@@ -3601,6 +3625,18 @@ int RTFDocumentImpl::popState()
m_aMathBuffer.appendClosingTag(M_TOKEN(d));
else if (m_aStates.top().nDestinationState == DESTINATION_MDPR)
m_aMathBuffer.appendClosingTag(M_TOKEN(dPr));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MFUNC)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(func));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MFUNCPR)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(funcPr));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MFNAME)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(fName));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MLIMLOW)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(limLow));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MLIMLOWPR)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(limLowPr));
+ else if (m_aStates.top().nDestinationState == DESTINATION_MLIM)
+ m_aMathBuffer.appendClosingTag(M_TOKEN(lim));
// See if we need to end a track change
RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 9a7ffff..70d7c86 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -136,7 +136,13 @@ namespace writerfilter {
DESTINATION_MD,
DESTINATION_MDPR,
DESTINATION_MBEGCHR,
- DESTINATION_MENDCHR
+ DESTINATION_MENDCHR,
+ DESTINATION_MFUNC,
+ DESTINATION_MFUNCPR,
+ DESTINATION_MFNAME,
+ DESTINATION_MLIMLOW,
+ DESTINATION_MLIMLOWPR,
+ DESTINATION_MLIM
};
enum RTFBorderState
commit fbee23deadd0e168d5b73629e31d317810c88bc9
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Tue Jul 24 11:59:43 2012 +0200
escape RTF_LBRACE and RTF_RBRACE inside RTF_MR
Change-Id: I9315da151390ea1b5d56c7e58ac901e3f11dd2a7
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 36b3fa6..8e9d04d 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1507,6 +1507,13 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
if (cCh > 0)
{
OUString aStr(OStringToOUString(OString(cCh), RTL_TEXTENCODING_MS_1252));
+ if ((nKeyword == RTF_LBRACE || nKeyword == RTF_RBRACE) && m_aStates.top().nDestinationState == DESTINATION_MR)
+ {
+ if (nKeyword == RTF_LBRACE)
+ aStr = "\\{";
+ else
+ aStr = "\\}";
+ }
text(aStr);
return 0;
}
@@ -3122,7 +3129,6 @@ int RTFDocumentImpl::pushState()
m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT ||
m_aStates.top().nDestinationState == DESTINATION_FORMFIELD ||
(m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION && !m_bEq) ||
- m_aStates.top().nDestinationState == DESTINATION_MOMATH ||
m_aStates.top().nDestinationState == DESTINATION_MNUM ||
m_aStates.top().nDestinationState == DESTINATION_MDEN ||
m_aStates.top().nDestinationState == DESTINATION_ME)
@@ -3133,6 +3139,8 @@ int RTFDocumentImpl::pushState()
m_aStates.top().nDestinationState = DESTINATION_REVISIONENTRY;
else if (m_aStates.top().nDestinationState == DESTINATION_EQINSTRUCTION)
m_aStates.top().nDestinationState = DESTINATION_NORMAL;
+ else if (m_aStates.top().nDestinationState == DESTINATION_MOMATH)
+ m_aStates.top().nDestinationState = DESTINATION_MR;
return 0;
}
More information about the Libreoffice-commits
mailing list