summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2014-05-04 21:06:45 +0200
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-05-04 21:29:56 +0200
commitda47a7d239fe9b27aa84cd5716e9f7430814beab (patch)
tree89f83106adc3d595107b388976c377782344fd96 /writerfilter
parent40a6b4863c74791c3d6e4459d83f9cf162e63191 (diff)
writerfilter: fix indentation in rtfdocumentimpl
Change-Id: I5588e84a486ca751e94e097bc8bceaa35fe8b969
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/README11
-rw-r--r--writerfilter/source/rtftok/astyle.options11
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx7481
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx1071
4 files changed, 4537 insertions, 4037 deletions
diff --git a/writerfilter/source/rtftok/README b/writerfilter/source/rtftok/README
index 4adbb7563b8b..0a554bbd299c 100644
--- a/writerfilter/source/rtftok/README
+++ b/writerfilter/source/rtftok/README
@@ -10,3 +10,14 @@ grep M_TOKEN starmath/source/ooxmlimport.cxx |sed 's/.*\(M_TOKEN(\) /\1/;s/ ).*/
grep '[^_]M_TOKEN' writerfilter/source/rtftok/rtfdocumentimpl.cxx |sed 's/.*\(M_TOKEN(\)/\1/;s/).*/)/'|sort -u > ~/wf-export-list
diff -u ~/math-import-list ~/wf-export-list |grep ^-M_TOKEN
----
+
+== Coding style
+
+This directory uses mostly the same coding style like the rest of Fridrich's
+libraries. Please run
+
+----
+astyle --options=astyle.options \*.cxx \*.hxx
+----
+
+before committing.
diff --git a/writerfilter/source/rtftok/astyle.options b/writerfilter/source/rtftok/astyle.options
new file mode 100644
index 000000000000..e62db1007c6b
--- /dev/null
+++ b/writerfilter/source/rtftok/astyle.options
@@ -0,0 +1,11 @@
+# formatting options
+style=allman
+indent=spaces=4
+align-pointer=type
+break-closing-brackets
+pad-header
+unpad-paren
+
+# processing options
+recursive
+suffix=none
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 7fffb141242c..3f327055244a 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -61,8 +61,10 @@
using std::make_pair;
-namespace writerfilter {
-namespace rtftok {
+namespace writerfilter
+{
+namespace rtftok
+{
static Id lcl_getParagraphBorder(sal_uInt32 nIndex)
{
@@ -75,7 +77,7 @@ static Id lcl_getParagraphBorder(sal_uInt32 nIndex)
}
static void lcl_putNestedAttribute(RTFSprms& rSprms, Id nParent, Id nId, RTFValue::Pointer_t pValue,
- RTFOverwrite eOverwrite = OVERWRITE_YES, bool bAttribute = true)
+ RTFOverwrite eOverwrite = OVERWRITE_YES, bool bAttribute = true)
{
RTFValue::Pointer_t pParent = rSprms.find(nParent, /*bFirst=*/true, /*bForWrite=*/true);
if (!pParent.get())
@@ -203,7 +205,7 @@ static const char* lcl_RtfToString(RTFKeyword nKeyword)
static util::DateTime lcl_getDateTime(RTFParserState& aState)
{
return util::DateTime(0 /*100sec*/, 0 /*sec*/, aState.nMinute, aState.nHour,
- aState.nDay, aState.nMonth, aState.nYear, false);
+ aState.nDay, aState.nMonth, aState.nYear, false);
}
static void lcl_DestinationToMath(OUStringBuffer& rDestinationText, oox::formulaimport::XmlStreamBuilder& rMathBuffer, bool& rMathNor)
@@ -229,70 +231,70 @@ static void lcl_DestinationToMath(OUStringBuffer& rDestinationText, oox::formula
}
RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext,
- uno::Reference<io::XInputStream> const& xInputStream,
- uno::Reference<lang::XComponent> const& xDstDoc,
- uno::Reference<frame::XFrame> const& xFrame,
- uno::Reference<task::XStatusIndicator> const& xStatusIndicator)
+ uno::Reference<io::XInputStream> const& xInputStream,
+ uno::Reference<lang::XComponent> const& xDstDoc,
+ uno::Reference<frame::XFrame> const& xFrame,
+ uno::Reference<task::XStatusIndicator> const& xStatusIndicator)
: m_xContext(xContext),
- m_xInputStream(xInputStream),
- m_xDstDoc(xDstDoc),
- m_xFrame(xFrame),
- m_xStatusIndicator(xStatusIndicator),
- m_pMapperStream(NULL),
- m_aDefaultState(this),
- m_bSkipUnknown(false),
- m_aFontIndexes(),
- m_aColorTable(),
- m_bFirstRun(true),
- m_bNeedPap(true),
- m_bNeedCr(false),
- m_bNeedCrOrig(false),
- m_bNeedPar(true),
- m_bNeedFinalPar(false),
- m_aListTableSprms(),
- m_aSettingsTableAttributes(),
- m_aSettingsTableSprms(),
- m_xStorage(),
- m_nNestedCells(0),
- m_nTopLevelCells(0),
- m_nInheritingCells(0),
- m_nNestedCurrentCellX(0),
- m_nTopLevelCurrentCellX(0),
- m_nBackupTopLevelCurrentCellX(0),
- m_aTableBufferStack(1), // create top-level buffer already
- m_aSuperBuffer(),
- m_bHasFootnote(false),
- m_pSuperstream(0),
- m_nStreamType(0),
- m_nHeaderFooterPositions(),
- m_nGroupStartPos(0),
- m_aBookmarks(),
- m_aAuthors(),
- m_aFormfieldSprms(),
- m_aFormfieldAttributes(),
- m_nFormFieldType(FORMFIELD_NONE),
- m_aObjectSprms(),
- m_aObjectAttributes(),
- m_bObject(false),
- m_aFontTableEntries(),
- m_nCurrentFontIndex(0),
- m_nCurrentEncoding(0),
- m_nDefaultFontIndex(-1),
- m_aStyleTableEntries(),
- m_nCurrentStyleIndex(0),
- m_bFormField(false),
- m_bIsInFrame(false),
- m_aUnicodeBuffer(),
- m_aHexBuffer(),
- m_bMathNor(false),
- m_bIgnoreNextContSectBreak(false),
- m_nResetBreakOnSectBreak(RTF_invalid),
- m_bNeedSect(false), // done by checkFirstRun
- m_bWasInFrame(false),
- m_bHadPicture(false),
- m_bHadSect(false),
- m_nCellxMax(0),
- m_nListPictureId(0)
+ m_xInputStream(xInputStream),
+ m_xDstDoc(xDstDoc),
+ m_xFrame(xFrame),
+ m_xStatusIndicator(xStatusIndicator),
+ m_pMapperStream(NULL),
+ m_aDefaultState(this),
+ m_bSkipUnknown(false),
+ m_aFontIndexes(),
+ m_aColorTable(),
+ m_bFirstRun(true),
+ m_bNeedPap(true),
+ m_bNeedCr(false),
+ m_bNeedCrOrig(false),
+ m_bNeedPar(true),
+ m_bNeedFinalPar(false),
+ m_aListTableSprms(),
+ m_aSettingsTableAttributes(),
+ m_aSettingsTableSprms(),
+ m_xStorage(),
+ m_nNestedCells(0),
+ m_nTopLevelCells(0),
+ m_nInheritingCells(0),
+ m_nNestedCurrentCellX(0),
+ m_nTopLevelCurrentCellX(0),
+ m_nBackupTopLevelCurrentCellX(0),
+ m_aTableBufferStack(1), // create top-level buffer already
+ m_aSuperBuffer(),
+ m_bHasFootnote(false),
+ m_pSuperstream(0),
+ m_nStreamType(0),
+ m_nHeaderFooterPositions(),
+ m_nGroupStartPos(0),
+ m_aBookmarks(),
+ m_aAuthors(),
+ m_aFormfieldSprms(),
+ m_aFormfieldAttributes(),
+ m_nFormFieldType(FORMFIELD_NONE),
+ m_aObjectSprms(),
+ m_aObjectAttributes(),
+ m_bObject(false),
+ m_aFontTableEntries(),
+ m_nCurrentFontIndex(0),
+ m_nCurrentEncoding(0),
+ m_nDefaultFontIndex(-1),
+ m_aStyleTableEntries(),
+ m_nCurrentStyleIndex(0),
+ m_bFormField(false),
+ m_bIsInFrame(false),
+ m_aUnicodeBuffer(),
+ m_aHexBuffer(),
+ m_bMathNor(false),
+ m_bIgnoreNextContSectBreak(false),
+ m_nResetBreakOnSectBreak(RTF_invalid),
+ m_bNeedSect(false), // done by checkFirstRun
+ m_bWasInFrame(false),
+ m_bHadPicture(false),
+ m_bHadSect(false),
+ m_nCellxMax(0),
+ m_nListPictureId(0)
{
OSL_ASSERT(xInputStream.is());
m_pInStream.reset(utl::UcbStreamHelper::CreateStream(xInputStream, true));
@@ -323,7 +325,7 @@ Stream& RTFDocumentImpl::Mapper()
return *m_pMapperStream;
}
-void RTFDocumentImpl::setSuperstream(RTFDocumentImpl *pSuperstream)
+void RTFDocumentImpl::setSuperstream(RTFDocumentImpl* pSuperstream)
{
m_pSuperstream = pSuperstream;
}
@@ -466,12 +468,12 @@ void RTFDocumentImpl::checkNeedPap()
if (!m_aStates.top().pCurrentBuffer)
{
writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
- getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
- );
+ getProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
+ );
// Writer will ignore a page break before a text frame, so guard it with empty paragraphs
bool hasBreakBeforeFrame = m_aStates.top().aFrame.hasProperties() &&
- m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore).get();
+ m_aStates.top().aParagraphSprms.find(NS_ooxml::LN_CT_PPrBase_pageBreakBefore).get();
if (hasBreakBeforeFrame)
{
dispatchSymbol(RTF_PAR);
@@ -484,7 +486,7 @@ void RTFDocumentImpl::checkNeedPap()
if (m_aStates.top().aFrame.hasProperties())
{
writerfilter::Reference<Properties>::Pointer_t const pFrameProperties(
- new RTFReferenceProperties(RTFSprms(), m_aStates.top().aFrame.getSprms()));
+ new RTFReferenceProperties(RTFSprms(), m_aStates.top().aFrame.getSprms()));
Mapper().props(pFrameProperties);
}
}
@@ -492,7 +494,7 @@ void RTFDocumentImpl::checkNeedPap()
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms));
m_aStates.top().pCurrentBuffer->push_back(
- Buf_t(BUFFER_PROPS, pValue));
+ Buf_t(BUFFER_PROPS, pValue));
}
}
}
@@ -589,8 +591,8 @@ void RTFDocumentImpl::sectBreak(bool bFinal = false)
RTFSprms aSprms;
aSprms.set(NS_ooxml::LN_CT_PPr_sectPr, pValue);
writerfilter::Reference<Properties>::Pointer_t const pProperties(
- new RTFReferenceProperties(aAttributes, aSprms)
- );
+ new RTFReferenceProperties(aAttributes, aSprms)
+ );
// The trick is that we send properties of the previous section right now, which will be exactly what dmapper expects.
Mapper().props(pProperties);
Mapper().endParagraphGroup();
@@ -672,39 +674,39 @@ oox::GraphicHelper& RTFDocumentImpl::getGraphicHelper()
return *m_pGraphicHelper;
}
-void RTFDocumentImpl::resolve(Stream & rMapper)
+void RTFDocumentImpl::resolve(Stream& rMapper)
{
m_pMapperStream = &rMapper;
switch (m_pTokenizer->resolveParse())
{
- case ERROR_OK:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": finished without errors");
- break;
- case ERROR_GROUP_UNDER:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unmatched '}'");
- break;
- case ERROR_GROUP_OVER:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unmatched '{'");
- throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
- break;
- case ERROR_EOF:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unexpected end of file");
- throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
- break;
- case ERROR_HEX_INVALID:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": invalid hex char");
- throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
- break;
- case ERROR_CHAR_OVER:
- SAL_INFO("writerfilter", OSL_THIS_FUNC << ": characters after last '}'");
- break;
+ case ERROR_OK:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": finished without errors");
+ break;
+ case ERROR_GROUP_UNDER:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unmatched '}'");
+ break;
+ case ERROR_GROUP_OVER:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unmatched '{'");
+ throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
+ break;
+ case ERROR_EOF:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": unexpected end of file");
+ throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
+ break;
+ case ERROR_HEX_INVALID:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": invalid hex char");
+ throw io::WrongFormatException(m_pTokenizer->getPosition(), uno::Reference< uno::XInterface >());
+ break;
+ case ERROR_CHAR_OVER:
+ SAL_INFO("writerfilter", OSL_THIS_FUNC << ": characters after last '}'");
+ break;
}
}
int RTFDocumentImpl::resolvePict(bool bInline)
{
SvMemoryStream aStream;
- SvStream *pStream = 0;
+ SvStream* pStream = 0;
if (!m_pBinaryData.get())
{
pStream = &aStream;
@@ -712,7 +714,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
// Feed the destination text to a stream.
OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
- const char *str = aStr.getStr();
+ const char* str = aStr.getStr();
for (int i = 0; i < aStr.getLength(); ++i)
{
char ch = str[i];
@@ -726,7 +728,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
count--;
if (!count)
{
- aStream.WriteChar( (char)b );
+ aStream.WriteChar((char)b);
count = 2;
b = 0;
}
@@ -778,12 +780,12 @@ int RTFDocumentImpl::resolvePict(bool bInline)
if (m_xModelFactory.is())
xShape.set(m_xModelFactory->createInstance("com.sun.star.drawing.GraphicObjectShape"), uno::UNO_QUERY);
uno::Reference<beans::XPropertySet> xPropertySet(xShape, uno::UNO_QUERY);
- uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier( m_xDstDoc, uno::UNO_QUERY);
- if ( xDrawSupplier.is() )
+ uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
+ if (xDrawSupplier.is())
{
- uno::Reference< drawing::XShapes > xShapes( xDrawSupplier->getDrawPage(), uno::UNO_QUERY );
- if ( xShapes.is() )
- xShapes->add( xShape );
+ uno::Reference< drawing::XShapes > xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY);
+ if (xShapes.is())
+ xShapes->add(xShape);
}
// check if the picture is in an OLE object and if the \objdata element is used
@@ -802,7 +804,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
awt::Size aSize;
aSize.Width = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth : m_aStates.top().aPicture.nWidth);
aSize.Height = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight : m_aStates.top().aPicture.nHeight);
- xShape->setSize( aSize );
+ xShape->setSize(aSize);
RTFValue::Pointer_t pShapeValue(new RTFValue(xShape));
m_aObjectAttributes.set(NS_ooxml::LN_shape, pShapeValue);
@@ -845,9 +847,9 @@ int RTFDocumentImpl::resolvePict(bool bInline)
nXExt = (m_aStates.top().aPicture.nGoalWidth ? m_aStates.top().aPicture.nGoalWidth : m_aStates.top().aPicture.nWidth);
nYExt = (m_aStates.top().aPicture.nGoalHeight ? m_aStates.top().aPicture.nGoalHeight : m_aStates.top().aPicture.nHeight);
if (m_aStates.top().aPicture.nScaleX != 100)
- nXExt = (((long)m_aStates.top().aPicture.nScaleX) * ( nXExt - ( m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR ))) / 100L;
+ nXExt = (((long)m_aStates.top().aPicture.nScaleX) * (nXExt - (m_aStates.top().aPicture.nCropL + m_aStates.top().aPicture.nCropR))) / 100L;
if (m_aStates.top().aPicture.nScaleY != 100)
- nYExt = (((long)m_aStates.top().aPicture.nScaleY) * ( nYExt - ( m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB ))) / 100L;
+ nYExt = (((long)m_aStates.top().aPicture.nScaleY) * (nYExt - (m_aStates.top().aPicture.nCropT + m_aStates.top().aPicture.nCropB))) / 100L;
RTFValue::Pointer_t pXExtValue(new RTFValue(MM100_TO_EMU(nXExt)));
RTFValue::Pointer_t pYExtValue(new RTFValue(MM100_TO_EMU(nYExt)));
aExtentAttributes.set(NS_ooxml::LN_CT_PositiveSize2D_cx, pXExtValue);
@@ -939,11 +941,11 @@ int RTFDocumentImpl::resolveChars(char ch)
if (m_aStates.top().nInternalState == INTERNAL_BIN)
{
m_pBinaryData.reset(new SvMemoryStream());
- m_pBinaryData->WriteChar( ch );
+ m_pBinaryData->WriteChar(ch);
for (int i = 0; i < m_aStates.top().nBinaryToRead - 1; ++i)
{
- Strm().ReadChar( ch );
- m_pBinaryData->WriteChar( ch );
+ Strm().ReadChar(ch);
+ m_pBinaryData->WriteChar(ch);
}
m_aStates.top().nInternalState = INTERNAL_NORMAL;
return 0;
@@ -956,7 +958,7 @@ int RTFDocumentImpl::resolveChars(char ch)
bool bUnicodeChecked = false;
bool bSkipped = false;
- while(!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != '{' && ch != '}' && ch != '\\')))
+ while (!Strm().IsEof() && (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != '{' && ch != '}' && ch != '\\')))
{
if (m_aStates.top().nInternalState == INTERNAL_HEX || (ch != 0x0d && ch != 0x0a))
{
@@ -978,7 +980,7 @@ int RTFDocumentImpl::resolveChars(char ch)
// read a single char if we're in hex mode
if (m_aStates.top().nInternalState == INTERNAL_HEX)
break;
- Strm().ReadChar( ch );
+ Strm().ReadChar(ch);
}
if (m_aStates.top().nInternalState != INTERNAL_HEX && !Strm().IsEof())
Strm().SeekRel(-1);
@@ -1006,8 +1008,8 @@ int RTFDocumentImpl::resolveChars(char ch)
if (m_aStates.top().nDestinationState == DESTINATION_COLORTABLE)
{
// we hit a ';' at the end of each color entry
- sal_uInt32 color = (m_aStates.top().aCurrentColor.nRed << 16) | ( m_aStates.top().aCurrentColor.nGreen << 8)
- | m_aStates.top().aCurrentColor.nBlue;
+ sal_uInt32 color = (m_aStates.top().aCurrentColor.nRed << 16) | (m_aStates.top().aCurrentColor.nGreen << 8)
+ | m_aStates.top().aCurrentColor.nBlue;
m_aColorTable.push_back(color);
// set components back to zero
m_aStates.top().aCurrentColor = RTFColorTableEntry();
@@ -1021,9 +1023,9 @@ int RTFDocumentImpl::resolveChars(char ch)
bool RTFFrame::inFrame()
{
return nW > 0
- || nH > 0
- || nX > 0
- || nY > 0;
+ || nH > 0
+ || nX > 0
+ || nY > 0;
}
void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
@@ -1062,125 +1064,126 @@ void RTFDocumentImpl::text(OUString& rString)
bool bRet = true;
switch (m_aStates.top().nDestinationState)
{
- case DESTINATION_FONTTABLE:
- case DESTINATION_FONTENTRY:
- case DESTINATION_STYLESHEET:
- case DESTINATION_STYLEENTRY:
- case DESTINATION_REVISIONTABLE:
- case DESTINATION_REVISIONENTRY:
+ case DESTINATION_FONTTABLE:
+ case DESTINATION_FONTENTRY:
+ case DESTINATION_STYLESHEET:
+ case DESTINATION_STYLEENTRY:
+ case DESTINATION_REVISIONTABLE:
+ case DESTINATION_REVISIONENTRY:
+ {
+ // ; is the end of the entry
+ bool bEnd = false;
+ if (rString.endsWithAsciiL(";", 1))
+ {
+ rString = rString.copy(0, rString.getLength() - 1);
+ bEnd = true;
+ }
+ m_aStates.top().aDestinationText.append(rString);
+ if (bEnd)
+ {
+ switch (m_aStates.top().nDestinationState)
{
- // ; is the end of the entry
- bool bEnd = false;
- if (rString.endsWithAsciiL(";", 1))
+ case DESTINATION_FONTTABLE:
+ case DESTINATION_FONTENTRY:
+ {
+ OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
+ m_aFontNames[m_nCurrentFontIndex] = aName;
+ if (m_nCurrentEncoding > 0)
{
- rString = rString.copy(0, rString.getLength() - 1);
- bEnd = true;
+ m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding;
+ m_nCurrentEncoding = 0;
}
- m_aStates.top().aDestinationText.append(rString);
- if (bEnd)
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, RTFValue::Pointer_t(new RTFValue(aName)));
+
+ writerfilter::Reference<Properties>::Pointer_t const pProp(
+ new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms)
+ );
+
+ //See fdo#47347 initial invalid font entry properties are inserted first,
+ //so when we attempt to insert the correct ones, there's already an
+ //entry in the map for them, so the new ones aren't inserted.
+ RTFReferenceTable::Entries_t::iterator lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex);
+ if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first)))
+ lb->second = pProp;
+ else
+ m_aFontTableEntries.insert(lb, make_pair(m_nCurrentFontIndex, pProp));
+ }
+ break;
+ case DESTINATION_STYLESHEET:
+ case DESTINATION_STYLEENTRY:
+ if (m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type))
{
- switch (m_aStates.top().nDestinationState)
- {
- case DESTINATION_FONTTABLE:
- case DESTINATION_FONTENTRY:
- {
- OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
- m_aFontNames[m_nCurrentFontIndex] = aName;
- if (m_nCurrentEncoding > 0)
- {
- m_aFontEncodings[m_nCurrentFontIndex] = m_nCurrentEncoding;
- m_nCurrentEncoding = 0;
- }
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Font_name, RTFValue::Pointer_t(new RTFValue(aName)));
-
- writerfilter::Reference<Properties>::Pointer_t const pProp(
- new RTFReferenceProperties(m_aStates.top().aTableAttributes, m_aStates.top().aTableSprms)
- );
-
- //See fdo#47347 initial invalid font entry properties are inserted first,
- //so when we attempt to insert the correct ones, there's already an
- //entry in the map for them, so the new ones aren't inserted.
- RTFReferenceTable::Entries_t::iterator lb = m_aFontTableEntries.lower_bound(m_nCurrentFontIndex);
- if (lb != m_aFontTableEntries.end() && !(m_aFontTableEntries.key_comp()(m_nCurrentFontIndex, lb->first)))
- lb->second = pProp;
- else
- m_aFontTableEntries.insert(lb, make_pair(m_nCurrentFontIndex, pProp));
- }
- break;
- case DESTINATION_STYLESHEET:
- case DESTINATION_STYLEENTRY:
- if (m_aStates.top().aTableAttributes.find(NS_ooxml::LN_CT_Style_type))
- {
- OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
- m_aStyleNames[m_nCurrentStyleIndex] = aName;
- RTFValue::Pointer_t pValue(new RTFValue(aName));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue);
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue);
-
- writerfilter::Reference<Properties>::Pointer_t const pProp(
- new RTFReferenceProperties(mergeAttributes(), mergeSprms())
- );
- m_aStyleTableEntries.insert(make_pair(m_nCurrentStyleIndex, pProp));
- }
- else
- SAL_INFO("writerfilter", "no RTF style type defined, ignoring");
- break;
- case DESTINATION_REVISIONTABLE:
- case DESTINATION_REVISIONENTRY:
- m_aAuthors[m_aAuthors.size()] = m_aStates.top().aDestinationText.makeStringAndClear();
- break;
- default: break;
- }
- resetAttributes();
- resetSprms();
+ OUString aName = m_aStates.top().aDestinationText.makeStringAndClear();
+ m_aStyleNames[m_nCurrentStyleIndex] = aName;
+ RTFValue::Pointer_t pValue(new RTFValue(aName));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_styleId, pValue);
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Style_name, pValue);
+
+ writerfilter::Reference<Properties>::Pointer_t const pProp(
+ new RTFReferenceProperties(mergeAttributes(), mergeSprms())
+ );
+ m_aStyleTableEntries.insert(make_pair(m_nCurrentStyleIndex, pProp));
}
+ else
+ SAL_INFO("writerfilter", "no RTF style type defined, ignoring");
+ break;
+ case DESTINATION_REVISIONTABLE:
+ case DESTINATION_REVISIONENTRY:
+ m_aAuthors[m_aAuthors.size()] = m_aStates.top().aDestinationText.makeStringAndClear();
+ break;
+ default:
+ break;
}
- break;
- case DESTINATION_LEVELTEXT:
- case DESTINATION_SHAPEPROPERTYNAME:
- case DESTINATION_SHAPEPROPERTYVALUE:
- case DESTINATION_BOOKMARKEND:
- case DESTINATION_PICT:
- case DESTINATION_SHAPEPROPERTYVALUEPICT:
- case DESTINATION_FORMFIELDNAME:
- case DESTINATION_FORMFIELDLIST:
- case DESTINATION_DATAFIELD:
- case DESTINATION_AUTHOR:
- case DESTINATION_KEYWORDS:
- case DESTINATION_OPERATOR:
- case DESTINATION_COMPANY:
- case DESTINATION_COMMENT:
- case DESTINATION_OBJDATA:
- case DESTINATION_ANNOTATIONDATE:
- case DESTINATION_ANNOTATIONAUTHOR:
- case DESTINATION_ANNOTATIONREFERENCE:
- case DESTINATION_FALT:
- case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
- case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
- case DESTINATION_TITLE:
- case DESTINATION_SUBJECT:
- case DESTINATION_DOCCOMM:
- case DESTINATION_ATNID:
- case DESTINATION_ANNOTATIONREFERENCESTART:
- case DESTINATION_ANNOTATIONREFERENCEEND:
- case DESTINATION_MR:
- case DESTINATION_MCHR:
- case DESTINATION_MPOS:
- case DESTINATION_MVERTJC:
- case DESTINATION_MSTRIKEH:
- case DESTINATION_MDEGHIDE:
- case DESTINATION_MBEGCHR:
- case DESTINATION_MSEPCHR:
- case DESTINATION_MENDCHR:
- case DESTINATION_MSUBHIDE:
- case DESTINATION_MSUPHIDE:
- case DESTINATION_MTYPE:
- case DESTINATION_MGROW:
- m_aStates.top().aDestinationText.append(rString);
- break;
- default:
- bRet = false;
- break;
+ resetAttributes();
+ resetSprms();
+ }
+ }
+ break;
+ case DESTINATION_LEVELTEXT:
+ case DESTINATION_SHAPEPROPERTYNAME:
+ case DESTINATION_SHAPEPROPERTYVALUE:
+ case DESTINATION_BOOKMARKEND:
+ case DESTINATION_PICT:
+ case DESTINATION_SHAPEPROPERTYVALUEPICT:
+ case DESTINATION_FORMFIELDNAME:
+ case DESTINATION_FORMFIELDLIST:
+ case DESTINATION_DATAFIELD:
+ case DESTINATION_AUTHOR:
+ case DESTINATION_KEYWORDS:
+ case DESTINATION_OPERATOR:
+ case DESTINATION_COMPANY:
+ case DESTINATION_COMMENT:
+ case DESTINATION_OBJDATA:
+ case DESTINATION_ANNOTATIONDATE:
+ case DESTINATION_ANNOTATIONAUTHOR:
+ case DESTINATION_ANNOTATIONREFERENCE:
+ case DESTINATION_FALT:
+ case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
+ case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
+ case DESTINATION_TITLE:
+ case DESTINATION_SUBJECT:
+ case DESTINATION_DOCCOMM:
+ case DESTINATION_ATNID:
+ case DESTINATION_ANNOTATIONREFERENCESTART:
+ case DESTINATION_ANNOTATIONREFERENCEEND:
+ case DESTINATION_MR:
+ case DESTINATION_MCHR:
+ case DESTINATION_MPOS:
+ case DESTINATION_MVERTJC:
+ case DESTINATION_MSTRIKEH:
+ case DESTINATION_MDEGHIDE:
+ case DESTINATION_MBEGCHR:
+ case DESTINATION_MSEPCHR:
+ case DESTINATION_MENDCHR:
+ case DESTINATION_MSUBHIDE:
+ case DESTINATION_MSUPHIDE:
+ case DESTINATION_MTYPE:
+ case DESTINATION_MGROW:
+ m_aStates.top().aDestinationText.append(rString);
+ break;
+ default:
+ bRet = false;
+ break;
}
if (bRet)
return;
@@ -1193,7 +1196,7 @@ void RTFDocumentImpl::text(OUString& rString)
// Are we in the middle of the table definition? (No cell defs yet, but we already have some cell props.)
if (m_aStates.top().aTableCellSprms.find(NS_ooxml::LN_CT_TcPrBase_vAlign).get() &&
- m_nTopLevelCells == 0)
+ m_nTopLevelCells == 0)
{
m_aTableBufferStack.back().push_back(
Buf_t(BUFFER_UTEXT, RTFValue::Pointer_t(new RTFValue(rString))));
@@ -1237,7 +1240,7 @@ void RTFDocumentImpl::text(OUString& rString)
if (!pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
Mapper().endCharacterGroup();
- else if(pCurrentBuffer)
+ else if (pCurrentBuffer)
{
RTFValue::Pointer_t pValue;
pCurrentBuffer->push_back(Buf_t(BUFFER_ENDRUN, pValue));
@@ -1245,29 +1248,29 @@ void RTFDocumentImpl::text(OUString& rString)
}
void RTFDocumentImpl::prepareProperties(
- RTFParserState & rState,
- writerfilter::Reference<Properties>::Pointer_t & o_rpParagraphProperties,
- writerfilter::Reference<Properties>::Pointer_t & o_rpFrameProperties,
- writerfilter::Reference<Properties>::Pointer_t & o_rpTableRowProperties,
+ RTFParserState& rState,
+ writerfilter::Reference<Properties>::Pointer_t& o_rpParagraphProperties,
+ writerfilter::Reference<Properties>::Pointer_t& o_rpFrameProperties,
+ writerfilter::Reference<Properties>::Pointer_t& o_rpTableRowProperties,
int const nCells, int const nCurrentCellX)
{
o_rpParagraphProperties = getProperties(
- rState.aParagraphAttributes, rState.aParagraphSprms);
+ rState.aParagraphAttributes, rState.aParagraphSprms);
if (rState.aFrame.hasProperties())
{
o_rpFrameProperties.reset(new RTFReferenceProperties(
- RTFSprms(), rState.aFrame.getSprms()));
+ RTFSprms(), rState.aFrame.getSprms()));
}
// Table width.
RTFValue::Pointer_t const pUnitValue(new RTFValue(3));
lcl_putNestedAttribute(rState.aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type,
- pUnitValue);
+ NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_type,
+ pUnitValue);
RTFValue::Pointer_t const pWValue(new RTFValue(nCurrentCellX));
lcl_putNestedAttribute(rState.aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue);
+ NS_ooxml::LN_CT_TblPrBase_tblW, NS_ooxml::LN_CT_TblWidth_w, pWValue);
RTFValue::Pointer_t const pRowValue(new RTFValue(1));
if (nCells > 0)
@@ -1280,21 +1283,21 @@ void RTFDocumentImpl::prepareProperties(
// If no cell margins are defined, the default left/right margin is 0 in Word, but not in Writer.
RTFSprms aAttributes;
aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, RTFValue::Pointer_t(
- new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+ new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
aAttributes.set(NS_ooxml::LN_CT_TblWidth_w,
- RTFValue::Pointer_t(new RTFValue(0)));
+ RTFValue::Pointer_t(new RTFValue(0)));
lcl_putNestedSprm(rState.aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblCellMar,
- NS_ooxml::LN_CT_TblCellMar_left,
- RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ NS_ooxml::LN_CT_TblPrBase_tblCellMar,
+ NS_ooxml::LN_CT_TblCellMar_left,
+ RTFValue::Pointer_t(new RTFValue(aAttributes)));
lcl_putNestedSprm(rState.aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblCellMar,
- NS_ooxml::LN_CT_TblCellMar_right,
- RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ NS_ooxml::LN_CT_TblPrBase_tblCellMar,
+ NS_ooxml::LN_CT_TblCellMar_right,
+ RTFValue::Pointer_t(new RTFValue(aAttributes)));
}
o_rpTableRowProperties.reset(new RTFReferenceProperties(
- rState.aTableRowAttributes, rState.aTableRowSprms));
+ rState.aTableRowAttributes, rState.aTableRowSprms));
}
void RTFDocumentImpl::sendProperties(
@@ -1315,10 +1318,10 @@ void RTFDocumentImpl::sendProperties(
}
void RTFDocumentImpl::replayRowBuffer(
- RTFBuffer_t & rBuffer,
- ::std::deque<RTFSprms> & rCellsSrpms,
- ::std::deque<RTFSprms> & rCellsAttributes,
- int const nCells)
+ RTFBuffer_t& rBuffer,
+ ::std::deque<RTFSprms>& rCellsSrpms,
+ ::std::deque<RTFSprms>& rCellsAttributes,
+ int const nCells)
{
for (int i = 0; i < nCells; ++i)
{
@@ -1328,15 +1331,15 @@ void RTFDocumentImpl::replayRowBuffer(
}
for (size_t i = 0; i < rBuffer.size(); ++i)
{
- SAL_WARN_IF( BUFFER_CELLEND == boost::get<0>(rBuffer[i]),
- "writerfilter.rtf", "dropping table cell!");
+ SAL_WARN_IF(BUFFER_CELLEND == boost::get<0>(rBuffer[i]),
+ "writerfilter.rtf", "dropping table cell!");
}
assert(0 == rCellsSrpms.size());
assert(0 == rCellsAttributes.size());
}
void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
- RTFSprms *const pSprms, RTFSprms const*const pAttributes)
+ RTFSprms* const pSprms, RTFSprms const* const pAttributes)
{
while (rBuffer.size())
{
@@ -1345,21 +1348,21 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
if (boost::get<0>(aTuple) == BUFFER_PROPS)
{
writerfilter::Reference<Properties>::Pointer_t const pProp(
- new RTFReferenceProperties(
- boost::get<1>(aTuple)->getAttributes(),
- boost::get<1>(aTuple)->getSprms())
- );
+ new RTFReferenceProperties(
+ boost::get<1>(aTuple)->getAttributes(),
+ boost::get<1>(aTuple)->getSprms())
+ );
Mapper().props(pProp);
}
else if (boost::get<0>(aTuple) == BUFFER_NESTROW)
{
- TableRowBuffer & rRowBuffer(*boost::get<2>(aTuple));
+ TableRowBuffer& rRowBuffer(*boost::get<2>(aTuple));
replayRowBuffer(rRowBuffer.buffer, rRowBuffer.cellsSprms,
- rRowBuffer.cellsAttributes, rRowBuffer.nCells);
+ rRowBuffer.cellsAttributes, rRowBuffer.nCells);
sendProperties(rRowBuffer.pParaProperties,
- rRowBuffer.pFrameProperties, rRowBuffer.pRowProperties);
+ rRowBuffer.pFrameProperties, rRowBuffer.pRowProperties);
}
else if (boost::get<0>(aTuple) == BUFFER_CELLEND)
{
@@ -1367,7 +1370,7 @@ void RTFDocumentImpl::replayBuffer(RTFBuffer_t& rBuffer,
RTFValue::Pointer_t pValue(new RTFValue(1));
pSprms->set(NS_ooxml::LN_tblCell, pValue);
writerfilter::Reference<Properties>::Pointer_t const pTableCellProperties(
- new RTFReferenceProperties(*pAttributes, *pSprms));
+ new RTFReferenceProperties(*pAttributes, *pSprms));
Mapper().props(pTableCellProperties);
tableBreak();
break;
@@ -1405,478 +1408,521 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
RTFSkipDestination aSkip(*this);
switch (nKeyword)
{
- case RTF_RTF:
- break;
- case RTF_FONTTBL:
- m_aStates.top().nDestinationState = DESTINATION_FONTTABLE;
- break;
- case RTF_COLORTBL:
- m_aStates.top().nDestinationState = DESTINATION_COLORTABLE;
- break;
- case RTF_STYLESHEET:
- m_aStates.top().nDestinationState = DESTINATION_STYLESHEET;
- break;
- case RTF_FIELD:
- m_aStates.top().nDestinationState = DESTINATION_FIELD;
- break;
- case RTF_FLDINST:
- {
- // Look for the field type
- sal_Size nPos = Strm().Tell();
- OStringBuffer aBuf;
- char ch = 0;
- bool bFoundCode = false;
- bool bInKeyword = false;
- while (!bFoundCode && ch != '}')
- {
- Strm().ReadChar( ch );
- if ('\\' == ch)
- bInKeyword = true;
- if (!bInKeyword && isalnum(ch))
- aBuf.append(ch);
- else if (bInKeyword && isspace(ch))
- bInKeyword = false;
- if (!aBuf.isEmpty() && !isalnum(ch))
- bFoundCode = true;
- }
- Strm().Seek(nPos);
+ case RTF_RTF:
+ break;
+ case RTF_FONTTBL:
+ m_aStates.top().nDestinationState = DESTINATION_FONTTABLE;
+ break;
+ case RTF_COLORTBL:
+ m_aStates.top().nDestinationState = DESTINATION_COLORTABLE;
+ break;
+ case RTF_STYLESHEET:
+ m_aStates.top().nDestinationState = DESTINATION_STYLESHEET;
+ break;
+ case RTF_FIELD:
+ m_aStates.top().nDestinationState = DESTINATION_FIELD;
+ break;
+ case RTF_FLDINST:
+ {
+ // Look for the field type
+ sal_Size nPos = Strm().Tell();
+ OStringBuffer aBuf;
+ char ch = 0;
+ bool bFoundCode = false;
+ bool bInKeyword = false;
+ while (!bFoundCode && ch != '}')
+ {
+ Strm().ReadChar(ch);
+ if ('\\' == ch)
+ bInKeyword = true;
+ if (!bInKeyword && isalnum(ch))
+ aBuf.append(ch);
+ else if (bInKeyword && isspace(ch))
+ bInKeyword = false;
+ if (!aBuf.isEmpty() && !isalnum(ch))
+ bFoundCode = true;
+ }
+ Strm().Seek(nPos);
- // Form data should be handled only for form fields if any
- if (aBuf.toString().indexOf(OString("FORM")) != -1 )
- m_bFormField = true;
+ // Form data should be handled only for form fields if any
+ if (aBuf.toString().indexOf(OString("FORM")) != -1)
+ m_bFormField = true;
- singleChar(0x13);
- m_aStates.top().nDestinationState = DESTINATION_FIELDINSTRUCTION;
- }
- break;
- case RTF_FLDRSLT:
- m_aStates.top().nDestinationState = DESTINATION_FIELDRESULT;
- break;
- case RTF_LISTTABLE:
- m_aStates.top().nDestinationState = DESTINATION_LISTTABLE;
- break;
- case RTF_LISTPICTURE:
- m_aStates.top().nDestinationState = DESTINATION_LISTPICTURE;
- m_aStates.top().bInListpicture = true;
- break;
- case RTF_LIST:
- m_aStates.top().nDestinationState = DESTINATION_LISTENTRY;
- break;
- case RTF_LFOLEVEL:
- m_aStates.top().nDestinationState = DESTINATION_LFOLEVEL;
- m_aStates.top().aTableSprms.clear();
- break;
- case RTF_LISTOVERRIDETABLE:
- m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDETABLE;
- break;
- case RTF_LISTOVERRIDE:
- m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDEENTRY;
- break;
- case RTF_LISTLEVEL:
- m_aStates.top().nDestinationState = DESTINATION_LISTLEVEL;
- break;
- case RTF_LEVELTEXT:
- m_aStates.top().nDestinationState = DESTINATION_LEVELTEXT;
- break;
- case RTF_LEVELNUMBERS:
- m_aStates.top().nDestinationState = DESTINATION_LEVELNUMBERS;
- break;
- case RTF_SHPPICT:
- m_aStates.top().resetFrame();
- m_aStates.top().nDestinationState = DESTINATION_SHPPICT;
- break;
- case RTF_PICT:
- if (m_aStates.top().nDestinationState != DESTINATION_SHAPEPROPERTYVALUE)
- m_aStates.top().nDestinationState = DESTINATION_PICT; // as character
- else
- m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUEPICT; // anchored inside a shape
- break;
- case RTF_PICPROP:
- m_aStates.top().nDestinationState = DESTINATION_PICPROP;
- break;
- case RTF_SP:
- m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTY;
- break;
- case RTF_SN:
- m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYNAME;
- break;
- case RTF_SV:
- m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUE;
- break;
- case RTF_SHP:
- m_bNeedCrOrig = m_bNeedCr;
- m_aStates.top().nDestinationState = DESTINATION_SHAPE;
- m_aStates.top().bInShape = true;
- break;
- case RTF_SHPINST:
- m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
- break;
- case RTF_NESTTABLEPROPS:
- // do not set any properties of outer table at nested table!
- m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
- m_aStates.top().aTableCellAttributes =
- m_aDefaultState.aTableCellAttributes;
- m_aNestedTableCellsSprms.clear();
- m_aNestedTableCellsAttributes.clear();
- m_nNestedCells = 0;
- m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES;
- break;
- case RTF_HEADER:
- case RTF_FOOTER:
- case RTF_HEADERL:
- case RTF_HEADERR:
- case RTF_HEADERF:
- case RTF_FOOTERL:
- case RTF_FOOTERR:
- case RTF_FOOTERF:
- if (!m_pSuperstream)
+ singleChar(0x13);
+ m_aStates.top().nDestinationState = DESTINATION_FIELDINSTRUCTION;
+ }
+ break;
+ case RTF_FLDRSLT:
+ m_aStates.top().nDestinationState = DESTINATION_FIELDRESULT;
+ break;
+ case RTF_LISTTABLE:
+ m_aStates.top().nDestinationState = DESTINATION_LISTTABLE;
+ break;
+ case RTF_LISTPICTURE:
+ m_aStates.top().nDestinationState = DESTINATION_LISTPICTURE;
+ m_aStates.top().bInListpicture = true;
+ break;
+ case RTF_LIST:
+ m_aStates.top().nDestinationState = DESTINATION_LISTENTRY;
+ break;
+ case RTF_LFOLEVEL:
+ m_aStates.top().nDestinationState = DESTINATION_LFOLEVEL;
+ m_aStates.top().aTableSprms.clear();
+ break;
+ case RTF_LISTOVERRIDETABLE:
+ m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDETABLE;
+ break;
+ case RTF_LISTOVERRIDE:
+ m_aStates.top().nDestinationState = DESTINATION_LISTOVERRIDEENTRY;
+ break;
+ case RTF_LISTLEVEL:
+ m_aStates.top().nDestinationState = DESTINATION_LISTLEVEL;
+ break;
+ case RTF_LEVELTEXT:
+ m_aStates.top().nDestinationState = DESTINATION_LEVELTEXT;
+ break;
+ case RTF_LEVELNUMBERS:
+ m_aStates.top().nDestinationState = DESTINATION_LEVELNUMBERS;
+ break;
+ case RTF_SHPPICT:
+ m_aStates.top().resetFrame();
+ m_aStates.top().nDestinationState = DESTINATION_SHPPICT;
+ break;
+ case RTF_PICT:
+ if (m_aStates.top().nDestinationState != DESTINATION_SHAPEPROPERTYVALUE)
+ m_aStates.top().nDestinationState = DESTINATION_PICT; // as character
+ else
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUEPICT; // anchored inside a shape
+ break;
+ case RTF_PICPROP:
+ m_aStates.top().nDestinationState = DESTINATION_PICPROP;
+ break;
+ case RTF_SP:
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTY;
+ break;
+ case RTF_SN:
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYNAME;
+ break;
+ case RTF_SV:
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEPROPERTYVALUE;
+ break;
+ case RTF_SHP:
+ m_bNeedCrOrig = m_bNeedCr;
+ m_aStates.top().nDestinationState = DESTINATION_SHAPE;
+ m_aStates.top().bInShape = true;
+ break;
+ case RTF_SHPINST:
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEINSTRUCTION;
+ break;
+ case RTF_NESTTABLEPROPS:
+ // do not set any properties of outer table at nested table!
+ m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
+ m_aStates.top().aTableCellAttributes =
+ m_aDefaultState.aTableCellAttributes;
+ m_aNestedTableCellsSprms.clear();
+ m_aNestedTableCellsAttributes.clear();
+ m_nNestedCells = 0;
+ m_aStates.top().nDestinationState = DESTINATION_NESTEDTABLEPROPERTIES;
+ break;
+ case RTF_HEADER:
+ case RTF_FOOTER:
+ case RTF_HEADERL:
+ case RTF_HEADERR:
+ case RTF_HEADERF:
+ case RTF_FOOTERL:
+ case RTF_FOOTERR:
+ case RTF_FOOTERF:
+ if (!m_pSuperstream)
+ {
+ Id nId = 0;
+ sal_Size nPos = m_nGroupStartPos - 1;
+ switch (nKeyword)
{
- Id nId = 0;
- sal_Size nPos = m_nGroupStartPos - 1;
- switch (nKeyword)
- {
- case RTF_HEADER: nId = NS_ooxml::LN_headerr; break;
- case RTF_FOOTER: nId = NS_ooxml::LN_footerr; break;
- case RTF_HEADERL: nId = NS_ooxml::LN_headerl; break;
- case RTF_HEADERR: nId = NS_ooxml::LN_headerr; break;
- case RTF_HEADERF: nId = NS_ooxml::LN_headerf; break;
- case RTF_FOOTERL: nId = NS_ooxml::LN_footerl; break;
- case RTF_FOOTERR: nId = NS_ooxml::LN_footerr; break;
- case RTF_FOOTERF: nId = NS_ooxml::LN_footerf; break;
- default: break;
- }
- m_nHeaderFooterPositions.push(make_pair(nId, nPos));
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ case RTF_HEADER:
+ nId = NS_ooxml::LN_headerr;
+ break;
+ case RTF_FOOTER:
+ nId = NS_ooxml::LN_footerr;
+ break;
+ case RTF_HEADERL:
+ nId = NS_ooxml::LN_headerl;
+ break;
+ case RTF_HEADERR:
+ nId = NS_ooxml::LN_headerr;
+ break;
+ case RTF_HEADERF:
+ nId = NS_ooxml::LN_headerf;
+ break;
+ case RTF_FOOTERL:
+ nId = NS_ooxml::LN_footerl;
+ break;
+ case RTF_FOOTERR:
+ nId = NS_ooxml::LN_footerr;
+ break;
+ case RTF_FOOTERF:
+ nId = NS_ooxml::LN_footerf;
+ break;
+ default:
+ break;
}
- break;
- case RTF_FOOTNOTE:
- if (!m_pSuperstream)
- {
- Id nId = NS_ooxml::LN_footnote;
+ m_nHeaderFooterPositions.push(make_pair(nId, nPos));
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ }
+ break;
+ case RTF_FOOTNOTE:
+ if (!m_pSuperstream)
+ {
+ Id nId = NS_ooxml::LN_footnote;
- // Check if this is an endnote.
- OStringBuffer aBuf;
- char ch;
- for (int i = 0; i < 7; ++i)
- {
- Strm().ReadChar( ch );
- aBuf.append(ch);
- }
- OString aKeyword = aBuf.makeStringAndClear();
- if (aKeyword.equals("\\ftnalt"))
- nId = NS_ooxml::LN_endnote;
-
- m_bHasFootnote = true;
- if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer)
- m_aStates.top().pCurrentBuffer = 0;
- bool bCustomMark = false;
- OUString aCustomMark;
- while (m_aSuperBuffer.size())
- {
- Buf_t aTuple = m_aSuperBuffer.front();
- m_aSuperBuffer.pop_front();
- if (boost::get<0>(aTuple) == BUFFER_UTEXT)
- {
- aCustomMark = boost::get<1>(aTuple)->getString();
- bCustomMark = true;
- }
- }
- m_aStates.top().nDestinationState = DESTINATION_FOOTNOTE;
- if (bCustomMark)
- Mapper().startCharacterGroup();
- resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark);
- if (bCustomMark)
- {
- m_aStates.top().aCharacterAttributes.clear();
- m_aStates.top().aCharacterSprms.clear();
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue);
- text(aCustomMark);
- Mapper().endCharacterGroup();
- }
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- }
- break;
- case RTF_BKMKSTART:
- m_aStates.top().nDestinationState = DESTINATION_BOOKMARKSTART;
- break;
- case RTF_BKMKEND:
- m_aStates.top().nDestinationState = DESTINATION_BOOKMARKEND;
- break;
- case RTF_REVTBL:
- m_aStates.top().nDestinationState = DESTINATION_REVISIONTABLE;
- break;
- case RTF_ANNOTATION:
- if (!m_pSuperstream)
+ // Check if this is an endnote.
+ OStringBuffer aBuf;
+ char ch;
+ for (int i = 0; i < 7; ++i)
{
- resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation);
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ Strm().ReadChar(ch);
+ aBuf.append(ch);
}
- else
+ OString aKeyword = aBuf.makeStringAndClear();
+ if (aKeyword.equals("\\ftnalt"))
+ nId = NS_ooxml::LN_endnote;
+
+ m_bHasFootnote = true;
+ if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer)
+ m_aStates.top().pCurrentBuffer = 0;
+ bool bCustomMark = false;
+ OUString aCustomMark;
+ while (m_aSuperBuffer.size())
{
- // If there is an author set, emit it now.
- if (!m_aAuthor.isEmpty() || !m_aAuthorInitials.isEmpty())
+ Buf_t aTuple = m_aSuperBuffer.front();
+ m_aSuperBuffer.pop_front();
+ if (boost::get<0>(aTuple) == BUFFER_UTEXT)
{
- RTFSprms aAttributes;
- if (!m_aAuthor.isEmpty())
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aAuthor));
- aAttributes.set(NS_ooxml::LN_CT_TrackChange_author, pValue);
- }
- if (!m_aAuthorInitials.isEmpty())
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aAuthorInitials));
- aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue);
- }
- writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes));
- Mapper().props(pProperties);
+ aCustomMark = boost::get<1>(aTuple)->getString();
+ bCustomMark = true;
}
}
- break;
- case RTF_SHPTXT:
- case RTF_DPTXBXTEXT:
+ m_aStates.top().nDestinationState = DESTINATION_FOOTNOTE;
+ if (bCustomMark)
+ Mapper().startCharacterGroup();
+ resolveSubstream(m_nGroupStartPos - 1, nId, aCustomMark);
+ if (bCustomMark)
+ {
+ m_aStates.top().aCharacterAttributes.clear();
+ m_aStates.top().aCharacterSprms.clear();
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdnRef_customMarkFollows, pValue);
+ text(aCustomMark);
+ Mapper().endCharacterGroup();
+ }
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ }
+ break;
+ case RTF_BKMKSTART:
+ m_aStates.top().nDestinationState = DESTINATION_BOOKMARKSTART;
+ break;
+ case RTF_BKMKEND:
+ m_aStates.top().nDestinationState = DESTINATION_BOOKMARKEND;
+ break;
+ case RTF_REVTBL:
+ m_aStates.top().nDestinationState = DESTINATION_REVISIONTABLE;
+ break;
+ case RTF_ANNOTATION:
+ if (!m_pSuperstream)
+ {
+ resolveSubstream(m_nGroupStartPos - 1, NS_ooxml::LN_annotation);
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ }
+ else
+ {
+ // If there is an author set, emit it now.
+ if (!m_aAuthor.isEmpty() || !m_aAuthorInitials.isEmpty())
{
- bool bPictureFrame = false;
- for (size_t i = 0; i < m_aStates.top().aShape.aProperties.size(); ++i)
+ RTFSprms aAttributes;
+ if (!m_aAuthor.isEmpty())
{
- std::pair<OUString, OUString>& rProperty = m_aStates.top().aShape.aProperties[i];
- if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame))
- {
- bPictureFrame = true;
- break;
- }
+ RTFValue::Pointer_t pValue(new RTFValue(m_aAuthor));
+ aAttributes.set(NS_ooxml::LN_CT_TrackChange_author, pValue);
}
- if (bPictureFrame)
- // Skip text on picture frames.
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- else
+ if (!m_aAuthorInitials.isEmpty())
{
- m_aStates.top().nDestinationState = DESTINATION_SHAPETEXT;
- checkFirstRun();
- dispatchFlag(RTF_PARD);
- m_bNeedPap = true;
- if (nKeyword == RTF_SHPTXT)
- {
- if (!m_aStates.top().pCurrentBuffer)
- m_pSdrImport->resolve(m_aStates.top().aShape, false);
- else
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape));
- m_aStates.top().pCurrentBuffer->push_back(
- Buf_t(BUFFER_STARTSHAPE, pValue));
- }
- }
+ RTFValue::Pointer_t pValue(new RTFValue(m_aAuthorInitials));
+ aAttributes.set(NS_ooxml::LN_CT_Comment_initials, pValue);
}
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes));
+ Mapper().props(pProperties);
}
- break;
- case RTF_FORMFIELD:
- if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
- m_aStates.top().nDestinationState = DESTINATION_FORMFIELD;
- break;
- case RTF_FFNAME:
- m_aStates.top().nDestinationState = DESTINATION_FORMFIELDNAME;
- break;
- case RTF_FFL:
- m_aStates.top().nDestinationState = DESTINATION_FORMFIELDLIST;
- break;
- case RTF_DATAFIELD:
- m_aStates.top().nDestinationState = DESTINATION_DATAFIELD;
- break;
- case RTF_INFO:
- m_aStates.top().nDestinationState = DESTINATION_INFO;
- break;
- case RTF_CREATIM:
- m_aStates.top().nDestinationState = DESTINATION_CREATIONTIME;
- break;
- case RTF_REVTIM:
- m_aStates.top().nDestinationState = DESTINATION_REVISIONTIME;
- break;
- case RTF_PRINTIM:
- m_aStates.top().nDestinationState = DESTINATION_PRINTTIME;
- break;
- case RTF_AUTHOR:
- m_aStates.top().nDestinationState = DESTINATION_AUTHOR;
- break;
- case RTF_KEYWORDS:
- m_aStates.top().nDestinationState = DESTINATION_KEYWORDS;
- break;
- case RTF_OPERATOR:
- m_aStates.top().nDestinationState = DESTINATION_OPERATOR;
- break;
- case RTF_COMPANY:
- m_aStates.top().nDestinationState = DESTINATION_COMPANY;
- break;
- case RTF_COMMENT:
- m_aStates.top().nDestinationState = DESTINATION_COMMENT;
- break;
- case RTF_OBJECT:
+ }
+ break;
+ case RTF_SHPTXT:
+ case RTF_DPTXBXTEXT:
+ {
+ bool bPictureFrame = false;
+ for (size_t i = 0; i < m_aStates.top().aShape.aProperties.size(); ++i)
+ {
+ std::pair<OUString, OUString>& rProperty = m_aStates.top().aShape.aProperties[i];
+ if (rProperty.first == "shapeType" && rProperty.second == OUString::number(ESCHER_ShpInst_PictureFrame))
+ {
+ bPictureFrame = true;
+ break;
+ }
+ }
+ if (bPictureFrame)
+ // Skip text on picture frames.
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ else
+ {
+ m_aStates.top().nDestinationState = DESTINATION_SHAPETEXT;
+ checkFirstRun();
+ dispatchFlag(RTF_PARD);
+ m_bNeedPap = true;
+ if (nKeyword == RTF_SHPTXT)
{
- // beginning of an OLE Object
- m_aStates.top().nDestinationState = DESTINATION_OBJECT;
-
- // check if the object is in a special container (e.g. a table)
if (!m_aStates.top().pCurrentBuffer)
+ m_pSdrImport->resolve(m_aStates.top().aShape, false);
+ else
{
- // the object is in a table or another container.
- // Don't try to treate it as an OLE object (fdo#53594).
- // Use the \result (RTF_RESULT) element of the object instead,
- // the result element contain picture representing the OLE Object.
- m_bObject = true;
+ RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aShape));
+ m_aStates.top().pCurrentBuffer->push_back(
+ Buf_t(BUFFER_STARTSHAPE, pValue));
}
}
- break;
- case RTF_OBJDATA:
- // check if the object is in a special container (e.g. a table)
- if (m_aStates.top().pCurrentBuffer)
- {
- // the object is in a table or another container.
- // Use the \result (RTF_RESULT) element of the object instead,
- // of the \objdata.
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- }
- else
- {
- m_aStates.top().nDestinationState = DESTINATION_OBJDATA;
- }
- break;
- case RTF_RESULT:
- m_aStates.top().nDestinationState = DESTINATION_RESULT;
- break;
- case RTF_ATNDATE:
- m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONDATE;
- break;
- case RTF_ATNAUTHOR:
- m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONAUTHOR;
- break;
- case RTF_ATNREF:
- m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCE;
- break;
- case RTF_FALT:
- m_aStates.top().nDestinationState = DESTINATION_FALT;
- break;
- case RTF_FLYMAINCNT:
- m_aStates.top().nDestinationState = DESTINATION_FLYMAINCONTENT;
- break;
- case RTF_LISTTEXT:
- // Should be ignored by any reader that understands Word 97 through Word 2007 numbering.
- case RTF_NONESTTABLES:
- // This destination should be ignored by readers that support nested tables.
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- break;
- case RTF_DO:
- m_aStates.top().nDestinationState = DESTINATION_DRAWINGOBJECT;
- break;
- case RTF_PN:
- m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING;
- break;
- case RTF_PNTEXT:
- // This destination should be ignored by readers that support paragraph numbering.
+ }
+ }
+ break;
+ case RTF_FORMFIELD:
+ if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
+ m_aStates.top().nDestinationState = DESTINATION_FORMFIELD;
+ break;
+ case RTF_FFNAME:
+ m_aStates.top().nDestinationState = DESTINATION_FORMFIELDNAME;
+ break;
+ case RTF_FFL:
+ m_aStates.top().nDestinationState = DESTINATION_FORMFIELDLIST;
+ break;
+ case RTF_DATAFIELD:
+ m_aStates.top().nDestinationState = DESTINATION_DATAFIELD;
+ break;
+ case RTF_INFO:
+ m_aStates.top().nDestinationState = DESTINATION_INFO;
+ break;
+ case RTF_CREATIM:
+ m_aStates.top().nDestinationState = DESTINATION_CREATIONTIME;
+ break;
+ case RTF_REVTIM:
+ m_aStates.top().nDestinationState = DESTINATION_REVISIONTIME;
+ break;
+ case RTF_PRINTIM:
+ m_aStates.top().nDestinationState = DESTINATION_PRINTTIME;
+ break;
+ case RTF_AUTHOR:
+ m_aStates.top().nDestinationState = DESTINATION_AUTHOR;
+ break;
+ case RTF_KEYWORDS:
+ m_aStates.top().nDestinationState = DESTINATION_KEYWORDS;
+ break;
+ case RTF_OPERATOR:
+ m_aStates.top().nDestinationState = DESTINATION_OPERATOR;
+ break;
+ case RTF_COMPANY:
+ m_aStates.top().nDestinationState = DESTINATION_COMPANY;
+ break;
+ case RTF_COMMENT:
+ m_aStates.top().nDestinationState = DESTINATION_COMMENT;
+ break;
+ case RTF_OBJECT:
+ {
+ // beginning of an OLE Object
+ m_aStates.top().nDestinationState = DESTINATION_OBJECT;
+
+ // check if the object is in a special container (e.g. a table)
+ if (!m_aStates.top().pCurrentBuffer)
+ {
+ // the object is in a table or another container.
+ // Don't try to treate it as an OLE object (fdo#53594).
+ // Use the \result (RTF_RESULT) element of the object instead,
+ // the result element contain picture representing the OLE Object.
+ m_bObject = true;
+ }
+ }
+ break;
+ case RTF_OBJDATA:
+ // check if the object is in a special container (e.g. a table)
+ if (m_aStates.top().pCurrentBuffer)
+ {
+ // the object is in a table or another container.
+ // Use the \result (RTF_RESULT) element of the object instead,
+ // of the \objdata.
m_aStates.top().nDestinationState = DESTINATION_SKIP;
- break;
- case RTF_PNTXTA:
- m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER;
- break;
- case RTF_PNTXTB:
- m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE;
- break;
- case RTF_TITLE:
- // \title inside \upr but outside \ud should be ignored.
- if (m_aStates.top().nDestinationState != DESTINATION_UPR)
- m_aStates.top().nDestinationState = DESTINATION_TITLE;
- else
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- break;
- case RTF_SUBJECT:
- m_aStates.top().nDestinationState = DESTINATION_SUBJECT;
- break;
- case RTF_DOCCOMM:
- m_aStates.top().nDestinationState = DESTINATION_DOCCOMM;
- break;
- case RTF_ATRFSTART:
- m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCESTART;
- break;
- case RTF_ATRFEND:
- m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCEEND;
- break;
- case RTF_ATNID:
- m_aStates.top().nDestinationState = DESTINATION_ATNID;
- break;
- case RTF_MMATH:
- case RTF_MOMATHPARA:
- // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented.
- break;
- case RTF_MR: m_aStates.top().nDestinationState = DESTINATION_MR; break;
- case RTF_MCHR: m_aStates.top().nDestinationState = DESTINATION_MCHR; break;
- case RTF_MPOS: m_aStates.top().nDestinationState = DESTINATION_MPOS; break;
- case RTF_MVERTJC: m_aStates.top().nDestinationState = DESTINATION_MVERTJC; break;
- case RTF_MSTRIKEH: m_aStates.top().nDestinationState = DESTINATION_MSTRIKEH; break;
- case RTF_MDEGHIDE: m_aStates.top().nDestinationState = DESTINATION_MDEGHIDE; break;
- case RTF_MTYPE: m_aStates.top().nDestinationState = DESTINATION_MTYPE; break;
- case RTF_MGROW: m_aStates.top().nDestinationState = DESTINATION_MGROW; break;
- case RTF_MHIDETOP:
- case RTF_MHIDEBOT:
- case RTF_MHIDELEFT:
- case RTF_MHIDERIGHT:
- // SmOoxmlImport::handleBorderBox will ignore these anyway, so silently ignore for now.
+ }
+ else
+ {
+ m_aStates.top().nDestinationState = DESTINATION_OBJDATA;
+ }
+ break;
+ case RTF_RESULT:
+ m_aStates.top().nDestinationState = DESTINATION_RESULT;
+ break;
+ case RTF_ATNDATE:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONDATE;
+ break;
+ case RTF_ATNAUTHOR:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONAUTHOR;
+ break;
+ case RTF_ATNREF:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCE;
+ break;
+ case RTF_FALT:
+ m_aStates.top().nDestinationState = DESTINATION_FALT;
+ break;
+ case RTF_FLYMAINCNT:
+ m_aStates.top().nDestinationState = DESTINATION_FLYMAINCONTENT;
+ break;
+ case RTF_LISTTEXT:
+ // Should be ignored by any reader that understands Word 97 through Word 2007 numbering.
+ case RTF_NONESTTABLES:
+ // This destination should be ignored by readers that support nested tables.
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ break;
+ case RTF_DO:
+ m_aStates.top().nDestinationState = DESTINATION_DRAWINGOBJECT;
+ break;
+ case RTF_PN:
+ m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING;
+ break;
+ case RTF_PNTEXT:
+ // This destination should be ignored by readers that support paragraph numbering.
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ break;
+ case RTF_PNTXTA:
+ m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER;
+ break;
+ case RTF_PNTXTB:
+ m_aStates.top().nDestinationState = DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE;
+ break;
+ case RTF_TITLE:
+ // \title inside \upr but outside \ud should be ignored.
+ if (m_aStates.top().nDestinationState != DESTINATION_UPR)
+ m_aStates.top().nDestinationState = DESTINATION_TITLE;
+ else
m_aStates.top().nDestinationState = DESTINATION_SKIP;
- break;
- case RTF_MSUBHIDE: m_aStates.top().nDestinationState = DESTINATION_MSUBHIDE; break;
- case RTF_MSUPHIDE: m_aStates.top().nDestinationState = DESTINATION_MSUPHIDE; break;
- case RTF_MBEGCHR: m_aStates.top().nDestinationState = DESTINATION_MBEGCHR; break;
- case RTF_MSEPCHR: m_aStates.top().nDestinationState = DESTINATION_MSEPCHR; break;
- case RTF_MENDCHR: m_aStates.top().nDestinationState = DESTINATION_MENDCHR; break;
- case RTF_UPR:
- m_aStates.top().nDestinationState = DESTINATION_UPR;
- break;
- case RTF_UD:
- // Anything inside \ud is just normal Unicode content.
- m_aStates.top().nDestinationState = DESTINATION_NORMAL;
- break;
- case RTF_BACKGROUND:
- m_aStates.top().nDestinationState = DESTINATION_BACKGROUND;
- m_aStates.top().bInBackground = true;
- break;
- case RTF_SHPGRP:
+ break;
+ case RTF_SUBJECT:
+ m_aStates.top().nDestinationState = DESTINATION_SUBJECT;
+ break;
+ case RTF_DOCCOMM:
+ m_aStates.top().nDestinationState = DESTINATION_DOCCOMM;
+ break;
+ case RTF_ATRFSTART:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCESTART;
+ break;
+ case RTF_ATRFEND:
+ m_aStates.top().nDestinationState = DESTINATION_ANNOTATIONREFERENCEEND;
+ break;
+ case RTF_ATNID:
+ m_aStates.top().nDestinationState = DESTINATION_ATNID;
+ break;
+ case RTF_MMATH:
+ case RTF_MOMATHPARA:
+ // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented.
+ break;
+ case RTF_MR:
+ m_aStates.top().nDestinationState = DESTINATION_MR;
+ break;
+ case RTF_MCHR:
+ m_aStates.top().nDestinationState = DESTINATION_MCHR;
+ break;
+ case RTF_MPOS:
+ m_aStates.top().nDestinationState = DESTINATION_MPOS;
+ break;
+ case RTF_MVERTJC:
+ m_aStates.top().nDestinationState = DESTINATION_MVERTJC;
+ break;
+ case RTF_MSTRIKEH:
+ m_aStates.top().nDestinationState = DESTINATION_MSTRIKEH;
+ break;
+ case RTF_MDEGHIDE:
+ m_aStates.top().nDestinationState = DESTINATION_MDEGHIDE;
+ break;
+ case RTF_MTYPE:
+ m_aStates.top().nDestinationState = DESTINATION_MTYPE;
+ break;
+ case RTF_MGROW:
+ m_aStates.top().nDestinationState = DESTINATION_MGROW;
+ break;
+ case RTF_MHIDETOP:
+ case RTF_MHIDEBOT:
+ case RTF_MHIDELEFT:
+ case RTF_MHIDERIGHT:
+ // SmOoxmlImport::handleBorderBox will ignore these anyway, so silently ignore for now.
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ break;
+ case RTF_MSUBHIDE:
+ m_aStates.top().nDestinationState = DESTINATION_MSUBHIDE;
+ break;
+ case RTF_MSUPHIDE:
+ m_aStates.top().nDestinationState = DESTINATION_MSUPHIDE;
+ break;
+ case RTF_MBEGCHR:
+ m_aStates.top().nDestinationState = DESTINATION_MBEGCHR;
+ break;
+ case RTF_MSEPCHR:
+ m_aStates.top().nDestinationState = DESTINATION_MSEPCHR;
+ break;
+ case RTF_MENDCHR:
+ m_aStates.top().nDestinationState = DESTINATION_MENDCHR;
+ break;
+ case RTF_UPR:
+ m_aStates.top().nDestinationState = DESTINATION_UPR;
+ break;
+ case RTF_UD:
+ // Anything inside \ud is just normal Unicode content.
+ m_aStates.top().nDestinationState = DESTINATION_NORMAL;
+ break;
+ case RTF_BACKGROUND:
+ m_aStates.top().nDestinationState = DESTINATION_BACKGROUND;
+ m_aStates.top().bInBackground = true;
+ break;
+ case RTF_SHPGRP:
+ {
+ RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart());
+ if (!aLookahead.hasTable())
+ {
+ uno::Reference<drawing::XShapes> xGroupShape(m_xModelFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
+ if (xDrawSupplier.is())
{
- RTFLookahead aLookahead(Strm(), m_pTokenizer->getGroupStart());
- if (!aLookahead.hasTable())
- {
- uno::Reference<drawing::XShapes> xGroupShape(m_xModelFactory->createInstance("com.sun.star.drawing.GroupShape"), uno::UNO_QUERY);
- uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
- if (xDrawSupplier.is())
- {
- uno::Reference<drawing::XShape> xShape(xGroupShape, uno::UNO_QUERY);
- xDrawSupplier->getDrawPage()->add(xShape);
- }
- m_pSdrImport->pushParent(xGroupShape);
- m_aStates.top().bCreatedShapeGroup = true;
- }
- m_aStates.top().nDestinationState = DESTINATION_SHAPEGROUP;
- m_aStates.top().bInShapeGroup = true;
+ uno::Reference<drawing::XShape> xShape(xGroupShape, uno::UNO_QUERY);
+ xDrawSupplier->getDrawPage()->add(xShape);
}
- break;
- case RTF_FTNSEP:
- m_aStates.top().nDestinationState = DESTINATION_FOOTNOTESEPARATOR;
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdn_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_FtnEdn_separator)));
- break;
- default:
- {
- // Check if it's a math token.
- RTFMathSymbol aSymbol;
- aSymbol.eKeyword = nKeyword;
- if (RTFTokenizer::lookupMathKeyword(aSymbol))
- {
- m_aMathBuffer.appendOpeningTag(aSymbol.nToken);
- m_aStates.top().nDestinationState = aSymbol.eDestination;
- return 0;
- }
+ m_pSdrImport->pushParent(xGroupShape);
+ m_aStates.top().bCreatedShapeGroup = true;
+ }
+ m_aStates.top().nDestinationState = DESTINATION_SHAPEGROUP;
+ m_aStates.top().bInShapeGroup = true;
+ }
+ break;
+ case RTF_FTNSEP:
+ m_aStates.top().nDestinationState = DESTINATION_FOOTNOTESEPARATOR;
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdn_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_FtnEdn_separator)));
+ break;
+ default:
+ {
+ // Check if it's a math token.
+ RTFMathSymbol aSymbol;
+ aSymbol.eKeyword = nKeyword;
+ if (RTFTokenizer::lookupMathKeyword(aSymbol))
+ {
+ m_aMathBuffer.appendOpeningTag(aSymbol.nToken);
+ m_aStates.top().nDestinationState = aSymbol.eDestination;
+ return 0;
+ }
- SAL_INFO("writerfilter", "TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
- // Make sure we skip destinations (even without \*) till we don't handle them
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- aSkip.setParsed(false);
- }
- break;
+ SAL_INFO("writerfilter", "TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
+ // Make sure we skip destinations (even without \*) till we don't handle them
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ aSkip.setParsed(false);
+ }
+ break;
}
return 0;
@@ -1892,7 +1938,8 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
RTFSkipDestination aSkip(*this);
if (RTF_LINE == nKeyword)
- { // very special handling since text() will eat lone '\n'
+ {
+ // very special handling since text() will eat lone '\n'
singleChar('\n');
return 0;
}
@@ -1900,18 +1947,41 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
sal_uInt8 cCh = 0;
switch (nKeyword)
{
- case RTF_TAB: cCh = '\t'; break;
- case RTF_BACKSLASH: cCh = '\\'; break;
- case RTF_LBRACE: cCh = '{'; break;
- case RTF_RBRACE: cCh = '}'; break;
- case RTF_EMDASH: cCh = 151; break;
- case RTF_ENDASH: cCh = 150; break;
- case RTF_BULLET: cCh = 149; break;
- case RTF_LQUOTE: cCh = 145; break;
- case RTF_RQUOTE: cCh = 146; break;
- case RTF_LDBLQUOTE: cCh = 147; break;
- case RTF_RDBLQUOTE: cCh = 148; break;
- default: break;
+ case RTF_TAB:
+ cCh = '\t';
+ break;
+ case RTF_BACKSLASH:
+ cCh = '\\';
+ break;
+ case RTF_LBRACE:
+ cCh = '{';
+ break;
+ case RTF_RBRACE:
+ cCh = '}';
+ break;
+ case RTF_EMDASH:
+ cCh = 151;
+ break;
+ case RTF_ENDASH:
+ cCh = 150;
+ break;
+ case RTF_BULLET:
+ cCh = 149;
+ break;
+ case RTF_LQUOTE:
+ cCh = 145;
+ break;
+ case RTF_RQUOTE:
+ cCh = 146;
+ break;
+ case RTF_LDBLQUOTE:
+ cCh = 147;
+ break;
+ case RTF_RDBLQUOTE:
+ cCh = 148;
+ break;
+ default:
+ break;
}
if (cCh > 0)
{
@@ -1922,296 +1992,297 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
switch (nKeyword)
{
- case RTF_IGNORE:
- {
- m_bSkipUnknown = true;
- aSkip.setReset(false);
- return 0;
- }
- break;
- case RTF_PAR:
- {
- checkFirstRun();
- bool bNeedPap = m_bNeedPap;
- checkNeedPap();
- if (bNeedPap)
- runProps();
- if (!m_aStates.top().pCurrentBuffer)
- {
- if (m_aStates.top().nDestinationState == DESTINATION_FOOTNOTESEPARATOR)
- {
- static const sal_Unicode uCR = 0xd;
- Mapper().utext((const sal_uInt8*)&uCR, 1);
- }
- else
- parBreak();
- // Not in table? Reset max width.
- m_nCellxMax = 0;
- }
- else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
- {
- RTFValue::Pointer_t pValue;
- m_aStates.top().pCurrentBuffer->push_back(
- Buf_t(BUFFER_PAR, pValue));
- }
- // but don't emit properties yet, since they may change till the first text token arrives
- m_bNeedPap = true;
- if (!m_aStates.top().aFrame.inFrame())
- m_bNeedPar = false;
- m_bNeedFinalPar = false;
- }
- break;
- case RTF_SECT:
- {
- m_bHadSect = true;
- if (m_bIgnoreNextContSectBreak)
- m_bIgnoreNextContSectBreak = false;
- else
- {
- sectBreak();
- if (m_nResetBreakOnSectBreak != RTF_invalid)
- { // this should run on _second_ \sect after \page
- dispatchSymbol(m_nResetBreakOnSectBreak); // lazy reset
- m_nResetBreakOnSectBreak = RTF_invalid;
- m_bNeedSect = false; // dispatchSymbol set it
- }
- }
- }
- break;
- case RTF_NOBREAK:
- {
- OUString aStr(SVT_HARD_SPACE);
- text(aStr);
- }
- break;
- case RTF_NOBRKHYPH:
+ case RTF_IGNORE:
+ {
+ m_bSkipUnknown = true;
+ aSkip.setReset(false);
+ return 0;
+ }
+ break;
+ case RTF_PAR:
+ {
+ checkFirstRun();
+ bool bNeedPap = m_bNeedPap;
+ checkNeedPap();
+ if (bNeedPap)
+ runProps();
+ if (!m_aStates.top().pCurrentBuffer)
+ {
+ if (m_aStates.top().nDestinationState == DESTINATION_FOOTNOTESEPARATOR)
{
- OUString aStr(SVT_HARD_HYPHEN);
- text(aStr);
+ static const sal_Unicode uCR = 0xd;
+ Mapper().utext((const sal_uInt8*)&uCR, 1);
}
- break;
- case RTF_OPTHYPH:
+ else
+ parBreak();
+ // Not in table? Reset max width.
+ m_nCellxMax = 0;
+ }
+ else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
+ {
+ RTFValue::Pointer_t pValue;
+ m_aStates.top().pCurrentBuffer->push_back(
+ Buf_t(BUFFER_PAR, pValue));
+ }
+ // but don't emit properties yet, since they may change till the first text token arrives
+ m_bNeedPap = true;
+ if (!m_aStates.top().aFrame.inFrame())
+ m_bNeedPar = false;
+ m_bNeedFinalPar = false;
+ }
+ break;
+ case RTF_SECT:
+ {
+ m_bHadSect = true;
+ if (m_bIgnoreNextContSectBreak)
+ m_bIgnoreNextContSectBreak = false;
+ else
+ {
+ sectBreak();
+ if (m_nResetBreakOnSectBreak != RTF_invalid)
{
- OUString aStr(SVT_SOFT_HYPHEN);
- text(aStr);
+ // this should run on _second_ \sect after \page
+ dispatchSymbol(m_nResetBreakOnSectBreak); // lazy reset
+ m_nResetBreakOnSectBreak = RTF_invalid;
+ m_bNeedSect = false; // dispatchSymbol set it
}
- break;
- case RTF_HEXCHAR:
- m_aStates.top().nInternalState = INTERNAL_HEX;
- break;
- case RTF_CELL:
- case RTF_NESTCELL:
- {
- checkFirstRun();
- if (m_bNeedPap)
- {
- // There were no runs in the cell, so we need to send paragraph and character properties here.
- RTFValue::Pointer_t pPValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms));
- m_aTableBufferStack.back().push_back(
- Buf_t(BUFFER_PROPS, pPValue));
- RTFValue::Pointer_t pCValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
- m_aTableBufferStack.back().push_back(
- Buf_t(BUFFER_PROPS, pCValue));
- }
+ }
+ }
+ break;
+ case RTF_NOBREAK:
+ {
+ OUString aStr(SVT_HARD_SPACE);
+ text(aStr);
+ }
+ break;
+ case RTF_NOBRKHYPH:
+ {
+ OUString aStr(SVT_HARD_HYPHEN);
+ text(aStr);
+ }
+ break;
+ case RTF_OPTHYPH:
+ {
+ OUString aStr(SVT_SOFT_HYPHEN);
+ text(aStr);
+ }
+ break;
+ case RTF_HEXCHAR:
+ m_aStates.top().nInternalState = INTERNAL_HEX;
+ break;
+ case RTF_CELL:
+ case RTF_NESTCELL:
+ {
+ checkFirstRun();
+ if (m_bNeedPap)
+ {
+ // There were no runs in the cell, so we need to send paragraph and character properties here.
+ RTFValue::Pointer_t pPValue(new RTFValue(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms));
+ m_aTableBufferStack.back().push_back(
+ Buf_t(BUFFER_PROPS, pPValue));
+ RTFValue::Pointer_t pCValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
+ m_aTableBufferStack.back().push_back(
+ Buf_t(BUFFER_PROPS, pCValue));
+ }
- RTFValue::Pointer_t pValue;
- m_aTableBufferStack.back().push_back(
- Buf_t(BUFFER_CELLEND, pValue));
- m_bNeedPap = true;
- }
- break;
- case RTF_NESTROW:
+ RTFValue::Pointer_t pValue;
+ m_aTableBufferStack.back().push_back(
+ Buf_t(BUFFER_CELLEND, pValue));
+ m_bNeedPap = true;
+ }
+ break;
+ case RTF_NESTROW:
+ {
+ boost::shared_ptr<TableRowBuffer> const pBuffer(
+ new TableRowBuffer(
+ m_aTableBufferStack.back(),
+ m_aNestedTableCellsSprms,
+ m_aNestedTableCellsAttributes,
+ m_nNestedCells));
+ prepareProperties(m_aStates.top(),
+ pBuffer->pParaProperties,
+ pBuffer->pFrameProperties,
+ pBuffer->pRowProperties,
+ m_nNestedCells, m_nNestedCurrentCellX);
+
+ assert(m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back());
+ if (m_aTableBufferStack.size() == 1)
+ {
+ throw io::WrongFormatException(
+ "mismatch between \\itap and number of \\nestrow", 0);
+ }
+ // note: there may be several states pointing to table buffer!
+ for (size_t i = 0; i < m_aStates.size(); ++i)
+ {
+ if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back())
{
- boost::shared_ptr<TableRowBuffer> const pBuffer(
- new TableRowBuffer(
- m_aTableBufferStack.back(),
- m_aNestedTableCellsSprms,
- m_aNestedTableCellsAttributes,
- m_nNestedCells));
- prepareProperties(m_aStates.top(),
- pBuffer->pParaProperties,
- pBuffer->pFrameProperties,
- pBuffer->pRowProperties,
- m_nNestedCells, m_nNestedCurrentCellX);
-
- assert(m_aStates.top().pCurrentBuffer == &m_aTableBufferStack.back());
- if (m_aTableBufferStack.size() == 1)
- {
- throw io::WrongFormatException(
- "mismatch between \\itap and number of \\nestrow", 0);
- }
- // note: there may be several states pointing to table buffer!
- for (size_t i = 0; i < m_aStates.size(); ++i)
- {
- if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back())
- {
- m_aStates[i].pCurrentBuffer =
- &m_aTableBufferStack[m_aTableBufferStack.size()-2];
- }
- }
- m_aTableBufferStack.pop_back();
- m_aTableBufferStack.back().push_back(
- Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer));
-
- m_aNestedTableCellsSprms.clear();
- m_aNestedTableCellsAttributes.clear();
- m_nNestedCells = 0;
- m_bNeedPap = true;
+ m_aStates[i].pCurrentBuffer =
+ &m_aTableBufferStack[m_aTableBufferStack.size()-2];
}
- break;
- case RTF_ROW:
- {
- bool bRestored = false;
- // Ending a row, but no cells defined?
- // See if there was an invalid table row reset, so we can restore cell infos to help invalid documents.
- if (!m_nTopLevelCurrentCellX && m_nBackupTopLevelCurrentCellX)
- {
- restoreTableRowProperties();
- bRestored = true;
- }
+ }
+ m_aTableBufferStack.pop_back();
+ m_aTableBufferStack.back().push_back(
+ Buf_t(BUFFER_NESTROW, RTFValue::Pointer_t(), pBuffer));
- // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic WW8TabDesc::CalcDefaults(): add a fake cell.
- const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames.
- if ((m_nCellxMax - m_nTopLevelCurrentCellX) >= MINLAY)
- dispatchValue(RTF_CELLX, m_nCellxMax);
+ m_aNestedTableCellsSprms.clear();
+ m_aNestedTableCellsAttributes.clear();
+ m_nNestedCells = 0;
+ m_bNeedPap = true;
+ }
+ break;
+ case RTF_ROW:
+ {
+ bool bRestored = false;
+ // Ending a row, but no cells defined?
+ // See if there was an invalid table row reset, so we can restore cell infos to help invalid documents.
+ if (!m_nTopLevelCurrentCellX && m_nBackupTopLevelCurrentCellX)
+ {
+ restoreTableRowProperties();
+ bRestored = true;
+ }
- if (m_nTopLevelCells)
- {
- // Make a backup before we start popping elements
- m_aTableInheritingCellsSprms = m_aTopLevelTableCellsSprms;
- m_aTableInheritingCellsAttributes = m_aTopLevelTableCellsAttributes;
- m_nInheritingCells = m_nTopLevelCells;
- }
- else
- {
- // No table definition? Then inherit from the previous row
- m_aTopLevelTableCellsSprms = m_aTableInheritingCellsSprms;
- m_aTopLevelTableCellsAttributes = m_aTableInheritingCellsAttributes;
- m_nTopLevelCells = m_nInheritingCells;
- }
+ // If the right edge of the last cell (row width) is smaller than the width of some other row, mimic WW8TabDesc::CalcDefaults(): add a fake cell.
+ const int MINLAY = 23; // sw/inc/swtypes.hxx, minimal possible size of frames.
+ if ((m_nCellxMax - m_nTopLevelCurrentCellX) >= MINLAY)
+ dispatchValue(RTF_CELLX, m_nCellxMax);
- while (m_aTableBufferStack.size() > 1)
- {
- SAL_WARN("writerfilter.rtf", "dropping extra table buffer");
- // note: there may be several states pointing to table buffer!
- for (size_t i = 0; i < m_aStates.size(); ++i)
- {
- if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back())
- {
- m_aStates[i].pCurrentBuffer =
- &m_aTableBufferStack.front();
- }
- }
- m_aTableBufferStack.pop_back();
- }
+ if (m_nTopLevelCells)
+ {
+ // Make a backup before we start popping elements
+ m_aTableInheritingCellsSprms = m_aTopLevelTableCellsSprms;
+ m_aTableInheritingCellsAttributes = m_aTopLevelTableCellsAttributes;
+ m_nInheritingCells = m_nTopLevelCells;
+ }
+ else
+ {
+ // No table definition? Then inherit from the previous row
+ m_aTopLevelTableCellsSprms = m_aTableInheritingCellsSprms;
+ m_aTopLevelTableCellsAttributes = m_aTableInheritingCellsAttributes;
+ m_nTopLevelCells = m_nInheritingCells;
+ }
- replayRowBuffer(m_aTableBufferStack.back(),
- m_aTopLevelTableCellsSprms, m_aTopLevelTableCellsAttributes,
- m_nTopLevelCells);
-
- m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
- m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
-
- writerfilter::Reference<Properties>::Pointer_t paraProperties;
- writerfilter::Reference<Properties>::Pointer_t frameProperties;
- writerfilter::Reference<Properties>::Pointer_t rowProperties;
- prepareProperties(m_aStates.top(),
- paraProperties, frameProperties, rowProperties,
- m_nTopLevelCells, m_nTopLevelCurrentCellX);
- sendProperties(paraProperties, frameProperties, rowProperties);
-
- m_bNeedPap = true;
- m_bNeedFinalPar = true;
- m_aTableBufferStack.back().clear();
- m_nTopLevelCells = 0;
-
- if (bRestored)
- // We restored cell definitions, clear these now.
- // This is necessary, as later cell definitions want to overwrite the restored ones.
- resetTableRowProperties();
- }
- break;
- case RTF_COLUMN:
- {
- bool bColumns = false; // If we have multiple columns
- RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols);
- if (pCols.get())
- {
- RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num);
- if (pNum.get() && pNum->getInt() > 1)
- bColumns = true;
- }
- if (bColumns)
- {
- sal_uInt8 sBreak[] = { 0xe };
- Mapper().startCharacterGroup();
- Mapper().text(sBreak, 1);
- Mapper().endCharacterGroup();
- }
- else
- dispatchSymbol(RTF_PAGE);
- }
- break;
- case RTF_CHFTN:
- // Nothing to do, dmapper assumes this is the default.
- break;
- case RTF_PAGE:
+ while (m_aTableBufferStack.size() > 1)
+ {
+ SAL_WARN("writerfilter.rtf", "dropping extra table buffer");
+ // note: there may be several states pointing to table buffer!
+ for (size_t i = 0; i < m_aStates.size(); ++i)
{
- // If we're inside a continuous section, we should send a section break, not a page one.
- RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type);
- // Unless we're on a title page.
- RTFValue::Pointer_t pTitlePg = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg);
- if (((pBreak.get() && !pBreak->getInt())
- || m_nResetBreakOnSectBreak == RTF_SBKNONE)
- && !(pTitlePg.get() && pTitlePg->getInt()))
- {
- if (m_bWasInFrame)
- {
- dispatchSymbol(RTF_PAR);
- m_bWasInFrame = false;
- }
- sectBreak();
- // note: this will not affect the following section break
- // but the one just pushed
- dispatchFlag(RTF_SBKPAGE);
- if (m_bNeedPar)
- dispatchSymbol(RTF_PAR);
- m_bIgnoreNextContSectBreak = true;
- // arrange to clean up the syntetic RTF_SBKPAGE
- m_nResetBreakOnSectBreak = RTF_SBKNONE;
- }
- else
+ if (m_aStates[i].pCurrentBuffer == &m_aTableBufferStack.back())
{
- checkNeedPap();
- sal_uInt8 sBreak[] = { 0xc };
- Mapper().text(sBreak, 1);
- if (!m_bNeedPap)
- parBreak();
- m_bNeedCr = true;
+ m_aStates[i].pCurrentBuffer =
+ &m_aTableBufferStack.front();
}
}
- break;
- case RTF_CHPGN:
- {
- OUString aStr("PAGE");
- singleChar(0x13);
- text(aStr);
- singleChar(0x14, true);
- singleChar(0x15);
- }
- break;
- case RTF_CHFTNSEP:
- {
- static const sal_Unicode uFtnEdnSep = 0x3;
- Mapper().utext((const sal_uInt8*)&uFtnEdnSep, 1);
- }
- break;
- default:
+ m_aTableBufferStack.pop_back();
+ }
+
+ replayRowBuffer(m_aTableBufferStack.back(),
+ m_aTopLevelTableCellsSprms, m_aTopLevelTableCellsAttributes,
+ m_nTopLevelCells);
+
+ m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
+ m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
+
+ writerfilter::Reference<Properties>::Pointer_t paraProperties;
+ writerfilter::Reference<Properties>::Pointer_t frameProperties;
+ writerfilter::Reference<Properties>::Pointer_t rowProperties;
+ prepareProperties(m_aStates.top(),
+ paraProperties, frameProperties, rowProperties,
+ m_nTopLevelCells, m_nTopLevelCurrentCellX);
+ sendProperties(paraProperties, frameProperties, rowProperties);
+
+ m_bNeedPap = true;
+ m_bNeedFinalPar = true;
+ m_aTableBufferStack.back().clear();
+ m_nTopLevelCells = 0;
+
+ if (bRestored)
+ // We restored cell definitions, clear these now.
+ // This is necessary, as later cell definitions want to overwrite the restored ones.
+ resetTableRowProperties();
+ }
+ break;
+ case RTF_COLUMN:
+ {
+ bool bColumns = false; // If we have multiple columns
+ RTFValue::Pointer_t pCols = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_cols);
+ if (pCols.get())
+ {
+ RTFValue::Pointer_t pNum = pCols->getAttributes().find(NS_ooxml::LN_CT_Columns_num);
+ if (pNum.get() && pNum->getInt() > 1)
+ bColumns = true;
+ }
+ if (bColumns)
+ {
+ sal_uInt8 sBreak[] = { 0xe };
+ Mapper().startCharacterGroup();
+ Mapper().text(sBreak, 1);
+ Mapper().endCharacterGroup();
+ }
+ else
+ dispatchSymbol(RTF_PAGE);
+ }
+ break;
+ case RTF_CHFTN:
+ // Nothing to do, dmapper assumes this is the default.
+ break;
+ case RTF_PAGE:
+ {
+ // If we're inside a continuous section, we should send a section break, not a page one.
+ RTFValue::Pointer_t pBreak = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_type);
+ // Unless we're on a title page.
+ RTFValue::Pointer_t pTitlePg = m_aStates.top().aSectionSprms.find(NS_ooxml::LN_EG_SectPrContents_titlePg);
+ if (((pBreak.get() && !pBreak->getInt())
+ || m_nResetBreakOnSectBreak == RTF_SBKNONE)
+ && !(pTitlePg.get() && pTitlePg->getInt()))
+ {
+ if (m_bWasInFrame)
{
- SAL_INFO("writerfilter", "TODO handle symbol '" << lcl_RtfToString(nKeyword) << "'");
- aSkip.setParsed(false);
+ dispatchSymbol(RTF_PAR);
+ m_bWasInFrame = false;
}
- break;
+ sectBreak();
+ // note: this will not affect the following section break
+ // but the one just pushed
+ dispatchFlag(RTF_SBKPAGE);
+ if (m_bNeedPar)
+ dispatchSymbol(RTF_PAR);
+ m_bIgnoreNextContSectBreak = true;
+ // arrange to clean up the syntetic RTF_SBKPAGE
+ m_nResetBreakOnSectBreak = RTF_SBKNONE;
+ }
+ else
+ {
+ checkNeedPap();
+ sal_uInt8 sBreak[] = { 0xc };
+ Mapper().text(sBreak, 1);
+ if (!m_bNeedPap)
+ parBreak();
+ m_bNeedCr = true;
+ }
+ }
+ break;
+ case RTF_CHPGN:
+ {
+ OUString aStr("PAGE");
+ singleChar(0x13);
+ text(aStr);
+ singleChar(0x14, true);
+ singleChar(0x15);
+ }
+ break;
+ case RTF_CHFTNSEP:
+ {
+ static const sal_Unicode uFtnEdnSep = 0x3;
+ Mapper().utext((const sal_uInt8*)&uFtnEdnSep, 1);
+ }
+ break;
+ default:
+ {
+ SAL_INFO("writerfilter", "TODO handle symbol '" << lcl_RtfToString(nKeyword) << "'");
+ aSkip.setParsed(false);
+ }
+ break;
}
return 0;
}
@@ -2266,9 +2337,14 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Map all underline flags to a single sprm.
switch (nKeyword)
{
- case RTF_ULD: nSprm = 4; break;
- case RTF_ULW: nSprm = 2; break;
- default: break;
+ case RTF_ULD:
+ nSprm = 4;
+ break;
+ case RTF_ULW:
+ nSprm = 2;
+ break;
+ default:
+ break;
}
if (nSprm >= 0)
{
@@ -2280,12 +2356,23 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Indentation
switch (nKeyword)
{
- case RTF_QC: nParam = 1; break;
- case RTF_QJ: nParam = 3; break;
- case RTF_QL: nParam = 0; break;
- case RTF_QR: nParam = 2; break;
- case RTF_QD: nParam = 4; break;
- default: break;
+ case RTF_QC:
+ nParam = 1;
+ break;
+ case RTF_QJ:
+ nParam = 3;
+ break;
+ case RTF_QL:
+ nParam = 0;
+ break;
+ case RTF_QR:
+ nParam = 2;
+ break;
+ case RTF_QD:
+ nParam = 4;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2298,13 +2385,24 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Font Alignment
switch (nKeyword)
{
- case RTF_FAFIXED:
- case RTF_FAAUTO: nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_auto; break;
- case RTF_FAHANG: nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_top; break;
- case RTF_FACENTER: nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_center; break;
- case RTF_FAROMAN: nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_baseline; break;
- case RTF_FAVAR: nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_bottom; break;
- default: break;
+ case RTF_FAFIXED:
+ case RTF_FAAUTO:
+ nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_auto;
+ break;
+ case RTF_FAHANG:
+ nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_top;
+ break;
+ case RTF_FACENTER:
+ nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_center;
+ break;
+ case RTF_FAROMAN:
+ nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_baseline;
+ break;
+ case RTF_FAVAR:
+ nParam = NS_ooxml::LN_Value_wordprocessingml_ST_TextAlignment_bottom;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2316,10 +2414,17 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Tab kind.
switch (nKeyword)
{
- case RTF_TQR: nParam = 2; break;
- case RTF_TQC: nParam = 1; break;
- case RTF_TQDEC: nParam = 3; break;
- default: break;
+ case RTF_TQR:
+ nParam = 2;
+ break;
+ case RTF_TQC:
+ nParam = 1;
+ break;
+ case RTF_TQDEC:
+ nParam = 3;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2331,13 +2436,26 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Tab lead.
switch (nKeyword)
{
- case RTF_TLDOT: nParam = 1; break;
- case RTF_TLMDOT: nParam = NS_ooxml::LN_Value_ST_TabTlc_middleDot; break;
- case RTF_TLHYPH: nParam = 2; break;
- case RTF_TLUL: nParam = 3; break;
- case RTF_TLTH: nParam = 2; break; // thick line is not supported by dmapper, this is just a hack
- case RTF_TLEQ: nParam = 0; break; // equal sign isn't, either
- default: break;
+ case RTF_TLDOT:
+ nParam = 1;
+ break;
+ case RTF_TLMDOT:
+ nParam = NS_ooxml::LN_Value_ST_TabTlc_middleDot;
+ break;
+ case RTF_TLHYPH:
+ nParam = 2;
+ break;
+ case RTF_TLUL:
+ nParam = 3;
+ break;
+ case RTF_TLTH:
+ nParam = 2;
+ break; // thick line is not supported by dmapper, this is just a hack
+ case RTF_TLEQ:
+ nParam = 0;
+ break; // equal sign isn't, either
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2352,23 +2470,56 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{
// brdrhair and brdrs are the same, brdrw will make a difference
// map to values in ooxml/model.xml resource ST_Border
- case RTF_BRDRHAIR: nParam = 5; break;
- case RTF_BRDRS: nParam = 1; break;
- case RTF_BRDRDOT: nParam = 6; break;
- case RTF_BRDRDASH: nParam = 7; break;
- case RTF_BRDRDB: nParam = 3; break;
- case RTF_BRDRTNTHSG: nParam = 11; break;
- case RTF_BRDRTNTHMG: nParam = 14; break;
- case RTF_BRDRTNTHLG: nParam = 17; break;
- case RTF_BRDRTHTNSG: nParam = 12; break;
- case RTF_BRDRTHTNMG: nParam = 15; break;
- case RTF_BRDRTHTNLG: nParam = 18; break;
- case RTF_BRDREMBOSS: nParam = 24; break;
- case RTF_BRDRENGRAVE: nParam = 25; break;
- case RTF_BRDROUTSET: nParam = 18; break;
- case RTF_BRDRINSET: nParam = 17; break;
- case RTF_BRDRNONE: nParam = 0; break;
- default: break;
+ case RTF_BRDRHAIR:
+ nParam = 5;
+ break;
+ case RTF_BRDRS:
+ nParam = 1;
+ break;
+ case RTF_BRDRDOT:
+ nParam = 6;
+ break;
+ case RTF_BRDRDASH:
+ nParam = 7;
+ break;
+ case RTF_BRDRDB:
+ nParam = 3;
+ break;
+ case RTF_BRDRTNTHSG:
+ nParam = 11;
+ break;
+ case RTF_BRDRTNTHMG:
+ nParam = 14;
+ break;
+ case RTF_BRDRTNTHLG:
+ nParam = 17;
+ break;
+ case RTF_BRDRTHTNSG:
+ nParam = 12;
+ break;
+ case RTF_BRDRTHTNMG:
+ nParam = 15;
+ break;
+ case RTF_BRDRTHTNLG:
+ nParam = 18;
+ break;
+ case RTF_BRDREMBOSS:
+ nParam = 24;
+ break;
+ case RTF_BRDRENGRAVE:
+ nParam = 25;
+ break;
+ case RTF_BRDROUTSET:
+ nParam = 18;
+ break;
+ case RTF_BRDRINSET:
+ nParam = 17;
+ break;
+ case RTF_BRDRNONE:
+ nParam = 0;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2381,12 +2532,23 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Section breaks
switch (nKeyword)
{
- case RTF_SBKNONE: nParam = 0; break;
- case RTF_SBKCOL: nParam = 1; break;
- case RTF_SBKPAGE: nParam = 2; break;
- case RTF_SBKEVEN: nParam = 3; break;
- case RTF_SBKODD: nParam = 4; break;
- default: break;
+ case RTF_SBKNONE:
+ nParam = 0;
+ break;
+ case RTF_SBKCOL:
+ nParam = 1;
+ break;
+ case RTF_SBKPAGE:
+ nParam = 2;
+ break;
+ case RTF_SBKEVEN:
+ nParam = 3;
+ break;
+ case RTF_SBKODD:
+ nParam = 4;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2402,13 +2564,26 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Footnote numbering
switch (nKeyword)
{
- case RTF_FTNNAR: nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; break;
- case RTF_FTNNALC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; break;
- case RTF_FTNNAUC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; break;
- case RTF_FTNNRLC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; break;
- case RTF_FTNNRUC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; break;
- case RTF_FTNNCHI: nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; break;
- default: break;
+ case RTF_FTNNAR:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal;
+ break;
+ case RTF_FTNNALC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter;
+ break;
+ case RTF_FTNNAUC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter;
+ break;
+ case RTF_FTNNRLC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman;
+ break;
+ case RTF_FTNNRUC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman;
+ break;
+ case RTF_FTNNCHI:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2420,10 +2595,17 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Footnote restart type
switch (nKeyword)
{
- case RTF_FTNRSTPG: nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachPage; break;
- case RTF_FTNRESTART: nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachSect; break;
- case RTF_FTNRSTCONT: nParam = NS_ooxml::LN_Value_ST_RestartNumber_continuous; break;
- default: break;
+ case RTF_FTNRSTPG:
+ nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachPage;
+ break;
+ case RTF_FTNRESTART:
+ nParam = NS_ooxml::LN_Value_ST_RestartNumber_eachSect;
+ break;
+ case RTF_FTNRSTCONT:
+ nParam = NS_ooxml::LN_Value_ST_RestartNumber_continuous;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2435,13 +2617,26 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Endnote numbering
switch (nKeyword)
{
- case RTF_AFTNNAR: nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal; break;
- case RTF_AFTNNALC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter; break;
- case RTF_AFTNNAUC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter; break;
- case RTF_AFTNNRLC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman; break;
- case RTF_AFTNNRUC: nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman; break;
- case RTF_AFTNNCHI: nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago; break;
- default: break;
+ case RTF_AFTNNAR:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_decimal;
+ break;
+ case RTF_AFTNNALC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerLetter;
+ break;
+ case RTF_AFTNNAUC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperLetter;
+ break;
+ case RTF_AFTNNRLC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_lowerRoman;
+ break;
+ case RTF_AFTNNRUC:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_upperRoman;
+ break;
+ case RTF_AFTNNCHI:
+ nParam = NS_ooxml::LN_Value_ST_NumberFormat_chicago;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2453,12 +2648,23 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Cell Text Flow
switch (nKeyword)
{
- case RTF_CLTXLRTB: nParam = 0; break;
- case RTF_CLTXTBRL: nParam = 1; break;
- case RTF_CLTXBTLR: nParam = 3; break;
- case RTF_CLTXLRTBV: nParam = 4; break;
- case RTF_CLTXTBRLV: nParam = 5; break;
- default: break;
+ case RTF_CLTXLRTB:
+ nParam = 0;
+ break;
+ case RTF_CLTXTBRL:
+ nParam = 1;
+ break;
+ case RTF_CLTXBTLR:
+ nParam = 3;
+ break;
+ case RTF_CLTXLRTBV:
+ nParam = 4;
+ break;
+ case RTF_CLTXTBRLV:
+ nParam = 5;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2469,25 +2675,25 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
// Trivial paragraph flags
switch (nKeyword)
{
- case RTF_KEEP:
- if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back())
- nParam = NS_ooxml::LN_CT_PPrBase_keepLines;
- break;
- case RTF_KEEPN:
- if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back())
- nParam = NS_ooxml::LN_CT_PPrBase_keepNext;
- break;
- case RTF_INTBL:
- {
- m_aStates.top().pCurrentBuffer = &m_aTableBufferStack.back();
- nParam = NS_ooxml::LN_inTbl;
- }
- break;
- case RTF_PAGEBB:
- nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore;
- break;
- default:
- break;
+ case RTF_KEEP:
+ if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back())
+ nParam = NS_ooxml::LN_CT_PPrBase_keepLines;
+ break;
+ case RTF_KEEPN:
+ if (m_aStates.top().pCurrentBuffer != &m_aTableBufferStack.back())
+ nParam = NS_ooxml::LN_CT_PPrBase_keepNext;
+ break;
+ case RTF_INTBL:
+ {
+ m_aStates.top().pCurrentBuffer = &m_aTableBufferStack.back();
+ nParam = NS_ooxml::LN_inTbl;
+ }
+ break;
+ case RTF_PAGEBB:
+ nParam = NS_ooxml::LN_CT_PPrBase_pageBreakBefore;
+ break;
+ default:
+ break;
}
if (nParam >= 0)
{
@@ -2499,501 +2705,569 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
switch (nKeyword)
{
- case RTF_FNIL:
- case RTF_FROMAN:
- case RTF_FSWISS:
- case RTF_FMODERN:
- case RTF_FSCRIPT:
- case RTF_FDECOR:
- case RTF_FTECH:
- case RTF_FBIDI:
- // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper
- break;
- case RTF_ANSI:
- m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
- break;
- case RTF_PLAIN:
- {
- m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
- m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
- m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
- }
- break;
- case RTF_PARD:
- if (m_bHadPicture)
- dispatchSymbol(RTF_PAR);
- // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
- m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
- m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
- if (m_nTopLevelCells == 0 && m_nNestedCells == 0)
- {
- // Reset that we're in a table.
- m_aStates.top().pCurrentBuffer = 0;
- }
- else
- {
- // We are still in a table.
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, RTFValue::Pointer_t(new RTFValue(1)));
- }
- m_aStates.top().resetFrame();
+ case RTF_FNIL:
+ case RTF_FROMAN:
+ case RTF_FSWISS:
+ case RTF_FMODERN:
+ case RTF_FSCRIPT:
+ case RTF_FDECOR:
+ case RTF_FTECH:
+ case RTF_FBIDI:
+ // TODO ooxml:CT_Font_family seems to be ignored by the domain mapper
+ break;
+ case RTF_ANSI:
+ m_aStates.top().nCurrentEncoding = RTL_TEXTENCODING_MS_1252;
+ break;
+ case RTF_PLAIN:
+ {
+ m_aStates.top().aCharacterSprms = getDefaultState().aCharacterSprms;
+ m_aStates.top().nCurrentEncoding = getEncoding(getFontIndex(m_nDefaultFontIndex));
+ m_aStates.top().aCharacterAttributes = getDefaultState().aCharacterAttributes;
+ }
+ break;
+ case RTF_PARD:
+ if (m_bHadPicture)
+ dispatchSymbol(RTF_PAR);
+ // \pard is allowed between \cell and \row, but in that case it should not reset the fact that we're inside a table.
+ m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
+ m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
+ if (m_nTopLevelCells == 0 && m_nNestedCells == 0)
+ {
+ // Reset that we're in a table.
+ m_aStates.top().pCurrentBuffer = 0;
+ }
+ else
+ {
+ // We are still in a table.
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_inTbl, RTFValue::Pointer_t(new RTFValue(1)));
+ }
+ m_aStates.top().resetFrame();
- // Reset currently selected paragraph style as well.
- m_aStates.top().nCurrentStyleIndex = -1;
- break;
- case RTF_SECTD:
- {
- m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;
- m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes;
- }
- break;
- case RTF_TROWD:
- {
- // Back these up, in case later we still need this info.
- backupTableRowProperties();
- resetTableRowProperties();
- // In case the table definition is in the middle of the row
- // (invalid), make sure table definition is emitted.
- m_bNeedPap = true;
- }
- break;
- case RTF_WIDCTLPAR:
- case RTF_NOWIDCTLPAR:
- {
- RTFValue::Pointer_t pValue(new RTFValue(int(nKeyword == RTF_WIDCTLPAR)));
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue);
- }
- break;
- case RTF_BOX:
- {
- RTFSprms aAttributes;
- RTFValue::Pointer_t pValue(new RTFValue(aAttributes));
- for (int i = 0; i < 4; i++)
- m_aStates.top().aParagraphSprms.set(lcl_getParagraphBorder(i), pValue);
- m_aStates.top().nBorderState = BORDER_PARAGRAPH_BOX;
- }
- break;
- case RTF_LTRSECT:
- case RTF_RTLSECT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRSECT ? 0 : 1));
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, pValue);
- }
- break;
- case RTF_LTRPAR:
- case RTF_RTLPAR:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 1));
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_textDirection, pValue);
- }
- break;
- case RTF_LTRROW:
- case RTF_RTLROW:
- // dmapper does not support these.
- break;
- case RTF_LTRCH:
- // dmapper does not support this.
- break;
- case RTF_RTLCH:
- if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255)
- m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
- break;
- case RTF_ULNONE:
- {
- RTFValue::Pointer_t pValue(new RTFValue(0));
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue);
- }
- break;
- case RTF_NONSHPPICT:
- case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group
- m_aStates.top().nDestinationState = DESTINATION_SKIP;
- break;
+ // Reset currently selected paragraph style as well.
+ m_aStates.top().nCurrentStyleIndex = -1;
+ break;
+ case RTF_SECTD:
+ {
+ m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;
+ m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes;
+ }
+ break;
+ case RTF_TROWD:
+ {
+ // Back these up, in case later we still need this info.
+ backupTableRowProperties();
+ resetTableRowProperties();
+ // In case the table definition is in the middle of the row
+ // (invalid), make sure table definition is emitted.
+ m_bNeedPap = true;
+ }
+ break;
+ case RTF_WIDCTLPAR:
+ case RTF_NOWIDCTLPAR:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(int(nKeyword == RTF_WIDCTLPAR)));
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_widowControl, pValue);
+ }
+ break;
+ case RTF_BOX:
+ {
+ RTFSprms aAttributes;
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes));
+ for (int i = 0; i < 4; i++)
+ m_aStates.top().aParagraphSprms.set(lcl_getParagraphBorder(i), pValue);
+ m_aStates.top().nBorderState = BORDER_PARAGRAPH_BOX;
+ }
+ break;
+ case RTF_LTRSECT:
+ case RTF_RTLSECT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRSECT ? 0 : 1));
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_EG_SectPrContents_textDirection, pValue);
+ }
+ break;
+ case RTF_LTRPAR:
+ case RTF_RTLPAR:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LTRPAR ? 0 : 1));
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_textDirection, pValue);
+ }
+ break;
+ case RTF_LTRROW:
+ case RTF_RTLROW:
+ // dmapper does not support these.
+ break;
+ case RTF_LTRCH:
+ // dmapper does not support this.
+ break;
+ case RTF_RTLCH:
+ if (m_aDefaultState.nCurrentEncoding == RTL_TEXTENCODING_MS_1255)
+ m_aStates.top().nCurrentEncoding = m_aDefaultState.nCurrentEncoding;
+ break;
+ case RTF_ULNONE:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(0));
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_Underline_val, pValue);
+ }
+ break;
+ case RTF_NONSHPPICT:
+ case RTF_MMATHPICT: // Picture group used by readers not understanding \moMath group
+ m_aStates.top().nDestinationState = DESTINATION_SKIP;
+ break;
+ case RTF_CLBRDRT:
+ case RTF_CLBRDRL:
+ case RTF_CLBRDRB:
+ case RTF_CLBRDRR:
+ {
+ RTFSprms aAttributes;
+ RTFSprms aSprms;
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+ switch (nKeyword)
+ {
case RTF_CLBRDRT:
+ nParam = NS_ooxml::LN_CT_TcBorders_top;
+ break;
case RTF_CLBRDRL:
+ nParam = NS_ooxml::LN_CT_TcBorders_left;
+ break;
case RTF_CLBRDRB:
+ nParam = NS_ooxml::LN_CT_TcBorders_bottom;
+ break;
case RTF_CLBRDRR:
- {
- RTFSprms aAttributes;
- RTFSprms aSprms;
- RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
- switch (nKeyword)
- {
- case RTF_CLBRDRT: nParam = NS_ooxml::LN_CT_TcBorders_top; break;
- case RTF_CLBRDRL: nParam = NS_ooxml::LN_CT_TcBorders_left; break;
- case RTF_CLBRDRB: nParam = NS_ooxml::LN_CT_TcBorders_bottom; break;
- case RTF_CLBRDRR: nParam = NS_ooxml::LN_CT_TcBorders_right; break;
- default: break;
- }
- lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue);
- m_aStates.top().nBorderState = BORDER_CELL;
- }
+ nParam = NS_ooxml::LN_CT_TcBorders_right;
+ break;
+ default:
break;
+ }
+ lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcBorders, nParam, pValue);
+ m_aStates.top().nBorderState = BORDER_CELL;
+ }
+ break;
+ case RTF_PGBRDRT:
+ case RTF_PGBRDRL:
+ case RTF_PGBRDRB:
+ case RTF_PGBRDRR:
+ {
+ RTFSprms aAttributes;
+ RTFSprms aSprms;
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+ switch (nKeyword)
+ {
case RTF_PGBRDRT:
+ nParam = NS_ooxml::LN_CT_PageBorders_top;
+ break;
case RTF_PGBRDRL:
+ nParam = NS_ooxml::LN_CT_PageBorders_left;
+ break;
case RTF_PGBRDRB:
+ nParam = NS_ooxml::LN_CT_PageBorders_bottom;
+ break;
case RTF_PGBRDRR:
- {
- RTFSprms aAttributes;
- RTFSprms aSprms;
- RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
- switch (nKeyword)
- {
- case RTF_PGBRDRT: nParam = NS_ooxml::LN_CT_PageBorders_top; break;
- case RTF_PGBRDRL: nParam = NS_ooxml::LN_CT_PageBorders_left; break;
- case RTF_PGBRDRB: nParam = NS_ooxml::LN_CT_PageBorders_bottom; break;
- case RTF_PGBRDRR: nParam = NS_ooxml::LN_CT_PageBorders_right; break;
- default: break;
- }
- lcl_putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue);
- m_aStates.top().nBorderState = BORDER_PAGE;
- }
+ nParam = NS_ooxml::LN_CT_PageBorders_right;
+ break;
+ default:
break;
+ }
+ lcl_putNestedSprm(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgBorders, nParam, pValue);
+ 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:
- {
- 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;
- }
+ nParam = lcl_getParagraphBorder(3);
break;
- case RTF_CHBRDR:
- {
- RTFSprms aAttributes;
- RTFValue::Pointer_t pValue(new RTFValue(aAttributes));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue);
- m_aStates.top().nBorderState = BORDER_CHARACTER;
- }
+ default:
break;
- case RTF_CLMGF:
- {
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart));
- m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue);
}
- break;
- case RTF_CLMRG:
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_pBdr, nParam, pValue);
+ m_aStates.top().nBorderState = BORDER_PARAGRAPH;
+ }
+ break;
+ case RTF_CHBRDR:
+ {
+ RTFSprms aAttributes;
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_bdr, pValue);
+ m_aStates.top().nBorderState = BORDER_CHARACTER;
+ }
+ break;
+ case RTF_CLMGF:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart));
+ m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue);
+ }
+ break;
+ case RTF_CLMRG:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue));
+ m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue);
+ }
+ break;
+ case RTF_CLVMGF:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart));
+ m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue);
+ }
+ break;
+ case RTF_CLVMRG:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue));
+ m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue);
+ }
+ break;
+ case RTF_CLVERTALT:
+ case RTF_CLVERTALC:
+ case RTF_CLVERTALB:
+ {
+ switch (nKeyword)
{
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue));
- m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_hMerge, pValue);
- }
- break;
- case RTF_CLVMGF:
- {
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_restart));
- m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue);
- }
- break;
- case RTF_CLVMRG:
- {
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_Merge_continue));
- m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vMerge, pValue);
- }
- break;
case RTF_CLVERTALT:
- case RTF_CLVERTALC:
- case RTF_CLVERTALB:
- {
- switch (nKeyword)
- {
- case RTF_CLVERTALT: nParam = 0; break;
- case RTF_CLVERTALC: nParam = 1; break;
- case RTF_CLVERTALB: nParam = 3; break;
- default: break;
- }
- RTFValue::Pointer_t pValue(new RTFValue(nParam));
- m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue);
- }
- break;
- case RTF_TRKEEP:
- {
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_cantSplit, pValue);
- }
- break;
- case RTF_SECTUNLOCKED:
- {
- RTFValue::Pointer_t pValue(new RTFValue(int(!nParam)));
- m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue);
- }
+ nParam = 0;
break;
- case RTF_PGNDEC:
- case RTF_PGNUCRM:
- case RTF_PGNLCRM:
- case RTF_PGNUCLTR:
- case RTF_PGNLCLTR:
- case RTF_PGNBIDIA:
- case RTF_PGNBIDIB:
- // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
- break;
- case RTF_LOCH:
- // Noop, dmapper detects this automatically.
- break;
- case RTF_HICH:
- m_aStates.top().bIsCjk = true;
+ case RTF_CLVERTALC:
+ nParam = 1;
break;
- case RTF_DBCH:
- m_aStates.top().bIsCjk = false;
+ case RTF_CLVERTALB:
+ nParam = 3;
break;
- case RTF_TITLEPG:
- {
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue);
- }
+ default:
break;
- case RTF_SUPER:
- {
- if (!m_aStates.top().pCurrentBuffer)
- m_aStates.top().pCurrentBuffer = &m_aSuperBuffer;
+ }
+ RTFValue::Pointer_t pValue(new RTFValue(nParam));
+ m_aStates.top().aTableCellSprms.set(NS_ooxml::LN_CT_TcPrBase_vAlign, pValue);
+ }
+ break;
+ case RTF_TRKEEP:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TrPrBase_cantSplit, pValue);
+ }
+ break;
+ case RTF_SECTUNLOCKED:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(int(!nParam)));
+ m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_formProt, pValue);
+ }
+ break;
+ case RTF_PGNDEC:
+ case RTF_PGNUCRM:
+ case RTF_PGNLCRM:
+ case RTF_PGNUCLTR:
+ case RTF_PGNLCLTR:
+ case RTF_PGNBIDIA:
+ case RTF_PGNBIDIB:
+ // These should be mapped to NS_ooxml::LN_EG_SectPrContents_pgNumType, but dmapper has no API for that at the moment.
+ break;
+ case RTF_LOCH:
+ // Noop, dmapper detects this automatically.
+ break;
+ case RTF_HICH:
+ m_aStates.top().bIsCjk = true;
+ break;
+ case RTF_DBCH:
+ m_aStates.top().bIsCjk = false;
+ break;
+ case RTF_TITLEPG:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aStates.top().aSectionSprms.set(NS_ooxml::LN_EG_SectPrContents_titlePg, pValue);
+ }
+ break;
+ case RTF_SUPER:
+ {
+ if (!m_aStates.top().pCurrentBuffer)
+ m_aStates.top().pCurrentBuffer = &m_aSuperBuffer;
- RTFValue::Pointer_t pValue(new RTFValue("superscript"));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
- }
- break;
- case RTF_SUB:
- {
- RTFValue::Pointer_t pValue(new RTFValue("subscript"));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
- }
- break;
- case RTF_NOSUPERSUB:
- {
- if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer)
- {
- replayBuffer(m_aSuperBuffer, 0, 0);
- m_aStates.top().pCurrentBuffer = 0;
- }
- m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign);
- }
- break;
- case RTF_LINEPPAGE:
- case RTF_LINECONT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LINEPPAGE ? 0 : 2));
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_restart, pValue);
- }
- break;
- case RTF_AENDDOC:
- // Noop, this is the default in Writer.
- break;
- case RTF_AENDNOTES:
- // Noop, Writer does not support having endnotes at the end of section.
+ RTFValue::Pointer_t pValue(new RTFValue("superscript"));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
+ }
+ break;
+ case RTF_SUB:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue("subscript"));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
+ }
+ break;
+ case RTF_NOSUPERSUB:
+ {
+ if (m_aStates.top().pCurrentBuffer == &m_aSuperBuffer)
+ {
+ replayBuffer(m_aSuperBuffer, 0, 0);
+ m_aStates.top().pCurrentBuffer = 0;
+ }
+ m_aStates.top().aCharacterSprms.erase(NS_ooxml::LN_EG_RPrBase_vertAlign);
+ }
+ break;
+ case RTF_LINEPPAGE:
+ case RTF_LINECONT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_LINEPPAGE ? 0 : 2));
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_restart, pValue);
+ }
+ break;
+ case RTF_AENDDOC:
+ // Noop, this is the default in Writer.
+ break;
+ case RTF_AENDNOTES:
+ // Noop, Writer does not support having endnotes at the end of section.
+ break;
+ case RTF_AFTNRSTCONT:
+ // Noop, this is the default in Writer.
+ break;
+ case RTF_AFTNRESTART:
+ // Noop, Writer does not support restarting endnotes at each section.
+ break;
+ case RTF_FTNBJ:
+ // Noop, this is the default in Writer.
+ break;
+ case RTF_ENDDOC:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect));
+ lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
+ NS_ooxml::LN_EG_SectPrContents_footnotePr,
+ NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue);
+ }
+ break;
+ case RTF_NOLINE:
+ lcl_eraseNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance);
+ break;
+ case RTF_FORMSHADE:
+ // Noop, this is the default in Writer.
+ break;
+ case RTF_PNGBLIP:
+ m_aStates.top().aPicture.nStyle = BMPSTYLE_PNG;
+ break;
+ case RTF_JPEGBLIP:
+ m_aStates.top().aPicture.nStyle = BMPSTYLE_JPEG;
+ break;
+ case RTF_POSYT:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top);
+ break;
+ case RTF_POSYB:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom);
+ break;
+ case RTF_POSYC:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center);
+ break;
+ case RTF_POSYIN:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside);
+ break;
+ case RTF_POSYOUT:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside);
+ break;
+ case RTF_POSYIL:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline);
+ break;
+
+ case RTF_PHMRG:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin);
+ break;
+ case RTF_PVMRG:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin);
+ break;
+ case RTF_PHPG:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page);
+ break;
+ case RTF_PVPG:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page);
+ break;
+ case RTF_PHCOL:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text);
+ break;
+ case RTF_PVPARA:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text);
+ break;
+
+ case RTF_POSXC:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center);
+ break;
+ case RTF_POSXI:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside);
+ break;
+ case RTF_POSXO:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside);
+ break;
+ case RTF_POSXL:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left);
+ break;
+ case RTF_POSXR:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right);
+ break;
+
+ case RTF_DPLINE:
+ case RTF_DPRECT:
+ case RTF_DPELLIPSE:
+ case RTF_DPTXBX:
+ case RTF_DPPOLYLINE:
+ {
+ sal_Int32 nType = 0;
+ switch (nKeyword)
+ {
+ case RTF_DPLINE:
+ m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY);
break;
- case RTF_AFTNRSTCONT:
- // Noop, this is the default in Writer.
+ case RTF_DPPOLYLINE:
+ // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info.
+ m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"), uno::UNO_QUERY);
break;
- case RTF_AFTNRESTART:
- // Noop, Writer does not support restarting endnotes at each section.
+ case RTF_DPRECT:
+ m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY);
break;
- case RTF_FTNBJ:
- // Noop, this is the default in Writer.
+ case RTF_DPELLIPSE:
+ nType = ESCHER_ShpInst_Ellipse;
break;
- case RTF_ENDDOC:
+ case RTF_DPTXBX:
+ {
+ m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY);
+ std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(false);
+ for (size_t i = 0; i < aDefaults.size(); ++i)
{
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_ST_RestartNumber_eachSect));
- lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
- NS_ooxml::LN_EG_SectPrContents_footnotePr,
- NS_ooxml::LN_EG_FtnEdnNumProps_numRestart, pValue);
+ if (!lcl_findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, aDefaults[i].Name))
+ m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
}
- break;
- case RTF_NOLINE:
- lcl_eraseNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance);
- break;
- case RTF_FORMSHADE:
- // Noop, this is the default in Writer.
- break;
- case RTF_PNGBLIP:
- m_aStates.top().aPicture.nStyle = BMPSTYLE_PNG;
- break;
- case RTF_JPEGBLIP:
- m_aStates.top().aPicture.nStyle = BMPSTYLE_JPEG;
- break;
- case RTF_POSYT: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top); break;
- case RTF_POSYB: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom); break;
- case RTF_POSYC: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center); break;
- case RTF_POSYIN: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside); break;
- case RTF_POSYOUT: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside); break;
- case RTF_POSYIL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline); break;
-
- case RTF_PHMRG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin); break;
- case RTF_PVMRG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin); break;
- case RTF_PHPG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page); break;
- case RTF_PVPG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page); break;
- case RTF_PHCOL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text); break;
- case RTF_PVPARA: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text); break;
-
- case RTF_POSXC: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center); break;
- case RTF_POSXI: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside); break;
- case RTF_POSXO: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside); break;
- case RTF_POSXL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left); break;
- case RTF_POSXR: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right); break;
-
- case RTF_DPLINE:
- case RTF_DPRECT:
- case RTF_DPELLIPSE:
- case RTF_DPTXBX:
- case RTF_DPPOLYLINE:
- {
- sal_Int32 nType = 0;
- switch (nKeyword)
- {
- case RTF_DPLINE:
- m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.LineShape"), uno::UNO_QUERY);
- break;
- case RTF_DPPOLYLINE:
- // The reason this is not a simple CustomShape is that in the old syntax we have no ViewBox info.
- m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.PolyLineShape"), uno::UNO_QUERY);
- break;
- case RTF_DPRECT:
- m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.RectangleShape"), uno::UNO_QUERY);
- break;
- case RTF_DPELLIPSE:
- nType = ESCHER_ShpInst_Ellipse;
- break;
- case RTF_DPTXBX:
- {
- m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY);
- std::vector<beans::PropertyValue> aDefaults = m_pSdrImport->getTextFrameDefaults(false);
- for (size_t i = 0; i < aDefaults.size(); ++i)
- {
- if (!lcl_findPropertyName(m_aStates.top().aDrawingObject.aPendingProperties, aDefaults[i].Name))
- m_aStates.top().aDrawingObject.aPendingProperties.push_back(aDefaults[i]);
- }
- checkFirstRun();
- Mapper().startShape(m_aStates.top().aDrawingObject.xShape);
- m_aStates.top().aDrawingObject.bHadShapeText = true;
- }
- break;
- default:
- break;
- }
- if (nType)
- m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
- uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier( m_xDstDoc, uno::UNO_QUERY);
- if (xDrawSupplier.is())
- {
- uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY);
- if (xShapes.is() && nKeyword != RTF_DPTXBX)
- xShapes->add(m_aStates.top().aDrawingObject.xShape);
- }
- if (nType)
- {
- uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
- xDefaulter->createCustomShapeDefaults(OUString::number(nType));
- }
- m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
- std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties;
- for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i)
- m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(i->Name, i->Value);
- m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true);
- }
- break;
- case RTF_DOBXMARGIN:
- case RTF_DOBYMARGIN:
- {
- beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
- aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
- m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
- }
- break;
- case RTF_DOBXPAGE:
- case RTF_DOBYPAGE:
- {
- beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
- aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
- m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
- }
- break;
- case RTF_DOBYPARA:
- {
- beans::PropertyValue aPropertyValue;
- aPropertyValue.Name = "VertOrientRelation";
- aPropertyValue.Value <<= text::RelOrientation::FRAME;
- m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
- }
- break;
- case RTF_CONTEXTUALSPACE:
- {
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue);
- }
- break;
- case RTF_LINKSTYLES:
- {
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_linkStyles, pValue);
- }
- break;
- case RTF_PNLVLBODY:
- {
- RTFValue::Pointer_t pValue(new RTFValue(2));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pValue);
- }
- break;
- case RTF_PNDEC:
- {
- RTFValue::Pointer_t pValue(new RTFValue(0)); // decimal, same as \levelnfc0
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pValue);
- }
- break;
- case RTF_PNLVLBLT:
- {
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, RTFValue::Pointer_t(new RTFValue(1)));
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, RTFValue::Pointer_t(new RTFValue(23))); // bullets, same as \levelnfc23
- }
- break;
- case RTF_LANDSCAPE:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, RTFValue::Pointer_t(new RTFValue(1)));
- break;
- case RTF_FACINGP:
- m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, RTFValue::Pointer_t(new RTFValue(1)));
- break;
- case RTF_SHPBXPAGE:
- m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
- m_aStates.top().aShape.nHoriOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page;
- break;
- case RTF_SHPBYPAGE:
- m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
- m_aStates.top().aShape.nVertOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page;
- break;
- case RTF_DPLINEHOLLOW:
- m_aStates.top().aDrawingObject.nFLine = 0;
- break;
- case RTF_DPROUNDR:
- if (m_aStates.top().aDrawingObject.xPropertySet.is())
- // Seems this old syntax has no way to specify a custom radius, and this is the default
- m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", uno::makeAny(sal_Int32(83)));
- break;
- case RTF_NOWRAP:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_wrap, NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside);
- break;
- case RTF_MNOR:
- m_bMathNor = true;
- break;
- case RTF_REVISIONS:
- m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, RTFValue::Pointer_t(new RTFValue(1)));
- break;
- case RTF_BRDRSH:
- lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, RTFValue::Pointer_t(new RTFValue(1)));
- break;
+ checkFirstRun();
+ Mapper().startShape(m_aStates.top().aDrawingObject.xShape);
+ m_aStates.top().aDrawingObject.bHadShapeText = true;
+ }
+ break;
default:
- {
- SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
- aSkip.setParsed(false);
- }
- break;
+ break;
+ }
+ if (nType)
+ m_aStates.top().aDrawingObject.xShape.set(getModelFactory()->createInstance("com.sun.star.drawing.CustomShape"), uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPageSupplier> xDrawSupplier(m_xDstDoc, uno::UNO_QUERY);
+ if (xDrawSupplier.is())
+ {
+ uno::Reference<drawing::XShapes> xShapes(xDrawSupplier->getDrawPage(), uno::UNO_QUERY);
+ if (xShapes.is() && nKeyword != RTF_DPTXBX)
+ xShapes->add(m_aStates.top().aDrawingObject.xShape);
+ }
+ if (nType)
+ {
+ uno::Reference<drawing::XEnhancedCustomShapeDefaulter> xDefaulter(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
+ xDefaulter->createCustomShapeDefaults(OUString::number(nType));
+ }
+ m_aStates.top().aDrawingObject.xPropertySet.set(m_aStates.top().aDrawingObject.xShape, uno::UNO_QUERY);
+ std::vector<beans::PropertyValue>& rPendingProperties = m_aStates.top().aDrawingObject.aPendingProperties;
+ for (std::vector<beans::PropertyValue>::iterator i = rPendingProperties.begin(); i != rPendingProperties.end(); ++i)
+ m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue(i->Name, i->Value);
+ m_pSdrImport->resolveDhgt(m_aStates.top().aDrawingObject.xPropertySet, m_aStates.top().aDrawingObject.nDhgt, /*bOldStyle=*/true);
+ }
+ break;
+ case RTF_DOBXMARGIN:
+ case RTF_DOBYMARGIN:
+ {
+ beans::PropertyValue aPropertyValue;
+ aPropertyValue.Name = (nKeyword == RTF_DOBXMARGIN ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
+ aPropertyValue.Value <<= text::RelOrientation::PAGE_PRINT_AREA;
+ m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
+ }
+ break;
+ case RTF_DOBXPAGE:
+ case RTF_DOBYPAGE:
+ {
+ beans::PropertyValue aPropertyValue;
+ aPropertyValue.Name = (nKeyword == RTF_DOBXPAGE ? OUString("HoriOrientRelation") : OUString("VertOrientRelation"));
+ aPropertyValue.Value <<= text::RelOrientation::PAGE_FRAME;
+ m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
+ }
+ break;
+ case RTF_DOBYPARA:
+ {
+ beans::PropertyValue aPropertyValue;
+ aPropertyValue.Name = "VertOrientRelation";
+ aPropertyValue.Value <<= text::RelOrientation::FRAME;
+ m_aStates.top().aDrawingObject.aPendingProperties.push_back(aPropertyValue);
+ }
+ break;
+ case RTF_CONTEXTUALSPACE:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_contextualSpacing, pValue);
+ }
+ break;
+ case RTF_LINKSTYLES:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_linkStyles, pValue);
+ }
+ break;
+ case RTF_PNLVLBODY:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(2));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pValue);
+ }
+ break;
+ case RTF_PNDEC:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(0)); // decimal, same as \levelnfc0
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pValue);
+ }
+ break;
+ case RTF_PNLVLBLT:
+ {
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, RTFValue::Pointer_t(new RTFValue(1)));
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, RTFValue::Pointer_t(new RTFValue(23))); // bullets, same as \levelnfc23
+ }
+ break;
+ case RTF_LANDSCAPE:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_orient, RTFValue::Pointer_t(new RTFValue(1)));
+ break;
+ case RTF_FACINGP:
+ m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_evenAndOddHeaders, RTFValue::Pointer_t(new RTFValue(1)));
+ break;
+ case RTF_SHPBXPAGE:
+ m_aStates.top().aShape.nHoriOrientRelation = text::RelOrientation::PAGE_FRAME;
+ m_aStates.top().aShape.nHoriOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromH_page;
+ break;
+ case RTF_SHPBYPAGE:
+ m_aStates.top().aShape.nVertOrientRelation = text::RelOrientation::PAGE_FRAME;
+ m_aStates.top().aShape.nVertOrientRelationToken = NS_ooxml::LN_Value_wordprocessingDrawing_ST_RelFromV_page;
+ break;
+ case RTF_DPLINEHOLLOW:
+ m_aStates.top().aDrawingObject.nFLine = 0;
+ break;
+ case RTF_DPROUNDR:
+ if (m_aStates.top().aDrawingObject.xPropertySet.is())
+ // Seems this old syntax has no way to specify a custom radius, and this is the default
+ m_aStates.top().aDrawingObject.xPropertySet->setPropertyValue("CornerRadius", uno::makeAny(sal_Int32(83)));
+ break;
+ case RTF_NOWRAP:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_wrap, NS_ooxml::LN_Value_wordprocessingml_ST_Wrap_notBeside);
+ break;
+ case RTF_MNOR:
+ m_bMathNor = true;
+ break;
+ case RTF_REVISIONS:
+ m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_trackRevisions, RTFValue::Pointer_t(new RTFValue(1)));
+ break;
+ case RTF_BRDRSH:
+ lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_shadow, RTFValue::Pointer_t(new RTFValue(1)));
+ break;
+ default:
+ {
+ SAL_INFO("writerfilter", "TODO handle flag '" << lcl_RtfToString(nKeyword) << "'");
+ aSkip.setParsed(false);
+ }
+ break;
}
return 0;
}
@@ -3008,11 +3282,20 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Trivial table sprms.
switch (nKeyword)
{
- case RTF_LEVELJC: nSprm = NS_ooxml::LN_CT_Lvl_lvlJc; break;
- case RTF_LEVELNFC: nSprm = NS_ooxml::LN_CT_Lvl_numFmt; break;
- case RTF_LEVELSTARTAT: nSprm = NS_ooxml::LN_CT_Lvl_start; break;
- case RTF_LEVELPICTURE: nSprm = NS_ooxml::LN_CT_Lvl_lvlPicBulletId; break;
- default: break;
+ case RTF_LEVELJC:
+ nSprm = NS_ooxml::LN_CT_Lvl_lvlJc;
+ break;
+ case RTF_LEVELNFC:
+ nSprm = NS_ooxml::LN_CT_Lvl_numFmt;
+ break;
+ case RTF_LEVELSTARTAT:
+ nSprm = NS_ooxml::LN_CT_Lvl_start;
+ break;
+ case RTF_LEVELPICTURE:
+ nSprm = NS_ooxml::LN_CT_Lvl_lvlPicBulletId;
+ break;
+ default:
+ break;
}
if (nSprm > 0)
{
@@ -3022,13 +3305,26 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Trivial character sprms.
switch (nKeyword)
{
- case RTF_FS: nSprm = NS_ooxml::LN_EG_RPrBase_sz; break;
- case RTF_AFS: nSprm = NS_ooxml::LN_EG_RPrBase_szCs; break;
- case RTF_ANIMTEXT: nSprm = NS_ooxml::LN_EG_RPrBase_effect; break;
- case RTF_EXPNDTW: nSprm = NS_ooxml::LN_EG_RPrBase_spacing; break;
- case RTF_KERNING: nSprm = NS_ooxml::LN_EG_RPrBase_kern; break;
- case RTF_CHARSCALEX: nSprm = NS_ooxml::LN_EG_RPrBase_w; break;
- default: break;
+ case RTF_FS:
+ nSprm = NS_ooxml::LN_EG_RPrBase_sz;
+ break;
+ case RTF_AFS:
+ nSprm = NS_ooxml::LN_EG_RPrBase_szCs;
+ break;
+ case RTF_ANIMTEXT:
+ nSprm = NS_ooxml::LN_EG_RPrBase_effect;
+ break;
+ case RTF_EXPNDTW:
+ nSprm = NS_ooxml::LN_EG_RPrBase_spacing;
+ break;
+ case RTF_KERNING:
+ nSprm = NS_ooxml::LN_EG_RPrBase_kern;
+ break;
+ case RTF_CHARSCALEX:
+ nSprm = NS_ooxml::LN_EG_RPrBase_w;
+ break;
+ default:
+ break;
}
if (nSprm > 0)
{
@@ -3038,10 +3334,17 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Trivial character attributes.
switch (nKeyword)
{
- case RTF_LANG: nSprm = NS_ooxml::LN_CT_Language_val; break;
- case RTF_LANGFE: nSprm = NS_ooxml::LN_CT_Language_eastAsia; break;
- case RTF_ALANG: nSprm = NS_ooxml::LN_CT_Language_bidi; break;
- default: break;
+ case RTF_LANG:
+ nSprm = NS_ooxml::LN_CT_Language_val;
+ break;
+ case RTF_LANGFE:
+ nSprm = NS_ooxml::LN_CT_Language_eastAsia;
+ break;
+ case RTF_ALANG:
+ nSprm = NS_ooxml::LN_CT_Language_bidi;
+ break;
+ default:
+ break;
}
if (nSprm > 0)
{
@@ -3056,12 +3359,15 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Trivial paragraph sprms.
switch (nKeyword)
{
- case RTF_ITAP: nSprm = NS_ooxml::LN_tblDepth; break;
- case RTF_SBASEDON:
- nSprm = NS_ooxml::LN_CT_Style_basedOn;
- pIntValue.reset(new RTFValue(getStyleName(nParam)));
- break;
- default: break;
+ case RTF_ITAP:
+ nSprm = NS_ooxml::LN_tblDepth;
+ break;
+ case RTF_SBASEDON:
+ nSprm = NS_ooxml::LN_CT_Style_basedOn;
+ pIntValue.reset(new RTFValue(getStyleName(nParam)));
+ break;
+ default:
+ break;
}
if (nSprm > 0)
{
@@ -3082,38 +3388,38 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Info group.
switch (nKeyword)
{
- case RTF_YR:
- {
- m_aStates.top().nYear = nParam;
- nSprm = 1;
- }
- break;
- case RTF_MO:
- {
- m_aStates.top().nMonth = nParam;
- nSprm = 1;
- }
- break;
- case RTF_DY:
- {
- m_aStates.top().nDay = nParam;
- nSprm = 1;
- }
- break;
- case RTF_HR:
- {
- m_aStates.top().nHour = nParam;
- nSprm = 1;
- }
- break;
- case RTF_MIN:
- {
- m_aStates.top().nMinute = nParam;
- nSprm = 1;
- }
- break;
- default:
- break;
+ case RTF_YR:
+ {
+ m_aStates.top().nYear = nParam;
+ nSprm = 1;
+ }
+ break;
+ case RTF_MO:
+ {
+ m_aStates.top().nMonth = nParam;
+ nSprm = 1;
+ }
+ break;
+ case RTF_DY:
+ {
+ m_aStates.top().nDay = nParam;
+ nSprm = 1;
+ }
+ break;
+ case RTF_HR:
+ {
+ m_aStates.top().nHour = nParam;
+ nSprm = 1;
+ }
+ break;
+ case RTF_MIN:
+ {
+ m_aStates.top().nMinute = nParam;
+ nSprm = 1;
+ }
+ break;
+ default:
+ break;
}
if (nSprm > 0)
return 0;
@@ -3122,26 +3428,26 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
Id nId = 0;
switch (nKeyword)
{
- case RTF_ABSW:
- nId = NS_ooxml::LN_CT_FramePr_w;
- break;
- case RTF_ABSH:
- nId = NS_ooxml::LN_CT_FramePr_h;
- break;
- case RTF_POSX:
- {
- nId = NS_ooxml::LN_CT_FramePr_x;
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0);
- }
- break;
- case RTF_POSY:
- {
- nId = NS_ooxml::LN_CT_FramePr_y;
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0);
- }
- break;
- default:
- break;
+ case RTF_ABSW:
+ nId = NS_ooxml::LN_CT_FramePr_w;
+ break;
+ case RTF_ABSH:
+ nId = NS_ooxml::LN_CT_FramePr_h;
+ break;
+ case RTF_POSX:
+ {
+ nId = NS_ooxml::LN_CT_FramePr_x;
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0);
+ }
+ break;
+ case RTF_POSY:
+ {
+ nId = NS_ooxml::LN_CT_FramePr_y;
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0);
+ }
+ break;
+ default:
+ break;
}
if (nId > 0)
@@ -3157,867 +3463,960 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
// Then check for the more complex ones.
switch (nKeyword)
{
- case RTF_F:
- case RTF_AF:
- if (nKeyword == RTF_F)
- nSprm = NS_ooxml::LN_CT_Fonts_ascii;
- else
- nSprm = (m_aStates.top().bIsCjk ? NS_ooxml::LN_CT_Fonts_eastAsia : NS_ooxml::LN_CT_Fonts_cs);
- if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE || m_aStates.top().nDestinationState == DESTINATION_FONTENTRY)
- {
- m_aFontIndexes.push_back(nParam);
- m_nCurrentFontIndex = getFontIndex(nParam);
- }
- else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL)
- {
- RTFSprms aFontAttributes;
- aFontAttributes.set(nSprm, RTFValue::Pointer_t(new RTFValue(m_aFontNames[getFontIndex(nParam)])));
- // In the context of listlevels, \af seems to imply \f.
- if (nKeyword == RTF_AF)
- aFontAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, RTFValue::Pointer_t(new RTFValue(m_aFontNames[getFontIndex(nParam)])));
- RTFSprms aRunPropsSprms;
- aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(aFontAttributes)));
- // If there are multiple \f or \af tokens, only handle the first one.
- if (!m_aStates.top().aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr))
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
- }
- else
- {
- m_nCurrentFontIndex = getFontIndex(nParam);
- RTFValue::Pointer_t pValue(new RTFValue(getFontName(m_nCurrentFontIndex)));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, nSprm, pValue);
- m_aStates.top().nCurrentEncoding = getEncoding(m_nCurrentFontIndex);
- }
- break;
- case RTF_RED:
- m_aStates.top().aCurrentColor.nRed = nParam;
- break;
- case RTF_GREEN:
- m_aStates.top().aCurrentColor.nGreen = nParam;
- break;
- case RTF_BLUE:
- m_aStates.top().aCurrentColor.nBlue = nParam;
- break;
- case RTF_FCHARSET:
- {
- // we always send text to the domain mapper in OUString, so no
- // need to send encoding info
- int i;
- for (i = 0; i < nRTFEncodings; i++)
- {
- if (aRTFEncodings[i].charset == nParam)
- break;
- }
- if (i == nRTFEncodings)
- // not found
- return 0;
+ case RTF_F:
+ case RTF_AF:
+ if (nKeyword == RTF_F)
+ nSprm = NS_ooxml::LN_CT_Fonts_ascii;
+ else
+ nSprm = (m_aStates.top().bIsCjk ? NS_ooxml::LN_CT_Fonts_eastAsia : NS_ooxml::LN_CT_Fonts_cs);
+ if (m_aStates.top().nDestinationState == DESTINATION_FONTTABLE || m_aStates.top().nDestinationState == DESTINATION_FONTENTRY)
+ {
+ m_aFontIndexes.push_back(nParam);
+ m_nCurrentFontIndex = getFontIndex(nParam);
+ }
+ else if (m_aStates.top().nDestinationState == DESTINATION_LISTLEVEL)
+ {
+ RTFSprms aFontAttributes;
+ aFontAttributes.set(nSprm, RTFValue::Pointer_t(new RTFValue(m_aFontNames[getFontIndex(nParam)])));
+ // In the context of listlevels, \af seems to imply \f.
+ if (nKeyword == RTF_AF)
+ aFontAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, RTFValue::Pointer_t(new RTFValue(m_aFontNames[getFontIndex(nParam)])));
+ RTFSprms aRunPropsSprms;
+ aRunPropsSprms.set(NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(aFontAttributes)));
+ // If there are multiple \f or \af tokens, only handle the first one.
+ if (!m_aStates.top().aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr))
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_rPr, RTFValue::Pointer_t(new RTFValue(RTFSprms(), aRunPropsSprms)));
+ }
+ else
+ {
+ m_nCurrentFontIndex = getFontIndex(nParam);
+ RTFValue::Pointer_t pValue(new RTFValue(getFontName(m_nCurrentFontIndex)));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, nSprm, pValue);
+ m_aStates.top().nCurrentEncoding = getEncoding(m_nCurrentFontIndex);
+ }
+ break;
+ case RTF_RED:
+ m_aStates.top().aCurrentColor.nRed = nParam;
+ break;
+ case RTF_GREEN:
+ m_aStates.top().aCurrentColor.nGreen = nParam;
+ break;
+ case RTF_BLUE:
+ m_aStates.top().aCurrentColor.nBlue = nParam;
+ break;
+ case RTF_FCHARSET:
+ {
+ // we always send text to the domain mapper in OUString, so no
+ // need to send encoding info
+ int i;
+ for (i = 0; i < nRTFEncodings; i++)
+ {
+ if (aRTFEncodings[i].charset == nParam)
+ break;
+ }
+ if (i == nRTFEncodings)
+ // not found
+ return 0;
- m_nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
- }
- break;
- case RTF_ANSICPG:
- {
- m_aDefaultState.nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
- m_aStates.top().nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
- }
- break;
- case RTF_CPG:
- m_nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
- break;
- case RTF_CF:
- {
- RTFSprms aAttributes;
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue);
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color, RTFValue::Pointer_t(new RTFValue(aAttributes)));
- }
- break;
- case RTF_S:
- {
- m_aStates.top().nCurrentStyleIndex = nParam;
+ m_nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(aRTFEncodings[i].codepage);
+ }
+ break;
+ case RTF_ANSICPG:
+ {
+ m_aDefaultState.nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
+ m_aStates.top().nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
+ }
+ break;
+ case RTF_CPG:
+ m_nCurrentEncoding = rtl_getTextEncodingFromWindowsCodePage(nParam);
+ break;
+ case RTF_CF:
+ {
+ RTFSprms aAttributes;
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ aAttributes.set(NS_ooxml::LN_CT_Color_val, pValue);
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_color, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ }
+ break;
+ case RTF_S:
+ {
+ m_aStates.top().nCurrentStyleIndex = nParam;
- if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
- {
- m_nCurrentStyleIndex = nParam;
- RTFValue::Pointer_t pValue(new RTFValue(1));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // paragraph style
- }
- else
- {
- OUString aName = getStyleName(nParam);
- if (!aName.isEmpty())
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, RTFValue::Pointer_t(new RTFValue(aName)));
- }
- }
- break;
- case RTF_CS:
- if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
- {
- m_nCurrentStyleIndex = nParam;
- RTFValue::Pointer_t pValue(new RTFValue(2));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // character style
- }
- else
- {
- OUString aName = getStyleName(nParam);
- if (!aName.isEmpty())
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, RTFValue::Pointer_t(new RTFValue(aName)));
- }
- break;
- case RTF_DEFF:
- m_nDefaultFontIndex = nParam;
- break;
- case RTF_DEFLANG:
- case RTF_ADEFLANG:
- {
- LanguageTag aTag((LanguageType)nParam);
- RTFValue::Pointer_t pValue(new RTFValue(aTag.getBcp47()));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang : NS_ooxml::LN_CT_Language_bidi), nSprm, pValue);
- }
- break;
- case RTF_CHCBPAT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nParam ? getColorTable(nParam) : COL_AUTO));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
- }
- break;
- case RTF_CLCBPAT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- lcl_putNestedAttribute(m_aStates.top().aTableCellSprms,
- NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
- }
- break;
- case RTF_CBPAT:
- if (nParam)
- {
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
- }
- break;
- case RTF_ULC:
- {
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- m_aStates.top().aCharacterSprms.set(0x6877, pValue);
- }
- break;
- case RTF_HIGHLIGHT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue);
- }
- break;
- case RTF_UP:
- case RTF_DN:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nParam * (nKeyword == RTF_UP ? 1 : -1)));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_position, pValue);
- }
- break;
- case RTF_HORZVERT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(int(true)));
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue);
- if (nParam)
- // rotate fits to a single line
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue);
- }
- break;
- case RTF_EXPND:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nParam/5));
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_spacing, pValue);
- }
- break;
- case RTF_TWOINONE:
- {
- RTFValue::Pointer_t pValue(new RTFValue(int(true)));
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, pValue);
- if (nParam > 0)
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, pIntValue);
- }
- break;
- case RTF_SL:
- {
- // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'.
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast));
- if (nParam < 0)
- {
- pValue.reset(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact));
- pIntValue.reset(new RTFValue(-nParam));
- }
- m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue);
- m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue);
- }
- break;
- case RTF_SLMULT:
- if (nParam > 0)
- {
- RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto));
- m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue);
- }
- break;
- case RTF_BRDRW:
- {
- // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0
- if (nParam > 1)
- nParam = nParam * 2 / 5;
- RTFValue::Pointer_t pValue(new RTFValue(nParam));
- lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue);
- }
- break;
- case RTF_BRDRCF:
- {
- RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
- lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue);
- }
- break;
- case RTF_BRSP:
- {
- // dmapper expects it in points, we have it in twip
- RTFValue::Pointer_t pValue(new RTFValue(nParam / 20));
- lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_space, pValue);
- }
- break;
- case RTF_TX:
- {
- m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue);
- RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aTabAttributes));
- lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
- m_aStates.top().aTabAttributes.clear();
- }
- break;
- case RTF_ILVL:
- lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIntValue);
- break;
- case RTF_LISTTEMPLATEID:
- // This one is not referenced anywhere, so it's pointless to store it at the moment.
+ if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
+ {
+ m_nCurrentStyleIndex = nParam;
+ RTFValue::Pointer_t pValue(new RTFValue(1));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // paragraph style
+ }
+ else
+ {
+ OUString aName = getStyleName(nParam);
+ if (!aName.isEmpty())
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_pStyle, RTFValue::Pointer_t(new RTFValue(aName)));
+ }
+ }
+ break;
+ case RTF_CS:
+ if (m_aStates.top().nDestinationState == DESTINATION_STYLESHEET || m_aStates.top().nDestinationState == DESTINATION_STYLEENTRY)
+ {
+ m_nCurrentStyleIndex = nParam;
+ RTFValue::Pointer_t pValue(new RTFValue(2));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_Style_type, pValue); // character style
+ }
+ else
+ {
+ OUString aName = getStyleName(nParam);
+ if (!aName.isEmpty())
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_rStyle, RTFValue::Pointer_t(new RTFValue(aName)));
+ }
+ break;
+ case RTF_DEFF:
+ m_nDefaultFontIndex = nParam;
+ break;
+ case RTF_DEFLANG:
+ case RTF_ADEFLANG:
+ {
+ LanguageTag aTag((LanguageType)nParam);
+ RTFValue::Pointer_t pValue(new RTFValue(aTag.getBcp47()));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, (nKeyword == RTF_DEFLANG ? NS_ooxml::LN_EG_RPrBase_lang : NS_ooxml::LN_CT_Language_bidi), nSprm, pValue);
+ }
+ break;
+ case RTF_CHCBPAT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nParam ? getColorTable(nParam) : COL_AUTO));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms, NS_ooxml::LN_EG_RPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
+ }
+ break;
+ case RTF_CLCBPAT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ lcl_putNestedAttribute(m_aStates.top().aTableCellSprms,
+ NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
+ }
+ break;
+ case RTF_CBPAT:
+ if (nParam)
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PrBase_shd, NS_ooxml::LN_CT_Shd_fill, pValue);
+ }
+ break;
+ case RTF_ULC:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ m_aStates.top().aCharacterSprms.set(0x6877, pValue);
+ }
+ break;
+ case RTF_HIGHLIGHT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_highlight, pValue);
+ }
+ break;
+ case RTF_UP:
+ case RTF_DN:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nParam * (nKeyword == RTF_UP ? 1 : -1)));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_position, pValue);
+ }
+ break;
+ case RTF_HORZVERT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(int(true)));
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vert, pValue);
+ if (nParam)
+ // rotate fits to a single line
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_vertCompress, pValue);
+ }
+ break;
+ case RTF_EXPND:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nParam/5));
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_spacing, pValue);
+ }
+ break;
+ case RTF_TWOINONE:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(int(true)));
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combine, pValue);
+ if (nParam > 0)
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_EastAsianLayout_combineBrackets, pIntValue);
+ }
+ break;
+ case RTF_SL:
+ {
+ // This is similar to RTF_ABSH, negative value means 'exact', positive means 'at least'.
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_atLeast));
+ if (nParam < 0)
+ {
+ pValue.reset(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_exact));
+ pIntValue.reset(new RTFValue(-nParam));
+ }
+ m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue);
+ m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_line, pIntValue);
+ }
+ break;
+ case RTF_SLMULT:
+ if (nParam > 0)
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(NS_ooxml::LN_Value_wordprocessingml_ST_LineSpacingRule_auto));
+ m_aStates.top().aParagraphAttributes.set(NS_ooxml::LN_CT_Spacing_lineRule, pValue);
+ }
+ break;
+ case RTF_BRDRW:
+ {
+ // dmapper expects it in 1/8 pt, we have it in twip - but avoid rounding 1 to 0
+ if (nParam > 1)
+ nParam = nParam * 2 / 5;
+ RTFValue::Pointer_t pValue(new RTFValue(nParam));
+ lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_sz, pValue);
+ }
+ break;
+ case RTF_BRDRCF:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(getColorTable(nParam)));
+ lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_color, pValue);
+ }
+ break;
+ case RTF_BRSP:
+ {
+ // dmapper expects it in points, we have it in twip
+ RTFValue::Pointer_t pValue(new RTFValue(nParam / 20));
+ lcl_putBorderProperty(m_aStates, NS_ooxml::LN_CT_Border_space, pValue);
+ }
+ break;
+ case RTF_TX:
+ {
+ m_aStates.top().aTabAttributes.set(NS_ooxml::LN_CT_TabStop_pos, pIntValue);
+ RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aTabAttributes));
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_Tabs_tab, pValue);
+ m_aStates.top().aTabAttributes.clear();
+ }
+ break;
+ case RTF_ILVL:
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIntValue);
+ break;
+ case RTF_LISTTEMPLATEID:
+ // This one is not referenced anywhere, so it's pointless to store it at the moment.
+ break;
+ case RTF_LISTID:
+ {
+ if (m_aStates.top().nDestinationState == DESTINATION_LISTENTRY)
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIntValue);
+ else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue);
+ }
+ break;
+ case RTF_LS:
+ {
+ if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue);
+ else
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_NumPr_numId, pIntValue);
+ }
+ break;
+ case RTF_UC:
+ if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16))
+ m_aStates.top().nUc = nParam;
+ break;
+ case RTF_U:
+ // sal_Unicode is unsigned 16-bit, RTF may represent that as a
+ // signed SAL_MIN_INT16..SAL_MAX_INT16 or 0..SAL_MAX_UINT16. The
+ // static_cast() will do the right thing.
+ if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
+ {
+ m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam));
+ if (m_aStates.top().nDestinationState != DESTINATION_LEVELTEXT)
+ m_aStates.top().nCharsToSkip = m_aStates.top().nUc;
+ }
+ break;
+ case RTF_LEVELFOLLOW:
+ {
+ OUString sValue;
+ switch (nParam)
+ {
+ case 0:
+ sValue = "tab";
break;
- case RTF_LISTID:
- {
- if (m_aStates.top().nDestinationState == DESTINATION_LISTENTRY)
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIntValue);
- else if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIntValue);
- }
+ case 1:
+ sValue = "space";
break;
- case RTF_LS:
- {
- if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIntValue);
- else
- lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_NumPr_numId, pIntValue);
- }
+ case 2:
+ sValue = "nothing";
break;
- case RTF_UC:
- if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_INT16))
- m_aStates.top().nUc = nParam;
+ }
+ if (!sValue.isEmpty())
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, RTFValue::Pointer_t(new RTFValue(sValue)));
+ }
+ break;
+ case RTF_FPRQ:
+ {
+ sal_Int32 nValue = 0;
+ switch (nParam)
+ {
+ case 0:
+ nValue = NS_ooxml::LN_Value_ST_Pitch_default;
break;
- case RTF_U:
- // sal_Unicode is unsigned 16-bit, RTF may represent that as a
- // signed SAL_MIN_INT16..SAL_MAX_INT16 or 0..SAL_MAX_UINT16. The
- // static_cast() will do the right thing.
- if ((SAL_MIN_INT16 <= nParam) && (nParam <= SAL_MAX_UINT16))
- {
- m_aUnicodeBuffer.append(static_cast<sal_Unicode>(nParam));
- if (m_aStates.top().nDestinationState != DESTINATION_LEVELTEXT)
- m_aStates.top().nCharsToSkip = m_aStates.top().nUc;
- }
+ case 1:
+ nValue = NS_ooxml::LN_Value_ST_Pitch_fixed;
break;
- case RTF_LEVELFOLLOW:
- {
- OUString sValue;
- switch (nParam)
- {
- case 0:
- sValue = "tab";
- break;
- case 1:
- sValue = "space";
- break;
- case 2:
- sValue = "nothing";
- break;
- }
- if (!sValue.isEmpty())
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_suff, RTFValue::Pointer_t(new RTFValue(sValue)));
- }
+ case 2:
+ nValue = NS_ooxml::LN_Value_ST_Pitch_variable;
break;
- case RTF_FPRQ:
- {
- sal_Int32 nValue = 0;
- switch (nParam)
- {
- case 0:
- nValue = NS_ooxml::LN_Value_ST_Pitch_default;
- break;
- case 1:
- nValue = NS_ooxml::LN_Value_ST_Pitch_fixed;
- break;
- case 2:
- nValue = NS_ooxml::LN_Value_ST_Pitch_variable;
- break;
- }
- if (nValue)
- {
- RTFSprms aAttributes;
- aAttributes.set(NS_ooxml::LN_CT_Pitch_val, RTFValue::Pointer_t(new RTFValue(nValue)));
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_pitch, RTFValue::Pointer_t(new RTFValue(aAttributes)));
- }
- }
+ }
+ if (nValue)
+ {
+ RTFSprms aAttributes;
+ aAttributes.set(NS_ooxml::LN_CT_Pitch_val, RTFValue::Pointer_t(new RTFValue(nValue)));
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Font_pitch, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ }
+ }
+ break;
+ case RTF_LISTOVERRIDECOUNT:
+ // Ignore this for now, the exporter always emits it with a zero parameter.
+ break;
+ case RTF_PICSCALEX:
+ m_aStates.top().aPicture.nScaleX = nParam;
+ break;
+ case RTF_PICSCALEY:
+ m_aStates.top().aPicture.nScaleY = nParam;
+ break;
+ case RTF_PICW:
+ m_aStates.top().aPicture.nWidth = nParam;
+ break;
+ case RTF_PICH:
+ m_aStates.top().aPicture.nHeight = nParam;
+ break;
+ case RTF_PICWGOAL:
+ m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam);
+ break;
+ case RTF_PICHGOAL:
+ m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam);
+ break;
+ case RTF_PICCROPL:
+ m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam);
+ break;
+ case RTF_PICCROPR:
+ m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam);
+ break;
+ case RTF_PICCROPT:
+ m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam);
+ break;
+ case RTF_PICCROPB:
+ m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam);
+ break;
+ case RTF_SHPWRK:
+ {
+ int nValue = 0;
+ switch (nParam)
+ {
+ case 0:
+ nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides;
break;
- case RTF_LISTOVERRIDECOUNT:
- // Ignore this for now, the exporter always emits it with a zero parameter.
+ case 1:
+ nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left;
break;
- case RTF_PICSCALEX:
- m_aStates.top().aPicture.nScaleX = nParam;
+ case 2:
+ nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right;
break;
- case RTF_PICSCALEY:
- m_aStates.top().aPicture.nScaleY = nParam;
+ case 3:
+ nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest;
break;
- case RTF_PICW:
- m_aStates.top().aPicture.nWidth = nParam;
+ default:
break;
- case RTF_PICH:
- m_aStates.top().aPicture.nHeight = nParam;
+ }
+ RTFValue::Pointer_t pValue(new RTFValue(nValue));
+ m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, pValue);
+ }
+ break;
+ case RTF_SHPWR:
+ {
+ switch (nParam)
+ {
+ case 1:
+ m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_NONE;
break;
- case RTF_PICWGOAL:
- m_aStates.top().aPicture.nGoalWidth = convertTwipToMm100(nParam);
+ case 2:
+ m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL;
break;
- case RTF_PICHGOAL:
- m_aStates.top().aPicture.nGoalHeight = convertTwipToMm100(nParam);
+ case 3:
+ m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT;
break;
- case RTF_PICCROPL: m_aStates.top().aPicture.nCropL = convertTwipToMm100(nParam); break;
- case RTF_PICCROPR: m_aStates.top().aPicture.nCropR = convertTwipToMm100(nParam); break;
- case RTF_PICCROPT: m_aStates.top().aPicture.nCropT = convertTwipToMm100(nParam); break;
- case RTF_PICCROPB: m_aStates.top().aPicture.nCropB = convertTwipToMm100(nParam); break;
- case RTF_SHPWRK:
- {
- int nValue = 0;
- switch (nParam)
- {
- case 0: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_bothSides; break;
- case 1: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_left; break;
- case 2: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_right; break;
- case 3: nValue = NS_ooxml::LN_Value_wordprocessingDrawing_ST_WrapText_largest; break;
- default: break;
- }
- RTFValue::Pointer_t pValue(new RTFValue(nValue));
- m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_WrapSquare_wrapText, pValue);
- }
+ case 4:
+ m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL;
break;
- case RTF_SHPWR:
- {
- switch (nParam)
- {
- case 1:
- m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_NONE; break;
- case 2:
- m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL; break;
- case 3:
- m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT; break;
- case 4:
- m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_PARALLEL; break;
- case 5:
- m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT; break;
- }
- }
+ case 5:
+ m_aStates.top().aShape.nWrap = com::sun::star::text::WrapTextMode_THROUGHT;
break;
- case RTF_CELLX:
- {
- int & rCurrentCellX((DESTINATION_NESTEDTABLEPROPERTIES ==
- m_aStates.top().nDestinationState)
- ? m_nNestedCurrentCellX
- : m_nTopLevelCurrentCellX);
- int nCellX = nParam - rCurrentCellX;
- const int COL_DFLT_WIDTH = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells.
- if (!nCellX)
- nCellX = COL_DFLT_WIDTH;
-
- // If there is a negative left margin, then the first cellx is relative to that.
- RTFValue::Pointer_t pTblInd = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd);
- if (rCurrentCellX == 0 && pTblInd.get())
- {
- RTFValue::Pointer_t pWidth = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w);
- if (pWidth.get() && pWidth->getInt() < 0)
- nCellX = -1 * (pWidth->getInt() - nParam);
- }
+ }
+ }
+ break;
+ case RTF_CELLX:
+ {
+ int& rCurrentCellX((DESTINATION_NESTEDTABLEPROPERTIES ==
+ m_aStates.top().nDestinationState)
+ ? m_nNestedCurrentCellX
+ : m_nTopLevelCurrentCellX);
+ int nCellX = nParam - rCurrentCellX;
+ const int COL_DFLT_WIDTH = 41; // sw/source/filter/inc/wrtswtbl.hxx, minimal possible width of cells.
+ if (!nCellX)
+ nCellX = COL_DFLT_WIDTH;
+
+ // If there is a negative left margin, then the first cellx is relative to that.
+ RTFValue::Pointer_t pTblInd = m_aStates.top().aTableRowSprms.find(NS_ooxml::LN_CT_TblPrBase_tblInd);
+ if (rCurrentCellX == 0 && pTblInd.get())
+ {
+ RTFValue::Pointer_t pWidth = pTblInd->getAttributes().find(NS_ooxml::LN_CT_TblWidth_w);
+ if (pWidth.get() && pWidth->getInt() < 0)
+ nCellX = -1 * (pWidth->getInt() - nParam);
+ }
- rCurrentCellX = nParam;
- RTFValue::Pointer_t pXValue(new RTFValue(nCellX));
- m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, OVERWRITE_NO_APPEND);
- if (DESTINATION_NESTEDTABLEPROPERTIES == m_aStates.top().nDestinationState)
- {
- m_nNestedCells++;
- // Push cell properties.
- m_aNestedTableCellsSprms.push_back(
- m_aStates.top().aTableCellSprms);
- m_aNestedTableCellsAttributes.push_back(
- m_aStates.top().aTableCellAttributes);
- }
- else
- {
- m_nTopLevelCells++;
- // Push cell properties.
- m_aTopLevelTableCellsSprms.push_back(
- m_aStates.top().aTableCellSprms);
- m_aTopLevelTableCellsAttributes.push_back(
- m_aStates.top().aTableCellAttributes);
- }
+ rCurrentCellX = nParam;
+ RTFValue::Pointer_t pXValue(new RTFValue(nCellX));
+ m_aStates.top().aTableRowSprms.set(NS_ooxml::LN_CT_TblGridBase_gridCol, pXValue, OVERWRITE_NO_APPEND);
+ if (DESTINATION_NESTEDTABLEPROPERTIES == m_aStates.top().nDestinationState)
+ {
+ m_nNestedCells++;
+ // Push cell properties.
+ m_aNestedTableCellsSprms.push_back(
+ m_aStates.top().aTableCellSprms);
+ m_aNestedTableCellsAttributes.push_back(
+ m_aStates.top().aTableCellAttributes);
+ }
+ else
+ {
+ m_nTopLevelCells++;
+ // Push cell properties.
+ m_aTopLevelTableCellsSprms.push_back(
+ m_aStates.top().aTableCellSprms);
+ m_aTopLevelTableCellsAttributes.push_back(
+ m_aStates.top().aTableCellAttributes);
+ }
- m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
- m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
- // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token
- dispatchFlag(RTF_INTBL);
- m_nCellxMax = std::max(m_nCellxMax, nParam);
- }
- break;
- case RTF_TRRH:
- {
- OUString hRule("auto");
- if ( nParam < 0 )
- {
- RTFValue::Pointer_t pAbsValue(new RTFValue(-nParam));
- pIntValue.swap( pAbsValue );
+ m_aStates.top().aTableCellSprms = m_aDefaultState.aTableCellSprms;
+ m_aStates.top().aTableCellAttributes = m_aDefaultState.aTableCellAttributes;
+ // We assume text after a row definition always belongs to the table, to handle text before the real INTBL token
+ dispatchFlag(RTF_INTBL);
+ m_nCellxMax = std::max(m_nCellxMax, nParam);
+ }
+ break;
+ case RTF_TRRH:
+ {
+ OUString hRule("auto");
+ if (nParam < 0)
+ {
+ RTFValue::Pointer_t pAbsValue(new RTFValue(-nParam));
+ pIntValue.swap(pAbsValue);
- hRule = "exact";
- }
- else if ( nParam > 0 )
- hRule = "atLeast";
+ hRule = "exact";
+ }
+ else if (nParam > 0)
+ hRule = "atLeast";
- lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
- NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_val, pIntValue);
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+ NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_val, pIntValue);
- RTFValue::Pointer_t pHRule(new RTFValue(hRule));
- lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
- NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_hRule, pHRule);
- }
- break;
- case RTF_TRLEFT:
- {
- // the value is in twips
- lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_type,
- RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
- lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
- NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_w,
- RTFValue::Pointer_t(new RTFValue(nParam)));
- }
- break;
- case RTF_COLS:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_num, pIntValue);
- break;
- case RTF_COLSX:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_space, pIntValue);
- break;
- case RTF_COLNO:
- lcl_putNestedSprm(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_col, pIntValue);
- break;
- case RTF_COLW:
- case RTF_COLSR:
- {
- RTFSprms& rAttributes = lcl_getLastAttributes(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols);
- rAttributes.set((nKeyword == RTF_COLW ? NS_ooxml::LN_CT_Column_w : NS_ooxml::LN_CT_Column_space), pIntValue);
- }
- break;
- case RTF_PAPERH: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, OVERWRITE_YES);
- case RTF_PGHSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, OVERWRITE_YES);
- break;
- case RTF_PAPERW: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, OVERWRITE_YES);
- case RTF_PGWSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, OVERWRITE_YES);
- break;
- case RTF_MARGL: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, OVERWRITE_YES);
- case RTF_MARGLSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, OVERWRITE_YES);
- break;
- case RTF_MARGR: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, OVERWRITE_YES);
- case RTF_MARGRSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, OVERWRITE_YES);
- break;
- case RTF_MARGT: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, OVERWRITE_YES);
- case RTF_MARGTSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, OVERWRITE_YES);
- break;
- case RTF_MARGB: // fall through: set the default + current value
- lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, OVERWRITE_YES);
- case RTF_MARGBSXN:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, OVERWRITE_YES);
- break;
- case RTF_HEADERY:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_header, pIntValue, OVERWRITE_YES);
- break;
- case RTF_FOOTERY:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_footer, pIntValue, OVERWRITE_YES);
- break;
- case RTF_DEFTAB:
- m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue);
- break;
- case RTF_LINEMOD:
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_countBy, pIntValue);
- break;
- case RTF_LINEX:
- if (nParam)
- lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance, pIntValue);
- break;
- case RTF_LINESTARTS:
+ RTFValue::Pointer_t pHRule(new RTFValue(hRule));
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+ NS_ooxml::LN_CT_TrPrBase_trHeight, NS_ooxml::LN_CT_Height_hRule, pHRule);
+ }
+ break;
+ case RTF_TRLEFT:
+ {
+ // the value is in twips
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+ NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_type,
+ RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+ lcl_putNestedAttribute(m_aStates.top().aTableRowSprms,
+ NS_ooxml::LN_CT_TblPrBase_tblInd, NS_ooxml::LN_CT_TblWidth_w,
+ RTFValue::Pointer_t(new RTFValue(nParam)));
+ }
+ break;
+ case RTF_COLS:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_num, pIntValue);
+ break;
+ case RTF_COLSX:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_space, pIntValue);
+ break;
+ case RTF_COLNO:
+ lcl_putNestedSprm(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_cols, NS_ooxml::LN_CT_Columns_col, pIntValue);
+ break;
+ case RTF_COLW:
+ case RTF_COLSR:
+ {
+ RTFSprms& rAttributes = lcl_getLastAttributes(m_aStates.top().aSectionSprms, NS_ooxml::LN_EG_SectPrContents_cols);
+ rAttributes.set((nKeyword == RTF_COLW ? NS_ooxml::LN_CT_Column_w : NS_ooxml::LN_CT_Column_space), pIntValue);
+ }
+ break;
+ case RTF_PAPERH: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, OVERWRITE_YES);
+ case RTF_PGHSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_h, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_PAPERW: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, OVERWRITE_YES);
+ case RTF_PGWSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgSz, NS_ooxml::LN_CT_PageSz_w, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_MARGL: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, OVERWRITE_YES);
+ case RTF_MARGLSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_left, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_MARGR: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, OVERWRITE_YES);
+ case RTF_MARGRSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_right, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_MARGT: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, OVERWRITE_YES);
+ case RTF_MARGTSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_top, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_MARGB: // fall through: set the default + current value
+ lcl_putNestedAttribute(m_aDefaultState.aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, OVERWRITE_YES);
+ case RTF_MARGBSXN:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_bottom, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_HEADERY:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_header, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_FOOTERY:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_pgMar, NS_ooxml::LN_CT_PageMar_footer, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_DEFTAB:
+ m_aSettingsTableSprms.set(NS_ooxml::LN_CT_Settings_defaultTabStop, pIntValue);
+ break;
+ case RTF_LINEMOD:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_countBy, pIntValue);
+ break;
+ case RTF_LINEX:
+ if (nParam)
lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
- NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_start, pIntValue);
- break;
- case RTF_REVAUTH:
- case RTF_REVAUTHDEL:
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aAuthors[nParam]));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
- NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_author, pValue);
- }
- break;
- case RTF_REVDTTM:
- case RTF_REVDTTMDEL:
- {
- OUString aStr(OStringToOUString(lcl_DTTM22OString(nParam), m_aStates.top().nCurrentEncoding));
- RTFValue::Pointer_t pValue(new RTFValue(aStr));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
- NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue);
- }
- break;
- case RTF_SHPLEFT:
- m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam);
- break;
- case RTF_SHPTOP:
- m_aStates.top().aShape.nTop = convertTwipToMm100(nParam);
+ NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_distance, pIntValue);
+ break;
+ case RTF_LINESTARTS:
+ lcl_putNestedAttribute(m_aStates.top().aSectionSprms,
+ NS_ooxml::LN_EG_SectPrContents_lnNumType, NS_ooxml::LN_CT_LineNumber_start, pIntValue);
+ break;
+ case RTF_REVAUTH:
+ case RTF_REVAUTHDEL:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aAuthors[nParam]));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
+ NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_author, pValue);
+ }
+ break;
+ case RTF_REVDTTM:
+ case RTF_REVDTTMDEL:
+ {
+ OUString aStr(OStringToOUString(lcl_DTTM22OString(nParam), m_aStates.top().nCurrentEncoding));
+ RTFValue::Pointer_t pValue(new RTFValue(aStr));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
+ NS_ooxml::LN_trackchange, NS_ooxml::LN_CT_TrackChange_date, pValue);
+ }
+ break;
+ case RTF_SHPLEFT:
+ m_aStates.top().aShape.nLeft = convertTwipToMm100(nParam);
+ break;
+ case RTF_SHPTOP:
+ m_aStates.top().aShape.nTop = convertTwipToMm100(nParam);
+ break;
+ case RTF_SHPRIGHT:
+ m_aStates.top().aShape.nRight = convertTwipToMm100(nParam);
+ break;
+ case RTF_SHPBOTTOM:
+ m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam);
+ break;
+ case RTF_SHPZ:
+ m_aStates.top().aShape.oZ.reset(nParam);
+ break;
+ case RTF_FFTYPE:
+ switch (nParam)
+ {
+ case 0:
+ m_nFormFieldType = FORMFIELD_TEXT;
break;
- case RTF_SHPRIGHT:
- m_aStates.top().aShape.nRight = convertTwipToMm100(nParam);
+ case 1:
+ m_nFormFieldType = FORMFIELD_CHECKBOX;
break;
- case RTF_SHPBOTTOM:
- m_aStates.top().aShape.nBottom = convertTwipToMm100(nParam);
+ case 2:
+ m_nFormFieldType = FORMFIELD_LIST;
break;
- case RTF_SHPZ:
- m_aStates.top().aShape.oZ.reset(nParam);
+ default:
+ m_nFormFieldType = FORMFIELD_NONE;
break;
- case RTF_FFTYPE:
- switch (nParam)
+ }
+ break;
+ case RTF_FFDEFRES:
+ if (m_nFormFieldType == FORMFIELD_CHECKBOX)
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_default, pIntValue);
+ else if (m_nFormFieldType == FORMFIELD_LIST)
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_default, pIntValue);
+ break;
+ case RTF_FFRES:
+ if (m_nFormFieldType == FORMFIELD_CHECKBOX)
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_checked, pIntValue);
+ else if (m_nFormFieldType == FORMFIELD_LIST)
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_result, pIntValue);
+ break;
+ case RTF_EDMINS:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setEditingDuration(nParam);
+ break;
+ case RTF_NOFPAGES:
+ case RTF_NOFWORDS:
+ case RTF_NOFCHARS:
+ case RTF_NOFCHARSWS:
+ if (m_xDocumentProperties.is())
+ {
+ uno::Sequence<beans::NamedValue> aSet = m_xDocumentProperties->getDocumentStatistics();
+ OUString aName;
+ switch (nKeyword)
{
- case 0: m_nFormFieldType = FORMFIELD_TEXT; break;
- case 1: m_nFormFieldType = FORMFIELD_CHECKBOX; break;
- case 2: m_nFormFieldType = FORMFIELD_LIST; break;
- default: m_nFormFieldType = FORMFIELD_NONE; break;
+ case RTF_NOFPAGES:
+ aName = "PageCount";
+ nParam = 99;
+ break;
+ case RTF_NOFWORDS:
+ aName = "WordCount";
+ break;
+ case RTF_NOFCHARS:
+ aName = "CharacterCount";
+ break;
+ case RTF_NOFCHARSWS:
+ aName = "NonWhitespaceCharacterCount";
+ break;
+ default:
+ break;
}
- break;
- case RTF_FFDEFRES:
- if (m_nFormFieldType == FORMFIELD_CHECKBOX)
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_default, pIntValue);
- else if (m_nFormFieldType == FORMFIELD_LIST)
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_default, pIntValue);
- break;
- case RTF_FFRES:
- if (m_nFormFieldType == FORMFIELD_CHECKBOX)
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFCheckBox_checked, pIntValue);
- else if (m_nFormFieldType == FORMFIELD_LIST)
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_result, pIntValue);
- break;
- case RTF_EDMINS:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setEditingDuration(nParam);
- break;
- case RTF_NOFPAGES:
- case RTF_NOFWORDS:
- case RTF_NOFCHARS:
- case RTF_NOFCHARSWS:
- if (m_xDocumentProperties.is())
+ if (!aName.isEmpty())
{
- uno::Sequence<beans::NamedValue> aSet = m_xDocumentProperties->getDocumentStatistics();
- OUString aName;
- switch (nKeyword)
- {
- case RTF_NOFPAGES: aName = "PageCount"; nParam = 99; break;
- case RTF_NOFWORDS: aName = "WordCount"; break;
- case RTF_NOFCHARS: aName = "CharacterCount"; break;
- case RTF_NOFCHARSWS: aName = "NonWhitespaceCharacterCount"; break;
- default: break;
- }
- if (!aName.isEmpty())
+ bool bFound = false;
+ int nLen = aSet.getLength();
+ for (int i = 0; i < nLen; ++i)
+ if (aSet[i].Name.equals(aName))
+ aSet[i].Value = uno::makeAny(sal_Int32(nParam));
+ if (!bFound)
{
- bool bFound = false;
- int nLen = aSet.getLength();
- for (int i = 0; i < nLen; ++i)
- if (aSet[i].Name.equals(aName))
- aSet[i].Value = uno::makeAny(sal_Int32(nParam));
- if (!bFound)
- {
- aSet.realloc(nLen + 1);
- aSet[nLen].Name = aName;
- aSet[nLen].Value = uno::makeAny(sal_Int32(nParam));
- }
- m_xDocumentProperties->setDocumentStatistics(aSet);
+ aSet.realloc(nLen + 1);
+ aSet[nLen].Name = aName;
+ aSet[nLen].Value = uno::makeAny(sal_Int32(nParam));
}
+ m_xDocumentProperties->setDocumentStatistics(aSet);
}
+ }
+ break;
+ case RTF_VERSION:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setEditingCycles(nParam);
+ break;
+ case RTF_VERN:
+ // Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers.
+ break;
+ case RTF_FTNSTART:
+ lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
+ NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
+ break;
+ case RTF_AFTNSTART:
+ lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
+ NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
+ break;
+ case RTF_DFRMTXTX:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
+ break;
+ case RTF_DFRMTXTY:
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
+ break;
+ case RTF_DXFRTEXT:
+ {
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
+ }
+ break;
+ case RTF_FLYVERT:
+ {
+ RTFVertOrient aVertOrient(nParam);
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign());
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, aVertOrient.GetAnchor());
+ }
+ break;
+ case RTF_FLYHORZ:
+ {
+ RTFHoriOrient aHoriOrient(nParam);
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign());
+ m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, aHoriOrient.GetAnchor());
+ }
+ break;
+ case RTF_FLYANCHOR:
+ m_aStates.top().aFrame.nAnchorType = nParam;
+ break;
+ case RTF_WMETAFILE:
+ m_aStates.top().aPicture.eWMetafile = nParam;
+ break;
+ case RTF_SB:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms,
+ NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_SA:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms,
+ NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue, OVERWRITE_YES);
+ break;
+ case RTF_DPX:
+ m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam);
+ break;
+ case RTF_DPY:
+ m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam);
+ break;
+ case RTF_DPXSIZE:
+ m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam);
+ break;
+ case RTF_DPYSIZE:
+ m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam);
+ break;
+ case RTF_PNSTART:
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue);
+ break;
+ case RTF_PNF:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aFontNames[getFontIndex(nParam)]));
+ RTFSprms aAttributes;
+ aAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, pValue);
+ lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ }
+ break;
+ case RTF_VIEWSCALE:
+ m_aSettingsTableAttributes.set(NS_ooxml::LN_CT_Zoom_percent, pIntValue);
+ break;
+ case RTF_BIN:
+ {
+ m_aStates.top().nInternalState = INTERNAL_BIN;
+ m_aStates.top().nBinaryToRead = nParam;
+ }
+ break;
+ case RTF_DPLINECOR:
+ m_aStates.top().aDrawingObject.nLineColorR = nParam;
+ m_aStates.top().aDrawingObject.bHasLineColor = true;
+ break;
+ case RTF_DPLINECOG:
+ m_aStates.top().aDrawingObject.nLineColorG = nParam;
+ m_aStates.top().aDrawingObject.bHasLineColor = true;
+ break;
+ case RTF_DPLINECOB:
+ m_aStates.top().aDrawingObject.nLineColorB = nParam;
+ m_aStates.top().aDrawingObject.bHasLineColor = true;
+ break;
+ case RTF_DPFILLBGCR:
+ m_aStates.top().aDrawingObject.nFillColorR = nParam;
+ m_aStates.top().aDrawingObject.bHasFillColor = true;
+ break;
+ case RTF_DPFILLBGCG:
+ m_aStates.top().aDrawingObject.nFillColorG = nParam;
+ m_aStates.top().aDrawingObject.bHasFillColor = true;
+ break;
+ case RTF_DPFILLBGCB:
+ m_aStates.top().aDrawingObject.nFillColorB = nParam;
+ m_aStates.top().aDrawingObject.bHasFillColor = true;
+ break;
+ case RTF_CLSHDNG:
+ {
+ int nValue = -1;
+ switch (nParam)
+ {
+ case 500:
+ nValue = 2;
break;
- case RTF_VERSION:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setEditingCycles(nParam);
- break;
- case RTF_VERN:
- // Ignore this for now, later the RTF writer version could be used to add hacks for older buggy writers.
- break;
- case RTF_FTNSTART:
- lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
- NS_ooxml::LN_EG_SectPrContents_footnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
- break;
- case RTF_AFTNSTART:
- lcl_putNestedSprm(m_aDefaultState.aParagraphSprms,
- NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
- break;
- case RTF_DFRMTXTX:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
- break;
- case RTF_DFRMTXTY:
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
- break;
- case RTF_DXFRTEXT:
- {
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hSpace, nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vSpace, nParam);
- }
- break;
- case RTF_FLYVERT:
- {
- RTFVertOrient aVertOrient(nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign());
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, aVertOrient.GetAnchor());
- }
+ case 1000:
+ nValue = 3;
break;
- case RTF_FLYHORZ:
- {
- RTFHoriOrient aHoriOrient(nParam);
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign());
- m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, aHoriOrient.GetAnchor());
- }
+ case 1200:
+ nValue = 37;
break;
- case RTF_FLYANCHOR:
- m_aStates.top().aFrame.nAnchorType = nParam;
+ case 1500:
+ nValue = 38;
break;
- case RTF_WMETAFILE:
- m_aStates.top().aPicture.eWMetafile = nParam;
+ case 2000:
+ nValue = 4;
break;
- case RTF_SB:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms,
- NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_before, pIntValue, OVERWRITE_YES);
+ case 2500:
+ nValue = 5;
break;
- case RTF_SA:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms,
- NS_ooxml::LN_CT_PPrBase_spacing, NS_ooxml::LN_CT_Spacing_after, pIntValue, OVERWRITE_YES);
+ case 3000:
+ nValue = 6;
break;
- case RTF_DPX:
- m_aStates.top().aDrawingObject.nLeft = convertTwipToMm100(nParam);
+ case 3500:
+ nValue = 43;
break;
- case RTF_DPY:
- m_aStates.top().aDrawingObject.nTop = convertTwipToMm100(nParam);
+ case 3700:
+ nValue = 44;
break;
- case RTF_DPXSIZE:
- m_aStates.top().aDrawingObject.nRight = convertTwipToMm100(nParam);
+ case 4000:
+ nValue = 7;
break;
- case RTF_DPYSIZE:
- m_aStates.top().aDrawingObject.nBottom = convertTwipToMm100(nParam);
+ case 4500:
+ nValue = 46;
break;
- case RTF_PNSTART:
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_start, pIntValue);
+ case 5000:
+ nValue = 8;
break;
- case RTF_PNF:
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aFontNames[getFontIndex(nParam)]));
- RTFSprms aAttributes;
- aAttributes.set(NS_ooxml::LN_CT_Fonts_ascii, pValue);
- lcl_putNestedSprm(m_aStates.top().aTableSprms, NS_ooxml::LN_CT_Lvl_rPr, NS_ooxml::LN_EG_RPrBase_rFonts, RTFValue::Pointer_t(new RTFValue(aAttributes)));
- }
+ case 5500:
+ nValue = 49;
break;
- case RTF_VIEWSCALE:
- m_aSettingsTableAttributes.set(NS_ooxml::LN_CT_Zoom_percent, pIntValue);
+ case 6000:
+ nValue = 9;
break;
- case RTF_BIN:
- {
- m_aStates.top().nInternalState = INTERNAL_BIN;
- m_aStates.top().nBinaryToRead = nParam;
- }
+ case 6200:
+ nValue = 51;
break;
- case RTF_DPLINECOR:
- m_aStates.top().aDrawingObject.nLineColorR = nParam; m_aStates.top().aDrawingObject.bHasLineColor = true;
+ case 6500:
+ nValue = 52;
break;
- case RTF_DPLINECOG:
- m_aStates.top().aDrawingObject.nLineColorG = nParam; m_aStates.top().aDrawingObject.bHasLineColor = true;
+ case 7000:
+ nValue = 10;
break;
- case RTF_DPLINECOB:
- m_aStates.top().aDrawingObject.nLineColorB = nParam; m_aStates.top().aDrawingObject.bHasLineColor = true;
+ case 7500:
+ nValue = 11;
break;
- case RTF_DPFILLBGCR:
- m_aStates.top().aDrawingObject.nFillColorR = nParam; m_aStates.top().aDrawingObject.bHasFillColor = true;
+ case 8000:
+ nValue = 12;
break;
- case RTF_DPFILLBGCG:
- m_aStates.top().aDrawingObject.nFillColorG = nParam; m_aStates.top().aDrawingObject.bHasFillColor = true;
+ case 8500:
+ nValue = 57;
break;
- case RTF_DPFILLBGCB:
- m_aStates.top().aDrawingObject.nFillColorB = nParam; m_aStates.top().aDrawingObject.bHasFillColor = true;
+ case 8700:
+ nValue = 58;
break;
- case RTF_CLSHDNG:
- {
- int nValue = -1;
- switch (nParam)
- {
- case 500: nValue = 2; break;
- case 1000: nValue = 3; break;
- case 1200: nValue = 37; break;
- case 1500: nValue = 38; break;
- case 2000: nValue = 4; break;
- case 2500: nValue = 5; break;
- case 3000: nValue = 6; break;
- case 3500: nValue = 43; break;
- case 3700: nValue = 44; break;
- case 4000: nValue = 7; break;
- case 4500: nValue = 46; break;
- case 5000: nValue = 8; break;
- case 5500: nValue = 49; break;
- case 6000: nValue = 9; break;
- case 6200: nValue = 51; break;
- case 6500: nValue = 52; break;
- case 7000: nValue = 10; break;
- case 7500: nValue = 11; break;
- case 8000: nValue = 12; break;
- case 8500: nValue = 57; break;
- case 8700: nValue = 58; break;
- case 9000: nValue = 13; break;
- case 9500: nValue = 60; break;
- default: break;
- }
- if (nValue != -1)
- lcl_putNestedAttribute(m_aStates.top().aTableCellSprms,
- NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_val, RTFValue::Pointer_t(new RTFValue(nValue)));
- }
+ case 9000:
+ nValue = 13;
break;
- case RTF_DODHGT:
- m_aStates.top().aDrawingObject.nDhgt = nParam;
+ case 9500:
+ nValue = 60;
break;
- case RTF_DPPOLYCOUNT:
- if (nParam >= 0)
- {
- m_aStates.top().aDrawingObject.nPolyLineCount = nParam;
- m_aStates.top().aDrawingObject.aPolyLinePoints.realloc(nParam);
- }
+ default:
break;
- case RTF_DPPTX:
- {
- RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
+ }
+ if (nValue != -1)
+ lcl_putNestedAttribute(m_aStates.top().aTableCellSprms,
+ NS_ooxml::LN_CT_TcPrBase_shd, NS_ooxml::LN_CT_Shd_val, RTFValue::Pointer_t(new RTFValue(nValue)));
+ }
+ break;
+ case RTF_DODHGT:
+ m_aStates.top().aDrawingObject.nDhgt = nParam;
+ break;
+ case RTF_DPPOLYCOUNT:
+ if (nParam >= 0)
+ {
+ m_aStates.top().aDrawingObject.nPolyLineCount = nParam;
+ m_aStates.top().aDrawingObject.aPolyLinePoints.realloc(nParam);
+ }
+ break;
+ case RTF_DPPTX:
+ {
+ RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
- if (!rDrawingObject.aPolyLinePoints.hasElements())
- dispatchValue(RTF_DPPOLYCOUNT, 2);
+ if (!rDrawingObject.aPolyLinePoints.hasElements())
+ dispatchValue(RTF_DPPOLYCOUNT, 2);
- rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].X = convertTwipToMm100(nParam);
- }
- break;
- case RTF_DPPTY:
- {
- RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
- if (rDrawingObject.aPolyLinePoints.hasElements())
- {
- rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].Y = convertTwipToMm100(nParam);
- rDrawingObject.nPolyLineCount--;
- if (rDrawingObject.nPolyLineCount == 0)
- {
- uno::Sequence< uno::Sequence<awt::Point> >aPointSequenceSequence(1);
- aPointSequenceSequence[0] = rDrawingObject.aPolyLinePoints;
- rDrawingObject.xPropertySet->setPropertyValue("PolyPolygon", uno::Any(aPointSequenceSequence));
- }
- }
- }
- break;
- case RTF_SHPFBLWTXT:
- if (nParam == 1)
+ rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].X = convertTwipToMm100(nParam);
+ }
+ break;
+ case RTF_DPPTY:
+ {
+ RTFDrawingObject& rDrawingObject = m_aStates.top().aDrawingObject;
+ if (rDrawingObject.aPolyLinePoints.hasElements())
+ {
+ rDrawingObject.aPolyLinePoints[rDrawingObject.aPolyLinePoints.getLength() - rDrawingObject.nPolyLineCount].Y = convertTwipToMm100(nParam);
+ rDrawingObject.nPolyLineCount--;
+ if (rDrawingObject.nPolyLineCount == 0)
{
- // Shape is below text -> send it to the background.
- m_aStates.top().aCharacterAttributes.erase(NS_ooxml::LN_CT_WrapSquare_wrapText);
- m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue()));
+ uno::Sequence< uno::Sequence<awt::Point> >aPointSequenceSequence(1);
+ aPointSequenceSequence[0] = rDrawingObject.aPolyLinePoints;
+ rDrawingObject.xPropertySet->setPropertyValue("PolyPolygon", uno::Any(aPointSequenceSequence));
}
- break;
+ }
+ }
+ break;
+ case RTF_SHPFBLWTXT:
+ if (nParam == 1)
+ {
+ // Shape is below text -> send it to the background.
+ m_aStates.top().aCharacterAttributes.erase(NS_ooxml::LN_CT_WrapSquare_wrapText);
+ m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_WrapType_wrapNone, RTFValue::Pointer_t(new RTFValue()));
+ }
+ break;
+ case RTF_CLPADB:
+ case RTF_CLPADL:
+ case RTF_CLPADR:
+ case RTF_CLPADT:
+ {
+ RTFSprms aAttributes;
+ aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
+ aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, RTFValue::Pointer_t(new RTFValue(nParam)));
+ switch (nKeyword)
+ {
case RTF_CLPADB:
- case RTF_CLPADL:
- case RTF_CLPADR:
- case RTF_CLPADT:
- {
- RTFSprms aAttributes;
- aAttributes.set(NS_ooxml::LN_CT_TblWidth_type, RTFValue::Pointer_t(new RTFValue(NS_ooxml::LN_Value_ST_TblWidth_dxa)));
- aAttributes.set(NS_ooxml::LN_CT_TblWidth_w, RTFValue::Pointer_t(new RTFValue(nParam)));
- switch (nKeyword)
- {
- case RTF_CLPADB:
- nSprm = NS_ooxml::LN_CT_TcMar_bottom;
- break;
- case RTF_CLPADL:
- nSprm = NS_ooxml::LN_CT_TcMar_left;
- break;
- case RTF_CLPADR:
- nSprm = NS_ooxml::LN_CT_TcMar_right;
- break;
- case RTF_CLPADT:
- nSprm = NS_ooxml::LN_CT_TcMar_top;
- break;
- default:
- break;
- }
- lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, RTFValue::Pointer_t(new RTFValue(aAttributes)));
- }
- break;
- case RTF_FI:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue);
- break;
- case RTF_LI:
- {
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_left, pIntValue);
- // It turns out \li should reset the \fi inherited from the stylesheet.
- // So set the direct formatting to zero, if we don't have such direct formatting yet.
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, RTFValue::Pointer_t(new RTFValue(0)),
- OVERWRITE_NO_IGNORE, /*bAttribute=*/true);
- }
+ nSprm = NS_ooxml::LN_CT_TcMar_bottom;
break;
- case RTF_RI:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_right, pIntValue);
+ case RTF_CLPADL:
+ nSprm = NS_ooxml::LN_CT_TcMar_left;
break;
- case RTF_LIN:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_start, pIntValue);
+ case RTF_CLPADR:
+ nSprm = NS_ooxml::LN_CT_TcMar_right;
break;
- case RTF_RIN:
- lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_end, pIntValue);
+ case RTF_CLPADT:
+ nSprm = NS_ooxml::LN_CT_TcMar_top;
break;
default:
- {
- SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
- aSkip.setParsed(false);
- }
break;
+ }
+ lcl_putNestedSprm(m_aStates.top().aTableCellSprms, NS_ooxml::LN_CT_TcPrBase_tcMar, nSprm, RTFValue::Pointer_t(new RTFValue(aAttributes)));
+ }
+ break;
+ case RTF_FI:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, pIntValue);
+ break;
+ case RTF_LI:
+ {
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_left, pIntValue);
+ // It turns out \li should reset the \fi inherited from the stylesheet.
+ // So set the direct formatting to zero, if we don't have such direct formatting yet.
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_firstLine, RTFValue::Pointer_t(new RTFValue(0)),
+ OVERWRITE_NO_IGNORE, /*bAttribute=*/true);
+ }
+ break;
+ case RTF_RI:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_right, pIntValue);
+ break;
+ case RTF_LIN:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_start, pIntValue);
+ break;
+ case RTF_RIN:
+ lcl_putNestedAttribute(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_ind, NS_ooxml::LN_CT_Ind_end, pIntValue);
+ break;
+ default:
+ {
+ SAL_INFO("writerfilter", "TODO handle value '" << lcl_RtfToString(nKeyword) << "'");
+ aSkip.setParsed(false);
+ }
+ break;
}
return 0;
}
@@ -4033,22 +4432,53 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
// Map all underline toggles to a single sprm.
switch (nKeyword)
{
- case RTF_UL: nSprm = 1; break;
- case RTF_ULDASH: nSprm = 7; break;
- case RTF_ULDASHD: nSprm = 9; break;
- case RTF_ULDASHDD: nSprm = 10; break;
- case RTF_ULDB: nSprm = 3; break;
- case RTF_ULHWAVE: nSprm = 27; break;
- case RTF_ULLDASH: nSprm = 39; break;
- case RTF_ULTH: nSprm = 6; break;
- case RTF_ULTHD: nSprm = 20; break;
- case RTF_ULTHDASH: nSprm = 23; break;
- case RTF_ULTHDASHD: nSprm = 25; break;
- case RTF_ULTHDASHDD: nSprm = 26; break;
- case RTF_ULTHLDASH: nSprm = 55; break;
- case RTF_ULULDBWAVE: nSprm = 43; break;
- case RTF_ULWAVE: nSprm = 11; break;
- default: break;
+ case RTF_UL:
+ nSprm = 1;
+ break;
+ case RTF_ULDASH:
+ nSprm = 7;
+ break;
+ case RTF_ULDASHD:
+ nSprm = 9;
+ break;
+ case RTF_ULDASHDD:
+ nSprm = 10;
+ break;
+ case RTF_ULDB:
+ nSprm = 3;
+ break;
+ case RTF_ULHWAVE:
+ nSprm = 27;
+ break;
+ case RTF_ULLDASH:
+ nSprm = 39;
+ break;
+ case RTF_ULTH:
+ nSprm = 6;
+ break;
+ case RTF_ULTHD:
+ nSprm = 20;
+ break;
+ case RTF_ULTHDASH:
+ nSprm = 23;
+ break;
+ case RTF_ULTHDASHD:
+ nSprm = 25;
+ break;
+ case RTF_ULTHDASHDD:
+ nSprm = 26;
+ break;
+ case RTF_ULTHLDASH:
+ nSprm = 55;
+ break;
+ case RTF_ULULDBWAVE:
+ nSprm = 43;
+ break;
+ case RTF_ULWAVE:
+ nSprm = 11;
+ break;
+ default:
+ break;
}
if (nSprm >= 0)
{
@@ -4060,12 +4490,23 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
// Accent characters (over dot / over coma).
switch (nKeyword)
{
- case RTF_ACCNONE: nSprm = 0; break;
- case RTF_ACCDOT: nSprm = 1; break;
- case RTF_ACCCOMMA: nSprm = 2; break;
- case RTF_ACCCIRCLE: nSprm = 3; break;
- case RTF_ACCUNDERDOT: nSprm = 4; break;
- default: break;
+ case RTF_ACCNONE:
+ nSprm = 0;
+ break;
+ case RTF_ACCDOT:
+ nSprm = 1;
+ break;
+ case RTF_ACCCOMMA:
+ nSprm = 2;
+ break;
+ case RTF_ACCCIRCLE:
+ nSprm = 3;
+ break;
+ case RTF_ACCUNDERDOT:
+ nSprm = 4;
+ break;
+ default:
+ break;
}
if (nSprm >= 0)
{
@@ -4077,19 +4518,44 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
// Trivial character sprms.
switch (nKeyword)
{
- case RTF_B: nSprm = NS_ooxml::LN_EG_RPrBase_b; break;
- case RTF_AB: nSprm = NS_ooxml::LN_EG_RPrBase_bCs; break;
- case RTF_I: nSprm = NS_ooxml::LN_EG_RPrBase_i; break;
- case RTF_AI: nSprm = NS_ooxml::LN_EG_RPrBase_iCs; break;
- case RTF_OUTL: nSprm = NS_ooxml::LN_EG_RPrBase_outline; break;
- case RTF_SHAD: nSprm = NS_ooxml::LN_EG_RPrBase_shadow; break;
- case RTF_V: nSprm = NS_ooxml::LN_EG_RPrBase_vanish; break;
- case RTF_STRIKE: nSprm = NS_ooxml::LN_EG_RPrBase_strike; break;
- case RTF_STRIKED: nSprm = NS_ooxml::LN_EG_RPrBase_dstrike; break;
- case RTF_SCAPS: nSprm = NS_ooxml::LN_EG_RPrBase_smallCaps; break;
- case RTF_IMPR: nSprm = NS_ooxml::LN_EG_RPrBase_imprint; break;
- case RTF_CAPS: nSprm = NS_ooxml::LN_EG_RPrBase_caps; break;
- default: break;
+ case RTF_B:
+ nSprm = NS_ooxml::LN_EG_RPrBase_b;
+ break;
+ case RTF_AB:
+ nSprm = NS_ooxml::LN_EG_RPrBase_bCs;
+ break;
+ case RTF_I:
+ nSprm = NS_ooxml::LN_EG_RPrBase_i;
+ break;
+ case RTF_AI:
+ nSprm = NS_ooxml::LN_EG_RPrBase_iCs;
+ break;
+ case RTF_OUTL:
+ nSprm = NS_ooxml::LN_EG_RPrBase_outline;
+ break;
+ case RTF_SHAD:
+ nSprm = NS_ooxml::LN_EG_RPrBase_shadow;
+ break;
+ case RTF_V:
+ nSprm = NS_ooxml::LN_EG_RPrBase_vanish;
+ break;
+ case RTF_STRIKE:
+ nSprm = NS_ooxml::LN_EG_RPrBase_strike;
+ break;
+ case RTF_STRIKED:
+ nSprm = NS_ooxml::LN_EG_RPrBase_dstrike;
+ break;
+ case RTF_SCAPS:
+ nSprm = NS_ooxml::LN_EG_RPrBase_smallCaps;
+ break;
+ case RTF_IMPR:
+ nSprm = NS_ooxml::LN_EG_RPrBase_imprint;
+ break;
+ case RTF_CAPS:
+ nSprm = NS_ooxml::LN_EG_RPrBase_caps;
+ break;
+ default:
+ break;
}
if (nSprm >= 0)
{
@@ -4099,23 +4565,23 @@ int RTFDocumentImpl::dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam
switch (nKeyword)
{
- case RTF_ASPALPHA:
- m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, pBoolValue);
- break;
- case RTF_DELETED:
- case RTF_REVISED:
- {
- RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_DELETED ? OOXML_del : OOXML_ins));
- lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
- NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue);
- }
- break;
- default:
- {
- SAL_INFO("writerfilter", "TODO handle toggle '" << lcl_RtfToString(nKeyword) << "'");
- aSkip.setParsed(false);
- }
- break;
+ case RTF_ASPALPHA:
+ m_aStates.top().aParagraphSprms.set(NS_ooxml::LN_CT_PPrBase_autoSpaceDE, pBoolValue);
+ break;
+ case RTF_DELETED:
+ case RTF_REVISED:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(nKeyword == RTF_DELETED ? OOXML_del : OOXML_ins));
+ lcl_putNestedAttribute(m_aStates.top().aCharacterSprms,
+ NS_ooxml::LN_trackchange, NS_ooxml::LN_token, pValue);
+ }
+ break;
+ default:
+ {
+ SAL_INFO("writerfilter", "TODO handle toggle '" << lcl_RtfToString(nKeyword) << "'");
+ aSkip.setParsed(false);
+ }
+ break;
}
return 0;
}
@@ -4141,35 +4607,35 @@ int RTFDocumentImpl::pushState()
switch (m_aStates.top().nDestinationState)
{
- case DESTINATION_FONTTABLE:
- m_aStates.top().nDestinationState = DESTINATION_FONTENTRY;
- break;
- case DESTINATION_STYLESHEET:
- m_aStates.top().nDestinationState = DESTINATION_STYLEENTRY;
- break;
- case DESTINATION_FIELDRESULT:
- case DESTINATION_SHAPETEXT:
- case DESTINATION_FORMFIELD:
- case DESTINATION_FIELDINSTRUCTION:
- case DESTINATION_PICT:
- m_aStates.top().nDestinationState = DESTINATION_NORMAL;
- break;
- case DESTINATION_MNUM:
- case DESTINATION_MDEN:
- case DESTINATION_ME:
- case DESTINATION_MFNAME:
- case DESTINATION_MLIM:
- case DESTINATION_MSUB:
- case DESTINATION_MSUP:
- case DESTINATION_MDEG:
- case DESTINATION_MOMATH:
- m_aStates.top().nDestinationState = DESTINATION_MR;
- break;
- case DESTINATION_REVISIONTABLE:
- m_aStates.top().nDestinationState = DESTINATION_REVISIONENTRY;
- break;
- default:
- break;
+ case DESTINATION_FONTTABLE:
+ m_aStates.top().nDestinationState = DESTINATION_FONTENTRY;
+ break;
+ case DESTINATION_STYLESHEET:
+ m_aStates.top().nDestinationState = DESTINATION_STYLEENTRY;
+ break;
+ case DESTINATION_FIELDRESULT:
+ case DESTINATION_SHAPETEXT:
+ case DESTINATION_FORMFIELD:
+ case DESTINATION_FIELDINSTRUCTION:
+ case DESTINATION_PICT:
+ m_aStates.top().nDestinationState = DESTINATION_NORMAL;
+ break;
+ case DESTINATION_MNUM:
+ case DESTINATION_MDEN:
+ case DESTINATION_ME:
+ case DESTINATION_MFNAME:
+ case DESTINATION_MLIM:
+ case DESTINATION_MSUB:
+ case DESTINATION_MSUP:
+ case DESTINATION_MDEG:
+ case DESTINATION_MOMATH:
+ m_aStates.top().nDestinationState = DESTINATION_MR;
+ break;
+ case DESTINATION_REVISIONTABLE:
+ m_aStates.top().nDestinationState = DESTINATION_REVISIONENTRY;
+ break;
+ default:
+ break;
}
return 0;
@@ -4230,663 +4696,663 @@ int RTFDocumentImpl::popState()
switch (aState.nDestinationState)
{
- case DESTINATION_FONTTABLE:
- {
- writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aFontTableEntries));
- Mapper().table(NS_ooxml::LN_FONTTABLE, pTable);
- if (m_nDefaultFontIndex >= 0)
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]));
- lcl_putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pValue);
- }
- }
- break;
- case DESTINATION_STYLESHEET:
- {
- writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStyleTableEntries));
- Mapper().table(NS_ooxml::LN_STYLESHEET, pTable);
- }
- break;
- case DESTINATION_LISTOVERRIDETABLE:
- {
- RTFSprms aListTableAttributes;
- writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms));
- RTFReferenceTable::Entries_t aListTableEntries;
- aListTableEntries.insert(make_pair(0, pProp));
- writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries));
- Mapper().table(NS_ooxml::LN_NUMBERING, pTable);
- }
- break;
- case DESTINATION_LISTENTRY:
- for (RTFSprms::Iterator_t i = aState.aListLevelEntries.begin(); i != aState.aListLevelEntries.end(); ++i)
- aState.aTableSprms.set(i->first, i->second, OVERWRITE_NO_APPEND);
- break;
- case DESTINATION_FIELDINSTRUCTION:
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aFormfieldAttributes, m_aFormfieldSprms));
- RTFSprms aFFAttributes;
- RTFSprms aFFSprms;
- aFFSprms.set(NS_ooxml::LN_ffdata, pValue);
- writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aFFAttributes, aFFSprms));
- Mapper().props(pProperties);
- m_aFormfieldAttributes.clear();
- m_aFormfieldSprms.clear();
- singleChar(0x14);
- }
- break;
- case DESTINATION_FIELDRESULT:
- singleChar(0x15);
- break;
- case DESTINATION_LEVELTEXT:
- {
- OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
-
- // The first character is the length of the string (the rest should be ignored).
- sal_Int32 nLength(aStr.toChar());
- OUString aValue;
- if (nLength <= aStr.getLength())
- aValue = aStr.copy(1, nLength);
- else
- aValue = aStr;
- RTFValue::Pointer_t pValue(new RTFValue(aValue, true));
- aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
- }
- break;
- case DESTINATION_LEVELNUMBERS:
- if (aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText))
- {
- RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes();
- RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val);
- OUString aOrig = pValue->getString();
+ case DESTINATION_FONTTABLE:
+ {
+ writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aFontTableEntries));
+ Mapper().table(NS_ooxml::LN_FONTTABLE, pTable);
+ if (m_nDefaultFontIndex >= 0)
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aFontNames[getFontIndex(m_nDefaultFontIndex)]));
+ lcl_putNestedAttribute(m_aDefaultState.aCharacterSprms, NS_ooxml::LN_EG_RPrBase_rFonts, NS_ooxml::LN_CT_Fonts_ascii, pValue);
+ }
+ }
+ break;
+ case DESTINATION_STYLESHEET:
+ {
+ writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(m_aStyleTableEntries));
+ Mapper().table(NS_ooxml::LN_STYLESHEET, pTable);
+ }
+ break;
+ case DESTINATION_LISTOVERRIDETABLE:
+ {
+ RTFSprms aListTableAttributes;
+ writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, m_aListTableSprms));
+ RTFReferenceTable::Entries_t aListTableEntries;
+ aListTableEntries.insert(make_pair(0, pProp));
+ writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries));
+ Mapper().table(NS_ooxml::LN_NUMBERING, pTable);
+ }
+ break;
+ case DESTINATION_LISTENTRY:
+ for (RTFSprms::Iterator_t i = aState.aListLevelEntries.begin(); i != aState.aListLevelEntries.end(); ++i)
+ aState.aTableSprms.set(i->first, i->second, OVERWRITE_NO_APPEND);
+ break;
+ case DESTINATION_FIELDINSTRUCTION:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aFormfieldAttributes, m_aFormfieldSprms));
+ RTFSprms aFFAttributes;
+ RTFSprms aFFSprms;
+ aFFSprms.set(NS_ooxml::LN_ffdata, pValue);
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aFFAttributes, aFFSprms));
+ Mapper().props(pProperties);
+ m_aFormfieldAttributes.clear();
+ m_aFormfieldSprms.clear();
+ singleChar(0x14);
+ }
+ break;
+ case DESTINATION_FIELDRESULT:
+ singleChar(0x15);
+ break;
+ case DESTINATION_LEVELTEXT:
+ {
+ OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
- OUStringBuffer aBuf;
- sal_Int32 nReplaces = 1;
- for (int i = 0; i < aOrig.getLength(); i++)
- {
- if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), i+1)
- != aState.aLevelNumbers.end())
- {
- aBuf.append('%');
- // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2.
- aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 - aState.aLevelNumbers.size()));
- }
- else
- aBuf.append(aOrig.copy(i, 1));
- }
+ // The first character is the length of the string (the rest should be ignored).
+ sal_Int32 nLength(aStr.toChar());
+ OUString aValue;
+ if (nLength <= aStr.getLength())
+ aValue = aStr.copy(1, nLength);
+ else
+ aValue = aStr;
+ RTFValue::Pointer_t pValue(new RTFValue(aValue, true));
+ aState.aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
+ }
+ break;
+ case DESTINATION_LEVELNUMBERS:
+ if (aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText))
+ {
+ RTFSprms& rAttributes = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_lvlText)->getAttributes();
+ RTFValue::Pointer_t pValue = rAttributes.find(NS_ooxml::LN_CT_LevelText_val);
+ OUString aOrig = pValue->getString();
- pValue->setString(aBuf.makeStringAndClear());
- }
- break;
- case DESTINATION_SHAPEPROPERTYNAME:
- aState.aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(), OUString()));
- break;
- case DESTINATION_SHAPEPROPERTYVALUE:
- if (aState.aShape.aProperties.size())
+ OUStringBuffer aBuf;
+ sal_Int32 nReplaces = 1;
+ for (int i = 0; i < aOrig.getLength(); i++)
{
- aState.aShape.aProperties.back().second = m_aStates.top().aDestinationText.makeStringAndClear();
- if (m_aStates.top().bHadShapeText)
- m_pSdrImport->append(aState.aShape.aProperties.back().first, aState.aShape.aProperties.back().second);
- else if (aState.bInShapeGroup && !aState.bInShape && aState.aShape.aProperties.back().first == "rotation")
+ if (std::find(aState.aLevelNumbers.begin(), aState.aLevelNumbers.end(), i+1)
+ != aState.aLevelNumbers.end())
{
- // Rotation should be applied on the groupshape itself, not on each shape.
- aState.aShape.aGroupProperties.push_back(aState.aShape.aProperties.back());
- aState.aShape.aProperties.pop_back();
+ aBuf.append('%');
+ // '1.1.1' -> '%1.%2.%3', but '1.' (with '2.' prefix omitted) is %2.
+ aBuf.append(sal_Int32(nReplaces++ + aState.nListLevelNum + 1 - aState.aLevelNumbers.size()));
}
+ else
+ aBuf.append(aOrig.copy(i, 1));
}
- break;
- case DESTINATION_PICPROP:
- case DESTINATION_SHAPEINSTRUCTION:
- // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
- if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
- m_pSdrImport->resolve(m_aStates.top().aShape, true);
- else if (aState.bInShapeGroup && !aState.bInShape)
- {
- // End of a groupshape, as we're in shapegroup, but not in a real shape.
- for (std::vector< std::pair<OUString, OUString> >::iterator i = aState.aShape.aGroupProperties.begin(); i != aState.aShape.aGroupProperties.end(); ++i)
- m_pSdrImport->appendGroupProperty(i->first, i->second);
- aState.aShape.aGroupProperties.clear();
- }
- 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));
- }
- break;
- case DESTINATION_BOOKMARKEND:
- Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().aDestinationText.makeStringAndClear()]));
- break;
- case DESTINATION_PICT:
- resolvePict(true);
- 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);
- }
- break;
- case DESTINATION_FORMFIELDLIST:
+
+ pValue->setString(aBuf.makeStringAndClear());
+ }
+ break;
+ case DESTINATION_SHAPEPROPERTYNAME:
+ aState.aShape.aProperties.push_back(make_pair(m_aStates.top().aDestinationText.makeStringAndClear(), OUString()));
+ break;
+ case DESTINATION_SHAPEPROPERTYVALUE:
+ if (aState.aShape.aProperties.size())
+ {
+ aState.aShape.aProperties.back().second = m_aStates.top().aDestinationText.makeStringAndClear();
+ if (m_aStates.top().bHadShapeText)
+ m_pSdrImport->append(aState.aShape.aProperties.back().first, aState.aShape.aProperties.back().second);
+ else if (aState.bInShapeGroup && !aState.bInShape && aState.aShape.aProperties.back().first == "rotation")
{
- RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aDestinationText.makeStringAndClear()));
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFDDList_listEntry, pValue);
+ // Rotation should be applied on the groupshape itself, not on each shape.
+ aState.aShape.aGroupProperties.push_back(aState.aShape.aProperties.back());
+ aState.aShape.aProperties.pop_back();
}
- break;
- case DESTINATION_DATAFIELD:
+ }
+ break;
+ case DESTINATION_PICPROP:
+ case DESTINATION_SHAPEINSTRUCTION:
+ // Don't trigger a shape import in case we're only leaving the \shpinst of the groupshape itself.
+ if (!m_bObject && !aState.bInListpicture && !aState.bHadShapeText && !(aState.bInShapeGroup && !aState.bInShape))
+ m_pSdrImport->resolve(m_aStates.top().aShape, true);
+ else if (aState.bInShapeGroup && !aState.bInShape)
+ {
+ // End of a groupshape, as we're in shapegroup, but not in a real shape.
+ for (std::vector< std::pair<OUString, OUString> >::iterator i = aState.aShape.aGroupProperties.begin(); i != aState.aShape.aGroupProperties.end(); ++i)
+ m_pSdrImport->appendGroupProperty(i->first, i->second);
+ aState.aShape.aGroupProperties.clear();
+ }
+ 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));
+ }
+ break;
+ case DESTINATION_BOOKMARKEND:
+ Mapper().props(lcl_getBookmarkProperties(m_aBookmarks[m_aStates.top().aDestinationText.makeStringAndClear()]));
+ break;
+ case DESTINATION_PICT:
+ resolvePict(true);
+ 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);
+ }
+ 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);
+ }
+ break;
+ case DESTINATION_DATAFIELD:
+ {
+ OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), aState.nCurrentEncoding);
+ // decode hex dump
+ OStringBuffer aBuf;
+ const char* str = aStr.getStr();
+ int b = 0, count = 2;
+ for (int i = 0; i < aStr.getLength(); ++i)
+ {
+ char ch = str[i];
+ if (ch != 0x0d && ch != 0x0a)
{
- OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), aState.nCurrentEncoding);
- // decode hex dump
- OStringBuffer aBuf;
- const char *str = aStr.getStr();
- int b = 0, count = 2;
- for (int i = 0; i < aStr.getLength(); ++i)
- {
- char ch = str[i];
- if (ch != 0x0d && ch != 0x0a)
- {
- b = b << 4;
- sal_Int8 parsed = m_pTokenizer->asHex(ch);
- if (parsed == -1)
- return ERROR_HEX_INVALID;
- b += parsed;
- count--;
- if (!count)
- {
- aBuf.append((char)b);
- count = 2;
- b = 0;
- }
- }
- }
- aStr = aBuf.makeStringAndClear();
-
- // ignore the first bytes
- if (aStr.getLength() > 8)
- aStr = aStr.copy(8);
- // extract name
- sal_Int32 nLength = aStr.toChar();
- if (!aStr.isEmpty())
- aStr = aStr.copy(1);
- nLength = std::min(nLength, aStr.getLength());
- OString aName = aStr.copy(0, nLength);
- if (aStr.getLength() > nLength)
- aStr = aStr.copy(nLength+1); // zero-terminated string
- else
- aStr = OString();
- // extract default text
- nLength = aStr.toChar();
- if (!aStr.isEmpty())
- aStr = aStr.copy(1);
- RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)));
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
- if (nLength > 0)
+ b = b << 4;
+ sal_Int8 parsed = m_pTokenizer->asHex(ch);
+ if (parsed == -1)
+ return ERROR_HEX_INVALID;
+ b += parsed;
+ count--;
+ if (!count)
{
- OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength()));
- RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
- m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ aBuf.append((char)b);
+ count = 2;
+ b = 0;
}
-
- m_bFormField = false;
}
- break;
- case DESTINATION_CREATIONTIME:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setCreationDate(lcl_getDateTime(aState));
- break;
- case DESTINATION_REVISIONTIME:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setModificationDate(lcl_getDateTime(aState));
- break;
- case DESTINATION_PRINTTIME:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
- break;
- case DESTINATION_AUTHOR:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setAuthor(m_aStates.top().aDestinationText.makeStringAndClear());
- break;
- case DESTINATION_KEYWORDS:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().aDestinationText.makeStringAndClear()));
- break;
- case DESTINATION_COMMENT:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
- break;
- case DESTINATION_SUBJECT:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear());
- break;
- case DESTINATION_DOCCOMM:
- if (m_xDocumentProperties.is())
- m_xDocumentProperties->setDescription(m_aStates.top().aDestinationText.makeStringAndClear());
- break;
- case DESTINATION_OPERATOR:
- case DESTINATION_COMPANY:
+ }
+ aStr = aBuf.makeStringAndClear();
+
+ // ignore the first bytes
+ if (aStr.getLength() > 8)
+ aStr = aStr.copy(8);
+ // extract name
+ sal_Int32 nLength = aStr.toChar();
+ if (!aStr.isEmpty())
+ aStr = aStr.copy(1);
+ nLength = std::min(nLength, aStr.getLength());
+ OString aName = aStr.copy(0, nLength);
+ if (aStr.getLength() > nLength)
+ aStr = aStr.copy(nLength+1); // zero-terminated string
+ else
+ aStr = OString();
+ // extract default text
+ nLength = aStr.toChar();
+ if (!aStr.isEmpty())
+ aStr = aStr.copy(1);
+ RTFValue::Pointer_t pNValue(new RTFValue(OStringToOUString(aName, aState.nCurrentEncoding)));
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFData_name, pNValue);
+ if (nLength > 0)
+ {
+ OString aDefaultText = aStr.copy(0, std::min(nLength, aStr.getLength()));
+ RTFValue::Pointer_t pDValue(new RTFValue(OStringToOUString(aDefaultText, aState.nCurrentEncoding)));
+ m_aFormfieldSprms.set(NS_ooxml::LN_CT_FFTextInput_default, pDValue);
+ }
+
+ m_bFormField = false;
+ }
+ break;
+ case DESTINATION_CREATIONTIME:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setCreationDate(lcl_getDateTime(aState));
+ break;
+ case DESTINATION_REVISIONTIME:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setModificationDate(lcl_getDateTime(aState));
+ break;
+ case DESTINATION_PRINTTIME:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setPrintDate(lcl_getDateTime(aState));
+ break;
+ case DESTINATION_AUTHOR:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setAuthor(m_aStates.top().aDestinationText.makeStringAndClear());
+ break;
+ case DESTINATION_KEYWORDS:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setKeywords(comphelper::string::convertCommaSeparated(m_aStates.top().aDestinationText.makeStringAndClear()));
+ break;
+ case DESTINATION_COMMENT:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setGenerator(m_aStates.top().aDestinationText.makeStringAndClear());
+ break;
+ case DESTINATION_SUBJECT:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setSubject(m_aStates.top().aDestinationText.makeStringAndClear());
+ break;
+ case DESTINATION_DOCCOMM:
+ if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setDescription(m_aStates.top().aDestinationText.makeStringAndClear());
+ break;
+ case DESTINATION_OPERATOR:
+ case DESTINATION_COMPANY:
+ {
+ OUString aName = aState.nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
+ uno::Any aValue = uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear());
+ if (m_xDocumentProperties.is())
+ {
+ uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
+ uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY);
+ uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
+ if (xPropertySetInfo->hasPropertyByName(aName))
+ xPropertySet->setPropertyValue(aName, aValue);
+ else
+ xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE, aValue);
+ }
+ }
+ break;
+ case DESTINATION_OBJDATA:
+ {
+ m_pObjectData.reset(new SvMemoryStream());
+ int b = 0, count = 2;
+
+ // Feed the destination text to a stream.
+ OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
+ const char* str = aStr.getStr();
+ for (int i = 0; i < aStr.getLength(); ++i)
+ {
+ char ch = str[i];
+ if (ch != 0x0d && ch != 0x0a)
{
- OUString aName = aState.nDestinationState == DESTINATION_OPERATOR ? OUString("Operator") : OUString("Company");
- uno::Any aValue = uno::makeAny(m_aStates.top().aDestinationText.makeStringAndClear());
- if (m_xDocumentProperties.is())
+ b = b << 4;
+ sal_Int8 parsed = m_pTokenizer->asHex(ch);
+ if (parsed == -1)
+ return ERROR_HEX_INVALID;
+ b += parsed;
+ count--;
+ if (!count)
{
- uno::Reference<beans::XPropertyContainer> xUserDefinedProperties = m_xDocumentProperties->getUserDefinedProperties();
- uno::Reference<beans::XPropertySet> xPropertySet(xUserDefinedProperties, uno::UNO_QUERY);
- uno::Reference<beans::XPropertySetInfo> xPropertySetInfo = xPropertySet->getPropertySetInfo();
- if (xPropertySetInfo->hasPropertyByName(aName))
- xPropertySet->setPropertyValue(aName, aValue);
- else
- xUserDefinedProperties->addProperty(aName, beans::PropertyAttribute::REMOVABLE, aValue);
+ m_pObjectData->WriteChar((char)b);
+ count = 2;
+ b = 0;
}
}
- break;
- case DESTINATION_OBJDATA:
- {
- m_pObjectData.reset(new SvMemoryStream());
- int b = 0, count = 2;
-
- // Feed the destination text to a stream.
- OString aStr = OUStringToOString(m_aStates.top().aDestinationText.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US);
- const char *str = aStr.getStr();
- for (int i = 0; i < aStr.getLength(); ++i)
- {
- char ch = str[i];
- if (ch != 0x0d && ch != 0x0a)
- {
- b = b << 4;
- sal_Int8 parsed = m_pTokenizer->asHex(ch);
- if (parsed == -1)
- return ERROR_HEX_INVALID;
- b += parsed;
- count--;
- if (!count)
- {
- m_pObjectData->WriteChar( (char)b );
- count = 2;
- b = 0;
- }
- }
- }
+ }
- if (m_pObjectData->Tell())
- {
- m_pObjectData->Seek(0);
-
- // Skip ObjectHeader
- sal_uInt32 nData;
- m_pObjectData->ReadUInt32( nData ); // OLEVersion
- m_pObjectData->ReadUInt32( nData ); // FormatID
- m_pObjectData->ReadUInt32( nData ); // ClassName
- m_pObjectData->SeekRel(nData);
- m_pObjectData->ReadUInt32( nData ); // TopicName
- m_pObjectData->SeekRel(nData);
- m_pObjectData->ReadUInt32( nData ); // ItemName
- m_pObjectData->SeekRel(nData);
- m_pObjectData->ReadUInt32( nData ); // NativeDataSize
- }
+ if (m_pObjectData->Tell())
+ {
+ m_pObjectData->Seek(0);
+
+ // Skip ObjectHeader
+ sal_uInt32 nData;
+ m_pObjectData->ReadUInt32(nData); // OLEVersion
+ m_pObjectData->ReadUInt32(nData); // FormatID
+ m_pObjectData->ReadUInt32(nData); // ClassName
+ m_pObjectData->SeekRel(nData);
+ m_pObjectData->ReadUInt32(nData); // TopicName
+ m_pObjectData->SeekRel(nData);
+ m_pObjectData->ReadUInt32(nData); // ItemName
+ m_pObjectData->SeekRel(nData);
+ m_pObjectData->ReadUInt32(nData); // NativeDataSize
+ }
- uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(m_pObjectData.get()));
- RTFValue::Pointer_t pStreamValue(new RTFValue(xInputStream));
+ uno::Reference<io::XInputStream> xInputStream(new utl::OInputStreamWrapper(m_pObjectData.get()));
+ RTFValue::Pointer_t pStreamValue(new RTFValue(xInputStream));
- RTFSprms aOLEAttributes;
- aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue);
- RTFValue::Pointer_t pValue(new RTFValue(aOLEAttributes));
- m_aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pValue);
- }
+ RTFSprms aOLEAttributes;
+ aOLEAttributes.set(NS_ooxml::LN_inputstream, pStreamValue);
+ RTFValue::Pointer_t pValue(new RTFValue(aOLEAttributes));
+ m_aObjectSprms.set(NS_ooxml::LN_OLEObject_OLEObject, pValue);
+ }
+ break;
+ case DESTINATION_OBJECT:
+ {
+ if (!m_bObject)
+ {
+ // if the object is in a special container we will use the \result
+ // element instead of the \objdata
+ // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination)
break;
- case DESTINATION_OBJECT:
- {
- if (!m_bObject)
- {
- // if the object is in a special container we will use the \result
- // element instead of the \objdata
- // (see RTF_OBJECT in RTFDocumentImpl::dispatchDestination)
- break;
- }
+ }
- RTFSprms aObjAttributes;
- RTFSprms aObjSprms;
- RTFValue::Pointer_t pValue(new RTFValue(m_aObjectAttributes, m_aObjectSprms));
- aObjSprms.set(NS_ooxml::LN_object, pValue);
- writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aObjAttributes, aObjSprms));
- uno::Reference<drawing::XShape> xShape;
- RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape);
- OSL_ASSERT(pShape.get());
- if (pShape.get())
- pShape->getAny() >>= xShape;
- Mapper().startShape(xShape);
- Mapper().props(pProperties);
- Mapper().endShape();
- m_aObjectAttributes.clear();
- m_aObjectSprms.clear();
- m_bObject = false;
- }
- break;
- case DESTINATION_ANNOTATIONDATE:
- {
- OUString aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().aDestinationText.makeStringAndClear().toInt32()),
- aState.nCurrentEncoding));
- RTFValue::Pointer_t pValue(new RTFValue(aStr));
- RTFSprms aAnnAttributes;
- aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue);
- writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAnnAttributes));
- Mapper().props(pProperties);
- }
- break;
- case DESTINATION_ANNOTATIONAUTHOR:
- m_aAuthor = m_aStates.top().aDestinationText.makeStringAndClear();
- break;
- case DESTINATION_ATNID:
- m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear();
- break;
- case DESTINATION_ANNOTATIONREFERENCESTART:
- case DESTINATION_ANNOTATIONREFERENCEEND:
- {
- OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
- RTFValue::Pointer_t pValue(new RTFValue(aStr.toInt32()));
- RTFSprms aAttributes;
- if (aState.nDestinationState == DESTINATION_ANNOTATIONREFERENCESTART)
- aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue);
- else
- aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue);
- writerfilter::Reference<Properties>::Pointer_t pProperties(new RTFReferenceProperties(aAttributes));
- Mapper().props(pProperties);
- }
- break;
- case DESTINATION_ANNOTATIONREFERENCE:
+ RTFSprms aObjAttributes;
+ RTFSprms aObjSprms;
+ RTFValue::Pointer_t pValue(new RTFValue(m_aObjectAttributes, m_aObjectSprms));
+ aObjSprms.set(NS_ooxml::LN_object, pValue);
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aObjAttributes, aObjSprms));
+ uno::Reference<drawing::XShape> xShape;
+ RTFValue::Pointer_t pShape = m_aObjectAttributes.find(NS_ooxml::LN_shape);
+ OSL_ASSERT(pShape.get());
+ if (pShape.get())
+ pShape->getAny() >>= xShape;
+ Mapper().startShape(xShape);
+ Mapper().props(pProperties);
+ Mapper().endShape();
+ m_aObjectAttributes.clear();
+ m_aObjectSprms.clear();
+ m_bObject = false;
+ }
+ break;
+ case DESTINATION_ANNOTATIONDATE:
+ {
+ OUString aStr(OStringToOUString(lcl_DTTM22OString(m_aStates.top().aDestinationText.makeStringAndClear().toInt32()),
+ aState.nCurrentEncoding));
+ RTFValue::Pointer_t pValue(new RTFValue(aStr));
+ RTFSprms aAnnAttributes;
+ aAnnAttributes.set(NS_ooxml::LN_CT_TrackChange_date, pValue);
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAnnAttributes));
+ Mapper().props(pProperties);
+ }
+ break;
+ case DESTINATION_ANNOTATIONAUTHOR:
+ m_aAuthor = m_aStates.top().aDestinationText.makeStringAndClear();
+ break;
+ case DESTINATION_ATNID:
+ m_aAuthorInitials = m_aStates.top().aDestinationText.makeStringAndClear();
+ break;
+ case DESTINATION_ANNOTATIONREFERENCESTART:
+ case DESTINATION_ANNOTATIONREFERENCEEND:
+ {
+ OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+ RTFValue::Pointer_t pValue(new RTFValue(aStr.toInt32()));
+ RTFSprms aAttributes;
+ if (aState.nDestinationState == DESTINATION_ANNOTATIONREFERENCESTART)
+ aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeStart, pValue);
+ else
+ aAttributes.set(NS_ooxml::LN_EG_RangeMarkupElements_commentRangeEnd, pValue);
+ writerfilter::Reference<Properties>::Pointer_t pProperties(new RTFReferenceProperties(aAttributes));
+ Mapper().props(pProperties);
+ }
+ break;
+ case DESTINATION_ANNOTATIONREFERENCE:
+ {
+ OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
+ RTFSprms aAnnAttributes;
+ aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, RTFValue::Pointer_t(new RTFValue(aStr.toInt32())));
+ Mapper().props(writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAnnAttributes)));
+ }
+ break;
+ case DESTINATION_FALT:
+ {
+ OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());
+ RTFValue::Pointer_t pValue(new RTFValue(aStr));
+ aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
+ }
+ break;
+ case DESTINATION_DRAWINGOBJECT:
+ if (m_aStates.top().aDrawingObject.xShape.is())
+ {
+ RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject;
+ uno::Reference<drawing::XShape> xShape(rDrawing.xShape);
+ uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.xPropertySet);
+
+ uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY);
+ bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame");
+
+ // The default is certainly not inline, but then what Word supports is just at-character.
+ xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
+
+ if (bTextFrame)
{
- OUString aStr = m_aStates.top().aDestinationText.makeStringAndClear();
- RTFSprms aAnnAttributes;
- aAnnAttributes.set(NS_ooxml::LN_CT_Markup_id, RTFValue::Pointer_t(new RTFValue(aStr.toInt32())));
- Mapper().props(writerfilter::Reference<Properties>::Pointer_t(new RTFReferenceProperties(aAnnAttributes)));
+ xPropertySet->setPropertyValue("HoriOrientPosition", uno::makeAny((sal_Int32)rDrawing.nLeft));
+ xPropertySet->setPropertyValue("VertOrientPosition", uno::makeAny((sal_Int32)rDrawing.nTop));
}
- break;
- case DESTINATION_FALT:
+ else
{
- OUString aStr(m_aStates.top().aDestinationText.makeStringAndClear());
- RTFValue::Pointer_t pValue(new RTFValue(aStr));
- aState.aTableSprms.set(NS_ooxml::LN_CT_Font_altName, pValue);
+ xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop));
}
- break;
- case DESTINATION_DRAWINGOBJECT:
- if (m_aStates.top().aDrawingObject.xShape.is())
- {
- RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject;
- uno::Reference<drawing::XShape> xShape(rDrawing.xShape);
- uno::Reference<beans::XPropertySet> xPropertySet(rDrawing.xPropertySet);
-
- uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY);
- bool bTextFrame = xServiceInfo->supportsService("com.sun.star.text.TextFrame");
-
- // The default is certainly not inline, but then what Word supports is just at-character.
- xPropertySet->setPropertyValue("AnchorType", uno::makeAny(text::TextContentAnchorType_AT_CHARACTER));
-
- if (bTextFrame)
- {
- xPropertySet->setPropertyValue("HoriOrientPosition", uno::makeAny((sal_Int32)rDrawing.nLeft));
- xPropertySet->setPropertyValue("VertOrientPosition", uno::makeAny((sal_Int32)rDrawing.nTop));
- }
- else
- {
- xShape->setPosition(awt::Point(rDrawing.nLeft, rDrawing.nTop));
- }
- xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom));
+ xShape->setSize(awt::Size(rDrawing.nRight, rDrawing.nBottom));
- if (rDrawing.bHasLineColor)
- xPropertySet->setPropertyValue("LineColor", uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB)));
- if (rDrawing.bHasFillColor)
- xPropertySet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR<<16) + (rDrawing.nFillColorG<<8) + rDrawing.nFillColorB)));
- else if (!bTextFrame)
- // If there is no fill, the Word default is 100% transparency.
- xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100)));
+ if (rDrawing.bHasLineColor)
+ xPropertySet->setPropertyValue("LineColor", uno::makeAny(sal_uInt32((rDrawing.nLineColorR<<16) + (rDrawing.nLineColorG<<8) + rDrawing.nLineColorB)));
+ if (rDrawing.bHasFillColor)
+ xPropertySet->setPropertyValue("FillColor", uno::makeAny(sal_uInt32((rDrawing.nFillColorR<<16) + (rDrawing.nFillColorG<<8) + rDrawing.nFillColorB)));
+ else if (!bTextFrame)
+ // If there is no fill, the Word default is 100% transparency.
+ xPropertySet->setPropertyValue("FillTransparence", uno::makeAny(sal_Int32(100)));
- m_pSdrImport->resolveFLine(xPropertySet, rDrawing.nFLine);
+ m_pSdrImport->resolveFLine(xPropertySet, rDrawing.nFLine);
- if (!m_aStates.top().aDrawingObject.bHadShapeText)
- {
- Mapper().startShape(xShape);
- }
- Mapper().endShape();
- }
- break;
- case DESTINATION_SHAPE:
- m_bNeedCr = m_bNeedCrOrig;
- if (aState.aFrame.inFrame())
- {
- // parBreak modify m_aStates.top() so we can't apply resetFrame directly on aState
- m_aStates.top().resetFrame();
- parBreak();
- // Save this state for later use, so we only reset frame status only for the first shape inside a frame.
- aState = m_aStates.top();
- m_bNeedPap = true;
- }
- break;
- case DESTINATION_MOMATH:
+ if (!m_aStates.top().aDrawingObject.bHadShapeText)
{
- m_aMathBuffer.appendClosingTag(M_TOKEN(oMath));
-
- SvGlobalName aGlobalName(SO3_SM_CLASSID);
- comphelper::EmbeddedObjectContainer aContainer;
- OUString aName;
- uno::Reference<embed::XEmbeddedObject> xObject = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName);
- uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY);
- // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
- // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
- // to RTLD_GLOBAL, so most probably a gcc bug.
- oox::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(dynamic_cast<SfxBaseModel*>(xComponent.get()));
- assert( pImport != NULL );
- if (pImport)
- pImport->readFormulaOoxml(m_aMathBuffer);
- RTFValue::Pointer_t pValue(new RTFValue(xObject));
- RTFSprms aMathAttributes;
- aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
- writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aMathAttributes));
- Mapper().props(pProperties);
- m_aMathBuffer = oox::formulaimport::XmlStreamBuilder();
+ Mapper().startShape(xShape);
}
- break;
- case DESTINATION_MR:
- lcl_DestinationToMath(m_aStates.top().aDestinationText, m_aMathBuffer, m_bMathNor);
- 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;
+ Mapper().endShape();
+ }
+ break;
+ case DESTINATION_SHAPE:
+ m_bNeedCr = m_bNeedCrOrig;
+ if (aState.aFrame.inFrame())
+ {
+ // parBreak modify m_aStates.top() so we can't apply resetFrame directly on aState
+ m_aStates.top().resetFrame();
+ parBreak();
+ // Save this state for later use, so we only reset frame status only for the first shape inside a frame.
+ aState = m_aStates.top();
+ m_bNeedPap = true;
+ }
+ break;
+ case DESTINATION_MOMATH:
+ {
+ m_aMathBuffer.appendClosingTag(M_TOKEN(oMath));
+
+ SvGlobalName aGlobalName(SO3_SM_CLASSID);
+ comphelper::EmbeddedObjectContainer aContainer;
+ OUString aName;
+ uno::Reference<embed::XEmbeddedObject> xObject = aContainer.CreateEmbeddedObject(aGlobalName.GetByteSequence(), aName);
+ uno::Reference<util::XCloseable> xComponent(xObject->getComponent(), uno::UNO_QUERY);
+ // gcc4.4 (and 4.3 and possibly older) have a problem with dynamic_cast directly to the target class,
+ // so help it with an intermediate cast. I'm not sure what exactly the problem is, seems to be unrelated
+ // to RTLD_GLOBAL, so most probably a gcc bug.
+ oox::FormulaImportBase* pImport = dynamic_cast<oox::FormulaImportBase*>(dynamic_cast<SfxBaseModel*>(xComponent.get()));
+ assert(pImport != NULL);
+ if (pImport)
+ pImport->readFormulaOoxml(m_aMathBuffer);
+ RTFValue::Pointer_t pValue(new RTFValue(xObject));
+ RTFSprms aMathAttributes;
+ aMathAttributes.set(NS_ooxml::LN_starmath, pValue);
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aMathAttributes));
+ Mapper().props(pProperties);
+ m_aMathBuffer = oox::formulaimport::XmlStreamBuilder();
+ }
+ break;
+ case DESTINATION_MR:
+ lcl_DestinationToMath(m_aStates.top().aDestinationText, m_aMathBuffer, m_bMathNor);
+ 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_MPOS:
+ case DESTINATION_MVERTJC:
+ case DESTINATION_MSTRIKEH:
+ case DESTINATION_MDEGHIDE:
+ case DESTINATION_MBEGCHR:
+ case DESTINATION_MSEPCHR:
+ case DESTINATION_MENDCHR:
+ case DESTINATION_MSUBHIDE:
+ case DESTINATION_MSUPHIDE:
+ case DESTINATION_MTYPE:
+ case DESTINATION_MGROW:
+ {
+ sal_Int32 nMathToken = 0;
+ switch (aState.nDestinationState)
+ {
case DESTINATION_MCHR:
- case DESTINATION_MPOS:
- case DESTINATION_MVERTJC:
- case DESTINATION_MSTRIKEH:
- case DESTINATION_MDEGHIDE:
- case DESTINATION_MBEGCHR:
- case DESTINATION_MSEPCHR:
- case DESTINATION_MENDCHR:
- case DESTINATION_MSUBHIDE:
- case DESTINATION_MSUPHIDE:
- case DESTINATION_MTYPE:
- case DESTINATION_MGROW:
- {
- sal_Int32 nMathToken = 0;
- switch (aState.nDestinationState)
- {
- case DESTINATION_MCHR:
- nMathToken = M_TOKEN(chr);
- break;
- case DESTINATION_MPOS:
- nMathToken = M_TOKEN(pos);
- break;
- case DESTINATION_MVERTJC:
- nMathToken = M_TOKEN(vertJc);
- break;
- case DESTINATION_MSTRIKEH:
- nMathToken = M_TOKEN(strikeH);
- break;
- case DESTINATION_MDEGHIDE:
- nMathToken = M_TOKEN(degHide);
- break;
- case DESTINATION_MBEGCHR:
- nMathToken = M_TOKEN(begChr);
- break;
- case DESTINATION_MSEPCHR:
- nMathToken = M_TOKEN(sepChr);
- break;
- case DESTINATION_MENDCHR:
- nMathToken = M_TOKEN(endChr);
- break;
- case DESTINATION_MSUBHIDE:
- nMathToken = M_TOKEN(subHide);
- break;
- case DESTINATION_MSUPHIDE:
- nMathToken = M_TOKEN(supHide);
- break;
- case DESTINATION_MTYPE:
- nMathToken = M_TOKEN(type);
- break;
- case DESTINATION_MGROW:
- nMathToken = M_TOKEN(grow);
- break;
- default:
- break;
- }
-
- oox::formulaimport::XmlStream::AttributeList aAttribs;
- aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
- m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs);
- m_aMathBuffer.appendClosingTag(nMathToken);
- }
- 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;
- 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;
- case DESTINATION_MNARY:
- m_aMathBuffer.appendClosingTag(M_TOKEN(nary));
- break;
- case DESTINATION_MNARYPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(naryPr));
- break;
- case DESTINATION_MSUB:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sub));
- break;
- case DESTINATION_MSUP:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sup));
- break;
- case DESTINATION_MLIMUPP:
- m_aMathBuffer.appendClosingTag(M_TOKEN(limUpp));
- break;
- case DESTINATION_MLIMUPPPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(limUppPr));
- break;
- case DESTINATION_MGROUPCHR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(groupChr));
+ nMathToken = M_TOKEN(chr);
break;
- case DESTINATION_MGROUPCHRPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(groupChrPr));
- break;
- case DESTINATION_MBORDERBOX:
- m_aMathBuffer.appendClosingTag(M_TOKEN(borderBox));
- break;
- case DESTINATION_MBORDERBOXPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(borderBoxPr));
- break;
- case DESTINATION_MRAD:
- m_aMathBuffer.appendClosingTag(M_TOKEN(rad));
- break;
- case DESTINATION_MRADPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(radPr));
- break;
- case DESTINATION_MDEG:
- m_aMathBuffer.appendClosingTag(M_TOKEN(deg));
- break;
- case DESTINATION_MSSUB:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSub));
+ case DESTINATION_MPOS:
+ nMathToken = M_TOKEN(pos);
break;
- case DESTINATION_MSSUBPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSubPr));
+ case DESTINATION_MVERTJC:
+ nMathToken = M_TOKEN(vertJc);
break;
- case DESTINATION_MSSUP:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSup));
+ case DESTINATION_MSTRIKEH:
+ nMathToken = M_TOKEN(strikeH);
break;
- case DESTINATION_MSSUPPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSupPr));
+ case DESTINATION_MDEGHIDE:
+ nMathToken = M_TOKEN(degHide);
break;
- case DESTINATION_MSSUBSUP:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSup));
+ case DESTINATION_MBEGCHR:
+ nMathToken = M_TOKEN(begChr);
break;
- case DESTINATION_MSSUBSUPPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSupPr));
+ case DESTINATION_MSEPCHR:
+ nMathToken = M_TOKEN(sepChr);
break;
- case DESTINATION_MSPRE:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sPre));
+ case DESTINATION_MENDCHR:
+ nMathToken = M_TOKEN(endChr);
break;
- case DESTINATION_MSPREPR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(sPrePr));
+ case DESTINATION_MSUBHIDE:
+ nMathToken = M_TOKEN(subHide);
break;
- case DESTINATION_MBOX:
- m_aMathBuffer.appendClosingTag(M_TOKEN(box));
+ case DESTINATION_MSUPHIDE:
+ nMathToken = M_TOKEN(supHide);
break;
- case DESTINATION_MEQARR:
- m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr));
+ case DESTINATION_MTYPE:
+ nMathToken = M_TOKEN(type);
break;
- case DESTINATION_SHAPEGROUP:
- if (aState.bCreatedShapeGroup)
- m_pSdrImport->popParent();
+ case DESTINATION_MGROW:
+ nMathToken = M_TOKEN(grow);
break;
default:
break;
+ }
+
+ oox::formulaimport::XmlStream::AttributeList aAttribs;
+ aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
+ m_aMathBuffer.appendOpeningTag(nMathToken, aAttribs);
+ m_aMathBuffer.appendClosingTag(nMathToken);
+ }
+ 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;
+ 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;
+ case DESTINATION_MNARY:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(nary));
+ break;
+ case DESTINATION_MNARYPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(naryPr));
+ break;
+ case DESTINATION_MSUB:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sub));
+ break;
+ case DESTINATION_MSUP:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sup));
+ break;
+ case DESTINATION_MLIMUPP:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(limUpp));
+ break;
+ case DESTINATION_MLIMUPPPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(limUppPr));
+ break;
+ case DESTINATION_MGROUPCHR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(groupChr));
+ break;
+ case DESTINATION_MGROUPCHRPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(groupChrPr));
+ break;
+ case DESTINATION_MBORDERBOX:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(borderBox));
+ break;
+ case DESTINATION_MBORDERBOXPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(borderBoxPr));
+ break;
+ case DESTINATION_MRAD:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(rad));
+ break;
+ case DESTINATION_MRADPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(radPr));
+ break;
+ case DESTINATION_MDEG:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(deg));
+ break;
+ case DESTINATION_MSSUB:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSub));
+ break;
+ case DESTINATION_MSSUBPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSubPr));
+ break;
+ case DESTINATION_MSSUP:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSup));
+ break;
+ case DESTINATION_MSSUPPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSupPr));
+ break;
+ case DESTINATION_MSSUBSUP:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSup));
+ break;
+ case DESTINATION_MSSUBSUPPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sSubSupPr));
+ break;
+ case DESTINATION_MSPRE:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sPre));
+ break;
+ case DESTINATION_MSPREPR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(sPrePr));
+ break;
+ case DESTINATION_MBOX:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(box));
+ break;
+ case DESTINATION_MEQARR:
+ m_aMathBuffer.appendClosingTag(M_TOKEN(eqArr));
+ break;
+ case DESTINATION_SHAPEGROUP:
+ if (aState.bCreatedShapeGroup)
+ m_pSdrImport->popParent();
+ break;
+ default:
+ break;
}
// See if we need to end a track change
@@ -4917,211 +5383,212 @@ int RTFDocumentImpl::popState()
// list table
switch (aState.nDestinationState)
{
- case DESTINATION_LISTENTRY:
- {
- RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
- m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, OVERWRITE_NO_APPEND);
- }
- break;
- case DESTINATION_PARAGRAPHNUMBERING:
- {
- RTFValue::Pointer_t pIdValue = aState.aTableAttributes.find(NS_ooxml::LN_CT_AbstractNum_nsid);
- if (pIdValue.get())
- {
- // Abstract numbering
- RTFSprms aLeveltextAttributes;
- OUString aTextValue;
- RTFValue::Pointer_t pTextBefore = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val);
- if (pTextBefore.get())
- aTextValue += pTextBefore->getString();
- aTextValue += "%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));
- aLeveltextAttributes.set(NS_ooxml::LN_CT_LevelText_val, pTextValue);
-
- RTFSprms aLevelAttributes;
- RTFSprms aLevelSprms;
- RTFValue::Pointer_t pIlvlValue(new RTFValue(0));
- aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue);
-
- RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt);
- if (pFmtValue.get())
- aLevelSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pFmtValue);
-
- RTFValue::Pointer_t pStartatValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_start);
- if (pStartatValue.get())
- aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue);
-
- RTFValue::Pointer_t pLeveltextValue(new RTFValue(aLeveltextAttributes));
- aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue);
- RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr);
- if (pRunProps.get())
- aLevelSprms.set(NS_ooxml::LN_CT_Lvl_rPr, pRunProps);
-
- RTFSprms aAbstractAttributes;
- RTFSprms aAbstractSprms;
- aAbstractAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIdValue);
- RTFValue::Pointer_t pLevelValue(new RTFValue(aLevelAttributes, aLevelSprms));
- aAbstractSprms.set(NS_ooxml::LN_CT_AbstractNum_lvl, pLevelValue, OVERWRITE_NO_APPEND);
-
- RTFSprms aListTableSprms;
- RTFValue::Pointer_t pAbstractValue(new RTFValue(aAbstractAttributes, aAbstractSprms));
- // It's important that Numbering_abstractNum and Numbering_num never overwrites previous values.
- aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pAbstractValue, OVERWRITE_NO_APPEND);
-
- // Numbering
- RTFSprms aNumberingAttributes;
- RTFSprms aNumberingSprms;
- aNumberingAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIdValue);
- aNumberingSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIdValue);
- RTFValue::Pointer_t pNumberingValue(new RTFValue(aNumberingAttributes, aNumberingSprms));
- aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pNumberingValue, OVERWRITE_NO_APPEND);
-
- // Table
- RTFSprms aListTableAttributes;
- writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, aListTableSprms));
-
- RTFReferenceTable::Entries_t aListTableEntries;
- aListTableEntries.insert(make_pair(0, pProp));
- writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries));
- Mapper().table(NS_ooxml::LN_NUMBERING, pTable);
-
- // Use it
- lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIlvlValue);
- lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_NumPr_numId, pIdValue);
- }
- }
- break;
- case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
- {
- RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue);
- }
- break;
- case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
- {
- RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
- m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
- }
- break;
- case DESTINATION_LISTLEVEL:
- {
- RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++));
- aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue);
+ case DESTINATION_LISTENTRY:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
+ m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pValue, OVERWRITE_NO_APPEND);
+ }
+ break;
+ case DESTINATION_PARAGRAPHNUMBERING:
+ {
+ RTFValue::Pointer_t pIdValue = aState.aTableAttributes.find(NS_ooxml::LN_CT_AbstractNum_nsid);
+ if (pIdValue.get())
+ {
+ // Abstract numbering
+ RTFSprms aLeveltextAttributes;
+ OUString aTextValue;
+ RTFValue::Pointer_t pTextBefore = aState.aTableAttributes.find(NS_ooxml::LN_CT_LevelText_val);
+ if (pTextBefore.get())
+ aTextValue += pTextBefore->getString();
+ aTextValue += "%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));
+ aLeveltextAttributes.set(NS_ooxml::LN_CT_LevelText_val, pTextValue);
+
+ RTFSprms aLevelAttributes;
+ RTFSprms aLevelSprms;
+ RTFValue::Pointer_t pIlvlValue(new RTFValue(0));
+ aLevelAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pIlvlValue);
+
+ RTFValue::Pointer_t pFmtValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_numFmt);
+ if (pFmtValue.get())
+ aLevelSprms.set(NS_ooxml::LN_CT_Lvl_numFmt, pFmtValue);
+
+ RTFValue::Pointer_t pStartatValue = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_start);
+ if (pStartatValue.get())
+ aLevelSprms.set(NS_ooxml::LN_CT_Lvl_start, pStartatValue);
+
+ RTFValue::Pointer_t pLeveltextValue(new RTFValue(aLeveltextAttributes));
+ aLevelSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pLeveltextValue);
+ RTFValue::Pointer_t pRunProps = aState.aTableSprms.find(NS_ooxml::LN_CT_Lvl_rPr);
+ if (pRunProps.get())
+ aLevelSprms.set(NS_ooxml::LN_CT_Lvl_rPr, pRunProps);
+
+ RTFSprms aAbstractAttributes;
+ RTFSprms aAbstractSprms;
+ aAbstractAttributes.set(NS_ooxml::LN_CT_AbstractNum_abstractNumId, pIdValue);
+ RTFValue::Pointer_t pLevelValue(new RTFValue(aLevelAttributes, aLevelSprms));
+ aAbstractSprms.set(NS_ooxml::LN_CT_AbstractNum_lvl, pLevelValue, OVERWRITE_NO_APPEND);
+
+ RTFSprms aListTableSprms;
+ RTFValue::Pointer_t pAbstractValue(new RTFValue(aAbstractAttributes, aAbstractSprms));
+ // It's important that Numbering_abstractNum and Numbering_num never overwrites previous values.
+ aListTableSprms.set(NS_ooxml::LN_CT_Numbering_abstractNum, pAbstractValue, OVERWRITE_NO_APPEND);
+
+ // Numbering
+ RTFSprms aNumberingAttributes;
+ RTFSprms aNumberingSprms;
+ aNumberingAttributes.set(NS_ooxml::LN_CT_AbstractNum_nsid, pIdValue);
+ aNumberingSprms.set(NS_ooxml::LN_CT_Num_abstractNumId, pIdValue);
+ RTFValue::Pointer_t pNumberingValue(new RTFValue(aNumberingAttributes, aNumberingSprms));
+ aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pNumberingValue, OVERWRITE_NO_APPEND);
+
+ // Table
+ RTFSprms aListTableAttributes;
+ writerfilter::Reference<Properties>::Pointer_t const pProp(new RTFReferenceProperties(aListTableAttributes, aListTableSprms));
+
+ RTFReferenceTable::Entries_t aListTableEntries;
+ aListTableEntries.insert(make_pair(0, pProp));
+ writerfilter::Reference<Table>::Pointer_t const pTable(new RTFReferenceTable(aListTableEntries));
+ Mapper().table(NS_ooxml::LN_NUMBERING, pTable);
+
+ // Use it
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_numPr, NS_ooxml::LN_CT_NumPr_ilvl, pIlvlValue);
+ lcl_putNestedSprm(m_aStates.top().aParagraphSprms, NS_ooxml::LN_CT_PPrBase_tabs, NS_ooxml::LN_CT_NumPr_numId, pIdValue);
+ }
+ }
+ break;
+ case DESTINATION_PARAGRAPHNUMBERING_TEXTAFTER:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelSuffix_val, pValue);
+ }
+ break;
+ case DESTINATION_PARAGRAPHNUMBERING_TEXTBEFORE:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aDestinationText.makeStringAndClear(), true));
+ m_aStates.top().aTableAttributes.set(NS_ooxml::LN_CT_LevelText_val, pValue);
+ }
+ break;
+ case DESTINATION_LISTLEVEL:
+ {
+ RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++));
+ aState.aTableAttributes.set(NS_ooxml::LN_CT_Lvl_ilvl, pInnerValue);
- RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
- if (m_aStates.top().nDestinationState != DESTINATION_LFOLEVEL)
- m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, OVERWRITE_NO_APPEND);
- else
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue);
- }
- break;
- case DESTINATION_LFOLEVEL:
- {
- RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++));
- aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue);
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
+ if (m_aStates.top().nDestinationState != DESTINATION_LFOLEVEL)
+ m_aStates.top().aListLevelEntries.set(NS_ooxml::LN_CT_AbstractNum_lvl, pValue, OVERWRITE_NO_APPEND);
+ else
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_NumLvl_lvl, pValue);
+ }
+ break;
+ case DESTINATION_LFOLEVEL:
+ {
+ RTFValue::Pointer_t pInnerValue(new RTFValue(m_aStates.top().nListLevelNum++));
+ aState.aTableAttributes.set(NS_ooxml::LN_CT_NumLvl_ilvl, pInnerValue);
- RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue);
- }
- break;
- // list override table
- case DESTINATION_LISTOVERRIDEENTRY:
- {
- if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
- { // copy properties upwards so upper popState inserts it
- m_aStates.top().aTableAttributes = aState.aTableAttributes;
- m_aStates.top().aTableSprms = aState.aTableSprms;
- }
- else
- {
- RTFValue::Pointer_t pValue(new RTFValue(
- aState.aTableAttributes, aState.aTableSprms));
- m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, OVERWRITE_NO_APPEND);
- }
- }
- break;
- case DESTINATION_LEVELTEXT:
- {
- RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes));
- m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue);
- }
- break;
- case DESTINATION_LEVELNUMBERS:
- m_aStates.top().aTableSprms = aState.aTableSprms;
- break;
- case DESTINATION_FIELDINSTRUCTION:
- m_aStates.top().nFieldStatus = FIELD_INSTRUCTION;
- break;
- case DESTINATION_FIELDRESULT:
- m_aStates.top().nFieldStatus = FIELD_RESULT;
- break;
- case DESTINATION_FIELD:
- if (aState.nFieldStatus == FIELD_INSTRUCTION)
- singleChar(0x15);
- break;
- case DESTINATION_SHAPEPROPERTYVALUEPICT:
- {
- m_aStates.top().aPicture = aState.aPicture;
- m_aStates.top().aDestinationText = aState.aDestinationText;
- }
- break;
- case DESTINATION_FALT:
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes, aState.aTableSprms));
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Num_lvlOverride, pValue);
+ }
+ break;
+ // list override table
+ case DESTINATION_LISTOVERRIDEENTRY:
+ {
+ if (m_aStates.top().nDestinationState == DESTINATION_LISTOVERRIDEENTRY)
+ {
+ // copy properties upwards so upper popState inserts it
+ m_aStates.top().aTableAttributes = aState.aTableAttributes;
m_aStates.top().aTableSprms = aState.aTableSprms;
- break;
- case DESTINATION_SHAPEPROPERTYNAME:
- case DESTINATION_SHAPEPROPERTYVALUE:
- case DESTINATION_SHAPEPROPERTY:
- {
- m_aStates.top().aShape = aState.aShape;
- m_aStates.top().aPicture = aState.aPicture;
- m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
- }
- break;
- case DESTINATION_FLYMAINCONTENT:
- case DESTINATION_SHPPICT:
- case DESTINATION_SHAPE:
- m_aStates.top().aFrame = aState.aFrame;
- if (aState.nDestinationState == DESTINATION_SHPPICT && !m_aStates.empty() && m_aStates.top().nDestinationState == DESTINATION_LISTPICTURE)
- {
- RTFSprms aAttributes;
- aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, RTFValue::Pointer_t(new RTFValue(m_nListPictureId++)));
- RTFSprms aSprms;
- // Dummy value, real picture is already sent to dmapper.
- aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, RTFValue::Pointer_t(new RTFValue(0)));
- RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
- m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, OVERWRITE_NO_APPEND);
- }
- break;
- case DESTINATION_TITLE:
- {
- if (m_aStates.top().nDestinationState == DESTINATION_TITLE)
- // The parent is a title as well, just append what we have so far.
- m_aStates.top().aDestinationText.append(aState.aDestinationText.makeStringAndClear());
- else if (m_xDocumentProperties.is())
- m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
- }
- break;
- case DESTINATION_SHAPETEXT:
- // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject.
- if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText)
- {
- m_aStates.top().bHadShapeText = true;
- if (!m_aStates.top().pCurrentBuffer)
- m_pSdrImport->close();
- else
- m_aStates.top().pCurrentBuffer->push_back(
- Buf_t(BUFFER_ENDSHAPE));
- }
- break;
- default:
- {
- if (m_aStates.size() && m_aStates.top().nDestinationState == DESTINATION_PICT)
- m_aStates.top().aPicture = aState.aPicture;
- }
- break;
+ }
+ else
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(
+ aState.aTableAttributes, aState.aTableSprms));
+ m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_num, pValue, OVERWRITE_NO_APPEND);
+ }
+ }
+ break;
+ case DESTINATION_LEVELTEXT:
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(aState.aTableAttributes));
+ m_aStates.top().aTableSprms.set(NS_ooxml::LN_CT_Lvl_lvlText, pValue);
+ }
+ break;
+ case DESTINATION_LEVELNUMBERS:
+ m_aStates.top().aTableSprms = aState.aTableSprms;
+ break;
+ case DESTINATION_FIELDINSTRUCTION:
+ m_aStates.top().nFieldStatus = FIELD_INSTRUCTION;
+ break;
+ case DESTINATION_FIELDRESULT:
+ m_aStates.top().nFieldStatus = FIELD_RESULT;
+ break;
+ case DESTINATION_FIELD:
+ if (aState.nFieldStatus == FIELD_INSTRUCTION)
+ singleChar(0x15);
+ break;
+ case DESTINATION_SHAPEPROPERTYVALUEPICT:
+ {
+ m_aStates.top().aPicture = aState.aPicture;
+ m_aStates.top().aDestinationText = aState.aDestinationText;
+ }
+ break;
+ case DESTINATION_FALT:
+ m_aStates.top().aTableSprms = aState.aTableSprms;
+ break;
+ case DESTINATION_SHAPEPROPERTYNAME:
+ case DESTINATION_SHAPEPROPERTYVALUE:
+ case DESTINATION_SHAPEPROPERTY:
+ {
+ m_aStates.top().aShape = aState.aShape;
+ m_aStates.top().aPicture = aState.aPicture;
+ m_aStates.top().aCharacterAttributes = aState.aCharacterAttributes;
+ }
+ break;
+ case DESTINATION_FLYMAINCONTENT:
+ case DESTINATION_SHPPICT:
+ case DESTINATION_SHAPE:
+ m_aStates.top().aFrame = aState.aFrame;
+ if (aState.nDestinationState == DESTINATION_SHPPICT && !m_aStates.empty() && m_aStates.top().nDestinationState == DESTINATION_LISTPICTURE)
+ {
+ RTFSprms aAttributes;
+ aAttributes.set(NS_ooxml::LN_CT_NumPicBullet_numPicBulletId, RTFValue::Pointer_t(new RTFValue(m_nListPictureId++)));
+ RTFSprms aSprms;
+ // Dummy value, real picture is already sent to dmapper.
+ aSprms.set(NS_ooxml::LN_CT_NumPicBullet_pict, RTFValue::Pointer_t(new RTFValue(0)));
+ RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
+ m_aListTableSprms.set(NS_ooxml::LN_CT_Numbering_numPicBullet, pValue, OVERWRITE_NO_APPEND);
+ }
+ break;
+ case DESTINATION_TITLE:
+ {
+ if (m_aStates.top().nDestinationState == DESTINATION_TITLE)
+ // The parent is a title as well, just append what we have so far.
+ m_aStates.top().aDestinationText.append(aState.aDestinationText.makeStringAndClear());
+ else if (m_xDocumentProperties.is())
+ m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
+ }
+ break;
+ case DESTINATION_SHAPETEXT:
+ // If we're leaving the shapetext group (it may have nested ones) and this is a shape, not an old drawingobject.
+ if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT && !m_aStates.top().aDrawingObject.bHadShapeText)
+ {
+ m_aStates.top().bHadShapeText = true;
+ if (!m_aStates.top().pCurrentBuffer)
+ m_pSdrImport->close();
+ else
+ m_aStates.top().pCurrentBuffer->push_back(
+ Buf_t(BUFFER_ENDSHAPE));
+ }
+ break;
+ default:
+ {
+ if (m_aStates.size() && m_aStates.top().nDestinationState == DESTINATION_PICT)
+ m_aStates.top().aPicture = aState.aPicture;
+ }
+ break;
}
if (aState.pCurrentBuffer == &m_aSuperBuffer)
@@ -5202,52 +5669,52 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)
}
}
-RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
+RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
: m_pDocumentImpl(pDocumentImpl),
- nInternalState(INTERNAL_NORMAL),
- nDestinationState(DESTINATION_NORMAL),
- nFieldStatus(FIELD_NONE),
- nBorderState(BORDER_NONE),
- aTableSprms(),
- aTableAttributes(),
- aCharacterSprms(),
- aCharacterAttributes(),
- aParagraphSprms(),
- aParagraphAttributes(),
- aSectionSprms(),
- aSectionAttributes(),
- aTableRowSprms(),
- aTableRowAttributes(),
- aTableCellSprms(),
- aTableCellAttributes(),
- aTabAttributes(),
- aCurrentColor(),
- nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)),
- nUc(1),
- nCharsToSkip(0),
- nBinaryToRead(0),
- nListLevelNum(0),
- aListLevelEntries(),
- aLevelNumbers(),
- aPicture(),
- aShape(),
- aDrawingObject(),
- aFrame(this),
- bIsCjk(false),
- nYear(0),
- nMonth(0),
- nDay(0),
- nHour(0),
- nMinute(0),
- nCurrentStyleIndex(-1),
- pCurrentBuffer(0),
- bInListpicture(false),
- bInBackground(false),
- bHadShapeText(false),
- bInShapeGroup(false),
- bInShape(false),
- bCreatedShapeGroup(false),
- bStartedTrackchange(false)
+ nInternalState(INTERNAL_NORMAL),
+ nDestinationState(DESTINATION_NORMAL),
+ nFieldStatus(FIELD_NONE),
+ nBorderState(BORDER_NONE),
+ aTableSprms(),
+ aTableAttributes(),
+ aCharacterSprms(),
+ aCharacterAttributes(),
+ aParagraphSprms(),
+ aParagraphAttributes(),
+ aSectionSprms(),
+ aSectionAttributes(),
+ aTableRowSprms(),
+ aTableRowAttributes(),
+ aTableCellSprms(),
+ aTableCellAttributes(),
+ aTabAttributes(),
+ aCurrentColor(),
+ nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0)),
+ nUc(1),
+ nCharsToSkip(0),
+ nBinaryToRead(0),
+ nListLevelNum(0),
+ aListLevelEntries(),
+ aLevelNumbers(),
+ aPicture(),
+ aShape(),
+ aDrawingObject(),
+ aFrame(this),
+ bIsCjk(false),
+ nYear(0),
+ nMonth(0),
+ nDay(0),
+ nHour(0),
+ nMinute(0),
+ nCurrentStyleIndex(-1),
+ pCurrentBuffer(0),
+ bInListpicture(false),
+ bInBackground(false),
+ bHadShapeText(false),
+ bInShapeGroup(false),
+ bInShape(false),
+ bCreatedShapeGroup(false),
+ bStartedTrackchange(false)
{
}
@@ -5258,70 +5725,70 @@ void RTFParserState::resetFrame()
RTFColorTableEntry::RTFColorTableEntry()
: nRed(0),
- nGreen(0),
- nBlue(0)
+ nGreen(0),
+ nBlue(0)
{
}
RTFPicture::RTFPicture()
: nWidth(0),
- nHeight(0),
- nGoalWidth(0),
- nGoalHeight(0),
- nScaleX(100),
- nScaleY(100),
- nCropT(0),
- nCropB(0),
- nCropL(0),
- nCropR(0),
- eWMetafile(0),
- nStyle(BMPSTYLE_NONE)
+ nHeight(0),
+ nGoalWidth(0),
+ nGoalHeight(0),
+ nScaleX(100),
+ nScaleY(100),
+ nCropT(0),
+ nCropB(0),
+ nCropL(0),
+ nCropR(0),
+ eWMetafile(0),
+ nStyle(BMPSTYLE_NONE)
{
}
RTFShape::RTFShape()
: nLeft(0),
- nTop(0),
- nRight(0),
- nBottom(0),
- nHoriOrientRelation(0),
- nVertOrientRelation(0),
- nHoriOrientRelationToken(0),
- nVertOrientRelationToken(0),
- nWrap(-1)
+ nTop(0),
+ nRight(0),
+ nBottom(0),
+ nHoriOrientRelation(0),
+ nVertOrientRelation(0),
+ nHoriOrientRelationToken(0),
+ nVertOrientRelationToken(0),
+ nWrap(-1)
{
}
RTFDrawingObject::RTFDrawingObject()
: nLineColorR(0),
- nLineColorG(0),
- nLineColorB(0),
- bHasLineColor(false),
- nFillColorR(0),
- nFillColorG(0),
- nFillColorB(0),
- bHasFillColor(false),
- nDhgt(0),
- nFLine(-1),
- nPolyLineCount(0),
- bHadShapeText(false)
+ nLineColorG(0),
+ nLineColorB(0),
+ bHasLineColor(false),
+ nFillColorR(0),
+ nFillColorG(0),
+ nFillColorB(0),
+ bHasFillColor(false),
+ nDhgt(0),
+ nFLine(-1),
+ nPolyLineCount(0),
+ bHadShapeText(false)
{
}
RTFFrame::RTFFrame(RTFParserState* pParserState)
: m_pParserState(pParserState),
- nX(0),
- nY(0),
- nW(0),
- nH(0),
- nHoriPadding(0),
- nVertPadding(0),
- nHoriAlign(0),
- nHoriAnchor(0),
- nVertAlign(0),
- nVertAnchor(0),
- nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
- nAnchorType(0)
+ nX(0),
+ nY(0),
+ nW(0),
+ nH(0),
+ nHoriPadding(0),
+ nVertPadding(0),
+ nHoriAlign(0),
+ nHoriAnchor(0),
+ nVertAlign(0),
+ nVertAnchor(0),
+ nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
+ nAnchorType(0)
{
}
@@ -5334,41 +5801,41 @@ void RTFFrame::setSprm(Id nId, Id nValue)
}
switch (nId)
{
- case NS_ooxml::LN_CT_FramePr_w:
- nW = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_h:
- nH = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_x:
- nX = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_y:
- nY = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_hSpace:
- nHoriPadding = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_vSpace:
- nVertPadding = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_xAlign:
- nHoriAlign = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_hAnchor:
- nHoriAnchor = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_yAlign:
- nVertAlign = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_vAnchor:
- nVertAnchor = nValue;
- break;
- case NS_ooxml::LN_CT_FramePr_wrap:
- oWrap = nValue;
- break;
- default:
- break;
+ case NS_ooxml::LN_CT_FramePr_w:
+ nW = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_h:
+ nH = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_x:
+ nX = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_y:
+ nY = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_hSpace:
+ nHoriPadding = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_vSpace:
+ nVertPadding = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_xAlign:
+ nHoriAlign = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_hAnchor:
+ nHoriAnchor = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_yAlign:
+ nVertAlign = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_vAnchor:
+ nVertAnchor = nValue;
+ break;
+ case NS_ooxml::LN_CT_FramePr_wrap:
+ oWrap = nValue;
+ break;
+ default:
+ break;
}
}
@@ -5394,77 +5861,77 @@ RTFSprms RTFFrame::getSprms()
NS_ooxml::LN_CT_FramePr_lines
};
- for ( int i = 0, len = SAL_N_ELEMENTS(pNames); i < len; ++i )
+ for (int i = 0, len = SAL_N_ELEMENTS(pNames); i < len; ++i)
{
Id nId = pNames[i];
RTFValue::Pointer_t pValue;
- switch ( nId )
+ switch (nId)
{
- case NS_ooxml::LN_CT_FramePr_x:
- if ( nX != 0 )
- pValue.reset(new RTFValue(nX));
- break;
- case NS_ooxml::LN_CT_FramePr_y:
- if ( nY != 0 )
- pValue.reset(new RTFValue(nY));
- break;
- case NS_ooxml::LN_CT_FramePr_h:
- if ( nH != 0 )
- {
- if (nHRule == NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact)
- pValue.reset(new RTFValue(-nH)); // The negative value just sets nHRule
- else
- pValue.reset(new RTFValue(nH));
- }
- break;
- case NS_ooxml::LN_CT_FramePr_w:
- if ( nW != 0 )
- pValue.reset(new RTFValue(nW));
- break;
- case NS_ooxml::LN_CT_FramePr_hSpace:
- if ( nHoriPadding != 0 )
- pValue.reset(new RTFValue(nHoriPadding));
- break;
- case NS_ooxml::LN_CT_FramePr_vSpace:
- if ( nVertPadding != 0 )
- pValue.reset(new RTFValue(nVertPadding));
- break;
- case NS_ooxml::LN_CT_FramePr_hAnchor:
- {
- if ( nHoriAnchor == 0 )
- nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
- pValue.reset(new RTFValue(nHoriAnchor));
- }
- break;
- case NS_ooxml::LN_CT_FramePr_vAnchor:
- {
- if ( nVertAnchor == 0 )
- nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
- pValue.reset(new RTFValue(nVertAnchor));
- }
- break;
- case NS_ooxml::LN_CT_FramePr_xAlign:
- pValue.reset(new RTFValue(nHoriAlign));
- break;
- case NS_ooxml::LN_CT_FramePr_yAlign:
- pValue.reset(new RTFValue(nVertAlign));
- break;
- case NS_ooxml::LN_CT_FramePr_hRule:
- {
- if ( nH < 0 )
- nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
- else if ( nH > 0 )
- nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
- pValue.reset(new RTFValue(nHRule));
- }
- break;
- case NS_ooxml::LN_CT_FramePr_wrap:
- if (oWrap)
- pValue.reset(new RTFValue(*oWrap));
- break;
- default:
- break;
+ case NS_ooxml::LN_CT_FramePr_x:
+ if (nX != 0)
+ pValue.reset(new RTFValue(nX));
+ break;
+ case NS_ooxml::LN_CT_FramePr_y:
+ if (nY != 0)
+ pValue.reset(new RTFValue(nY));
+ break;
+ case NS_ooxml::LN_CT_FramePr_h:
+ if (nH != 0)
+ {
+ if (nHRule == NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact)
+ pValue.reset(new RTFValue(-nH)); // The negative value just sets nHRule
+ else
+ pValue.reset(new RTFValue(nH));
+ }
+ break;
+ case NS_ooxml::LN_CT_FramePr_w:
+ if (nW != 0)
+ pValue.reset(new RTFValue(nW));
+ break;
+ case NS_ooxml::LN_CT_FramePr_hSpace:
+ if (nHoriPadding != 0)
+ pValue.reset(new RTFValue(nHoriPadding));
+ break;
+ case NS_ooxml::LN_CT_FramePr_vSpace:
+ if (nVertPadding != 0)
+ pValue.reset(new RTFValue(nVertPadding));
+ break;
+ case NS_ooxml::LN_CT_FramePr_hAnchor:
+ {
+ if (nHoriAnchor == 0)
+ nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin;
+ pValue.reset(new RTFValue(nHoriAnchor));
+ }
+ break;
+ case NS_ooxml::LN_CT_FramePr_vAnchor:
+ {
+ if (nVertAnchor == 0)
+ nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin;
+ pValue.reset(new RTFValue(nVertAnchor));
+ }
+ break;
+ case NS_ooxml::LN_CT_FramePr_xAlign:
+ pValue.reset(new RTFValue(nHoriAlign));
+ break;
+ case NS_ooxml::LN_CT_FramePr_yAlign:
+ pValue.reset(new RTFValue(nVertAlign));
+ break;
+ case NS_ooxml::LN_CT_FramePr_hRule:
+ {
+ if (nH < 0)
+ nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
+ else if (nH > 0)
+ nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
+ pValue.reset(new RTFValue(nHRule));
+ }
+ break;
+ case NS_ooxml::LN_CT_FramePr_wrap:
+ if (oWrap)
+ pValue.reset(new RTFValue(*oWrap));
+ break;
+ default:
+ break;
}
if (pValue.get())
@@ -5481,9 +5948,9 @@ RTFSprms RTFFrame::getSprms()
bool RTFFrame::hasProperties()
{
return nX != 0 || nY != 0 || nW != 0 || nH != 0 ||
- nHoriPadding != 0 || nVertPadding != 0 ||
- nHoriAlign != 0 || nHoriAnchor != 0 || nVertAlign != 0 || nVertAnchor != 0 ||
- nAnchorType != 0;
+ nHoriPadding != 0 || nVertPadding != 0 ||
+ nHoriAlign != 0 || nHoriAnchor != 0 || nVertAlign != 0 || nVertAnchor != 0 ||
+ nAnchorType != 0;
}
} // namespace rtftok
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 5b5ff601dffd..616e3ae77c78 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -29,536 +29,547 @@
class SvStream;
-namespace writerfilter {
- namespace rtftok {
- enum RTFBorderState
- {
- BORDER_NONE,
- BORDER_PARAGRAPH,
- BORDER_PARAGRAPH_BOX,
- BORDER_CELL,
- BORDER_PAGE,
- BORDER_CHARACTER
- };
-
- /// Minimalistic buffer of elements for nested cells.
- enum RTFBufferTypes
- {
- BUFFER_PROPS,
- BUFFER_NESTROW,
- BUFFER_CELLEND,
- BUFFER_STARTRUN,
- BUFFER_TEXT,
- BUFFER_UTEXT,
- BUFFER_ENDRUN,
- BUFFER_PAR,
- BUFFER_STARTSHAPE,
- BUFFER_ENDSHAPE
- };
-
- /// Form field types
- enum RTFFormFieldTypes
- {
- FORMFIELD_NONE,
- FORMFIELD_TEXT,
- FORMFIELD_CHECKBOX,
- FORMFIELD_LIST
- };
-
- enum RTFBmpStyles
- {
- BMPSTYLE_NONE,
- BMPSTYLE_PNG,
- BMPSTYLE_JPEG
- };
-
- enum RTFFieldStatus
- {
- FIELD_NONE,
- FIELD_INSTRUCTION,
- FIELD_RESULT
- };
-
- struct TableRowBuffer;
-
- /// A buffer storing dmapper calls.
- typedef ::boost::tuple<RTFBufferTypes, RTFValue::Pointer_t,
- ::boost::shared_ptr<TableRowBuffer> > Buf_t;
- typedef std::deque< Buf_t > RTFBuffer_t;
-
- /// holds one nested table row
- struct TableRowBuffer
- {
- RTFBuffer_t buffer;
- ::std::deque<RTFSprms> cellsSprms;
- ::std::deque<RTFSprms> cellsAttributes;
- int nCells;
- writerfilter::Reference<Properties>::Pointer_t pParaProperties;
- writerfilter::Reference<Properties>::Pointer_t pFrameProperties;
- writerfilter::Reference<Properties>::Pointer_t pRowProperties;
-
- TableRowBuffer(RTFBuffer_t const& rBuffer,
- ::std::deque<RTFSprms> const& rSprms,
- ::std::deque<RTFSprms> const& rAttributes,
- int const i_nCells)
- : buffer(rBuffer)
- , cellsSprms(rSprms), cellsAttributes(rAttributes)
- , nCells(i_nCells)
- {}
- };
-
- /// An entry in the color table.
- class RTFColorTableEntry
- {
- public:
- RTFColorTableEntry();
- sal_uInt8 nRed;
- sal_uInt8 nGreen;
- sal_uInt8 nBlue;
- };
-
- /// Stores the properties of a shape.
- class RTFShape
- {
- public:
- RTFShape();
- std::vector< std::pair<OUString, OUString> > aProperties; ///< Properties of a single shape.
- std::vector< std::pair<OUString, OUString> > aGroupProperties; ///< Properties applied on the groupshape.
- sal_Int32 nLeft;
- sal_Int32 nTop;
- sal_Int32 nRight;
- sal_Int32 nBottom;
- boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
- sal_Int16 nHoriOrientRelation; ///< Horizontal text::RelOrientation for drawinglayer shapes.
- sal_Int16 nVertOrientRelation; ///< Vertical text::RelOrientation for drawinglayer shapes.
- sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures.
- sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures.
- int nWrap;
- };
-
- /// Stores the properties of a drawing object.
- class RTFDrawingObject : public RTFShape
- {
- public:
- RTFDrawingObject();
- uno::Reference<drawing::XShape> xShape;
- uno::Reference<beans::XPropertySet> xPropertySet;
- std::vector<beans::PropertyValue> aPendingProperties;
- sal_uInt8 nLineColorR, nLineColorG, nLineColorB;
- bool bHasLineColor;
- sal_uInt8 nFillColorR, nFillColorG, nFillColorB;
- bool bHasFillColor;
- sal_Int32 nDhgt;
- sal_Int32 nFLine;
- sal_Int32 nPolyLineCount;
- uno::Sequence<awt::Point> aPolyLinePoints;
- bool bHadShapeText;
- };
-
- /// Stores the properties of a picture.
- class RTFPicture
- {
- public:
- RTFPicture();
- sal_uInt16 nWidth, nHeight;
- sal_uInt16 nGoalWidth, nGoalHeight;
- sal_uInt16 nScaleX, nScaleY;
- short nCropT, nCropB, nCropL, nCropR;
- sal_uInt16 eWMetafile;
- RTFBmpStyles nStyle;
- };
-
- class RTFParserState;
-
- /// Stores the properties of a frame
- class RTFFrame
- {
- private:
- RTFParserState* m_pParserState;
- sal_Int32 nX, nY, nW, nH;
- sal_Int32 nHoriPadding, nVertPadding;
- sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
- Id nHRule;
- boost::optional<Id> oWrap;
- public:
- RTFFrame(RTFParserState* pParserState);
- sal_Int16 nAnchorType;
-
- /// Convert the stored properties to Sprms
- RTFSprms getSprms();
- /// Store a property
- void setSprm(Id nId, Id nValue);
- bool hasProperties();
- /// If we got tokens indicating we're in a frame.
- bool inFrame();
- };
-
- class RTFDocumentImpl;
-
- /// State of the parser, which gets saved / restored when changing groups.
- class RTFParserState
- {
- public:
- RTFParserState(RTFDocumentImpl* pDocumentImpl);
- /// Resets aFrame.
- void resetFrame();
-
- RTFDocumentImpl* m_pDocumentImpl;
- RTFInternalState nInternalState;
- RTFDestinationState nDestinationState;
- RTFFieldStatus nFieldStatus;
- RTFBorderState nBorderState;
- // font table, stylesheet table
- RTFSprms aTableSprms;
- RTFSprms aTableAttributes;
- // reset by plain
- RTFSprms aCharacterSprms;
- RTFSprms aCharacterAttributes;
- // reset by pard
- RTFSprms aParagraphSprms;
- RTFSprms aParagraphAttributes;
- // reset by sectd
- RTFSprms aSectionSprms;
- RTFSprms aSectionAttributes;
- // reset by trowd
- RTFSprms aTableRowSprms;
- RTFSprms aTableRowAttributes;
- // reset by cellx
- RTFSprms aTableCellSprms;
- RTFSprms aTableCellAttributes;
- // reset by tx
- RTFSprms aTabAttributes;
-
- RTFColorTableEntry aCurrentColor;
-
- rtl_TextEncoding nCurrentEncoding;
-
- /// Current \uc value.
- int nUc;
- /// Characters to skip, set to nUc by \u.
- int nCharsToSkip;
- /// Characters to read, once in binary mode.
- int nBinaryToRead;
-
- /// Next list level index to use when parsing list table.
- int nListLevelNum;
- /// List level entries, which will form a list entry later.
- RTFSprms aListLevelEntries;
-
- /// List of character positions in leveltext to replace.
- std::vector<sal_Int32> aLevelNumbers;
-
- RTFPicture aPicture;
- RTFShape aShape;
- RTFDrawingObject aDrawingObject;
- RTFFrame aFrame;
-
- /// CJK or CTL?
- bool bIsCjk;
-
- // Info group.
- int nYear;
- int nMonth;
- int nDay;
- int nHour;
- int nMinute;
-
- /// Text from special destinations.
- OUStringBuffer aDestinationText;
-
- /// Index of the current style.
- int nCurrentStyleIndex;
-
- /// Points to the active buffer, if there is one.
- RTFBuffer_t* pCurrentBuffer;
-
- /// If we're inside a \listpicture group.
- bool bInListpicture;
-
- /// If we're inside a \background group.
- bool bInBackground;
-
- bool bHadShapeText;
- bool bInShapeGroup; ///< If we're inside a \shpgrp group.
- bool bInShape; ///< If we're inside a \shp group.
- bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
- bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
- };
-
- /// An RTF stack is similar to std::stack, except that it has an operator[].
- struct RTFStack : public std::deque<RTFParserState>
- {
- RTFParserState & top() { return back(); }
- void pop() { return pop_back(); }
- void push(RTFParserState const& rState) {return push_back(rState);}
- };
-
- class RTFTokenizer;
- class RTFSdrImport;
-
- /// Implementation of the RTFDocument interface.
- class RTFDocumentImpl
- : public RTFDocument, public RTFListener
- {
- public:
- typedef ::boost::shared_ptr<RTFDocumentImpl> Pointer_t;
- RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext,
- uno::Reference<io::XInputStream> const& xInputStream,
- uno::Reference<lang::XComponent> const& xDstDoc,
- uno::Reference<frame::XFrame> const& xFrame,
- uno::Reference<task::XStatusIndicator> const& xStatusIndicator);
- virtual ~RTFDocumentImpl();
-
- // RTFDocument
- virtual void resolve(Stream & rHandler) SAL_OVERRIDE;
- virtual std::string getType() const SAL_OVERRIDE;
-
- // RTFListener
- virtual int dispatchDestination(RTFKeyword nKeyword) SAL_OVERRIDE;
- virtual int dispatchFlag(RTFKeyword nKeyword) SAL_OVERRIDE;
- virtual int dispatchSymbol(RTFKeyword nKeyword) SAL_OVERRIDE;
- virtual int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) SAL_OVERRIDE;
- virtual int dispatchValue(RTFKeyword nKeyword, int nParam) SAL_OVERRIDE;
- virtual int resolveChars(char ch) SAL_OVERRIDE;
- virtual int pushState() SAL_OVERRIDE;
- virtual int popState() SAL_OVERRIDE;
- virtual RTFDestinationState getDestinationState() SAL_OVERRIDE;
- virtual void setDestinationState(RTFDestinationState nDestinationState) SAL_OVERRIDE;
- virtual RTFInternalState getInternalState() SAL_OVERRIDE;
- virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE;
- virtual bool getSkipUnknown() SAL_OVERRIDE;
- virtual void setSkipUnknown(bool bSkipUnknown) SAL_OVERRIDE;
- virtual void finishSubstream() SAL_OVERRIDE;
- virtual bool isSubstream() const SAL_OVERRIDE;
-
- Stream& Mapper();
- void setSubstream(bool bIsSubtream);
- void setSuperstream(RTFDocumentImpl *pSuperstream);
- void setStreamType(Id nId);
- void setAuthor(OUString& rAuthor);
- void setAuthorInitials(OUString& rAuthorInitials);
- void setIgnoreFirst(OUString& rIgnoreFirst);
- void seek(sal_Size nPos);
- uno::Reference<lang::XMultiServiceFactory> getModelFactory();
- bool isInBackground();
- void setDestinationText(OUString& rString);
- /// Resolve a picture: If not inline, then anchored.
- int resolvePict(bool bInline);
-
- /// If this is the first run of the document, starts the initial paragraph.
- void checkFirstRun();
- /// If the initial paragraph is started.
- bool getFirstRun();
- /// If we need to add a dummy paragraph before a section break.
- void setNeedPar(bool bNeedPar);
- /// Return the dmapper index of an RTF index for fonts.
- int getFontIndex(int nIndex);
- /// Return the name of the font, based on a dmapper index.
- OUString getFontName(int nIndex);
- /// Return the style name of an RTF style index.
- OUString getStyleName(int nIndex);
- /// Return the encoding associated with a font index.
- rtl_TextEncoding getEncoding(int nFontIndex);
- /// Get the default parser state.
- RTFParserState& getDefaultState();
- oox::GraphicHelper& getGraphicHelper();
-
- private:
- SvStream& Strm();
- sal_uInt32 getColorTable(sal_uInt32 nIndex);
- RTFSprms mergeSprms();
- RTFSprms mergeAttributes();
- void resetSprms();
- void resetAttributes();
- void resolveSubstream(sal_Size nPos, Id nId);
- void resolveSubstream(sal_Size nPos, Id nId, OUString& rIgnoreFirst);
-
- void text(OUString& rString);
- // Sends a single character to dmapper, taking care of buffering.
- void singleChar(sal_uInt8 nValue, bool bRunProps = false);
- // Sends run properties to dmapper, taking care of buffering.
- void runProps();
- void runBreak();
- void parBreak();
- void tableBreak();
- writerfilter::Reference<Properties>::Pointer_t getProperties(RTFSprms& rAttributes, RTFSprms& rSprms);
- void checkNeedPap();
- void sectBreak(bool bFinal);
- void prepareProperties(
- RTFParserState & rState,
- writerfilter::Reference<Properties>::Pointer_t &,
- writerfilter::Reference<Properties>::Pointer_t &,
- writerfilter::Reference<Properties>::Pointer_t &,
- int const nCells, int const nCurrentCellX);
- /// Send the passed properties to dmapper.
- void sendProperties(
- writerfilter::Reference<Properties>::Pointer_t const&,
- writerfilter::Reference<Properties>::Pointer_t const&,
- writerfilter::Reference<Properties>::Pointer_t const&);
- void replayRowBuffer(RTFBuffer_t & rBuffer,
- ::std::deque<RTFSprms> & rCellsSrpms,
- ::std::deque<RTFSprms> & rCellsAttributes,
- int const nCells);
- void replayBuffer(RTFBuffer_t& rBuffer,
- RTFSprms *const pSprms,
- RTFSprms const*const pAttributes);
- /// If we have some unicode or hex characters to send.
- void checkUnicode(bool bUnicode, bool bHex);
- /// If we need a final section break at the end of the document.
- void setNeedSect(bool bNeedSect = true);
- void resetTableRowProperties();
- void backupTableRowProperties();
- void restoreTableRowProperties();
-
- uno::Reference<uno::XComponentContext> const& m_xContext;
- uno::Reference<io::XInputStream> const& m_xInputStream;
- uno::Reference<lang::XComponent> const& m_xDstDoc;
- uno::Reference<frame::XFrame> const& m_xFrame;
- uno::Reference<task::XStatusIndicator> const& m_xStatusIndicator;
- uno::Reference<lang::XMultiServiceFactory> m_xModelFactory;
- uno::Reference<document::XDocumentProperties> m_xDocumentProperties;
- boost::shared_ptr<SvStream> m_pInStream;
- Stream* m_pMapperStream;
- boost::shared_ptr<RTFSdrImport> m_pSdrImport;
- boost::shared_ptr<RTFTokenizer> m_pTokenizer;
- RTFStack m_aStates;
- /// Read by RTF_PARD.
- RTFParserState m_aDefaultState;
- bool m_bSkipUnknown;
- /// Font index <-> encoding map, *not* part of the parser state
- std::map<int, rtl_TextEncoding> m_aFontEncodings;
- /// Font index <-> name map.
- std::map<int, OUString> m_aFontNames;
- /// Maps the non-continuous font indexes to the continuous dmapper indexes.
- std::vector<int> m_aFontIndexes;
- /// Maps style indexes to style names.
- std::map<int, OUString> m_aStyleNames;
- /// Color index <-> RGB color value map
- std::vector<sal_uInt32> m_aColorTable;
- bool m_bFirstRun;
- /// If paragraph properties should be emitted on next run.
- bool m_bNeedPap;
- /// If we need to emit a CR at the end of substream.
- bool m_bNeedCr;
- /// Original value of m_bNeedCr -- saved/restored before/after textframes.
- bool m_bNeedCrOrig;
- bool m_bNeedPar;
- /// If set, an empty paragraph will be added at the end of the document.
- bool m_bNeedFinalPar;
- /// The list table and list override table combined.
- RTFSprms m_aListTableSprms;
- /// The settings table attributes.
- RTFSprms m_aSettingsTableAttributes;
- /// The settings table sprms.
- RTFSprms m_aSettingsTableSprms;
-
- oox::StorageRef m_xStorage;
- boost::shared_ptr<oox::GraphicHelper> m_pGraphicHelper;
-
- /// cell props buffer for nested tables, reset by \nestrow
- /// the \nesttableprops is a destination and must follow the
- /// nested cells, so it should be sufficient to store the
- /// currently active one, no need for a stack of them
- int m_nNestedCells;
- std::deque<RTFSprms> m_aNestedTableCellsSprms;
- std::deque<RTFSprms> m_aNestedTableCellsAttributes;
- /// cell props buffer for top-level table, reset by \row
- int m_nTopLevelCells;
- std::deque<RTFSprms> m_aTopLevelTableCellsSprms;
- std::deque<RTFSprms> m_aTopLevelTableCellsAttributes;
- /// backup of top-level props, to support inheriting cell props
- int m_nInheritingCells;
- std::deque<RTFSprms> m_aTableInheritingCellsSprms;
- std::deque<RTFSprms> m_aTableInheritingCellsAttributes;
-
- /// Current cellx value (nested table)
- int m_nNestedCurrentCellX;
- /// Current cellx value (top-level table)
- int m_nTopLevelCurrentCellX;
-
- // Backup of what \trowd clears, to work around invalid input.
- RTFSprms m_aBackupTableRowSprms;
- RTFSprms m_aBackupTableRowAttributes;
- int m_nBackupTopLevelCurrentCellX;
-
- /// Buffered table cells, till cell definitions are not reached.
- /// for nested table, one buffer per table level
- std::deque< RTFBuffer_t > m_aTableBufferStack;
- /// Buffered superscript, till footnote is reached (or not).
- RTFBuffer_t m_aSuperBuffer;
-
- bool m_bHasFootnote;
- /// Superstream of this substream.
- RTFDocumentImpl *m_pSuperstream;
- /// Type of the stream: header, footer, footnote, etc.
- Id m_nStreamType;
- std::queue< std::pair<Id, sal_Size> > m_nHeaderFooterPositions;
- sal_Size m_nGroupStartPos;
- /// Ignore the first occurrence of this text.
- OUString m_aIgnoreFirst;
- /// Bookmark name <-> index map.
- std::map<OUString, int> m_aBookmarks;
- /// Revision index <-> author map.
- std::map<int, OUString> m_aAuthors;
- /// Annotation author of the next annotation.
- OUString m_aAuthor;
- /// Initials of author of the next annotation.
- OUString m_aAuthorInitials;
-
- RTFSprms m_aFormfieldSprms;
- RTFSprms m_aFormfieldAttributes;
- RTFFormFieldTypes m_nFormFieldType;
-
- RTFSprms m_aObjectSprms;
- RTFSprms m_aObjectAttributes;
- /** If we are in an object group and if the we use its
- * \objdata element.
- * (if we don't use the \objdata we use the \result element)*/
- bool m_bObject;
- /// Contents of the objdata group.
- boost::shared_ptr<SvStream> m_pObjectData;
- /// If the data for a picture is a binary one, it's stored here.
- boost::shared_ptr<SvStream> m_pBinaryData;
-
- RTFReferenceTable::Entries_t m_aFontTableEntries;
- int m_nCurrentFontIndex;
- /// Used only during font table parsing till we don't know the font name.
- int m_nCurrentEncoding;
- /// Raw default font index, use getFont() on it to get a real one.
- int m_nDefaultFontIndex;
-
- RTFReferenceTable::Entries_t m_aStyleTableEntries;
- int m_nCurrentStyleIndex;
- bool m_bFormField;
- /// If a frame start token is already sent to dmapper (nesting them is not OK).
- bool m_bIsInFrame;
- // Unicode characters are collected here so we don't have to send them one by one.
- OUStringBuffer m_aUnicodeBuffer;
- /// Same for hex characters.
- OStringBuffer m_aHexBuffer;
- /// Formula import.
- oox::formulaimport::XmlStreamBuilder m_aMathBuffer;
- /// Normal text property, that is math italic and math spacing are not applied to the current run.
- bool m_bMathNor;
- /// If the next continuous section break should be ignored.
- bool m_bIgnoreNextContSectBreak;
- /// clean up a synthetic page break, see RTF_PAGE
- /// if inactive value is -1, otherwise the RTF_SKB* to restore
- RTFKeyword m_nResetBreakOnSectBreak;
- /// If a section break is needed before the end of the doc (false right after a section break).
- bool m_bNeedSect;
- /// If aFrame.inFrame() was true in the previous state.
- bool m_bWasInFrame;
- /// A picture was seen in the current paragraph.
- bool m_bHadPicture;
- /// The document has multiple sections.
- bool m_bHadSect;
- /// Max width of the rows in the current table.
- int m_nCellxMax;
- /// ID of the next \listlevel picture.
- int m_nListPictureId;
- };
- } // namespace rtftok
+namespace writerfilter
+{
+namespace rtftok
+{
+enum RTFBorderState
+{
+ BORDER_NONE,
+ BORDER_PARAGRAPH,
+ BORDER_PARAGRAPH_BOX,
+ BORDER_CELL,
+ BORDER_PAGE,
+ BORDER_CHARACTER
+};
+
+/// Minimalistic buffer of elements for nested cells.
+enum RTFBufferTypes
+{
+ BUFFER_PROPS,
+ BUFFER_NESTROW,
+ BUFFER_CELLEND,
+ BUFFER_STARTRUN,
+ BUFFER_TEXT,
+ BUFFER_UTEXT,
+ BUFFER_ENDRUN,
+ BUFFER_PAR,
+ BUFFER_STARTSHAPE,
+ BUFFER_ENDSHAPE
+};
+
+/// Form field types
+enum RTFFormFieldTypes
+{
+ FORMFIELD_NONE,
+ FORMFIELD_TEXT,
+ FORMFIELD_CHECKBOX,
+ FORMFIELD_LIST
+};
+
+enum RTFBmpStyles
+{
+ BMPSTYLE_NONE,
+ BMPSTYLE_PNG,
+ BMPSTYLE_JPEG
+};
+
+enum RTFFieldStatus
+{
+ FIELD_NONE,
+ FIELD_INSTRUCTION,
+ FIELD_RESULT
+};
+
+struct TableRowBuffer;
+
+/// A buffer storing dmapper calls.
+typedef ::boost::tuple<RTFBufferTypes, RTFValue::Pointer_t,
+ ::boost::shared_ptr<TableRowBuffer> > Buf_t;
+typedef std::deque< Buf_t > RTFBuffer_t;
+
+/// holds one nested table row
+struct TableRowBuffer
+{
+ RTFBuffer_t buffer;
+ ::std::deque<RTFSprms> cellsSprms;
+ ::std::deque<RTFSprms> cellsAttributes;
+ int nCells;
+ writerfilter::Reference<Properties>::Pointer_t pParaProperties;
+ writerfilter::Reference<Properties>::Pointer_t pFrameProperties;
+ writerfilter::Reference<Properties>::Pointer_t pRowProperties;
+
+ TableRowBuffer(RTFBuffer_t const& rBuffer,
+ ::std::deque<RTFSprms> const& rSprms,
+ ::std::deque<RTFSprms> const& rAttributes,
+ int const i_nCells)
+ : buffer(rBuffer)
+ , cellsSprms(rSprms), cellsAttributes(rAttributes)
+ , nCells(i_nCells)
+ {}
+};
+
+/// An entry in the color table.
+class RTFColorTableEntry
+{
+public:
+ RTFColorTableEntry();
+ sal_uInt8 nRed;
+ sal_uInt8 nGreen;
+ sal_uInt8 nBlue;
+};
+
+/// Stores the properties of a shape.
+class RTFShape
+{
+public:
+ RTFShape();
+ std::vector< std::pair<OUString, OUString> > aProperties; ///< Properties of a single shape.
+ std::vector< std::pair<OUString, OUString> > aGroupProperties; ///< Properties applied on the groupshape.
+ sal_Int32 nLeft;
+ sal_Int32 nTop;
+ sal_Int32 nRight;
+ sal_Int32 nBottom;
+ boost::optional<sal_Int32> oZ; ///< Z-Order of the shape.
+ sal_Int16 nHoriOrientRelation; ///< Horizontal text::RelOrientation for drawinglayer shapes.
+ sal_Int16 nVertOrientRelation; ///< Vertical text::RelOrientation for drawinglayer shapes.
+ sal_uInt32 nHoriOrientRelationToken; ///< Horizontal dmapper token for Writer pictures.
+ sal_uInt32 nVertOrientRelationToken; ///< Vertical dmapper token for Writer pictures.
+ int nWrap;
+};
+
+/// Stores the properties of a drawing object.
+class RTFDrawingObject : public RTFShape
+{
+public:
+ RTFDrawingObject();
+ uno::Reference<drawing::XShape> xShape;
+ uno::Reference<beans::XPropertySet> xPropertySet;
+ std::vector<beans::PropertyValue> aPendingProperties;
+ sal_uInt8 nLineColorR, nLineColorG, nLineColorB;
+ bool bHasLineColor;
+ sal_uInt8 nFillColorR, nFillColorG, nFillColorB;
+ bool bHasFillColor;
+ sal_Int32 nDhgt;
+ sal_Int32 nFLine;
+ sal_Int32 nPolyLineCount;
+ uno::Sequence<awt::Point> aPolyLinePoints;
+ bool bHadShapeText;
+};
+
+/// Stores the properties of a picture.
+class RTFPicture
+{
+public:
+ RTFPicture();
+ sal_uInt16 nWidth, nHeight;
+ sal_uInt16 nGoalWidth, nGoalHeight;
+ sal_uInt16 nScaleX, nScaleY;
+ short nCropT, nCropB, nCropL, nCropR;
+ sal_uInt16 eWMetafile;
+ RTFBmpStyles nStyle;
+};
+
+class RTFParserState;
+
+/// Stores the properties of a frame
+class RTFFrame
+{
+private:
+ RTFParserState* m_pParserState;
+ sal_Int32 nX, nY, nW, nH;
+ sal_Int32 nHoriPadding, nVertPadding;
+ sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
+ Id nHRule;
+ boost::optional<Id> oWrap;
+public:
+ RTFFrame(RTFParserState* pParserState);
+ sal_Int16 nAnchorType;
+
+ /// Convert the stored properties to Sprms
+ RTFSprms getSprms();
+ /// Store a property
+ void setSprm(Id nId, Id nValue);
+ bool hasProperties();
+ /// If we got tokens indicating we're in a frame.
+ bool inFrame();
+};
+
+class RTFDocumentImpl;
+
+/// State of the parser, which gets saved / restored when changing groups.
+class RTFParserState
+{
+public:
+ RTFParserState(RTFDocumentImpl* pDocumentImpl);
+ /// Resets aFrame.
+ void resetFrame();
+
+ RTFDocumentImpl* m_pDocumentImpl;
+ RTFInternalState nInternalState;
+ RTFDestinationState nDestinationState;
+ RTFFieldStatus nFieldStatus;
+ RTFBorderState nBorderState;
+ // font table, stylesheet table
+ RTFSprms aTableSprms;
+ RTFSprms aTableAttributes;
+ // reset by plain
+ RTFSprms aCharacterSprms;
+ RTFSprms aCharacterAttributes;
+ // reset by pard
+ RTFSprms aParagraphSprms;
+ RTFSprms aParagraphAttributes;
+ // reset by sectd
+ RTFSprms aSectionSprms;
+ RTFSprms aSectionAttributes;
+ // reset by trowd
+ RTFSprms aTableRowSprms;
+ RTFSprms aTableRowAttributes;
+ // reset by cellx
+ RTFSprms aTableCellSprms;
+ RTFSprms aTableCellAttributes;
+ // reset by tx
+ RTFSprms aTabAttributes;
+
+ RTFColorTableEntry aCurrentColor;
+
+ rtl_TextEncoding nCurrentEncoding;
+
+ /// Current \uc value.
+ int nUc;
+ /// Characters to skip, set to nUc by \u.
+ int nCharsToSkip;
+ /// Characters to read, once in binary mode.
+ int nBinaryToRead;
+
+ /// Next list level index to use when parsing list table.
+ int nListLevelNum;
+ /// List level entries, which will form a list entry later.
+ RTFSprms aListLevelEntries;
+
+ /// List of character positions in leveltext to replace.
+ std::vector<sal_Int32> aLevelNumbers;
+
+ RTFPicture aPicture;
+ RTFShape aShape;
+ RTFDrawingObject aDrawingObject;
+ RTFFrame aFrame;
+
+ /// CJK or CTL?
+ bool bIsCjk;
+
+ // Info group.
+ int nYear;
+ int nMonth;
+ int nDay;
+ int nHour;
+ int nMinute;
+
+ /// Text from special destinations.
+ OUStringBuffer aDestinationText;
+
+ /// Index of the current style.
+ int nCurrentStyleIndex;
+
+ /// Points to the active buffer, if there is one.
+ RTFBuffer_t* pCurrentBuffer;
+
+ /// If we're inside a \listpicture group.
+ bool bInListpicture;
+
+ /// If we're inside a \background group.
+ bool bInBackground;
+
+ bool bHadShapeText;
+ bool bInShapeGroup; ///< If we're inside a \shpgrp group.
+ bool bInShape; ///< If we're inside a \shp group.
+ bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
+ bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
+};
+
+/// An RTF stack is similar to std::stack, except that it has an operator[].
+struct RTFStack : public std::deque<RTFParserState>
+{
+ RTFParserState& top()
+ {
+ return back();
+ }
+ void pop()
+ {
+ return pop_back();
+ }
+ void push(RTFParserState const& rState)
+ {
+ return push_back(rState);
+ }
+};
+
+class RTFTokenizer;
+class RTFSdrImport;
+
+/// Implementation of the RTFDocument interface.
+class RTFDocumentImpl
+ : public RTFDocument, public RTFListener
+{
+public:
+ typedef ::boost::shared_ptr<RTFDocumentImpl> Pointer_t;
+ RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& xContext,
+ uno::Reference<io::XInputStream> const& xInputStream,
+ uno::Reference<lang::XComponent> const& xDstDoc,
+ uno::Reference<frame::XFrame> const& xFrame,
+ uno::Reference<task::XStatusIndicator> const& xStatusIndicator);
+ virtual ~RTFDocumentImpl();
+
+ // RTFDocument
+ virtual void resolve(Stream& rHandler) SAL_OVERRIDE;
+ virtual std::string getType() const SAL_OVERRIDE;
+
+ // RTFListener
+ virtual int dispatchDestination(RTFKeyword nKeyword) SAL_OVERRIDE;
+ virtual int dispatchFlag(RTFKeyword nKeyword) SAL_OVERRIDE;
+ virtual int dispatchSymbol(RTFKeyword nKeyword) SAL_OVERRIDE;
+ virtual int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam) SAL_OVERRIDE;
+ virtual int dispatchValue(RTFKeyword nKeyword, int nParam) SAL_OVERRIDE;
+ virtual int resolveChars(char ch) SAL_OVERRIDE;
+ virtual int pushState() SAL_OVERRIDE;
+ virtual int popState() SAL_OVERRIDE;
+ virtual RTFDestinationState getDestinationState() SAL_OVERRIDE;
+ virtual void setDestinationState(RTFDestinationState nDestinationState) SAL_OVERRIDE;
+ virtual RTFInternalState getInternalState() SAL_OVERRIDE;
+ virtual void setInternalState(RTFInternalState nInternalState) SAL_OVERRIDE;
+ virtual bool getSkipUnknown() SAL_OVERRIDE;
+ virtual void setSkipUnknown(bool bSkipUnknown) SAL_OVERRIDE;
+ virtual void finishSubstream() SAL_OVERRIDE;
+ virtual bool isSubstream() const SAL_OVERRIDE;
+
+ Stream& Mapper();
+ void setSubstream(bool bIsSubtream);
+ void setSuperstream(RTFDocumentImpl* pSuperstream);
+ void setStreamType(Id nId);
+ void setAuthor(OUString& rAuthor);
+ void setAuthorInitials(OUString& rAuthorInitials);
+ void setIgnoreFirst(OUString& rIgnoreFirst);
+ void seek(sal_Size nPos);
+ uno::Reference<lang::XMultiServiceFactory> getModelFactory();
+ bool isInBackground();
+ void setDestinationText(OUString& rString);
+ /// Resolve a picture: If not inline, then anchored.
+ int resolvePict(bool bInline);
+
+ /// If this is the first run of the document, starts the initial paragraph.
+ void checkFirstRun();
+ /// If the initial paragraph is started.
+ bool getFirstRun();
+ /// If we need to add a dummy paragraph before a section break.
+ void setNeedPar(bool bNeedPar);
+ /// Return the dmapper index of an RTF index for fonts.
+ int getFontIndex(int nIndex);
+ /// Return the name of the font, based on a dmapper index.
+ OUString getFontName(int nIndex);
+ /// Return the style name of an RTF style index.
+ OUString getStyleName(int nIndex);
+ /// Return the encoding associated with a font index.
+ rtl_TextEncoding getEncoding(int nFontIndex);
+ /// Get the default parser state.
+ RTFParserState& getDefaultState();
+ oox::GraphicHelper& getGraphicHelper();
+
+private:
+ SvStream& Strm();
+ sal_uInt32 getColorTable(sal_uInt32 nIndex);
+ RTFSprms mergeSprms();
+ RTFSprms mergeAttributes();
+ void resetSprms();
+ void resetAttributes();
+ void resolveSubstream(sal_Size nPos, Id nId);
+ void resolveSubstream(sal_Size nPos, Id nId, OUString& rIgnoreFirst);
+
+ void text(OUString& rString);
+ // Sends a single character to dmapper, taking care of buffering.
+ void singleChar(sal_uInt8 nValue, bool bRunProps = false);
+ // Sends run properties to dmapper, taking care of buffering.
+ void runProps();
+ void runBreak();
+ void parBreak();
+ void tableBreak();
+ writerfilter::Reference<Properties>::Pointer_t getProperties(RTFSprms& rAttributes, RTFSprms& rSprms);
+ void checkNeedPap();
+ void sectBreak(bool bFinal);
+ void prepareProperties(
+ RTFParserState& rState,
+ writerfilter::Reference<Properties>::Pointer_t&,
+ writerfilter::Reference<Properties>::Pointer_t&,
+ writerfilter::Reference<Properties>::Pointer_t&,
+ int const nCells, int const nCurrentCellX);
+ /// Send the passed properties to dmapper.
+ void sendProperties(
+ writerfilter::Reference<Properties>::Pointer_t const&,
+ writerfilter::Reference<Properties>::Pointer_t const&,
+ writerfilter::Reference<Properties>::Pointer_t const&);
+ void replayRowBuffer(RTFBuffer_t& rBuffer,
+ ::std::deque<RTFSprms>& rCellsSrpms,
+ ::std::deque<RTFSprms>& rCellsAttributes,
+ int const nCells);
+ void replayBuffer(RTFBuffer_t& rBuffer,
+ RTFSprms* const pSprms,
+ RTFSprms const* const pAttributes);
+ /// If we have some unicode or hex characters to send.
+ void checkUnicode(bool bUnicode, bool bHex);
+ /// If we need a final section break at the end of the document.
+ void setNeedSect(bool bNeedSect = true);
+ void resetTableRowProperties();
+ void backupTableRowProperties();
+ void restoreTableRowProperties();
+
+ uno::Reference<uno::XComponentContext> const& m_xContext;
+ uno::Reference<io::XInputStream> const& m_xInputStream;
+ uno::Reference<lang::XComponent> const& m_xDstDoc;
+ uno::Reference<frame::XFrame> const& m_xFrame;
+ uno::Reference<task::XStatusIndicator> const& m_xStatusIndicator;
+ uno::Reference<lang::XMultiServiceFactory> m_xModelFactory;
+ uno::Reference<document::XDocumentProperties> m_xDocumentProperties;
+ boost::shared_ptr<SvStream> m_pInStream;
+ Stream* m_pMapperStream;
+ boost::shared_ptr<RTFSdrImport> m_pSdrImport;
+ boost::shared_ptr<RTFTokenizer> m_pTokenizer;
+ RTFStack m_aStates;
+ /// Read by RTF_PARD.
+ RTFParserState m_aDefaultState;
+ bool m_bSkipUnknown;
+ /// Font index <-> encoding map, *not* part of the parser state
+ std::map<int, rtl_TextEncoding> m_aFontEncodings;
+ /// Font index <-> name map.
+ std::map<int, OUString> m_aFontNames;
+ /// Maps the non-continuous font indexes to the continuous dmapper indexes.
+ std::vector<int> m_aFontIndexes;
+ /// Maps style indexes to style names.
+ std::map<int, OUString> m_aStyleNames;
+ /// Color index <-> RGB color value map
+ std::vector<sal_uInt32> m_aColorTable;
+ bool m_bFirstRun;
+ /// If paragraph properties should be emitted on next run.
+ bool m_bNeedPap;
+ /// If we need to emit a CR at the end of substream.
+ bool m_bNeedCr;
+ /// Original value of m_bNeedCr -- saved/restored before/after textframes.
+ bool m_bNeedCrOrig;
+ bool m_bNeedPar;
+ /// If set, an empty paragraph will be added at the end of the document.
+ bool m_bNeedFinalPar;
+ /// The list table and list override table combined.
+ RTFSprms m_aListTableSprms;
+ /// The settings table attributes.
+ RTFSprms m_aSettingsTableAttributes;
+ /// The settings table sprms.
+ RTFSprms m_aSettingsTableSprms;
+
+ oox::StorageRef m_xStorage;
+ boost::shared_ptr<oox::GraphicHelper> m_pGraphicHelper;
+
+ /// cell props buffer for nested tables, reset by \nestrow
+ /// the \nesttableprops is a destination and must follow the
+ /// nested cells, so it should be sufficient to store the
+ /// currently active one, no need for a stack of them
+ int m_nNestedCells;
+ std::deque<RTFSprms> m_aNestedTableCellsSprms;
+ std::deque<RTFSprms> m_aNestedTableCellsAttributes;
+ /// cell props buffer for top-level table, reset by \row
+ int m_nTopLevelCells;
+ std::deque<RTFSprms> m_aTopLevelTableCellsSprms;
+ std::deque<RTFSprms> m_aTopLevelTableCellsAttributes;
+ /// backup of top-level props, to support inheriting cell props
+ int m_nInheritingCells;
+ std::deque<RTFSprms> m_aTableInheritingCellsSprms;
+ std::deque<RTFSprms> m_aTableInheritingCellsAttributes;
+
+ /// Current cellx value (nested table)
+ int m_nNestedCurrentCellX;
+ /// Current cellx value (top-level table)
+ int m_nTopLevelCurrentCellX;
+
+ // Backup of what \trowd clears, to work around invalid input.
+ RTFSprms m_aBackupTableRowSprms;
+ RTFSprms m_aBackupTableRowAttributes;
+ int m_nBackupTopLevelCurrentCellX;
+
+ /// Buffered table cells, till cell definitions are not reached.
+ /// for nested table, one buffer per table level
+ std::deque< RTFBuffer_t > m_aTableBufferStack;
+ /// Buffered superscript, till footnote is reached (or not).
+ RTFBuffer_t m_aSuperBuffer;
+
+ bool m_bHasFootnote;
+ /// Superstream of this substream.
+ RTFDocumentImpl* m_pSuperstream;
+ /// Type of the stream: header, footer, footnote, etc.
+ Id m_nStreamType;
+ std::queue< std::pair<Id, sal_Size> > m_nHeaderFooterPositions;
+ sal_Size m_nGroupStartPos;
+ /// Ignore the first occurrence of this text.
+ OUString m_aIgnoreFirst;
+ /// Bookmark name <-> index map.
+ std::map<OUString, int> m_aBookmarks;
+ /// Revision index <-> author map.
+ std::map<int, OUString> m_aAuthors;
+ /// Annotation author of the next annotation.
+ OUString m_aAuthor;
+ /// Initials of author of the next annotation.
+ OUString m_aAuthorInitials;
+
+ RTFSprms m_aFormfieldSprms;
+ RTFSprms m_aFormfieldAttributes;
+ RTFFormFieldTypes m_nFormFieldType;
+
+ RTFSprms m_aObjectSprms;
+ RTFSprms m_aObjectAttributes;
+ /** If we are in an object group and if the we use its
+ * \objdata element.
+ * (if we don't use the \objdata we use the \result element)*/
+ bool m_bObject;
+ /// Contents of the objdata group.
+ boost::shared_ptr<SvStream> m_pObjectData;
+ /// If the data for a picture is a binary one, it's stored here.
+ boost::shared_ptr<SvStream> m_pBinaryData;
+
+ RTFReferenceTable::Entries_t m_aFontTableEntries;
+ int m_nCurrentFontIndex;
+ /// Used only during font table parsing till we don't know the font name.
+ int m_nCurrentEncoding;
+ /// Raw default font index, use getFont() on it to get a real one.
+ int m_nDefaultFontIndex;
+
+ RTFReferenceTable::Entries_t m_aStyleTableEntries;
+ int m_nCurrentStyleIndex;
+ bool m_bFormField;
+ /// If a frame start token is already sent to dmapper (nesting them is not OK).
+ bool m_bIsInFrame;
+ // Unicode characters are collected here so we don't have to send them one by one.
+ OUStringBuffer m_aUnicodeBuffer;
+ /// Same for hex characters.
+ OStringBuffer m_aHexBuffer;
+ /// Formula import.
+ oox::formulaimport::XmlStreamBuilder m_aMathBuffer;
+ /// Normal text property, that is math italic and math spacing are not applied to the current run.
+ bool m_bMathNor;
+ /// If the next continuous section break should be ignored.
+ bool m_bIgnoreNextContSectBreak;
+ /// clean up a synthetic page break, see RTF_PAGE
+ /// if inactive value is -1, otherwise the RTF_SKB* to restore
+ RTFKeyword m_nResetBreakOnSectBreak;
+ /// If a section break is needed before the end of the doc (false right after a section break).
+ bool m_bNeedSect;
+ /// If aFrame.inFrame() was true in the previous state.
+ bool m_bWasInFrame;
+ /// A picture was seen in the current paragraph.
+ bool m_bHadPicture;
+ /// The document has multiple sections.
+ bool m_bHadSect;
+ /// Max width of the rows in the current table.
+ int m_nCellxMax;
+ /// ID of the next \listlevel picture.
+ int m_nListPictureId;
+};
+} // namespace rtftok
} // namespace writerfilter
#endif // INCLUDED_WRITERFILTER_SOURCE_RTFTOK_RTFDOCUMENTIMPL_HXX