[Libreoffice-commits] .: sc/source

Noel Power noelp at kemper.freedesktop.org
Tue Jul 12 02:46:05 PDT 2011


 sc/source/filter/excel/xiescher.cxx |   29 +++++++++++++++++++++++++----
 sc/source/filter/inc/xiescher.hxx   |    5 +++--
 2 files changed, 28 insertions(+), 6 deletions(-)

New commits:
commit ec33010b89003d0983d4c3b746c5174dfeee8061
Author: Noel Power <noel.power at novell.com>
Date:   Tue Jul 12 10:07:51 2011 +0100

    use oox filter for *all* control import

diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx
index 408321b..34ac6cd 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 71c0b3c..7c05346 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.


More information about the Libreoffice-commits mailing list