implement RTF_SECT and RTF_SECTD

This commit is contained in:
Miklos Vajna 2011-06-22 17:54:21 +02:00
parent ffddfa7c55
commit 3430986b5c
2 changed files with 34 additions and 4 deletions

View file

@ -161,6 +161,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_aColorTable(),
m_bFirstRun(true),
m_bNeedPap(false),
m_bNeedSep(false),
m_aListTableSprms(),
m_xStorage(),
m_aBuffer(),
@ -427,9 +428,6 @@ void RTFDocumentImpl::text(OUString& rString)
return;
}
writerfilter::Reference<Properties>::Pointer_t const pCharacterProperties(
new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
);
writerfilter::Reference<Properties>::Pointer_t const pParagraphProperties(
new RTFReferenceProperties(m_aStates.top().aParagraphAttributes, m_aStates.top().aParagraphSprms)
);
@ -453,6 +451,18 @@ void RTFDocumentImpl::text(OUString& rString)
}
m_bNeedPap = false;
}
if (m_bNeedSep)
{
writerfilter::Reference<Properties>::Pointer_t const pProperties(
new RTFReferenceProperties(m_aStates.top().aSectionAttributes, m_aStates.top().aSectionSprms)
);
Mapper().props(pProperties);
Mapper().endParagraphGroup();
Mapper().endSectionGroup();
Mapper().startSectionGroup();
Mapper().startParagraphGroup();
m_bNeedSep = false;
}
if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
{
@ -471,7 +481,12 @@ void RTFDocumentImpl::text(OUString& rString)
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL || m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT)
{
if (!m_bTable)
Mapper().props(pCharacterProperties);
{
writerfilter::Reference<Properties>::Pointer_t const pProperties(
new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
);
Mapper().props(pProperties);
}
else
{
RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
@ -624,6 +639,9 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
m_bNeedPap = true;
}
break;
case RTF_SECT:
m_bNeedSep = true;
break;
case RTF_BACKSLASH:
if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION)
m_aStates.top().aFieldInstruction.append('\\');
@ -840,6 +858,10 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
m_bTable = false;
break;
case RTF_SECTD:
m_aStates.top().aSectionSprms = m_aDefaultState.aSectionSprms;
m_aStates.top().aSectionAttributes = m_aDefaultState.aSectionAttributes;
break;
case RTF_TROWD:
m_aStates.top().aTableRowSprms = m_aDefaultState.aTableRowSprms;
m_aStates.top().aTableRowAttributes = m_aDefaultState.aTableRowAttributes;
@ -1936,6 +1958,8 @@ RTFParserState::RTFParserState()
aCharacterAttributes(),
aParagraphSprms(),
aParagraphAttributes(),
aSectionSprms(),
aSectionAttributes(),
aTableRowSprms(),
aTableRowAttributes(),
aTableCellSprms(),

View file

@ -109,6 +109,9 @@ namespace writerfilter {
// reset by pard
RTFSprms_t aParagraphSprms;
RTFSprms_t aParagraphAttributes;
// reset by sectd
RTFSprms_t aSectionSprms;
RTFSprms_t aSectionAttributes;
// reset by trowd
RTFSprms_t aTableRowSprms;
RTFSprms_t aTableRowAttributes;
@ -212,7 +215,10 @@ namespace writerfilter {
/// 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 section properties should be emitted on next run.
bool m_bNeedSep;
/// The list table and list override table combined.
RTFSprms_t m_aListTableSprms;