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 /oox/source/ole/olehelper.cxx | |
parent | Related tdf#105500: leaks in PaletteManager and SvxColorToolBoxControl (diff) | |
download | core-c0cc02e2934aeb12dda44818955e5964496c186a.tar.gz core-c0cc02e2934aeb12dda44818955e5964496c186a.zip |
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>
Diffstat (limited to 'oox/source/ole/olehelper.cxx')
-rw-r--r-- | oox/source/ole/olehelper.cxx | 45 |
1 files changed, 11 insertions, 34 deletions
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 ); |