diff options
author | Noel Power <noel.power@suse.com> | 2013-06-10 17:30:07 +0100 |
---|---|---|
committer | Noel Power <noel.power@suse.com> | 2013-06-11 14:10:01 +0100 |
commit | 866845356629dd51660b73330bb9c8a2696147dd (patch) | |
tree | 2d2a48289de1a877acbda4dacdbd7df9d47b19e5 | |
parent | 74d631dfb37ec870575d873c82e982a58f65d60c (diff) |
fix build error, reinstate WriteOCXExcelKludgeStream to export ole control
new ole export used WriteOCXExcelKludgeStream but that function dissapeared when
msocximex was stripped of ocx control import ( now we use the new filters in oox )
When that stuff was moved WriteOCXExcelKludgeStream was #ifdef'ed out
Change-Id: I370983efa5e8c4ba2b210dfb7535ea211d13a8c1
-rw-r--r-- | include/oox/ole/olehelper.hxx | 4 | ||||
-rw-r--r-- | oox/source/ole/olehelper.cxx | 31 | ||||
-rw-r--r-- | sc/source/filter/xcl97/xcl97esc.cxx | 19 |
3 files changed, 44 insertions, 10 deletions
diff --git a/include/oox/ole/olehelper.hxx b/include/oox/ole/olehelper.hxx index e75a0cd07588..85cca196c4f0 100644 --- a/include/oox/ole/olehelper.hxx +++ b/include/oox/ole/olehelper.hxx @@ -39,6 +39,8 @@ #include "oox/dllapi.h" #include "sot/storage.hxx" +class SvGlobalName; + namespace oox { class BinaryInputStream; class BinaryOutputStream; @@ -122,6 +124,7 @@ public: representation (in uppercase characters). */ static OUString importGuid( BinaryInputStream& rInStrm ); + static void exportGuid( BinaryOutputStream& rOutStrm, const SvGlobalName& rId ); /** Imports an OLE StdFont font structure from the current position of the passed binary stream. @@ -175,6 +178,7 @@ public: sal_Bool ReadOCXCtlsStream(SotStorageStreamRef& rSrc1, ::com::sun::star::uno::Reference< com::sun::star::form::XFormComponent > & rxFormComp, sal_Int32 nPos, sal_Int32 nSize ); static sal_Bool WriteOCXStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, SotStorageRef &rSrc1, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName); + static sal_Bool WriteOCXExcelKludgeStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStrm, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rControlModel, const com::sun::star::awt::Size& rSize,OUString &rName); #ifdef SvxMSConvertOCXControlsRemoved const com::sun::star::uno::Reference< com::sun::star::drawing::XShapes > & GetShapes(); diff --git a/oox/source/ole/olehelper.cxx b/oox/source/ole/olehelper.cxx index e87f2cde88a7..58aa67e485f2 100644 --- a/oox/source/ole/olehelper.cxx +++ b/oox/source/ole/olehelper.cxx @@ -284,6 +284,22 @@ sal_uInt32 OleHelper::encodeOleColor( sal_Int32 nRgbColor ) return OLE_COLORTYPE_BGR | lclSwapRedBlue( static_cast< sal_uInt32 >( nRgbColor & 0xFFFFFF ) ); } +void OleHelper::exportGuid( BinaryOutputStream& rOStr, const SvGlobalName& rId ) +{ + const sal_uInt8* pBytes = rId.GetBytes(); + sal_uInt32 a; + memcpy(&a, pBytes, sizeof(sal_uInt32)); + rOStr<< a; + + sal_uInt16 b; + memcpy(&b, pBytes+4, sizeof(sal_uInt16)); + rOStr << b; + + memcpy(&b, pBytes+6, sizeof(sal_uInt16)); + rOStr << b; + + rOStr.writeArray( (sal_Char *)&pBytes[ 8 ], 8 ); +} OUString OleHelper::importGuid( BinaryInputStream& rInStrm ) { OUStringBuffer aBuffer; @@ -569,6 +585,21 @@ sal_Bool MSConvertOCXControls::ReadOCXStorage( SotStorageRef& xOleStg, return sal_False; } +sal_Bool MSConvertOCXControls::WriteOCXExcelKludgeStream( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& rxModel, const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutStrm, const com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > &rxControlModel, const com::sun::star::awt::Size& rSize,OUString &rName ) +{ + OleFormCtrlExportHelper exportHelper( comphelper::getProcessComponentContext(), rxModel, rxControlModel ); + if ( !exportHelper.isValid() ) + return sal_False; + rName = exportHelper.getTypeName(); + SvGlobalName aName; + OUString sId = exportHelper.getGUID(); + aName.MakeId(sId); + BinaryXOutputStream xOut( xOutStrm, false ); + OleHelper::exportGuid( xOut, aName ); + exportHelper.exportControl( xOutStrm, rSize ); + return sal_True; +} + sal_Bool MSConvertOCXControls::WriteOCXStream( const Reference< XModel >& rxModel, SotStorageRef &xOleStg, const Reference< XControlModel > &rxControlModel, const com::sun::star::awt::Size& rSize, OUString &rName) diff --git a/sc/source/filter/xcl97/xcl97esc.cxx b/sc/source/filter/xcl97/xcl97esc.cxx index 4ffad4065066..bcdec460cc66 100644 --- a/sc/source/filter/xcl97/xcl97esc.cxx +++ b/sc/source/filter/xcl97/xcl97esc.cxx @@ -52,6 +52,9 @@ #include "xehelper.hxx" #include "xechart.hxx" #include "xcl97esc.hxx" +#include <unotools/streamwrap.hxx> +#include <oox/ole/olehelper.hxx> +#include <sfx2/objsh.hxx> using ::com::sun::star::uno::Any; using ::com::sun::star::uno::Exception; @@ -68,6 +71,7 @@ using ::com::sun::star::uno::Any; using ::com::sun::star::form::XForm; using ::com::sun::star::form::XFormComponent; using ::com::sun::star::form::XFormsSupplier; +using ::com::sun::star::io::XOutputStream; using ::com::sun::star::script::ScriptEventDescriptor; using ::com::sun::star::script::XEventAttacherManager; @@ -410,9 +414,6 @@ void XclEscherEx::EndDocument() mpOutStrm->Seek( 0 ); } -//delete for exporting OCX -//#if EXC_EXP_OCX_CTRL - XclExpOcxControlObj* XclEscherEx::CreateOCXCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor ) { ::std::auto_ptr< XclExpOcxControlObj > xOcxCtrl; @@ -425,15 +426,17 @@ XclExpOcxControlObj* XclEscherEx::CreateOCXCtrlObj( Reference< XShape > xShape, mxCtlsStrm = OpenStream( EXC_STREAM_CTLS ); if( mxCtlsStrm.Is() ) { - String aClassName; + OUString aClassName; sal_uInt32 nStrmStart = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() ); // writes from xCtrlModel into mxCtlsStrm, raw class name returned in aClassName - if( SvxMSConvertOCXControls::WriteOCXExcelKludgeStream( mxCtlsStrm, xCtrlModel, xShape->getSize(), aClassName ) ) + Reference< XOutputStream > xOut( new utl::OSeekableOutputStreamWrapper( *mxCtlsStrm ) ); + Reference< com::sun::star::frame::XModel > xModel( GetDocShell() ? GetDocShell()->GetModel() : NULL ); + if( xModel.is() && xOut.is() && oox::ole::MSConvertOCXControls::WriteOCXExcelKludgeStream( xModel, xOut, xCtrlModel, xShape->getSize(), aClassName ) ) { sal_uInt32 nStrmSize = static_cast< sal_uInt32 >( mxCtlsStrm->Tell() - nStrmStart ); // adjust the class name to "Forms.***.1" - aClassName.InsertAscii( "Forms.", 0 ).AppendAscii( ".1" ); + aClassName = "Forms." + aClassName + ".1"; xOcxCtrl.reset( new XclExpOcxControlObj( mrObjMgr, xShape, pChildAnchor, aClassName, nStrmStart, nStrmSize ) ); } } @@ -441,8 +444,6 @@ XclExpOcxControlObj* XclEscherEx::CreateOCXCtrlObj( Reference< XShape > xShape, return xOcxCtrl.release(); } -//#else - XclExpTbxControlObj* XclEscherEx::CreateTBXCtrlObj( Reference< XShape > xShape, const Rectangle* pChildAnchor ) { ::std::auto_ptr< XclExpTbxControlObj > xTbxCtrl( new XclExpTbxControlObj( mrObjMgr, xShape, pChildAnchor ) ); @@ -511,8 +512,6 @@ void XclEscherEx::ConvertTbxMacro( XclExpTbxControlObj& rTbxCtrlObj, Reference< } } -//#endif - void XclEscherEx::DeleteCurrAppData() { if ( pCurrAppData ) |