diff options
author | Justin Luth <jluth@mail.com> | 2023-01-21 17:00:26 -0500 |
---|---|---|
committer | Justin Luth <jluth@mail.com> | 2023-01-24 02:09:55 +0000 |
commit | 245912dc42bfc13cbf0db3f04f2411f3dede9615 (patch) | |
tree | 03cd30cee1bcc10a4db67bcbf84b7b6a5360864b /oox | |
parent | 5cd3a8ec6d36a389eb0be4d59f4570e3bda92dc5 (diff) |
tdf#117266 tdf#120374 sc oox: export correct vml button name #2
So the actual name is more important than I knew.
For example, VBA maps click macros based on the button name.
So use the MS-provided name and use the SPID to connect to the shape id.
Of the existing unit tests that were affected by this:
-macro-button-form-control.xlsm: button now launches hello macro
-tdf117266_macroButton.xlsm - same file as ^^^
-button-form-control.xls nearly same file as ^^^
-tdf134769.xlsx - checkbox still exists on round-trip
-tdf106181.ods - checkbox still exists, but link to cell still lost.
-checkbox-form-control.xlsx - nearly same as ^^^
All looks good.
Change-Id: If83cf17d60b73c46d55a21b1a46ed320513044cb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145961
Tested-by: Jenkins
Reviewed-by: Justin Luth <jluth@mail.com>
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/export/vmlexport.cxx | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index 339187fbe4d2..6da57bdd8be8 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -187,20 +187,24 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, ShapeFlag nShapeFlags, sal_uInt m_nShapeFlags = nShapeFlags; m_sShapeId = ShapeIdString( nShapeId ); - // If shape is a watermark object - should keep the original shape's name - // because Microsoft detects if it is a watermark by the actual name - if (!IsWaterMarkShape(m_pSdrObject->GetName())) + if (m_sShapeId.startsWith("_x0000_")) { - // Not a watermark object - m_pShapeAttrList->add( XML_id, m_sShapeId ); + // xml_id must be set elsewhere. The id is critical for matching VBA macros etc, + // and the spid is critical to link to the shape number elsewhere. + m_pShapeAttrList->addNS( XML_o, XML_spid, m_sShapeId ); } - else + else if (IsWaterMarkShape(m_pSdrObject->GetName())) { - // A watermark object - store the optional shape ID + // Shape is a watermark object - keep the original shape's name + // because Microsoft detects if it is a watermark by the actual name m_pShapeAttrList->add( XML_id, m_pSdrObject->GetName() ); // also ('o:spid') m_pShapeAttrList->addNS( XML_o, XML_spid, m_sShapeId ); } + else + { + m_pShapeAttrList->add(XML_id, m_sShapeId); + } } bool VMLExport::IsWaterMarkShape(std::u16string_view rStr) |