[ooo-build-commit] .: patches/vba
Noel Power
noelp at kemper.freedesktop.org
Thu Jul 15 00:36:04 PDT 2010
patches/vba/vba-no-old-controlfilter-for-excel.diff | 256 ++++++++++++++++++++
1 file changed, 256 insertions(+)
New commits:
commit 6ae48de1f6f97ec9a575374d55c137ed4f04ec55
Author: Noel Power <noel.power at novell.com>
Date: Thu Jul 15 08:36:23 2010 +0100
fully remove old msocximex filter from controls ( from Calc/Excel )
* patches/vba/vba-no-old-controlfilter-for-excel.diff:
diff --git a/patches/vba/vba-no-old-controlfilter-for-excel.diff b/patches/vba/vba-no-old-controlfilter-for-excel.diff
new file mode 100644
index 0000000..b499e8b
--- /dev/null
+++ b/patches/vba/vba-no-old-controlfilter-for-excel.diff
@@ -0,0 +1,256 @@
+diff --git oox/inc/oox/xls/excelfilter.hxx oox/inc/oox/xls/excelfilter.hxx
+index 72ed636..f1f90ac 100644
+--- oox/inc/oox/xls/excelfilter.hxx
++++ oox/inc/oox/xls/excelfilter.hxx
+@@ -32,6 +32,7 @@
+ #include "oox/core/binaryfilterbase.hxx"
+ #include "oox/xls/excelvbaproject.hxx"
+ #include "oox/ole/simplevbaprojectfilter.hxx"
++#include <com/sun/star/form/XFormComponent.hpp>
+
+ namespace oox {
+ namespace xls {
+@@ -102,6 +103,7 @@ public:
+ virtual bool importDocument() throw();
+
+ private:
++ bool importFormControl( ::com::sun::star::uno::Reference< ::com::sun::star::form::XFormComponent >& rxFormComp, sal_Int32 nStrmPos );
+ virtual GraphicHelper* implCreateGraphicHelper() const;
+ virtual ::rtl::OUString implGetImplementationName() const;
+ };
+diff --git oox/source/ole/.vbaproject.cxx.swp oox/source/ole/.vbaproject.cxx.swp
+index a51a0be..3d0609f 100644
+Binary files oox/source/ole/.vbaproject.cxx.swp and oox/source/ole/.vbaproject.cxx.swp differ
+diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
+index fed9dcd..c5a9a06 100644
+--- oox/source/xls/excelfilter.cxx
++++ oox/source/xls/excelfilter.cxx
+@@ -33,9 +33,11 @@
+ #include "oox/xls/stylesbuffer.hxx"
+ #include "oox/xls/themebuffer.hxx"
+ #include "oox/xls/workbookfragment.hxx"
++#include "oox/ole/axcontrol.hxx"
+ #include "oox/dump/biffdumper.hxx"
+ #include "oox/dump/xlsbdumper.hxx"
+ #include <com/sun/star/container/XNameContainer.hpp>
++#include <com/sun/star/awt/XControlModel.hpp>
+
+ using ::rtl::OUString;
+ using ::com::sun::star::uno::Any;
+@@ -43,6 +45,7 @@ using ::com::sun::star::uno::Reference;
+ using ::com::sun::star::uno::Sequence;
+ using ::com::sun::star::uno::Exception;
+ using ::com::sun::star::uno::XInterface;
++using ::com::sun::star::uno::UNO_QUERY;
+ using ::com::sun::star::container::XNameContainer;
+ using ::com::sun::star::lang::XMultiServiceFactory;
+ using ::com::sun::star::xml::sax::XFastDocumentHandler;
+@@ -52,6 +55,9 @@ using ::oox::core::Relation;
+ using ::oox::core::Relations;
+ using ::oox::core::XmlFilterBase;
+ using ::oox::drawingml::table::TableStyleListPtr;
++using ::com::sun::star::form::XFormComponent;
++using ::com::sun::star::awt::XControlModel;
++using ::com::sun::star::beans::XPropertySet;
+
+ namespace oox {
+ namespace xls {
+@@ -268,6 +274,28 @@ SimpleExcelVBAProjFilter::SimpleExcelVBAProjFilter( const Reference< XMultiServi
+ {
+ }
+
++bool SimpleExcelVBAProjFilter::importFormControl( Reference< XFormComponent >& rxFormComp, sal_Int32 nPos )
++{
++ bool bRet = false;
++
++ ::oox::ole::EmbeddedControl aControl( CREATE_OUSTRING( "Unknown" ) );
++ BinaryXInputStream aInStrm( openInputStream( CREATE_OUSTRING( "Ctls" ) ), true );
++
++ aInStrm.skip( nPos );
++ OUString aStrmClassId = ::oox::ole::OleHelper::importGuid( aInStrm );
++
++ if( ::oox::ole::ControlModelBase* pModel = aControl.createModel( aStrmClassId ).get() )
++ {
++ pModel->importBinaryModel( aInStrm );
++ rxFormComp.set( getGlobalFactory()->createInstance( pModel->getServiceName() ), UNO_QUERY );
++ Reference< XControlModel > xCtlModel( rxFormComp, UNO_QUERY );
++ ::oox::ole::ControlConverter aConv( getGraphicHelper() );
++ aControl.convertProperties( xCtlModel, aConv );
++ }
++
++ return bRet;
++}
++
+ bool SimpleExcelVBAProjFilter::importDocument() throw()
+ {
+ bool bRet = false;
+@@ -282,7 +310,22 @@ bool SimpleExcelVBAProjFilter::importDocument() throw()
+ getArgument( CREATE_OUSTRING( "GeneratedCodeNames" ) ) >>= sGeneratedCNames;
+ Reference< XNameContainer > xOleNameOverrideSink;
+ getArgument( CREATE_OUSTRING( "OleNameOverrideInfo" ) ) >>= xOleNameOverrideSink;
++
+ WorkbookHelperRoot aHelper( *this, eBiff );
++ // # Temporary Hack to allow at least for Excel removal of
++ // the old msocximex filter for importing controls
++
++ Reference< XPropertySet > xProps;
++ if ( ( getArgument( CREATE_OUSTRING( "ImportFormControl" ) ) >>= xProps ) && xProps.is() )
++ {
++ sal_Int32 nStrmPos = 0;
++ xProps->getPropertyValue( CREATE_OUSTRING( "StreamPosition" ) ) >>= nStrmPos;
++ Reference< XFormComponent > xFormComp;
++ bRet = importFormControl( xFormComp, nStrmPos );
++ xProps->setPropertyValue( CREATE_OUSTRING( "Control" ), Any( xFormComp ) );
++ return xFormComp.is();
++ }
++
+ StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false ) ;
+ if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
+ {
+diff --git sc/source/filter/excel/.excimp8.cxx.swp sc/source/filter/excel/.excimp8.cxx.swp
+index 77bc9f1..6982451 100644
+Binary files sc/source/filter/excel/.excimp8.cxx.swp and sc/source/filter/excel/.excimp8.cxx.swp differ
+diff --git sc/source/filter/excel/xiescher.cxx sc/source/filter/excel/xiescher.cxx
+index afea800..bfdff62 100644
+--- sc/source/filter/excel/xiescher.cxx
++++ sc/source/filter/excel/xiescher.cxx
+@@ -118,6 +118,15 @@
+
+ #include "namebuff.hxx"
+
++#include <sfx2/docfile.hxx>
++#include <com/sun/star/document/XFilter.hpp>
++#include <comphelper/processfactory.hxx>
++#include <com/sun/star/document/XImporter.hpp>
++#include <com/sun/star/beans/XPropertyContainer.hpp>
++#include <com/sun/star/beans/XPropertySet.hpp>
++#include <com/sun/star/beans/PropertyAttribute.hpp>
++#include <comphelper/mediadescriptor.hxx>
++
+ using ::rtl::OUString;
+ using ::rtl::OUStringBuffer;
+ using ::com::sun::star::uno::Any;
+@@ -129,6 +138,7 @@ using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_SET_THROW;
+ using ::com::sun::star::beans::NamedValue;
+ using ::com::sun::star::lang::XMultiServiceFactory;
++using ::com::sun::star::lang::XComponent;
+ using ::com::sun::star::container::XIndexContainer;
+ using ::com::sun::star::container::XNameContainer;
+ using ::com::sun::star::frame::XModel;
+@@ -148,7 +158,13 @@ using ::com::sun::star::script::ScriptEventDescriptor;
+ using ::com::sun::star::script::XEventAttacherManager;
+ using ::com::sun::star::table::CellAddress;
+ using ::com::sun::star::table::CellRangeAddress;
++using ::com::sun::star::document::XImporter;
++using ::com::sun::star::document::XFilter;
++using ::com::sun::star::beans::XPropertyContainer;
++using ::com::sun::star::beans::XPropertySet;
++using ::com::sun::star::beans::PropertyAttribute::MAYBEVOID;
+
++using namespace ::comphelper;
+ // ============================================================================
+
+ namespace {
+@@ -191,6 +207,54 @@ typedef TSdrObjectPtr< SdrObject > SdrObjectPtr;
+
+ } // namespace
+
++// SfxMedium& rMedium = GetMedium();
++void importFormControl( const Reference< XModel >& xModel, SfxMedium& rMedium, Reference< XFormComponent >& xFComp, sal_Int32 nStrmPos )
++{
++ try
++ {
++ Reference< XComponent > xComponent( xModel, UNO_QUERY_THROW );
++ Sequence< NamedValue > aArgSeq(1);
++ aArgSeq[ 0 ].Name = CREATE_OUSTRING( "ImportFormControl");
++ Reference< XMultiServiceFactory > xFac( ::comphelper::getProcessServiceFactory
++(), UNO_QUERY_THROW );
++
++ Reference< XPropertyContainer > xPropBag( xFac->createInstance( CREATE_OUSTRING( "com.sun.star.beans.PropertyBag" ) ), UNO_QUERY_THROW );
++ aArgSeq[ 0 ].Value <<= xPropBag;
++
++ xPropBag->addProperty( CREATE_OUSTRING( "StreamPosition" ), MAYBEVOID, Any( nStrmPos ) );
++ xPropBag->addProperty( CREATE_OUSTRING( "Control" ), MAYBEVOID, Any( xFComp ) );
++
++ Sequence< Any > aArgs(2);
++ aArgs[ 0 ] <<= ::comphelper::getProcessServiceFactory();
++ aArgs[ 1 ] <<= aArgSeq;
++
++ Reference< XImporter > xImporter( ScfApiHelper::CreateInstanceWithArgs( CREATE_OUSTRING( "com.sun.star.comp.xls.SimpleExcelVBAProjFilter" ), aArgs ), UNO_QUERY_THROW );
++ xImporter->setTargetDocument( xComponent );
++
++ MediaDescriptor aMediaDesc;
++ SfxItemSet* pItemSet = rMedium.GetItemSet();
++ if( pItemSet )
++ {
++ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_FILE_NAME ) ) )
++ aMediaDesc[ MediaDescriptor::PROP_URL() ] <<= ::rtl::OUString( pItem->GetValue() );
++ if( const SfxStringItem* pItem = static_cast< const SfxStringItem* >( pItemSet->GetItem( SID_PASSWORD ) ) )
++ aMediaDesc[ MediaDescriptor::PROP_PASSWORD() ] <<= ::rtl::OUString( pItem->GetValue() );
++ }
++ aMediaDesc[ MediaDescriptor::PROP_INPUTSTREAM() ] <<= rMedium.GetInputStream();
++ aMediaDesc[ MediaDescriptor::PROP_INTERACTIONHANDLER() ] <<= rMedium.GetInteractionHandler();
++
++ // call the filter
++ Reference< XFilter > xFilter( xImporter, UNO_QUERY_THROW );
++ if ( xFilter->filter( aMediaDesc.getAsConstPropertyValueList() ) )
++ {
++ Reference< XPropertySet > xPropSet( xPropBag, UNO_QUERY_THROW );
++ xPropSet->getPropertyValue( CREATE_OUSTRING( "Control" ) ) >>= xFComp;
++ }
++ }
++ catch( Exception& )
++ {
++ }
++}
+ // Drawing objects ============================================================
+
+ XclImpDrawObjBase::XclImpDrawObjBase( const XclImpRoot& rRoot ) :
+@@ -3171,7 +3235,7 @@ XclImpDffConverter::XclImpDffConvData::XclImpDffConvData(
+
+ XclImpDffConverter::XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm ) :
+ XclImpSimpleDffConverter( rRoot, rDffStrm ),
+- SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ),
++// SvxMSConvertOCXControls( rRoot.GetDocShell(), 0 ),
+ maStdFormName( CREATE_OUSTRING( "Standard" ) ),
+ mnOleImpFlags( 0 )
+ {
+@@ -3336,8 +3400,24 @@ 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, TRUE ) )
+ xSdrObj.reset( rPicObj.CreateSdrObjectFromShape( xShape, rAnchorRect ) );
++*/
++ if( GetConvData().mxCtrlForm.is() )
++ {
++ Reference< XFormComponent > xFComp;
++ com::sun::star::awt::Size aSz; // not used in import
++ SfxMedium& rMedium = GetMedium();
++ importFormControl( GetDocShell()->GetModel(), rMedium, xFComp, rPicObj.GetCtlsStreamPos() );
++ // 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 sc/source/filter/inc/xiescher.hxx sc/source/filter/inc/xiescher.hxx
+index 38464fa..81f1cfd 100644
+--- sc/source/filter/inc/xiescher.hxx
++++ sc/source/filter/inc/xiescher.hxx
+@@ -990,7 +990,7 @@ protected:
+ contains core implementation of DFF stream import and OCX form control
+ import.
+ */
+-class XclImpDffConverter : public XclImpSimpleDffConverter, private SvxMSConvertOCXControls
++class XclImpDffConverter : public XclImpSimpleDffConverter/*, private SvxMSConvertOCXControls*/
+ {
+ public:
+ explicit XclImpDffConverter( const XclImpRoot& rRoot, SvStream& rDffStrm );
More information about the ooo-build-commit
mailing list