Related: fdo#76260 writerfilter: move SavedAlternateStates to OOXMLParserState
Change-Id: Ib9bddeb2d3b5ccdb71295587acbd13c86e5dd28b
This commit is contained in:
parent
012003e468
commit
95e6cc2ecb
3 changed files with 19 additions and 18 deletions
|
@ -150,8 +150,7 @@ OOXMLFastContextHandler::OOXMLFastContextHandler
|
|||
inPositionV(pContext->inPositionV),
|
||||
m_xContext(pContext->m_xContext),
|
||||
m_bDiscardChildren(pContext->m_bDiscardChildren),
|
||||
m_bTookChoice(pContext->m_bTookChoice),
|
||||
m_aSavedAlternateStates(pContext->m_aSavedAlternateStates)
|
||||
m_bTookChoice(pContext->m_bTookChoice)
|
||||
{
|
||||
mpParserState = pContext->mpParserState;
|
||||
|
||||
|
@ -179,7 +178,7 @@ bool OOXMLFastContextHandler::prepareMceContext(Token_t nElement, const uno::Ref
|
|||
m_bDiscardChildren = false;
|
||||
aState.m_bTookChoice = m_bTookChoice;
|
||||
m_bTookChoice = false;
|
||||
m_aSavedAlternateStates.push_back(aState);
|
||||
mpParserState->getSavedAlternateStates().push_back(aState);
|
||||
}
|
||||
break;
|
||||
case OOXML_Choice:
|
||||
|
@ -241,8 +240,8 @@ throw (uno::RuntimeException, xml::sax::SAXException, std::exception)
|
|||
m_bDiscardChildren = false;
|
||||
else if (Element == (NS_mce | OOXML_AlternateContent))
|
||||
{
|
||||
SavedAlternateState aState(m_aSavedAlternateStates.back());
|
||||
m_aSavedAlternateStates.pop_back();
|
||||
SavedAlternateState aState(mpParserState->getSavedAlternateStates().back());
|
||||
mpParserState->getSavedAlternateStates().pop_back();
|
||||
m_bDiscardChildren = aState.m_bDiscardChildren;
|
||||
m_bTookChoice = aState.m_bTookChoice;
|
||||
}
|
||||
|
|
|
@ -43,18 +43,6 @@ namespace ooxml
|
|||
|
||||
typedef boost::shared_ptr<Stream> StreamPointer_t;
|
||||
|
||||
/**
|
||||
* Struct to store our 'alternate state'. If multiple mc:AlternateContent
|
||||
* elements arrive, then while the inner ones are active, the original state is
|
||||
* saved away, and once they inner goes out of scope, the original state is
|
||||
* restored.
|
||||
*/
|
||||
struct SavedAlternateState
|
||||
{
|
||||
bool m_bDiscardChildren;
|
||||
bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
|
||||
};
|
||||
|
||||
class OOXMLFastContextHandler:
|
||||
public ::cppu::WeakImplHelper1<
|
||||
xml::sax::XFastContextHandler>
|
||||
|
@ -290,7 +278,6 @@ private:
|
|||
uno::Reference< uno::XComponentContext > m_xContext;
|
||||
bool m_bDiscardChildren;
|
||||
bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
|
||||
std::vector<SavedAlternateState> m_aSavedAlternateStates;
|
||||
|
||||
static sal_uInt32 mnInstanceCount;
|
||||
|
||||
|
|
|
@ -31,6 +31,18 @@ namespace writerfilter {
|
|||
namespace ooxml
|
||||
{
|
||||
|
||||
/**
|
||||
* Struct to store our 'alternate state'. If multiple mc:AlternateContent
|
||||
* elements arrive, then while the inner ones are active, the original state is
|
||||
* saved away, and once they inner goes out of scope, the original state is
|
||||
* restored.
|
||||
*/
|
||||
struct SavedAlternateState
|
||||
{
|
||||
bool m_bDiscardChildren;
|
||||
bool m_bTookChoice; ///< Did we take the Choice or want Fallback instead?
|
||||
};
|
||||
|
||||
class OOXMLParserState
|
||||
{
|
||||
bool mbInSectionGroup;
|
||||
|
@ -51,6 +63,7 @@ class OOXMLParserState
|
|||
bool savedInParagraphGroup;
|
||||
bool savedInCharacterGroup;
|
||||
bool savedLastParagraphInSection;
|
||||
std::vector<SavedAlternateState> maSavedAlternateStates;
|
||||
|
||||
public:
|
||||
typedef boost::shared_ptr<OOXMLParserState> Pointer_t;
|
||||
|
@ -64,6 +77,8 @@ public:
|
|||
void setLastParagraphInSection(bool bLastParagraphInSection);
|
||||
bool isLastParagraphInSection() const { return mbLastParagraphInSection;}
|
||||
|
||||
std::vector<SavedAlternateState>& getSavedAlternateStates() { return maSavedAlternateStates; }
|
||||
|
||||
bool isInParagraphGroup() const { return mbInParagraphGroup;}
|
||||
void setInParagraphGroup(bool bInParagraphGroup);
|
||||
|
||||
|
|
Loading…
Reference in a new issue