initial RTF_SHPTXT

This commit is contained in:
Miklos Vajna 2011-07-05 20:41:06 +02:00
parent b243bc619c
commit a6ca3eccd2
2 changed files with 21 additions and 2 deletions

View file

@ -278,6 +278,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
m_xStorage(),
m_aTableBuffer(),
m_aSuperBuffer(),
m_aShapetextBuffer(),
m_pCurrentBuffer(0),
m_bHasFootnote(false),
m_bIsSubstream(false),
@ -674,7 +675,9 @@ void RTFDocumentImpl::text(OUString& rString)
RTFValue::Pointer_t pValue;
m_pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue));
}
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL || m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT)
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL
|| m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT
|| m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
{
if (!m_pCurrentBuffer)
{
@ -919,6 +922,11 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().nDestinationState = DESTINATION_SKIP;
}
break;
case RTF_SHPTXT:
m_aStates.top().nDestinationState = DESTINATION_SHAPETEXT;
OSL_ENSURE(!m_aShapetextBuffer.size(), "shapetext buffer is not empty");
m_pCurrentBuffer = &m_aShapetextBuffer;
break;
case RTF_LISTTEXT:
// Should be ignored by any reader that understands Word 97 through Word 2007 numbering.
case RTF_NONESTTABLES:
@ -2338,6 +2346,8 @@ int RTFDocumentImpl::popState()
bPopPictureProperties = true;
aAttributes = m_aStates.top().aCharacterAttributes;
}
else if (m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
m_pCurrentBuffer = 0; // Just disable buffering, don't empty it yet.
// See if we need to end a track change
RTFValue::Pointer_t pTrackchange = RTFSprm::find(m_aStates.top().aCharacterSprms, NS_ooxml::LN_trackchange);
@ -2484,6 +2494,7 @@ void RTFDocumentImpl::resolveShapeProperties(std::vector< std::pair<rtl::OUStrin
m_aStates.top().aShape.nBottom - m_aStates.top().aShape.nTop));
Mapper().startShape(xShape);
replayBuffer(m_aShapetextBuffer);
Mapper().endShape();
}

View file

@ -56,6 +56,9 @@ namespace writerfilter {
INTERNAL_HEX
};
// Note that this is not a 1:1 mapping between destination control
// words, e.g. RTF_PICT gets mapped to DESTINATION_PICT or
// DESTINATION_SHAPEPROPERTYVALUEPICT, etc.
enum RTFDesitnationState
{
DESTINATION_NORMAL,
@ -88,7 +91,8 @@ namespace writerfilter {
DESTINATION_BOOKMARKSTART,
DESTINATION_BOOKMARKEND,
DESTINATION_REVISIONTABLE,
DESTINATION_REVISIONENTRY
DESTINATION_REVISIONENTRY,
DESTINATION_SHAPETEXT
};
enum RTFBorderState
@ -298,7 +302,11 @@ namespace writerfilter {
RTFBuffer_t m_aTableBuffer;
/// Buffered superscript, till footnote is reached (or not).
RTFBuffer_t m_aSuperBuffer;
/// Buffered shape text.
RTFBuffer_t m_aShapetextBuffer;
/// Points to the active buffer, if there is one.
RTFBuffer_t* m_pCurrentBuffer;
bool m_bHasFootnote;
/// If this is a substream.
bool m_bIsSubstream;