diff options
author | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-17 21:47:22 +0200 |
---|---|---|
committer | Tamás Zolnai <tamas.zolnai@collabora.com> | 2017-08-17 23:11:15 +0200 |
commit | c0cc02e2934aeb12dda44818955e5964496c186a (patch) | |
tree | 16f450bbe38e14d336bdbac3220b642b9a302a87 | |
parent | 8c0cc5cd7befffc6e8e6361ba67807a799cc997f (diff) |
tdf#50097: DOCX: export form controls as MSO ActiveX controls
* Use the same structure for export what MSO uses
** Position and size information are exported as VML shape properties
** Different handling of inline and floating controls (pict or object)
** Do some changes on VML shape export to match how MSO exports these controls
** Write out activeX.xml and activeX.bin to store control properties
** Use persistStorage storage type defined in activeX.xml
* Drop grabbaging of activex.XML and activeX.bin
* Cleanup control related test code
Change-Id: I38bb2b2ffd2676c5459b61ec2549c31348bab41c
Signed-off-by: Tamás Zolnai <tamas.zolnai@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/41256
Tested-by: Jenkins <ci@libreoffice.org>
29 files changed, 377 insertions, 345 deletions
diff --git a/filter/source/msfilter/eschesdo.cxx b/filter/source/msfilter/eschesdo.cxx index c89469405c68..1348c38bfe7e 100644 --- a/filter/source/msfilter/eschesdo.cxx +++ b/filter/source/msfilter/eschesdo.cxx @@ -40,6 +40,7 @@ #include <com/sun/star/drawing/TextAdjust.hpp> #include <com/sun/star/drawing/LineDash.hpp> #include <com/sun/star/text/XText.hpp> +#include <com/sun/star/text/TextContentAnchorType.hpp> #include <com/sun/star/drawing/CircleKind.hpp> #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/task/XStatusIndicator.hpp> @@ -419,7 +420,24 @@ sal_uInt32 ImplEESdrWriter::ImplWriteShape( ImplEESdrObject& rObj, } else if ( rObj.GetType() == "drawing.Control" ) { - break; + mpEscherEx->OpenContainer( ESCHER_SpContainer ); + bool bInline = false; + const Reference< XPropertySet > xPropSet(rObj.mXPropSet, UNO_QUERY); + if(xPropSet.is()) + { + text::TextContentAnchorType eAnchorType; + xPropSet->getPropertyValue("AnchorType") >>= eAnchorType; + bInline = eAnchorType == text::TextContentAnchorType_AS_CHARACTER; + } + + if(bInline) + { + ADD_SHAPE( ESCHER_ShpInst_PictureFrame, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); + } + else + { + ADD_SHAPE( ESCHER_ShpInst_HostControl, SHAPEFLAG_HAVESPT | SHAPEFLAG_HAVEANCHOR ); + } } else if ( rObj.GetType() == "drawing.Connector" ) { diff --git a/include/oox/export/vmlexport.hxx b/include/oox/export/vmlexport.hxx index aac1811a4f17..c259db30cf06 100644 --- a/include/oox/export/vmlexport.hxx +++ b/include/oox/export/vmlexport.hxx @@ -82,6 +82,7 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Anchoring. sal_Int16 m_eHOri, m_eVOri, m_eHRel, m_eVRel; + bool m_bInline; // css::text::TextContentAnchorType_AS_CHARACTER /// Parent position. const Point* m_pNdTopLeft; @@ -101,11 +102,20 @@ class OOX_DLLPUBLIC VMLExport : public EscherEx /// Remember style, the most important shape attribute ;-) OStringBuffer m_ShapeStyle; + /// Remember the generated shape id. + OString m_sShapeId; + /// Remember which shape types we had already written. std::vector<bool> m_aShapeTypeWritten; + /// It seems useless to write out an XML_ID attribute next to XML_id which defines the actual shape id + bool m_bSkipwzName; + + /// Use '#' mark for type attribute (check Type Attribute of VML shape in OOXML documentation) + bool m_bUseHashMarkForType; + public: - VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLTextExport* pTextExport = nullptr ); + VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLTextExport* pTextExport = nullptr); virtual ~VMLExport() override; const ::sax_fastparser::FSHelperPtr& @@ -116,11 +126,15 @@ public: /// Export the sdr object as VML. /// /// Call this when you need to export the object as VML. - void AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1, + OString AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri = -1, sal_Int16 eVOri = -1, sal_Int16 eHRel = -1, sal_Int16 eVRel = -1, const Point* pNdTopLeft = nullptr, const bool bOOxmlExport = false ); + OString AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport = false ); virtual void AddSdrObjectVMLObject( const SdrObject& rObj) override; static bool IsWaterMarkShape(const OUString& rStr); + + void SetSkipwzName() { m_bSkipwzName = true; } + void SetHashMarkForType() { m_bUseHashMarkForType = true; } protected: /// Add an attribute to the generated <v:shape/> element. /// diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx index 19b871ad27de..128b49796334 100644 --- a/include/oox/ole/olehelper.hxx +++ b/include/oox/ole/olehelper.hxx @@ -29,6 +29,7 @@ #include <rtl/ustring.hxx> #include <sal/types.h> #include <tools/ref.hxx> +#include <memory> namespace com { namespace sun { namespace star { namespace awt { class XControlModel; } @@ -52,6 +53,8 @@ namespace oox { namespace ole { + class ControlModelBase; + class EmbeddedControl; #define OLE_GUID_STDFONT "{0BE35203-8F91-11CE-9DE3-00AA004BB851}" @@ -131,6 +134,38 @@ namespace OleHelper bool bWithGuid ); } +class OOX_DLLPUBLIC OleFormCtrlExportHelper final +{ + std::unique_ptr<::oox::ole::EmbeddedControl> mpControl; + ::oox::ole::ControlModelBase* mpModel; + ::oox::GraphicHelper maGrfHelper; + css::uno::Reference< css::frame::XModel > mxDocModel; + css::uno::Reference< css::awt::XControlModel > mxControlModel; + + OUString maName; + OUString maTypeName; + OUString maFullName; + OUString maGUID; +public: + OleFormCtrlExportHelper( const css::uno::Reference< css::uno::XComponentContext >& rxCtx, const css::uno::Reference< css::frame::XModel >& xDocModel, const css::uno::Reference< css::awt::XControlModel >& xModel ); + ~OleFormCtrlExportHelper(); + + OUString getGUID() + { + OUString sResult; + if ( maGUID.getLength() > 2 ) + sResult = maGUID.copy(1, maGUID.getLength() - 2 ); + return sResult; + } + const OUString& getFullName() { return maFullName; } + const OUString& getTypeName() { return maTypeName; } + const OUString& getName() { return maName; } + bool isValid() { return mpModel != nullptr; } + void exportName( const css::uno::Reference< css::io::XOutputStream >& rxOut ); + void exportCompObj( const css::uno::Reference< css::io::XOutputStream >& rxOut ); + void exportControl( const css::uno::Reference< css::io::XOutputStream >& rxOut, const css::awt::Size& rSize, bool bAutoClose = false ); +}; + // ideally it would be great to get rid of SvxMSConvertOCXControls // however msfilter/source/msfilter/svdfppt.cxx still uses // SvxMSConvertOCXControls as a base class, unfortunately oox depends on diff --git a/oox/source/export/preset-definitions-to-shape-types.pl b/oox/source/export/preset-definitions-to-shape-types.pl index 2fe929705746..b41dd58953e8 100644 --- a/oox/source/export/preset-definitions-to-shape-types.pl +++ b/oox/source/export/preset-definitions-to-shape-types.pl @@ -287,7 +287,7 @@ my %shapes_ids = ( 198 => 'actionButtonDocument', 199 => 'actionButtonSound', 200 => 'actionButtonMovie', - 201 => 'hostControl', # should not be used + 201 => 'hostControl', 202 => 'textBox' ); # An error occurred, we have to ignore this shape diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index b91d72e218e9..3ee2711f8e5f 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -59,6 +59,7 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLText , m_eVOri( 0 ) , m_eHRel( 0 ) , m_eVRel( 0 ) + , m_bInline( false ) , m_pNdTopLeft( nullptr ) , m_pSdrObject( nullptr ) , m_pShapeAttrList( nullptr ) @@ -66,6 +67,8 @@ VMLExport::VMLExport( ::sax_fastparser::FSHelperPtr const & pSerializer, VMLText , m_nShapeFlags(0) , m_ShapeStyle( 200 ) , m_aShapeTypeWritten( ESCHER_ShpInst_COUNT ) + , m_bSkipwzName( false ) + , m_bUseHashMarkForType( false ) { mnGroupLevel = 1; } @@ -181,19 +184,21 @@ void VMLExport::AddShape( sal_uInt32 nShapeType, sal_uInt32 nShapeFlags, sal_uIn { m_nShapeType = nShapeType; 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())) { // Not a watermark object - m_pShapeAttrList->add( XML_id, ShapeIdString( nShapeId ) ); + m_pShapeAttrList->add( XML_id, m_sShapeId ); } else { // A watermark object - store the optional shape ID m_pShapeAttrList->add( XML_id, OUStringToOString(m_pSdrObject->GetName(), RTL_TEXTENCODING_UTF8) ); // also ('o:spid') - m_pShapeAttrList->addNS( XML_o, XML_spid, ShapeIdString( nShapeId ) ); + m_pShapeAttrList->addNS( XML_o, XML_spid, m_sShapeId ); } } @@ -849,7 +854,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& aStream.Seek(0); OUString idStr = SvxMSDffManager::MSDFFReadZString(aStream, it->nPropSize, true); aStream.Seek(0); - if (!IsWaterMarkShape(m_pSdrObject->GetName())) + if (!IsWaterMarkShape(m_pSdrObject->GetName()) && !m_bSkipwzName) m_pShapeAttrList->add(XML_ID, OUStringToOString(idStr, RTL_TEXTENCODING_UTF8).getStr()); bAlreadyWritten[ESCHER_Prop_wzName] = true; @@ -939,12 +944,18 @@ void VMLExport::AddRectangleDimensions( OStringBuffer& rBuffer, const tools::Rec if ( !rBuffer.isEmpty() ) rBuffer.append( ";" ); - if (rbAbsolutePos) + if (rbAbsolutePos && !m_bInline) { rBuffer.append( "position:absolute;" ); } - if ( mnGroupLevel == 1 ) + if(m_bInline) + { + rBuffer.append( "width:" ).append( double( rRectangle.Right() - rRectangle.Left() ) / 20 ) + .append( "pt;height:" ).append( double( rRectangle.Bottom() - rRectangle.Top() ) / 20 ) + .append( "pt" ); + } + else if ( mnGroupLevel == 1 ) { rBuffer.append( "margin-left:" ).append( double( rRectangle.Left() ) / 20 ) .append( "pt;margin-top:" ).append( double( rRectangle.Top() ) / 20 ) @@ -1031,6 +1042,62 @@ sal_Int32 VMLExport::StartShape() case ESCHER_ShpInst_Ellipse: nShapeElement = XML_oval; break; case ESCHER_ShpInst_Arc: nShapeElement = XML_arc; break; case ESCHER_ShpInst_Line: nShapeElement = XML_line; break; + case ESCHER_ShpInst_HostControl: + { + // We don't have a shape definition for host control in presetShapeDefinitions.xml + // So use a definition copied from DOCX file created with MSO + bReferToShapeType = true; + nShapeElement = XML_shape; + if ( !m_aShapeTypeWritten[ m_nShapeType ] ) + { + OStringBuffer sShapeType; + sShapeType.append("<v:shapetype id=\"shapetype_").append(OString::number(m_nShapeType)). + append("\" coordsize=\"21600,21600\" o:spt=\"").append(OString::number(m_nShapeType)). + append("\" path=\"m,l,21600l21600,21600l21600,xe\">\n"). + append("<v:stroke joinstyle=\"miter\"/>\n" + "<v:path shadowok=\"f\" o:extrusionok=\"f\" strokeok=\"f\" fillok=\"f\" o:connecttype=\"rect\"/>\n" + "<o:lock v:ext=\"edit\" shapetype=\"t\"/>\n" + "</v:shapetype>"); + m_pSerializer->write(sShapeType.makeStringAndClear().getStr()); + m_aShapeTypeWritten[ m_nShapeType ] = true; + } + break; + } + case ESCHER_ShpInst_PictureFrame: + { + // We don't have a shape definition for picture frame in presetShapeDefinitions.xml + // So use a definition copied from DOCX file created with MSO + bReferToShapeType = true; + nShapeElement = XML_shape; + if ( !m_aShapeTypeWritten[ m_nShapeType ] ) + { + OStringBuffer sShapeType; + sShapeType.append("<v:shapetype id=\"shapetype_").append(OString::number(m_nShapeType)). + append("\" coordsize=\"21600,21600\" o:spt=\"").append(OString::number(m_nShapeType)). + append("\" o:preferrelative=\"t\" path=\"m@4@5l@4@11@9@11@9@5xe\" filled=\"f\" stroked=\"f\">\n"). + append("<v:stroke joinstyle=\"miter\"/>\n" + "<v:formulas>\n" + "<v:f eqn=\"if lineDrawn pixelLineWidth 0\"/>\n" + "<v:f eqn=\"sum @0 1 0\"/>\n" + "<v:f eqn=\"sum 0 0 @1\"/>\n" + "<v:f eqn=\"prod @2 1 2\"/>\n" + "<v:f eqn=\"prod @3 21600 pixelWidth\"/>\n" + "<v:f eqn=\"prod @3 21600 pixelHeight\"/>\n" + "<v:f eqn=\"sum @0 0 1\"/>\n" + "<v:f eqn=\"prod @6 1 2\"/>\n" + "<v:f eqn=\"prod @7 21600 pixelWidth\"/>\n" + "<v:f eqn=\"sum @8 21600 0\"/>\n" + "<v:f eqn=\"prod @7 21600 pixelHeight\"/>\n" + "<v:f eqn=\"sum @10 21600 0\"/>\n" + "</v:formulas>\n" + "<v:path o:extrusionok=\"f\" gradientshapeok=\"t\" o:connecttype=\"rect\"/>\n" + "<o:lock v:ext=\"edit\" aspectratio=\"t\"/>\n" + "</v:shapetype>"); + m_pSerializer->write(sShapeType.makeStringAndClear().getStr()); + m_aShapeTypeWritten[ m_nShapeType ] = true; + } + break; + } default: if ( m_nShapeType < ESCHER_ShpInst_COUNT ) { @@ -1137,7 +1204,10 @@ sal_Int32 VMLExport::StartShape() if ( nShapeElement >= 0 && !m_pShapeAttrList->hasAttribute( XML_type ) && bReferToShapeType ) { - m_pShapeAttrList->add( XML_type, OStringBuffer( 20 ) + OStringBuffer sTypeBuffer( 20 ); + if (m_bUseHashMarkForType) + sTypeBuffer.append("#"); + m_pShapeAttrList->add( XML_type, sTypeBuffer .append( "shapetype_" ).append( sal_Int32( m_nShapeType ) ) .makeStringAndClear() ); } @@ -1210,7 +1280,7 @@ void VMLExport::EndShape( sal_Int32 nShapeElement ) } } -void VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, const Point* pNdTopLeft, const bool bOOxmlExport ) +OString VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, sal_Int16 eVOri, sal_Int16 eHRel, sal_Int16 eVRel, const Point* pNdTopLeft, const bool bOOxmlExport ) { m_pSdrObject = &rObj; m_eHOri = eHOri; @@ -1219,6 +1289,15 @@ void VMLExport::AddSdrObject( const SdrObject& rObj, sal_Int16 eHOri, sal_Int16 m_eVRel = eVRel; m_pNdTopLeft = pNdTopLeft; EscherEx::AddSdrObject(rObj, bOOxmlExport); + return m_sShapeId; +} + +OString VMLExport::AddInlineSdrObject( const SdrObject& rObj, const bool bOOxmlExport ) +{ + m_pSdrObject = &rObj; + m_bInline = true; + EscherEx::AddSdrObject(rObj, bOOxmlExport); + return m_sShapeId; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index 1a6e7df17a5e..f2df54a833a0 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -329,35 +329,7 @@ Reference< css::frame::XFrame > lcl_getFrame( const Reference< css::frame::XMod return xFrame; } -class OleFormCtrlExportHelper final -{ - ::oox::ole::EmbeddedControl maControl; - ::oox::ole::ControlModelBase* mpModel; - ::oox::GraphicHelper maGrfHelper; - Reference< XModel > mxDocModel; - Reference< XControlModel > mxControlModel; - - OUString maName; - OUString maTypeName; - OUString maFullName; - OUString maGUID; -public: - OleFormCtrlExportHelper( const Reference< XComponentContext >& rxCtx, const Reference< XModel >& xDocModel, const Reference< XControlModel >& xModel ); - OUString getGUID() - { - OUString sResult; - if ( maGUID.getLength() > 2 ) - sResult = maGUID.copy(1, maGUID.getLength() - 2 ); - return sResult; - } - const OUString& getFullName() { return maFullName; } - const OUString& getTypeName() { return maTypeName; } - bool isValid() { return mpModel != nullptr; } - void exportName( const Reference< XOutputStream >& rxOut ); - void exportCompObj( const Reference< XOutputStream >& rxOut ); - void exportControl( const Reference< XOutputStream >& rxOut, const css::awt::Size& rSize ); -}; -OleFormCtrlExportHelper::OleFormCtrlExportHelper( const Reference< XComponentContext >& rxCtx, const Reference< XModel >& rxDocModel, const Reference< XControlModel >& xCntrlModel ) : maControl( "Unknown" ), mpModel( nullptr ), maGrfHelper( rxCtx, lcl_getFrame( rxDocModel ), StorageRef() ), mxDocModel( rxDocModel ), mxControlModel( xCntrlModel ) +OleFormCtrlExportHelper::OleFormCtrlExportHelper( const Reference< XComponentContext >& rxCtx, const Reference< XModel >& rxDocModel, const Reference< XControlModel >& xCntrlModel ) : mpControl(nullptr), mpModel( nullptr ), maGrfHelper( rxCtx, lcl_getFrame( rxDocModel ), StorageRef() ), mxDocModel( rxDocModel ), mxControlModel( xCntrlModel ) { // try to get the guid Reference< css::beans::XPropertySet > xProps( xCntrlModel, UNO_QUERY ); @@ -404,14 +376,18 @@ OleFormCtrlExportHelper::OleFormCtrlExportHelper( const Reference< XComponentCo aPropSet.getProperty(maName, PROP_Name ); maTypeName = OUString::createFromAscii( it->second.sName ); maFullName = "Microsoft Forms 2.0 " + maTypeName; - maControl = EmbeddedControl( maName ); + mpControl.reset(new EmbeddedControl( maName )); maGUID = OUString::createFromAscii( it->second.sGUID ); - mpModel = maControl.createModelFromGuid( maGUID ); + mpModel = mpControl->createModelFromGuid( maGUID ); } } } } +OleFormCtrlExportHelper::~OleFormCtrlExportHelper() +{ +} + void OleFormCtrlExportHelper::exportName( const Reference< XOutputStream >& rxOut ) { oox::BinaryXOutputStream aOut( rxOut, false ); @@ -426,13 +402,14 @@ void OleFormCtrlExportHelper::exportCompObj( const Reference< XOutputStream >& r mpModel->exportCompObj( aOut ); } -void OleFormCtrlExportHelper::exportControl( const Reference< XOutputStream >& rxOut, const Size& rSize ) +void OleFormCtrlExportHelper::exportControl( const Reference< XOutputStream >& rxOut, const Size& rSize, bool bAutoClose ) { - oox::BinaryXOutputStream aOut( rxOut, false ); + oox::BinaryXOutputStream aOut( rxOut, bAutoClose ); if ( mpModel ) { ::oox::ole::ControlConverter aConv( mxDocModel, maGrfHelper ); - maControl.convertFromProperties( mxControlModel, aConv ); + if(mpControl) + mpControl->convertFromProperties( mxControlModel, aConv ); mpModel->maSize.first = rSize.Width; mpModel->maSize.second = rSize.Height; mpModel->exportBinaryModel( aOut ); diff --git a/oox/source/token/tokens.txt b/oox/source/token/tokens.txt index 00577f862890..653050ea9ba2 100644 --- a/oox/source/token/tokens.txt +++ b/oox/source/token/tokens.txt @@ -740,6 +740,7 @@ avLst average avg avgSubtotal +ax axId axPos axis @@ -5808,6 +5809,7 @@ xmlPr xmlns xpath xrange +xsc xscale xsi xy diff --git a/sd/Module_sd.mk b/sd/Module_sd.mk index 8e2cb1122008..c1e67695fe7e 100644 --- a/sd/Module_sd.mk +++ b/sd/Module_sd.mk @@ -36,7 +36,6 @@ $(eval $(call gb_Module_add_check_targets,sd,\ CppunitTest_sd_filters_test \ CppunitTest_sd_misc_tests \ CppunitTest_sd_html_export_tests \ - CppunitTest_sd_activex_controls_tests \ )) endif @@ -56,6 +55,7 @@ $(eval $(call gb_Module_add_screenshot_targets,sd, \ $(eval $(call gb_Module_add_subsequentcheck_targets,sd,\ JunitTest_sd_unoapi \ + CppunitTest_sd_activex_controls_tests \ )) # vim: set noet sw=4 ts=4: diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx index a4de6d9b5978..839d90db74a8 100644 --- a/sd/qa/unit/import-tests.cxx +++ b/sd/qa/unit/import-tests.cxx @@ -70,7 +70,6 @@ #include <com/sun/star/style/XStyleFamiliesSupplier.hpp> #include <com/sun/star/table/XTableRows.hpp> #include <com/sun/star/style/NumberingType.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <stlpool.hxx> #include <comphelper/processfactory.hxx> diff --git a/sw/qa/extras/ooxmlexport/data/activex.docx b/sw/qa/extras/ooxmlexport/data/activex.docx Binary files differdeleted file mode 100644 index eb546d9795ef..000000000000 --- a/sw/qa/extras/ooxmlexport/data/activex.docx +++ /dev/null diff --git a/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx b/sw/qa/extras/ooxmlexport/data/activex_checkbox.docx Binary files differindex d7415ef5a5c6..d7415ef5a5c6 100755 --- a/sw/qa/extras/ooxmlimport/data/activex_checkbox.docx +++ b/sw/qa/extras/ooxmlexport/data/activex_checkbox.docx diff --git a/sw/qa/extras/ooxmlexport/data/activexbin.docx b/sw/qa/extras/ooxmlexport/data/activexbin.docx Binary files differdeleted file mode 100644 index ecf4599ed0e9..000000000000 --- a/sw/qa/extras/ooxmlexport/data/activexbin.docx +++ /dev/null diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index 72062211959d..b5e63cf65a86 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -14,7 +14,6 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx index 85b1b8fef611..0303237aece2 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx @@ -14,7 +14,6 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> @@ -537,62 +536,6 @@ DECLARE_OOXMLEXPORT_TEST(testCustomXmlGrabBag, "customxml.docx") CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements } -DECLARE_OOXMLEXPORT_TEST(testActiveXGrabBag, "activex.docx") -{ - // The problem was that activeX.xml files were missing from docx file after saving file. - // This test case tests whether activex files grabbagged properly in correct object. - - uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aGrabBag(0); - xTextDocumentPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; - CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty - bool bActiveX = false; - for(int i = 0; i < aGrabBag.getLength(); ++i) - { - if (aGrabBag[i].Name == "OOXActiveX") - { - bActiveX = true; - uno::Reference<xml::dom::XDocument> aActiveXDom; - uno::Sequence<uno::Reference<xml::dom::XDocument> > aActiveXDomList; - CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXDomList); // PropertyValue of proper type - sal_Int32 length = aActiveXDomList.getLength(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length); - aActiveXDom = aActiveXDomList[0]; - CPPUNIT_ASSERT(aActiveXDom.get()); // Reference not empty - } - } - CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements -} - -DECLARE_OOXMLEXPORT_TEST(testActiveXBinGrabBag, "activexbin.docx") -{ - // The problem was that activeX.bin files were missing from docx file after saving file. - // This test case tests whether activex bin files grabbagged properly in correct object. - - uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY); - uno::Reference<beans::XPropertySet> xTextDocumentPropertySet(xTextDocument, uno::UNO_QUERY); - uno::Sequence<beans::PropertyValue> aGrabBag(0); - xTextDocumentPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag; - CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty - bool bActiveX = false; - for(int i = 0; i < aGrabBag.getLength(); ++i) - { - if (aGrabBag[i].Name == "OOXActiveXBin") - { - bActiveX = true; - uno::Reference<io::XInputStream> aActiveXBin; - uno::Sequence<uno::Reference<io::XInputStream> > aActiveXBinList; - CPPUNIT_ASSERT(aGrabBag[i].Value >>= aActiveXBinList); // PropertyValue of proper type - sal_Int32 length = aActiveXBinList.getLength(); - CPPUNIT_ASSERT_EQUAL(sal_Int32(5), length); - aActiveXBin = aActiveXBinList[0]; - CPPUNIT_ASSERT(aActiveXBin.get()); // Reference not empty - } - } - CPPUNIT_ASSERT(bActiveX); // Grab Bag has all the expected elements -} - DECLARE_OOXMLEXPORT_TEST(testFdo69644, "fdo69644.docx") { // The problem was that the exporter exported the table definition diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx index a690c4519ea7..96868a3b6f66 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport5.cxx @@ -14,7 +14,6 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx index 2891b3ff162f..a5a28a21d9b7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport6.cxx @@ -9,7 +9,7 @@ #include <swmodeltestbase.hxx> -#if !defined(_WIN32) + #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> @@ -455,7 +455,7 @@ DECLARE_OOXMLEXPORT_TEST(testVMLData, "TestVMLData.docx") xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); if (!pXmlDoc) return; - CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect", "stroked").match("f")); + CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape", "stroked").match("f")); } DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx") @@ -465,7 +465,7 @@ DECLARE_OOXMLEXPORT_TEST(testImageData, "image_data.docx") xmlDocPtr pXmlDoc = parseExport("word/header2.xml"); if (!pXmlDoc) return; - CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:rect/v:imagedata", "detectmouseclick").match("t")); + CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:hdr/w:p/w:r/mc:AlternateContent/mc:Fallback/w:pict/v:shape/v:imagedata", "detectmouseclick").match("t")); } DECLARE_OOXMLEXPORT_TEST(testFdo70838, "fdo70838.docx") @@ -929,8 +929,6 @@ DECLARE_OOXMLEXPORT_TEST(testSyncedRelativePercent, "tdf93676-1.odt") assertXPath(pXmlDoc, "//wp14:pctHeight", 0); } -#endif - CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx index d564e8031b26..8607ff84fca5 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport7.cxx @@ -9,7 +9,6 @@ #include <swmodeltestbase.hxx> -#if !defined(_WIN32) #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeSegment.hpp> @@ -125,7 +124,7 @@ DECLARE_OOXMLEXPORT_TEST(testPictureWatermark, "pictureWatermark.docx") return; // Check the watermark ID - assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:rect[1]","id","WordPictureWatermark11962361"); + assertXPath(pXmlHeader1, "/w:hdr[1]/w:p[1]/w:r[1]/mc:AlternateContent[1]/mc:Fallback[1]/w:pict[1]/v:shape[1]","id","WordPictureWatermark11962361"); } @@ -1127,6 +1126,8 @@ DECLARE_OOXMLEXPORT_TEST(testTDF93675, "no-numlevel-but-indented.odt") assertXPath(pXmlDoc, "//w:ind", "start", "1418"); } + + DECLARE_OOXMLEXPORT_TEST(testFlipAndRotateCustomShape, "flip_and_rotate.odt") { xmlDocPtr pXmlDoc = parseExport("word/document.xml"); @@ -1141,6 +1142,7 @@ DECLARE_OOXMLEXPORT_TEST(testFlipAndRotateCustomShape, "flip_and_rotate.odt") #ifndef MACOSX /* Retina-related rounding rountrip error * hard to smooth out due to the use of string compare * instead of number */ +#if !defined(_WIN32) assertXPath(pXmlDoc, "//a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", "x", "2351"); assertXPath(pXmlDoc, "//a:custGeom/a:pathLst/a:path/a:lnTo[1]/a:pt", "y", "3171"); assertXPath(pXmlDoc, "//a:custGeom/a:pathLst/a:path/a:lnTo[2]/a:pt", "x", "1695"); @@ -1148,9 +1150,9 @@ DECLARE_OOXMLEXPORT_TEST(testFlipAndRotateCustomShape, "flip_and_rotate.odt") assertXPath(pXmlDoc, "//a:custGeom/a:pathLst/a:path/a:lnTo[3]/a:pt", "x", "1695"); assertXPath(pXmlDoc, "//a:custGeom/a:pathLst/a:path/a:lnTo[3]/a:pt", "y", "1701"); #endif +#endif } -#endif CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx index caecccfa0681..afdd942eade4 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport9.cxx @@ -10,7 +10,6 @@ #include <swmodeltestbase.hxx> #include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/drawing/EnhancedCustomShapeParameterPair.hpp> #include <com/sun/star/text/XFootnote.hpp> #include <com/sun/star/text/XPageCursor.hpp> @@ -27,6 +26,7 @@ #include <com/sun/star/view/XViewSettingsSupplier.hpp> #include <com/sun/star/style/LineSpacing.hpp> #include <com/sun/star/style/LineSpacingMode.hpp> +#include <com/sun/star/drawing/XControlShape.hpp> #include <ftninfo.hxx> #include <sfx2/docfile.hxx> @@ -818,6 +818,33 @@ DECLARE_OOXMLEXPORT_TEST(testTdf105095, "tdf105095.docx") CPPUNIT_ASSERT(xTextRange->getString().endsWith("\tfootnote")); } +DECLARE_OOXMLIMPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" ) +{ + uno::Reference<drawing::XControlShape> xControlShape( getShape(1), uno::UNO_QUERY ); + CPPUNIT_ASSERT( xControlShape.is() ); + + // Check control type + uno::Reference<beans::XPropertySet> xPropertySet( xControlShape->getControl(), uno::UNO_QUERY ); + uno::Reference<lang::XServiceInfo> xServiceInfo( xPropertySet, uno::UNO_QUERY ); + CPPUNIT_ASSERT_EQUAL( true, bool( xServiceInfo->supportsService( "com.sun.star.form.component.CheckBox" ) ) ); + + // Check custom label + CPPUNIT_ASSERT_EQUAL( OUString( "Custom Caption" ), getProperty<OUString>(xPropertySet, "Label") ); + + // Check background color (highlight system color) + CPPUNIT_ASSERT_EQUAL( sal_Int32( 0x316AC5 ), getProperty<sal_Int32>(xPropertySet, "BackgroundColor") ); + + // Check Text color (active border system color) + CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD4D0C8), getProperty<sal_Int32>(xPropertySet, "TextColor")); + + // Check state of the checkbox + CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPropertySet, "State")); + + // Check anchor type + uno::Reference<beans::XPropertySet> xPropertySet2(xControlShape, uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); +} + CPPUNIT_PLUGIN_IMPLEMENT(); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx index c3b2af4bc065..7e5373e60241 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlfieldexport.cxx @@ -14,7 +14,6 @@ #include <com/sun/star/drawing/FillStyle.hpp> #include <com/sun/star/drawing/LineJoint.hpp> #include <com/sun/star/drawing/LineStyle.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/Gradient.hpp> #include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/view/XViewSettingsSupplier.hpp> diff --git a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx index 2c2da5e9e7f3..e44d41f26d03 100644 --- a/sw/qa/extras/ooxmlimport/ooxmlimport.cxx +++ b/sw/qa/extras/ooxmlimport/ooxmlimport.cxx @@ -61,7 +61,6 @@ #include <unotools/streamwrap.hxx> #include <comphelper/propertysequence.hxx> #include <com/sun/star/drawing/HomogenMatrix3.hpp> -#include <com/sun/star/drawing/XControlShape.hpp> #include <com/sun/star/awt/CharSet.hpp> #include <test/mtfxmldump.hxx> @@ -1464,33 +1463,6 @@ DECLARE_OOXMLIMPORT_TEST(testGroupShapeFontName, "groupshape-fontname.docx") CPPUNIT_ASSERT_EQUAL(OUString(""), getProperty<OUString>(getRun(getParagraphOfText(1, xText), 1), "CharFontNameAsian")); } -DECLARE_OOXMLIMPORT_TEST( testActiveXCheckbox, "activex_checkbox.docx" ) -{ - uno::Reference<drawing::XControlShape> xControlShape( getShape(1), uno::UNO_QUERY ); - CPPUNIT_ASSERT( xControlShape.is() ); - - // Check control type - uno::Reference<beans::XPropertySet> xPropertySet( xControlShape->getControl(), uno::UNO_QUERY ); - uno::Reference<lang::XServiceInfo> xServiceInfo( xPropertySet, uno::UNO_QUERY ); - CPPUNIT_ASSERT_EQUAL( true, bool( xServiceInfo->supportsService( "com.sun.star.form.component.CheckBox" ) ) ); - - // Check custom label - CPPUNIT_ASSERT_EQUAL( OUString( "Custom Caption" ), getProperty<OUString>(xPropertySet, "Label") ); - - // Check background color (highlight system color) - CPPUNIT_ASSERT_EQUAL( sal_Int32( 0x316AC5 ), getProperty<sal_Int32>(xPropertySet, "BackgroundColor") ); - - // Check Text color (active border system color) - CPPUNIT_ASSERT_EQUAL(sal_Int32(0xD4D0C8), getProperty<sal_Int32>(xPropertySet, "TextColor")); - - // Check state of the checkbox - CPPUNIT_ASSERT_EQUAL(sal_Int16(1), getProperty<sal_Int16>(xPropertySet, "State")); - - // Check anchor type - uno::Reference<beans::XPropertySet> xPropertySet2(xControlShape, uno::UNO_QUERY); - CPPUNIT_ASSERT_EQUAL(text::TextContentAnchorType_AT_CHARACTER,getProperty<text::TextContentAnchorType>(xPropertySet2,"AnchorType")); -} - DECLARE_OOXMLIMPORT_TEST(testTdf111550, "tdf111550.docx") { // The test document has following ill-formed structure: diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 93cd4daba349..3c8bddef0cbf 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -50,6 +50,8 @@ #include <oox/mathml/export.hxx> #include <oox/drawingml/drawingmltypes.hxx> #include <oox/token/relationship.hxx> +#include <oox/export/vmlexport.hxx> +#include <oox/ole/olehelper.hxx> #include <editeng/autokernitem.hxx> #include <editeng/unoprnms.hxx> @@ -2043,6 +2045,8 @@ void DocxAttributeOutput::EndRunProperties( const SwRedlineData* pRedlineData ) WritePostponedOLE(); + WritePostponedActiveXControl(); + // merge the properties _before_ the run text (strictly speaking, just // after the start of the run) m_pSerializer->mergeTopMarks(Tag_StartRunProperties, sax_fastparser::MergeMarks::PREPEND); @@ -4781,6 +4785,101 @@ void DocxAttributeOutput::WritePostponedFormControl(const SdrObject* pObject) } } +void DocxAttributeOutput::WritePostponedActiveXControl() +{ + for( std::vector<PostponedDrawing>::const_iterator it = m_aPostponedActiveXControls.begin(); + it != m_aPostponedActiveXControls.end(); ++it ) + { + WriteActiveXControl(it->object, *(it->frame), *(it->point)); + } + m_aPostponedActiveXControls.clear(); +} + + +void DocxAttributeOutput::WriteActiveXControl(const SdrObject* pObject, const SwFrameFormat& rFrameFormat,const Point& rNdTopLeft) +{ + SdrUnoObj *pFormObj = const_cast<SdrUnoObj*>(dynamic_cast< const SdrUnoObj*>(pObject)); + if (!pFormObj) + return; + + uno::Reference<awt::XControlModel> xControlModel = pFormObj->GetUnoControlModel(); + if (!xControlModel.is()) + return; + + const bool bAnchoredInline = rFrameFormat.GetAnchor().GetAnchorId() == static_cast<RndStdIds>(css::text::TextContentAnchorType_AS_CHARACTER); + + // w:pict for floating embedded control and w:object for inline embedded control + if(bAnchoredInline) + m_pSerializer->startElementNS(XML_w, XML_object, FSEND); + else + m_pSerializer->startElementNS(XML_w, XML_pict, FSEND); + + // write ActiveX fragment and ActiveX binary + uno::Reference<drawing::XShape> xShape(const_cast<SdrObject*>(pObject)->getUnoShape(), uno::UNO_QUERY); + std::pair<OString,OString> sRelIdAndName = m_rExport.WriteActiveXObject(xShape, xControlModel); + + // VML shape definition + m_rExport.VMLExporter().SetSkipwzName(); + m_rExport.VMLExporter().SetHashMarkForType(); + OString sShapeId; + if(bAnchoredInline) + { + sShapeId = m_rExport.VMLExporter().AddInlineSdrObject(*pObject, true); + } + else + { + const SwFormatHoriOrient& rHoriOri = rFrameFormat.GetHoriOrient(); + const SwFormatVertOrient& rVertOri = rFrameFormat.GetVertOrient(); + sShapeId = m_rExport.VMLExporter().AddSdrObject(*pObject, + rHoriOri.GetHoriOrient(), rVertOri.GetVertOrient(), + rHoriOri.GetRelationOrient(), + rVertOri.GetRelationOrient(), &rNdTopLeft, true); + } + + // control + m_pSerializer->singleElementNS(XML_w, XML_control, + FSNS(XML_r, XML_id), sRelIdAndName.first.getStr(), + FSNS(XML_w, XML_name), sRelIdAndName.second.getStr(), + FSNS(XML_w, XML_shapeid), sShapeId.getStr(), + FSEND); + + if(bAnchoredInline) + m_pSerializer->endElementNS(XML_w, XML_object); + else + m_pSerializer->endElementNS(XML_w, XML_pict); +} + +bool DocxAttributeOutput::ExportAsActiveXControl(const SdrObject* pObject) const +{ + SdrUnoObj *pFormObj = const_cast<SdrUnoObj*>(dynamic_cast< const SdrUnoObj*>(pObject)); + if (!pFormObj) + return false; + + uno::Reference<awt::XControlModel> xControlModel = pFormObj->GetUnoControlModel(); + if (!xControlModel.is()) + return false; + + uno::Reference< css::frame::XModel > xModel( m_rExport.m_pDoc->GetDocShell() ? m_rExport.m_pDoc->GetDocShell()->GetModel() : nullptr ); + if (!xModel.is()) + return false; + + uno::Reference<lang::XServiceInfo> xInfo(xControlModel, uno::UNO_QUERY); + if (!xInfo.is()) + return false; + + // See WritePostponedFormControl + // By now date field and combobox is handled on a different way, so let's not interfere with the other method. + if(xInfo->supportsService("com.sun.star.form.component.DateField") || + xInfo->supportsService("com.sun.star.form.component.ComboBox")) + return false; + + oox::ole::OleFormCtrlExportHelper exportHelper(comphelper::getProcessComponentContext(), xModel, xControlModel); + if(!exportHelper.isValid()) + return false; + + return true; +} + bool DocxAttributeOutput::PostponeOLE( SwOLENode& rNode, const Size& rSize, const SwFlyFrameFormat* pFlyFrameFormat ) { if( !m_pPostponedOLEs ) @@ -5066,7 +5165,10 @@ void DocxAttributeOutput::OutputFlyFrame_Impl( const ww8::Frame &rFrame, const P case ww8::Frame::eFormControl: { const SdrObject* pObject = rFrame.GetFrameFormat().FindRealSdrObject(); - m_aPostponedFormControls.push_back(pObject); + if(ExportAsActiveXControl(pObject)) + m_aPostponedActiveXControls.push_back(PostponedDrawing(pObject, &(rFrame.GetFrameFormat()), &rNdTopLeft)); + else + m_aPostponedFormControls.push_back(pObject); m_bPostponedProcessingFly = true ; } break; diff --git a/sw/source/filter/ww8/docxattributeoutput.hxx b/sw/source/filter/ww8/docxattributeoutput.hxx index 8daa50aea34a..54d67559b35e 100644 --- a/sw/source/filter/ww8/docxattributeoutput.hxx +++ b/sw/source/filter/ww8/docxattributeoutput.hxx @@ -417,6 +417,9 @@ private: bool PostponeOLE( SwOLENode& rNode, const Size& rSize, const SwFlyFrameFormat* pFlyFrameFormat ); void WriteOLE( SwOLENode& rNode, const Size& rSize, const SwFlyFrameFormat* rFlyFrameFormat ); + void WriteActiveXControl(const SdrObject* pObject, const SwFrameFormat& rFrameFormat, const Point& rNdTopLeft); + bool ExportAsActiveXControl(const SdrObject* pObject) const; + /// checks whether the current component is a diagram static bool IsDiagram (const SdrObject* sdrObject); @@ -697,6 +700,7 @@ private: void WritePostponedGraphic(); void WritePostponedMath(const SwOLENode* pObject); void WritePostponedFormControl(const SdrObject* pObject); + void WritePostponedActiveXControl(); void WritePostponedDiagram(); void WritePostponedChart(); void WritePostponedOLE(); @@ -873,6 +877,7 @@ private: const SdrObject* m_postponedChart; Size m_postponedChartSize; std::vector<const SdrObject*> m_aPostponedFormControls; + std::vector<PostponedDrawing> m_aPostponedActiveXControls; const SwField* pendingPlaceholder; /// Maps postit fields to ID's, used in commentRangeStart/End, commentReference and comment.xml. std::vector< std::pair<const SwPostItField*, sal_Int32> > m_postitFields; diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx index 87de4e11b242..c3df2b0cf18f 100644 --- a/sw/source/filter/ww8/docxexport.cxx +++ b/sw/source/filter/ww8/docxexport.cxx @@ -31,6 +31,7 @@ #include <com/sun/star/xml/dom/XDocument.hpp> #include <com/sun/star/xml/sax/XSAXSerializable.hpp> #include <com/sun/star/xml/sax/Writer.hpp> +#include <com/sun/star/awt/XControlModel.hpp> #include <oox/token/namespaces.hxx> #include <oox/token/tokens.hxx> @@ -40,6 +41,9 @@ #include <oox/export/shapes.hxx> #include <oox/helper/propertyset.hxx> #include <oox/token/relationship.hxx> +#include <oox/helper/binaryoutputstream.hxx> +#include <oox/ole/olestorage.hxx> +#include <oox/ole/olehelper.hxx> #include <map> #include <algorithm> @@ -419,6 +423,54 @@ OString DocxExport::WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID) return OUStringToOString( sId, RTL_TEXTENCODING_UTF8 ); } +std::pair<OString, OString> DocxExport::WriteActiveXObject(const uno::Reference<drawing::XShape>& rxShape, + const uno::Reference<awt::XControlModel>& rxControlModel) +{ + ++m_nActiveXControls; + + // Write out ActiveX binary + const OUString sBinaryFileName = "word/activeX/activeX" + OUString::number(m_nActiveXControls) + ".bin"; + + OString sGUID; + OString sName; + uno::Reference<io::XStream> xOutStorage(m_pFilter->openFragmentStream(sBinaryFileName, "application/vnd.ms-office.activeX"), uno::UNO_QUERY); + if(xOutStorage.is()) + { + oox::ole::OleStorage aOleStorage(m_pFilter->getComponentContext(), xOutStorage, false); + uno::Reference<io::XOutputStream> xOutputStream(aOleStorage.openOutputStream("contents"), uno::UNO_SET_THROW); + uno::Reference< css::frame::XModel > xModel( m_pDoc->GetDocShell() ? m_pDoc->GetDocShell()->GetModel() : nullptr ); + oox::ole::OleFormCtrlExportHelper exportHelper(comphelper::getProcessComponentContext(), xModel, rxControlModel); + if ( !exportHelper.isValid() ) + return std::make_pair<OString, OString>(OString(), OString()); + sGUID = OUStringToOString(exportHelper.getGUID(), RTL_TEXTENCODING_UTF8); + sName = OUStringToOString(exportHelper.getName(), RTL_TEXTENCODING_UTF8); + exportHelper.exportControl(xOutputStream, rxShape->getSize(), true); + aOleStorage.commit(); + } + + // Write out ActiveX fragment + const OUString sXMLFileName = "word/activeX/activeX" + OUString::number( m_nActiveXControls ) + ".xml"; + ::sax_fastparser::FSHelperPtr pActiveXFS = m_pFilter->openFragmentStreamWithSerializer(sXMLFileName, "application/vnd.ms-office.activeX+xml" ); + + const OUString sBinaryId = m_pFilter->addRelation( pActiveXFS->getOutputStream(), + oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY), + sBinaryFileName.copy(sBinaryFileName.lastIndexOf("/") + 1) ); + + pActiveXFS->singleElementNS(XML_ax, XML_ocx, + FSNS(XML_xmlns, XML_ax), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(ax)), RTL_TEXTENCODING_UTF8).getStr(), + FSNS(XML_xmlns, XML_r), OUStringToOString(m_pFilter->getNamespaceURL(OOX_NS(officeRel)), RTL_TEXTENCODING_UTF8).getStr(), + FSNS(XML_ax, XML_classid), OString("{" + sGUID + "}").getStr(), + FSNS(XML_ax, XML_persistence), "persistStorage", + FSNS(XML_r, XML_id), OUStringToOString(sBinaryId, RTL_TEXTENCODING_UTF8).getStr(), FSEND); + + OString sXMLId = OUStringToOString(m_pFilter->addRelation(m_pDocumentFS->getOutputStream(), + oox::getRelationship(Relationship::CONTROL), + sXMLFileName.copy(sBinaryFileName.indexOf("/") + 1)), + RTL_TEXTENCODING_UTF8); + + return std::pair<OString, OString>(sXMLId, sName); +} + void DocxExport::OutputDML(uno::Reference<drawing::XShape> const & xShape) { uno::Reference<lang::XServiceInfo> xServiceInfo(xShape, uno::UNO_QUERY_THROW); @@ -462,8 +514,6 @@ void DocxExport::ExportDocument_Impl() WriteCustomXml(); - WriteActiveX(); - WriteEmbeddings(); WriteVBA(); @@ -1171,100 +1221,6 @@ void DocxExport::WriteCustomXml() } } -void DocxExport::WriteActiveX() -{ - uno::Reference< beans::XPropertySet > xPropSet( m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY_THROW ); - - uno::Reference< beans::XPropertySetInfo > xPropSetInfo = xPropSet->getPropertySetInfo(); - OUString aName = UNO_NAME_MISC_OBJ_INTEROPGRABBAG; - if ( !xPropSetInfo->hasPropertyByName( aName ) ) - return; - - uno::Sequence<uno::Reference<xml::dom::XDocument> > activeXDomlist; - uno::Sequence<uno::Reference<io::XInputStream> > activeXBinList; - uno::Sequence< beans::PropertyValue > propList; - xPropSet->getPropertyValue( aName ) >>= propList; - for ( sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp ) - { - OUString propName = propList[nProp].Name; - if ( propName == "OOXActiveX" ) - { - propList[nProp].Value >>= activeXDomlist; - break; - } - } - - for ( sal_Int32 nProp=0; nProp < propList.getLength(); ++nProp ) - { - OUString propName = propList[nProp].Name; - if ( propName == "OOXActiveXBin" ) - { - propList[nProp].Value >>= activeXBinList; - break; - } - } - - for (sal_Int32 j = 0; j < activeXDomlist.getLength(); j++) - { - uno::Reference<xml::dom::XDocument> activeXDom = activeXDomlist[j]; - uno::Reference<io::XInputStream> activeXBin = activeXBinList[j]; - - if ( activeXDom.is() ) - { - m_pFilter->addRelation( m_pDocumentFS->getOutputStream(), - oox::getRelationship(Relationship::CONTROL), - "activeX/activeX"+OUString::number((j+1))+".xml" ); - - uno::Reference< xml::sax::XSAXSerializable > serializer( activeXDom, uno::UNO_QUERY ); - uno::Reference< xml::sax::XWriter > writer = xml::sax::Writer::create( comphelper::getProcessComponentContext() ); - writer->setOutputStream( GetFilter().openFragmentStream( "word/activeX/activeX"+OUString::number((j+1))+".xml", - "application/vnd.ms-office.activeX+xml" ) ); - serializer->serialize( uno::Reference< xml::sax::XDocumentHandler >( writer, uno::UNO_QUERY_THROW ), - uno::Sequence< beans::StringPair >() ); - } - - if ( activeXBin.is() ) - { - uno::Reference< io::XOutputStream > xOutStream = GetFilter().openFragmentStream("word/activeX/activeX"+OUString::number((j+1))+".bin", - "application/vnd.ms-office.activeX"); - - try - { - sal_Int32 nBufferSize = 512; - uno::Sequence< sal_Int8 > aDataBuffer(nBufferSize); - sal_Int32 nRead; - do - { - nRead = activeXBin->readBytes( aDataBuffer, nBufferSize ); - if( nRead ) - { - if( nRead < nBufferSize ) - { - nBufferSize = nRead; - aDataBuffer.realloc(nRead); - } - xOutStream->writeBytes( aDataBuffer ); - } - } - while( nRead ); - xOutStream->flush(); - } - catch(const uno::Exception&) - { - SAL_WARN("sw.ww8", "WriteActiveX() ::Failed to copy Inputstream to outputstream exception caught!"); - } - - xOutStream->closeOutput(); - // Adding itemprops's relationship entry to item.xml.rels file - m_pFilter->addRelation( GetFilter().openFragmentStream( "/word/activeX/activeX"+OUString::number((j+1))+".xml", - "application/vnd.ms-office.activeX+xml" ) , - oox::getRelationship(Relationship::ACTIVEXCONTROLBINARY), - "activeX"+OUString::number((j+1))+".bin" ); - - } - } -} - void DocxExport::WriteVBA() { uno::Reference<document::XStorageBasedDocument> xStorageBasedDocument(m_pDoc->GetDocShell()->GetBaseModel(), uno::UNO_QUERY); @@ -1528,6 +1484,7 @@ DocxExport::DocxExport( DocxExportFilter *pFilter, SwDoc *pDocument, SwPaM *pCur m_nHeaders( 0 ), m_nFooters( 0 ), m_nOLEObjects( 0 ), + m_nActiveXControls( 0 ), m_nHeadersFootersInSection(0), m_pVMLExport( nullptr ), m_pSdrExport( nullptr ), diff --git a/sw/source/filter/ww8/docxexport.hxx b/sw/source/filter/ww8/docxexport.hxx index 915f50122bfc..73f690a66198 100644 --- a/sw/source/filter/ww8/docxexport.hxx +++ b/sw/source/filter/ww8/docxexport.hxx @@ -49,6 +49,7 @@ namespace oox { namespace com { namespace sun { namespace star { namespace frame { class XModel; } namespace drawing { class XShape; } + namespace awt { class XControlModel; } } } } /// Data to be written in the document settings part of the document @@ -91,6 +92,9 @@ class DocxExport : public MSWordExportBase /// OLE objects counter. sal_Int32 m_nOLEObjects; + /// ActiveX controls counter + sal_Int32 m_nActiveXControls; + ///Footer and Header counter in Section properties sal_Int32 m_nHeadersFootersInSection; @@ -174,6 +178,8 @@ public: /// Returns the relationd id OString OutputChart( css::uno::Reference< css::frame::XModel > const & xModel, sal_Int32 nCount, ::sax_fastparser::FSHelperPtr const & m_pSerializer ); OString WriteOLEObject(SwOLEObj& rObject, OUString & io_rProgID); + std::pair<OString,OString> WriteActiveXObject(const uno::Reference<css::drawing::XShape>& rxShape, + const uno::Reference<awt::XControlModel>& rxControlModel); /// Writes the shape using drawingML syntax. void OutputDML( css::uno::Reference< css::drawing::XShape > const & xShape ); diff --git a/writerfilter/inc/ooxml/OOXMLDocument.hxx b/writerfilter/inc/ooxml/OOXMLDocument.hxx index 8f0a12d3189c..909a5491b59a 100644 --- a/writerfilter/inc/ooxml/OOXMLDocument.hxx +++ b/writerfilter/inc/ooxml/OOXMLDocument.hxx @@ -75,7 +75,7 @@ class OOXMLStream { public: enum StreamType_t { UNKNOWN, DOCUMENT, STYLES, WEBSETTINGS, FONTTABLE, NUMBERING, - FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, ACTIVEX, ACTIVEXBIN, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA }; + FOOTNOTES, ENDNOTES, COMMENTS, THEME, CUSTOMXML, CUSTOMXMLPROPS, GLOSSARY, CHARTS, EMBEDDINGS, SETTINGS, VBAPROJECT, FOOTER, HEADER, VBADATA }; typedef std::shared_ptr<OOXMLStream> Pointer_t; virtual ~OOXMLStream() {} @@ -230,8 +230,6 @@ public: virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() = 0; virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomList( ) = 0; virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomPropsList( ) = 0; - virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getActiveXDomList( ) = 0; - virtual css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > getActiveXBinList() = 0; virtual css::uno::Sequence<css::beans::PropertyValue > getEmbeddingsList() = 0; }; diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 63c4d50a29be..2f49a4743cd2 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -227,10 +227,6 @@ sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& aDesc aGrabBagProperties["OOXCustomXml"] <<= pDocument->getCustomXmlDomList(); aGrabBagProperties["OOXCustomXmlProps"] <<= pDocument->getCustomXmlDomPropsList(); - // Adding the saved ActiveX DOM - aGrabBagProperties["OOXActiveX"] <<= pDocument->getActiveXDomList(); - aGrabBagProperties["OOXActiveXBin"] <<= pDocument->getActiveXBinList(); - // Adding the saved Glossary Documnet DOM to the document's grab bag aGrabBagProperties["OOXGlossary"] <<= pDocument->getGlossaryDocDom(); aGrabBagProperties["OOXGlossaryDom"] <<= pDocument->getGlossaryDomList(); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 119e6271d336..d884248e7908 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -169,10 +169,6 @@ uno::Reference<xml::dom::XDocument> OOXMLDocumentImpl::importSubStream(OOXMLStre { importSubStreamRelations(pStream, OOXMLStream::CUSTOMXMLPROPS); } - if(OOXMLStream::ACTIVEX == nType) - { - importSubStreamRelations(pStream, OOXMLStream::ACTIVEXBIN); - } if(OOXMLStream::CHARTS == nType) { importSubStreamRelations(pStream, OOXMLStream::EMBEDDINGS); @@ -223,14 +219,8 @@ void OOXMLDocumentImpl::importSubStreamRelations(const OOXMLStream::Pointer_t& p mxCustomXmlProsDom = xRelation; } } - else if(OOXMLStream::ACTIVEXBIN == nType) - { - // imporing activex.bin files for activex.xml from activeX folder. - mxActiveXBin = xcpInputStream; - } else if(OOXMLStream::EMBEDDINGS == nType) { - // imporing activex.bin files for activex.xml from activeX folder. mxEmbeddings = xcpInputStream; } else if(OOXMLStream::CHARTS == nType) @@ -485,8 +475,6 @@ void OOXMLDocumentImpl::resolve(Stream & rStream) // Custom xml's are handled as part of grab bag. resolveCustomXmlStream(rStream); - resolveActiveXStream(rStream); - resolveFastSubStream(rStream, OOXMLStream::FONTTABLE); resolveFastSubStream(rStream, OOXMLStream::STYLES); resolveFastSubStream(rStream, OOXMLStream::NUMBERING); @@ -796,62 +784,6 @@ void OOXMLDocumentImpl::resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pS mxEmbeddingsList = comphelper::containerToSequence(aEmbeddings); } -void OOXMLDocumentImpl::resolveActiveXStream(Stream & rStream) -{ - // Resolving all ActiveX[n].xml files from ActiveX folder. - uno::Reference<embed::XRelationshipAccess> xRelationshipAccess; - xRelationshipAccess.set((dynamic_cast<OOXMLStreamImpl&>(*mpStream.get())).accessDocumentStream(), uno::UNO_QUERY); - if (xRelationshipAccess.is()) - { - static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"; - static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/control"; - bool bFound = false; - sal_Int32 counter = 0; - uno::Sequence< uno::Sequence< beans::StringPair > > aSeqs = xRelationshipAccess->getAllRelationships(); - uno::Sequence<uno::Reference<xml::dom::XDocument> > xActiveXDomListTemp(aSeqs.getLength()); - uno::Sequence<uno::Reference<io::XInputStream> > xActiveXBinListTemp(aSeqs.getLength()); - for (sal_Int32 j = 0; j < aSeqs.getLength(); j++) - { - uno::Sequence< beans::StringPair > aSeq = aSeqs[j]; - for (sal_Int32 i = 0; i < aSeq.getLength(); i++) - { - beans::StringPair aPair = aSeq[i]; - // Need to resolve only ActiveX files from document relationships. - // Skipping other files. - if (aPair.Second == sCustomType || - aPair.Second == sCustomTypeStrict) - bFound = true; - else if(aPair.First == "Target" && bFound) - { - // Adding value to extern variable customTarget. It will be used in ooxmlstreamimpl - // to ensure ActiveX.xml target is visited in lcl_getTarget. - customTarget = aPair.Second; - } - } - if(bFound) - { - uno::Reference<xml::dom::XDocument> activeXTemp = importSubStream(OOXMLStream::ACTIVEX); - // This will add all ActiveX[n].xml to grabbag list. - if(activeXTemp.is()) - { - xActiveXDomListTemp[counter] = activeXTemp; - if(mxActiveXBin.is()) - { - xActiveXBinListTemp[counter] = mxActiveXBin; - } - counter++; - resolveFastSubStream(rStream, OOXMLStream::ACTIVEX); - } - bFound = false; - } - } - xActiveXDomListTemp.realloc(counter); - xActiveXBinListTemp.realloc(counter); - mxActiveXDomList = xActiveXDomListTemp; - mxActiveXBinList = xActiveXBinListTemp; - } -} - uno::Reference<xml::dom::XDocument> OOXMLDocumentImpl::getGlossaryDocDom( ) { return mxGlossaryDocDom; @@ -934,16 +866,6 @@ uno::Sequence<uno::Reference<xml::dom::XDocument> > OOXMLDocumentImpl::getCustom return mxCustomXmlDomPropsList; } -uno::Sequence<uno::Reference<xml::dom::XDocument> > OOXMLDocumentImpl::getActiveXDomList( ) -{ - return mxActiveXDomList; -} - -uno::Sequence<uno::Reference<io::XInputStream> > OOXMLDocumentImpl::getActiveXBinList( ) -{ - return mxActiveXBinList; -} - uno::Sequence<beans::PropertyValue > OOXMLDocumentImpl::getEmbeddingsList( ) { return mxEmbeddingsList; diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx index adc834dd1146..48412cd64ffd 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.hxx @@ -49,9 +49,6 @@ class OOXMLDocumentImpl : public OOXMLDocument css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomList; css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxCustomXmlDomPropsList; css::uno::Reference<css::xml::dom::XDocument> mxCustomXmlProsDom; - css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > mxActiveXDomList; - css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > mxActiveXBinList; - css::uno::Reference<css::io::XInputStream> mxActiveXBin; css::uno::Reference<css::io::XInputStream> mxEmbeddings; css::uno::Sequence < css::beans::PropertyValue > mxEmbeddingsList; std::vector<css::beans::PropertyValue> aEmbeddings; @@ -90,7 +87,6 @@ protected: const sal_Int32 nNoteId); void resolveCustomXmlStream(Stream & rStream); - void resolveActiveXStream(Stream & rStream); void resolveGlossaryStream(Stream & rStream); void resolveEmbeddingsStream(const OOXMLStream::Pointer_t& pStream); public: @@ -135,8 +131,6 @@ public: virtual css::uno::Reference<css::xml::dom::XDocument> getThemeDom() override; virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomList() override; virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getCustomXmlDomPropsList() override; - virtual css::uno::Sequence<css::uno::Reference<css::xml::dom::XDocument> > getActiveXDomList() override; - virtual css::uno::Sequence<css::uno::Reference<css::io::XInputStream> > getActiveXBinList() override; virtual css::uno::Reference<css::xml::dom::XDocument> getGlossaryDocDom() override; virtual css::uno::Sequence<css::uno::Sequence< css::uno::Any> > getGlossaryDomList() override; virtual css::uno::Sequence<css::beans::PropertyValue > getEmbeddingsList() override; diff --git a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx index 3267e89ee6b2..e8ae8c1dca20 100644 --- a/writerfilter/source/ooxml/OOXMLStreamImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLStreamImpl.cxx @@ -141,8 +141,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc static const char sThemeType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"; static const char sCustomType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"; static const char sCustomPropsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"; - static const char sActiveXType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"; - static const char sActiveXBinType[] = "http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"; static const char sGlossaryType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"; static const char sWebSettings[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings"; static const char sSettingsType[] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"; @@ -162,7 +160,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc static const char sThemeTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/theme"; static const char sCustomTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXml"; static const char sCustomPropsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/customXmlProps"; - static const char sActiveXTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/control"; static const char sGlossaryTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/glossaryDocument"; static const char sWebSettingsStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/webSettings"; static const char sSettingsTypeStrict[] = "http://purl.oclc.org/ooxml/officeDocument/relationships/settings"; @@ -227,14 +224,6 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc sStreamType = sCustomPropsType; sStreamTypeStrict = sCustomPropsTypeStrict; break; - case ACTIVEX: - sStreamType = sActiveXType; - sStreamTypeStrict = sActiveXTypeStrict; - break; - case ACTIVEXBIN: - sStreamType = sActiveXBinType; - sStreamTypeStrict = sActiveXBinType; - break; case SETTINGS: sStreamType = sSettingsType; sStreamTypeStrict = sSettingsTypeStrict; @@ -298,8 +287,8 @@ bool OOXMLStreamImpl::lcl_getTarget(const uno::Reference<embed::XRelationshipAcc bFound = true; else if (rPair.First == sTarget) { - // checking item[n].xml or activex[n].xml is not visited already. - if(customTarget != rPair.Second && (sStreamType == sCustomType || sStreamType == sActiveXType || sStreamType == sChartType || sStreamType == sFooterType || sStreamType == sHeaderType)) + // checking item[n].xml is not visited already. + if(customTarget != rPair.Second && (sStreamType == sCustomType || sStreamType == sChartType || sStreamType == sFooterType || sStreamType == sHeaderType)) { bFound = false; } |