diff options
author | Attila Bakos (NISZ) <bakos.attilakaroly@nisz.hu> | 2022-01-19 17:43:54 +0100 |
---|---|---|
committer | László Németh <nemeth@numbertext.org> | 2022-02-03 09:12:20 +0100 |
commit | 4a38ca4035ac03571925e72cb47e0beb8da2003a (patch) | |
tree | 6c472f1efe01827320bfd3ae35404f38ee18ba9a /oox/source | |
parent | b8925251e48534706c6960a54c320d3879317321 (diff) |
tdf#146802 OOXML import: fix embedded VML in grouped textbox
E.g. OLE formulas inside them broke document load.
Regression from 121cbc250b36290f0f8c7265fea57256dad69553
"tdf#66039 DOCX: import textboxes (with tables, images etc.)
in group shapes".
Note: now embedded VML OLE is loaded in WPG shapes, thanks to
that the ShapeHandler in oox/ has a stack having the start
token inside for each shape.
Change-Id: I973d78ed88c5c83efffd9629061e2a2c6fdd25e4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128627
Tested-by: László Németh <nemeth@numbertext.org>
Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'oox/source')
-rw-r--r-- | oox/source/shape/ShapeContextHandler.cxx | 31 |
1 files changed, 20 insertions, 11 deletions
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx index 6eb9e5ce9083..cacd46d82d14 100644 --- a/oox/source/shape/ShapeContextHandler.cxx +++ b/oox/source/shape/ShapeContextHandler.cxx @@ -44,7 +44,6 @@ using namespace core; using namespace drawingml; ShapeContextHandler::ShapeContextHandler(const rtl::Reference<ShapeFilterBase>& xFilterBase) : - mnStartToken(0), m_bFullWPGSUpport(false), mxShapeFilterBase(xFilterBase) @@ -225,8 +224,9 @@ uno::Reference<xml::sax::XFastContextHandler> ShapeContextHandler::getContextHandler(sal_Int32 nElement) { uno::Reference<xml::sax::XFastContextHandler> xResult; + const sal_uInt32 nStartToken = getStartToken(); - switch (getNamespace( mnStartToken )) + switch (getNamespace( nStartToken )) { case NMSP_doc: case NMSP_vml: @@ -236,19 +236,19 @@ ShapeContextHandler::getContextHandler(sal_Int32 nElement) xResult.set(getDiagramShapeContext()); break; case NMSP_dmlLockedCanvas: - xResult.set(getLockedCanvasContext(mnStartToken)); + xResult.set(getLockedCanvasContext(nStartToken)); break; case NMSP_dmlChart: - xResult.set(getChartShapeContext(mnStartToken)); + xResult.set(getChartShapeContext(nStartToken)); break; case NMSP_wps: - xResult.set(getWpsContext(mnStartToken, nElement)); + xResult.set(getWpsContext(nStartToken, nElement)); break; case NMSP_wpg: - xResult.set(getWpgContext(mnStartToken)); + xResult.set(getWpgContext(nStartToken)); break; default: - xResult.set(getGraphicShapeContext(mnStartToken)); + xResult.set(getGraphicShapeContext(nStartToken)); break; } @@ -456,7 +456,7 @@ ShapeContextHandler::getShape() //NMSP_dmlChart == getNamespace( mnStartToken ) check is introduced to make sure that //mnStartToken is set as NMSP_dmlChart in setStartToken. //Only in case it is set then only the below block of code for ChartShapeContext should be executed. - else if (mxChartShapeContext.is() && (NMSP_dmlChart == getNamespace( mnStartToken ))) + else if (mxChartShapeContext.is() && (NMSP_dmlChart == getNamespace( getStartToken() ))) { ChartGraphicDataContext* pChartGraphicDataContext = dynamic_cast<ChartGraphicDataContext*>(mxChartShapeContext.get()); if (pChartGraphicDataContext) @@ -514,6 +514,8 @@ ShapeContextHandler::getShape() } } + if (xResult) + popStartToken(); return xResult; } @@ -537,12 +539,19 @@ void ShapeContextHandler::setRelationFragmentPath(const OUString & the_value) sal_Int32 ShapeContextHandler::getStartToken() const { - return mnStartToken; + assert(mnStartTokenStack.size() && "This stack must not be empty!"); + return mnStartTokenStack.top(); } -void ShapeContextHandler::setStartToken( sal_Int32 _starttoken ) +void ShapeContextHandler::popStartToken() { - mnStartToken = _starttoken; + if (mnStartTokenStack.size() > 1) + mnStartTokenStack.pop(); +} + +void ShapeContextHandler::pushStartToken( sal_Int32 _starttoken ) +{ + mnStartTokenStack.push(_starttoken); } void ShapeContextHandler::setPosition(const awt::Point& rPosition) |