From b38c23a63a189072a6275bb791fcfa55edfdc2fd Mon Sep 17 00:00:00 2001 From: npower Developer Date: Wed, 3 Mar 2010 16:12:54 +0000 Subject: [PATCH] npower13_objectmodule: clean up IDE changes --- basctl/source/basicide/baside3.cxx | 11 +--- basctl/source/basicide/basides1.cxx | 10 +--- basctl/source/basicide/basides2.cxx | 19 +++---- basctl/source/basicide/basidesh.cxx | 14 +++-- basctl/source/basicide/bastype2.cxx | 67 +++++++++++------------ basctl/source/basicide/scriptdocument.cxx | 2 - basctl/source/dlged/dlged.cxx | 3 +- basctl/source/dlged/dlgedobj.cxx | 40 ++++---------- basctl/source/inc/dlged.hxx | 5 +- 9 files changed, 65 insertions(+), 106 deletions(-) diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index c5628451ac8f..f4a3c1d48fc7 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -82,7 +82,6 @@ #include #include #include -#include using namespace comphelper; using namespace ::com::sun::star; @@ -113,16 +112,8 @@ DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, St { InitSettings( TRUE, TRUE, TRUE ); - pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() ); + pEditor = new DlgEditor(); pEditor->SetWindow( this ); - // set vba mode on DialogModel ( allows it to work in 100thmm instead of MAP_APPFONT ) - if ( rDocument.isDocument() && rDocument.getDocument().is() ) - { - uno::Reference< script::XVBACompat > xDocVBAMode( rDocument.getLibraryContainer( E_SCRIPTS ), uno::UNO_QUERY ); - uno::Reference< script::XVBACompat > xDialogModelVBAMode( xDialogModel, uno::UNO_QUERY ); - if ( xDocVBAMode.is() && xDialogModelVBAMode.is() ) - xDialogModelVBAMode->setVBACompatModeOn( xDocVBAMode->getVBACompatModeOn() ); - } pEditor->SetDialog( xDialogModel ); // Undo einrichten diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx index ded495d416be..31391297f564 100644 --- a/basctl/source/basicide/basides1.cxx +++ b/basctl/source/basicide/basides1.cxx @@ -1198,18 +1198,10 @@ IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const // return any non-suspended window return pWin; } - else if ( pWin->IsDocument( rDocument ) ) - { - OSL_TRACE("FindWindow pWin->GetLibName() %s rLibName %s", - rtl::OUStringToOString( pWin->GetLibName(), RTL_TEXTENCODING_UTF8 ).getStr(), - rtl::OUStringToOString( rLibName, RTL_TEXTENCODING_UTF8 ).getStr() ); - OSL_TRACE("pWin->pWin->IsA( TYPE( ModulWindow ) %d && nType %d = BASICIDE_TYPE_MODULE %d", pWin->IsA( TYPE( ModulWindow ) ), nType, BASICIDE_TYPE_MODULE ); - OSL_TRACE("pWin->pWin->IsA( TYPE( DialogWindow ) %d && nType %d = BASICIDE_TYPE_DIALOG %d", pWin->IsA( TYPE( DialogWindow ) ), nType, BASICIDE_TYPE_DIALOG ); - if ( pWin->GetLibName() == rLibName && pWin->GetName() == rName && + else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rName && ( ( pWin->IsA( TYPE( ModulWindow ) ) && nType == BASICIDE_TYPE_MODULE ) || ( pWin->IsA( TYPE( DialogWindow ) ) && nType == BASICIDE_TYPE_DIALOG ) ) ) return pWin; - } } pWin = aIDEWindowTable.Next(); } diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx index 8da483e209d4..c6f6a77a9446 100644 --- a/basctl/source/basicide/basides2.cxx +++ b/basctl/source/basicide/basides2.cxx @@ -301,21 +301,18 @@ ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const } DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" ); } - if( nKey ) + if( nKey && xLib.is() && rDocument.isInVBAMode() ) { - if( xLib.is() ) + // display a nice friendly name in the ObjectModule tab, + // combining the objectname and module name, e.g. Sheet1 ( Financials ) + String sObjName; + lcl_getObjectName( xLib, rModName, sObjName ); + if( sObjName.Len() ) { - // display a nice friendly name in the ObjectModule tab, - // combining the objectname and module name, e.g. Sheet1 ( Financials ) - String sObjName; - lcl_getObjectName( xLib, rModName, sObjName ); - if( sObjName.Len() ) - { - aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); - } + aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")"); } - pTabBar->InsertPage( (USHORT)nKey, aModName ); } + pTabBar->InsertPage( (USHORT)nKey, aModName ); pTabBar->Sort(); pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar ); if ( !pCurWin ) diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx index 9e698af58917..608cc51c1ff3 100644 --- a/basctl/source/basicide/basidesh.cxx +++ b/basctl/source/basicide/basidesh.cxx @@ -1008,17 +1008,23 @@ void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, { ContainerListenerImpl* pListener = NULL; - if ( rDocument.isInVBAMode() ) - pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() ); + pListener = dynamic_cast< ContainerListenerImpl* >( m_xLibListener.get() ); if ( pListener ) pListener->removeContainerListener( m_aCurDocument, m_aCurLibName ); m_aCurDocument = rDocument; - if ( pListener ) - pListener->addContainerListener( m_aCurDocument, aLibName ); + if ( m_aCurDocument.isInVBAMode() ) + { + if ( !pListener ) + { + pListener = new ContainerListenerImpl( this ); + m_xLibListener = pListener; + } + pListener->addContainerListener( m_aCurDocument, aLibName ); + } m_aCurLibName = aLibName; if ( bUpdateWindows ) UpdateWindows(); diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx index bf13b554a0a6..6009ad9f2385 100644 --- a/basctl/source/basicide/bastype2.cxx +++ b/basctl/source/basicide/bastype2.cxx @@ -307,51 +307,50 @@ void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const { try { - sal_Bool bVBAEnabled = rDocument.isInVBAMode(); - if( bVBAEnabled ) + if( rDocument.isInVBAMode() ) ImpCreateLibSubEntriesInVBAMode( pLibRootEntry, rDocument, rLibName ); else { - // get a sorted list of module names - Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); - sal_Int32 nModCount = aModNames.getLength(); - const ::rtl::OUString* pModNames = aModNames.getConstArray(); + // get a sorted list of module names + Sequence< ::rtl::OUString > aModNames = rDocument.getObjectNames( E_SCRIPTS, rLibName ); + sal_Int32 nModCount = aModNames.getLength(); + const ::rtl::OUString* pModNames = aModNames.getConstArray(); - for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) - { - String aModName = pModNames[ i ]; - SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE ); - if ( !pModuleEntry ) - pModuleEntry = AddEntry( - aModName, - Image( IDEResId( RID_IMG_MODULE ) ), - Image( IDEResId( RID_IMG_MODULE_HC ) ), - pLibRootEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - - // methods - if ( nMode & BROWSEMODE_SUBS ) + for ( sal_Int32 i = 0 ; i < nModCount ; i++ ) { - Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); - sal_Int32 nCount = aNames.getLength(); - const ::rtl::OUString* pNames = aNames.getConstArray(); + String aModName = pModNames[ i ]; + SvLBoxEntry* pModuleEntry = FindEntry( pLibRootEntry, aModName, OBJ_TYPE_MODULE ); + if ( !pModuleEntry ) + pModuleEntry = AddEntry( + aModName, + Image( IDEResId( RID_IMG_MODULE ) ), + Image( IDEResId( RID_IMG_MODULE_HC ) ), + pLibRootEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) ); - for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + // methods + if ( nMode & BROWSEMODE_SUBS ) { - String aName = pNames[ j ]; - SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); - if ( !pEntry ) - pEntry = AddEntry( - aName, - Image( IDEResId( RID_IMG_MACRO ) ), - Image( IDEResId( RID_IMG_MACRO_HC ) ), - pModuleEntry, false, - std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + Sequence< ::rtl::OUString > aNames = BasicIDE::GetMethodNames( rDocument, rLibName, aModName ); + sal_Int32 nCount = aNames.getLength(); + const ::rtl::OUString* pNames = aNames.getConstArray(); + + for ( sal_Int32 j = 0 ; j < nCount ; j++ ) + { + String aName = pNames[ j ]; + SvLBoxEntry* pEntry = FindEntry( pModuleEntry, aName, OBJ_TYPE_METHOD ); + if ( !pEntry ) + pEntry = AddEntry( + aName, + Image( IDEResId( RID_IMG_MACRO ) ), + Image( IDEResId( RID_IMG_MACRO_HC ) ), + pModuleEntry, false, + std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) ); + } } } } } - } catch ( const container::NoSuchElementException& ) { DBG_UNHANDLED_EXCEPTION(); diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx index f246e1613dd8..edb04f352855 100644 --- a/basctl/source/basicide/scriptdocument.cxx +++ b/basctl/source/basicide/scriptdocument.cxx @@ -480,8 +480,6 @@ namespace basctl { OSL_ENSURE( isValid(), "ScriptDocument_Impl::getDocument: invalid state!" ); OSL_ENSURE( isDocument(), "ScriptDocument_Impl::getDocument: for documents only!" ); - if ( !isDocument() ) - OSL_TRACE("**** BAHHHH!!!*****"); if ( !isValid() || !isDocument() ) return NULL; diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 65059f3b759b..326098976d87 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -205,7 +205,7 @@ BOOL DlgEditor::RemarkDialog() //---------------------------------------------------------------------------- -DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ) +DlgEditor::DlgEditor() :pHScroll(NULL) ,pVScroll(NULL) ,pDlgEdModel(NULL) @@ -227,7 +227,6 @@ DlgEditor::DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star:: ,bCreateOK(TRUE) ,bDialogModelChanged(FALSE) ,mnPaintGuard(0) - ,m_xDocument( xModel ) { pDlgEdModel = new DlgEdModel(); pDlgEdModel->GetItemPool().FreezeIdRanges(); diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index fcade49d1c8b..5af7519f85f0 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -74,22 +74,6 @@ TYPEINIT1(DlgEdObj, SdrUnoObj); DBG_NAME(DlgEdObj); //---------------------------------------------------------------------------- -MapMode lcl_getMapModeForForm( DlgEdForm* pForm ) -{ - MapMode aMode( MAP_APPFONT ); //Default - try - { - uno::Reference< beans::XPropertySet > xProps( pForm ? pForm->GetUnoControlModel() : NULL, uno::UNO_QUERY_THROW ); - sal_Bool bVBAForm = sal_False; - xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAForm") ) ) >>= bVBAForm; - if ( bVBAForm ) - aMode = MapMode( MAP_100TH_MM ); - } - catch ( Exception& ) - { - } - return aMode; -} DlgEdObj::DlgEdObj() :SdrUnoObj(String(), sal_False) @@ -210,9 +194,8 @@ bool DlgEdObj::TransformSdrToControlCoordinates( } // convert pixel to logic units - MapMode aConvMode = lcl_getMapModeForForm( pForm ); - aPos = pDevice->PixelToLogic( aPos, aConvMode ); - aSize = pDevice->PixelToLogic( aSize, aConvMode ); + aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) ); + aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) ); // set out parameters nXOut = aPos.Width(); @@ -259,10 +242,10 @@ bool DlgEdObj::TransformSdrToFormCoordinates( aSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; aSize.Height() -= aDeviceInfo.TopInset + aDeviceInfo.BottomInset; } - MapMode aConvMode = lcl_getMapModeForForm( pForm ); + // convert pixel to logic units - aPos = pDevice->PixelToLogic( aPos, aConvMode ); - aSize = pDevice->PixelToLogic( aSize, aConvMode ); + aPos = pDevice->PixelToLogic( aPos, MapMode( MAP_APPFONT ) ); + aSize = pDevice->PixelToLogic( aSize, MapMode( MAP_APPFONT ) ); // set out parameters nXOut = aPos.Width(); @@ -304,10 +287,9 @@ bool DlgEdObj::TransformControlToSdrCoordinates( DBG_ASSERT( pDevice, "DlgEdObj::TransformControlToSdrCoordinates: missing default device!" ); if ( !pDevice ) return false; - MapMode aConvMode = lcl_getMapModeForForm( pForm ); - aPos = pDevice->LogicToPixel( aPos, aConvMode ); - aSize = pDevice->LogicToPixel( aSize, aConvMode ); - aFormPos = pDevice->LogicToPixel( aFormPos, aConvMode ); + aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) ); + aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) ); + aFormPos = pDevice->LogicToPixel( aFormPos, MapMode( MAP_APPFONT ) ); // add form position aPos.Width() += aFormPos.Width(); @@ -351,16 +333,14 @@ bool DlgEdObj::TransformFormToSdrCoordinates( DBG_ASSERT( pDevice, "DlgEdObj::TransformFormToSdrCoordinates: missing default device!" ); if ( !pDevice ) return false; + aPos = pDevice->LogicToPixel( aPos, MapMode( MAP_APPFONT ) ); + aSize = pDevice->LogicToPixel( aSize, MapMode( MAP_APPFONT ) ); // take window borders into account DlgEdForm* pForm = NULL; if ( !lcl_getDlgEdForm( this, pForm ) ) return false; - MapMode aConvMode = lcl_getMapModeForForm( pForm ); - aPos = pDevice->LogicToPixel( aPos, aConvMode ); - aSize = pDevice->LogicToPixel( aSize, aConvMode ); - // take window borders into account Reference< beans::XPropertySet > xPSetForm( pForm->GetUnoControlModel(), UNO_QUERY ); DBG_ASSERT( xPSetForm.is(), "DlgEdObj::TransformFormToSdrCoordinates: no form property set!" ); diff --git a/basctl/source/inc/dlged.hxx b/basctl/source/inc/dlged.hxx index f49d684cbe80..1444bab59c65 100644 --- a/basctl/source/inc/dlged.hxx +++ b/basctl/source/inc/dlged.hxx @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -129,11 +128,9 @@ protected: BOOL bDialogModelChanged; Timer aMarkTimer; long mnPaintGuard; - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xDocument; - DlgEditor(); // not implemented public: - DlgEditor( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); + DlgEditor(); ~DlgEditor(); void SetWindow( Window* pWindow );