diff options
author | Noel Power <noel.power@novell.com> | 2011-07-12 10:07:51 +0100 |
---|---|---|
committer | Noel Power <noel.power@novell.com> | 2011-07-12 10:07:51 +0100 |
commit | 7efec84c9cc62694e953f0a8987d9a4a29c9a1f9 (patch) | |
tree | 3c2a235f456df70eb7dea08245e54f9c6502242a /sc | |
parent | e8342dab9d8cfdda174e8baecfef4853c6927604 (diff) |
use oox filter for *all* control import
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/excel/xiescher.cxx | 29 | ||||
-rw-r--r-- | sc/source/filter/inc/xiescher.hxx | 5 |
2 files changed, 28 insertions, 6 deletions
diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 6a15ee44f232..bc186e039116 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -115,6 +115,10 @@ #include "namebuff.hxx" #include <boost/shared_ptr.hpp> +#include <comphelper/componentcontext.hxx> +#include <comphelper/processfactory.hxx> +#include <comphelper/mediadescriptor.hxx> +#include <sfx2/docfile.hxx> using ::rtl::OUString; using ::rtl::OUStringBuffer; @@ -125,6 +129,7 @@ using ::com::sun::star::uno::Sequence; using ::com::sun::star::uno::UNO_QUERY; using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::uno::UNO_SET_THROW; +using ::com::sun::star::uno::XComponentContext; using ::com::sun::star::beans::NamedValue; using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::container::XIndexContainer; @@ -3132,6 +3137,12 @@ bool XclImpSimpleDffConverter::GetColorFromPalette( sal_uInt16 nIndex, Color& rC } // ---------------------------------------------------------------------------- +Reference< XComponentContext > +lcl_getUnoCtx() +{ + comphelper::ComponentContext aCtx( ::comphelper::getProcessServiceFactory() ); + return aCtx.getUNOContext(); +} XclImpDffConverter::XclImpDffConvData::XclImpDffConvData( XclImpDrawing& rDrawing, SdrModel& rSdrModel, SdrPage& rSdrPage ) : @@ -3142,13 +3153,12 @@ XclImpDffConverter::XclImpDffConvData::XclImpDffConvData( mbHasCtrlForm( false ) { } - // ---------------------------------------------------------------------------- XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ) : XclImpSimpleDffConverter( rRoot, rDffStrm ), - SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ), maStdFormName( CREATE_OUSTRING( "Standard" ) ), + maFormCtrlHelper( GetMedium().GetInputStream(), lcl_getUnoCtx(), GetDocShell()->GetModel() ), mnOleImpFlags( 0 ) { if( SvtFilterOptions* pFilterOpt = SvtFilterOptions::Get() ) @@ -3312,8 +3322,19 @@ SdrObject* XclImpDffConverter::CreateSdrObject( const XclImpPictureObj& rPicObj, mxCtlsStrm->Seek( rPicObj.GetCtlsStreamPos() ); // read from mxCtlsStrm into xShape, insert the control model into the form Reference< XShape > xShape; - if( GetConvData().mxCtrlForm.is() && ReadOCXExcelKludgeStream( mxCtlsStrm, &xShape, sal_True ) ) - xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) ); + if( GetConvData().mxCtrlForm.is() ) + { + Reference< XFormComponent > xFComp; + com::sun::star::awt::Size aSz; // not used in import + maFormCtrlHelper.importFormControlFromCtls( xFComp, rPicObj.GetCtlsStreamPos(), rPicObj.GetCtlsStreamSize() ); + // recreate the method formally known as + // ReadOCXExcelKludgeStream( ) + if ( xFComp.is() ) + { + InsertControl( xFComp, aSz,&xShape,true); + xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) ); + } + } } catch( Exception& ) { diff --git a/sc/source/filter/inc/xiescher.hxx b/sc/source/filter/inc/xiescher.hxx index 71c0b3c66859..7c05346b26ef 100644 --- a/sc/source/filter/inc/xiescher.hxx +++ b/sc/source/filter/inc/xiescher.hxx @@ -38,7 +38,7 @@ #include "xiroot.hxx" #include "xistring.hxx" #include <boost/shared_ptr.hpp> - +#include <oox/ole/olehelper.hxx> namespace com { namespace sun { namespace star { namespace drawing { class XShape; } namespace form { class XForm; } @@ -985,7 +985,7 @@ protected: contains core implementation of DFF stream import and OCX form control import. */ -class XclImpDffConverter : public XclImpSimpleDffConverter, private SvxMSConvertOCXControls +class XclImpDffConverter : public XclImpSimpleDffConverter { public: explicit XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ); @@ -1092,6 +1092,7 @@ private: typedef ::std::vector< XclImpDffConvDataRef > XclImpDffConvDataStack; const ::rtl::OUString maStdFormName; /// Standard name of control forms. + ::oox::ole::OleFormCtrlImportHelper maFormCtrlHelper; SotStorageStreamRef mxCtlsStrm; /// The 'Ctls' stream for OCX form controls. ScfProgressBarRef mxProgress; /// The progress bar used in ProcessObj(). XclImpDffConvDataStack maDataStack; /// Stack for registered drawing managers. |