summaryrefslogtreecommitdiff
path: root/include/oox
diff options
context:
space:
mode:
authorGülşah Köse <gulsah.kose@collabora.com>2021-07-07 00:27:58 +0300
committerGülşah Köse <gulsah.kose@collabora.com>2021-07-08 23:12:07 +0200
commit92a407b7f90a98704a238c5ffa3a3491eaf3263a (patch)
tree24eecc3bbf5e0547167787e71b4573d1af957116 /include/oox
parent3175a7684982e7812e8071c595395eb3da3035fc (diff)
tdf143222 Handle alternate content of graphicData element.
Handle alternate content and make true choice. According to ooxml spec ole object requires exactly one pic element. (ECMA-376 Part 1, Annex A, CT_OleObject). In the current case first choice has not pic element and we should allow fallback processing. Change-Id: I30b7de703b8c2f00d6bf286e05eea505ac3627f2 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/118539 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'include/oox')
-rw-r--r--include/oox/core/contexthandler2.hxx19
-rw-r--r--include/oox/core/fragmenthandler2.hxx11
-rw-r--r--include/oox/drawingml/graphicshapecontext.hxx1
-rw-r--r--include/oox/ole/oleobjecthelper.hxx1
4 files changed, 20 insertions, 12 deletions
diff --git a/include/oox/core/contexthandler2.hxx b/include/oox/core/contexthandler2.hxx
index 4e256089ac8e..3a75aff5706a 100644
--- a/include/oox/core/contexthandler2.hxx
+++ b/include/oox/core/contexthandler2.hxx
@@ -72,7 +72,7 @@ struct ElementInfo;
class OOX_DLLPUBLIC ContextHandler2Helper
{
public:
- explicit ContextHandler2Helper( bool bEnableTrimSpace );
+ explicit ContextHandler2Helper( bool bEnableTrimSpace, XmlFilterBase& rFilter );
explicit ContextHandler2Helper( const ContextHandler2Helper& rParent );
virtual ~ContextHandler2Helper();
@@ -201,6 +201,21 @@ protected:
/** Must be called from endRecord() in derived classes. */
void implEndRecord( sal_Int32 nRecId );
+ bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
+ XmlFilterBase& getDocFilter() const { return mrFilter; }
+
+ enum class MCE_STATE
+ {
+ Started,
+ FoundChoice
+ };
+
+ MCE_STATE getMCEState() const { return aMceState.back(); }
+ void setMCEState( MCE_STATE aState ) { aMceState.back() = aState; }
+ void addMCEState( MCE_STATE aState ) { aMceState.push_back( aState ); }
+ void removeMCEState() { aMceState.pop_back(); }
+ bool isMCEStateEmpty() { return aMceState.empty(); }
+
private:
ContextHandler2Helper& operator=( const ContextHandler2Helper& ) = delete;
@@ -214,9 +229,11 @@ private:
ContextStackRef mxContextStack; ///< Stack of all processed elements.
size_t mnRootStackSize; ///< Stack size on construction time.
+ std::vector<MCE_STATE> aMceState;
protected:
bool mbEnableTrimSpace; ///< True = trim whitespace in characters().
+ XmlFilterBase& mrFilter;
};
class OOX_DLLPUBLIC ContextHandler2 : public ContextHandler, public ContextHandler2Helper
diff --git a/include/oox/core/fragmenthandler2.hxx b/include/oox/core/fragmenthandler2.hxx
index 86d1453f13a1..598426ee681e 100644
--- a/include/oox/core/fragmenthandler2.hxx
+++ b/include/oox/core/fragmenthandler2.hxx
@@ -47,17 +47,6 @@ class XmlFilterBase;
class OOX_DLLPUBLIC FragmentHandler2 : public FragmentHandler, public ContextHandler2Helper
{
-protected:
- enum class MCE_STATE
- {
- Started,
- FoundChoice
- };
- ::std::vector<MCE_STATE> aMceState;
-
- bool prepareMceContext( sal_Int32 nElement, const AttributeList& rAttribs );
-
-
public:
explicit FragmentHandler2(
XmlFilterBase& rFilter,
diff --git a/include/oox/drawingml/graphicshapecontext.hxx b/include/oox/drawingml/graphicshapecontext.hxx
index 4813d5fc9aed..ffd579f00bb1 100644
--- a/include/oox/drawingml/graphicshapecontext.hxx
+++ b/include/oox/drawingml/graphicshapecontext.hxx
@@ -62,6 +62,7 @@ public:
OleObjectGraphicDataContext( ::oox::core::ContextHandler2Helper const & rParent, const ShapePtr& pShapePtr );
virtual ~OleObjectGraphicDataContext() override;
virtual ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) override;
+ virtual void onEndElement() override;
private:
::oox::vml::OleObjectInfo& mrOleObjectInfo;
diff --git a/include/oox/ole/oleobjecthelper.hxx b/include/oox/ole/oleobjecthelper.hxx
index d2506f3d4949..5b792f2048b1 100644
--- a/include/oox/ole/oleobjecthelper.hxx
+++ b/include/oox/ole/oleobjecthelper.hxx
@@ -47,6 +47,7 @@ struct OleObjectInfo
bool mbLinked; ///< True = linked OLE object, false = embedded OLE object.
bool mbShowAsIcon; ///< True = show as icon, false = show contents.
bool mbAutoUpdate;
+ bool mbHasPicture; ///<Ole object requires a picture element according to spec.>
explicit OleObjectInfo();
};