ooo-build r11237 - in trunk: . patches/test/vba scratch/sc-vba/testvba/TestDocuments
- From: jiaojh svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r11237 - in trunk: . patches/test/vba scratch/sc-vba/testvba/TestDocuments
- Date: Thu, 10 Jan 2008 10:40:17 +0000 (GMT)
Author: jiaojh
Date: Thu Jan 10 10:40:17 2008
New Revision: 11237
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11237&view=rev
Log:
* patches/test/vba/ModuleInfo.diff: update for missing file.
and listener deallocate.
* scratch/sc-vba/testvba/TestDocuments/TestObjectModule.xls:
Update test file for delete worksheet.
Modified:
trunk/ChangeLog
trunk/patches/test/vba/ModuleInfo.diff
trunk/scratch/sc-vba/testvba/TestDocuments/TestObjectModule.xls
Modified: trunk/patches/test/vba/ModuleInfo.diff
==============================================================================
--- trunk/patches/test/vba/ModuleInfo.diff (original)
+++ trunk/patches/test/vba/ModuleInfo.diff Thu Jan 10 10:40:17 2008
@@ -1517,6 +1517,73 @@
}
}
}
+--- sc/inc/scextopt.hxx.bak 2007-12-25 13:34:11.000000000 +0800
++++ sc/inc/scextopt.hxx 2008-01-09 21:38:09.000000000 +0800
+@@ -57,7 +57,7 @@
+ struct ScExtDocSettings
+ {
+ ScRange maOleSize; /// Visible range if embedded.
+- String maGlobCodeName; /// Global codename (VBA module name).
++ //String maGlobCodeName; /// Global codename (VBA module name).
+ double mfTabBarWidth; /// Width of the tabbar, relative to frame window width (0.0 ... 1.0).
+ sal_uInt32 mnLinkCnt; /// Recursive counter for loading external documents.
+ SCTAB mnDisplTab; /// Index of displayed sheet.
+@@ -136,13 +136,13 @@ public:
+ ScExtTabSettings& GetOrCreateTabSettings( SCTAB nTab );
+
+ /** Returns the number of sheet codenames. */
+- size_t GetCodeNameCount() const;
++ //size_t GetCodeNameCount() const;
+ /** Returns the specified codename (empty string = no codename). */
+- const String& GetCodeName( size_t nIdx ) const;
++ //const String& GetCodeName( size_t nIdx ) const;
+ /** Appends a codename for a sheet. */
+- void AppendCodeName( const String& rCodeName );
+- void SetCodeName( const String& rCodeName, size_t nIdx );
+- void DeleteCodeName( size_t nIdx );
++ //void AppendCodeName( const String& rCodeName );
++ //void SetCodeName( const String& rCodeName, size_t nIdx );
++ //void DeleteCodeName( size_t nIdx );
+
+ private:
+ ::std::auto_ptr< ScExtDocOptionsImpl > mxImpl;
+--- sc/source/ui/view/scextopt.cxx.bak 2007-12-25 13:34:11.000000000 +0800
++++ sc/source/ui/view/scextopt.cxx 2008-01-09 21:38:06.000000000 +0800
+@@ -140,7 +140,7 @@ void ScExtTabSettingsCont::CopyFromMap(
+
+ // ============================================================================
+
+-typedef ::std::map< size_t, String > TabCodeNameMap;
++//typedef ::std::map< size_t, String > TabCodeNameMap;
+ /** Implementation struct for ScExtDocOptions containing all members. */
+ struct ScExtDocOptionsImpl
+ {
+@@ -148,7 +148,7 @@ struct ScExtDocOptionsImpl
+ ScExtDocSettings maDocSett; /// Global document settings.
+ ScExtTabSettingsCont maTabSett; /// Settings for all sheets.
+ // StringVec maCodeNames; /// Codenames for all sheets (VBA module names).
+- TabCodeNameMap maCodeNames; /// Codenames for all sheets (VBA module names).
++// TabCodeNameMap maCodeNames; /// Codenames for all sheets (VBA module names).
+
+ bool mbChanged; /// Use only if something has been changed.
+
+@@ -211,7 +211,7 @@ ScExtTabSettings& ScExtDocOptions::GetOr
+ {
+ return mxImpl->maTabSett.GetOrCreateTabSettings( nTab );
+ }
+-
++/*
+ size_t ScExtDocOptions::GetCodeNameCount() const
+ {
+ return mxImpl->maCodeNames.size();
+@@ -241,6 +241,6 @@ void ScExtDocOptions::DeleteCodeName( si
+ TabCodeNameMap::iterator it = mxImpl->maCodeNames.find( nIdx );
+ if ( it != mxImpl->maCodeNames.end() )
+ mxImpl->maCodeNames.erase( it );
+-}
++}*/
+ // ============================================================================
+
--- basic/source/runtime/runtime.cxx.bak 2007-12-25 13:34:14.000000000 +0800
+++ basic/source/runtime/runtime.cxx 2007-12-25 14:03:24.000000000 +0800
@@ -82,6 +82,17 @@ void StarBASIC::StaticEnableReschedule(
@@ -1710,7 +1777,7 @@
if (bWasLinked)
--- basctl/source/basicide/basidesh.cxx.bak 2007-12-25 13:34:14.000000000 +0800
-+++ basctl/source/basicide/basidesh.cxx 2007-12-25 14:03:24.000000000 +0800
++++ basctl/source/basicide/basidesh.cxx 2008-01-10 17:51:27.000000000 +0800
@@ -97,6 +97,8 @@
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
#include <com/sun/star/container/XNameContainer.hpp>
@@ -1720,7 +1787,7 @@
#include <svx/xmlsecctrl.hxx>
-@@ -104,7 +106,75 @@ using namespace ::com::sun::star::uno;
+@@ -104,7 +106,95 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star;
using ::rtl::OUString;
@@ -1731,10 +1798,12 @@
+
+class BasIDEContainerListenerImpl: public ContainerListenerHelper
+{
-+ BasicIDEShell* pBasIDE;
++ BasicIDEShell* m_pBasIDE;
++ uno::Reference< container::XContainer > m_xContainer;
+public:
-+ BasIDEContainerListenerImpl( BasicIDEShell* pIDE ): pBasIDE( pIDE ) {}
-+ static void addContainerListenerImpl( const ScriptDocument* pScriptDocument, BasicIDEShell* pIDE );
++ BasIDEContainerListenerImpl( BasicIDEShell* pIDE, uno::Reference< container::XContainer > xContainer );
++ ~BasIDEContainerListenerImpl();
++ static uno::Reference< container::XContainerListener > addContainerListenerImpl( const ScriptDocument* pScriptDocument, BasicIDEShell* pIDE );
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const lang::EventObject& Source )
@@ -1749,54 +1818,110 @@
+ throw( uno::RuntimeException );
+};
+
-+void BasIDEContainerListenerImpl::addContainerListenerImpl( const ScriptDocument* pScriptDocument, BasicIDEShell* pIDE )
++BasIDEContainerListenerImpl::BasIDEContainerListenerImpl( BasicIDEShell* pIDE, uno::Reference< container::XContainer > xContainer )
++ : m_pBasIDE( pIDE ), m_xContainer( xContainer )
++{
++ uno::Reference< container::XContainerListener > xContainerListener( static_cast< XContainerListener* > ( this ), uno::UNO_QUERY);
++ m_xContainer->addContainerListener( xContainerListener );
++}
++BasIDEContainerListenerImpl::~BasIDEContainerListenerImpl()
++{
++}
++uno::Reference< container::XContainerListener > BasIDEContainerListenerImpl::addContainerListenerImpl( const ScriptDocument* pScriptDocument, BasicIDEShell* pIDE )
+{
+ rtl::OUString sLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
+ uno::Reference< container::XNameContainer > xNameContainer( pScriptDocument->getLibrary( E_SCRIPTS, sLibName, FALSE ) );
+ uno::Reference< container::XContainer > xContainer( xNameContainer, uno::UNO_QUERY );
+ if ( xContainer.is() )
+ {
-+ uno::Reference< container::XContainerListener > xContainerListener
-+ = static_cast< XContainerListener* >
-+ ( new BasIDEContainerListenerImpl( pIDE ) );
-+ xContainer->addContainerListener( xContainerListener );
++ return uno::Reference< container::XContainerListener > (new BasIDEContainerListenerImpl( pIDE, xContainer ) );
+ }
++ return uno::Reference< container::XContainerListener >();
+}
-
++
+// XEventListener
+//----------------------------------------------------------------------------
-+void SAL_CALL BasIDEContainerListenerImpl::disposing( const lang::EventObject& Source )
++void SAL_CALL BasIDEContainerListenerImpl::disposing( const lang::EventObject& /*Source*/ )
+ throw( uno::RuntimeException )
+{
-+ // we don't interest here.
-+ (void)Source;
++ uno::Reference< container::XContainerListener > xContainerListener( static_cast< XContainerListener* > ( this ), uno::UNO_QUERY);
++ if( xContainerListener.is() )
++ {
++ if( m_xContainer.is() )
++ m_xContainer->removeContainerListener( xContainerListener );
++ if( m_pBasIDE )
++ {
++ m_pBasIDE = NULL;
++ }
++ }
+}
+
+// XContainerListener
+//----------------------------------------------------------------------------
-+void SAL_CALL BasIDEContainerListenerImpl::elementInserted( const container::ContainerEvent& Event )
++void SAL_CALL BasIDEContainerListenerImpl::elementInserted( const container::ContainerEvent& /*Event*/ )
+ throw( uno::RuntimeException )
+{
-+ pBasIDE->UpdateWindowsWithBas( TRUE );
++ if( m_pBasIDE )
++ m_pBasIDE->UpdateBasWindows( TRUE );
+}
+
+void SAL_CALL BasIDEContainerListenerImpl::elementReplaced( const container::ContainerEvent& Event )
+ throw( uno::RuntimeException )
+{
-+ // we don't interest here
++ /* we don't interest here, because of the container
++ make rename a module as delete old one and create a new one. */
+ (void)Event;
+}
-+
-+void SAL_CALL BasIDEContainerListenerImpl::elementRemoved( const container::ContainerEvent& Event )
+
++void SAL_CALL BasIDEContainerListenerImpl::elementRemoved( const container::ContainerEvent& /*Event*/ )
+ throw( uno::RuntimeException )
+{
-+ pBasIDE->UpdateWindowsWithBas( FALSE );
++ if( m_pBasIDE )
++ m_pBasIDE->UpdateBasWindows( FALSE );
+}
+//============================================================================
TYPEINIT1( BasicIDEShell, SfxViewShell );
SFX_IMPL_VIEWFACTORY( BasicIDEShell, IDEResId( SVX_INTERFACE_BASIDE_VIEWSH ) )
-@@ -599,7 +669,6 @@ void BasicIDEShell::ShowObjectDialog( BO
+@@ -257,6 +347,14 @@ __EXPORT BasicIDEShell::~BasicIDEShell()
+ delete pTabBar;
+ delete pObjectCatalog;
+ DestroyModulWindowLayout();
++ // Destroy all ContainerListeners for Basic Container.
++ while( !m_ListenerList.empty() )
++ {
++ uno::Reference < container::XContainerListener > xContainerListener ( m_ListenerList.front() );
++ if( xContainerListener.is() )
++ xContainerListener->disposing( lang::EventObject() );
++ m_ListenerList.pop_front();
++ }
+ // MI: Das gab einen GPF im SDT beim Schliessen da dann der ViewFrame die
+ // ObjSh loslaesst. Es wusste auch keiner mehr wozu das gut war.
+ // GetViewFrame()->GetObjectShell()->Broadcast( SfxSimpleHint( SFX_HINT_DYING ) );
+@@ -401,6 +499,22 @@ void BasicIDEShell::StoreAllWindowData(
+ }
+ }
+
++void
++BasicIDEShell::AddContainerListener( uno::Reference < container::XContainerListener > xContainerListener )
++{
++ if( xContainerListener.is() )
++ m_ListenerList.push_back( xContainerListener );
++}
++
++void
++BasicIDEShell::RemoveContainerListener( uno::Reference < container::XContainerListener > xContainerListener )
++{
++ if( xContainerListener.is() )
++ {
++ xContainerListener->disposing( lang::EventObject() );
++ m_ListenerList.remove( xContainerListener );
++ }
++}
+
+ USHORT __EXPORT BasicIDEShell::PrepareClose( BOOL bUI, BOOL bForBrowsing )
+ {
+@@ -599,7 +713,6 @@ void BasicIDEShell::ShowObjectDialog( BO
}
@@ -1804,40 +1929,56 @@
void __EXPORT BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
const SfxHint& rHint, const TypeId& )
{
-@@ -679,7 +748,28 @@ void __EXPORT BasicIDEShell::SFX_NOTIFY(
+@@ -679,7 +792,43 @@ void __EXPORT BasicIDEShell::SFX_NOTIFY(
}
}
-+void BasicIDEShell::RemoveNoModulesWindows()
+-
++void BasicIDEShell::UpdateBasWindows( BOOL bInserted )
+{
-+ for ( ULONG nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
++ if( bInserted )
+ {
-+ IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
-+ if ( pWin->IsDocument( m_aCurDocument ) && ( pWin->GetLibName() == m_aCurLibName ) )
++ rtl::OUString sLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
++ if( GetCurWindow()->IsDocument( m_aCurDocument ) && sLibName.equals( m_aCurLibName) )
+ {
-+ if ( !m_aCurDocument.hasModule( pWin->GetLibName(), pWin->GetName() ) )
++ const ScriptDocument aScriptDocument( m_aCurDocument );
++ uno::Reference< container::XNameContainer > xNameContainer( aScriptDocument.getLibrary( E_SCRIPTS, sLibName, FALSE ) );
++ if( xNameContainer.is() )
+ {
-+ RemoveWindow( pWin, FALSE, TRUE );
++ Sequence< ::rtl::OUString > sModNames = xNameContainer->getElementNames();
++ sal_Int32 nCount = sModNames.getLength();
++ rtl::OUString sName;
++ for( sal_Int32 i = 0; i < nCount; i++ )
++ {
++ sName = sModNames[i];
++ ModulWindow* pNewModuleWindow = FindBasWin( aScriptDocument, sLibName, sName, TRUE, FALSE );
++ }
+ }
+ }
+ }
-+}
-
-+void BasicIDEShell::UpdateWindowsWithBas( BOOL bInserted )
-+{
-+ if( bInserted )
-+ UpdateWindows();
+ else
-+ RemoveNoModulesWindows();
++ {
++ for ( ULONG nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
++ {
++ IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
++ if ( pWin->IsDocument( m_aCurDocument ) && ( pWin->GetLibName() == m_aCurLibName ) )
++ {
++ if ( !m_aCurDocument.hasModule( pWin->GetLibName(), pWin->GetName() ) )
++ {
++ RemoveWindow( pWin, FALSE, TRUE );
++ }
++ }
++ }
++ }
+}
void BasicIDEShell::CheckWindows()
{
-@@ -763,6 +853,7 @@ void BasicIDEShell::UpdateWindows()
+@@ -763,6 +912,7 @@ void BasicIDEShell::UpdateWindows()
)
{
StartListening( *doc->getBasicManager(), TRUE /* Nur einmal anmelden */ );
-+ BasIDEContainerListenerImpl::addContainerListenerImpl( doc, this );
++ AddContainerListener( BasIDEContainerListenerImpl::addContainerListenerImpl( doc, this ) );
// libraries
Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() );
@@ -1926,20 +2067,93 @@
pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
pSfxApp->Broadcast( SfxSimpleHint( SC_HINT_DBAREAS_CHANGED ) );
--- basctl/source/inc/basidesh.hxx.bak 2007-12-25 13:34:14.000000000 +0800
-+++ basctl/source/inc/basidesh.hxx 2007-12-25 14:03:24.000000000 +0800
-@@ -124,6 +124,7 @@ friend class BasicIDE;
- void CheckWindows();
- void RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, BOOL bDestroy );
- void UpdateWindows();
-+ void RemoveNoModulesWindows();
- void ShowObjectDialog( BOOL bShow, BOOL bCreateOrDestroy );
- void InvalidateBasicIDESlots();
- void StoreAllWindowData( BOOL bPersistent = TRUE );
-@@ -237,6 +238,7 @@ public:
++++ basctl/source/inc/basidesh.hxx 2008-01-10 17:49:27.000000000 +0800
+@@ -62,8 +62,10 @@
+ #ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
+ #include <com/sun/star/io/XInputStreamProvider.hpp>
+ #endif
++#include <com/sun/star/container/XContainerListener.hpp>
++#include <list>
+
+-
++typedef std::list < com::sun::star::uno::Reference < com::sun::star::container::XContainerListener > > ContainerListenerList;
+ //----------------------------------------------------------------------------
+
+ const ULONG BASICIDE_UI_FEATURE_SHOW_BROWSER = 0x00000001;
+@@ -116,6 +118,7 @@ friend class BasicIDE;
+ BOOL m_bAppBasicModified;
+ ::basctl::DocumentEventNotifier
+ m_aNotifier;
++ ContainerListenerList m_ListenerList;
+
+ #if _SOLAR__PRIVATE
+ void Init();
+@@ -237,7 +240,11 @@ public:
BOOL IsAppBasicModified() const { return m_bAppBasicModified; }
void SetAppBasicModified( BOOL bModified = TRUE ) { m_bAppBasicModified = bModified; }
-+ void UpdateWindowsWithBas( BOOL bInerted );
++ void UpdateBasWindows( BOOL bInerted );
++ // For ContainerListener
++ void AddContainerListener( com::sun::star::uno::Reference < com::sun::star::container::XContainerListener > xContainerListener );
++ void RemoveContainerListener( com::sun::star::uno::Reference < com::sun::star::container::XContainerListener > xContainerListener );
// For Dialog Drag&Drop in Dialog Organizer
static void CopyDialogResources(
+ ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStreamProvider >& io_xISP,
+--- sc/source/ui/vba/vbaworkbook.cxx
++++ sc/source/ui/vba/vbaworkbook.cxx
+@@ -467,9 +471,10 @@ ScVbaWorkbook::getCodeName() throw (css:
+ #ifdef VBA_OOBUILD_HACK
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument* pDoc = getDocShell( xModel )->GetDocument();
+- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
++ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
+ ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
+- ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName;
++ ::rtl::OUString sGlobCodeName = pExtSettings.maGlobCodeName; */
++ ::rtl::OUString sGlobCodeName = pDoc->GetCodeName();
+ return sGlobCodeName;
+ #else
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Not implemented") ), uno::Reference< uno::XInterface >() );
+@@ -481,9 +486,10 @@ ScVbaWorkbook::setCodeName( const ::rtl:
+ {
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument* pDoc = getDocShell( xModel )->GetDocument();
+- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
++ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
+ ScExtDocSettings pExtSettings = pExtOptions->GetDocSettings();
+- pExtSettings.maGlobCodeName = sGlobCodeName;
++ pExtSettings.maGlobCodeName = sGlobCodeName;*/
++ pDoc->SetCodeName( sGlobCodeName );
+ #else
+ void SAL_CALL
+ ScVbaWorkbook::setCodeName( const ::rtl::OUString& ) throw (css::uno::RuntimeException)
+--- sc/source/ui/vba/vbaworksheet.cxx
++++ sc/source/ui/vba/vbaworksheet.cxx
+@@ -814,8 +814,10 @@ ScVbaWorksheet::getCodeName() throw (css
+ {
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument* pDoc = getDocShell( xModel )->GetDocument();
+- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
+- rtl::OUString sCodeName = pExtOptions->GetCodeName( nTab );
++ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
++ rtl::OUString sCodeName = pExtOptions->GetCodeName( nTab );*/
++ String sCodeName;
++ pDoc->GetCodeName( nTab, sCodeName );
+ return sCodeName;
+ }
+ else
+@@ -838,8 +840,10 @@ ScVbaWorksheet::setCodeName( const rtl::
+ {
+ uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
+ ScDocument* pDoc = getDocShell( xModel )->GetDocument();
+- ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
+- pExtOptions->SetCodeName( sCodeName, nTab );
++ /*ScExtDocOptions* pExtOptions = pDoc->GetExtDocOptions();
++ pExtOptions->SetCodeName( sCodeName, nTab );*/
++ String sNewCodeName( sCodeName );
++ pDoc->SetCodeName( nTab, sNewCodeName );
+ }
+ else
+ throw uno::RuntimeException(::rtl::OUString(
+
Modified: trunk/scratch/sc-vba/testvba/TestDocuments/TestObjectModule.xls
==============================================================================
Binary files. No diff available.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]