Commits

Anonymous committed 2cc8ced

container_controls: #i113048# read control name overrides from module attributes

  • Participants
  • Parent commits 45564ca

Comments (0)

Files changed (10)

oox/inc/oox/helper/containerhelper.hxx

                             forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
                         }
 
+    /** Calls the passed member function of ObjType on every contained object,
+        automatically skips all elements that are empty references. */
+    template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
+    inline void         forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
+                        {
+                            forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
+                        }
     /** Calls the passed functor for every contained object. Passes the index as
         first argument and the object reference as second argument to rFunctor. */
     template< typename FunctorType >
                         {
                             forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3 ) );
                         }
+    /** Calls the passed member function of ObjType on every contained object,
+        automatically skips all elements that are empty references. */
+    template< typename FuncType, typename ParamType1, typename ParamType2, typename ParamType3, typename ParamType4 >
+    inline void         forEachMem( FuncType pFunc, ParamType1 aParam1, ParamType2 aParam2, ParamType3 aParam3, ParamType4 aParam4 ) const
+                        {
+                            forEach( ::boost::bind( pFunc, _1, aParam1, aParam2, aParam3, aParam4 ) );
+                        }
     /** Calls the passed functor for every contained object. Passes the key as
         first argument and the object reference as second argument to rFunctor. */
     template< typename FunctorType >

oox/inc/oox/ole/vbamodule.hxx

     void                importSourceCode(
                             StorageBase& rVbaStrg,
                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
-                            const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
+                            const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA, const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
 
     /** Creates empty document module for the passed Basic library/project. */
     void                createEmptyDocModule(
                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxBasicLib,
                             const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess >& rxDocObjectNA ) const;
 private:
+    void extractOleOverrideFromAttr( const rtl::OUString& rAttribute, 
+                                     const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >& rxOleNameOverrides ) const;
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
                         mxDocModel;         /// Document model used to import/export the VBA project.
     ::rtl::OUString     maName;

oox/inc/oox/ole/vbaproject.hxx

                             const ::rtl::OUString& rProxyArgs,
                             const ::rtl::OUString& rProxyType,
                             const ::rtl::OUString& rProxyCode );
-
+    void                setOleOverridesSink( ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >&  rxOleOverridesSink ){ mxOleOverridesSink = rxOleOverridesSink; }
 private:
                         VbaProject( const VbaProject& );
     VbaProject&         operator=( const VbaProject& );
                         mxBasicLib;         /// The Basic library of the document used for import.
     ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
                         mxDialogLib;        /// The dialog library of the document used for import.
+    ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer >
+                        mxOleOverridesSink;
     ::rtl::OUString     maPrjName;        /// Name of VBA project being imported
 };
 

oox/source/ole/vbamodule.cxx

 
 #include "oox/ole/vbamodule.hxx"
 #include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
 #include <com/sun/star/script/ModuleInfo.hpp>
 #include <com/sun/star/script/ModuleType.hpp>
 #include <com/sun/star/script/XVBAModuleInfo.hpp>
 #include "oox/helper/textinputstream.hxx"
 #include "oox/ole/vbahelper.hxx"
 #include "oox/ole/vbainputstream.hxx"
+#include <hash_map>
+#include <cppuhelper/implbase1.hxx>
 
 using ::rtl::OUString;
 using ::rtl::OUStringBuffer;
 using ::com::sun::star::container::XNameAccess;
 using ::com::sun::star::container::XNameContainer;
+using ::com::sun::star::container::XIndexContainer;
+using ::com::sun::star::container::ElementExistException;
+using ::com::sun::star::container::NoSuchElementException;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::lang::WrappedTargetException;
+using ::com::sun::star::lang::IllegalArgumentException;
 using ::com::sun::star::frame::XModel;
 using ::com::sun::star::script::ModuleInfo;
 using ::com::sun::star::script::XVBAModuleInfo;
 using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Type;
+using ::com::sun::star::uno::makeAny;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::RuntimeException;
 using ::com::sun::star::uno::UNO_QUERY;
 using ::com::sun::star::uno::UNO_QUERY_THROW;
 
 namespace ole {
 
 // ============================================================================
+typedef ::cppu::WeakImplHelper1< XIndexContainer > OleIdToNameContainer_BASE;
+typedef std::hash_map< sal_Int32, rtl::OUString >  ObjIdToName;
+class OleIdToNameContainer : public OleIdToNameContainer_BASE
+{
+    ObjIdToName ObjIdToNameHash;
+    ::osl::Mutex m_aMutex;
+    bool hasByIndex( ::sal_Int32 Index )
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return ( ObjIdToNameHash.find( Index ) != ObjIdToNameHash.end() );
+    }
+public:
+    OleIdToNameContainer() {}
+    // XIndexContainer Methods
+    virtual void SAL_CALL insertByIndex( ::sal_Int32 Index, const Any& Element ) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        rtl::OUString sOleName;
+        if ( !( Element >>= sOleName ) )
+            throw IllegalArgumentException();
+        ObjIdToNameHash[ Index ] = sOleName;
+    }
+    virtual void SAL_CALL removeByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByIndex( Index ) )
+            throw IndexOutOfBoundsException();
+        ObjIdToNameHash.erase( ObjIdToNameHash.find( Index ) );
+    }
+    // XIndexReplace Methods
+    virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const Any& Element ) throw (IllegalArgumentException, IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByIndex( Index ) )
+            throw IndexOutOfBoundsException();
+        rtl::OUString sOleName;
+        if ( !( Element >>= sOleName ) )
+            throw IllegalArgumentException();
+        ObjIdToNameHash[ Index ] = sOleName;
+    }
+    // XIndexAccess Methods
+    virtual ::sal_Int32 SAL_CALL getCount(  ) throw (RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return ObjIdToNameHash.size();
+    }
+    virtual Any SAL_CALL getByIndex( ::sal_Int32 Index ) throw (IndexOutOfBoundsException, WrappedTargetException, RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByIndex( Index ) )
+            throw IndexOutOfBoundsException();
+        return makeAny( ObjIdToNameHash[ Index ] );
+    }
+    // XElementAccess Methods
+    virtual Type SAL_CALL getElementType(  ) throw (RuntimeException)
+    {
+        return ::getCppuType((const ::rtl::OUString*)(NULL) );
+    }
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return ( getCount() > 0 );
+    }
+};
 
 VbaModule::VbaModule( const Reference< XModel >& rxDocModel, const OUString& rName, rtl_TextEncoding eTextEnc, bool bExecutable ) :
     mxDocModel( rxDocModel ),
     OSL_ENSURE( mnOffset < SAL_MAX_UINT32, "VbaModule::importDirRecords - missing module stream offset" );
 }
 
+void VbaModule::extractOleOverrideFromAttr( const rtl::OUString& rAttribute,
+                                            const Reference< XNameContainer >& rxOleNameOverrides ) const
+{
+    // format of the attribute we are interested in is
+    // Attribute VB_Control = "ControlName", intString, MSForms, ControlTypeAsString
+    // e.g.
+    // Attribute VB_Control = "CommandButton1, 201, 19, MSForms, CommandButton"
+    rtl::OUString sControlAttribute( RTL_CONSTASCII_USTRINGPARAM("Attribute VB_Control = \"") );
+    if ( rxOleNameOverrides.is() && rAttribute.indexOf( sControlAttribute ) !=  -1 )
+    {
+        rtl::OUString sRest = rAttribute.copy( sControlAttribute.getLength() );
+        sal_Int32 nPos = sRest.indexOf( ',' );
+        rtl::OUString sCntrlName = sRest.copy( 0, nPos );
+        
+        sal_Int32 nCntrlId = sRest.copy( nPos + 1 ).copy( 0, sRest.indexOf( ',', nPos + 1) ).toInt32();
+        OSL_TRACE("In module %s, assiging %d controlname %s", 
+            rtl::OUStringToOString( maName, RTL_TEXTENCODING_UTF8 ).getStr(), nCntrlId,
+            rtl::OUStringToOString( sCntrlName, RTL_TEXTENCODING_UTF8 ).getStr() );
+        if ( !rxOleNameOverrides->hasByName( maName ) )
+            rxOleNameOverrides->insertByName( maName, makeAny( Reference< XIndexContainer> ( new OleIdToNameContainer() ) ) );
+        Reference< XIndexContainer > xIdToOleName;
+        if ( rxOleNameOverrides->getByName( maName ) >>= xIdToOleName )
+            xIdToOleName->insertByIndex( nCntrlId, makeAny( sCntrlName ) );
+    }
+}
+
 void VbaModule::importSourceCode( StorageBase& rVbaStrg,
-        const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA ) const
+        const Reference< XNameContainer >& rxBasicLib, const Reference< XNameAccess >& rxDocObjectNA,  const Reference< XNameContainer >& rxOleNameOverrides ) const
 {
     if( (maName.getLength() == 0) || (maStreamName.getLength() == 0) || (mnOffset == SAL_MAX_UINT32) )
         return;
                 aSourceCode.appendAscii( RTL_CONSTASCII_STRINGPARAM( "Rem " ) );
             aSourceCode.append( aCodeLine ).append( sal_Unicode( '\n' ) );
         }
+        else
+            extractOleOverrideFromAttr( aCodeLine, rxOleNameOverrides );
     }
 
     // close the subroutine named after the module

oox/source/ole/vbaproject.cxx

             aGeneratedModules.forEachMem( &VbaModule::createEmptyDocModule,
                 ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
             aModules.forEachMem( &VbaModule::importSourceCode,
-                ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ) );
+                ::boost::ref( *xVbaStrg ), ::boost::cref( xBasicLib ), ::boost::cref( xDocObjectNA ), ::boost::cref( mxOleOverridesSink ) );
         }
     }
     catch( Exception& )

oox/source/xls/excelfilter.cxx

 #include "oox/xls/workbookfragment.hxx"
 #include "oox/dump/biffdumper.hxx"
 #include "oox/dump/xlsbdumper.hxx"
+#include <com/sun/star/container/XNameContainer.hpp>
 
 using ::rtl::OUString;
 using ::com::sun::star::uno::Any;
 using ::com::sun::star::uno::Sequence;
 using ::com::sun::star::uno::Exception;
 using ::com::sun::star::uno::XInterface;
+using ::com::sun::star::container::XNameContainer;
 using ::com::sun::star::lang::XMultiServiceFactory;
 using ::com::sun::star::xml::sax::XFastDocumentHandler;
 using ::oox::core::BinaryFilterBase;
     {
         Sequence< rtl::OUString > sGeneratedCNames;
         getArgument( CREATE_OUSTRING( "GeneratedCodeNames" ) ) >>= sGeneratedCNames;
+        Reference< XNameContainer > xOleNameOverrideSink;
+        getArgument( CREATE_OUSTRING( "OleNameOverrideInfo" ) ) >>= xOleNameOverrideSink;
         WorkbookHelperRoot aHelper( *this, eBiff );
         StorageRef xVbaPrjStrg = openSubStorage( CREATE_OUSTRING( "_VBA_PROJECT_CUR" ), false )    ;
         if( xVbaPrjStrg.get() && xVbaPrjStrg->isStorage() )
         {
             VbaProject aVbaProject( getGlobalFactory(), aHelper.getDocument() );
+            aVbaProject.setOleOverridesSink( xOleNameOverrideSink );
             aVbaProject.importVbaProject( *xVbaPrjStrg, getGraphicHelper(), sGeneratedCNames );
             bRet = true;
         }

sc/source/filter/excel/excimp8.cxx

 #include <basic/basmgr.hxx>
 #include <cppuhelper/component_context.hxx>
 #include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/container/XIndexContainer.hpp>
 #include <sfx2/app.hxx>
 #include <com/sun/star/document/XFilter.hpp>
 #include <com/sun/star/document/XImporter.hpp>
 
 
 
+//OleNameOverrideContainer
+
+typedef ::cppu::WeakImplHelper1< container::XNameContainer > OleNameOverrideContainer_BASE;
+
+class OleNameOverrideContainer : public OleNameOverrideContainer_BASE
+{
+private:
+    typedef std::hash_map< rtl::OUString, uno::Reference< container::XIndexContainer >, ::rtl::OUStringHash,
+       ::std::equal_to< ::rtl::OUString > > NamedIndexToOleName;
+    NamedIndexToOleName  IdToOleNameHash;
+    ::osl::Mutex m_aMutex;
+public:
+    // XElementAccess
+    virtual uno::Type SAL_CALL getElementType(  ) throw (uno::RuntimeException) { return  container::XIndexContainer::static_type(0); }
+    virtual ::sal_Bool SAL_CALL hasElements(  ) throw (uno::RuntimeException) 
+    { 
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return ( IdToOleNameHash.size() > 0 ); 
+    }
+    // XNameAcess 
+    virtual uno::Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByName(aName) )
+            throw container::NoSuchElementException();
+        return uno::makeAny( IdToOleNameHash[ aName ] );
+    }
+    virtual uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(  ) throw (uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        uno::Sequence< ::rtl::OUString > aResult( IdToOleNameHash.size() );
+        NamedIndexToOleName::iterator it = IdToOleNameHash.begin();
+        NamedIndexToOleName::iterator it_end = IdToOleNameHash.end();
+        rtl::OUString* pName = aResult.getArray();
+        for (; it != it_end; ++it, ++pName )
+            *pName = it->first; 
+        return aResult;
+    }
+    virtual ::sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName ) throw (uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return ( IdToOleNameHash.find( aName ) != IdToOleNameHash.end() );        
+    }
+
+    // XElementAccess
+    virtual ::sal_Int32 SAL_CALL getCount(  ) throw (uno::RuntimeException) 
+    { 
+        ::osl::MutexGuard aGuard( m_aMutex );
+        return IdToOleNameHash.size(); 
+    }	
+    // XNameContainer
+    virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( hasByName( aName ) )
+            throw container::ElementExistException();
+        uno::Reference< container::XIndexContainer > xElement;
+        if ( ! ( aElement >>= xElement ) )
+            throw lang::IllegalArgumentException(); 
+       IdToOleNameHash[ aName ] = xElement;
+    }
+    virtual void SAL_CALL removeByName( const ::rtl::OUString& aName ) throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByName( aName ) )
+            throw container::NoSuchElementException(); 
+        IdToOleNameHash.erase( IdToOleNameHash.find( aName ) );
+    }
+    virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const uno::Any& aElement ) throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
+    {
+        ::osl::MutexGuard aGuard( m_aMutex );
+        if ( !hasByName( aName ) )
+            throw container::NoSuchElementException(); 
+        uno::Reference< container::XIndexContainer > xElement;
+        if ( ! ( aElement >>= xElement ) )
+            throw lang::IllegalArgumentException(); 
+        IdToOleNameHash[ aName ] = xElement;
+    }    
+};
 
 ImportExcel8::ImportExcel8( XclImpRootData& rImpData, SvStream& rStrm ) :
     ImportExcel( rImpData, rStrm )
         try
         {
             uno::Reference< lang::XComponent > xComponent( pShell->GetModel(), uno::UNO_QUERY_THROW );
-                uno::Sequence< beans::NamedValue > aArgSeq(1);
+                uno::Sequence< beans::NamedValue > aArgSeq(2);
                 // I guess we could actually handle the GeneratedCodeNames here
                 // ( e.g. after import create the required modules ) but...
                 // better to reuse the code in the filter right?
                 }
                 aArgSeq[ 0 ].Value <<= sGeneratedCNames;
 
+                aArgSeq[ 1 ].Name = CREATE_OUSTRING( "OleNameOverrideInfo");
+                uno::Reference< container::XNameContainer > xOleNameOverrideSink( new OleNameOverrideContainer() );
+                aArgSeq[ 1 ].Value <<=  xOleNameOverrideSink;
+          
                 uno::Sequence< uno::Any > aArgs( 2 );
                 aArgs[ 0 ] <<= getProcessServiceFactory();
                 aArgs[ 1 ] <<= aArgSeq;
             // call the filter
             uno::Reference< document::XFilter > xFilter( xImporter, uno::UNO_QUERY_THROW );
             xFilter->filter( aMediaDesc.getAsConstPropertyValueList() );
+            GetObjectManager().SetOleNameOverrideInfo( xOleNameOverrideSink );
         }
         catch( uno::Exception& )
         {

sc/source/filter/excel/read.cxx

         std::vector < SCTAB >::iterator it_end = nTabsWithNoCodeName.end();
         for ( std::vector < SCTAB >::iterator it = nTabsWithNoCodeName.begin(); it != it_end; ++it )
         {
-            bool bGotCodeName = false;
             SCTAB nTab = 1;
             OSL_TRACE("Trying to find suitable codename for %d", *it );
             while ( true )

sc/source/filter/excel/xiescher.cxx

 #include "xipage.hxx"
 #include "xichart.hxx"
 #include "xicontent.hxx"
+#include "scextopt.hxx"
+
 #include "namebuff.hxx"
 
 using ::rtl::OUString;
                 xDrawObj.reset( new XclImpPhObj( rRoot ) );
         }
     }
-
+    xDrawObj->mnTab = rRoot.GetCurrScTab();
     xDrawObj->ImplReadObj3( rStrm );
     return xDrawObj;
 }
         }
     }
 
+    xDrawObj->mnTab = rRoot.GetCurrScTab();
     xDrawObj->ImplReadObj4( rStrm );
     return xDrawObj;
 }
         }
     }
 
+    xDrawObj->mnTab = rRoot.GetCurrScTab();
     xDrawObj->ImplReadObj5( rStrm );
     return xDrawObj;
 }
         }
     }
 
+    xDrawObj->mnTab = rRoot.GetCurrScTab();
     xDrawObj->ImplReadObj8( rStrm );
     return xDrawObj;
 }
     return xSdrObj.release();
 }
 
+String XclImpPictureObj::GetObjName() const
+{
+    if( IsOcxControl() )
+    {
+        String sName( GetObjectManager().GetOleNameOverride( GetTab(), GetObjId() ) );
+        if ( sName.Len() > 0 )
+            return sName;
+    }
+    return XclImpDrawObjBase::GetObjName();
+}
+
 void XclImpPictureObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const
 {
     if( IsOcxControl() )
 {
 }
 
+String XclImpObjectManager::GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId )
+{
+    rtl::OUString sOleName; 
+    String sCodeName = GetExtDocOptions().GetCodeName( nTab );
+    
+    if (  mxOleCtrlNameOverride->hasByName( sCodeName ) )
+    {
+        Reference< XIndexContainer > xIdToOleName;
+        mxOleCtrlNameOverride->getByName( sCodeName ) >>= xIdToOleName;
+        xIdToOleName->getByIndex( nObjId ) >>= sOleName;
+    }
+    OSL_TRACE("XclImpObjectManager::GetOleNameOverride tab %d, ( module %s ) object id ( %d ) is %s", nTab,
+        rtl::OUStringToOString( sCodeName, RTL_TEXTENCODING_UTF8 ).getStr(), nObjId,
+        rtl::OUStringToOString( sOleName, RTL_TEXTENCODING_UTF8 ).getStr() );
+        
+    return sOleName;
+}
+
 void XclImpDffConverter::StartProgressBar( sal_Size nProgressSize )
 {
     mxProgress.reset( new ScfProgressBar( GetDocShell(), STR_PROGRESS_CALCULATING ) );

sc/source/filter/inc/xiescher.hxx

     /** Returns the Excel object type from OBJ record. */
     inline sal_uInt16   GetObjType() const { return mnObjType; }
     /** Returns the name of this object, may generate a default name. */
-    String              GetObjName() const;
+    virtual String              GetObjName() const;
     /** Returns associated macro name, if set, otherwise zero length string. */
     inline const String& GetMacroName() const { return maMacroName; }
 
     bool                IsValidSize( const Rectangle& rAnchorRect ) const;
     /** Returns the range in the sheet covered by this object. */
     ScRange             GetUsedArea( SCTAB nScTab ) const;
-
     /** Returns true, if the object is valid and will be processed. */
     inline bool         IsProcessSdrObj() const { return mbProcessSdr && !mbHidden; }
     /** Returns true, if the SdrObject will be created or processed, but not be inserted into the draw page. */
     virtual void        DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
     /** Derived classes may perform additional processing for the passed SdrObject after insertion. */
     virtual void        DoPostProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& rSdrObj ) const;
-
+    SCTAB               GetTab() const { return mnTab; }
 private:
     /** Reads the contents of a BIFF3 OBJ record. */
     void                ImplReadObj3( XclImpStream& rStrm );
 private:
     XclObjAnchor        maAnchor;       /// The position of the object in its parent.
     sal_uInt16          mnObjId;        /// The object identifier (unique per drawing).
+    SCTAB               mnTab;          /// Location of object
     sal_uInt16          mnObjType;      /// The Excel object type from OBJ record.
     sal_uInt32          mnDffShapeId;   /// Shape ID from DFF stream.
     sal_uInt32          mnDffFlags;     /// Shape flags from DFF stream.
 {
 public:
     explicit            XclImpPictureObj( const XclImpRoot& rRoot );
-
+    /** Returns the ObjectName - can use non-obvious lookup for override in the associated vba document module stream**/
+    virtual String              GetObjName() const;
     /** Returns the graphic imported from the IMGDATA record. */
     inline const Graphic& GetGraphic() const { return maGraphic; }
     /** Returns the visible area of the imported graphic. */
     String              GetDefaultObjName( const XclImpDrawObjBase& rDrawObj ) const;
     /** Returns the used area in the sheet with the passed index. */
     ScRange             GetUsedArea( SCTAB nScTab ) const;
+    /** Sets the container to recieve overriden shape/ctrls names from
+        the filter. */
+    void SetOleNameOverrideInfo( const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& rxOverrideInfo ) {  mxOleCtrlNameOverride = rxOverrideInfo; }
+    /** Returns the name of overridden name ( or zero length string ) for 
+        associated object id. */
+    String GetOleNameOverride( SCTAB nTab, sal_uInt16 nObjId );
 
     // ------------------------------------------------------------------------
 private:
+    com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >  mxOleCtrlNameOverride;
     typedef ::std::map< sal_uInt16, String >            DefObjNameMap;
     typedef ScfRef< XclImpSheetDrawing >                XclImpSheetDrawingRef;
     typedef ::std::map< SCTAB, XclImpSheetDrawingRef >  XclImpSheetDrawingMap;