npower13_objectmodule: clean up IDE changes
This commit is contained in:
parent
b4cfc7121b
commit
b38c23a63a
9 changed files with 65 additions and 106 deletions
|
@ -82,7 +82,6 @@
|
|||
#include <com/sun/star/resource/XStringResourceResolver.hpp>
|
||||
#include <com/sun/star/resource/StringResourceWithLocation.hpp>
|
||||
#include <com/sun/star/task/XInteractionHandler.hpp>
|
||||
#include <com/sun/star/script/XVBACompat.hpp>
|
||||
|
||||
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
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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!" );
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
#include <com/sun/star/awt/XControlContainer.hpp>
|
||||
#include <com/sun/star/datatransfer/DataFlavor.hpp>
|
||||
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
|
||||
#include <com/sun/star/frame/XModel.hpp>
|
||||
#include <tools/link.hxx>
|
||||
#include <tools/gen.hxx>
|
||||
#include <vcl/timer.hxx>
|
||||
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue