20#ifndef INCLUDED_OOX_CORE_CONTEXTHANDLER2_HXX
21#define INCLUDED_OOX_CORE_CONTEXTHANDLER2_HXX
27#include <com/sun/star/uno/Reference.hxx>
30#include <rtl/ustring.hxx>
34 namespace xml::sax {
class XFastAttributeList; }
35 namespace xml::sax {
class XFastContextHandler; }
40 class SequenceInputStream;
75 explicit ContextHandler2Helper(
bool bEnableTrimSpace,
XmlFilterBase& rFilter );
76 explicit ContextHandler2Helper(
const ContextHandler2Helper& rParent );
77 virtual ~ContextHandler2Helper();
80 virtual void SAL_CALL acquire()
noexcept = 0;
81 virtual void SAL_CALL release()
noexcept = 0;
101 virtual void onStartElement(
const AttributeList& rAttribs ) = 0;
114 virtual void onCharacters(
const OUString& rChars ) = 0;
121 virtual void onEndElement() = 0;
143 virtual void onEndRecord() = 0;
148 sal_Int32 getCurrentElement()
const;
151 sal_Int32 getCurrentElementWithMce()
const;
155 bool isCurrentElement( sal_Int32 nElement )
const
156 {
return getCurrentElement() == nElement; }
160 bool isCurrentElement( sal_Int32 nElement1, sal_Int32 nElement2 )
const
161 {
return isCurrentElement( nElement1 ) || isCurrentElement( nElement2 ); }
164 sal_Int32 getParentElement( sal_Int32 nCountBack = 1 )
const;
168 bool isParentElement( sal_Int32 nElement, sal_Int32 nCountBack = 1 )
const
169 {
return getParentElement( nCountBack ) == nElement; }
173 bool isRootElement()
const;
179 css::uno::Reference< css::xml::sax::XFastContextHandler >
180 implCreateChildContext(
182 const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs );
185 void implStartElement(
187 const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs );
190 void implCharacters( std::u16string_view rChars );
193 void implEndElement( sal_Int32 nElement );
202 void implEndRecord( sal_Int32 nRecId );
204 bool prepareMceContext( sal_Int32 nElement,
const AttributeList& rAttribs );
213 MCE_STATE getMCEState()
const {
return aMceState.back(); }
214 void setMCEState( MCE_STATE aState ) { aMceState.back() = aState; }
215 void addMCEState( MCE_STATE aState ) { aMceState.push_back( aState ); }
216 void removeMCEState() { aMceState.pop_back(); }
217 bool isMCEStateEmpty()
const {
return aMceState.empty(); }
220 ContextHandler2Helper& operator=(
const ContextHandler2Helper& ) =
delete;
222 ElementInfo& pushElementInfo( sal_Int32 nElement );
223 void popElementInfo();
224 void processCollectedChars();
227 typedef std::vector< ElementInfo > ContextStack;
228 typedef std::shared_ptr< ContextStack > ContextStackRef;
230 ContextStackRef mxContextStack;
231 size_t mnRootStackSize;
232 std::vector<MCE_STATE> aMceState;
235 bool mbEnableTrimSpace;
251 virtual void SAL_CALL
acquire() noexcept
override { ContextHandler::acquire(); }
252 virtual void SAL_CALL
release() noexcept
override { ContextHandler::release(); }
256 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL
257 createFastChildContext(
259 const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs )
final override;
261 virtual void SAL_CALL startFastElement(
263 const css::uno::Reference< css::xml::sax::XFastAttributeList >& rxAttribs )
final override;
265 virtual void SAL_CALL characters(
const OUString& rChars )
final override;
267 virtual void SAL_CALL endFastElement( sal_Int32 nElement )
final override;
273 virtual void endRecord( sal_Int32 nRecId )
override;
278 virtual void onStartElement(
const AttributeList& rAttribs )
override;
279 virtual void onCharacters(
const OUString& rChars )
override;
280 virtual void onEndElement()
override;
284 virtual void onEndRecord()
override;
Provides access to attribute values of an element.
ContextHandler2(ContextHandler2 &&)=default
virtual void SAL_CALL release() noexcept override
ContextHandler2(ContextHandler2 const &)=default
virtual void SAL_CALL acquire() noexcept override
class OOX_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ContextHandler2Helper
Helper class that provides a context stack.
const sal_Int32 XML_ROOT_CONTEXT
const PowerPointImport & mrFilter
Information about a processed element.