summaryrefslogtreecommitdiff
path: root/basctl/source/basicide
diff options
context:
space:
mode:
Diffstat (limited to 'basctl/source/basicide')
-rw-r--r--basctl/source/basicide/basdoc.cxx101
-rw-r--r--basctl/source/basicide/basdoc.hxx68
-rw-r--r--basctl/source/basicide/basicbox.cxx546
-rw-r--r--basctl/source/basicide/basicbox.hxx154
-rw-r--r--basctl/source/basicide/basicmod.hxx49
-rw-r--r--basctl/source/basicide/basicprint.src38
-rw-r--r--basctl/source/basicide/basicrenderable.cxx196
-rw-r--r--basctl/source/basicide/basicrenderable.hxx76
-rw-r--r--basctl/source/basicide/baside2.cxx1739
-rw-r--r--basctl/source/basicide/baside2.hrc50
-rw-r--r--basctl/source/basicide/baside2.hxx476
-rw-r--r--basctl/source/basicide/baside2b.cxx2266
-rw-r--r--basctl/source/basicide/baside3.cxx1393
-rw-r--r--basctl/source/basicide/basidectrlr.cxx153
-rw-r--r--basctl/source/basicide/basides1.cxx1399
-rw-r--r--basctl/source/basicide/basides2.cxx316
-rw-r--r--basctl/source/basicide/basides3.cxx179
-rw-r--r--basctl/source/basicide/basidesh.cxx1053
-rw-r--r--basctl/source/basicide/basidesh.src638
-rw-r--r--basctl/source/basicide/basobj2.cxx458
-rw-r--r--basctl/source/basicide/basobj3.cxx519
-rw-r--r--basctl/source/basicide/bastype2.cxx880
-rw-r--r--basctl/source/basicide/bastype2.hxx222
-rw-r--r--basctl/source/basicide/bastype3.cxx507
-rw-r--r--basctl/source/basicide/bastype3.hxx67
-rw-r--r--basctl/source/basicide/bastype4.hxx69
-rw-r--r--basctl/source/basicide/bastypes.cxx1054
-rw-r--r--basctl/source/basicide/brkdlg.cxx274
-rw-r--r--basctl/source/basicide/brkdlg.hrc45
-rw-r--r--basctl/source/basicide/brkdlg.hxx75
-rw-r--r--basctl/source/basicide/brkdlg.src134
-rw-r--r--basctl/source/basicide/doceventnotifier.cxx280
-rw-r--r--basctl/source/basicide/docsignature.cxx118
-rw-r--r--basctl/source/basicide/documentenumeration.cxx206
-rw-r--r--basctl/source/basicide/documentenumeration.hxx109
-rw-r--r--basctl/source/basicide/ide_pch.cxx33
-rw-r--r--basctl/source/basicide/ide_pch.hxx71
-rw-r--r--basctl/source/basicide/iderdll.cxx201
-rw-r--r--basctl/source/basicide/iderdll2.hxx109
-rw-r--r--basctl/source/basicide/idetemp.hxx67
-rw-r--r--basctl/source/basicide/localizationmgr.cxx1180
-rw-r--r--basctl/source/basicide/macrodlg.cxx910
-rw-r--r--basctl/source/basicide/macrodlg.hrc59
-rw-r--r--basctl/source/basicide/macrodlg.hxx114
-rw-r--r--basctl/source/basicide/macrodlg.src234
-rw-r--r--basctl/source/basicide/moduldl2.cxx1706
-rw-r--r--basctl/source/basicide/moduldlg.cxx1067
-rw-r--r--basctl/source/basicide/moduldlg.hrc68
-rw-r--r--basctl/source/basicide/moduldlg.hxx277
-rw-r--r--basctl/source/basicide/moduldlg.src427
-rw-r--r--basctl/source/basicide/moptions.hrc47
-rw-r--r--basctl/source/basicide/moptions.src150
-rw-r--r--basctl/source/basicide/objdlg.cxx298
-rw-r--r--basctl/source/basicide/objdlg.hrc41
-rw-r--r--basctl/source/basicide/objdlg.hxx96
-rw-r--r--basctl/source/basicide/objdlg.src91
-rw-r--r--basctl/source/basicide/register.cxx89
-rw-r--r--basctl/source/basicide/scriptdocument.cxx1604
-rw-r--r--basctl/source/basicide/tbxctl.cxx164
-rw-r--r--basctl/source/basicide/tbxctl.hrc30
-rw-r--r--basctl/source/basicide/tbxctl.hxx68
-rw-r--r--basctl/source/basicide/unomodel.cxx129
-rw-r--r--basctl/source/basicide/unomodel.hxx69
63 files changed, 0 insertions, 25306 deletions
diff --git a/basctl/source/basicide/basdoc.cxx b/basctl/source/basicide/basdoc.cxx
deleted file mode 100644
index 96f00abba..000000000
--- a/basctl/source/basicide/basdoc.cxx
+++ /dev/null
@@ -1,101 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-
-#include <ide_pch.hxx>
-#include <svx/svxids.hrc>
-
-#define GLOBALOVERFLOW2
-
-#include <sfx2/docfac.hxx>
-#include <sfx2/sfxmodelfactory.hxx>
-#include <vcl/status.hxx>
-
-#include <svx/xmlsecctrl.hxx>
-
-#include <basdoc.hxx>
-
-#define BasicDocShell
-#include <basslots.hxx>
-
-#include "basicmod.hxx"
-#include "unomodel.hxx"
-
-TYPEINIT1(BasicDocShell, SfxObjectShell);
-DBG_NAME(BasicDocShell);
-
-SFX_IMPL_OBJECTFACTORY( BasicDocShell, SvGlobalName(), SFXOBJECTSHELL_STD_NORMAL, "sbasic" )
-
-SFX_IMPL_INTERFACE( BasicDocShell, SfxObjectShell, IDEResId( 0 ) )
-{
- SFX_STATUSBAR_REGISTRATION( IDEResId( SID_BASICIDE_STATUSBAR ) );
-}
-
-BasicDocShell::BasicDocShell()
- :SfxObjectShell( SFXMODEL_DISABLE_EMBEDDED_SCRIPTS | SFXMODEL_DISABLE_DOCUMENT_RECOVERY )
-{
- pPrinter = 0;
- SetPool( &SFX_APP()->GetPool() );
- SetBaseModel( new SIDEModel(this) );
-}
-
-BasicDocShell::~BasicDocShell()
-{
- delete pPrinter;
-}
-
-SfxPrinter* BasicDocShell::GetPrinter( sal_Bool bCreate )
-{
- if ( !pPrinter && bCreate )
- pPrinter = new SfxPrinter( new SfxItemSet( GetPool(), SID_PRINTER_NOTFOUND_WARN , SID_PRINTER_NOTFOUND_WARN ) );
-
- return pPrinter;
-}
-
-void BasicDocShell::SetPrinter( SfxPrinter* pPr )
-{
- if ( pPr != pPrinter )
- {
- delete pPrinter;
- pPrinter = pPr;
- }
-}
-
-void BasicDocShell::FillClass( SvGlobalName*, sal_uInt32*, String*, String*, String*, sal_Int32, sal_Bool bTemplate) const
-{
- (void)bTemplate;
- DBG_ASSERT( bTemplate == sal_False, "No template for Basic" );
-}
-
-void BasicDocShell::Draw( OutputDevice *, const JobSetup &, sal_uInt16 )
-{}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basdoc.hxx b/basctl/source/basicide/basdoc.hxx
deleted file mode 100644
index 843e2e41c..000000000
--- a/basctl/source/basicide/basdoc.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BASDOC_HXX
-#define _BASDOC_HXX
-
-#include <svx/ifaceids.hxx>
-#include <iderid.hxx>
-#include <sfx2/objsh.hxx>
-
-class SfxPrinter;
-
-class BasicDocShell: public SfxObjectShell
-{
- SfxPrinter* pPrinter;
-
-protected:
- virtual void Draw( OutputDevice *, const JobSetup & rSetup,
- sal_uInt16 nAspect = ASPECT_CONTENT );
- virtual void FillClass( SvGlobalName * pClassName,
- sal_uInt32 * pFormat,
- String * pAppName,
- String * pFullTypeName,
- String * pShortTypeName,
- sal_Int32 nVersion,
- sal_Bool bTemplate = sal_False ) const;
-
-public:
- TYPEINFO();
-
- using SotObject::GetInterface;
- SFX_DECL_OBJECTFACTORY();
- SFX_DECL_INTERFACE( SVX_INTERFACE_BASIDE_DOCSH )
- BasicDocShell();
- ~BasicDocShell();
-
- SfxPrinter* GetPrinter( sal_Bool bCreate );
- void SetPrinter( SfxPrinter* pPrinter );
-};
-
-#endif // _BASDOC_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basicbox.cxx b/basctl/source/basicide/basicbox.cxx
deleted file mode 100644
index e73671b25..000000000
--- a/basctl/source/basicide/basicbox.cxx
+++ /dev/null
@@ -1,546 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <ide_pch.hxx>
-
-
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <basobj.hxx>
-
-#include <basicbox.hxx>
-#include <iderid.hxx>
-#include <iderdll.hxx>
-#include <bastypes.hxx>
-#include "bastype2.hxx"
-#include "basdoc.hxx"
-
-#include "localizationmgr.hxx"
-#include "managelang.hxx"
-#include "dlgresid.hrc"
-#include <editeng/unolingu.hxx>
-
-#include <svtools/langtab.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::uno;
-
-SFX_IMPL_TOOLBOX_CONTROL( LibBoxControl, SfxStringItem );
-
-LibBoxControl::LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
- : SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-}
-
-
-
-LibBoxControl::~LibBoxControl()
-{
-}
-
-
-
-void LibBoxControl::StateChanged( sal_uInt16, SfxItemState eState, const SfxPoolItem* pState )
-{
- BasicLibBox* pBox = (BasicLibBox*) GetToolBox().GetItemWindow( GetId() );
-
- DBG_ASSERT( pBox, "Box not found" );
- if ( !pBox )
- return;
-
- if ( eState != SFX_ITEM_AVAILABLE )
- pBox->Disable();
- else
- {
- pBox->Enable();
-
- if ( pState->ISA(SfxStringItem) )
- pBox->Update( (const SfxStringItem*)pState );
- else
- pBox->Update( NULL );
- }
-}
-
-
-
-Window* LibBoxControl::CreateItemWindow( Window *pParent )
-{
- return new BasicLibBox( pParent, m_xFrame );
-}
-
-//=============================================================================
-//= DocListenerBox
-//=============================================================================
-
-DocListenerBox::DocListenerBox( Window* pParent )
- :ListBox( pParent, WinBits( WB_BORDER | WB_DROPDOWN ) )
- ,m_aNotifier( *this )
-{
-}
-
-DocListenerBox::~DocListenerBox()
-{
- m_aNotifier.dispose();
-}
-
-void DocListenerBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
-{
- FillBox();
-}
-
-void DocListenerBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ )
-{
- FillBox();
-}
-
-void DocListenerBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void DocListenerBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void DocListenerBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void DocListenerBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ )
-{
- FillBox();
-}
-
-void DocListenerBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ )
-{
- FillBox();
-}
-
-void DocListenerBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void DocListenerBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-//=============================================================================
-//= BasicLibBox
-//=============================================================================
-BasicLibBox::BasicLibBox( Window* pParent, const uno::Reference< frame::XFrame >& rFrame ) :
- DocListenerBox( pParent ),
- m_xFrame( rFrame )
-{
- FillBox();
- bIgnoreSelect = sal_True; // Select von 0 noch nicht weiterleiten
- bFillBox = sal_True;
- SelectEntryPos( 0 );
- aCurText = GetEntry( 0 );
- SetSizePixel( Size( 250, 200 ) );
- bIgnoreSelect = sal_False;
-}
-
-
-
-BasicLibBox::~BasicLibBox()
-{
- ClearBox();
-}
-
-void BasicLibBox::Update( const SfxStringItem* pItem )
-{
- // Immer auf dem laufenden sein...
-// if ( !pItem || !pItem->GetValue().Len() )
- FillBox();
-
- if ( pItem )
- {
- aCurText = pItem->GetValue();
- if ( aCurText.Len() == 0 )
- aCurText = String( IDEResId( RID_STR_ALL ) );
- }
-
- if ( GetSelectEntry() != aCurText )
- SelectEntry( aCurText );
-}
-
-void BasicLibBox::ReleaseFocus()
-{
- SfxViewShell* pCurSh = SfxViewShell::Current();
- DBG_ASSERT( pCurSh, "Current ViewShell not found!" );
-
- if ( pCurSh )
- {
- Window* pShellWin = pCurSh->GetWindow();
- if ( !pShellWin ) // sonst werde ich ihn nicht los
- pShellWin = Application::GetDefDialogParent();
-
- pShellWin->GrabFocus();
- }
-}
-
-void BasicLibBox::FillBox()
-{
- SetUpdateMode( sal_False );
- bIgnoreSelect = sal_True;
-
- aCurText = GetSelectEntry();
-
- SelectEntryPos( 0 );
- ClearBox();
-
- // create list box entries
- sal_uInt16 nPos = InsertEntry( String( IDEResId( RID_STR_ALL ) ), LISTBOX_APPEND );
- SetEntryData( nPos, new BasicLibEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_UNKNOWN, String() ) );
- InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER );
- InsertEntries( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
-
- ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- InsertEntries( *doc, LIBRARY_LOCATION_DOCUMENT );
- }
-
- SetUpdateMode( sal_True );
-
- SelectEntry( aCurText );
- if ( !GetSelectEntryCount() )
- {
- SelectEntryPos( GetEntryCount() ); // gibst es nicht => leer?
- aCurText = GetSelectEntry();
- }
- bIgnoreSelect = sal_False;
-}
-
-void BasicLibBox::InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation )
-{
- // get a sorted list of library names
- Sequence< ::rtl::OUString > aLibNames = rDocument.getLibraryNames();
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; ++i )
- {
- String aLibName = pLibNames[ i ];
- if ( eLocation == rDocument.getLibraryLocation( aLibName ) )
- {
- String aName( rDocument.getTitle( eLocation ) );
- String aEntryText( CreateMgrAndLibStr( aName, aLibName ) );
- sal_uInt16 nPos = InsertEntry( aEntryText, LISTBOX_APPEND );
- SetEntryData( nPos, new BasicLibEntry( rDocument, eLocation, aLibName ) );
- }
- }
-}
-
-long BasicLibBox::PreNotify( NotifyEvent& rNEvt )
-{
- long nDone = 0;
- if( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- KeyEvent aKeyEvt = *rNEvt.GetKeyEvent();
- sal_uInt16 nKeyCode = aKeyEvt.GetKeyCode().GetCode();
- switch( nKeyCode )
- {
- case KEY_RETURN:
- {
- NotifyIDE();
- nDone = 1;
- }
- break;
-
- case KEY_ESCAPE:
- {
- SelectEntry( aCurText );
- ReleaseFocus();
- nDone = 1;
- }
- break;
- }
- }
- else if( rNEvt.GetType() == EVENT_GETFOCUS )
- {
- if ( bFillBox )
- {
- FillBox();
- bFillBox = sal_False;
- }
- }
- else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
- {
- if ( !HasChildPathFocus( sal_True ) )
- {
- bIgnoreSelect = sal_True;
- bFillBox = sal_True;
- }
- }
-
- return nDone ? nDone : ListBox::PreNotify( rNEvt );
-}
-
-void BasicLibBox::Select()
-{
- if ( !IsTravelSelect() )
- {
- if ( !bIgnoreSelect )
- NotifyIDE();
- else
- SelectEntry( aCurText ); // Seit 306... (Select nach Escape)
- }
-}
-
-void BasicLibBox::NotifyIDE()
-{
- sal_uInt16 nSelPos = GetSelectEntryPos();
- BasicLibEntry* pEntry = (BasicLibEntry*)GetEntryData( nSelPos );
- if ( pEntry )
- {
- ScriptDocument aDocument( pEntry->GetDocument() );
- SfxUsrAnyItem aDocumentItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, uno::makeAny( aDocument.getDocumentOrNull() ) );
- String aLibName = pEntry->GetLibName();
- SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_LIBSELECTED,
- SFX_CALLMODE_SYNCHRON, &aDocumentItem, &aLibNameItem, 0L );
- }
- }
- ReleaseFocus();
-}
-
-void BasicLibBox::ClearBox()
-{
- sal_uInt16 nCount = GetEntryCount();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
- {
- BasicLibEntry* pEntry = (BasicLibEntry*)GetEntryData( i );
- delete pEntry;
- }
- ListBox::Clear();
-}
-
-// class LanguageBoxControl ----------------------------------------------
-
-SFX_IMPL_TOOLBOX_CONTROL( LanguageBoxControl, SfxStringItem );
-
-LanguageBoxControl::LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx )
- : SfxToolBoxControl( nSlotId, nId, rTbx )
-{
-}
-
-LanguageBoxControl::~LanguageBoxControl()
-{
-}
-
-void LanguageBoxControl::StateChanged( sal_uInt16 _nID, SfxItemState _eState, const SfxPoolItem* _pItem )
-{
- (void)_nID;
-
- BasicLanguageBox* pBox = (BasicLanguageBox*)( GetToolBox().GetItemWindow( GetId() ) );
-
- if ( pBox )
- {
- if ( _eState != SFX_ITEM_AVAILABLE )
- pBox->Disable();
- else
- {
- pBox->Enable();
- if ( _pItem->ISA(SfxStringItem) )
- pBox->Update( (const SfxStringItem*)_pItem );
- else
- pBox->Update( NULL );
- }
- }
-}
-
-Window* LanguageBoxControl::CreateItemWindow( Window *pParent )
-{
- return new BasicLanguageBox( pParent );
-}
-
-// class BasicLanguageBox ------------------------------------------------
-
-BasicLanguageBox::BasicLanguageBox( Window* pParent ) :
-
- DocListenerBox( pParent ),
-
- m_sNotLocalizedStr( IDEResId( RID_STR_TRANSLATION_NOTLOCALIZED ) ),
- m_sDefaultLanguageStr( IDEResId( RID_STR_TRANSLATION_DEFAULT ) ),
-
- m_bIgnoreSelect( false )
-
-{
- SetSizePixel( Size( 210, 200 ) );
-
- FillBox();
-}
-
-BasicLanguageBox::~BasicLanguageBox()
-{
- ClearBox();
-}
-
-void BasicLanguageBox::FillBox()
-{
- SetUpdateMode( sal_False );
- m_bIgnoreSelect = true;
- m_sCurrentText = GetSelectEntry();
- ClearBox();
-
- LocalizationMgr* pCurMgr = IDE_DLL()->GetShell()->GetCurLocalizationMgr();
- if ( pCurMgr->isLibraryLocalized() )
- {
- Enable();
- SvtLanguageTable aLangTable;
- Locale aDefaultLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
- Locale aCurrentLocale = pCurMgr->getStringResourceManager()->getCurrentLocale();
- Sequence< Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
- const Locale* pLocale = aLocaleSeq.getConstArray();
- sal_Int32 i, nCount = aLocaleSeq.getLength();
- sal_uInt16 nSelPos = LISTBOX_ENTRY_NOTFOUND;
- for ( i = 0; i < nCount; ++i )
- {
- bool bIsDefault = localesAreEqual( aDefaultLocale, pLocale[i] );
- bool bIsCurrent = localesAreEqual( aCurrentLocale, pLocale[i] );
- LanguageType eLangType = SvxLocaleToLanguage( pLocale[i] );
- String sLanguage = aLangTable.GetString( eLangType );
- if ( bIsDefault )
- {
- sLanguage += ' ';
- sLanguage += m_sDefaultLanguageStr;
- }
- sal_uInt16 nPos = InsertEntry( sLanguage );
- SetEntryData( nPos, new LanguageEntry( sLanguage, pLocale[i], bIsDefault ) );
-
- if ( bIsCurrent )
- nSelPos = nPos;
- }
-
- if ( nSelPos != LISTBOX_ENTRY_NOTFOUND )
- {
- SelectEntryPos( nSelPos );
- m_sCurrentText = GetSelectEntry();
- }
- }
- else
- {
- InsertEntry( m_sNotLocalizedStr );
- SelectEntryPos(0);
- Disable();
- }
-
- SetUpdateMode( sal_True );
- m_bIgnoreSelect = false;
-}
-
-void BasicLanguageBox::ClearBox()
-{
- sal_uInt16 nCount = GetEntryCount();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
- {
- LanguageEntry* pEntry = (LanguageEntry*)GetEntryData(i);
- delete pEntry;
- }
- ListBox::Clear();
-}
-
-void BasicLanguageBox::SetLanguage()
-{
- LanguageEntry* pEntry = (LanguageEntry*)GetEntryData( GetSelectEntryPos() );
- if ( pEntry )
- IDE_DLL()->GetShell()->GetCurLocalizationMgr()->handleSetCurrentLocale( pEntry->m_aLocale );
-}
-
-void BasicLanguageBox::Select()
-{
- if ( !m_bIgnoreSelect )
- SetLanguage();
- else
- SelectEntry( m_sCurrentText ); // Select after Escape
-}
-
-long BasicLanguageBox::PreNotify( NotifyEvent& rNEvt )
-{
- long nDone = 0;
- if( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- sal_uInt16 nKeyCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode();
- switch( nKeyCode )
- {
- case KEY_RETURN:
- {
- SetLanguage();
- nDone = 1;
- }
- break;
-
- case KEY_ESCAPE:
- {
- SelectEntry( m_sCurrentText );
- nDone = 1;
- }
- break;
- }
- }
- else if( rNEvt.GetType() == EVENT_GETFOCUS )
- {
- }
- else if( rNEvt.GetType() == EVENT_LOSEFOCUS )
- {
- }
-
- return nDone ? nDone : ListBox::PreNotify( rNEvt );
-}
-
-void BasicLanguageBox::Update( const SfxStringItem* pItem )
-{
- FillBox();
-
- if ( pItem && pItem->GetValue().Len() > 0 )
- {
- m_sCurrentText = pItem->GetValue();
- if ( GetSelectEntry() != m_sCurrentText )
- SelectEntry( m_sCurrentText );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basicbox.hxx b/basctl/source/basicide/basicbox.hxx
deleted file mode 100644
index 1e27c1c19..000000000
--- a/basctl/source/basicide/basicbox.hxx
+++ /dev/null
@@ -1,154 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-//
-#ifndef _BASICBOX_HXX
-#define _BASICBOX_HXX
-
-#include "doceventnotifier.hxx"
-#include <svl/stritem.hxx>
-#include <svheader.hxx>
-#include <sfx2/tbxctrl.hxx>
-#include <vcl/lstbox.hxx>
-
-
-class LibBoxControl: public SfxToolBoxControl
-{
-public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- LibBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- ~LibBoxControl();
-
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState );
- virtual Window* CreateItemWindow( Window *pParent );
-};
-
-/** base class for list boxes which need to update their content according to the list
- of open documents
-*/
-class DocListenerBox :public ListBox
- ,public ::basctl::DocumentEventListener
-{
-protected:
- DocListenerBox( Window* pParent );
- ~DocListenerBox();
-
-protected:
- virtual void FillBox() = 0;
-
-private:
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
- virtual void onDocumentOpened( const ScriptDocument& _rDocument );
- virtual void onDocumentSave( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
- virtual void onDocumentClosed( const ScriptDocument& _rDocument );
- virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
- virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
-
-private:
- ::basctl::DocumentEventNotifier m_aNotifier;
-};
-
-//
-
-class BasicLibBox : public DocListenerBox
-{
-private:
- String aCurText;
- sal_Bool bIgnoreSelect;
- sal_Bool bFillBox;
- com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
-
- void ReleaseFocus();
- void InsertEntries( const ScriptDocument& rDocument, LibraryLocation eLocation );
-
- void ClearBox();
- void NotifyIDE();
-
- // DocListenerBox
- virtual void FillBox();
-
-protected:
- virtual void Select();
- virtual long PreNotify( NotifyEvent& rNEvt );
-
-public:
- BasicLibBox( Window* pParent,
- const com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& rFrame );
- ~BasicLibBox();
-
- using Window::Update;
- void Update( const SfxStringItem* pItem );
-};
-
-class LanguageBoxControl: public SfxToolBoxControl
-{
-public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- LanguageBoxControl( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- ~LanguageBoxControl();
-
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState, const SfxPoolItem* pState );
- virtual Window* CreateItemWindow( Window *pParent );
-};
-
-class BasicLanguageBox : public DocListenerBox
-{
-private:
- String m_sNotLocalizedStr;
- String m_sDefaultLanguageStr;
- String m_sCurrentText;
-
- bool m_bIgnoreSelect;
-
- void ClearBox();
- void SetLanguage();
-
- // DocListenerBox
- virtual void FillBox();
-
-protected:
- virtual void Select();
- virtual long PreNotify( NotifyEvent& rNEvt );
-
-public:
- BasicLanguageBox( Window* pParent );
- ~BasicLanguageBox();
-
- using Window::Update;
- void Update( const SfxStringItem* pItem );
-};
-
-#endif // _BASICBOX_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basicmod.hxx b/basctl/source/basicide/basicmod.hxx
deleted file mode 100644
index 2c244443f..000000000
--- a/basctl/source/basicide/basicmod.hxx
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef BASICMOD_HXX
-#define BASICMOD_HXX
-
-#include <sfx2/module.hxx>
-#include <tools/shl.hxx>
-
-class BasicIDEModule : public SfxModule
-{
-public:
- BasicIDEModule( ResMgr *pMgr, SfxObjectFactory *pObjFact) :
- SfxModule( pMgr, sal_False, pObjFact, NULL )
- {}
-};
-
-
-#define BASIC_MOD() ( *(BasicIDEModule**) GetAppData(SHL_IDE) )
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basicprint.src b/basctl/source/basicide/basicprint.src
deleted file mode 100644
index caa5241c5..000000000
--- a/basctl/source/basicide/basicprint.src
+++ /dev/null
@@ -1,38 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <basidesh.hrc>
-
-StringArray RID_PRINTDLG_STRLIST
-{
- ItemList [en-US] =
- {
- < "Print range"; >;
- < "All ~Pages"; >;
- < "Pa~ges"; >;
- };
-};
diff --git a/basctl/source/basicide/basicrenderable.cxx b/basctl/source/basicide/basicrenderable.cxx
deleted file mode 100644
index b157a7254..000000000
--- a/basctl/source/basicide/basicrenderable.cxx
+++ /dev/null
@@ -1,196 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include "precompiled_basctl.hxx"
-
-#include "basicrenderable.hxx"
-#include "bastypes.hxx"
-#include "basidesh.hrc"
-
-#include "com/sun/star/awt/XDevice.hpp"
-#include "toolkit/awt/vclxdevice.hxx"
-#include "vcl/print.hxx"
-#include "tools/multisel.hxx"
-#include "tools/resary.hxx"
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace basicide;
-
-BasicRenderable::BasicRenderable( IDEBaseWindow* pWin )
-: cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >( maMutex )
-, mpWindow( pWin )
-{
- ResStringArray aStrings( IDEResId( RID_PRINTDLG_STRLIST ) );
- DBG_ASSERT( aStrings.Count() >= 3, "resource incomplete" );
- if( aStrings.Count() < 3 ) // bad resource ?
- return;
-
- m_aUIProperties.realloc( 3 );
-
- // create Subgroup for print range
- vcl::PrinterOptionsHelper::UIControlOptions aPrintRangeOpt;
- aPrintRangeOpt.maGroupHint = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PrintRange" ) );
- aPrintRangeOpt.mbInternalOnly = sal_True;
- m_aUIProperties[0].Value = getSubgroupControlOpt( rtl::OUString( aStrings.GetString( 0 ) ),
- rtl::OUString(),
- aPrintRangeOpt
- );
-
- // create a choice for the range to print
- rtl::OUString aPrintContentName( RTL_CONSTASCII_USTRINGPARAM( "PrintContent" ) );
- Sequence< rtl::OUString > aChoices( 2 );
- Sequence< rtl::OUString > aHelpIds( 2 );
- aChoices[0] = aStrings.GetString( 1 );
- aHelpIds[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:0" ) );
- aChoices[1] = aStrings.GetString( 2 );
- aHelpIds[1] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".HelpID:vcl:PrintDialog:PrintContent:RadioButton:1" ) );
- m_aUIProperties[1].Value = getChoiceControlOpt( rtl::OUString(),
- aHelpIds,
- aPrintContentName,
- aChoices,
- 0 );
-
- // create a an Edit dependent on "Pages" selected
- vcl::PrinterOptionsHelper::UIControlOptions aPageRangeOpt( aPrintContentName, 1, sal_True );
- m_aUIProperties[2].Value = getEditControlOpt( rtl::OUString(),
- rtl::OUString(),
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageRange" ) ),
- rtl::OUString(),
- aPageRangeOpt
- );
-}
-
-BasicRenderable::~BasicRenderable()
-{
-}
-
-Printer* BasicRenderable::getPrinter()
-{
- Printer* pPrinter = NULL;
- Any aValue( getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "RenderDevice" ) ) ) );
- Reference<awt::XDevice> xRenderDevice;
-
- if( aValue >>= xRenderDevice )
- {
- VCLXDevice* pDevice = VCLXDevice::GetImplementation(xRenderDevice);
- OutputDevice* pOut = pDevice ? pDevice->GetOutputDevice() : NULL;
- pPrinter = dynamic_cast<Printer*>(pOut);
- }
- return pPrinter;
-}
-
-sal_Int32 SAL_CALL BasicRenderable::getRendererCount (
- const Any&, const Sequence<beans::PropertyValue >& i_xOptions
- ) throw (lang::IllegalArgumentException, RuntimeException)
-{
- processProperties( i_xOptions );
-
- sal_Int32 nCount = 0;
- if( mpWindow )
- {
- Printer* pPrinter = getPrinter();
- if( pPrinter )
- {
- nCount = mpWindow->countPages( pPrinter );
- sal_Int64 nContent = getIntValue( "PrintContent", -1 );
- if( nContent == 1 )
- {
- rtl::OUString aPageRange( getStringValue( "PageRange" ) );
- MultiSelection aSel( aPageRange );
- long nSelCount = aSel.GetSelectCount();
- if( nSelCount >= 0 && nSelCount < nCount )
- nCount = nSelCount;
- }
- }
- else
- throw lang::IllegalArgumentException();
- }
-
- return nCount;
-}
-
-Sequence<beans::PropertyValue> SAL_CALL BasicRenderable::getRenderer (
- sal_Int32, const Any&, const Sequence<beans::PropertyValue>& i_xOptions
- ) throw (lang::IllegalArgumentException, RuntimeException)
-{
- processProperties( i_xOptions );
-
- Sequence< beans::PropertyValue > aVals;
- // insert page size here
- Printer* pPrinter = getPrinter();
- // no renderdevice is legal; the first call is to get our print ui options
- if( pPrinter )
- {
- Size aPageSize( pPrinter->PixelToLogic( pPrinter->GetPaperSizePixel(), MapMode( MAP_100TH_MM ) ) );
-
- aVals.realloc( 1 );
- aVals[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PageSize" ) );
- awt::Size aSize;
- aSize.Width = aPageSize.Width();
- aSize.Height = aPageSize.Height();
- aVals[0].Value <<= aSize;
- }
-
- appendPrintUIOptions( aVals );
-
- return aVals;
-}
-
-void SAL_CALL BasicRenderable::render (
- sal_Int32 nRenderer, const Any&,
- const Sequence<beans::PropertyValue>& i_xOptions
- ) throw (lang::IllegalArgumentException, RuntimeException)
-{
- processProperties( i_xOptions );
-
- if( mpWindow )
- {
- Printer* pPrinter = getPrinter();
- if( pPrinter )
- {
- sal_Int64 nContent = getIntValue( "PrintContent", -1 );
- if( nContent == 1 )
- {
- rtl::OUString aPageRange( getStringValue( "PageRange" ) );
- MultiSelection aSel( aPageRange );
- long nSelect = aSel.FirstSelected();
- while( nSelect != long(SFX_ENDOFSELECTION) && nRenderer-- )
- nSelect = aSel.NextSelected();
- if( nSelect != long(SFX_ENDOFSELECTION) )
- mpWindow->printPage( sal_Int32(nSelect-1), pPrinter );
- }
- else
- mpWindow->printPage( nRenderer, pPrinter );
- }
- else
- throw lang::IllegalArgumentException();
- }
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basicrenderable.hxx b/basctl/source/basicide/basicrenderable.hxx
deleted file mode 100644
index baa5eba87..000000000
--- a/basctl/source/basicide/basicrenderable.hxx
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASICRENDERABLE_HXX
-#define _BASICRENDERABLE_HXX
-
-#include "com/sun/star/view/XRenderable.hpp"
-#include "cppuhelper/compbase1.hxx"
-
-#include "vcl/print.hxx"
-
-class IDEBaseWindow;
-
-namespace basicide
-{
-class BasicRenderable :
- public cppu::WeakComponentImplHelper1< com::sun::star::view::XRenderable >,
- public vcl::PrinterOptionsHelper
-{
- IDEBaseWindow* mpWindow;
- osl::Mutex maMutex;
-
- Printer* getPrinter();
-public:
- BasicRenderable( IDEBaseWindow* pWin );
- virtual ~BasicRenderable();
-
- // XRenderable
- virtual sal_Int32 SAL_CALL getRendererCount (
- const com::sun::star::uno::Any& aSelection,
- const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue >& xOptions)
- throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
-
- virtual com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> SAL_CALL getRenderer (
- sal_Int32 nRenderer,
- const com::sun::star::uno::Any& rSelection,
- const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rxOptions)
- throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL render (
- sal_Int32 nRenderer,
- const com::sun::star::uno::Any& rSelection,
- const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rxOptions)
- throw (com::sun::star::lang::IllegalArgumentException, com::sun::star::uno::RuntimeException);
-
-};
-
-} // namespace
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2.cxx b/basctl/source/basicide/baside2.cxx
deleted file mode 100644
index 2ee4e33d7..000000000
--- a/basctl/source/basicide/baside2.cxx
+++ /dev/null
@@ -1,1739 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <ide_pch.hxx>
-
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-#include <svtools/xtextedt.hxx>
-#include <basic/sbx.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/document/MacroExecMode.hpp>
-#include <com/sun/star/script/ModuleType.hpp>
-#include <toolkit/helper/vclunohelper.hxx>
-#include <sfx2/docfile.hxx>
-#include <basic/basrdll.hxx>
-
-#include <baside2.hrc>
-#include <baside2.hxx>
-#include <objdlg.hxx>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-
-#include <basobj.hxx>
-#include <brkdlg.hxx>
-
-#include <vcl/sound.hxx>
-
-#include <unotools/textsearch.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-#define SPLIT_MARGIN 5
-#define SPLIT_HEIGHT 2
-
-#define LMARGPRN 1700
-#define RMARGPRN 900
-#define TMARGPRN 2000
-#define BMARGPRN 1000
-#define BORDERPRN 300
-
-#define APPWAIT_START 100
-
-#define VALIDWINDOW 0x1234
-
-#if defined(OW) || defined(MTF)
-#define FILTERMASK_ALL "*"
-#else
-#define FILTERMASK_ALL "*.*"
-#endif
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ui::dialogs;
-using namespace utl;
-using namespace comphelper;
-
-
-DBG_NAME( ModulWindow )
-
-TYPEINIT1( ModulWindow , IDEBaseWindow );
-
-void lcl_PrintHeader( Printer* pPrinter, sal_uInt16 nPages, sal_uInt16 nCurPage, const String& rTitle, bool bOutput )
-{
- short nLeftMargin = LMARGPRN;
- Size aSz = pPrinter->GetOutputSize();
- short nBorder = BORDERPRN;
-
- const Color aOldLineColor( pPrinter->GetLineColor() );
- const Color aOldFillColor( pPrinter->GetFillColor() );
- const Font aOldFont( pPrinter->GetFont() );
-
- pPrinter->SetLineColor( Color( COL_BLACK ) );
- pPrinter->SetFillColor();
-
- Font aFont( aOldFont );
- aFont.SetWeight( WEIGHT_BOLD );
- aFont.SetAlign( ALIGN_BOTTOM );
- pPrinter->SetFont( aFont );
-
- long nFontHeight = pPrinter->GetTextHeight();
-
- // 1.Border => Strich, 2+3 Border = Freiraum.
- long nYTop = TMARGPRN-3*nBorder-nFontHeight;
-
- long nXLeft = nLeftMargin-nBorder;
- long nXRight = aSz.Width()-RMARGPRN+nBorder;
-
- if( bOutput )
- pPrinter->DrawRect( Rectangle(
- Point( nXLeft, nYTop ),
- Size( nXRight-nXLeft, aSz.Height() - nYTop - BMARGPRN + nBorder ) ) );
-
-
- long nY = TMARGPRN-2*nBorder;
- Point aPos( nLeftMargin, nY );
- if( bOutput )
- pPrinter->DrawText( aPos, rTitle );
- if ( nPages != 1 )
- {
- aFont.SetWeight( WEIGHT_NORMAL );
- pPrinter->SetFont( aFont );
- String aPageStr( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
- aPageStr += String( IDEResId( RID_STR_PAGE ) );
- aPageStr += ' ';
- aPageStr += String::CreateFromInt32( nCurPage );
- aPageStr += ']';
- aPos.X() += pPrinter->GetTextWidth( rTitle );
- if( bOutput )
- pPrinter->DrawText( aPos, aPageStr );
- }
-
-
- nY = TMARGPRN-nBorder;
-
- if( bOutput )
- pPrinter->DrawLine( Point( nXLeft, nY ), Point( nXRight, nY ) );
-
- pPrinter->SetFont( aOldFont );
- pPrinter->SetFillColor( aOldFillColor );
- pPrinter->SetLineColor( aOldLineColor );
-}
-
-void lcl_ConvertTabsToSpaces( String& rLine )
-{
- if ( rLine.Len() )
- {
- sal_uInt16 nPos = 0;
- sal_uInt16 nMax = rLine.Len();
- while ( nPos < nMax )
- {
- if ( rLine.GetChar( nPos ) == '\t' )
- {
- // Nicht 4 Blanks, sondern an 4er TabPos:
- String aBlanker;
- aBlanker.Fill( ( 4 - ( nPos % 4 ) ), ' ' );
- rLine.Erase( nPos, 1 );
- rLine.Insert( aBlanker, nPos );
- nMax = rLine.Len();
- }
- nPos++; // Nicht optimal, falls Tab, aber auch nicht verkehrt...
- }
- }
-}
-
-
-ModulWindow::ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, String aLibName,
- String aName, ::rtl::OUString& aModule )
- :IDEBaseWindow( pParent, rDocument, aLibName, aName )
- ,aXEditorWindow( this )
- ,m_aModule( aModule )
-{
- DBG_CTOR( ModulWindow, 0 );
- nValid = VALIDWINDOW;
- pLayout = pParent;
- aXEditorWindow.Show();
-
- SetBackground();
-}
-
-SbModuleRef ModulWindow::XModule()
-{
- // ModuleWindows can now be created as a result of the
- // modules getting created via the api. This is a result of an
- // elementInserted event from the BasicLibrary container.
- // However the SbModule is also created from a different listener to
- // the same event ( in basmgr ) Therefore it is possible when we look
- // for xModule it may not yet be available, here we keep tring to access
- // the module until such time as it exists
-
- if ( !xModule.Is() )
- {
- BasicManager* pBasMgr = GetDocument().getBasicManager();
- if ( pBasMgr )
- {
- StarBASIC* pBasic = pBasMgr->GetLib( GetLibName() );
- if ( pBasic )
- {
- xBasic = pBasic;
- xModule = (SbModule*)pBasic->FindModule( GetName() );
- }
- }
- }
- return xModule;
-}
-
-ModulWindow::~ModulWindow()
-{
- DBG_DTOR( ModulWindow, 0 );
- nValid = 0;
-
- StarBASIC::Stop();
-}
-
-
-void ModulWindow::GetFocus()
-{
- if ( nValid != VALIDWINDOW )
- return;
- DBG_CHKTHIS( ModulWindow, 0 );
- aXEditorWindow.GetEdtWindow().GrabFocus();
- // Basisklasse nicht rufen, weil Focus jetzt woanders...
-}
-
-void ModulWindow::DoInit()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- // Wird beim Umschalten der Fenster gerufen...
- if ( GetVScrollBar() )
- GetVScrollBar()->Hide();
- GetHScrollBar()->Show();
- GetEditorWindow().InitScrollBars();
-}
-
-
-void ModulWindow::Paint( const Rectangle& )
-{
-}
-
-void ModulWindow::Resize()
-{
- aXEditorWindow.SetPosSizePixel( Point( 0, 0 ),
- Size( GetOutputSizePixel() ) );
-}
-
-
-// "Import" von baside4.cxx
-void CreateEngineForBasic( StarBASIC* pBasic );
-
-void ModulWindow::CheckCompileBasic()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- if ( XModule().Is() )
- {
- // Zur Laufzeit wird niemals compiliert!
- sal_Bool bRunning = StarBASIC::IsRunning();
- sal_Bool bModified = ( !xModule->IsCompiled() ||
- ( GetEditEngine() && GetEditEngine()->IsModified() ) );
-
- if ( !bRunning && bModified )
- {
- sal_Bool bDone = sal_False;
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- pIDEShell->GetViewFrame()->GetWindow().EnterWait();
-
- if( bModified )
- {
- AssertValidEditEngine();
- GetEditorWindow().SetSourceInBasic( sal_False );
- }
-
- sal_Bool bWasModified = GetBasic()->IsModified();
-
- bDone = GetBasic()->Compile( xModule );
- if ( !bWasModified )
- GetBasic()->SetModified( sal_False );
-
- if ( bDone )
- {
- GetBreakPoints().SetBreakPointsInBasic( xModule );
- }
-
- pIDEShell->GetViewFrame()->GetWindow().LeaveWait();
-
- aStatus.bError = !bDone;
- aStatus.bIsRunning = sal_False;
- }
- }
-}
-
-sal_Bool ModulWindow::BasicExecute()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- // #116444# check security settings before macro execution
- ScriptDocument aDocument( GetDocument() );
- if ( aDocument.isDocument() )
- {
- if ( !aDocument.allowMacros() )
- {
- WarningBox( this, WB_OK, String( IDEResId( RID_STR_CANNOTRUNMACRO ) ) ).Execute();
- return sal_False;
- }
- }
-
- CheckCompileBasic();
-
- if ( XModule().Is() && xModule->IsCompiled() && !aStatus.bError )
- {
- if ( GetBreakPoints().size() )
- aStatus.nBasicFlags = aStatus.nBasicFlags | SbDEBUG_BREAK;
-
- if ( !aStatus.bIsRunning )
- {
- DBG_ASSERT( xModule.Is(), "Kein Modul!" );
- AddStatus( BASWIN_RUNNINGBASIC );
- sal_uInt16 nStart, nEnd, nCurMethodStart = 0;
- TextSelection aSel = GetEditView()->GetSelection();
- // Init cursor to top
- nCurMethodStart = ( aSel.GetStart().GetPara() + 1 );
- SbMethod* pMethod = 0;
- // erstes Macro, sonst blind "Main" (ExtSearch?)
- for ( sal_uInt16 nMacro = 0; nMacro < xModule->GetMethods()->Count(); nMacro++ )
- {
- SbMethod* pM = (SbMethod*)xModule->GetMethods()->Get( nMacro );
- DBG_ASSERT( pM, "Method?" );
- pM->GetLineRange( nStart, nEnd );
- if ( nCurMethodStart >= nStart && nCurMethodStart <= nEnd )
- {
- // matched a method to the cursor position
- pMethod = pM;
- break;
- }
- }
- if ( !pMethod )
- {
- // If not in a method then prompt the user
- return ( BasicIDE::ChooseMacro( uno::Reference< frame::XModel >(), sal_False, rtl::OUString() ).getLength() > 0 ) ? sal_True : sal_False;
- }
- if ( pMethod )
- {
- pMethod->SetDebugFlags( aStatus.nBasicFlags );
- BasicDLL::SetDebugMode( sal_True );
- BasicIDE::RunMethod( pMethod );
- BasicDLL::SetDebugMode( sal_False );
- // Falls waehrend Interactive=sal_False abgebrochen
- BasicDLL::EnableBreak( sal_True );
- }
- ClearStatus( BASWIN_RUNNINGBASIC );
- }
- else
- aStatus.bIsRunning = sal_False; // Abbruch von Reschedule()
- }
-
- sal_Bool bDone = !aStatus.bError;
-
- return bDone;
-}
-
-sal_Bool ModulWindow::CompileBasic()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- CheckCompileBasic();
-
- sal_Bool bIsCompiled = sal_False;
- if ( XModule().Is() )
- bIsCompiled = xModule->IsCompiled();
-
- return bIsCompiled;
-}
-
-sal_Bool ModulWindow::BasicRun()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- aStatus.nBasicFlags = 0;
- sal_Bool bDone = BasicExecute();
- return bDone;
-}
-
-sal_Bool ModulWindow::BasicStepOver()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- aStatus.nBasicFlags = SbDEBUG_STEPINTO | SbDEBUG_STEPOVER;
- sal_Bool bDone = BasicExecute();
- return bDone;
-}
-
-
-sal_Bool ModulWindow::BasicStepInto()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- aStatus.nBasicFlags = SbDEBUG_STEPINTO;
- sal_Bool bDone = BasicExecute();
- return bDone;
-}
-
-sal_Bool ModulWindow::BasicStepOut()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- aStatus.nBasicFlags = SbDEBUG_STEPOUT;
- sal_Bool bDone = BasicExecute();
- return bDone;
-}
-
-
-
-void ModulWindow::BasicStop()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- GetBasic()->Stop();
- aStatus.bIsRunning = sal_False;
-}
-
-sal_Bool ModulWindow::LoadBasic()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- sal_Bool bDone = sal_False;
-
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
-
- if ( aCurPath.Len() )
- xFP->setDisplayDirectory ( aCurPath );
-
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) );
- xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
- xFltMgr->setCurrentFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
-
- if( xFP->execute() == RET_OK )
- {
- Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
- aCurPath = aPaths[0];
- SfxMedium aMedium( aCurPath, STREAM_READ | STREAM_SHARE_DENYWRITE | STREAM_NOCREATE, sal_True );
- SvStream* pStream = aMedium.GetInStream();
- if ( pStream )
- {
- AssertValidEditEngine();
- sal_uLong nLines = CalcLineCount( *pStream );
- // nLines*4: ReadText/Formatting/Highlighting/Formatting
- GetEditorWindow().CreateProgress( String( IDEResId( RID_STR_GENERATESOURCE ) ), nLines*4 );
- GetEditEngine()->SetUpdateMode( sal_False );
- GetEditView()->Read( *pStream );
- GetEditEngine()->SetUpdateMode( sal_True );
- GetEditorWindow().Update(); // Es wurde bei UpdateMode = sal_True nur Invalidiert
- GetEditorWindow().ForceSyntaxTimeout();
- GetEditorWindow().DestroyProgress();
- sal_uLong nError = aMedium.GetError();
- if ( nError )
- ErrorHandler::HandleError( nError );
- else
- bDone = sal_True;
- }
- else
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTREAD ) ) ).Execute();
- }
- return bDone;
-}
-
-
-sal_Bool ModulWindow::SaveBasicSource()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- sal_Bool bDone = sal_False;
-
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
-
- Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
- xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False);
- Any aValue;
- aValue <<= (sal_Bool) sal_True;
- xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
-
- if ( aCurPath.Len() )
- xFP->setDisplayDirectory ( aCurPath );
-
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ), String( RTL_CONSTASCII_USTRINGPARAM( "*.bas" ) ) );
- xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
- xFltMgr->setCurrentFilter( String( RTL_CONSTASCII_USTRINGPARAM( "BASIC" ) ) );
-
- if( xFP->execute() == RET_OK )
- {
- Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
- aCurPath = aPaths[0];
- SfxMedium aMedium( aCurPath, STREAM_WRITE | STREAM_SHARE_DENYWRITE | STREAM_TRUNC, sal_True, sal_False );
- SvStream* pStream = aMedium.GetOutStream();
- if ( pStream )
- {
- EnterWait();
- AssertValidEditEngine();
- GetEditEngine()->Write( *pStream );
- aMedium.Commit();
- LeaveWait();
- sal_uLong nError = aMedium.GetError();
- if ( nError )
- ErrorHandler::HandleError( nError );
- else
- bDone = sal_True;
- }
- else
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTWRITE) ) ).Execute();
- }
-
- return bDone;
-}
-
-sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName );
-
-sal_Bool ModulWindow::ImportDialog()
-{
- const ScriptDocument& rDocument = GetDocument();
- String aLibName = GetLibName();
- sal_Bool bRet = implImportDialog( this, aCurPath, rDocument, aLibName );
- return bRet;
-}
-
-sal_Bool ModulWindow::ToggleBreakPoint( sal_uLong nLine )
-{
- DBG_ASSERT( XModule().Is(), "Kein Modul!" );
-
- sal_Bool bNewBreakPoint = sal_False;
-
- if ( XModule().Is() )
- {
- CheckCompileBasic();
- if ( aStatus.bError )
- {
- Sound::Beep();
- return sal_False;
- }
-
- BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nLine );
- if ( pBrk ) // entfernen
- {
- xModule->ClearBP( (sal_uInt16)nLine );
- delete GetBreakPoints().remove( pBrk );
- }
- else // einen erzeugen
- {
- if ( xModule->SetBP( (sal_uInt16)nLine) )
- {
- GetBreakPoints().InsertSorted( new BreakPoint( nLine ) );
- bNewBreakPoint = sal_True;
- if ( StarBASIC::IsRunning() )
- {
- for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ )
- {
- SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod );
- DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
- pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK );
- }
- }
- }
-
- if ( !bNewBreakPoint )
- Sound::Beep();
- }
- }
-
- return bNewBreakPoint;
-}
-
-void ModulWindow::UpdateBreakPoint( const BreakPoint& rBrk )
-{
- DBG_ASSERT( XModule().Is(), "Kein Modul!" );
-
- if ( XModule().Is() )
- {
- CheckCompileBasic();
-
- if ( rBrk.bEnabled )
- xModule->SetBP( (sal_uInt16)rBrk.nLine );
- else
- xModule->ClearBP( (sal_uInt16)rBrk.nLine );
- }
-}
-
-
-sal_Bool ModulWindow::BasicToggleBreakPoint()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- AssertValidEditEngine();
-
- TextSelection aSel = GetEditView()->GetSelection();
- aSel.GetStart().GetPara()++; // Basic-Zeilen beginnen bei 1!
- aSel.GetEnd().GetPara()++;
-
- sal_Bool bNewBreakPoint = sal_False;
-
- for ( sal_uLong nLine = aSel.GetStart().GetPara(); nLine <= aSel.GetEnd().GetPara(); nLine++ )
- {
- if ( ToggleBreakPoint( nLine ) )
- bNewBreakPoint = sal_True;
- }
-
- aXEditorWindow.GetBrkWindow().Invalidate();
- return bNewBreakPoint;
-}
-
-
-void ModulWindow::BasicToggleBreakPointEnabled()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- AssertValidEditEngine();
-
- ExtTextView* pView = GetEditView();
- if ( pView )
- {
- TextSelection aSel = pView->GetSelection();
- BreakPointList& rList = GetBreakPoints();
-
- for ( sal_uLong nLine = ++aSel.GetStart().GetPara(), nEnd = ++aSel.GetEnd().GetPara(); nLine <= nEnd; ++nLine )
- {
- BreakPoint* pBrk = rList.FindBreakPoint( nLine );
- if ( pBrk )
- {
- pBrk->bEnabled = pBrk->bEnabled ? sal_False : sal_True;
- UpdateBreakPoint( *pBrk );
- }
- }
-
- GetBreakPointWindow().Invalidate();
- }
-}
-
-
-void ModulWindow::ManageBreakPoints()
-{
- BreakPointWindow& rBrkWin = GetBreakPointWindow();
- BreakPointDialog aBrkDlg( &rBrkWin, GetBreakPoints() );
- aBrkDlg.Execute();
- rBrkWin.Invalidate();
-}
-
-
-IMPL_LINK( ModulWindow, BasicErrorHdl, StarBASIC *, pBasic )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- GoOnTop();
-
- // ReturnWert: BOOL
- // FALSE: Abbrechen
- // TRUE: Weiter....
- String aErrorText( pBasic->GetErrorText() );
- sal_uInt16 nErrorLine = pBasic->GetLine() - 1;
- sal_uInt16 nErrCol1 = pBasic->GetCol1();
- sal_uInt16 nErrCol2 = pBasic->GetCol2();
- if ( nErrCol2 != 0xFFFF )
- nErrCol2++;
-
- AssertValidEditEngine();
- GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, nErrCol1 ), TextPaM( nErrorLine, nErrCol2 ) ) );
-
- String aErrorTextPrefix;
- if( pBasic->IsCompilerError() )
- {
- aErrorTextPrefix = String( IDEResId( RID_STR_COMPILEERROR ) );
- }
- else
- {
- aErrorTextPrefix = String( IDEResId( RID_STR_RUNTIMEERROR ) );
- aErrorTextPrefix += StarBASIC::GetVBErrorCode( pBasic->GetErrorCode() );
- aErrorTextPrefix += ' ';
- pLayout->GetStackWindow().UpdateCalls();
- }
- // Wenn anderes Basic, dan sollte die IDE versuchen, da richtige
- // Modul anzuzeigen...
- sal_Bool bMarkError = ( pBasic == GetBasic() ) ? sal_True : sal_False;
- if ( bMarkError )
- aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine, sal_True );
-
- // #i47002#
- Reference< awt::XWindow > xWindow = VCLUnoHelper::GetInterface( this );
-
- ErrorHandler::HandleError( StarBASIC::GetErrorCode() );
-
- // #i47002#
- Window* pWindow = VCLUnoHelper::GetWindow( xWindow );
- if ( !pWindow )
- return sal_False;
-
- if ( bMarkError )
- aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER );
- return sal_False;
-}
-
-long ModulWindow::BasicBreakHdl( StarBASIC* pBasic )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- // #i69280 Required in Window despite normal usage in next command!
- (void)pBasic;
-
- // ReturnWert: sal_uInt16 => siehe SB-Debug-Flags
- sal_uInt16 nErrorLine = pBasic->GetLine();
-
- // Gibt es hier einen BreakPoint?
- BreakPoint* pBrk = GetBreakPoints().FindBreakPoint( nErrorLine );
- if ( pBrk )
- {
- pBrk->nHitCount++;
- if ( pBrk->nHitCount < pBrk->nStopAfter && GetBasic()->IsBreak() )
- return aStatus.nBasicFlags; // weiterlaufen...
- }
-
- nErrorLine--; // EditEngine begint bei 0, Basic bei 1
- // Alleine schon damit gescrollt wird...
- AssertValidEditEngine();
- GetEditView()->SetSelection( TextSelection( TextPaM( nErrorLine, 0 ), TextPaM( nErrorLine, 0 ) ) );
- aXEditorWindow.GetBrkWindow().SetMarkerPos( nErrorLine );
-
- pLayout->GetWatchWindow().UpdateWatches();
- pLayout->GetStackWindow().UpdateCalls();
-
- aStatus.bIsInReschedule = sal_True;
- aStatus.bIsRunning = sal_True;
-
- AddStatus( BASWIN_INRESCHEDULE );
-
- BasicIDE::InvalidateDebuggerSlots();
-
- while( aStatus.bIsRunning )
- Application::Yield();
-
- aStatus.bIsInReschedule = sal_False;
- aXEditorWindow.GetBrkWindow().SetMarkerPos( MARKER_NOMARKER );
-
- ClearStatus( BASWIN_INRESCHEDULE );
-
- return aStatus.nBasicFlags;
-}
-
-void ModulWindow::BasicAddWatch()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- String aWatchStr;
- sal_Bool bInserted = sal_False;
- AssertValidEditEngine();
- sal_Bool bAdd = sal_True;
- if ( !GetEditView()->HasSelection() )
- {
- TextPaM aWordStart;
- String aWord = GetEditEngine()->GetWord( GetEditView()->GetSelection().GetEnd(), &aWordStart );
- if ( aWord.Len() )
- {
- TextSelection aSel( aWordStart );
- sal_uInt16& rIndex = aSel.GetEnd().GetIndex();
- rIndex = rIndex + aWord.Len();
- GetEditView()->SetSelection( aSel );
- bAdd = sal_True;
- }
- }
- if ( bAdd )
- {
- TextSelection aSel = GetEditView()->GetSelection();
- if ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() )
- {
- aWatchStr = GetEditView()->GetSelected();
- pLayout->GetWatchWindow().AddWatch( aWatchStr );
- pLayout->GetWatchWindow().UpdateWatches();
- bInserted = sal_True;
- }
- }
-
- if ( !bInserted )
- Sound::Beep();
-}
-
-
-
-void ModulWindow::BasicRemoveWatch()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- sal_Bool bRemoved = pLayout->GetWatchWindow().RemoveSelectedWatch();
-
- if ( !bRemoved )
- Sound::Beep();
-}
-
-
-void ModulWindow::EditMacro( const String& rMacroName )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( XModule().Is(), "Kein Modul!" );
-
- if ( XModule().Is() )
- {
- CheckCompileBasic();
-
- if ( !aStatus.bError )
- {
- sal_uInt16 nStart, nEnd;
- SbMethod* pMethod = (SbMethod*)xModule->Find( rMacroName, SbxCLASS_METHOD );
- if ( pMethod )
- {
- pMethod->GetLineRange( nStart, nEnd );
- if ( nStart )
- {
- // Basic beginnt bei 1
- nStart--;
- nEnd--;
- }
- TextSelection aSel( TextPaM( nStart, 0 ), TextPaM( nStart, 0 ) );
- AssertValidEditEngine();
- TextView * pView = GetEditView();
- // ggf. hinscrollen, so dass erste Zeile oben...
- long nVisHeight = GetOutputSizePixel().Height();
- if ( (long)pView->GetTextEngine()->GetTextHeight() > nVisHeight )
- {
- long nMaxY = pView->GetTextEngine()->GetTextHeight() - nVisHeight;
- long nOldStartY = pView->GetStartDocPos().Y();
- long nNewStartY = nStart * pView->GetTextEngine()->GetCharHeight();
- nNewStartY = Min( nNewStartY, nMaxY );
- pView->Scroll( 0, -(nNewStartY-nOldStartY) );
- pView->ShowCursor( sal_False, sal_True );
- GetEditVScrollBar().SetThumbPos( pView->GetStartDocPos().Y() );
- }
- pView->SetSelection( aSel );
- pView->ShowCursor();
- pView->GetWindow()->GrabFocus();
- }
- }
- }
-}
-
-
-void ModulWindow::StoreData()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- // StoreData wird gerufen, wenn der BasicManager zerstoert oder
- // dieses Fenster beendet wird.
- // => Keine Unterbrechungen erwuenscht!
- // Und bei SAVE, wenn AppBasic...
- GetEditorWindow().SetSourceInBasic( sal_True );
-}
-
-sal_Bool ModulWindow::CanClose()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- return sal_True;
-}
-
-
-sal_Bool ModulWindow::AllowUndo()
-{
- return GetEditorWindow().CanModify();
-}
-
-
-void ModulWindow::UpdateData()
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- DBG_ASSERT( XModule().Is(), "Kein Modul!" );
- // UpdateData wird gerufen, wenn sich der Source von aussen
- // geaendert hat.
- // => Keine Unterbrechungen erwuenscht!
-
- if ( XModule().Is() )
- {
- SetModule( xModule->GetSource32() );
-
- if ( GetEditView() )
- {
- TextSelection aSel = GetEditView()->GetSelection();
- setTextEngineText( GetEditEngine(), xModule->GetSource32() );
- GetEditView()->SetSelection( aSel );
- GetEditEngine()->SetModified( sal_False );
- BasicIDE::MarkDocumentModified( GetDocument() );
- }
- }
-}
-
-sal_Int32 ModulWindow::countPages( Printer* pPrinter )
-{
- return FormatAndPrint( pPrinter, -1 );
-}
-
-void ModulWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
-{
- FormatAndPrint( pPrinter, nPage );
-}
-
-/* implementation note: this is totally inefficient for the XRenderable interface
- usage since the whole "document" will be format for every page. Should this ever
- become a problem we should
- - format only once for every new printer
- - keep an index list for each page which is the starting paragraph
-*/
-sal_Int32 ModulWindow::FormatAndPrint( Printer* pPrinter, sal_Int32 nPrintPage )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
-
- AssertValidEditEngine();
-
- MapMode eOldMapMode( pPrinter->GetMapMode() );
- Font aOldFont( pPrinter->GetFont() );
-
- Font aFont( GetEditEngine()->GetFont() );
- aFont.SetAlign( ALIGN_BOTTOM );
- aFont.SetTransparent( sal_True );
- aFont.SetSize( Size( 0, 360 ) );
- pPrinter->SetFont( aFont );
- pPrinter->SetMapMode( MAP_100TH_MM );
-
- String aTitle( CreateQualifiedName() );
-
- sal_uInt16 nLineHeight = (sal_uInt16) pPrinter->GetTextHeight(); // etwas mehr.
- sal_uInt16 nParaSpace = 10;
-
- Size aPaperSz = pPrinter->GetOutputSize();
- aPaperSz.Width() -= (LMARGPRN+RMARGPRN);
- aPaperSz.Height() -= (TMARGPRN+BMARGPRN);
-
- // nLinepPage stimmt nicht, wenn Zeilen umgebrochen werden muessen...
- sal_uInt16 nLinespPage = (sal_uInt16) (aPaperSz.Height()/nLineHeight);
- sal_uInt16 nCharspLine = (sal_uInt16) (aPaperSz.Width() / pPrinter->GetTextWidth( 'X' ) );
- sal_uLong nParas = GetEditEngine()->GetParagraphCount();
-
- sal_uInt16 nPages = (sal_uInt16) (nParas/nLinespPage+1 );
- sal_uInt16 nCurPage = 1;
-
- // Header drucken...
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nPrintPage == 0 );
- Point aPos( LMARGPRN, TMARGPRN );
- for ( sal_uLong nPara = 0; nPara < nParas; nPara++ )
- {
- String aLine( GetEditEngine()->GetText( nPara ) );
- lcl_ConvertTabsToSpaces( aLine );
- sal_uInt16 nLines = aLine.Len()/nCharspLine+1;
- for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
- {
- String aTmpLine( aLine, nLine*nCharspLine, nCharspLine );
- aPos.Y() += nLineHeight;
- if ( aPos.Y() > ( aPaperSz.Height()+TMARGPRN ) )
- {
- nCurPage++;
- lcl_PrintHeader( pPrinter, nPages, nCurPage, aTitle, nCurPage-1 == nPrintPage );
- aPos = Point( LMARGPRN, TMARGPRN+nLineHeight );
- }
- if( nCurPage-1 == nPrintPage )
- pPrinter->DrawText( aPos, aTmpLine );
- }
- aPos.Y() += nParaSpace;
- }
-
- pPrinter->SetFont( aOldFont );
- pPrinter->SetMapMode( eOldMapMode );
-
- return sal_Int32(nCurPage);
-}
-
-
-void ModulWindow::ExecuteCommand( SfxRequest& rReq )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- AssertValidEditEngine();
- sal_uInt16 nSlot = rReq.GetSlot();
- switch ( nSlot )
- {
- case SID_DELETE:
- {
- KeyEvent aFakeDelete( 0, KEY_DELETE );
- GetEditView()->KeyInput( aFakeDelete );
- break;
- }
- case SID_SELECTALL:
- GetEditView()->SetSelection( TextSelection( TextPaM( 0, 0 ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
- break;
- case SID_BASICRUN:
- {
- BasicRun();
- }
- break;
- case SID_BASICCOMPILE:
- {
- CompileBasic();
- }
- break;
- case SID_BASICSTEPOVER:
- {
- BasicStepOver();
- }
- break;
- case SID_BASICSTEPINTO:
- {
- BasicStepInto();
- }
- break;
- case SID_BASICSTEPOUT:
- {
- BasicStepOut();
- }
- break;
- case SID_BASICLOAD:
- {
- LoadBasic();
- }
- break;
- case SID_BASICSAVEAS:
- {
- SaveBasicSource();
- }
- break;
- case SID_IMPORT_DIALOG:
- {
- ImportDialog();
- }
- break;
- case SID_BASICIDE_MATCHGROUP:
- {
- if ( !GetEditView()->MatchGroup() )
- Sound::Beep();
- }
- break;
- case SID_BASICIDE_TOGGLEBRKPNT:
- {
- BasicToggleBreakPoint();
- }
- break;
- case SID_BASICIDE_MANAGEBRKPNTS:
- {
- ManageBreakPoints();
- }
- break;
- case SID_BASICIDE_TOGGLEBRKPNTENABLED:
- {
- BasicToggleBreakPointEnabled();
- }
- break;
- case SID_BASICIDE_ADDWATCH:
- {
- BasicAddWatch();
- }
- break;
- case SID_BASICIDE_REMOVEWATCH:
- {
- BasicRemoveWatch();
- }
- break;
- case SID_CUT:
- {
- if ( !IsReadOnly() )
- {
- GetEditView()->Cut();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- }
- break;
- case SID_COPY:
- {
- GetEditView()->Copy();
- }
- break;
- case SID_PASTE:
- {
- if ( !IsReadOnly() )
- {
- GetEditView()->Paste();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- }
- break;
- case SID_BASICIDE_BRKPNTSCHANGED:
- {
- GetBreakPointWindow().Invalidate();
- }
- break;
- }
-}
-
-
-
-void ModulWindow::GetState( SfxItemSet &rSet )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- SfxWhichIter aIter(rSet);
- for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
- {
- switch ( nWh )
- {
- // allgemeine Items:
- case SID_CUT:
- {
- if ( !GetEditView() || !GetEditView()->HasSelection() )
- rSet.DisableItem( nWh );
-
- if ( IsReadOnly() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_COPY:
- {
- if ( !GetEditView() || !GetEditView()->HasSelection() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_PASTE:
- {
- if ( !IsPasteAllowed() )
- rSet.DisableItem( nWh );
-
- if ( IsReadOnly() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_BASICIDE_STAT_POS:
- {
- TextView* pView = GetEditView();
- if ( pView )
- {
- TextSelection aSel = pView->GetSelection();
- String aPos( IDEResId( RID_STR_LINE ) );
- aPos += ' ';
- aPos += String::CreateFromInt32( aSel.GetEnd().GetPara()+1 );
- aPos += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
- aPos += String( IDEResId( RID_STR_COLUMN ) );
- aPos += ' ';
- aPos += String::CreateFromInt32( aSel.GetEnd().GetIndex()+1 );
- SfxStringItem aItem( SID_BASICIDE_STAT_POS, aPos );
- rSet.Put( aItem );
- }
- }
- break;
- case SID_ATTR_INSERT:
- {
- TextView* pView = GetEditView();
- if ( pView )
- {
- SfxBoolItem aItem( SID_ATTR_INSERT, pView->IsInsertMode() );
- rSet.Put( aItem );
- }
- }
- break;
- }
- }
-}
-
-
-void ModulWindow::DoScroll( ScrollBar* pCurScrollBar )
-{
- DBG_CHKTHIS( ModulWindow, 0 );
- if ( ( pCurScrollBar == GetHScrollBar() ) && GetEditView() )
- {
- // Nicht mit dem Wert Scrollen, sondern lieber die Thumb-Pos fuer die
- // VisArea verwenden:
- long nDiff = GetEditView()->GetStartDocPos().X() - pCurScrollBar->GetThumbPos();
- GetEditView()->Scroll( nDiff, 0 );
- GetEditView()->ShowCursor( sal_False, sal_True );
- pCurScrollBar->SetThumbPos( GetEditView()->GetStartDocPos().X() );
-
- }
-}
-
-
-sal_Bool ModulWindow::IsModified()
-{
- return GetEditEngine() ? GetEditEngine()->IsModified() : sal_False;
-}
-
-
-
-void ModulWindow::GoOnTop()
-{
- IDE_DLL()->GetShell()->GetViewFrame()->ToTop();
-}
-
-String ModulWindow::GetSbModuleName()
-{
- String aModuleName;
- if ( XModule().Is() )
- aModuleName = xModule->GetName();
- return aModuleName;
-}
-
-
-
-String ModulWindow::GetTitle()
-{
- return GetSbModuleName();
-}
-
-
-
-void ModulWindow::FrameWindowMoved()
-{
-}
-
-
-
-void ModulWindow::ShowCursor( sal_Bool bOn )
-{
- if ( GetEditEngine() )
- {
- TextView* pView = GetEditEngine()->GetActiveView();
- if ( pView )
- {
- if ( bOn )
- pView->ShowCursor();
- else
- pView->HideCursor();
- }
- }
-}
-
-
-Window* ModulWindow::GetLayoutWindow()
-{
- return pLayout;
-}
-
-void ModulWindow::AssertValidEditEngine()
-{
- if ( !GetEditEngine() )
- GetEditorWindow().CreateEditEngine();
-}
-
-void ModulWindow::Deactivating()
-{
- if ( GetEditView() )
- GetEditView()->EraseVirtualDevice();
-}
-
-sal_uInt16 ModulWindow::StartSearchAndReplace( const SvxSearchItem& rSearchItem, sal_Bool bFromStart )
-{
- // Mann koennte fuer das blinde Alle-Ersetzen auch auf
- // Syntaxhighlighting/Formatierung verzichten...
- AssertValidEditEngine();
- ExtTextView* pView = GetEditView();
- TextSelection aSel;
- if ( bFromStart )
- {
- aSel = pView->GetSelection();
- if ( !rSearchItem.GetBackward() )
- pView->SetSelection( TextSelection() );
- else
- pView->SetSelection( TextSelection( TextPaM( 0xFFFFFFFF, 0xFFFF ), TextPaM( 0xFFFFFFFF, 0xFFFF ) ) );
- }
-
- sal_Bool bForward = !rSearchItem.GetBackward();
- sal_uInt16 nFound = 0;
- if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_FIND_ALL ) )
- {
- nFound = pView->Search( rSearchItem.GetSearchOptions() , bForward );
- }
- else if ( ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE ) ||
- ( rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL ) )
- {
- if ( !IsReadOnly() )
- {
- sal_Bool bAll = rSearchItem.GetCommand() == SVX_SEARCHCMD_REPLACE_ALL;
- nFound = pView->Replace( rSearchItem.GetSearchOptions() , bAll , bForward );
- }
- }
-
- if ( bFromStart && !nFound )
- pView->SetSelection( aSel );
-
- return nFound;
-}
-
-::svl::IUndoManager* ModulWindow::GetUndoManager()
-{
- if ( GetEditEngine() )
- return &GetEditEngine()->GetUndoManager();
- return NULL;
-}
-
-sal_uInt16 ModulWindow::GetSearchOptions()
-{
- sal_uInt16 nOptions = SEARCH_OPTIONS_SEARCH |
- SEARCH_OPTIONS_WHOLE_WORDS |
- SEARCH_OPTIONS_BACKWARDS |
- SEARCH_OPTIONS_REG_EXP |
- SEARCH_OPTIONS_EXACT |
- SEARCH_OPTIONS_SELECTION |
- SEARCH_OPTIONS_SIMILARITY;
-
- if ( !IsReadOnly() )
- {
- nOptions |= SEARCH_OPTIONS_REPLACE;
- nOptions |= SEARCH_OPTIONS_REPLACE_ALL;
- }
-
- return nOptions;
-}
-
-void ModulWindow::BasicStarted()
-{
- if ( XModule().Is() )
- {
- aStatus.bIsRunning = sal_True;
- BreakPointList& rList = GetBreakPoints();
- if ( rList.size() )
- {
- rList.ResetHitCount();
- rList.SetBreakPointsInBasic( xModule );
- for ( sal_uInt16 nMethod = 0; nMethod < xModule->GetMethods()->Count(); nMethod++ )
- {
- SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( nMethod );
- DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
- pMethod->SetDebugFlags( pMethod->GetDebugFlags() | SbDEBUG_BREAK );
- }
- }
- }
-}
-
-void ModulWindow::BasicStopped()
-{
- aStatus.bIsRunning = sal_False;
- GetBreakPointWindow().SetMarkerPos( MARKER_NOMARKER );
-}
-
-BasicEntryDescriptor ModulWindow::CreateEntryDescriptor()
-{
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- String aModName( GetName() );
- String aLibSubName;
- if( xBasic.Is() && aDocument.isInVBAMode() && XModule().Is() )
- {
- switch( xModule->GetModuleType() )
- {
- case script::ModuleType::DOCUMENT:
- {
- aLibSubName = String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) );
- uno::Reference< container::XNameContainer > xLib = aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
- if( xLib.is() )
- {
- String sObjName;
- ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
- if( sObjName.Len() )
- {
- aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
- }
- }
- break;
- }
- case script::ModuleType::FORM:
- aLibSubName = String( IDEResId( RID_STR_USERFORMS ) );
- break;
- case script::ModuleType::NORMAL:
- aLibSubName = String( IDEResId( RID_STR_NORMAL_MODULES ) );
- break;
- case script::ModuleType::CLASS:
- aLibSubName = String( IDEResId( RID_STR_CLASS_MODULES ) );
- break;
- }
- }
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aModName, OBJ_TYPE_MODULE );
-}
-
-void ModulWindow::SetReadOnly( sal_Bool b )
-{
- if ( GetEditView() )
- GetEditView()->SetReadOnly( b );
-}
-
-sal_Bool ModulWindow::IsReadOnly()
-{
- sal_Bool bReadOnly = sal_False;
-
- if ( GetEditView() )
- bReadOnly = GetEditView()->IsReadOnly();
-
- return bReadOnly;
-}
-
-sal_Bool ModulWindow::IsPasteAllowed()
-{
- sal_Bool bPaste = sal_False;
-
- // get clipboard
- Reference< datatransfer::clipboard::XClipboard > xClipboard = GetClipboard();
- if ( xClipboard.is() )
- {
- // get clipboard content
- const sal_uInt32 nRef = Application::ReleaseSolarMutex();
- Reference< datatransfer::XTransferable > xTransf = xClipboard->getContents();
- Application::AcquireSolarMutex( nRef );
- if ( xTransf.is() )
- {
- datatransfer::DataFlavor aFlavor;
- SotExchange::GetFormatDataFlavor( SOT_FORMAT_STRING, aFlavor );
- if ( xTransf->isDataFlavorSupported( aFlavor ) )
- {
- bPaste = sal_True;
- }
- }
- }
-
- return bPaste;
-}
-
-ModulWindowLayout::ModulWindowLayout( Window* pParent ) :
- Window( pParent, WB_CLIPCHILDREN ),
- aVSplitter( this, WinBits( WB_VSCROLL ) ),
- aHSplitter( this, WinBits( WB_HSCROLL ) ),
- aWatchWindow( this ),
- aStackWindow( this ),
- bVSplitted(sal_False),
- bHSplitted(sal_False),
- m_pModulWindow(0),
- m_aImagesNormal(IDEResId(RID_IMGLST_LAYOUT))
-{
- SetBackground(GetSettings().GetStyleSettings().GetWindowColor());
-
- aVSplitter.SetSplitHdl( LINK( this, ModulWindowLayout, SplitHdl ) );
- aHSplitter.SetSplitHdl( LINK( this, ModulWindowLayout, SplitHdl ) );
- aVSplitter.Show();
- aHSplitter.Show();
-
- aWatchWindow.Show();
- aStackWindow.Show();
-
- Color aColor(GetSettings().GetStyleSettings().GetFieldTextColor());
- m_aSyntaxColors[TT_UNKNOWN] = aColor;
- m_aSyntaxColors[TT_WHITESPACE] = aColor;
- m_aSyntaxColors[TT_EOL] = aColor;
- m_aColorConfig.AddListener(this);
- m_aSyntaxColors[TT_IDENTIFIER]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER).nColor);
- m_aSyntaxColors[TT_NUMBER]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor);
- m_aSyntaxColors[TT_STRING]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor);
- m_aSyntaxColors[TT_COMMENT]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT).nColor);
- m_aSyntaxColors[TT_ERROR]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor);
- m_aSyntaxColors[TT_OPERATOR]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR).nColor);
- m_aSyntaxColors[TT_KEYWORDS]
- = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD).nColor);
-
- Font aFont( GetFont() );
- Size aSz( aFont.GetSize() );
- aSz.Height() *= 3;
- aSz.Height() /= 2;
- aFont.SetSize( aSz );
- aFont.SetWeight( WEIGHT_BOLD );
- aFont.SetColor(GetSettings().GetStyleSettings().GetWindowTextColor());
- SetFont( aFont );
-}
-
-ModulWindowLayout::~ModulWindowLayout()
-{
- m_aColorConfig.RemoveListener(this);
-}
-
-void ModulWindowLayout::Resize()
-{
- // ScrollBars, etc. passiert in BasicIDEShell:Adjust...
- ArrangeWindows();
-}
-
-void ModulWindowLayout::Paint( const Rectangle& )
-{
- DrawText( Point(), String( IDEResId( RID_STR_NOMODULE ) ) );
-}
-
-
-void ModulWindowLayout::ArrangeWindows()
-{
- Size aSz = GetOutputSizePixel();
-
- // prueffen, ob der Splitter in einem gueltigen Bereich liegt...
- long nMinPos = SPLIT_MARGIN;
- long nMaxPos = aSz.Height() - SPLIT_MARGIN;
-
- long nVSplitPos = aVSplitter.GetSplitPosPixel();
- long nHSplitPos = aHSplitter.GetSplitPosPixel();
- if ( !bVSplitted )
- {
- // Wenn noch nie gesplitted wurde, Verhaeltniss = 3 : 4
- nVSplitPos = aSz.Height() * 3 / 4;
- aVSplitter.SetSplitPosPixel( nVSplitPos );
- }
- if ( !bHSplitted )
- {
- // Wenn noch nie gesplitted wurde, Verhaeltniss = 2 : 3
- nHSplitPos = aSz.Width() * 2 / 3;
- aHSplitter.SetSplitPosPixel( nHSplitPos );
- }
- if ( ( nVSplitPos < nMinPos ) || ( nVSplitPos > nMaxPos ) )
- nVSplitPos = ( nVSplitPos < nMinPos ) ? 0 : ( aSz.Height() - SPLIT_HEIGHT );
-
- Size aXEWSz;
- aXEWSz.Width() = aSz.Width();
- aXEWSz.Height() = nVSplitPos + 1;
- if ( m_pModulWindow )
- {
- DBG_CHKOBJ( m_pModulWindow, ModulWindow, 0 );
- m_pModulWindow->SetPosSizePixel( Point( 0, 0 ), aXEWSz );
- }
-
- aVSplitter.SetDragRectPixel( Rectangle( Point( 0, 0 ), Size( aSz.Width(), aSz.Height() ) ) );
- aVSplitter.SetPosPixel( Point( 0, nVSplitPos ) );
- aVSplitter.SetSizePixel( Size( aSz.Width(), SPLIT_HEIGHT ) );
-
- aHSplitter.SetDragRectPixel( Rectangle( Point( 0, nVSplitPos+SPLIT_HEIGHT ), Size( aSz.Width(), aSz.Height() - nVSplitPos - SPLIT_HEIGHT ) ) );
- aHSplitter.SetPosPixel( Point( nHSplitPos, nVSplitPos ) );
- aHSplitter.SetSizePixel( Size( SPLIT_HEIGHT, aSz.Height() - nVSplitPos ) );
-
- Size aWWSz;
- Point aWWPos( 0, nVSplitPos+SPLIT_HEIGHT );
- aWWSz.Width() = nHSplitPos;
- aWWSz.Height() = aSz.Height() - aWWPos.Y();
- if ( !aWatchWindow.IsFloatingMode() )
- aWatchWindow.SetPosSizePixel( aWWPos, aWWSz );
-
- Size aSWSz;
- Point aSWPos( nHSplitPos+SPLIT_HEIGHT, nVSplitPos+SPLIT_HEIGHT );
- aSWSz.Width() = aSz.Width() - aSWPos.X();
- aSWSz.Height() = aSz.Height() - aSWPos.Y();
- if ( !aStackWindow.IsFloatingMode() )
- aStackWindow.SetPosSizePixel( aSWPos, aSWSz );
-
- if ( aStackWindow.IsFloatingMode() && aWatchWindow.IsFloatingMode() )
- aHSplitter.Hide();
- else
- aHSplitter.Show();
-
- long nHDoubleClickSplitPosX = aSz.Width()-aHSplitter.GetSizePixel().Width();
- if ( aHSplitter.GetSplitPosPixel() < nHDoubleClickSplitPosX )
- aHSplitter.SetLastSplitPosPixel( nHDoubleClickSplitPosX );
-
-
- long nHDoubleClickSplitPosY = aSz.Height()-aVSplitter.GetSizePixel().Height();
- if ( aVSplitter.GetSplitPosPixel() < nHDoubleClickSplitPosY )
- aVSplitter.SetLastSplitPosPixel( nHDoubleClickSplitPosY );
-}
-
-IMPL_LINK( ModulWindowLayout, SplitHdl, Splitter *, pSplitter )
-{
- if ( pSplitter == &aVSplitter )
- bVSplitted = sal_True;
- else
- bHSplitted = sal_True;
-
- ArrangeWindows();
- return 0;
-}
-
-sal_Bool ModulWindowLayout::IsToBeDocked( DockingWindow* pDockingWindow, const Point& rPos, Rectangle& rRect )
-{
- // prueffen, ob als Dock oder als Child:
- // TRUE: Floating
- // FALSE: Child
- Point aPosInMe = ScreenToOutputPixel( rPos );
- Size aSz = GetOutputSizePixel();
- if ( ( aPosInMe.X() > 0 ) && ( aPosInMe.X() < aSz.Width() ) &&
- ( aPosInMe.Y() > 0 ) && ( aPosInMe.Y() < aSz.Height() ) )
- {
- long nVSplitPos = aVSplitter.GetSplitPosPixel();
- long nHSplitPos = aHSplitter.GetSplitPosPixel();
- if ( pDockingWindow == &aWatchWindow )
- {
- if ( ( aPosInMe.Y() > nVSplitPos ) && ( aPosInMe.X() < nHSplitPos ) )
- {
- rRect.SetSize( Size( nHSplitPos, aSz.Height() - nVSplitPos ) );
- rRect.SetPos( OutputToScreenPixel( Point( 0, nVSplitPos ) ) );
- return sal_True;
- }
- }
- if ( pDockingWindow == &aStackWindow )
- {
- if ( ( aPosInMe.Y() > nVSplitPos ) && ( aPosInMe.X() > nHSplitPos ) )
- {
- rRect.SetSize( Size( aSz.Width() - nHSplitPos, aSz.Height() - nVSplitPos ) );
- rRect.SetPos( OutputToScreenPixel( Point( nHSplitPos, nVSplitPos ) ) );
- return sal_True;
- }
- }
- }
- return sal_False;
-}
-
-void ModulWindowLayout::DockaWindow( DockingWindow* pDockingWindow )
-{
- if ( pDockingWindow == &aWatchWindow )
- {
- // evtl. Sonderbehandlung...
- ArrangeWindows();
- }
- else if ( pDockingWindow == &aStackWindow )
- {
- // evtl. Sonderbehandlung...
- ArrangeWindows();
- }
-#if OSL_DEBUG_LEVEL > 0
- else
- OSL_FAIL( "Wer will sich denn hier andocken ?" );
-#endif
-}
-
-void ModulWindowLayout::SetModulWindow( ModulWindow* pModWin )
-{
- m_pModulWindow = pModWin;
- ArrangeWindows();
-}
-
-// virtual
-void ModulWindowLayout::DataChanged(DataChangedEvent const & rDCEvt)
-{
- Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DATACHANGED_SETTINGS
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
- {
- bool bInvalidate = false;
- Color aColor(GetSettings().GetStyleSettings().GetWindowColor());
- if (aColor
- != rDCEvt.GetOldSettings()->GetStyleSettings().GetWindowColor())
- {
- SetBackground(Wallpaper(aColor));
- bInvalidate = true;
- }
- aColor = GetSettings().GetStyleSettings().GetWindowTextColor();
- if (aColor != rDCEvt.GetOldSettings()->
- GetStyleSettings().GetWindowTextColor())
- {
- Font aFont(GetFont());
- aFont.SetColor(aColor);
- SetFont(aFont);
- bInvalidate = true;
- }
- if (bInvalidate)
- Invalidate();
- aColor = GetSettings().GetStyleSettings().GetFieldTextColor();
- if (aColor != m_aSyntaxColors[TT_UNKNOWN])
- {
- m_aSyntaxColors[TT_UNKNOWN] = aColor;
- m_aSyntaxColors[TT_WHITESPACE] = aColor;
- m_aSyntaxColors[TT_EOL] = aColor;
- updateSyntaxHighlighting();
- }
- }
-}
-
-// virtual
-void ModulWindowLayout::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
-{
- {
- Color aColor(m_aColorConfig.GetColorValue(svtools::BASICIDENTIFIER).
- nColor);
- bool bChanged = aColor != m_aSyntaxColors[TT_IDENTIFIER];
- m_aSyntaxColors[TT_IDENTIFIER] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICNUMBER).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_NUMBER])
- bChanged = true;
- m_aSyntaxColors[TT_NUMBER] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICSTRING).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_STRING])
- bChanged = true;
- m_aSyntaxColors[TT_STRING] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICCOMMENT).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_COMMENT])
- bChanged = true;
- m_aSyntaxColors[TT_COMMENT] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICERROR).nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_ERROR])
- bChanged = true;
- m_aSyntaxColors[TT_ERROR] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICOPERATOR).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_OPERATOR])
- bChanged = true;
- m_aSyntaxColors[TT_OPERATOR] = aColor;
- aColor = Color(m_aColorConfig.GetColorValue(svtools::BASICKEYWORD).
- nColor);
- if (bChanged || aColor != m_aSyntaxColors[TT_KEYWORDS])
- bChanged = true;
- m_aSyntaxColors[TT_KEYWORDS] = aColor;
- if (bChanged)
- updateSyntaxHighlighting();
- }
-}
-
-void ModulWindowLayout::updateSyntaxHighlighting()
-{
- if (m_pModulWindow != 0)
- {
- EditorWindow & rEditor = m_pModulWindow->GetEditorWindow();
- sal_uLong nCount = rEditor.GetEditEngine()->GetParagraphCount();
- for (sal_uLong i = 0; i < nCount; ++i)
- rEditor.DoDelayedSyntaxHighlight(i);
- }
-}
-
-Image ModulWindowLayout::getImage(sal_uInt16 nId) const
-{
- return m_aImagesNormal.GetImage(nId);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2.hrc b/basctl/source/basicide/baside2.hrc
deleted file mode 100644
index 0da8274cc..000000000
--- a/basctl/source/basicide/baside2.hrc
+++ /dev/null
@@ -1,50 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASIDE2_HRC
-#define _BASIDE2_HRC
-
-#include <basidesh.hrc>
-
-// Diese Dateien enthaelt nur die lokalen ID's.
-
-// RID_POPUP_BRKPROPS
-#define RID_BRKPROPS 1
-#define RID_ACTIV 2
-
-// RID_POPUP_BRKDLG
-#define RID_BRKDLG 1
-
-// RID_POPUP_TABBAR
-#define RID_INSERT 1
-
-// ModulWindowLayout
-#define IMGID_BRKENABLED ( SID_BASICIDE_IMAGESTART + 20 )
-#define IMGID_BRKDISABLED ( SID_BASICIDE_IMAGESTART + 21 )
-#define IMGID_STEPMARKER ( SID_BASICIDE_IMAGESTART + 22 )
-#define IMGID_ERRORMARKER ( SID_BASICIDE_IMAGESTART + 23 )
-
-#endif // _BASIDE2_HRC
diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
deleted file mode 100644
index a41bb3e0c..000000000
--- a/basctl/source/basicide/baside2.hxx
+++ /dev/null
@@ -1,476 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BASIDE2_HXX
-#define _BASIDE2_HXX
-
-#include <svheader.hxx>
-
-#include <bastypes.hxx>
-#include <bastype3.hxx>
-#include <basidesh.hxx>
-
-class ExtTextEngine;
-class ExtTextView;
-class SvxSearchItem;
-#include <svtools/svtabbx.hxx>
-#include <svtools/headbar.hxx>
-
-#include <vcl/button.hxx>
-#include <basic/sbmod.hxx>
-#include <vcl/split.hxx>
-#include "svl/lstner.hxx"
-#include <svtools/colorcfg.hxx>
-
-#include <sfx2/progress.hxx>
-#include <svtools/syntaxhighlight.hxx>
-
-DBG_NAMEEX( ModulWindow )
-
-#define MARKER_NOMARKER 0xFFFF
-
-namespace utl
-{
- class SourceViewConfig;
-}
-
-// #108672 Helper functions to get/set text in TextEngine
-// using the stream interface (get/setText() only supports
-// tools Strings limited to 64K).
-::rtl::OUString getTextEngineText( ExtTextEngine* pEngine );
-void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr );
-
-class ProgressInfo : public SfxProgress
-{
-private:
- sal_uLong nCurState;
-
-public:
-
- inline ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange );
- inline void StepProgress();
-};
-
-inline ProgressInfo::ProgressInfo( SfxObjectShell* pObjSh, const String& rText, sal_uLong nRange )
- : SfxProgress( pObjSh, rText, nRange )
-{
- nCurState = 0;
-}
-
-inline void ProgressInfo::StepProgress()
-{
- SetState( ++nCurState );
-}
-
-
-namespace svt {
-class SourceViewConfig;
-}
-
-class EditorWindow : public Window, public SfxListener, public utl::ConfigurationListener
-{
-private:
- ExtTextView* pEditView;
- ExtTextEngine* pEditEngine;
-
- utl::SourceViewConfig* pSourceViewConfig;
-
- long nCurTextWidth;
-
- SyntaxHighlighter aHighlighter;
- Timer aSyntaxIdleTimer;
- Table aSyntaxLineTable;
- DECL_LINK( SyntaxTimerHdl, Timer * );
- ProgressInfo* pProgress;
- ModulWindow* pModulWindow;
-
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
- using Window::Notify;
- virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
-
- void ImpDoHighlight( sal_uLong nLineOff );
- void ImplSetFont();
-
- sal_Bool bHighlightning;
- sal_Bool bDoSyntaxHighlight;
- sal_Bool bDelayHighlight;
-
- virtual
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >
- GetComponentInterface(sal_Bool bCreate = sal_True);
-
-protected:
- virtual void Paint( const Rectangle& );
- virtual void Resize();
- virtual void KeyInput( const KeyEvent& rKeyEvt );
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void Command( const CommandEvent& rCEvt );
- virtual void LoseFocus();
- virtual void RequestHelp( const HelpEvent& rHEvt );
- virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
-
- void DoSyntaxHighlight( sal_uLong nPara );
- String GetWordAtCursor();
- sal_Bool ImpCanModify();
-
-public:
- EditorWindow( Window* pParent );
- ~EditorWindow();
-
- ExtTextEngine* GetEditEngine() const { return (ExtTextEngine*)pEditEngine; }
- ExtTextView* GetEditView() const { return pEditView; }
- ProgressInfo* GetProgress() const { return pProgress; }
-
- void CreateProgress( const String& rText, sal_uLong nRange );
- void DestroyProgress();
-
- void ParagraphInsertedDeleted( sal_uLong nNewPara, sal_Bool bInserted );
- void DoDelayedSyntaxHighlight( sal_uLong nPara );
-
- void CreateEditEngine();
- void SetScrollBarRanges();
- void InitScrollBars();
- void SetModulWindow( ModulWindow* pWin )
- { pModulWindow = pWin; }
-
- void ForceSyntaxTimeout();
- sal_Bool SetSourceInBasic( sal_Bool bQuiet = sal_True );
-
- sal_Bool CanModify() { return ImpCanModify(); }
-};
-
-
-class BreakPointWindow : public Window
-{
-private:
- long nCurYOffset;
- sal_uInt16 nMarkerPos;
- BreakPointList aBreakPointList;
- ModulWindow* pModulWindow;
- sal_Bool bErrorMarker;
-
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
- void setBackgroundColor(Color aColor);
-
-protected:
- virtual void Paint( const Rectangle& );
- virtual void Resize();
- BreakPoint* FindBreakPoint( const Point& rMousePos );
- void ShowMarker( sal_Bool bShow );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Command( const CommandEvent& rCEvt );
-
- sal_Bool SyncYOffset();
-
-public:
- BreakPointWindow( Window* pParent );
- ~BreakPointWindow();
-
- void SetModulWindow( ModulWindow* pWin )
- { pModulWindow = pWin; }
-
- void SetMarkerPos( sal_uInt16 nLine, sal_Bool bErrorMarker = sal_False );
-
- void DoScroll( long nHorzScroll, long nVertScroll );
- long& GetCurYOffset() { return nCurYOffset; }
- BreakPointList& GetBreakPoints() { return aBreakPointList; }
-};
-
-
-class WatchTreeListBox : public SvHeaderTabListBox
-{
- String aEditingRes;
-
-protected:
- virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel );
- virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
-
- sal_Bool ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& rResult );
- SbxBase* ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArrayElement );
-
-public:
- WatchTreeListBox( Window* pParent, WinBits nWinBits );
- ~WatchTreeListBox();
-
- void RequestingChilds( SvLBoxEntry * pParent );
- void UpdateWatches( bool bBasicStopped = false );
-
- using SvTabListBox::SetTabs;
- virtual void SetTabs();
-};
-
-
-
-class WatchWindow : public BasicDockingWindow
-{
-private:
- String aWatchStr;
- ExtendedEdit aXEdit;
- ImageButton aRemoveWatchButton;
- WatchTreeListBox aTreeListBox;
- HeaderBar aHeaderBar;
-
-protected:
- virtual void Resize();
- virtual void Paint( const Rectangle& rRect );
-
- DECL_LINK( ButtonHdl, ImageButton * );
- DECL_LINK( TreeListHdl, SvTreeListBox * );
- DECL_LINK( implEndDragHdl, HeaderBar * );
- DECL_LINK( EditAccHdl, Accelerator * );
-
-
-public:
- WatchWindow( Window* pParent );
- ~WatchWindow();
-
- void AddWatch( const String& rVName );
- sal_Bool RemoveSelectedWatch();
- void UpdateWatches( bool bBasicStopped = false );
-
- WatchTreeListBox& GetWatchTreeListBox() { return aTreeListBox; }
-};
-
-
-class StackWindow : public BasicDockingWindow
-{
-private:
- SvTreeListBox aTreeListBox;
- String aStackStr;
-
-protected:
- virtual void Resize();
- virtual void Paint( const Rectangle& rRect );
- DECL_LINK( ButtonHdl, ImageButton * );
-
-public:
- StackWindow( Window* pParent );
- ~StackWindow();
-
- void UpdateCalls();
-};
-
-
-class ComplexEditorWindow : public Window
-{
-private:
- BreakPointWindow aBrkWindow;
- EditorWindow aEdtWindow;
- ScrollBar aEWVScrollBar;
-
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
-protected:
- virtual void Resize();
- DECL_LINK( ScrollHdl, ScrollBar * );
-
-public:
- ComplexEditorWindow( ModulWindow* pParent );
-
- BreakPointWindow& GetBrkWindow() { return aBrkWindow; }
- EditorWindow& GetEdtWindow() { return aEdtWindow; }
- ScrollBar& GetEWVScrollBar() { return aEWVScrollBar; }
-};
-
-
-#define SYNTAX_COLOR_MAX 5
-
-class ModulWindow: public IDEBaseWindow
-{
- friend class BasicIDEShell;
-
-private:
- StarBASICRef xBasic;
- short nValid;
- ComplexEditorWindow aXEditorWindow;
- BasicStatus aStatus;
- SbModuleRef xModule;
- ModulWindowLayout* pLayout;
- String aCurPath;
- ::rtl::OUString m_aModule;
-
- DECL_LINK( BasicErrorHdl, StarBASIC * );
- long BasicBreakHdl( StarBASIC* pBasic );
-
- void CheckCompileBasic();
- sal_Bool BasicExecute();
-
- void GoOnTop();
- void AssertValidEditEngine();
-
- sal_Int32 FormatAndPrint( Printer* pPrinter, sal_Int32 nPage = -1 );
- SbModuleRef XModule();
-protected:
- virtual void Resize();
- virtual void GetFocus();
- virtual void Paint( const Rectangle& );
- virtual void Deactivating();
- virtual void DoInit();
- virtual void DoScroll( ScrollBar* pCurScrollBar );
-
-public:
- TYPEINFO();
-
- ModulWindow( ModulWindowLayout* pParent, const ScriptDocument& rDocument, String aLibName,
- String aName, ::rtl::OUString& aModule );
-
- ~ModulWindow();
-
- virtual void ExecuteCommand( SfxRequest& rReq );
- virtual void GetState( SfxItemSet& );
- virtual void StoreData();
- virtual void UpdateData();
- virtual sal_Bool CanClose();
- // return number of pages to be printed
- virtual sal_Int32 countPages( Printer* pPrinter );
- // print page
- virtual void printPage( sal_Int32 nPage, Printer* pPrinter );
- virtual String GetTitle();
- virtual BasicEntryDescriptor CreateEntryDescriptor();
- virtual sal_Bool AllowUndo();
- virtual void SetReadOnly( sal_Bool bReadOnly );
- virtual sal_Bool IsReadOnly();
-
- StarBASIC* GetBasic() { XModule(); return xBasic; }
-
- SbModule* GetSbModule() { return xModule; }
- void SetSbModule( SbModule* pModule ) { xModule = pModule; }
- String GetSbModuleName();
-
- sal_Bool CompileBasic();
- sal_Bool BasicRun();
- sal_Bool BasicStepOver();
- sal_Bool BasicStepInto();
- sal_Bool BasicStepOut();
- void BasicStop();
- sal_Bool BasicToggleBreakPoint();
- void BasicToggleBreakPointEnabled();
- void ManageBreakPoints();
- void UpdateBreakPoint( const BreakPoint& rBrk );
- void BasicAddWatch();
- void BasicRemoveWatch();
-
- sal_Bool LoadBasic();
- sal_Bool SaveBasicSource();
- sal_Bool ImportDialog();
-
- void EditMacro( const String& rMacroName );
-
- sal_Bool ToggleBreakPoint( sal_uLong nLine );
-
- BasicStatus& GetBasicStatus() { return aStatus; }
-
- virtual sal_Bool IsModified();
- virtual sal_Bool IsPasteAllowed();
-
- void FrameWindowMoved();
- void ShowCursor( sal_Bool bOn );
-
- virtual sal_uInt16 GetSearchOptions();
- sal_uInt16 StartSearchAndReplace( const SvxSearchItem& rSearchItem, sal_Bool bFromStart = sal_False );
-
- virtual Window* GetLayoutWindow();
-
- EditorWindow& GetEditorWindow() { return aXEditorWindow.GetEdtWindow(); }
- BreakPointWindow& GetBreakPointWindow() { return aXEditorWindow.GetBrkWindow(); }
- ScrollBar& GetEditVScrollBar() { return aXEditorWindow.GetEWVScrollBar(); }
- ExtTextEngine* GetEditEngine() { return GetEditorWindow().GetEditEngine(); }
- ExtTextView* GetEditView() { return GetEditorWindow().GetEditView(); }
- BreakPointList& GetBreakPoints() { return GetBreakPointWindow().GetBreakPoints(); }
- ModulWindowLayout* GetLayout() const { return pLayout; }
-
- virtual void BasicStarted();
- virtual void BasicStopped();
-
- virtual ::svl::IUndoManager*
- GetUndoManager();
-
- const ::rtl::OUString& GetModule() const { return m_aModule; }
- void SetModule( const ::rtl::OUString& aModule ) { m_aModule = aModule; }
-};
-
-class ModulWindowLayout: public Window, public utl::ConfigurationListener
-{
-private:
-
- Splitter aVSplitter;
- Splitter aHSplitter;
-
- WatchWindow aWatchWindow;
- StackWindow aStackWindow;
-
- sal_Bool bVSplitted;
- sal_Bool bHSplitted;
-
- ModulWindow * m_pModulWindow;
-
- Color m_aSyntaxColors[TT_KEYWORDS + 1];
- svtools::ColorConfig m_aColorConfig;
-
- ImageList m_aImagesNormal;
-
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
- virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 );
-
- void updateSyntaxHighlighting();
-
- DECL_LINK( SplitHdl, Splitter * );
-
- void ArrangeWindows();
-
-protected:
- virtual void Resize();
- virtual void Paint( const Rectangle& rRect );
-
-public:
- ModulWindowLayout( Window* pParent );
- ~ModulWindowLayout();
-
- void DockaWindow( DockingWindow* pDockingWin );
- sal_Bool IsToBeDocked( DockingWindow* pDockingWin, const Point& rPos, Rectangle& rRect );
-
- void SetModulWindow( ModulWindow* pModWin );
- ModulWindow* GetModulWindow() const { return m_pModulWindow; }
-
- WatchWindow& GetWatchWindow() { return aWatchWindow; }
- StackWindow& GetStackWindow() { return aStackWindow; }
-
- Image getImage(sal_uInt16 nId) const;
-
- inline Color const & getSyntaxColor(TokenTypes eType) const
- { return m_aSyntaxColors[eType]; }
-};
-
-#endif // _BASIDE2_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
deleted file mode 100644
index fde0fc984..000000000
--- a/basctl/source/basicide/baside2b.cxx
+++ /dev/null
@@ -1,2266 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <vector>
-#define _BASIC_TEXTPORTIONS
-#include <basic/sbdef.hxx>
-#include <ide_pch.hxx>
-
-
-#include <tools/urlobj.hxx>
-#include <unotools/charclass.hxx>
-#include <svl/urihelper.hxx>
-#include <basic/sbx.hxx>
-#include <vcl/sound.hxx>
-#include <svtools/xtextedt.hxx>
-#include <svtools/txtattr.hxx>
-#include <svtools/textwindowpeer.hxx>
-#include <basic/sbuno.hxx>
-
-#include <helpid.hrc>
-#include <baside2.hrc>
-#include <baside2.hxx>
-#include <brkdlg.hxx>
-#include <objdlg.hxx>
-#include <basobj.hxx>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <vcl/taskpanelist.hxx>
-#include <vcl/help.hxx>
-
-#include <unotools/sourceviewconfig.hxx>
-
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <comphelper/processfactory.hxx>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-long nVirtToolBoxHeight; // inited in WatchWindow, used in Stackwindow
-long nHeaderBarHeight;
-
-#define SCROLL_LINE 12
-#define SCROLL_PAGE 60
-#define DWBORDER 3
-
-static const char cSuffixes[] = "%&!#@$";
-
-MapUnit eEditMapUnit = MAP_100TH_MM;
-
-
-/**
- * Helper functions to get/set text in TextEngine using
- * the stream interface.
- *
- * get/setText() only supports tools Strings limited to 64K).
- */
-::rtl::OUString getTextEngineText( ExtTextEngine* pEngine )
-{
- SvMemoryStream aMemStream;
- aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 );
- aMemStream.SetLineDelimiter( LINEEND_LF );
- pEngine->Write( aMemStream );
- sal_uLong nSize = aMemStream.Tell();
- ::rtl::OUString aText( (const sal_Char*)aMemStream.GetData(),
- nSize, RTL_TEXTENCODING_UTF8 );
- return aText;
-}
-
-void setTextEngineText( ExtTextEngine* pEngine, const ::rtl::OUString aStr )
-{
- pEngine->SetText( String() );
- ::rtl::OString aUTF8Str = ::rtl::OUStringToOString( aStr, RTL_TEXTENCODING_UTF8 );
- SvMemoryStream aMemStream( (void*)aUTF8Str.getStr(), aUTF8Str.getLength(),
- STREAM_READ | STREAM_SEEK_TO_BEGIN );
- aMemStream.SetStreamCharSet( RTL_TEXTENCODING_UTF8 );
- aMemStream.SetLineDelimiter( LINEEND_LF );
- pEngine->Read( aMemStream );
-}
-
-void lcl_DrawIDEWindowFrame( DockingWindow* pWin )
-{
- if ( pWin->IsFloatingMode() )
- return;
-
- Size aSz = pWin->GetOutputSizePixel();
- const Color aOldLineColor( pWin->GetLineColor() );
- pWin->SetLineColor( Color( COL_WHITE ) );
- // White line on top
- pWin->DrawLine( Point( 0, 0 ), Point( aSz.Width(), 0 ) );
- // Black line at bottom
- pWin->SetLineColor( Color( COL_BLACK ) );
- pWin->DrawLine( Point( 0, aSz.Height() - 1 ),
- Point( aSz.Width(), aSz.Height() - 1 ) );
- pWin->SetLineColor( aOldLineColor );
-}
-
-void lcl_SeparateNameAndIndex( const String& rVName, String& rVar, String& rIndex )
-{
- rVar = rVName;
- rIndex.Erase();
- sal_uInt16 nIndexStart = rVar.Search( '(' );
- if ( nIndexStart != STRING_NOTFOUND )
- {
- sal_uInt16 nIndexEnd = rVar.Search( ')', nIndexStart );
- if ( nIndexStart != STRING_NOTFOUND )
- {
- rIndex = rVar.Copy( nIndexStart+1, nIndexEnd-nIndexStart-1 );
- rVar.Erase( nIndexStart );
- rVar.EraseTrailingChars();
- rIndex.EraseLeadingChars();
- rIndex.EraseTrailingChars();
- }
- }
-
- if ( rVar.Len() )
- {
- sal_uInt16 nLastChar = rVar.Len()-1;
- if ( strchr( cSuffixes, rVar.GetChar( nLastChar ) ) )
- rVar.Erase( nLastChar, 1 );
- }
- if ( rIndex.Len() )
- {
- sal_uInt16 nLastChar = rIndex.Len()-1;
- if ( strchr( cSuffixes, rIndex.GetChar( nLastChar ) ) )
- rIndex.Erase( nLastChar, 1 );
- }
-}
-
-
-EditorWindow::EditorWindow( Window* pParent ) :
- Window( pParent, WB_BORDER )
-{
- bDoSyntaxHighlight = sal_True;
- bDelayHighlight = sal_True;
- pModulWindow = 0;
- pEditView = 0;
- pEditEngine = 0;
- pSourceViewConfig = new utl::SourceViewConfig;
- bHighlightning = sal_False;
- pProgress = 0;
- nCurTextWidth = 0;
- SetBackground(
- Wallpaper(GetSettings().GetStyleSettings().GetFieldColor()));
- SetPointer( Pointer( POINTER_TEXT ) );
-
- SetHelpId( HID_BASICIDE_EDITORWINDOW );
- pSourceViewConfig->AddListener(this);
-}
-
-
-
-EditorWindow::~EditorWindow()
-{
- pSourceViewConfig->RemoveListener(this);
- delete pSourceViewConfig;
-
- aSyntaxIdleTimer.Stop();
-
- if ( pEditEngine )
- {
- EndListening( *pEditEngine );
- pEditEngine->RemoveView( pEditView );
- delete pEditView;
- delete pEditEngine;
- }
-}
-
-String EditorWindow::GetWordAtCursor()
-{
- String aWord;
-
- if ( pEditView )
- {
- TextEngine* pTextEngine = pEditView->GetTextEngine();
- if ( pTextEngine )
- {
- // check first, if the cursor is at a help URL
- const TextSelection& rSelection = pEditView->GetSelection();
- const TextPaM& rSelStart = rSelection.GetStart();
- const TextPaM& rSelEnd = rSelection.GetEnd();
- String aText = pTextEngine->GetText( rSelEnd.GetPara() );
- CharClass aClass( ::comphelper::getProcessServiceFactory() , Application::GetSettings().GetLocale() );
- xub_StrLen nSelStart = static_cast< xub_StrLen >( rSelStart.GetIndex() );
- xub_StrLen nSelEnd = static_cast< xub_StrLen >( rSelEnd.GetIndex() );
- xub_StrLen nLength = static_cast< xub_StrLen >( aText.Len() );
- xub_StrLen nStart = 0;
- xub_StrLen nEnd = nLength;
- while ( nStart < nLength )
- {
- String aURL( URIHelper::FindFirstURLInText( aText, nStart, nEnd, aClass ) );
- INetURLObject aURLObj( aURL );
- if ( aURLObj.GetProtocol() == INET_PROT_VND_SUN_STAR_HELP
- && nSelStart >= nStart && nSelStart <= nEnd && nSelEnd >= nStart && nSelEnd <= nEnd )
- {
- aWord = aURL;
- break;
- }
- nStart = nEnd;
- nEnd = nLength;
- }
-
- // Not the selected range, but at the CursorPosition,
- // if a word is partially selected.
- if ( !aWord.Len() )
- aWord = pTextEngine->GetWord( rSelEnd );
-
- // Can be empty when full word selected, as Cursor behing it
- if ( !aWord.Len() && pEditView->HasSelection() )
- aWord = pTextEngine->GetWord( rSelStart );
- }
- }
-
- return aWord;
-}
-
-void EditorWindow::RequestHelp( const HelpEvent& rHEvt )
-{
- sal_Bool bDone = sal_False;
-
- // Should have been activated at some point
- if ( pEditEngine )
- {
- if ( rHEvt.GetMode() & HELPMODE_CONTEXT )
- {
- String aKeyword = GetWordAtCursor();
- Application::GetHelp()->SearchKeyword( aKeyword );
- bDone = sal_True;
- }
- else if ( rHEvt.GetMode() & HELPMODE_QUICK )
- {
- String aHelpText;
- Point aTopLeft;
- if ( StarBASIC::IsRunning() )
- {
- Point aWindowPos = rHEvt.GetMousePosPixel();
- aWindowPos = ScreenToOutputPixel( aWindowPos );
- Point aDocPos = GetEditView()->GetDocPos( aWindowPos );
- TextPaM aCursor = GetEditView()->GetTextEngine()->GetPaM( aDocPos, sal_False );
- TextPaM aStartOfWord;
- String aWord = GetEditView()->GetTextEngine()->GetWord( aCursor, &aStartOfWord );
- if ( aWord.Len() && !ByteString( aWord, RTL_TEXTENCODING_UTF8 ).IsNumericAscii() )
- {
- sal_uInt16 nLastChar =aWord.Len()-1;
- if ( strchr( cSuffixes, aWord.GetChar( nLastChar ) ) )
- aWord.Erase( nLastChar, 1 );
- SbxBase* pSBX = StarBASIC::FindSBXInCurrentScope( aWord );
- if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) )
- {
- SbxVariable* pVar = (SbxVariable*)pSBX;
- SbxDataType eType = pVar->GetType();
- if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT )
- // Kann zu Absturz, z.B. bei Selections-Objekt fuehren
- // Type == Object heisst nicht, dass pVar == Object!
- ; // aHelpText = ((SbxObject*)pVar)->GetClassName();
- else if ( eType & SbxARRAY )
- ; // aHelpText = "{...}";
- else if ( (sal_uInt8)eType != (sal_uInt8)SbxEMPTY )
- {
- aHelpText = pVar->GetName();
- if ( !aHelpText.Len() ) // Bei Uebergabeparametern wird der Name nicht kopiert
- aHelpText = aWord;
- aHelpText += '=';
- aHelpText += pVar->GetString();
- }
- }
- if ( aHelpText.Len() )
- {
- aTopLeft = GetEditView()->GetTextEngine()->PaMtoEditCursor( aStartOfWord ).BottomLeft();
- aTopLeft = GetEditView()->GetWindowPos( aTopLeft );
- aTopLeft.X() += 5;
- aTopLeft.Y() += 5;
- aTopLeft = OutputToScreenPixel( aTopLeft );
- }
- }
- }
- Help::ShowQuickHelp( this, Rectangle( aTopLeft, Size( 1, 1 ) ), aHelpText, QUICKHELP_TOP|QUICKHELP_LEFT);
- bDone = sal_True;
- }
- }
-
- if ( !bDone )
- Window::RequestHelp( rHEvt );
-}
-
-
-void EditorWindow::Resize()
-{
- // ScrollBars, etc. happens in Adjust...
- if ( pEditView )
- {
- long nVisY = pEditView->GetStartDocPos().Y();
-
- pEditView->ShowCursor();
- Size aOutSz( GetOutputSizePixel() );
- long nMaxVisAreaStart = pEditView->GetTextEngine()->GetTextHeight() - aOutSz.Height();
- if ( nMaxVisAreaStart < 0 )
- nMaxVisAreaStart = 0;
- if ( pEditView->GetStartDocPos().Y() > nMaxVisAreaStart )
- {
- Point aStartDocPos( pEditView->GetStartDocPos() );
- aStartDocPos.Y() = nMaxVisAreaStart;
- pEditView->SetStartDocPos( aStartDocPos );
- pEditView->ShowCursor();
- pModulWindow->GetBreakPointWindow().GetCurYOffset() = aStartDocPos.Y();
- }
- InitScrollBars();
- if ( nVisY != pEditView->GetStartDocPos().Y() )
- Invalidate();
- }
-}
-
-
-void EditorWindow::MouseMove( const MouseEvent &rEvt )
-{
- if ( pEditView )
- pEditView->MouseMove( rEvt );
-}
-
-
-void EditorWindow::MouseButtonUp( const MouseEvent &rEvt )
-{
- if ( pEditView )
- {
- pEditView->MouseButtonUp( rEvt );
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- }
-}
-
-void EditorWindow::MouseButtonDown( const MouseEvent &rEvt )
-{
- GrabFocus();
- if ( pEditView )
- {
- pEditView->MouseButtonDown( rEvt );
- }
-}
-
-void EditorWindow::Command( const CommandEvent& rCEvt )
-{
- if ( pEditView )
- {
- pEditView->Command( rCEvt );
- if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) ||
- ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) ||
- ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) )
- {
- HandleScrollCommand( rCEvt, pModulWindow->GetHScrollBar(), &pModulWindow->GetEditVScrollBar() );
- }
- }
-}
-
-sal_Bool EditorWindow::ImpCanModify()
-{
- sal_Bool bCanModify = sal_True;
- if ( StarBASIC::IsRunning() )
- {
- // If in Trace-mode, abort the trace or refuse input
- // Remove markers in the modules in Notify at Basic::Stoped
- if ( QueryBox( 0, WB_OK_CANCEL, String( IDEResId( RID_STR_WILLSTOPPRG ) ) ).Execute() == RET_OK )
- {
- pModulWindow->GetBasicStatus().bIsRunning = sal_False;
- BasicIDE::StopBasic();
- }
- else
- bCanModify = sal_False;
- }
- return bCanModify;
-}
-
-void EditorWindow::KeyInput( const KeyEvent& rKEvt )
-{
- if ( !pEditView ) // Happens in Win95
- return;
-
-#if OSL_DEBUG_LEVEL > 1
- Range aRange = pModulWindow->GetHScrollBar()->GetRange(); (void)aRange;
- long nVisSz = pModulWindow->GetHScrollBar()->GetVisibleSize(); (void)nVisSz;
- long nPapSz = pModulWindow->GetHScrollBar()->GetPageSize(); (void)nPapSz;
- long nLinSz = pModulWindow->GetHScrollBar()->GetLineSize(); (void)nLinSz;
- long nThumb = pModulWindow->GetHScrollBar()->GetThumbPos(); (void)nThumb;
-#endif
- sal_Bool bWasModified = pEditEngine->IsModified();
- // see if there is an accelerator to be processed first
- sal_Bool bDone = SfxViewShell::Current()->KeyInput( rKEvt );
-
- if ( !bDone && ( !TextEngine::DoesKeyChangeText( rKEvt ) || ImpCanModify() ) )
- {
- if ( ( rKEvt.GetKeyCode().GetCode() == KEY_Y ) && rKEvt.GetKeyCode().IsMod1() )
- bDone = sal_True; // CTRL-Y schlucken, damit kein Vorlagenkatalog
- else
- {
- if ( ( rKEvt.GetKeyCode().GetCode() == KEY_TAB ) && !rKEvt.GetKeyCode().IsMod1() &&
- !rKEvt.GetKeyCode().IsMod2() && !GetEditView()->IsReadOnly() )
- {
- TextSelection aSel( pEditView->GetSelection() );
- if ( aSel.GetStart().GetPara() != aSel.GetEnd().GetPara() )
- {
- bDelayHighlight = sal_False;
- if ( !rKEvt.GetKeyCode().IsShift() )
- pEditView->IndentBlock();
- else
- pEditView->UnindentBlock();
- bDelayHighlight = sal_True;
- bDone = sal_True;
- }
- }
- if ( !bDone )
- bDone = pEditView->KeyInput( rKEvt );
- }
- }
- if ( !bDone )
- {
- Window::KeyInput( rKEvt );
- }
- else
- {
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- if ( rKEvt.GetKeyCode().GetGroup() == KEYGROUP_CURSOR )
- pBindings->Update( SID_BASICIDE_STAT_POS );
- if ( !bWasModified && pEditEngine->IsModified() )
- {
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Invalidate( SID_DOC_MODIFIED );
- pBindings->Invalidate( SID_UNDO );
- }
- if ( rKEvt.GetKeyCode().GetCode() == KEY_INSERT )
- pBindings->Invalidate( SID_ATTR_INSERT );
- }
- }
-}
-
-void EditorWindow::Paint( const Rectangle& rRect )
-{
- if ( !pEditEngine ) // We need it now at latest
- CreateEditEngine();
-
- pEditView->Paint( rRect );
-}
-
-void EditorWindow::LoseFocus()
-{
- SetSourceInBasic();
- Window::LoseFocus();
-}
-
-sal_Bool EditorWindow::SetSourceInBasic( sal_Bool bQuiet )
-{
- (void)bQuiet;
-
- sal_Bool bChanged = sal_False;
- if ( pEditEngine && pEditEngine->IsModified()
- && !GetEditView()->IsReadOnly() ) // Added for #i60626, otherwise
- // any read only bug in the text engine could lead to a crash later
- {
- if ( !StarBASIC::IsRunning() ) // Not at runtime!
- {
- ::rtl::OUString aModule = getTextEngineText( pEditEngine );
-
- // update module in basic
-#ifdef DBG_UTIL
- SbModule* pModule = pModulWindow->GetSbModule();
-#endif
- DBG_ASSERT(pModule, "EditorWindow::SetSourceInBasic: No Module found!");
-
- // update module in module window
- pModulWindow->SetModule( aModule );
-
- // update module in library
- ScriptDocument aDocument( pModulWindow->GetDocument() );
- String aLibName = pModulWindow->GetLibName();
- String aName = pModulWindow->GetName();
- OSL_VERIFY( aDocument.updateModule( aLibName, aName, aModule ) );
-
- pEditEngine->SetModified( sal_False );
- BasicIDE::MarkDocumentModified( aDocument );
- bChanged = sal_True;
- }
- }
- return bChanged;
-}
-
-
-// Returns the position of the last character of any of the following
-// EOL char combinations: CR, CR/LF, LF, return -1 if no EOL is found
-sal_Int32 searchEOL( const ::rtl::OUString& rStr, sal_Int32 fromIndex )
-{
- sal_Int32 iRetPos = -1;
-
- sal_Int32 iLF = rStr.indexOf( LINE_SEP, fromIndex );
- if( iLF != -1 )
- {
- iRetPos = iLF;
- }
- else
- {
- iRetPos = rStr.indexOf( LINE_SEP_CR, fromIndex );
- }
- return iRetPos;
-}
-
-
-void EditorWindow::CreateEditEngine()
-{
- if ( pEditEngine )
- return;
-
- pEditEngine = new ExtTextEngine;
- pEditView = new ExtTextView( pEditEngine, this );
- pEditView->SetAutoIndentMode( sal_True );
- pEditEngine->SetUpdateMode( sal_False );
- pEditEngine->InsertView( pEditView );
-
- ImplSetFont();
-
- aSyntaxIdleTimer.SetTimeout( 200 );
- aSyntaxIdleTimer.SetTimeoutHdl( LINK( this, EditorWindow, SyntaxTimerHdl ) );
-
- aHighlighter.initialize( HIGHLIGHT_BASIC );
-
- sal_Bool bWasDoSyntaxHighlight = bDoSyntaxHighlight;
- bDoSyntaxHighlight = sal_False; // Bei grossen Texten zu langsam...
- ::rtl::OUString aOUSource( pModulWindow->GetModule() );
- sal_Int32 nLines = 0;
- sal_Int32 nIndex = -1;
- do
- {
- nLines++;
- nIndex = searchEOL( aOUSource, nIndex+1 );
- }
- while ( nIndex >= 0 );
-
- // nLines*4: SetText+Formatting+DoHighlight+Formatting
- // 1 Formatting koennte eingespart werden, aber dann wartet man
- // bei einem langen Sourcecode noch laenger auf den Text...
- pProgress = new ProgressInfo( IDE_DLL()->GetShell()->GetViewFrame()->GetObjectShell(), String( IDEResId( RID_STR_GENERATESOURCE ) ), nLines*4 );
- setTextEngineText( pEditEngine, aOUSource );
-
- pEditView->SetStartDocPos( Point( 0, 0 ) );
- pEditView->SetSelection( TextSelection() );
- pModulWindow->GetBreakPointWindow().GetCurYOffset() = 0;
- pEditEngine->SetUpdateMode( sal_True );
- Update(); // Es wurde bei UpdateMode = sal_True nur Invalidiert
-
- // Die anderen Fenster auch, damit keine halben Sachen auf dem Bildschirm!
- pModulWindow->GetLayout()->GetWatchWindow().Update();
- pModulWindow->GetLayout()->GetStackWindow().Update();
- pModulWindow->GetBreakPointWindow().Update();
-
- pEditView->ShowCursor( sal_True, sal_True );
-
- StartListening( *pEditEngine );
-
- // Das Syntax-Highlightning legt ein rel. groesse VDev an.
- aSyntaxIdleTimer.Stop();
- bDoSyntaxHighlight = bWasDoSyntaxHighlight;
-
-
- for ( sal_uInt16 nLine = 0; nLine < nLines; nLine++ )
- aSyntaxLineTable.Insert( nLine, (void*)(sal_uInt16)1 );
- ForceSyntaxTimeout();
-
- DELETEZ( pProgress );
-
- pEditView->EraseVirtualDevice();
- pEditEngine->SetModified( sal_False );
- pEditEngine->EnableUndo( sal_True );
-
- InitScrollBars();
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
-
- DBG_ASSERT( pModulWindow->GetBreakPointWindow().GetCurYOffset() == 0, "CreateEditEngine: Brechpunkte verschoben?" );
-
- // set readonly mode for readonly libraries
- ScriptDocument aDocument( pModulWindow->GetDocument() );
- ::rtl::OUString aOULibName( pModulWindow->GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) )
- {
- pModulWindow->SetReadOnly( sal_True );
- }
-
- if ( aDocument.isDocument() && aDocument.isReadOnly() )
- pModulWindow->SetReadOnly( sal_True );
-}
-
-// virtual
-void EditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
-{
- Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DATACHANGED_SETTINGS
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
- {
- Color aColor(GetSettings().GetStyleSettings().GetFieldColor());
- if (aColor
- != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor())
- {
- SetBackground(Wallpaper(aColor));
- Invalidate();
- }
- if (pEditEngine != 0)
- {
- aColor = GetSettings().GetStyleSettings().GetFieldTextColor();
- if (aColor != rDCEvt.GetOldSettings()->
- GetStyleSettings().GetFieldTextColor())
- {
- Font aFont(pEditEngine->GetFont());
- aFont.SetColor(aColor);
- pEditEngine->SetFont(aFont);
- }
- }
- }
-}
-
-void EditorWindow::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint )
-{
- if ( rHint.ISA( TextHint ) )
- {
- const TextHint& rTextHint = (const TextHint&)rHint;
- if( rTextHint.GetId() == TEXT_HINT_VIEWSCROLLED )
- {
- if ( pModulWindow->GetHScrollBar() )
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
- pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
- pModulWindow->GetBreakPointWindow().DoScroll
- ( 0, pModulWindow->GetBreakPointWindow().GetCurYOffset() - pEditView->GetStartDocPos().Y() );
- }
- else if( rTextHint.GetId() == TEXT_HINT_TEXTHEIGHTCHANGED )
- {
- if ( pEditView->GetStartDocPos().Y() )
- {
- long nOutHeight = GetOutputSizePixel().Height();
- long nTextHeight = pEditEngine->GetTextHeight();
- if ( nTextHeight < nOutHeight )
- pEditView->Scroll( 0, pEditView->GetStartDocPos().Y() );
- }
-
- SetScrollBarRanges();
- }
- else if( rTextHint.GetId() == TEXT_HINT_TEXTFORMATTED )
- {
- if ( pModulWindow->GetHScrollBar() )
- {
- sal_uLong nWidth = pEditEngine->CalcTextWidth();
- if ( (long)nWidth != nCurTextWidth )
- {
- nCurTextWidth = nWidth;
- pModulWindow->GetHScrollBar()->SetRange( Range( 0, (long)nCurTextWidth-1) );
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
- }
- }
- long nPrevTextWidth = nCurTextWidth;
- nCurTextWidth = pEditEngine->CalcTextWidth();
- if ( nCurTextWidth != nPrevTextWidth )
- SetScrollBarRanges();
- }
- else if( rTextHint.GetId() == TEXT_HINT_PARAINSERTED )
- {
- ParagraphInsertedDeleted( rTextHint.GetValue(), sal_True );
- DoDelayedSyntaxHighlight( rTextHint.GetValue() );
- }
- else if( rTextHint.GetId() == TEXT_HINT_PARAREMOVED )
- {
- ParagraphInsertedDeleted( rTextHint.GetValue(), sal_False );
- }
- else if( rTextHint.GetId() == TEXT_HINT_PARACONTENTCHANGED )
- {
- DoDelayedSyntaxHighlight( rTextHint.GetValue() );
- }
- }
-}
-
-void EditorWindow::ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 )
-{
- ImplSetFont();
-}
-
-void EditorWindow::SetScrollBarRanges()
-{
- // Extra-Methode, nicht InitScrollBars, da auch fuer EditEngine-Events.
- if ( !pEditEngine )
- return;
-
- if ( pModulWindow->GetHScrollBar() )
- pModulWindow->GetHScrollBar()->SetRange( Range( 0, nCurTextWidth-1 ) );
-
- pModulWindow->GetEditVScrollBar().SetRange( Range( 0, pEditEngine->GetTextHeight()-1 ) );
-}
-
-void EditorWindow::InitScrollBars()
-{
- if ( !pEditEngine )
- return;
-
- SetScrollBarRanges();
- Size aOutSz( GetOutputSizePixel() );
- pModulWindow->GetEditVScrollBar().SetVisibleSize( aOutSz.Height() );
- pModulWindow->GetEditVScrollBar().SetPageSize( aOutSz.Height() * 8 / 10 );
- pModulWindow->GetEditVScrollBar().SetLineSize( GetTextHeight() );
- pModulWindow->GetEditVScrollBar().SetThumbPos( pEditView->GetStartDocPos().Y() );
- pModulWindow->GetEditVScrollBar().Show();
-
- if ( pModulWindow->GetHScrollBar() )
- {
- pModulWindow->GetHScrollBar()->SetVisibleSize( aOutSz.Width() );
- pModulWindow->GetHScrollBar()->SetPageSize( aOutSz.Width() * 8 / 10 );
- pModulWindow->GetHScrollBar()->SetLineSize( GetTextWidth( 'x' ) );
- pModulWindow->GetHScrollBar()->SetThumbPos( pEditView->GetStartDocPos().X() );
- pModulWindow->GetHScrollBar()->Show();
- }
-}
-
-void EditorWindow::ImpDoHighlight( sal_uLong nLine )
-{
- if ( bDoSyntaxHighlight )
- {
- String aLine( pEditEngine->GetText( nLine ) );
- Range aChanges = aHighlighter.notifyChange( nLine, 0, &aLine, 1 );
- if ( aChanges.Len() )
- {
- for ( long n = aChanges.Min() + 1; n <= aChanges.Max(); n++ )
- aSyntaxLineTable.Insert( n, (void*)(sal_uLong)1 );
- aSyntaxIdleTimer.Start();
- }
-
- sal_Bool bWasModified = pEditEngine->IsModified();
- pEditEngine->RemoveAttribs( nLine, sal_True );
- HighlightPortions aPortions;
- aHighlighter.getHighlightPortions( nLine, aLine, aPortions );
-
- for ( size_t i = 0; i < aPortions.size(); i++ )
- {
- HighlightPortion& r = aPortions[i];
- const Color& rColor = ((ModulWindowLayout*)pModulWindow->GetLayoutWindow())->getSyntaxColor(r.tokenType);
- pEditEngine->SetAttrib( TextAttribFontColor( rColor ), nLine, r.nBegin, r.nEnd, sal_True );
- }
-
- // Das Highlighten soll kein Modify setzen
- pEditEngine->SetModified( bWasModified );
- }
-}
-
-void EditorWindow::ImplSetFont()
-{
- if ( pSourceViewConfig )
- {
- String sFontName = pSourceViewConfig->GetFontName();
- if ( !sFontName.Len() )
- {
- Font aTmpFont( OutputDevice::GetDefaultFont( DEFAULTFONT_FIXED, Application::GetSettings().GetUILanguage(), 0 , this ) );
- sFontName = aTmpFont.GetName();
- }
- Size aFontSize( 0, pSourceViewConfig->GetFontHeight() );
- Font aFont( sFontName, aFontSize );
- aFont.SetColor( GetSettings().GetStyleSettings().GetFieldTextColor() );
- SetPointFont( aFont );
- aFont = GetFont();
-
- if ( pModulWindow )
- pModulWindow->GetBreakPointWindow().SetFont( aFont );
-
- if ( pEditEngine )
- {
- sal_Bool bModified = pEditEngine->IsModified();
- pEditEngine->SetFont( aFont );
- pEditEngine->SetModified( bModified );
- }
- }
-}
-
-void EditorWindow::DoSyntaxHighlight( sal_uLong nPara )
-{
- // Durch das DelayedSyntaxHighlight kann es passieren,
- // dass die Zeile nicht mehr existiert!
- if ( nPara < pEditEngine->GetParagraphCount() )
- {
- // leider weis ich nicht, ob genau diese Zeile Modified() ...
- if ( pProgress )
- pProgress->StepProgress();
- ImpDoHighlight( nPara );
- }
-}
-
-void EditorWindow::DoDelayedSyntaxHighlight( sal_uLong nPara )
-{
- // Zeile wird nur in 'Liste' aufgenommen, im TimerHdl abgearbeitet.
- // => Nicht Absaetze manipulieren, waehrend EditEngine formatiert.
- if ( pProgress )
- pProgress->StepProgress();
-
- if ( !bHighlightning && bDoSyntaxHighlight )
- {
- if ( bDelayHighlight )
- {
- aSyntaxLineTable.Insert( nPara, (void*)(sal_uLong)1 );
- aSyntaxIdleTimer.Start();
- }
- else
- DoSyntaxHighlight( nPara );
- }
-}
-
-IMPL_LINK( EditorWindow, SyntaxTimerHdl, Timer *, EMPTYARG )
-{
- DBG_ASSERT( pEditView, "Noch keine View, aber Syntax-Highlight ?!" );
-
- sal_Bool bWasModified = pEditEngine->IsModified();
- // pEditEngine->SetUpdateMode( sal_False );
-
- bHighlightning = sal_True;
- sal_uInt16 nLine;
- void* p = aSyntaxLineTable.First();
- while ( p )
- {
- nLine = (sal_uInt16)aSyntaxLineTable.GetCurKey();
- DoSyntaxHighlight( nLine );
- p = aSyntaxLineTable.Next();
- }
-
- // #i45572#
- if ( pEditView )
- pEditView->ShowCursor( sal_False, sal_True );
-
- pEditEngine->SetModified( bWasModified );
-
- aSyntaxLineTable.Clear();
- bHighlightning = sal_False;
-
- return 0;
-}
-
-void EditorWindow::ParagraphInsertedDeleted( sal_uLong nPara, sal_Bool bInserted )
-{
- if ( pProgress )
- pProgress->StepProgress();
-
- if ( !bInserted && ( nPara == TEXT_PARA_ALL ) )
- {
- pModulWindow->GetBreakPoints().reset();
- pModulWindow->GetBreakPointWindow().Invalidate();
- aHighlighter.initialize( HIGHLIGHT_BASIC );
- }
- else
- {
- // Brechpunkte Aktualisieren...
- // keine Sonderbehandlung fuer EditEngine-CTOR ( Erste-Zeile-Problem ),
- // da in diesem Moment noch keine BreakPoints.
- // +1: Basic-Zeilen beginnen bei 1!
- pModulWindow->GetBreakPoints().AdjustBreakPoints( (sal_uInt16)nPara+1, bInserted );
-
- // Im BreakPointWindow invalidieren...
- long nLineHeight = GetTextHeight();
- Size aSz = pModulWindow->GetBreakPointWindow().GetOutputSize();
- Rectangle aInvRec( Point( 0, 0 ), aSz );
- long nY = nPara*nLineHeight - pModulWindow->GetBreakPointWindow().GetCurYOffset();
- aInvRec.Top() = nY;
- pModulWindow->GetBreakPointWindow().Invalidate( aInvRec );
-
- if ( bDoSyntaxHighlight )
- {
- String aDummy;
- aHighlighter.notifyChange( nPara, bInserted ? 1 : (-1), &aDummy, 1 );
- }
- }
-}
-
-void EditorWindow::CreateProgress( const String& rText, sal_uLong nRange )
-{
- DBG_ASSERT( !pProgress, "ProgressInfo existiert schon" );
- pProgress = new ProgressInfo( IDE_DLL()->GetShell()->GetViewFrame()->GetObjectShell(), rText, nRange );
-}
-
-void EditorWindow::DestroyProgress()
-{
- DELETEZ( pProgress );
-}
-
-void EditorWindow::ForceSyntaxTimeout()
-{
- aSyntaxIdleTimer.Stop();
- ((Link&)aSyntaxIdleTimer.GetTimeoutHdl()).Call( &aSyntaxIdleTimer );
-}
-
-
-
-BreakPointWindow::BreakPointWindow( Window* pParent ) :
- Window( pParent, WB_BORDER )
-{
- pModulWindow = 0;
- nCurYOffset = 0;
- setBackgroundColor(GetSettings().GetStyleSettings().GetFieldColor());
- nMarkerPos = MARKER_NOMARKER;
-
- // nCurYOffset merken und nicht von EditEngine holen.
- // Falls in EditEngine autom. gescrollt wurde, wuesste ich sonst nicht,
- // wo ich gerade stehe.
-
- SetHelpId( HID_BASICIDE_BREAKPOINTWINDOW );
-}
-
-
-
-BreakPointWindow::~BreakPointWindow()
-{
-}
-
-
-
-void BreakPointWindow::Resize()
-{
-/// Invalidate();
-}
-
-
-
-void BreakPointWindow::Paint( const Rectangle& )
-{
- if ( SyncYOffset() )
- return;
-
- Size aOutSz( GetOutputSize() );
- long nLineHeight = GetTextHeight();
-
- Image aBrk1(((ModulWindowLayout *) pModulWindow->GetLayoutWindow())->
- getImage(IMGID_BRKENABLED));
- Image aBrk0(((ModulWindowLayout *) pModulWindow->GetLayoutWindow())->
- getImage(IMGID_BRKDISABLED));
- Size aBmpSz( aBrk1.GetSizePixel() );
- aBmpSz = PixelToLogic( aBmpSz );
- Point aBmpOff( 0, 0 );
- aBmpOff.X() = ( aOutSz.Width() - aBmpSz.Width() ) / 2;
- aBmpOff.Y() = ( nLineHeight - aBmpSz.Height() ) / 2;
-
- for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i )
- {
- BreakPoint* pBrk = GetBreakPoints().at( i );
- size_t nLine = pBrk->nLine-1;
- size_t nY = nLine*nLineHeight - nCurYOffset;
- DrawImage( Point( 0, nY ) + aBmpOff, pBrk->bEnabled ? aBrk1 : aBrk0 );
- }
- ShowMarker( sal_True );
-}
-
-
-
-void BreakPointWindow::DoScroll( long nHorzScroll, long nVertScroll )
-{
- nCurYOffset -= nVertScroll;
- Window::Scroll( nHorzScroll, nVertScroll );
-}
-
-
-
-void BreakPointWindow::SetMarkerPos( sal_uInt16 nLine, sal_Bool bError )
-{
- if ( SyncYOffset() )
- Update();
-
- ShowMarker( sal_False ); // Alten wegzeichen...
- nMarkerPos = nLine;
- bErrorMarker = bError;
- ShowMarker( sal_True ); // Neuen zeichnen...
-}
-
-void BreakPointWindow::ShowMarker( sal_Bool bShow )
-{
- if ( nMarkerPos == MARKER_NOMARKER )
- return;
-
- Size aOutSz( GetOutputSize() );
- long nLineHeight = GetTextHeight();
-
- Image aMarker(((ModulWindowLayout*)pModulWindow->GetLayoutWindow())->
- getImage(bErrorMarker
- ? IMGID_ERRORMARKER : IMGID_STEPMARKER));
-
- Size aMarkerSz( aMarker.GetSizePixel() );
- aMarkerSz = PixelToLogic( aMarkerSz );
- Point aMarkerOff( 0, 0 );
- aMarkerOff.X() = ( aOutSz.Width() - aMarkerSz.Width() ) / 2;
- aMarkerOff.Y() = ( nLineHeight - aMarkerSz.Height() ) / 2;
-
- sal_uLong nY = nMarkerPos*nLineHeight - nCurYOffset;
- Point aPos( 0, nY );
- aPos += aMarkerOff;
- if ( bShow )
- DrawImage( aPos, aMarker );
- else
- Invalidate( Rectangle( aPos, aMarkerSz ) );
-}
-
-
-
-
-BreakPoint* BreakPointWindow::FindBreakPoint( const Point& rMousePos )
-{
- size_t nLineHeight = GetTextHeight();
- size_t nYPos = rMousePos.Y() + nCurYOffset;
-
- for ( size_t i = 0, n = GetBreakPoints().size(); i < n ; ++i )
- {
- BreakPoint* pBrk = GetBreakPoints().at( i );
- size_t nLine = pBrk->nLine-1;
- size_t nY = nLine*nLineHeight;
- if ( ( nYPos > nY ) && ( nYPos < ( nY + nLineHeight ) ) )
- return pBrk;
- }
- return 0;
-}
-
-void BreakPointWindow::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if ( rMEvt.GetClicks() == 2 )
- {
- Point aMousePos( PixelToLogic( rMEvt.GetPosPixel() ) );
- long nLineHeight = GetTextHeight();
- long nYPos = aMousePos.Y() + nCurYOffset;
- long nLine = nYPos / nLineHeight + 1;
- pModulWindow->ToggleBreakPoint( (sal_uLong)nLine );
- // vielleicht mal etwas genauer...
- Invalidate();
- }
-}
-
-
-
-void BreakPointWindow::Command( const CommandEvent& rCEvt )
-{
- if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
- {
- Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) );
- Point aEventPos( PixelToLogic( aPos ) );
- BreakPoint* pBrk = rCEvt.IsMouseEvent() ? FindBreakPoint( aEventPos ) : 0;
- if ( pBrk )
- {
- // prueffen, ob Brechpunkt enabled....
- PopupMenu aBrkPropMenu( IDEResId( RID_POPUP_BRKPROPS ) );
- aBrkPropMenu.CheckItem( RID_ACTIV, pBrk->bEnabled );
- switch ( aBrkPropMenu.Execute( this, aPos ) )
- {
- case RID_ACTIV:
- {
- pBrk->bEnabled = pBrk->bEnabled ? sal_False : sal_True;
- pModulWindow->UpdateBreakPoint( *pBrk );
- Invalidate();
- }
- break;
- case RID_BRKPROPS:
- {
- BreakPointDialog aBrkDlg( this, GetBreakPoints() );
- aBrkDlg.SetCurrentBreakPoint( pBrk );
- aBrkDlg.Execute();
- Invalidate();
- }
- break;
- }
- }
- else
- {
- PopupMenu aBrkListMenu( IDEResId( RID_POPUP_BRKDLG ) );
- switch ( aBrkListMenu.Execute( this, aPos ) )
- {
- case RID_BRKDLG:
- {
- BreakPointDialog aBrkDlg( this, GetBreakPoints() );
- aBrkDlg.Execute();
- Invalidate();
- }
- break;
- }
- }
- }
-}
-
-sal_Bool BreakPointWindow::SyncYOffset()
-{
- TextView* pView = pModulWindow->GetEditView();
- if ( pView )
- {
- long nViewYOffset = pView->GetStartDocPos().Y();
- if ( nCurYOffset != nViewYOffset )
- {
- nCurYOffset = nViewYOffset;
- Invalidate();
- return sal_True;
- }
- }
- return sal_False;
-}
-
-// virtual
-void BreakPointWindow::DataChanged(DataChangedEvent const & rDCEvt)
-{
- Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DATACHANGED_SETTINGS
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
- {
- Color aColor(GetSettings().GetStyleSettings().GetFieldColor());
- if (aColor
- != rDCEvt.GetOldSettings()->GetStyleSettings().GetFieldColor())
- {
- setBackgroundColor(aColor);
- Invalidate();
- }
- }
-}
-
-void BreakPointWindow::setBackgroundColor(Color aColor)
-{
- SetBackground(Wallpaper(aColor));
-}
-
-
-const sal_uInt16 ITEM_ID_VARIABLE = 1;
-const sal_uInt16 ITEM_ID_VALUE = 2;
-const sal_uInt16 ITEM_ID_TYPE = 3;
-
-WatchWindow::WatchWindow( Window* pParent ) :
- BasicDockingWindow( pParent ),
- aWatchStr( IDEResId( RID_STR_REMOVEWATCH ) ),
- aXEdit( this, IDEResId( RID_EDT_WATCHEDIT ) ),
- aRemoveWatchButton( this, IDEResId( RID_IMGBTN_REMOVEWATCH ) ),
- aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HASBUTTONS | WB_HASLINES | WB_HSCROLL | WB_TABSTOP
- | WB_HASLINESATROOT | WB_HASBUTTONSATROOT ),
- aHeaderBar( this, WB_BUTTONSTYLE | WB_BORDER )
-{
- aXEdit.SetAccessibleName(String(IDEResId( RID_STR_WATCHNAME)));
- aTreeListBox.SetAccessibleName(String(IDEResId(RID_STR_WATCHNAME)));
-
- nVirtToolBoxHeight = aXEdit.GetSizePixel().Height() + 7;
- nHeaderBarHeight = 16;
-
- aTreeListBox.SetHelpId(HID_BASICIDE_WATCHWINDOW_LIST);
- aTreeListBox.EnableInplaceEditing( sal_True );
- aTreeListBox.SetSelectHdl( LINK( this, WatchWindow, TreeListHdl ) );
- aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight + nHeaderBarHeight ) );
- aTreeListBox.SetHighlightRange( 1, 5 );
-
- Point aPnt( DWBORDER, nVirtToolBoxHeight + 1 );
- aHeaderBar.SetPosPixel( aPnt );
- aHeaderBar.SetEndDragHdl( LINK( this, WatchWindow, implEndDragHdl ) );
-
- long nVarTabWidth = 220;
- long nValueTabWidth = 100;
- long nTypeTabWidth = 1250;
- aHeaderBar.InsertItem( ITEM_ID_VARIABLE, String( IDEResId( RID_STR_WATCHVARIABLE ) ), nVarTabWidth );
- aHeaderBar.InsertItem( ITEM_ID_VALUE, String( IDEResId( RID_STR_WATCHVALUE ) ), nValueTabWidth );
- aHeaderBar.InsertItem( ITEM_ID_TYPE, String( IDEResId( RID_STR_WATCHTYPE ) ), nTypeTabWidth );
-
- long tabs[ 4 ];
- tabs[ 0 ] = 3; // two tabs
- tabs[ 1 ] = 0;
- tabs[ 2 ] = nVarTabWidth;
- tabs[ 3 ] = nVarTabWidth + nValueTabWidth;
- aTreeListBox.SvHeaderTabListBox::SetTabs( tabs, MAP_PIXEL );
- aTreeListBox.InitHeaderBar( &aHeaderBar );
-
- aTreeListBox.SetNodeDefaultImages( );
-
- aHeaderBar.Show();
-
- aRemoveWatchButton.Disable();
-
- aTreeListBox.Show();
-
- long nTextLen = GetTextWidth( aWatchStr ) + DWBORDER;
- aXEdit.SetPosPixel( Point( nTextLen, 3 ) );
- aXEdit.SetAccHdl( LINK( this, WatchWindow, EditAccHdl ) );
- aXEdit.GetAccelerator().InsertItem( 1, KeyCode( KEY_RETURN ) );
- aXEdit.GetAccelerator().InsertItem( 2, KeyCode( KEY_ESCAPE ) );
- aXEdit.Show();
-
- aRemoveWatchButton.SetClickHdl( LINK( this, WatchWindow, ButtonHdl ) );
- aRemoveWatchButton.SetPosPixel( Point( nTextLen + aXEdit.GetSizePixel().Width() + 4, 2 ) );
- Size aSz( aRemoveWatchButton.GetModeImage().GetSizePixel() );
- aSz.Width() += 6;
- aSz.Height() += 6;
- aRemoveWatchButton.SetSizePixel( aSz );
- aRemoveWatchButton.Show();
-
- SetText( String( IDEResId( RID_STR_WATCHNAME ) ) );
-
- SetHelpId( HID_BASICIDE_WATCHWINDOW );
-
- // make watch window keyboard accessible
- GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
-}
-
-
-
-WatchWindow::~WatchWindow()
-{
- GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
-}
-
-
-
-void WatchWindow::Paint( const Rectangle& )
-{
- DrawText( Point( DWBORDER, 7 ), aWatchStr );
- lcl_DrawIDEWindowFrame( this );
-}
-
-
-
-void WatchWindow::Resize()
-{
- Size aSz = GetOutputSizePixel();
- Size aBoxSz( aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER );
-
- if ( aBoxSz.Width() < 4 ) // < 4, weil noch Border...
- aBoxSz.Width() = 0;
- if ( aBoxSz.Height() < 4 )
- aBoxSz.Height() = 0;
-
- aBoxSz.Height() -= nHeaderBarHeight;
- aTreeListBox.SetSizePixel( aBoxSz );
- aTreeListBox.GetHScroll()->SetPageSize( aTreeListBox.GetHScroll()->GetVisibleSize() );
-
- aBoxSz.Height() = nHeaderBarHeight;
- aHeaderBar.SetSizePixel( aBoxSz );
-
- Invalidate(); //Wegen DrawLine im Paint...
-}
-
-struct MemberList
-{
- String* mpMemberNames;
- int mnMemberCount;
-
- MemberList( void )
- : mpMemberNames( NULL )
- , mnMemberCount( 0 )
- {}
- ~MemberList()
- {
- clear();
- }
-
- void clear( void );
- void allocList( int nCount );
-};
-
-void MemberList::clear( void )
-{
- if( mnMemberCount )
- {
- delete[] mpMemberNames;
- mnMemberCount = 0;
- }
-}
-
-void MemberList::allocList( int nCount )
-{
- clear();
- if( nCount > 0 )
- {
- mnMemberCount = nCount;
- mpMemberNames = new String[ mnMemberCount ];
- }
-}
-
-struct WatchItem
-{
- String maName;
- String maDisplayName;
- SbxObjectRef mpObject;
- MemberList maMemberList;
-
- SbxDimArrayRef mpArray;
- int nDimLevel; // 0 = Root
- int nDimCount;
- short* pIndices;
-
- WatchItem* mpArrayParentItem;
-
- WatchItem( void )
- : nDimLevel( 0 )
- , nDimCount( 0 )
- , pIndices( NULL )
- , mpArrayParentItem( NULL )
- {}
- ~WatchItem()
- { clearWatchItem(); }
-
- void clearWatchItem( bool bIncludeArrayData=true )
- {
- mpObject = NULL;
- maMemberList.clear();
- if( bIncludeArrayData )
- {
- mpArray = NULL;
- nDimLevel = 0;
- nDimCount = 0;
- delete[] pIndices;
- pIndices = NULL;
- }
- }
-
- WatchItem* GetRootItem( void );
- SbxDimArray* GetRootArray( void );
-};
-
-WatchItem* WatchItem::GetRootItem( void )
-{
- WatchItem* pItem = mpArrayParentItem;
- while( pItem )
- {
- if( pItem->mpArray.Is() )
- break;
- pItem = pItem->mpArrayParentItem;
- }
- return pItem;
-}
-
-SbxDimArray* WatchItem::GetRootArray( void )
-{
- WatchItem* pRootItem = GetRootItem();
- SbxDimArray* pRet = NULL;
- if( pRootItem )
- pRet = pRootItem->mpArray;
- return pRet;
-}
-
-void WatchWindow::AddWatch( const String& rVName )
-{
- WatchItem* pWatchItem = new WatchItem;
- String aVar, aIndex;
- lcl_SeparateNameAndIndex( rVName, aVar, aIndex );
- pWatchItem->maName = aVar;
-
- String aWatchStr_( aVar );
- aWatchStr_ += String( RTL_CONSTASCII_USTRINGPARAM( "\t\t" ) );
- SvLBoxEntry* pNewEntry = aTreeListBox.InsertEntry( aWatchStr_, 0, sal_True, LIST_APPEND );
- pNewEntry->SetUserData( pWatchItem );
-
- aTreeListBox.Select( pNewEntry, sal_True );
- aTreeListBox.MakeVisible( pNewEntry );
- aRemoveWatchButton.Enable();
-}
-
-sal_Bool WatchWindow::RemoveSelectedWatch()
-{
- SvLBoxEntry* pEntry = aTreeListBox.GetCurEntry();
- if ( pEntry )
- {
- aTreeListBox.GetModel()->Remove( pEntry );
- pEntry = aTreeListBox.GetCurEntry();
- if ( pEntry )
- aXEdit.SetText( ((WatchItem*)pEntry->GetUserData())->maName );
- else
- aXEdit.SetText( String() );
- if ( !aTreeListBox.GetEntryCount() )
- aRemoveWatchButton.Disable();
- return sal_True;
- }
- else
- return sal_False;
-}
-
-
-IMPL_LINK_INLINE_START( WatchWindow, ButtonHdl, ImageButton *, pButton )
-{
- if ( pButton == &aRemoveWatchButton )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_REMOVEWATCH );
- }
- }
- return 0;
-}
-IMPL_LINK_INLINE_END( WatchWindow, ButtonHdl, ImageButton *, pButton )
-
-
-
-IMPL_LINK_INLINE_START( WatchWindow, TreeListHdl, SvTreeListBox *, EMPTYARG )
-{
- SvLBoxEntry* pCurEntry = aTreeListBox.GetCurEntry();
- if ( pCurEntry && pCurEntry->GetUserData() )
- aXEdit.SetText( ((WatchItem*)pCurEntry->GetUserData())->maName );
-
- return 0;
-}
-IMPL_LINK_INLINE_END( WatchWindow, TreeListHdl, SvTreeListBox *, EMPTYARG )
-
-
-IMPL_LINK_INLINE_START( WatchWindow, implEndDragHdl, HeaderBar *, pBar )
-{
- (void)pBar;
-
- const sal_Int32 TAB_WIDTH_MIN = 10;
- sal_Int32 nMaxWidth =
- aHeaderBar.GetSizePixel().getWidth() - 2 * TAB_WIDTH_MIN;
-
- sal_Int32 nVariableWith = aHeaderBar.GetItemSize( ITEM_ID_VARIABLE );
- if( nVariableWith < TAB_WIDTH_MIN )
- aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, TAB_WIDTH_MIN );
- else if( nVariableWith > nMaxWidth )
- aHeaderBar.SetItemSize( ITEM_ID_VARIABLE, nMaxWidth );
-
- sal_Int32 nValueWith = aHeaderBar.GetItemSize( ITEM_ID_VALUE );
- if( nValueWith < TAB_WIDTH_MIN )
- aHeaderBar.SetItemSize( ITEM_ID_VALUE, TAB_WIDTH_MIN );
- else if( nValueWith > nMaxWidth )
- aHeaderBar.SetItemSize( ITEM_ID_VALUE, nMaxWidth );
-
- if (aHeaderBar.GetItemSize( ITEM_ID_TYPE ) < TAB_WIDTH_MIN)
- aHeaderBar.SetItemSize( ITEM_ID_TYPE, TAB_WIDTH_MIN );
-
- sal_Int32 nPos = 0;
- sal_uInt16 nTabs = aHeaderBar.GetItemCount();
- for( sal_uInt16 i = 1 ; i < nTabs ; ++i )
- {
- nPos += aHeaderBar.GetItemSize( i );
- aTreeListBox.SetTab( i, nPos, MAP_PIXEL );
- }
- return 0;
-}
-IMPL_LINK_INLINE_END( WatchWindow, implEndDragHdl, HeaderBar *, pBar )
-
-
-IMPL_LINK( WatchWindow, EditAccHdl, Accelerator *, pAcc )
-{
- switch ( pAcc->GetCurKeyCode().GetCode() )
- {
- case KEY_RETURN:
- {
- String aCurText( aXEdit.GetText() );
- if ( aCurText.Len() )
- {
- AddWatch( aCurText );
- aXEdit.SetSelection( Selection( 0, 0xFFFF ) );
- UpdateWatches();
- }
- else
- Sound::Beep();
- }
- break;
- case KEY_ESCAPE:
- {
- aXEdit.SetText( String() );
- }
- break;
- }
-
- return 0;
-}
-
-void WatchWindow::UpdateWatches( bool bBasicStopped )
-{
- aTreeListBox.UpdateWatches( bBasicStopped );
-}
-
-
-StackWindow::StackWindow( Window* pParent ) :
- BasicDockingWindow( pParent ),
- aTreeListBox( this, WB_BORDER | WB_3DLOOK | WB_HSCROLL | WB_TABSTOP ),
- aStackStr( IDEResId( RID_STR_STACK ) )
-{
- aTreeListBox.SetHelpId(HID_BASICIDE_STACKWINDOW_LIST);
- aTreeListBox.SetAccessibleName(String( IDEResId(RID_STR_STACKNAME)));
- aTreeListBox.SetPosPixel( Point( DWBORDER, nVirtToolBoxHeight ) );
- aTreeListBox.SetHighlightRange();
- aTreeListBox.SetSelectionMode( NO_SELECTION );
- aTreeListBox.InsertEntry( String(), 0, sal_False, LIST_APPEND );
- aTreeListBox.Show();
-
- SetText( String( IDEResId( RID_STR_STACKNAME ) ) );
-
- SetHelpId( HID_BASICIDE_STACKWINDOW );
-
- // make stack window keyboard accessible
- GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
-}
-
-
-
-StackWindow::~StackWindow()
-{
- GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
-}
-
-
-
-void StackWindow::Paint( const Rectangle& )
-{
- DrawText( Point( DWBORDER, 7 ), aStackStr );
- lcl_DrawIDEWindowFrame( this );
-}
-
-
-
-void StackWindow::Resize()
-{
- Size aSz = GetOutputSizePixel();
- Size aBoxSz( aSz.Width() - 2*DWBORDER, aSz.Height() - nVirtToolBoxHeight - DWBORDER );
-
- if ( aBoxSz.Width() < 4 ) // < 4, weil noch Border...
- aBoxSz.Width() = 0;
- if ( aBoxSz.Height() < 4 )
- aBoxSz.Height() = 0;
-
- aTreeListBox.SetSizePixel( aBoxSz );
-
- Invalidate(); //Wegen DrawLine im Paint...
-}
-
-
-
-IMPL_LINK_INLINE_START( StackWindow, ButtonHdl, ImageButton *, /*pButton*/ )
-{
- return 0;
-}
-IMPL_LINK_INLINE_END( StackWindow, ButtonHdl, ImageButton *, pButton )
-
-
-
-void StackWindow::UpdateCalls()
-{
- aTreeListBox.SetUpdateMode( sal_False );
- aTreeListBox.Clear();
-
- if ( StarBASIC::IsRunning() )
- {
- SbxError eOld = SbxBase::GetError();
- aTreeListBox.SetSelectionMode( SINGLE_SELECTION );
-
- sal_uInt16 nScope = 0;
- SbMethod* pMethod = StarBASIC::GetActiveMethod( nScope );
- while ( pMethod )
- {
- String aEntry( String::CreateFromInt32(nScope ));
- if ( aEntry.Len() < 2 )
- aEntry.Insert( ' ', 0 );
- aEntry += String( RTL_CONSTASCII_USTRINGPARAM( ": " ) );
- aEntry += pMethod->GetName();
- SbxArray* pParams = pMethod->GetParameters();
- SbxInfo* pInfo = pMethod->GetInfo();
- if ( pParams )
- {
- aEntry += '(';
- // 0 ist der Name der Sub...
- for ( sal_uInt16 nParam = 1; nParam < pParams->Count(); nParam++ )
- {
- SbxVariable* pVar = pParams->Get( nParam );
- DBG_ASSERT( pVar, "Parameter?!" );
- if ( pVar->GetName().Len() )
- aEntry += pVar->GetName();
- else if ( pInfo )
- {
- const SbxParamInfo* pParam = pInfo->GetParam( nParam );
- if ( pParam )
- aEntry += pParam->aName;
- }
- aEntry += '=';
- SbxDataType eType = pVar->GetType();
- if( eType & SbxARRAY )
- aEntry += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
- else if( eType != SbxOBJECT )
- aEntry += pVar->GetString();
- if ( nParam < ( pParams->Count() - 1 ) )
- aEntry += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
- }
- aEntry += ')';
- }
- aTreeListBox.InsertEntry( aEntry, 0, sal_False, LIST_APPEND );
- nScope++;
- pMethod = StarBASIC::GetActiveMethod( nScope );
- }
-
- SbxBase::ResetError();
- if( eOld != SbxERR_OK )
- SbxBase::SetError( eOld );
- }
- else
- {
- aTreeListBox.SetSelectionMode( NO_SELECTION );
- aTreeListBox.InsertEntry( String(), 0, sal_False, LIST_APPEND );
- }
-
- aTreeListBox.SetUpdateMode( sal_True );
-}
-
-
-
-
-ComplexEditorWindow::ComplexEditorWindow( ModulWindow* pParent ) :
- Window( pParent, WB_3DLOOK | WB_CLIPCHILDREN ),
- aBrkWindow( this ),
- aEdtWindow( this ),
- aEWVScrollBar( this, WB_VSCROLL | WB_DRAG )
-{
- aEdtWindow.SetModulWindow( pParent );
- aBrkWindow.SetModulWindow( pParent );
- aEdtWindow.Show();
- aBrkWindow.Show();
-
- aEWVScrollBar.SetLineSize( SCROLL_LINE );
- aEWVScrollBar.SetPageSize( SCROLL_PAGE );
- aEWVScrollBar.SetScrollHdl( LINK( this, ComplexEditorWindow, ScrollHdl ) );
- aEWVScrollBar.Show();
-}
-
-
-
-void ComplexEditorWindow::Resize()
-{
- Size aOutSz = GetOutputSizePixel();
- Size aSz( aOutSz );
- aSz.Width() -= 2*DWBORDER;
- aSz.Height() -= 2*DWBORDER;
- long nBrkWidth = 20;
- long nSBWidth = aEWVScrollBar.GetSizePixel().Width();
-
- Size aBrkSz( Size( nBrkWidth, aSz.Height() ) );
- aBrkWindow.SetPosSizePixel( Point( DWBORDER, DWBORDER ), aBrkSz );
-
- Size aEWSz( Size( aSz.Width() - nBrkWidth - nSBWidth + 2, aSz.Height() ) );
- aEdtWindow.SetPosSizePixel( Point( DWBORDER+aBrkSz.Width()-1, DWBORDER ), aEWSz );
-
- aEWVScrollBar.SetPosSizePixel( Point( aOutSz.Width()-DWBORDER-nSBWidth, DWBORDER ), Size( nSBWidth, aSz.Height() ) );
-}
-
-IMPL_LINK( ComplexEditorWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
-{
- if ( aEdtWindow.GetEditView() )
- {
- DBG_ASSERT( pCurScrollBar == &aEWVScrollBar, "Wer scrollt hier ?" );
- long nDiff = aEdtWindow.GetEditView()->GetStartDocPos().Y() - pCurScrollBar->GetThumbPos();
- aEdtWindow.GetEditView()->Scroll( 0, nDiff );
- aBrkWindow.DoScroll( 0, nDiff );
- aEdtWindow.GetEditView()->ShowCursor( sal_False, sal_True );
- pCurScrollBar->SetThumbPos( aEdtWindow.GetEditView()->GetStartDocPos().Y() );
- }
-
- return 0;
-}
-
-void ComplexEditorWindow::DataChanged(DataChangedEvent const & rDCEvt)
-{
- Window::DataChanged(rDCEvt);
- if (rDCEvt.GetType() == DATACHANGED_SETTINGS
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
- {
- Color aColor(GetSettings().GetStyleSettings().GetFaceColor());
- if (aColor
- != rDCEvt.GetOldSettings()->GetStyleSettings().GetFaceColor())
- {
- SetBackground(Wallpaper(aColor));
- Invalidate();
- }
- }
-}
-
-uno::Reference< awt::XWindowPeer >
-EditorWindow::GetComponentInterface(sal_Bool bCreate)
-{
- uno::Reference< awt::XWindowPeer > xPeer(
- Window::GetComponentInterface(false));
- if (!xPeer.is() && bCreate)
- {
- // Make sure edit engine and view are available:
- if (!pEditEngine)
- CreateEditEngine();
-
- xPeer = new ::svt::TextWindowPeer(*GetEditView());
- SetComponentInterface(xPeer);
- }
- return xPeer;
-}
-
-WatchTreeListBox::WatchTreeListBox( Window* pParent, WinBits nWinBits )
- : SvHeaderTabListBox( pParent, nWinBits )
-{}
-
-WatchTreeListBox::~WatchTreeListBox()
-{
- // Destroy user data
- SvLBoxEntry* pEntry = First();
- while ( pEntry )
- {
- delete (WatchItem*)pEntry->GetUserData();
- pEntry = Next( pEntry );
- }
-}
-
-void WatchTreeListBox::SetTabs()
-{
- SvHeaderTabListBox::SetTabs();
- sal_uInt16 nTabCount_ = aTabs.Count();
- for( sal_uInt16 i = 0 ; i < nTabCount_ ; i++ )
- {
- SvLBoxTab* pTab = (SvLBoxTab*)aTabs.GetObject(i);
- if( i == 2 )
- pTab->nFlags |= SV_LBOXTAB_EDITABLE;
- else
- pTab->nFlags &= ~SV_LBOXTAB_EDITABLE;
- }
-}
-
-void WatchTreeListBox::RequestingChilds( SvLBoxEntry * pParent )
-{
- if( !StarBASIC::IsRunning() )
- return;
-
- if( GetChildCount( pParent ) > 0 )
- return;
-
- SvLBoxEntry * pEntry = pParent;
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
-
- SbxDimArray* pArray = pItem->mpArray;
- SbxDimArray* pRootArray = pItem->GetRootArray();
- bool bArrayIsRootArray = false;
- if( !pArray && pRootArray )
- {
- pArray = pRootArray;
- bArrayIsRootArray = true;
- }
-
- SbxObject* pObj = pItem->mpObject;
- if( pObj )
- {
- createAllObjectProperties( pObj );
- SbxArray* pProps = pObj->GetProperties();
- sal_uInt16 nPropCount = pProps->Count();
- pItem->maMemberList.allocList( nPropCount );
-
- for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ )
- {
- SbxVariable* pVar = pProps->Get( i );
-
- String aName( pVar->GetName() );
- pItem->maMemberList.mpMemberNames[i] = aName;
- SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aName, pEntry );
- WatchItem* pChildItem = new WatchItem();
- pChildItem->maName = aName;
- pChildEntry->SetUserData( pChildItem );
- }
- if( nPropCount > 0 )
- {
- UpdateWatches();
- }
- }
- else if( pArray )
- {
- sal_uInt16 nElementCount = 0;
-
- // Loop through indices of current level
- int nParentLevel = bArrayIsRootArray ? pItem->nDimLevel : 0;
- int nThisLevel = nParentLevel + 1;
- sal_Int32 nMin, nMax;
- pArray->GetDim32( nThisLevel, nMin, nMax );
- for( sal_Int32 i = nMin ; i <= nMax ; i++ )
- {
- WatchItem* pChildItem = new WatchItem();
-
- // Copy data and create name
- String aBaseName( pItem->maName );
- pChildItem->maName = aBaseName;
-
- String aIndexStr = String( RTL_CONSTASCII_USTRINGPARAM( "(" ) );
- pChildItem->mpArrayParentItem = pItem;
- pChildItem->nDimLevel = nThisLevel;
- pChildItem->nDimCount = pItem->nDimCount;
- pChildItem->pIndices = new short[ pChildItem->nDimCount ];
- sal_uInt16 j;
- for( j = 0 ; j < nParentLevel ; j++ )
- {
- short n = pChildItem->pIndices[j] = pItem->pIndices[j];
- aIndexStr += String::CreateFromInt32( n );
- aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( "," ) );
- }
- pChildItem->pIndices[ nParentLevel ] = sal::static_int_cast<short>( i );
- aIndexStr += String::CreateFromInt32( i );
- aIndexStr += String( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
-
- String aDisplayName;
- WatchItem* pArrayRootItem = pChildItem->GetRootItem();
- if( pArrayRootItem && pArrayRootItem->mpArrayParentItem )
- aDisplayName = pItem->maDisplayName;
- else
- aDisplayName = aBaseName;
- aDisplayName += aIndexStr;
- pChildItem->maDisplayName = aDisplayName;
-
- SvLBoxEntry* pChildEntry = SvTreeListBox::InsertEntry( aDisplayName, pEntry );
- nElementCount++;
- pChildEntry->SetUserData( pChildItem );
- }
- if( nElementCount > 0 )
- {
- UpdateWatches();
- }
- }
-}
-
-SbxBase* WatchTreeListBox::ImplGetSBXForEntry( SvLBoxEntry* pEntry, bool& rbArrayElement )
-{
- SbxBase* pSBX = NULL;
- rbArrayElement = false;
-
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
- String aVName( pItem->maName );
-
- SvLBoxEntry* pParentEntry = GetParent( pEntry );
- WatchItem* pParentItem = pParentEntry ? (WatchItem*)pParentEntry->GetUserData() : NULL;
- if( pParentItem )
- {
- SbxObject* pObj = pParentItem->mpObject;
- SbxDimArray* pArray;
- if( pObj )
- {
- pSBX = pObj->Find( aVName, SbxCLASS_DONTCARE );
-
- SbxVariable* pVar;
- if ( pSBX && (pVar = PTR_CAST( SbxVariable, pSBX )) != NULL
- && !pSBX->ISA( SbxMethod ) )
- {
- // Force getting value
- SbxValues aRes;
- aRes.eType = SbxVOID;
- pVar->Get( aRes );
- }
- }
- // Array?
- else if( (pArray = pItem->GetRootArray()) != NULL )
- {
- rbArrayElement = true;
- if( pParentItem->nDimLevel + 1 == pParentItem->nDimCount )
- pSBX = pArray->Get( pItem->pIndices );
- }
- }
- else
- {
- pSBX = StarBASIC::FindSBXInCurrentScope( aVName );
- }
- return pSBX;
-}
-
-sal_Bool WatchTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
-{
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
-
- sal_Bool bEdit = sal_False;
- if ( StarBASIC::IsRunning() && StarBASIC::GetActiveMethod() && !SbxBase::IsError() )
- {
- // No out of scope entries
- bool bArrayElement;
- SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement );
- if ( ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) ) || bArrayElement )
- {
- // Accept no objects and only end nodes of arrays for editing
- if( !pItem->mpObject && (pItem->mpArray == NULL || pItem->nDimLevel == pItem->nDimCount) )
- {
- aEditingRes = SvHeaderTabListBox::GetEntryText( pEntry, ITEM_ID_VALUE-1 );
- aEditingRes.EraseLeadingChars();
- aEditingRes.EraseTrailingChars();
- bEdit = sal_True;
- }
- }
- }
-
- if ( !bEdit )
- Sound::Beep();
-
- return bEdit;
-}
-
-sal_Bool WatchTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText )
-{
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
- String aVName( pItem->maName );
-
- String aResult = rNewText;
- aResult.EraseLeadingChars();
- aResult.EraseTrailingChars();
-
- sal_uInt16 nResultLen = aResult.Len();
- sal_Unicode cFirst = aResult.GetChar( 0 );
- sal_Unicode cLast = aResult.GetChar( nResultLen - 1 );
- if( cFirst == '\"' && cLast == '\"' )
- aResult = aResult.Copy( 1, nResultLen - 2 );
-
- sal_Bool bResModified = ( aResult != aEditingRes ) ? sal_True : sal_False;
- sal_Bool bError = sal_False;
- if ( !aVName.Len() )
- {
- bError = sal_True;
- }
-
- sal_Bool bRet = sal_False;
-
- if ( bError )
- {
- Sound::Beep();
- }
- else if ( bResModified )
- {
- bRet = ImplBasicEntryEdited( pEntry, aResult );
- }
-
- return bRet;
-}
-
-sal_Bool WatchTreeListBox::ImplBasicEntryEdited( SvLBoxEntry* pEntry, const String& rResult )
-{
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
- String aVName( pItem->maName );
-
- sal_Bool bError = sal_False;
- String aResult( rResult );
- String aIndex;
- bool bArrayElement;
- SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement );
-
- SbxBase* pToBeChanged = NULL;
- if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) )
- {
- SbxVariable* pVar = (SbxVariable*)pSBX;
- SbxDataType eType = pVar->GetType();
- if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT )
- bError = sal_True;
- else if ( eType & SbxARRAY )
- bError = sal_True;
- else
- pToBeChanged = pSBX;
- }
-
- if ( pToBeChanged )
- {
- if ( pToBeChanged->ISA( SbxVariable ) )
- {
- // Wenn der Typ variabel ist, macht die Konvertierung des SBX nichts,
- // bei festem Typ wird der String konvertiert.
- ((SbxVariable*)pToBeChanged)->PutStringExt( aResult );
- }
- else
- bError = sal_True;
- }
-
- // Wenn jemand z.B. einen zu grossen Wert fuer ein Int eingegeben hat,
- // folgt beim naechsten Step() ein Runtime-Error.
- if ( SbxBase::IsError() )
- {
- bError = sal_True;
- SbxBase::ResetError();
- }
-
- if ( bError )
- Sound::Beep();
-
- UpdateWatches();
-
- // The text should never be taken/copied 1:1,
- // as the UpdateWatches will be lost
- return sal_False;
-}
-
-
-static void implCollapseModifiedObjectEntry( SvLBoxEntry* pParent, WatchTreeListBox* pThis )
-{
- pThis->Collapse( pParent );
-
- SvLBoxTreeList* pModel = pThis->GetModel();
- SvLBoxEntry* pDeleteEntry;
- while( (pDeleteEntry = pThis->SvTreeListBox::GetEntry( pParent, 0 )) != NULL )
- {
- implCollapseModifiedObjectEntry( pDeleteEntry, pThis );
-
- WatchItem* pItem = (WatchItem*)pDeleteEntry->GetUserData();
- delete pItem;
- pModel->Remove( pDeleteEntry );
- }
-}
-
-static String implCreateTypeStringForDimArray( WatchItem* pItem, SbxDataType eType )
-{
- String aRetStr = getBasicTypeName( eType );
-
- SbxDimArray* pArray = pItem->mpArray;
- if( !pArray )
- pArray = pItem->GetRootArray();
- if( pArray )
- {
- int nDimLevel = pItem->nDimLevel;
- int nDims = pItem->nDimCount;
- if( nDimLevel < nDims )
- {
- aRetStr += '(';
- for( int i = nDimLevel ; i < nDims ; i++ )
- {
- short nMin, nMax;
- pArray->GetDim( sal::static_int_cast<short>( i+1 ), nMin, nMax );
- aRetStr += String::CreateFromInt32( nMin );
- aRetStr += String( RTL_CONSTASCII_USTRINGPARAM( " to " ) );
- aRetStr += String::CreateFromInt32( nMax );
- if( i < nDims - 1 )
- aRetStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
- }
- aRetStr += ')';
- }
- }
- return aRetStr;
-}
-
-
-void implEnableChildren( SvLBoxEntry* pEntry, bool bEnable )
-{
- if( bEnable )
- {
- pEntry->SetFlags(
- (pEntry->GetFlags() &
- ~(SV_ENTRYFLAG_NO_NODEBMP | SV_ENTRYFLAG_HAD_CHILDREN))
- | SV_ENTRYFLAG_CHILDS_ON_DEMAND );
- }
- else
- {
- pEntry->SetFlags(
- (pEntry->GetFlags() & ~(SV_ENTRYFLAG_CHILDS_ON_DEMAND)) );
- }
-}
-
-void WatchTreeListBox::UpdateWatches( bool bBasicStopped )
-{
- SbMethod* pCurMethod = StarBASIC::GetActiveMethod();
-
- SbxError eOld = SbxBase::GetError();
- setBasicWatchMode( true );
-
- SvLBoxEntry* pEntry = First();
- while ( pEntry )
- {
- WatchItem* pItem = (WatchItem*)pEntry->GetUserData();
- String aVName( pItem->maName );
- DBG_ASSERT( aVName.Len(), "Var? - Must not be empty!" );
- String aWatchStr;
- String aTypeStr;
- if ( pCurMethod )
- {
- bool bArrayElement;
- SbxBase* pSBX = ImplGetSBXForEntry( pEntry, bArrayElement );
-
- // Array? If no end node create type string
- if( bArrayElement && pItem->nDimLevel < pItem->nDimCount )
- {
- SbxDimArray* pRootArray = pItem->GetRootArray();
- SbxDataType eType = pRootArray->GetType();
- aTypeStr = implCreateTypeStringForDimArray( pItem, eType );
- implEnableChildren( pEntry, true );
- }
-
- bool bCollapse = false;
- if ( pSBX && pSBX->ISA( SbxVariable ) && !pSBX->ISA( SbxMethod ) )
- {
- SbxVariable* pVar = (SbxVariable*)pSBX;
- // extra treatment of arrays
- SbxDataType eType = pVar->GetType();
- if ( eType & SbxARRAY )
- {
- // Mehrdimensionale Arrays beruecksichtigen!
- SbxBase* pBase = pVar->GetObject();
- if ( pBase && pBase->ISA( SbxDimArray ) )
- {
- SbxDimArray* pNewArray = (SbxDimArray*)pBase;
- SbxDimArray* pOldArray = pItem->mpArray;
-
- bool bArrayChanged = false;
- if( pNewArray != NULL && pOldArray != NULL )
- {
- // Compare Array dimensions to see if array has changed
- // Can be a copy, so comparing pointers does not work
- sal_uInt16 nOldDims = pOldArray->GetDims();
- sal_uInt16 nNewDims = pNewArray->GetDims();
- if( nOldDims != nNewDims )
- {
- bArrayChanged = true;
- }
- else
- {
- for( int i = 0 ; i < nOldDims ; i++ )
- {
- short nOldMin, nOldMax;
- short nNewMin, nNewMax;
-
- pOldArray->GetDim( sal::static_int_cast<short>( i+1 ), nOldMin, nOldMax );
- pNewArray->GetDim( sal::static_int_cast<short>( i+1 ), nNewMin, nNewMax );
- if( nOldMin != nNewMin || nOldMax != nNewMax )
- {
- bArrayChanged = true;
- break;
- }
- }
- }
- }
- else if( pNewArray == NULL || pOldArray == NULL )
- bArrayChanged = true;
-
- if( pNewArray )
- implEnableChildren( pEntry, true );
-
- // #i37227 Clear always and replace array
- if( pNewArray != pOldArray )
- {
- pItem->clearWatchItem( false );
- if( pNewArray )
- {
- implEnableChildren( pEntry, true );
-
- pItem->mpArray = pNewArray;
- sal_uInt16 nDims = pNewArray->GetDims();
- pItem->nDimLevel = 0;
- pItem->nDimCount = nDims;
- }
- }
- if( bArrayChanged && pOldArray != NULL )
- bCollapse = true;
-
- aTypeStr = implCreateTypeStringForDimArray( pItem, eType );
- }
- else
- aWatchStr += String( RTL_CONSTASCII_USTRINGPARAM( "<?>" ) );
- }
- else if ( (sal_uInt8)eType == (sal_uInt8)SbxOBJECT )
- {
- SbxObject* pObj = NULL;
- SbxBase* pBase = pVar->GetObject();
- if( pBase && pBase->ISA( SbxObject ) )
- pObj = (SbxObject*)pBase;
-
- if( pObj )
- {
- // Check if member list has changed
- bool bObjChanged = false;
- if( pItem->mpObject != NULL && pItem->maMemberList.mpMemberNames != NULL )
- {
- SbxArray* pProps = pObj->GetProperties();
- sal_uInt16 nPropCount = pProps->Count();
- for( sal_uInt16 i = 0 ; i < nPropCount - 3 ; i++ )
- {
- SbxVariable* pVar_ = pProps->Get( i );
- String aName( pVar_->GetName() );
- if( pItem->maMemberList.mpMemberNames[i] != aName )
- {
- bObjChanged = true;
- break;
- }
- }
- if( bObjChanged )
- bCollapse = true;
- }
-
- pItem->mpObject = pObj;
- implEnableChildren( pEntry, true );
- aTypeStr = getBasicObjectTypeName( pObj );
- }
- else
- {
- aWatchStr = String( RTL_CONSTASCII_USTRINGPARAM( "Null" ) );
- if( pItem->mpObject != NULL )
- {
- bCollapse = true;
- pItem->clearWatchItem( false );
-
- implEnableChildren( pEntry, false );
- }
- }
- }
- else
- {
- if( pItem->mpObject != NULL )
- {
- bCollapse = true;
- pItem->clearWatchItem( false );
-
- implEnableChildren( pEntry, false );
- }
-
- bool bString = ((sal_uInt8)eType == (sal_uInt8)SbxSTRING);
- String aStrStr( RTL_CONSTASCII_USTRINGPARAM( "\"" ) );
- if( bString )
- aWatchStr += aStrStr;
- aWatchStr += pVar->GetString();
- if( bString )
- aWatchStr += aStrStr;
- }
- if( !aTypeStr.Len() )
- {
- if( !pVar->IsFixed() )
- aTypeStr = String( RTL_CONSTASCII_USTRINGPARAM( "Variant/" ) );
- aTypeStr += getBasicTypeName( pVar->GetType() );
- }
- }
- else if( !bArrayElement )
- aWatchStr += String( RTL_CONSTASCII_USTRINGPARAM( "<Out of Scope>" ) );
-
- if( bCollapse )
- implCollapseModifiedObjectEntry( pEntry, this );
-
- }
- else if( bBasicStopped )
- {
- if( pItem->mpObject || pItem->mpArray )
- {
- implCollapseModifiedObjectEntry( pEntry, this );
- pItem->mpObject = NULL;
- }
- }
-
- SvHeaderTabListBox::SetEntryText( aWatchStr, pEntry, ITEM_ID_VALUE-1 );
- SvHeaderTabListBox::SetEntryText( aTypeStr, pEntry, ITEM_ID_TYPE-1 );
-
- pEntry = Next( pEntry );
- }
-
- // Force redraw
- Invalidate();
-
- SbxBase::ResetError();
- if( eOld != SbxERR_OK )
- SbxBase::SetError( eOld );
- setBasicWatchMode( false );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
deleted file mode 100644
index 03d264a1a..000000000
--- a/basctl/source/basicide/baside3.cxx
+++ /dev/null
@@ -1,1393 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#define _SDR_NOITEMS
-#define _SDR_NOTOUCH
-#define _SDR_NOTRANSFORM
-#define _SDR_NOOBJECTS
-#define _SDR_NOVIEWMARKER
-#define _SDR_NODRAGMETHODS
-#define _SDR_NOXOUTDEV
-
-#include <ide_pch.hxx>
-
-
-#include <vector>
-#include <basidesh.hrc>
-#include <baside3.hxx>
-#include <localizationmgr.hxx>
-#include <accessibledialogwindow.hxx>
-#include <dlged.hxx>
-#include <dlgedmod.hxx>
-#include <dlgedview.hxx>
-#include <dlgeddef.hxx>
-#include <propbrw.hxx>
-
-#include <basobj.hxx>
-#include <iderdll.hxx>
-#include <basidesh.hxx>
-#include <idetemp.hxx>
-#include <helpid.hrc>
-#include <bastype2.hxx>
-#include <svx/svdview.hxx>
-#include <editeng/unolingu.hxx>
-#include <tools/diagnose_ex.h>
-#include <tools/urlobj.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <xmlscript/xmldlg_imexp.hxx>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <svtools/ehdl.hxx>
-#include <svtools/langtab.hxx>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilePickerControlAccess.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/ui/dialogs/ExtendedFilePickerElementIds.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#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/vba/XVBACompatibility.hpp>
-
-using namespace comphelper;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::io;
-using namespace ::com::sun::star::resource;
-using namespace ::com::sun::star::ui::dialogs;
-
-#if defined(UNX)
-#define FILTERMASK_ALL "*"
-#else
-#define FILTERMASK_ALL "*.*"
-#endif
-
-DBG_NAME( DialogWindow )
-
-TYPEINIT1( DialogWindow, IDEBaseWindow );
-
-DialogWindow::DialogWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName,
- const com::sun::star::uno::Reference< com::sun::star::container::XNameContainer >& xDialogModel )
- :IDEBaseWindow( pParent, rDocument, aLibName, aName )
- ,pUndoMgr(NULL)
-{
- InitSettings( sal_True, sal_True, sal_True );
-
- pEditor = new DlgEditor( rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- pEditor->SetWindow( this );
- pEditor->SetDialog( xDialogModel );
-
- // Undo einrichten
- pUndoMgr = new SfxUndoManager;
-
- Link aDummyLink;
- aOldNotifyUndoActionHdl = pEditor->GetModel()->GetNotifyUndoActionHdl();
- pEditor->GetModel()->SetNotifyUndoActionHdl(
- LINK(this, DialogWindow, NotifyUndoActionHdl));
-
- SetHelpId( HID_BASICIDE_DIALOGWINDOW );
-
- // set readonly mode for readonly libraries
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( GetDocument().getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) )
- SetReadOnly( sal_True );
-
- if ( rDocument.isDocument() && rDocument.isReadOnly() )
- SetReadOnly( sal_True );
-}
-
-DialogWindow::~DialogWindow()
-{
- delete pEditor;
- delete pUndoMgr;
-}
-
-void DialogWindow::LoseFocus()
-{
- if ( IsModified() )
- StoreData();
-
- Window::LoseFocus();
-}
-
-
-
-void DialogWindow::Paint( const Rectangle& rRect )
-{
- pEditor->Paint( rRect );
-}
-
-
-
-void DialogWindow::Resize()
-{
- if ( GetHScrollBar() && GetVScrollBar() ) {
- pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
- }
-}
-
-
-
-void DialogWindow::MouseButtonDown( const MouseEvent& rMEvt )
-{
- pEditor->MouseButtonDown( rMEvt );
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
-}
-
-
-
-void DialogWindow::MouseButtonUp( const MouseEvent& rMEvt )
-{
- pEditor->MouseButtonUp( rMEvt );
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if( (pEditor->GetMode() == DLGED_INSERT) && !pEditor->IsCreateOK() )
- {
- pEditor->SetMode( DLGED_SELECT );
- if ( pBindings )
- pBindings->Invalidate( SID_CHOOSE_CONTROLS );
- }
- if ( pBindings )
- {
- pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
- pBindings->Invalidate( SID_DOC_MODIFIED );
- pBindings->Invalidate( SID_SAVEDOC );
- }
-}
-
-
-
-void DialogWindow::MouseMove( const MouseEvent& rMEvt )
-{
- pEditor->MouseMove( rMEvt );
-}
-
-
-
-void DialogWindow::KeyInput( const KeyEvent& rKEvt )
-{
- if( rKEvt.GetKeyCode() == KEY_BACKSPACE )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BACKSPACE );
- }
- }
- else
- {
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if( pBindings && rKEvt.GetKeyCode() == KEY_TAB )
- pBindings->Invalidate( SID_SHOW_PROPERTYBROWSER );
-
- if( !pEditor->KeyInput( rKEvt ) )
- {
- if( !SfxViewShell::Current()->KeyInput( rKEvt ) )
- Window::KeyInput( rKEvt );
- }
- }
-}
-
-void DialogWindow::Command( const CommandEvent& rCEvt )
-{
- if ( ( rCEvt.GetCommand() == COMMAND_WHEEL ) ||
- ( rCEvt.GetCommand() == COMMAND_STARTAUTOSCROLL ) ||
- ( rCEvt.GetCommand() == COMMAND_AUTOSCROLL ) )
- {
- HandleScrollCommand( rCEvt, GetHScrollBar(), GetVScrollBar() );
- }
- else if ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
- {
- SdrView* pView = GetView();
- if( !rCEvt.IsMouseEvent() && pView->AreObjectsMarked() )
- {
- Rectangle aMarkedRect( pView->GetMarkedRect() );
- Point MarkedCenter( aMarkedRect.Center() );
- Point PosPixel( LogicToPixel( MarkedCenter ) );
- pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED), this, &PosPixel );
- }
- else
- {
- pDispatcher->ExecutePopup( IDEResId(RID_POPUP_DLGED) );
- }
-
- }
- }
- else
- IDEBaseWindow::Command( rCEvt );
-}
-
-
-
-
-IMPL_LINK( DialogWindow, NotifyUndoActionHdl, SfxUndoAction *, pUndoAction )
-{
- (void)pUndoAction;
-
- return 0;
-}
-
-
-
-void DialogWindow::DoInit()
-{
- GetHScrollBar()->Show();
- GetVScrollBar()->Show();
- pEditor->SetScrollBars( GetHScrollBar(), GetVScrollBar() );
-}
-
-
-
-void DialogWindow::DoScroll( ScrollBar* pCurScrollBar )
-{
- pEditor->DoScroll( pCurScrollBar );
-}
-
-void DialogWindow::GetState( SfxItemSet& rSet )
-{
- SfxWhichIter aIter(rSet);
- for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
- {
- switch ( nWh )
- {
- case SID_PASTE:
- {
- if ( !IsPasteAllowed() )
- rSet.DisableItem( nWh );
-
- if ( IsReadOnly() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_COPY:
- {
- // any object selected?
- if ( !pEditor->GetView()->AreObjectsMarked() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_CUT:
- case SID_DELETE:
- case SID_BACKSPACE:
- {
- // any object selected?
- if ( !pEditor->GetView()->AreObjectsMarked() )
- rSet.DisableItem( nWh );
-
- if ( IsReadOnly() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_REDO:
- {
- if ( !pUndoMgr->GetUndoActionCount() )
- rSet.DisableItem( nWh );
- }
- break;
-
- // Nur Dialogfenster:
- case SID_DIALOG_TESTMODE:
- {
- // ist die IDE noch aktiv?
- if( IDE_DLL()->GetShell()->GetFrame() )
- {
- rSet.Put( SfxBoolItem( SID_DIALOG_TESTMODE,
- (pEditor->GetMode() == DLGED_TEST) ? sal_True : sal_False) );
- }
- else
- rSet.Put( SfxBoolItem( SID_DIALOG_TESTMODE,sal_False ));
- }
- break;
-
- case SID_CHOOSE_CONTROLS:
- {
- if ( IsReadOnly() )
- {
- rSet.DisableItem( nWh );
- }
- else
- {
- SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS );
- if ( GetEditor()->GetMode() == DLGED_SELECT )
- aItem.SetValue( SVX_SNAP_SELECT );
- else
- {
- sal_uInt16 nObj;
- switch( pEditor->GetInsertObj() )
- {
- case OBJ_DLG_PUSHBUTTON: nObj = SVX_SNAP_PUSHBUTTON; break;
- case OBJ_DLG_RADIOBUTTON: nObj = SVX_SNAP_RADIOBUTTON; break;
- case OBJ_DLG_CHECKBOX: nObj = SVX_SNAP_CHECKBOX; break;
- case OBJ_DLG_LISTBOX: nObj = SVX_SNAP_LISTBOX; break;
- case OBJ_DLG_COMBOBOX: nObj = SVX_SNAP_COMBOBOX; break;
- case OBJ_DLG_GROUPBOX: nObj = SVX_SNAP_GROUPBOX; break;
- case OBJ_DLG_EDIT: nObj = SVX_SNAP_EDIT; break;
- case OBJ_DLG_FIXEDTEXT: nObj = SVX_SNAP_FIXEDTEXT; break;
- case OBJ_DLG_IMAGECONTROL: nObj = SVX_SNAP_IMAGECONTROL; break;
- case OBJ_DLG_PROGRESSBAR: nObj = SVX_SNAP_PROGRESSBAR; break;
- case OBJ_DLG_HSCROLLBAR: nObj = SVX_SNAP_HSCROLLBAR; break;
- case OBJ_DLG_VSCROLLBAR: nObj = SVX_SNAP_VSCROLLBAR; break;
- case OBJ_DLG_HFIXEDLINE: nObj = SVX_SNAP_HFIXEDLINE; break;
- case OBJ_DLG_VFIXEDLINE: nObj = SVX_SNAP_VFIXEDLINE; break;
- case OBJ_DLG_DATEFIELD: nObj = SVX_SNAP_DATEFIELD; break;
- case OBJ_DLG_TIMEFIELD: nObj = SVX_SNAP_TIMEFIELD; break;
- case OBJ_DLG_NUMERICFIELD: nObj = SVX_SNAP_NUMERICFIELD; break;
- case OBJ_DLG_CURRENCYFIELD: nObj = SVX_SNAP_CURRENCYFIELD; break;
- case OBJ_DLG_FORMATTEDFIELD: nObj = SVX_SNAP_FORMATTEDFIELD; break;
- case OBJ_DLG_PATTERNFIELD: nObj = SVX_SNAP_PATTERNFIELD; break;
- case OBJ_DLG_FILECONTROL: nObj = SVX_SNAP_FILECONTROL; break;
- case OBJ_DLG_TREECONTROL: nObj = SVX_SNAP_TREECONTROL; break;
- default: nObj = 0;
- }
-#ifdef DBG_UTIL
- if( !nObj )
- {
- DBG_WARNING( "SID_CHOOSE_CONTROLS: Unbekannt!" );
- }
-#endif
- aItem.SetValue( nObj );
- }
-
- rSet.Put( aItem );
- }
- }
- break;
-
- case SID_SHOW_PROPERTYBROWSER:
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- if ( pViewFrame && !pViewFrame->HasChildWindow( SID_SHOW_PROPERTYBROWSER ) && !pEditor->GetView()->AreObjectsMarked() )
- rSet.DisableItem( nWh );
-
- if ( IsReadOnly() )
- rSet.DisableItem( nWh );
- }
- break;
- }
- }
-}
-
-
-
-void DialogWindow::ExecuteCommand( SfxRequest& rReq )
-{
- switch ( rReq.GetSlot() )
- {
- case SID_CUT:
- if ( !IsReadOnly() )
- {
- GetEditor()->Cut();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- break;
- case SID_DELETE:
- if ( !IsReadOnly() )
- {
- GetEditor()->Delete();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- break;
- case SID_COPY:
- GetEditor()->Copy();
- break;
- case SID_PASTE:
- if ( !IsReadOnly() )
- {
- GetEditor()->Paste();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- break;
- case SID_CHOOSE_CONTROLS:
- {
- const SfxItemSet* pArgs = rReq.GetArgs();
- DBG_ASSERT( pArgs, "Nix Args" );
-
- const SfxAllEnumItem& rItem = (SfxAllEnumItem&)pArgs->Get( SID_CHOOSE_CONTROLS );
- switch( rItem.GetValue() )
- {
- case SVX_SNAP_PUSHBUTTON:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_PUSHBUTTON );
- }
- break;
- case SVX_SNAP_RADIOBUTTON:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_RADIOBUTTON );
- }
- break;
- case SVX_SNAP_CHECKBOX:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_CHECKBOX);
- }
- break;
- case SVX_SNAP_LISTBOX:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_LISTBOX );
- }
- break;
- case SVX_SNAP_COMBOBOX:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_COMBOBOX );
- }
- break;
- case SVX_SNAP_GROUPBOX:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_GROUPBOX );
- }
- break;
- case SVX_SNAP_EDIT:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_EDIT );
- }
- break;
- case SVX_SNAP_FIXEDTEXT:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_FIXEDTEXT );
- }
- break;
- case SVX_SNAP_IMAGECONTROL:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_IMAGECONTROL );
- }
- break;
- case SVX_SNAP_PROGRESSBAR:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_PROGRESSBAR );
- }
- break;
- case SVX_SNAP_HSCROLLBAR:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_HSCROLLBAR );
- }
- break;
- case SVX_SNAP_VSCROLLBAR:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_VSCROLLBAR );
- }
- break;
- case SVX_SNAP_HFIXEDLINE:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_HFIXEDLINE );
- }
- break;
- case SVX_SNAP_VFIXEDLINE:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_VFIXEDLINE );
- }
- break;
- case SVX_SNAP_DATEFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_DATEFIELD );
- }
- break;
- case SVX_SNAP_TIMEFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_TIMEFIELD );
- }
- break;
- case SVX_SNAP_NUMERICFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_NUMERICFIELD );
- }
- break;
- case SVX_SNAP_CURRENCYFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_CURRENCYFIELD );
- }
- break;
- case SVX_SNAP_FORMATTEDFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_FORMATTEDFIELD );
- }
- break;
- case SVX_SNAP_PATTERNFIELD:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_PATTERNFIELD );
- }
- break;
- case SVX_SNAP_FILECONTROL:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_FILECONTROL );
- }
- break;
- case SVX_SNAP_TREECONTROL:
- {
- GetEditor()->SetMode( DLGED_INSERT );
- GetEditor()->SetInsertObj( OBJ_DLG_TREECONTROL );
- }
- break;
-
- case SVX_SNAP_SELECT:
- {
- GetEditor()->SetMode( DLGED_SELECT );
- }
- break;
- }
-
- if ( rReq.GetModifier() & KEY_MOD1 )
- {
- if ( GetEditor()->GetMode() == DLGED_INSERT )
- GetEditor()->CreateDefaultObject();
- }
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
- }
- break;
-
- case SID_DIALOG_TESTMODE:
- {
- DlgEdMode eOldMode = GetEditor()->GetMode();
- GetEditor()->SetMode( DLGED_TEST );
- GetEditor()->SetMode( eOldMode );
- rReq.Done();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DIALOG_TESTMODE );
- return;
- }
- case SID_EXPORT_DIALOG:
- SaveDialog();
- break;
-
- case SID_IMPORT_DIALOG:
- ImportDialog();
- break;
- }
-
- rReq.Done();
-}
-
-Reference< container::XNameContainer > DialogWindow::GetDialog() const
-{
- return pEditor->GetDialog();
-}
-
-sal_Bool DialogWindow::RenameDialog( const String& rNewName )
-{
- if ( !BasicIDE::RenameDialog( this, GetDocument(), GetLibName(), GetName(), rNewName ) )
- return sal_False;
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_DOC_MODIFIED );
-
- return sal_True;
-}
-
-void DialogWindow::DisableBrowser()
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL;
- if( pChildWin )
- ((PropBrw*)(pChildWin->GetWindow()))->Update( NULL );
-}
-
-void DialogWindow::UpdateBrowser()
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow(SID_SHOW_PROPERTYBROWSER) : NULL;
- if( pChildWin )
- ((PropBrw*)(pChildWin->GetWindow()))->Update( pIDEShell );
-}
-
-static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ));
-
-sal_Bool DialogWindow::SaveDialog()
-{
- DBG_CHKTHIS( DialogWindow, 0 );
- sal_Bool bDone = sal_False;
-
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILESAVE_AUTOEXTENSION_PASSWORD;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
-
- Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
- xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False);
- Any aValue;
- aValue <<= (sal_Bool) sal_True;
- xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
-
- if ( aCurPath.Len() )
- xFP->setDisplayDirectory ( aCurPath );
-
- xFP->setDefaultName( ::rtl::OUString( GetName() ) );
-
- String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) );
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
- xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
- xFltMgr->setCurrentFilter( aDialogStr );
-
- if( xFP->execute() == RET_OK )
- {
- Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
- aCurPath = aPaths[0];
-
- // export dialog model to xml
- Reference< container::XNameContainer > xDialogModel = GetDialog();
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- Reference< XInputStream > xInput( xISP->createInputStream() );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
- ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY );
-
- Reference< XOutputStream > xOutput;
- try
- {
- if( xSFI->exists( aCurPath ) )
- xSFI->kill( aCurPath );
- xOutput = xSFI->openFileWrite( aCurPath );
- }
- catch( Exception& )
- {}
-
- if( xOutput.is() )
- {
- Sequence< sal_Int8 > bytes;
- sal_Int32 nRead = xInput->readBytes( bytes, xInput->available() );
- for (;;)
- {
- if( nRead )
- xOutput->writeBytes( bytes );
-
- nRead = xInput->readBytes( bytes, 1024 );
- if (! nRead)
- break;
- }
- bDone = true;
-
- // With resource?
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
- Reference< resource::XStringResourceResolver > xStringResourceResolver;
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aResourceResolver = xDialogModelPropSet->getPropertyValue( aResourceResolverPropName );
- aResourceResolver >>= xStringResourceResolver;
- }
- catch( beans::UnknownPropertyException& )
- {}
- }
-
- bool bResource = false;
- if( xStringResourceResolver.is() )
- {
- Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
- if( nLocaleCount > 0 )
- bResource = true;
- }
-
- if( bResource )
- {
- INetURLObject aURLObj( aCurPath );
- aURLObj.removeExtension();
- ::rtl::OUString aDialogName( aURLObj.getName() );
- aURLObj.removeSegment();
- ::rtl::OUString aURL( aURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
- sal_Bool bReadOnly = sal_False;
- ::rtl::OUString aComment( RTL_CONSTASCII_USTRINGPARAM( "# " ));
- aComment += aDialogName;
- aComment += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " strings" ));
- Reference< task::XInteractionHandler > xDummyHandler;
-
- // Remove old properties files in case of overwriting Dialog files
- if( xSFI->isFolder( aURL ) )
- {
- Sequence< ::rtl::OUString > aContentSeq = xSFI->getFolderContents( aURL, false );
-
- ::rtl::OUString aDialogName_( aDialogName );
- aDialogName_ += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_" ));
- sal_Int32 nCount = aContentSeq.getLength();
- const ::rtl::OUString* pFiles = aContentSeq.getConstArray();
- for( int i = 0 ; i < nCount ; i++ )
- {
- ::rtl::OUString aCompleteName = pFiles[i];
- rtl::OUString aPureName;
- rtl::OUString aExtension;
- sal_Int32 iDot = aCompleteName.lastIndexOf( '.' );
- sal_Int32 iSlash = aCompleteName.lastIndexOf( '/' );
- if( iDot != -1 )
- {
- sal_Int32 iCopyFrom = (iSlash != -1) ? iSlash + 1 : 0;
- aPureName = aCompleteName.copy( iCopyFrom, iDot-iCopyFrom );
- aExtension = aCompleteName.copy( iDot + 1 );
- }
-
- if( aExtension.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "properties" ) ) ||
- aExtension.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "default" ) ) )
- {
- if( aPureName.indexOf( aDialogName_ ) == 0 )
- {
- try
- {
- xSFI->kill( aCompleteName );
- }
- catch( uno::Exception& )
- {}
- }
- }
- }
- }
-
- Reference< XStringResourceWithLocation > xStringResourceWithLocation =
- StringResourceWithLocation::create( xContext, aURL, bReadOnly,
- xStringResourceResolver->getDefaultLocale(), aDialogName, aComment, xDummyHandler );
-
- // Add locales
- Sequence< lang::Locale > aLocaleSeq = xStringResourceResolver->getLocales();
- const lang::Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const lang::Locale& rLocale = pLocales[ iLocale ];
- xStringResourceWithLocation->newLocale( rLocale );
- }
-
- Reference< XStringResourceManager > xTargetStringResourceManager( xStringResourceWithLocation, uno::UNO_QUERY );
-
- LocalizationMgr::copyResourceForDialog( xDialogModel,
- xStringResourceResolver, xTargetStringResourceManager );
-
- xStringResourceWithLocation->store();
- }
- }
- else
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_COULDNTWRITE) ) ).Execute();
- }
-
- return bDone;
-}
-
-extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
- const ::com::sun::star::lang::Locale& rLocaleRight );
-
-std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq
- ( Sequence< lang::Locale > aFirstSeq, Sequence< lang::Locale > aSecondSeq )
-{
- std::vector< lang::Locale > avRet;
-
- const lang::Locale* pFirst = aFirstSeq.getConstArray();
- const lang::Locale* pSecond = aSecondSeq.getConstArray();
- sal_Int32 nFirstCount = aFirstSeq.getLength();
- sal_Int32 nSecondCount = aSecondSeq.getLength();
-
- for( sal_Int32 iFirst = 0 ; iFirst < nFirstCount ; iFirst++ )
- {
- const lang::Locale& rFirstLocale = pFirst[ iFirst ];
-
- bool bAlsoContainedInSecondSeq = false;
- for( sal_Int32 iSecond = 0 ; iSecond < nSecondCount ; iSecond++ )
- {
- const lang::Locale& rSecondLocale = pSecond[ iSecond ];
-
- bool bMatch = localesAreEqual( rFirstLocale, rSecondLocale );
- if( bMatch )
- {
- bAlsoContainedInSecondSeq = true;
- break;
- }
- }
-
- if( !bAlsoContainedInSecondSeq )
- avRet.push_back( rFirstLocale );
- }
-
- return avRet;
-}
-
-
-class NameClashQueryBox : public MessBox
-{
-public:
- NameClashQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage );
-};
-
-NameClashQueryBox::NameClashQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage )
- : MessBox( pParent, 0, rTitle, rMessage )
-{
- if ( rTitle.Len() )
- SetText( rTitle );
-
- maMessText = rMessage;
-
- AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_RENAME ) ), RET_YES,
- BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
- AddButton( String( IDEResId( RID_STR_DLGIMP_CLASH_REPLACE ) ), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
-
- SetImage( QueryBox::GetStandardImage() );
-}
-
-
-class LanguageMismatchQueryBox : public MessBox
-{
-public:
- LanguageMismatchQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage );
-};
-
-LanguageMismatchQueryBox::LanguageMismatchQueryBox( Window* pParent,
- const XubString& rTitle, const XubString& rMessage )
- : MessBox( pParent, 0, rTitle, rMessage )
-{
- if ( rTitle.Len() )
- SetText( rTitle );
-
- maMessText = rMessage;
- AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_ADD ) ), RET_YES,
- BUTTONDIALOG_DEFBUTTON | BUTTONDIALOG_OKBUTTON | BUTTONDIALOG_FOCUSBUTTON );
- AddButton( String( IDEResId( RID_STR_DLGIMP_MISMATCH_OMIT ) ), RET_NO, 0 );
- AddButton( BUTTON_CANCEL, RET_CANCEL, BUTTONDIALOG_CANCELBUTTON );
- AddButton( BUTTON_HELP, BUTTONID_HELP, BUTTONDIALOG_HELPBUTTON, 4 );
-
- SetImage( QueryBox::GetStandardImage() );
-}
-
-sal_Bool implImportDialog( Window* pWin, const String& rCurPath, const ScriptDocument& rDocument, const String& aLibName )
-{
- sal_Bool bDone = sal_False;
-
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
-
- Reference< XFilePickerControlAccess > xFPControl(xFP, UNO_QUERY);
- xFPControl->enableControl(ExtendedFilePickerElementIds::CHECKBOX_PASSWORD, sal_False);
- Any aValue;
- aValue <<= (sal_Bool) sal_True;
- xFPControl->setValue(ExtendedFilePickerElementIds::CHECKBOX_AUTOEXTENSION, 0, aValue);
-
- String aCurPath( rCurPath );
- if ( aCurPath.Len() )
- xFP->setDisplayDirectory ( aCurPath );
-
- String aDialogStr( IDEResId( RID_STR_STDDIALOGNAME ) );
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( aDialogStr, String( RTL_CONSTASCII_USTRINGPARAM( "*.xdl" ) ) );
- xFltMgr->appendFilter( String( IDEResId( RID_STR_FILTER_ALLFILES ) ), String( RTL_CONSTASCII_USTRINGPARAM( FILTERMASK_ALL ) ) );
- xFltMgr->setCurrentFilter( aDialogStr );
-
- if( xFP->execute() == RET_OK )
- {
- Sequence< ::rtl::OUString > aPaths = xFP->getFiles();
- aCurPath = aPaths[0];
-
- ::rtl::OUString aBasePath;
- ::rtl::OUString aOUCurPath( aCurPath );
- sal_Int32 iSlash = aOUCurPath.lastIndexOf( '/' );
- if( iSlash != -1 )
- aBasePath = aOUCurPath.copy( 0, iSlash + 1 );
-
- try
- {
- // create dialog model
- Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY_THROW );
-
- Reference< XSimpleFileAccess > xSFI( xMSF->createInstance
- ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" )) ), UNO_QUERY_THROW );
-
- Reference< XInputStream > xInput;
- if( xSFI->exists( aCurPath ) )
- xInput = xSFI->openFileRead( aCurPath );
-
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
-
- String aXmlDlgName;
- Reference< beans::XPropertySet > xDialogModelPropSet( xDialogModel, UNO_QUERY );
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny = xDialogModelPropSet->getPropertyValue( DLGED_PROP_NAME );
- ::rtl::OUString aOUXmlDialogName;
- aXmlDialogNameAny >>= aOUXmlDialogName;
- aXmlDlgName = aOUXmlDialogName;
- }
- catch( beans::UnknownPropertyException& )
- {}
- }
- bool bValidName = (aXmlDlgName.Len() != 0);
- OSL_ASSERT( bValidName );
- if( !bValidName )
- return bDone;
-
- bool bDialogAlreadyExists = rDocument.hasDialog( aLibName, aXmlDlgName );
-
- String aNewDlgName = aXmlDlgName;
- enum NameClashMode
- {
- NO_CLASH,
- CLASH_OVERWRITE_DIALOG,
- CLASH_RENAME_DIALOG,
- };
- NameClashMode eNameClashMode = NO_CLASH;
- if( bDialogAlreadyExists )
- {
- String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_CLASH_TITLE ) );
- String aQueryBoxText( IDEResId( RID_STR_DLGIMP_CLASH_TEXT ) );
- aQueryBoxText.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "$(ARG1)" ) ), aXmlDlgName );
-
- NameClashQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox.Execute();
- if( RET_YES == nRet )
- {
- // RET_YES == Rename, see NameClashQueryBox::NameClashQueryBox
- eNameClashMode = CLASH_RENAME_DIALOG;
-
- aNewDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
- }
- else if( RET_NO == nRet )
- {
- // RET_NO == Replace, see NameClashQueryBox::NameClashQueryBox
- eNameClashMode = CLASH_OVERWRITE_DIALOG;
- }
- else if( RET_CANCEL == nRet )
- {
- return bDone;
- }
- }
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if( pIDEShell == NULL )
- {
- OSL_ASSERT( pIDEShell != NULL );
- return bDone;
- }
-
- // Resource?
- ::com::sun::star::lang::Locale aLocale = Application::GetSettings().GetUILocale();
- Reference< task::XInteractionHandler > xDummyHandler;
- bool bReadOnly = true;
- Reference< XStringResourceWithLocation > xImportStringResource =
- StringResourceWithLocation::create( xContext, aBasePath, bReadOnly,
- aLocale, aXmlDlgName, ::rtl::OUString(), xDummyHandler );
-
- Sequence< lang::Locale > aImportLocaleSeq = xImportStringResource->getLocales();
- sal_Int32 nImportLocaleCount = aImportLocaleSeq.getLength();
-
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) );
- Reference< resource::XStringResourceManager > xLibStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- sal_Int32 nLibLocaleCount = 0;
- Sequence< lang::Locale > aLibLocaleSeq;
- if( xLibStringResourceManager.is() )
- {
- aLibLocaleSeq = xLibStringResourceManager->getLocales();
- nLibLocaleCount = aLibLocaleSeq.getLength();
- }
-
- // Check language matches
- std::vector< lang::Locale > aOnlyInImportLanguages =
- implGetLanguagesOnlyContainedInFirstSeq( aImportLocaleSeq, aLibLocaleSeq );
- int nOnlyInImportLanguageCount = aOnlyInImportLanguages.size();
-
- // For now: Keep languages from lib
- bool bLibLocalized = (nLibLocaleCount > 0);
- bool bImportLocalized = (nImportLocaleCount > 0);
-
- bool bAddDialogLanguagesToLib = false;
- if( nOnlyInImportLanguageCount > 0 )
- {
- String aQueryBoxTitle( IDEResId( RID_STR_DLGIMP_MISMATCH_TITLE ) );
- String aQueryBoxText( IDEResId( RID_STR_DLGIMP_MISMATCH_TEXT ) );
- LanguageMismatchQueryBox aQueryBox( pWin, aQueryBoxTitle, aQueryBoxText );
- sal_uInt16 nRet = aQueryBox.Execute();
- if( RET_YES == nRet )
- {
- // RET_YES == Add, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
- bAddDialogLanguagesToLib = true;
- }
- // RET_NO == Omit, see LanguageMismatchQueryBox::LanguageMismatchQueryBox
- // -> nothing to do here
- //else if( RET_NO == nRet )
- //{
- //}
- else if( RET_CANCEL == nRet )
- {
- return bDone;
- }
- }
-
- if( bImportLocalized )
- {
- bool bCopyResourcesForDialog = true;
- if( bAddDialogLanguagesToLib )
- {
- LocalizationMgr* pCurMgr = pIDEShell->GetCurLocalizationMgr();
-
- lang::Locale aFirstLocale;
- aFirstLocale = aOnlyInImportLanguages[0];
- if( nOnlyInImportLanguageCount > 1 )
- {
- // Check if import default belongs to only import languages and use it then
- lang::Locale aImportDefaultLocale = xImportStringResource->getDefaultLocale();
- lang::Locale aTmpLocale;
- for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
- {
- aTmpLocale = aOnlyInImportLanguages[i];
- if( localesAreEqual( aImportDefaultLocale, aTmpLocale ) )
- {
- aFirstLocale = aImportDefaultLocale;
- break;
- }
- }
- }
-
- Sequence< lang::Locale > aFirstLocaleSeq( 1 );
- aFirstLocaleSeq[0] = aFirstLocale;
- pCurMgr->handleAddLocales( aFirstLocaleSeq );
-
- if( nOnlyInImportLanguageCount > 1 )
- {
- Sequence< lang::Locale > aRemainingLocaleSeq( nOnlyInImportLanguageCount - 1 );
- lang::Locale aTmpLocale;
- int iSeq = 0;
- for( int i = 0 ; i < nOnlyInImportLanguageCount ; ++i )
- {
- aTmpLocale = aOnlyInImportLanguages[i];
- if( !localesAreEqual( aFirstLocale, aTmpLocale ) )
- aRemainingLocaleSeq[iSeq++] = aTmpLocale;
- }
- pCurMgr->handleAddLocales( aRemainingLocaleSeq );
- }
- }
- else if( !bLibLocalized )
- {
- Reference< resource::XStringResourceManager > xImportStringResourceManager( xImportStringResource, UNO_QUERY );
- LocalizationMgr::resetResourceForDialog( xDialogModel, xImportStringResourceManager );
- bCopyResourcesForDialog = false;
- }
-
- if( bCopyResourcesForDialog )
- {
- Reference< resource::XStringResourceResolver > xImportStringResourceResolver( xImportStringResource, UNO_QUERY );
- LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, aXmlDlgName,
- xLibStringResourceManager, xImportStringResourceResolver );
- }
- }
- else if( bLibLocalized )
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xLibStringResourceManager );
- }
-
-
- LocalizationMgr::setStringResourceAtDialog( rDocument, aLibName, aNewDlgName, xDialogModel );
-
- if( eNameClashMode == CLASH_OVERWRITE_DIALOG )
- {
- if ( BasicIDE::RemoveDialog( rDocument, aLibName, aNewDlgName ) )
- {
- IDEBaseWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, aLibName, aNewDlgName, sal_False, sal_True );
- if( pDlgWin != NULL )
- pIDEShell->RemoveWindow( pDlgWin, sal_True );
- BasicIDE::MarkDocumentModified( rDocument );
- }
- else
- {
- // TODO: Assertion?
- return bDone;
- }
- }
-
- if( eNameClashMode == CLASH_RENAME_DIALOG )
- {
- bool bRenamed = false;
- if( xDialogModelPropSet.is() )
- {
- try
- {
- Any aXmlDialogNameAny;
- aXmlDialogNameAny <<= ::rtl::OUString( aNewDlgName );
- xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny );
- bRenamed = true;
- }
- catch( beans::UnknownPropertyException& )
- {}
- }
-
-
- if( bRenamed )
- {
- LocalizationMgr::renameStringResourceIDs( rDocument, aLibName, aNewDlgName, xDialogModel );
- }
- else
- {
- // TODO: Assertion?
- return bDone;
- }
- }
-
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- bool bSuccess = rDocument.insertDialog( aLibName, aNewDlgName, xISP );
- if( bSuccess )
- {
- DialogWindow* pNewDlgWin = pIDEShell->CreateDlgWin( rDocument, aLibName, aNewDlgName );
- pIDEShell->SetCurWindow( pNewDlgWin, sal_True );
- }
-
- bDone = sal_True;
- }
- catch( Exception& )
- {}
- }
-
- return bDone;
-}
-
-sal_Bool DialogWindow::ImportDialog()
-{
- DBG_CHKTHIS( DialogWindow, 0 );
-
- const ScriptDocument& rDocument = GetDocument();
- String aLibName = GetLibName();
- sal_Bool bRet = implImportDialog( this, aCurPath, rDocument, aLibName );
- return bRet;
-}
-
-DlgEdModel* DialogWindow::GetModel() const
-{
- return pEditor ? pEditor->GetModel() : NULL;
-}
-
-DlgEdPage* DialogWindow::GetPage() const
-{
- return pEditor ? pEditor->GetPage() : NULL;
-}
-
-DlgEdView* DialogWindow::GetView() const
-{
- return pEditor ? pEditor->GetView() : NULL;
-}
-
-sal_Bool DialogWindow::IsModified()
-{
- return pEditor->IsModified();
-}
-
-::svl::IUndoManager* DialogWindow::GetUndoManager()
-{
- return pUndoMgr;
-}
-
-String DialogWindow::GetTitle()
-{
- return GetName();
-}
-
-BasicEntryDescriptor DialogWindow::CreateEntryDescriptor()
-{
- ScriptDocument aDocument( GetDocument() );
- String aLibName( GetLibName() );
- String aLibSubName;
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, GetName(), OBJ_TYPE_DIALOG );
-}
-
-void DialogWindow::SetReadOnly( sal_Bool b )
-{
- if ( pEditor )
- {
- if ( b )
- pEditor->SetMode( DLGED_READONLY );
- else
- pEditor->SetMode( DLGED_SELECT );
- }
-}
-
-sal_Bool DialogWindow::IsReadOnly()
-{
- sal_Bool bReadOnly = sal_False;
-
- if ( pEditor && pEditor->GetMode() == DLGED_READONLY )
- bReadOnly = sal_True;
-
- return bReadOnly;
-}
-
-sal_Bool DialogWindow::IsPasteAllowed()
-{
- return pEditor ? pEditor->IsPasteAllowed() : sal_False;
-}
-
-void DialogWindow::StoreData()
-{
- if ( IsModified() )
- {
- try
- {
- Reference< container::XNameContainer > xLib = GetDocument().getLibrary( E_DIALOGS, GetLibName(), true );
-
- if( xLib.is() )
- {
- Reference< container::XNameContainer > xDialogModel = pEditor->GetDialog();
-
- if( xDialogModel.is() )
- {
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, GetDocument().isDocument() ? GetDocument().getDocument() : Reference< frame::XModel >() );
- xLib->replaceByName( ::rtl::OUString( GetName() ), makeAny( xISP ) );
- }
- }
- }
- catch ( uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- BasicIDE::MarkDocumentModified( GetDocument() );
- pEditor->ClearModifyFlag();
- }
-}
-
-void DialogWindow::Deactivating()
-{
- if ( IsModified() )
- BasicIDE::MarkDocumentModified( GetDocument() );
-}
-
-sal_Int32 DialogWindow::countPages( Printer* pPrinter )
-{
- return pEditor->countPages( pPrinter );
-}
-
-void DialogWindow::printPage( sal_Int32 nPage, Printer* pPrinter )
-{
- pEditor->printPage( nPage, pPrinter, CreateQualifiedName() );
-}
-
-void DialogWindow::DataChanged( const DataChangedEvent& rDCEvt )
-{
- if( (rDCEvt.GetType()==DATACHANGED_SETTINGS) && (rDCEvt.GetFlags() & SETTINGS_STYLE) )
- {
- InitSettings( sal_True, sal_True, sal_True );
- Invalidate();
- }
- else
- IDEBaseWindow::DataChanged( rDCEvt );
-}
-
-void DialogWindow::InitSettings(sal_Bool bFont,sal_Bool bForeground,sal_Bool bBackground)
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( bFont )
- {
- Font aFont;
- aFont = rStyleSettings.GetFieldFont();
- SetPointFont( aFont );
- }
-
- if( bForeground || bFont )
- {
- SetTextColor( rStyleSettings.GetFieldTextColor() );
- SetTextFillColor();
- }
-
- if( bBackground )
- SetBackground( rStyleSettings.GetFieldColor() );
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > DialogWindow::CreateAccessible()
-{
- return (::com::sun::star::accessibility::XAccessible*) new AccessibleDialogWindow( this );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basidectrlr.cxx b/basctl/source/basicide/basidectrlr.cxx
deleted file mode 100644
index 9b32530c1..000000000
--- a/basctl/source/basicide/basidectrlr.cxx
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <basidectrlr.hxx>
-#include <cppuhelper/queryinterface.hxx>
-#include <comphelper/sequence.hxx>
-#include <com/sun/star/beans/PropertyAttribute.hpp>
-
-#include <vcl/syswin.hxx>
-
-#include <basidesh.hxx>
-
-
-using namespace com::sun::star;
-using namespace com::sun::star::uno;
-using namespace com::sun::star::beans;
-
-
-#define PROPERTY_ID_ICONID 1
-#define PROPERTY_ICONID ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "IconId" ) )
-
-
-//----------------------------------------------------------------------------
-
-BasicIDEController::BasicIDEController( BasicIDEShell* pViewShell )
- :OPropertyContainer( m_aBHelper )
- ,SfxBaseController( pViewShell )
- ,m_nIconId( ICON_MACROLIBRARY )
-{
- registerProperty( PROPERTY_ICONID, PROPERTY_ID_ICONID, PropertyAttribute::READONLY, &m_nIconId, ::getCppuType( &m_nIconId ) );
-}
-
-//----------------------------------------------------------------------------
-
-BasicIDEController::~BasicIDEController()
-{
-}
-
-// XInterface
-//----------------------------------------------------------------------------
-
-Any SAL_CALL BasicIDEController::queryInterface( const Type & rType ) throw(RuntimeException)
-{
- Any aReturn = SfxBaseController::queryInterface( rType );
- if ( !aReturn.hasValue() )
- aReturn = OPropertyContainer::queryInterface( rType );
-
- return aReturn;
-}
-
-//----------------------------------------------------------------------------
-
-void SAL_CALL BasicIDEController::acquire() throw()
-{
- SfxBaseController::acquire();
-}
-
-//----------------------------------------------------------------------------
-
-void SAL_CALL BasicIDEController::release() throw()
-{
- SfxBaseController::release();
-}
-
-
-// XTypeProvider ( ::SfxBaseController )
-//----------------------------------------------------------------------------
-
-Sequence< Type > SAL_CALL BasicIDEController::getTypes() throw(RuntimeException)
-{
- Sequence< Type > aTypes = ::comphelper::concatSequences(
- SfxBaseController::getTypes(),
- OPropertyContainer::getTypes()
- );
-
- return aTypes;
-}
-
-//----------------------------------------------------------------------------
-
-Sequence< sal_Int8 > SAL_CALL BasicIDEController::getImplementationId() throw(RuntimeException)
-{
- static ::cppu::OImplementationId * pId = 0;
- if ( !pId )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pId )
- {
- static ::cppu::OImplementationId aId;
- pId = &aId;
- }
- }
- return pId->getImplementationId();
-}
-
-// XPropertySet
-//----------------------------------------------------------------------------
-
-Reference< beans::XPropertySetInfo > SAL_CALL BasicIDEController::getPropertySetInfo() throw(RuntimeException)
-{
- Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
- return xInfo;
-}
-
-// OPropertySetHelper
-//----------------------------------------------------------------------------
-
-::cppu::IPropertyArrayHelper& BasicIDEController::getInfoHelper()
-{
- return *getArrayHelper();
-}
-
-// OPropertyArrayUsageHelper
-//----------------------------------------------------------------------------
-
-::cppu::IPropertyArrayHelper* BasicIDEController::createArrayHelper( ) const
-{
- Sequence< Property > aProps;
- describeProperties( aProps );
- return new ::cppu::OPropertyArrayHelper( aProps );
-}
-
-//----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basides1.cxx b/basctl/source/basicide/basides1.cxx
deleted file mode 100644
index a82a8bbb5..000000000
--- a/basctl/source/basicide/basides1.cxx
+++ /dev/null
@@ -1,1399 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "docsignature.hxx"
-
-#define GLOBALOVERFLOW2
-#include <basic/sbx.hxx>
-#define _SVSTDARR_STRINGS
-#include <svl/svstdarr.hxx>
-#include <ide_pch.hxx>
-
-#define _SOLAR__PRIVATE 1
-
-// #define _SVX_NOIDERESIDS
-
-#define SI_NOCONTROL
-#define SI_NOSBXCONTROLS
-#define SI_NOITEMS
-#define SI_NODRW
-#define _VCTRLS_HXX
-
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <baside2.hxx>
-#include <baside3.hxx>
-#include <basobj.hxx>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <sbxitem.hxx>
-#include <managelang.hxx>
-#include <localizationmgr.hxx>
-#include <helpid.hrc>
-
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-#include <svtools/xtextedt.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
-#include <sfx2/minfitem.hxx>
-#include <sfx2/docfile.hxx>
-#include <com/sun/star/task/XStatusIndicator.hpp>
-#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-
-#include <algorithm>
-#include <memory>
-
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::frame;
-
-class SvxSearchItem;
-
-// Egal was, einfach ans aktuelle Fenster:
-void BasicIDEShell::ExecuteCurrent( SfxRequest& rReq )
-{
- if ( !pCurWin )
- return;
-
- switch ( rReq.GetSlot() )
- {
- case SID_BASICIDE_HIDECURPAGE:
- {
- pCurWin->StoreData();
- RemoveWindow( pCurWin, sal_False );
- }
- break;
- case SID_BASICIDE_DELETECURRENT:
- {
- ScriptDocument aDocument( pCurWin->GetDocument() );
- String aLibName = pCurWin->GetLibName();
- String aName = pCurWin->GetName();
-
- if ( pCurWin->ISA( ModulWindow ) )
- {
- // module
- if ( QueryDelModule( aName, pCurWin ) )
- {
- if ( aDocument.removeModule( aLibName, aName ) )
- {
- BasicIDE::MarkDocumentModified( aDocument );
- }
- }
- }
- else
- {
- // dialog
- if ( QueryDelDialog( aName, pCurWin ) )
- {
- if ( BasicIDE::RemoveDialog( aDocument, aLibName, aName ) )
- {
- RemoveWindow( pCurWin, sal_True );
- BasicIDE::MarkDocumentModified( aDocument );
- }
- }
- }
- }
- break;
- case SID_BASICIDE_RENAMECURRENT:
- {
- pTabBar->StartEditMode( pTabBar->GetCurPageId() );
- }
- break;
- case FID_SEARCH_NOW:
- {
- if ( pCurWin->ISA( ModulWindow ) )
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxItemSet* pArgs = rReq.GetArgs();
- // Leider kenne ich die ID nicht:
- sal_uInt16 nWhich = pArgs->GetWhichByPos( 0 );
- DBG_ASSERT( nWhich, "Wich fuer SearchItem ?" );
- const SfxPoolItem& rItem = pArgs->Get( nWhich );
- DBG_ASSERT( rItem.ISA( SvxSearchItem ), "Kein Searchitem!" );
- if ( rItem.ISA( SvxSearchItem ) )
- {
- // Item wegen der Einstellungen merken...
- IDE_DLL()->GetExtraData()->SetSearchItem( (const SvxSearchItem&)rItem );
- sal_uInt16 nFound = 0;
- sal_Bool bCanceled = sal_False;
- if ( ((const SvxSearchItem&)rItem).GetCommand() == SVX_SEARCHCMD_REPLACE_ALL )
- {
- sal_uInt16 nActModWindows = 0;
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) )
- nActModWindows++;
- pWin = aIDEWindowTable.Next();
- }
-
- if ( ( nActModWindows <= 1 ) || ( !((const SvxSearchItem&)rItem).GetSelection() && QueryBox( pCurWin, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHALLMODULES ) ) ).Execute() == RET_YES ) )
- {
- pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) )
- nFound = nFound + ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem );
- pWin = aIDEWindowTable.Next();
- }
- }
- else
- nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem );
-
- IDEResId nId( RID_STR_SEARCHREPLACES );
- String aReplStr( nId );
- aReplStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), String::CreateFromInt32( nFound ) );
- InfoBox( pCurWin, aReplStr ).Execute();
- }
- else
- {
- nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem );
- if ( !nFound && !((const SvxSearchItem&)rItem).GetSelection() )
- {
- // Andere Module durchsuchen...
- sal_Bool bChangeCurWindow = sal_False;
- aIDEWindowTable.Seek( pCurWin );
- // Erstmal beim naechsten Anfangen, ggf. spaeter von vorne
- IDEBaseWindow* pWin = aIDEWindowTable.Next();
- sal_Bool bSearchedFromStart = sal_False;
- while ( !nFound && !bCanceled && ( pWin || !bSearchedFromStart ) )
- {
- if ( !pWin )
- {
- SfxViewFrame* pViewFrame = GetViewFrame();
- SfxChildWindow* pChildWin = pViewFrame ? pViewFrame->GetChildWindow( SID_SEARCH_DLG ) : NULL;
- Window* pParent = pChildWin ? pChildWin->GetWindow() : NULL;
- QueryBox aQuery( pParent, WB_YES_NO|WB_DEF_YES, String( IDEResId( RID_STR_SEARCHFROMSTART ) ) );
- if ( aQuery.Execute() == RET_YES )
- {
- pWin = aIDEWindowTable.First();
- bSearchedFromStart = sal_True;
- }
- else
- bCanceled = sal_True;
- }
-
- if ( pWin && !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) )
- {
- if ( pWin != pCurWin )
- {
- // Groesse einstellen, damit die View
- // gleich richtig justiert werden kann.
- if ( pCurWin )
- pWin->SetSizePixel( pCurWin->GetSizePixel() );
- nFound = ((ModulWindow*)pWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True );
- }
- if ( nFound )
- {
- bChangeCurWindow = sal_True;
- break;
- }
- }
- if ( pWin && ( pWin != pCurWin ) )
- pWin = aIDEWindowTable.Next();
- else
- pWin = 0; // Dann sind wir durch...
- }
- if ( !nFound && bSearchedFromStart ) // Aktuelles von vorne...
- nFound = ((ModulWindow*)pCurWin)->StartSearchAndReplace( (const SvxSearchItem&)rItem, sal_True );
- if ( bChangeCurWindow )
- SetCurWindow( pWin, sal_True );
- }
- if ( !nFound && !bCanceled )
- InfoBox( pCurWin, String( IDEResId( RID_STR_SEARCHNOTFOUND ) ) ).Execute();
- }
-
- rReq.Done();
- }
- }
- }
- break;
- case FID_SEARCH_OFF:
- {
- if ( pCurWin && pCurWin->ISA( ModulWindow ) )
- pCurWin->GrabFocus();
- }
- break;
- case SID_UNDO:
- case SID_REDO:
- {
- if ( GetUndoManager() && pCurWin->AllowUndo() )
- {
- GetViewFrame()->ExecuteSlot( rReq );
- }
- }
- break;
- default:
- {
- pCurWin->ExecuteCommand( rReq );
- }
- }
-}
-
-// Egal, wer oben, Einfluss auf die Shell:
-void BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
-{
- sal_uInt16 nSlot = rReq.GetSlot();
- switch ( nSlot )
- {
- case SID_BASICSTOP:
- {
- // Evtl. nicht einfach anhalten, falls auf Brechpunkt!
- if ( pCurWin && pCurWin->IsA( TYPE( ModulWindow ) ) )
- ((ModulWindow*)pCurWin)->BasicStop();
- BasicIDE::StopBasic();
- }
- break;
-
- case SID_SAVEDOC:
- {
- if ( pCurWin )
- {
- // Daten ins BASIC zurueckschreiben
- StoreAllWindowData();
-
- // document basic
- ScriptDocument aDocument( pCurWin->GetDocument() );
- if ( aDocument.isDocument() )
- {
- uno::Reference< task::XStatusIndicator > xStatusIndicator;
-
- SFX_REQUEST_ARG( rReq, pStatusIndicatorItem, SfxUnoAnyItem, SID_PROGRESS_STATUSBAR_CONTROL, sal_False );
- if ( pStatusIndicatorItem )
- OSL_VERIFY( pStatusIndicatorItem->GetValue() >>= xStatusIndicator );
- else
- {
- // get statusindicator
- SfxViewFrame *pFrame_ = GetFrame();
- if ( pFrame_ )
- {
- uno::Reference< task::XStatusIndicatorFactory > xStatFactory(
- pFrame_->GetFrame().GetFrameInterface(),
- uno::UNO_QUERY );
- if( xStatFactory.is() )
- xStatusIndicator = xStatFactory->createStatusIndicator();
- }
-
- if ( xStatusIndicator.is() )
- rReq.AppendItem( SfxUnoAnyItem( SID_PROGRESS_STATUSBAR_CONTROL, uno::makeAny( xStatusIndicator ) ) );
- }
-
- aDocument.saveDocument( xStatusIndicator );
- }
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_DOC_MODIFIED );
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Invalidate( SID_SIGNATURE );
- }
- }
- }
- break;
- case SID_SIGNATURE:
- {
- if ( pCurWin )
- {
- ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() );
- if ( aSignature.supportsSignatures() )
- {
- aSignature.signScriptingContent();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_SIGNATURE );
- }
- }
- }
- break;
-
- case SID_BASICIDE_MODULEDLG:
- {
- if ( rReq.GetArgs() )
- {
- const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
- BasicIDE::Organize( rTabId.GetValue() );
- }
- else
- BasicIDE::Organize( 0 );
- }
- break;
- case SID_BASICIDE_CHOOSEMACRO:
- {
- BasicIDE::ChooseMacro( NULL, sal_False, ::rtl::OUString() );
- }
- break;
- case SID_BASICIDE_CREATEMACRO:
- case SID_BASICIDE_EDITMACRO:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO );
- BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager();
- DBG_ASSERT( pBasMgr, "Nichts selektiert im Basic-Baum ?" );
-
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
-
- StartListening( *pBasMgr, sal_True /* Nur einmal anmelden */ );
- String aLibName( rInfo.GetLib() );
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
- StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
- if ( !pBasic )
- {
- // load module and dialog library (if not loaded)
- aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
- aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
-
- // get Basic
- pBasic = pBasMgr->GetLib( aLibName );
- }
- DBG_ASSERT( pBasic, "Kein Basic!" );
-
- SetCurLib( aDocument, aLibName );
-
- if ( rReq.GetSlot() == SID_BASICIDE_CREATEMACRO )
- {
- SbModule* pModule = pBasic->FindModule( rInfo.GetModule() );
- if ( !pModule )
- {
- if ( rInfo.GetModule().Len() || !pBasic->GetModules()->Count() )
- {
- String aModName = rInfo.GetModule();
-
- ::rtl::OUString sModuleCode;
- if ( aDocument.createModule( aLibName, aModName, sal_False, sModuleCode ) )
- pModule = pBasic->FindModule( aModName );
- }
- else
- pModule = (SbModule*) pBasic->GetModules()->Get(0);
- }
- DBG_ASSERT( pModule, "Kein Modul!" );
- if ( !pModule->GetMethods()->Find( rInfo.GetMethod(), SbxCLASS_METHOD ) )
- BasicIDE::CreateMacro( pModule, rInfo.GetMethod() );
- }
- SfxViewFrame* pViewFrame = GetViewFrame();
- if ( pViewFrame )
- pViewFrame->ToTop();
- ModulWindow* pWin = FindBasWin( aDocument, aLibName, rInfo.GetModule(), sal_True );
- DBG_ASSERT( pWin, "Edit/Create Macro: Fenster wurde nicht erzeugt/gefunden!" );
- SetCurWindow( pWin, sal_True );
- pWin->EditMacro( rInfo.GetMethod() );
- }
- break;
- case SID_BASICIDE_OBJCAT:
- {
- ShowObjectDialog( sal_True, sal_True );
- }
- break;
- case SID_BASICIDE_NAMECHANGEDONTAB:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxUInt16Item &rTabId = (const SfxUInt16Item&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_TABID );
- const SfxStringItem &rModName = (const SfxStringItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MODULENAME );
- IDEBaseWindow* pWin = aIDEWindowTable.Get( rTabId.GetValue() );
- DBG_ASSERT( pWin, "Window nicht im Liste, aber in TabBar ?" );
- if ( pWin )
- {
- String aNewName( rModName.GetValue() );
- String aOldName( pWin->GetName() );
- if ( aNewName != aOldName )
- {
- bool bRenameOk = false;
- if ( pWin->IsA( TYPE( ModulWindow ) ) )
- {
- ModulWindow* pModWin = (ModulWindow*)pWin;
- String aLibName = ( pModWin->GetLibName() );
- ScriptDocument aDocument( pWin->GetDocument() );
-
- if ( BasicIDE::RenameModule( pModWin, aDocument, aLibName, aOldName, aNewName ) )
- {
- bRenameOk = true;
- // Because we listen for container events for script
- // modules, rename will delete the 'old' window
- // pWin has been invalidated, restore now
- pWin = FindBasWin( aDocument, aLibName, aNewName, sal_True );
- }
-
- }
- else if ( pWin->IsA( TYPE( DialogWindow ) ) )
- {
- DialogWindow* pDlgWin = (DialogWindow*)pWin;
- bRenameOk = pDlgWin->RenameDialog( aNewName );
- }
- if ( bRenameOk )
- {
- BasicIDE::MarkDocumentModified( pWin->GetDocument() );
- }
- else
- {
- // set old name in TabWriter
- sal_uInt16 nId = (sal_uInt16)aIDEWindowTable.GetKey( pWin );
- DBG_ASSERT( nId, "No entry in Tabbar!" );
- if ( nId )
- pTabBar->SetPageText( nId, aOldName );
- }
- }
-
- // set focus to current window
- pWin->GrabFocus();
- }
- }
- break;
- case SID_BASICIDE_STOREMODULESOURCE:
- case SID_BASICIDE_UPDATEMODULESOURCE:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxMacroInfoItem& rInfo = (const SfxMacroInfoItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_MACROINFO );
- BasicManager* pBasMgr = (BasicManager*)rInfo.GetBasicManager();
- DBG_ASSERT( pBasMgr, "Store source: Kein BasMgr?" );
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- ModulWindow* pWin = FindBasWin( aDocument, rInfo.GetLib(), rInfo.GetModule(), sal_False, sal_True );
- if ( pWin )
- {
- if ( rReq.GetSlot() == SID_BASICIDE_STOREMODULESOURCE )
- pWin->StoreData();
- else
- pWin->UpdateData();
- }
- }
- break;
- case SID_BASICIDE_STOREALLMODULESOURCES:
- case SID_BASICIDE_UPDATEALLMODULESOURCES:
- {
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- if ( !pWin->IsSuspended() && pWin->IsA( TYPE( ModulWindow ) ) )
- {
- if ( rReq.GetSlot() == SID_BASICIDE_STOREALLMODULESOURCES )
- pWin->StoreData();
- else
- pWin->UpdateData();
- }
- pWin = aIDEWindowTable.Next();
- }
- }
- break;
- case SID_BASICIDE_LIBSELECTED:
- case SID_BASICIDE_LIBREMOVED:
- case SID_BASICIDE_LIBLOADED:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SfxUsrAnyItem& rShellItem = (const SfxUsrAnyItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_DOCUMENT_MODEL );
- uno::Reference< frame::XModel > xModel( rShellItem.GetValue(), UNO_QUERY );
- ScriptDocument aDocument( xModel.is() ? ScriptDocument( xModel ) : ScriptDocument::getApplicationScriptDocument() );
- const SfxStringItem& rLibNameItem = (const SfxStringItem&)rReq.GetArgs()->Get( SID_BASICIDE_ARG_LIBNAME );
- String aLibName( rLibNameItem.GetValue() );
-
- if ( nSlot == SID_BASICIDE_LIBSELECTED )
- {
- // load module and dialog library (if not loaded)
- aDocument.loadLibraryIfExists( E_SCRIPTS, aLibName );
- aDocument.loadLibraryIfExists( E_DIALOGS, aLibName );
-
- // check password, if library is password protected and not verified
- sal_Bool bOK = sal_True;
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
- {
- String aPassword;
- bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
- }
- }
-
- if ( bOK )
- {
- SetCurLib( aDocument, aLibName, true, false );
- }
- else
- {
- // alten Wert einstellen...
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, sal_True, sal_False );
- }
- }
- else if ( nSlot == SID_BASICIDE_LIBREMOVED )
- {
- if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
- {
- RemoveWindows( aDocument, aLibName, sal_True );
- if ( aDocument == m_aCurDocument && aLibName == m_aCurLibName )
- {
- m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
- m_aCurLibName = String();
- // Kein UpdateWindows!
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR );
- }
- }
- }
- else // Loaded...
- UpdateWindows();
- }
- break;
- case SID_BASICIDE_NEWMODULE:
- {
- ModulWindow* pWin = CreateBasWin( m_aCurDocument, m_aCurLibName, String() );
- DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
- SetCurWindow( pWin, sal_True );
- }
- break;
- case SID_BASICIDE_NEWDIALOG:
- {
- DialogWindow* pWin = CreateDlgWin( m_aCurDocument, m_aCurLibName, String() );
- DBG_ASSERT( pWin, "New Module: Konnte Fenster nicht erzeugen!" );
- SetCurWindow( pWin, sal_True );
- }
- break;
- case SID_BASICIDE_SBXRENAMED:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- }
- break;
- case SID_BASICIDE_SBXINSERTED:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
- ScriptDocument aDocument( rSbxItem.GetDocument() );
- String aLibName( rSbxItem.GetLibName() );
- String aName( rSbxItem.GetName() );
- if ( !m_aCurLibName.Len() || ( aDocument == m_aCurDocument && aLibName == m_aCurLibName ) )
- {
- if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE )
- FindBasWin( aDocument, aLibName, aName, sal_True );
- else if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG )
- FindDlgWin( aDocument, aLibName, aName, sal_True );
- }
- }
- break;
- case SID_BASICIDE_SBXDELETED:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
- ScriptDocument aDocument( rSbxItem.GetDocument() );
- IDEBaseWindow* pWin = FindWindow( aDocument, rSbxItem.GetLibName(), rSbxItem.GetName(), rSbxItem.GetType(), sal_True );
- if ( pWin )
- RemoveWindow( pWin, sal_True );
- }
- break;
- case SID_BASICIDE_SHOWSBX:
- {
- DBG_ASSERT( rReq.GetArgs(), "arguments expected" );
- const SbxItem& rSbxItem = (const SbxItem&)rReq.GetArgs()->Get(SID_BASICIDE_ARG_SBX );
- ScriptDocument aDocument( rSbxItem.GetDocument() );
- String aLibName( rSbxItem.GetLibName() );
- String aName( rSbxItem.GetName() );
- SetCurLib( aDocument, aLibName );
- IDEBaseWindow* pWin = 0;
- if ( rSbxItem.GetType() == BASICIDE_TYPE_DIALOG )
- {
- pWin = FindDlgWin( aDocument, aLibName, aName, sal_True );
- }
- else if ( rSbxItem.GetType() == BASICIDE_TYPE_MODULE )
- {
- pWin = FindBasWin( aDocument, aLibName, aName, sal_True );
- }
- else if ( rSbxItem.GetType() == BASICIDE_TYPE_METHOD )
- {
- pWin = FindBasWin( aDocument, aLibName, aName, sal_True );
- ((ModulWindow*)pWin)->EditMacro( rSbxItem.GetMethodName() );
- }
- DBG_ASSERT( pWin, "Fenster wurde nicht erzeugt!" );
- SetCurWindow( pWin, sal_True );
- pTabBar->MakeVisible( pTabBar->GetCurPageId() );
- }
- break;
- case SID_SHOW_PROPERTYBROWSER:
- {
- GetViewFrame()->ChildWindowExecute( rReq );
- rReq.Done();
- }
- break;
- case SID_BASICIDE_SHOWWINDOW:
- {
- ::std::auto_ptr< ScriptDocument > pDocument;
-
- SFX_REQUEST_ARG( rReq, pDocumentItem, SfxStringItem, SID_BASICIDE_ARG_DOCUMENT, sal_False );
- if ( pDocumentItem )
- {
- String sDocumentCaption = pDocumentItem->GetValue();
- if ( sDocumentCaption.Len() )
- pDocument.reset( new ScriptDocument( ScriptDocument::getDocumentWithURLOrCaption( sDocumentCaption ) ) );
- }
-
- SFX_REQUEST_ARG( rReq, pDocModelItem, SfxUsrAnyItem, SID_BASICIDE_ARG_DOCUMENT_MODEL, sal_False );
- if ( !pDocument.get() && pDocModelItem )
- {
- uno::Reference< frame::XModel > xModel( pDocModelItem->GetValue(), UNO_QUERY );
- if ( xModel.is() )
- pDocument.reset( new ScriptDocument( xModel ) );
- }
-
- if ( !pDocument.get() )
- break;
-
- SFX_REQUEST_ARG( rReq, pLibNameItem, SfxStringItem, SID_BASICIDE_ARG_LIBNAME, sal_False );
- if ( !pLibNameItem )
- break;
-
- String aLibName( pLibNameItem->GetValue() );
- pDocument->loadLibraryIfExists( E_SCRIPTS, aLibName );
- SetCurLib( *pDocument, aLibName );
- SFX_REQUEST_ARG( rReq, pNameItem, SfxStringItem, SID_BASICIDE_ARG_NAME, sal_False );
- if ( pNameItem )
- {
- String aName( pNameItem->GetValue() );
- String aModType( String::CreateFromAscii( "Module" ) );
- String aDlgType( String::CreateFromAscii( "Dialog" ) );
- String aType( aModType );
- SFX_REQUEST_ARG( rReq, pTypeItem, SfxStringItem, SID_BASICIDE_ARG_TYPE, sal_False );
- if ( pTypeItem )
- aType = pTypeItem->GetValue();
-
- IDEBaseWindow* pWin = 0;
- if ( aType == aModType )
- pWin = FindBasWin( *pDocument, aLibName, aName, sal_False );
- else if ( aType == aDlgType )
- pWin = FindDlgWin( *pDocument, aLibName, aName, sal_False );
-
- if ( pWin )
- {
- SetCurWindow( pWin, sal_True );
- if ( pTabBar )
- pTabBar->MakeVisible( pTabBar->GetCurPageId() );
-
- if ( pWin->ISA( ModulWindow ) )
- {
- ModulWindow* pModWin = (ModulWindow*)pWin;
- SFX_REQUEST_ARG( rReq, pLineItem, SfxUInt32Item, SID_BASICIDE_ARG_LINE, sal_False );
- if ( pLineItem )
- {
- pModWin->AssertValidEditEngine();
- TextView* pTextView = pModWin->GetEditView();
- if ( pTextView )
- {
- TextEngine* pTextEngine = pTextView->GetTextEngine();
- if ( pTextEngine )
- {
- sal_uInt32 nLine = pLineItem->GetValue();
- sal_uInt32 nLineCount = 0;
- for ( sal_uInt32 i = 0, nCount = pTextEngine->GetParagraphCount(); i < nCount; ++i )
- nLineCount += pTextEngine->GetLineCount( i );
- if ( nLine > nLineCount )
- nLine = nLineCount;
- if ( nLine > 0 )
- --nLine;
-
- // scroll window and set selection
- long nVisHeight = pModWin->GetOutputSizePixel().Height();
- long nTextHeight = pTextEngine->GetTextHeight();
- if ( nTextHeight > nVisHeight )
- {
- long nMaxY = nTextHeight - nVisHeight;
- long nOldY = pTextView->GetStartDocPos().Y();
- long nNewY = nLine * pTextEngine->GetCharHeight() - nVisHeight / 2;
- nNewY = ::std::min( nNewY, nMaxY );
- pTextView->Scroll( 0, -( nNewY - nOldY ) );
- pTextView->ShowCursor( sal_False, sal_True );
- pModWin->GetEditVScrollBar().SetThumbPos( pTextView->GetStartDocPos().Y() );
- }
- sal_uInt16 nCol1 = 0, nCol2 = 0;
- SFX_REQUEST_ARG( rReq, pCol1Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN1, sal_False );
- if ( pCol1Item )
- {
- nCol1 = pCol1Item->GetValue();
- if ( nCol1 > 0 )
- --nCol1;
- nCol2 = nCol1;
- }
- SFX_REQUEST_ARG( rReq, pCol2Item, SfxUInt16Item, SID_BASICIDE_ARG_COLUMN2, sal_False );
- if ( pCol2Item )
- {
- nCol2 = pCol2Item->GetValue();
- if ( nCol2 > 0 )
- --nCol2;
- }
- TextSelection aSel( TextPaM( nLine, nCol1 ), TextPaM( nLine, nCol2 ) );
- pTextView->SetSelection( aSel );
- pTextView->ShowCursor();
- Window* pWindow_ = pTextView->GetWindow();
- if ( pWindow_ )
- pWindow_->GrabFocus();
- }
- }
- }
- }
- }
- }
- rReq.Done();
- }
- break;
-
- case SID_BASICIDE_MANAGE_LANG:
- {
- ManageLanguageDialog aDlg( GetCurWindow(), GetCurLocalizationMgr() );
- aDlg.Execute();
- rReq.Done();
- }
- break;
- }
-}
-
-void BasicIDEShell::GetState(SfxItemSet &rSet)
-{
- SfxWhichIter aIter(rSet);
- for ( sal_uInt16 nWh = aIter.FirstWhich(); 0 != nWh; nWh = aIter.NextWhich() )
- {
- switch ( nWh )
- {
- case SID_DOCINFO:
- {
- rSet.DisableItem( nWh );
- }
- break;
- case SID_SAVEDOC:
- {
- sal_Bool bDisable = sal_False;
-
- if ( pCurWin )
- {
- if ( !pCurWin->IsModified() )
- {
- ScriptDocument aDocument( pCurWin->GetDocument() );
- bDisable = ( !aDocument.isAlive() )
- || ( aDocument.isDocument() ? !aDocument.isDocumentModified() : !IsAppBasicModified() );
- }
- }
- else
- {
- bDisable = sal_True;
- }
-
- if ( bDisable )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_NEWWINDOW:
- case SID_SAVEASDOC:
- {
- rSet.DisableItem( nWh );
- }
- break;
- case SID_SIGNATURE:
- {
- sal_uInt16 nState = 0;
- if ( pCurWin )
- {
- ::basctl::DocumentSignature aSignature( pCurWin->GetDocument() );
- nState = aSignature.getScriptingSignatureState();
- }
- rSet.Put( SfxUInt16Item( SID_SIGNATURE, nState ) );
- }
- break;
- case SID_BASICIDE_MODULEDLG:
- {
- if ( StarBASIC::IsRunning() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_BASICIDE_CHOOSEMACRO:
- case SID_BASICIDE_OBJCAT:
- case SID_BASICIDE_SHOWSBX:
- case SID_BASICIDE_CREATEMACRO:
- case SID_BASICIDE_EDITMACRO:
- case SID_BASICIDE_NAMECHANGEDONTAB:
- {
- ;
- }
- break;
-
- case SID_BASICIDE_ADDWATCH:
- case SID_BASICIDE_REMOVEWATCH:
- case SID_BASICLOAD:
- case SID_BASICSAVEAS:
- case SID_BASICIDE_MATCHGROUP:
- {
- if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) )
- rSet.DisableItem( nWh );
- else if ( ( nWh == SID_BASICLOAD ) && ( StarBASIC::IsRunning() || ( pCurWin && pCurWin->IsReadOnly() ) ) )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_BASICRUN:
- case SID_BASICSTEPINTO:
- case SID_BASICSTEPOVER:
- case SID_BASICSTEPOUT:
- case SID_BASICIDE_TOGGLEBRKPNT:
- case SID_BASICIDE_MANAGEBRKPNTS:
- {
- if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) )
- rSet.DisableItem( nWh );
- else if ( StarBASIC::IsRunning() && !((ModulWindow*)pCurWin)->GetBasicStatus().bIsInReschedule )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_BASICCOMPILE:
- {
- if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) || StarBASIC::IsRunning() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_BASICSTOP:
- {
- // Stop immermoeglich, wenn irgendein Basic lauft...
- if ( !StarBASIC::IsRunning() )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_CHOOSE_CONTROLS:
- case SID_DIALOG_TESTMODE:
- {
- if( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) )
- rSet.DisableItem( nWh );
- }
- break;
- case SID_SHOW_FORMS:
- case SID_SHOW_HIDDEN:
- {
- rSet.DisableItem( nWh );
- }
- break;
- case SID_SEARCH_OPTIONS:
- {
- sal_uInt16 nOptions = 0;
- if( pCurWin )
- nOptions = pCurWin->GetSearchOptions();
- rSet.Put( SfxUInt16Item( SID_SEARCH_OPTIONS, nOptions ) );
- }
- break;
- case SID_BASICIDE_LIBSELECTOR:
- {
- String aName;
- if ( m_aCurLibName.Len() )
- {
- LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName );
- aName = CreateMgrAndLibStr( m_aCurDocument.getTitle( eLocation ), m_aCurLibName );
- }
- SfxStringItem aItem( SID_BASICIDE_LIBSELECTOR, aName );
- rSet.Put( aItem );
- }
- break;
- case SID_SEARCH_ITEM:
- {
- String aSelected = GetSelectionText( sal_True );
- SvxSearchItem& rItem = IDE_DLL()->GetExtraData()->GetSearchItem();
- rItem.SetSearchString( aSelected );
- rSet.Put( rItem );
- }
- break;
- case SID_BASICIDE_STAT_DATE:
- {
- String aDate;
- aDate = String( RTL_CONSTASCII_USTRINGPARAM( "Datum?!" ) );
- SfxStringItem aItem( SID_BASICIDE_STAT_DATE, aDate );
- rSet.Put( aItem );
- }
- break;
- case SID_DOC_MODIFIED:
- {
- String aModifiedMarker;
- sal_Bool bModified = sal_False;
-
- if ( pCurWin )
- {
- if ( pCurWin->IsModified() )
- bModified = sal_True;
- else
- {
- ScriptDocument aDocument( pCurWin->GetDocument() );
- bModified = aDocument.isDocument() ? aDocument.isDocumentModified() : IsAppBasicModified();
- }
- }
-
- if ( bModified )
- aModifiedMarker = '*';
-
- SfxStringItem aItem( SID_DOC_MODIFIED, aModifiedMarker );
- rSet.Put( aItem );
- }
- break;
- case SID_BASICIDE_STAT_TITLE:
- {
- if ( pCurWin )
- {
- String aTitle = pCurWin->CreateQualifiedName();
- SfxStringItem aItem( SID_BASICIDE_STAT_TITLE, aTitle );
- rSet.Put( aItem );
- }
- }
- break;
- // Werden vom Controller ausgewertet:
- case SID_ATTR_SIZE:
- case SID_ATTR_INSERT:
- break;
- case SID_UNDO:
- case SID_REDO:
- {
- if( GetUndoManager() ) // sonst rekursives GetState
- GetViewFrame()->GetSlotState( nWh, NULL, &rSet );
- }
- break;
- case SID_SHOW_PROPERTYBROWSER:
- {
- if ( GetViewFrame()->KnowsChildWindow( nWh ) )
- rSet.Put( SfxBoolItem( nWh, GetViewFrame()->HasChildWindow( nWh ) ) );
- else
- rSet.DisableItem( nWh );
- }
- break;
-
- case SID_BASICIDE_CURRENT_LANG:
- {
- if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 )
- rSet.DisableItem( nWh );
- else
- {
- String aItemStr;
- LocalizationMgr* pCurMgr = GetCurLocalizationMgr();
- if ( pCurMgr->isLibraryLocalized() )
- {
- Sequence< lang::Locale > aLocaleSeq = pCurMgr->getStringResourceManager()->getLocales();
- const lang::Locale* pLocale = aLocaleSeq.getConstArray();
- sal_Int32 i, nCount = aLocaleSeq.getLength();
-
- // Force different results for any combination of locales and default locale
- ::rtl::OUString aLangStr;
- for ( i = 0; i <= nCount; ++i )
- {
- lang::Locale aLocale;
- if( i < nCount )
- aLocale = pLocale[i];
- else
- aLocale = pCurMgr->getStringResourceManager()->getDefaultLocale();
-
- aLangStr += aLocale.Language;
- aLangStr += aLocale.Country;
- aLangStr += aLocale.Variant;
- }
- aItemStr = aLangStr;
- }
- rSet.Put( SfxStringItem( nWh, aItemStr ) );
- }
- }
- break;
-
- case SID_BASICIDE_MANAGE_LANG:
- {
- if( (pCurWin && pCurWin->IsReadOnly()) || GetCurLibName().Len() == 0 )
- rSet.DisableItem( nWh );
- }
- break;
- }
- }
- if ( pCurWin )
- pCurWin->GetState( rSet );
-}
-
-sal_Bool BasicIDEShell::HasUIFeature( sal_uInt32 nFeature )
-{
- sal_Bool bResult = sal_False;
-
- if ( (nFeature & BASICIDE_UI_FEATURE_SHOW_BROWSER) == BASICIDE_UI_FEATURE_SHOW_BROWSER )
- {
- // fade out (in) property browser in module (dialog) windows
- if ( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) && !pCurWin->IsReadOnly() )
- bResult = sal_True;
- }
-
- return bResult;
-}
-
-void BasicIDEShell::SetCurWindow( IDEBaseWindow* pNewWin, sal_Bool bUpdateTabBar, sal_Bool bRememberAsCurrent )
-{
- // Es muss ein EditWindow am Sfx gesetzt sein, sonst kommt kein
- // Resize, also stehen die Controls auf den Wiese...
- // Sieht dann sowieso besser aus, wenn das Modul-Layout angezeigt wird...
- if ( !pNewWin && ( GetWindow() != pModulLayout ) )
- {
- pModulLayout->Show();
- AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() );
- SetWindow( pModulLayout );
- EnableScrollbars( sal_False );
- aVScrollBar.Hide();
- }
-
- if ( pNewWin != pCurWin )
- {
- IDEBaseWindow* pPrevCurWin = pCurWin;
- pCurWin = pNewWin;
- if ( pPrevCurWin )
- {
- pPrevCurWin->Hide();
- pPrevCurWin->Deactivating();
-// pPrevCurWin->GetLayoutWindow()->Hide();
- if( pPrevCurWin->IsA( TYPE( DialogWindow ) ) )
- {
- ((DialogWindow*)pPrevCurWin)->DisableBrowser();
- }
- else
- {
- pModulLayout->SetModulWindow( NULL );
- }
- }
- if ( pCurWin )
- {
- AdjustPosSizePixel( Point( 0, 0 ), GetViewFrame()->GetWindow().GetOutputSizePixel() );
- if( pCurWin->IsA( TYPE( ModulWindow ) ) )
- {
- GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
- pModulLayout->SetModulWindow( (ModulWindow*)pCurWin );
- pModulLayout->Show();
- }
- else
- {
- pModulLayout->Hide();
- GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_DIALOGWINDOW );
- }
-
- if ( bRememberAsCurrent )
- {
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- {
- sal_uInt16 nCurrentType = pCurWin->IsA( TYPE( ModulWindow ) ) ? BASICIDE_TYPE_MODULE : BASICIDE_TYPE_DIALOG;
- LibInfoItem* pLibInfoItem = new LibInfoItem( pCurWin->GetDocument(), pCurWin->GetLibName(), pCurWin->GetName(), nCurrentType );
- pData->GetLibInfos().InsertInfo( pLibInfoItem );
- }
- }
-
- if ( GetViewFrame()->GetWindow().IsVisible() ) // sonst macht es spaeter der SFX
- pCurWin->Show();
-
- pCurWin->Init();
-
- if ( !IDE_DLL()->GetExtraData()->ShellInCriticalSection() )
- {
- Window* pFrameWindow = &GetViewFrame()->GetWindow();
- Window* pFocusWindow = Application::GetFocusWindow();
- while ( pFocusWindow && ( pFocusWindow != pFrameWindow ) )
- pFocusWindow = pFocusWindow->GetParent();
- if ( pFocusWindow ) // Focus in BasicIDE
- pNewWin->GrabFocus();
- }
- if( pCurWin->IsA( TYPE( DialogWindow ) ) )
- ((DialogWindow*)pCurWin)->UpdateBrowser();
- }
- if ( bUpdateTabBar )
- {
- sal_uLong nKey = aIDEWindowTable.GetKey( pCurWin );
- if ( pCurWin && ( pTabBar->GetPagePos( (sal_uInt16)nKey ) == TAB_PAGE_NOTFOUND ) )
- pTabBar->InsertPage( (sal_uInt16)nKey, pCurWin->GetTitle() ); // wurde neu eingeblendet
- pTabBar->SetCurPageId( (sal_uInt16)nKey );
- }
- if ( pCurWin && pCurWin->IsSuspended() ) // Wenn das Fenster im Fehlerfall angezeigt wird...
- pCurWin->SetStatus( pCurWin->GetStatus() & ~BASWIN_SUSPENDED );
- if ( pCurWin )
- {
- SetWindow( pCurWin );
- if ( pCurWin->GetDocument().isDocument() )
- SfxObjectShell::SetCurrentComponent( pCurWin->GetDocument().getDocument() );
- }
- else
- {
- SetWindow( pModulLayout );
- GetViewFrame()->GetWindow().SetHelpId( HID_BASICIDE_MODULWINDOW );
- SfxObjectShell::SetCurrentComponent( NULL );
- }
- SetUndoManager( pCurWin ? pCurWin->GetUndoManager() : 0 );
- InvalidateBasicIDESlots();
- EnableScrollbars( pCurWin ? sal_True : sal_False );
-
- if ( m_pCurLocalizationMgr )
- m_pCurLocalizationMgr->handleTranslationbar();
-
- ManageToolbars();
-
- // fade out (in) property browser in module (dialog) windows
- UIFeatureChanged();
- }
-}
-
-void BasicIDEShell::ManageToolbars()
-{
- static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ));
- static ::rtl::OUString aMacroBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/macrobar" ));
- static ::rtl::OUString aDialogBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/dialogbar" ));
- static ::rtl::OUString aInsertControlsBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" ));
- (void)aInsertControlsBarResName;
-
- if( !pCurWin )
- return;
-
- Reference< beans::XPropertySet > xFrameProps
- ( GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
- if ( xFrameProps.is() )
- {
- Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
- uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName );
- a >>= xLayoutManager;
- if ( xLayoutManager.is() )
- {
- xLayoutManager->lock();
- if( pCurWin->IsA( TYPE( DialogWindow ) ) )
- {
- xLayoutManager->destroyElement( aMacroBarResName );
-
- xLayoutManager->requestElement( aDialogBarResName );
- xLayoutManager->requestElement( aInsertControlsBarResName );
- }
- else
- {
- xLayoutManager->destroyElement( aDialogBarResName );
- xLayoutManager->destroyElement( aInsertControlsBarResName );
-
- xLayoutManager->requestElement( aMacroBarResName );
- }
- xLayoutManager->unlock();
- }
- }
-}
-
-IDEBaseWindow* BasicIDEShell::FindApplicationWindow()
-{
- return FindWindow( ScriptDocument::getApplicationScriptDocument() );
-}
-
-IDEBaseWindow* BasicIDEShell::FindWindow( const ScriptDocument& rDocument, const String& rLibName, const String& rName, sal_uInt16 nType, sal_Bool bFindSuspended )
-{
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- if ( !pWin->IsSuspended() || bFindSuspended )
- {
- if ( !rLibName.Len() || !rName.Len() || nType == BASICIDE_TYPE_UNKNOWN )
- {
- // return any non-suspended window
- return pWin;
- }
- 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();
- }
- return 0;
-}
-
-long BasicIDEShell::CallBasicErrorHdl( StarBASIC* pBasic )
-{
- long nRet = 0;
- ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
- if ( pModWin )
- nRet = pModWin->BasicErrorHdl( pBasic );
- return nRet;
-}
-
-long BasicIDEShell::CallBasicBreakHdl( StarBASIC* pBasic )
-{
- long nRet = 0;
- ModulWindow* pModWin = ShowActiveModuleWindow( pBasic );
- if ( pModWin )
- {
- sal_Bool bAppWindowDisabled, bDispatcherLocked;
- sal_uInt16 nWaitCount;
- SfxUInt16Item *pSWActionCount, *pSWLockViewCount;
- BasicIDE::BasicStopped( &bAppWindowDisabled, &bDispatcherLocked,
- &nWaitCount, &pSWActionCount, &pSWLockViewCount );
-
- nRet = pModWin->BasicBreakHdl( pBasic );
-
- if ( StarBASIC::IsRunning() ) // Falls abgebrochen...
- {
- if ( bAppWindowDisabled )
- Application::GetDefDialogParent()->Enable( sal_False );
-
- if ( nWaitCount )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- for ( sal_uInt16 n = 0; n < nWaitCount; n++ )
- pIDEShell->GetViewFrame()->GetWindow().EnterWait();
- }
- }
- }
- return nRet;
-}
-
-ModulWindow* BasicIDEShell::ShowActiveModuleWindow( StarBASIC* pBasic )
-{
- SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false );
-
- SbModule* pActiveModule = StarBASIC::GetActiveModule();
- SbClassModuleObject* pClassModuleObject = PTR_CAST(SbClassModuleObject,pActiveModule);
- if( pClassModuleObject != NULL )
- pActiveModule = pClassModuleObject->getClassModule();
-
- DBG_ASSERT( pActiveModule, "Kein aktives Modul im ErrorHdl?!" );
- if ( pActiveModule )
- {
- ModulWindow* pWin = 0;
- SbxObject* pParent = pActiveModule->GetParent();
- DBG_ASSERT( pParent && pParent->ISA( StarBASIC ), "Kein BASIC!" );
- StarBASIC* pLib = static_cast< StarBASIC* >( pParent );
- if ( pLib )
- {
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pLib );
- if ( pBasMgr )
- {
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- String aLibName = pLib->GetName();
- pWin = FindBasWin( aDocument, aLibName, pActiveModule->GetName(), sal_True );
- DBG_ASSERT( pWin, "Error/Step-Hdl: Fenster wurde nicht erzeugt/gefunden!" );
- SetCurLib( aDocument, aLibName );
- SetCurWindow( pWin, sal_True );
- }
- }
- BasicManager* pBasicMgr = BasicIDE::FindBasicManager( pBasic );
- if ( pBasicMgr )
- StartListening( *pBasicMgr, sal_True /* Nur einmal anmelden */ );
- return pWin;
- }
- return 0;
-}
-
-void BasicIDEShell::AdjustPosSizePixel( const Point &rPos, const Size &rSize )
-{
- // Nicht wenn minimiert, weil dann bei Restore der Text verschoben ist.
- if ( GetViewFrame()->GetWindow().GetOutputSizePixel().Height() == 0 )
- return;
-
- Size aSz( rSize );
- Size aScrollBarBoxSz( aScrollBarBox.GetSizePixel() );
- aSz.Height() -= aScrollBarBoxSz.Height();
-
- Size aOutSz( aSz );
- aSz.Width() -= aScrollBarBoxSz.Width();
- aScrollBarBox.SetPosPixel( Point( rSize.Width() - aScrollBarBoxSz.Width(), rSize.Height() - aScrollBarBoxSz.Height() ) );
- aVScrollBar.SetPosSizePixel( Point( rPos.X()+aSz.Width(), rPos.Y() ), Size( aScrollBarBoxSz.Width(), aSz.Height() ) );
- if ( bTabBarSplitted )
- {
- // SplitSize ist beim Resize 0 !
- long nSplitPos = pTabBar->GetSizePixel().Width();
- if ( nSplitPos > aSz.Width() )
- nSplitPos = aSz.Width();
- pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( nSplitPos, aScrollBarBoxSz.Height() ) );
- long nScrlStart = rPos.X() + nSplitPos;
- aHScrollBar.SetPosSizePixel( Point( nScrlStart, rPos.Y()+aSz.Height() ), Size( aSz.Width() - nScrlStart + 1, aScrollBarBoxSz.Height() ) );
- aHScrollBar.Update();
- }
- else
- {
- aHScrollBar.SetPosSizePixel( Point( rPos.X()+ aSz.Width()/2 - 1, rPos.Y()+aSz.Height() ), Size( aSz.Width()/2 + 2, aScrollBarBoxSz.Height() ) );
- pTabBar->SetPosSizePixel( Point( rPos.X(), rPos.Y()+aSz.Height() ), Size( aSz.Width()/2, aScrollBarBoxSz.Height() ) );
- }
-
- Window* pEdtWin = pCurWin ? pCurWin->GetLayoutWindow() : pModulLayout;
- if ( pEdtWin )
- {
- if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) )
- pEdtWin->SetPosSizePixel( rPos, aSz ); // Ohne ScrollBar
- else
- pEdtWin->SetPosSizePixel( rPos, aOutSz );
- }
-}
-
-Reference< XModel > BasicIDEShell::GetCurrentDocument() const
-{
- Reference< XModel > xDocument;
- if ( pCurWin && pCurWin->GetDocument().isDocument() )
- xDocument = pCurWin->GetDocument().getDocument();
- return xDocument;
-}
-
-void BasicIDEShell::Activate( sal_Bool bMDI )
-{
- SfxViewShell::Activate( bMDI );
-
- if ( bMDI )
- {
- if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) )
- ((DialogWindow*)pCurWin)->UpdateBrowser();
-
- ShowObjectDialog( sal_True, sal_False );
- }
-}
-
-void BasicIDEShell::Deactivate( sal_Bool bMDI )
-{
- // bMDI sal_True heisst, dass ein anderes MDI aktiviert wurde, bei einem
- // Deactivate durch eine MessageBox ist bMDI FALSE
- if ( bMDI )
- {
- if( pCurWin && pCurWin->IsA( TYPE( DialogWindow ) ) )
- {
- DialogWindow* pXDlgWin = (DialogWindow*)pCurWin;
- pXDlgWin->DisableBrowser();
- if( pXDlgWin->IsModified() )
- BasicIDE::MarkDocumentModified( pXDlgWin->GetDocument() );
- }
-
- // CanClose pruefen, damit auch beim deaktivieren der BasicIDE geprueft wird,
- // ob in einem Modul der Sourcecode zu gross ist...
- for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( /* !pWin->IsSuspended() && */ !pWin->CanClose() )
- {
- if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
- SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false );
- SetCurWindow( pWin, sal_True );
- break;
- }
- }
-
- ShowObjectDialog( sal_False, sal_False );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basides2.cxx b/basctl/source/basicide/basides2.cxx
deleted file mode 100644
index a2e0a85e1..000000000
--- a/basctl/source/basicide/basides2.cxx
+++ /dev/null
@@ -1,316 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "docsignature.hxx"
-
-#define SI_NOCONTROL
-#define SI_NOSBXCONTROLS
-
-#include <ide_pch.hxx>
-#include <basic/sbx.hxx>
-#include "basicrenderable.hxx"
-
-#include <com/sun/star/frame/XTitle.hpp>
-
-#include <vcl/sound.hxx>
-#include <basidesh.hxx>
-#include <basidesh.hrc>
-#include <baside2.hxx>
-#include <basdoc.hxx>
-#include <basobj.hxx>
-#include <svtools/texteng.hxx>
-#include <svtools/textview.hxx>
-#include <svtools/xtextedt.hxx>
-#include <tools/diagnose_ex.h>
-#include <sfx2/sfxdefs.hxx>
-#include <sfx2/signaturestate.hxx>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-namespace css = ::com::sun::star;
-
-IMPL_LINK_INLINE_START( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
-{
- ShowObjectDialog( sal_False, sal_True );
- return 0;
-}
-IMPL_LINK_INLINE_END( BasicIDEShell, ObjectDialogCancelHdl, ObjectCatalog *, EMPTYARG )
-
-Reference< view::XRenderable > BasicIDEShell::GetRenderable()
-{
- return Reference< view::XRenderable >( new basicide::BasicRenderable( pCurWin ) );
-}
-
-sal_Bool BasicIDEShell::HasSelection( sal_Bool /* bText */ ) const
-{
- sal_Bool bSel = sal_False;
- if ( pCurWin && pCurWin->ISA( ModulWindow ) )
- {
- TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView();
- if ( pEditView && pEditView->HasSelection() )
- bSel = sal_True;
- }
- return bSel;
-}
-
-String BasicIDEShell::GetSelectionText( sal_Bool bWholeWord )
-{
- String aText;
- if ( pCurWin && pCurWin->ISA( ModulWindow ) )
- {
- TextView* pEditView = ((ModulWindow*)pCurWin)->GetEditView();
- if ( pEditView )
- {
- if ( bWholeWord && !pEditView->HasSelection() )
- {
- aText = pEditView->GetTextEngine()->GetWord( pEditView->GetSelection().GetEnd() );
- }
- else
- {
- TextSelection aSel = pEditView->GetSelection();
- if ( !bWholeWord || ( aSel.GetStart().GetPara() == aSel.GetEnd().GetPara() ) )
- aText = pEditView->GetSelected();
- }
- }
- }
- return aText;
-}
-
-SfxPrinter* BasicIDEShell::GetPrinter( sal_Bool bCreate )
-{
- if ( pCurWin ) // && pCurWin->ISA( ModulWindow ) )
- {
- BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell();
- DBG_ASSERT( pDocShell, "DocShell ?!" );
- return pDocShell->GetPrinter( bCreate );
- }
- return 0;
-}
-
-sal_uInt16 BasicIDEShell::SetPrinter( SfxPrinter *pNewPrinter, sal_uInt16 nDiffFlags, bool )
-{
- (void)nDiffFlags;
- BasicDocShell* pDocShell = (BasicDocShell*)GetViewFrame()->GetObjectShell();
- DBG_ASSERT( pDocShell, "DocShell ?!" );
- pDocShell->SetPrinter( pNewPrinter );
- return 0;
-}
-
-void BasicIDEShell::SetMDITitle()
-{
- String aTitle;
-
- if ( m_aCurLibName.Len() )
- {
- LibraryLocation eLocation = m_aCurDocument.getLibraryLocation( m_aCurLibName );
- aTitle = m_aCurDocument.getTitle( eLocation );
- aTitle += '.';
- aTitle += m_aCurLibName;
- }
- else
- {
- aTitle = String( IDEResId( RID_STR_ALL ) );
- }
-
- ::basctl::DocumentSignature aCurSignature( m_aCurDocument );
- if ( aCurSignature.getScriptingSignatureState() == SIGNATURESTATE_SIGNATURES_OK )
- {
- aTitle += String::CreateFromAscii( " " );
- aTitle += String( IDEResId( RID_STR_SIGNED ) );
- aTitle += String::CreateFromAscii( " " );
- }
-
- SfxViewFrame* pViewFrame = GetViewFrame();
- if ( pViewFrame )
- {
- SfxObjectShell* pShell = pViewFrame->GetObjectShell();
- if ( pShell && aTitle != pShell->GetTitle( SFX_TITLE_CAPTION ) )
- {
- pShell->SetTitle( aTitle );
- pShell->SetModified( sal_False );
- }
-
- css::uno::Reference< css::frame::XController > xController = GetController ();
- css::uno::Reference< css::frame::XTitle > xTitle (xController, css::uno::UNO_QUERY);
- if (xTitle.is ())
- xTitle->setTitle (aTitle);
- }
-}
-
-void BasicIDEShell::DestroyModulWindowLayout()
-{
- delete pModulLayout;
- pModulLayout = 0;
-}
-
-
-void BasicIDEShell::UpdateModulWindowLayout( bool bBasicStopped )
-{
- if ( pModulLayout )
- {
- pModulLayout->GetStackWindow().UpdateCalls();
- pModulLayout->GetWatchWindow().UpdateWatches( bBasicStopped );
- }
-}
-
-void BasicIDEShell::CreateModulWindowLayout()
-{
- pModulLayout = new ModulWindowLayout( &GetViewFrame()->GetWindow() );
-}
-
-ModulWindow* BasicIDEShell::CreateBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName )
-{
- bCreatingWindow = sal_True;
-
- sal_uLong nKey = 0;
- ModulWindow* pWin = 0;
-
- String aLibName( rLibName );
- String aModName( rModName );
-
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
-
- uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-
- if ( !aModName.Len() )
- aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
-
- // Vielleicht gibt es ein suspendiertes?
- pWin = FindBasWin( rDocument, aLibName, aModName, sal_False, sal_True );
-
- if ( !pWin )
- {
- ::rtl::OUString aModule;
- bool bSuccess = false;
- if ( rDocument.hasModule( aLibName, aModName ) )
- bSuccess = rDocument.getModule( aLibName, aModName, aModule );
- else
- bSuccess = rDocument.createModule( aLibName, aModName, sal_True, aModule );
-
- if ( bSuccess )
- {
- pWin = FindBasWin( rDocument, aLibName, aModName, sal_False, sal_True );
- if( !pWin )
- {
- // new module window
- pWin = new ModulWindow( pModulLayout, rDocument, aLibName, aModName, aModule );
- nKey = InsertWindowInTable( pWin );
- }
- else // we've gotten called recursively ( via listener from createModule above ), get outta here
- return pWin;
- }
- }
- else
- {
- pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED );
- IDEBaseWindow* pTmp = aIDEWindowTable.First();
- while ( pTmp && !nKey )
- {
- if ( pTmp == pWin )
- nKey = aIDEWindowTable.GetCurKey();
- pTmp = aIDEWindowTable.Next();
- }
- DBG_ASSERT( nKey, "CreateBasWin: Kein Key- Fenster nicht gefunden!" );
- }
- if( nKey && xLib.is() && rDocument.isInVBAMode() )
- {
- // display a nice friendly name in the ObjectModule tab,
- // combining the objectname and module name, e.g. Sheet1 ( Financials )
- String sObjName;
- ModuleInfoHelper::getObjectName( xLib, rModName, sObjName );
- if( sObjName.Len() )
- {
- aModName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
- }
- }
- pTabBar->InsertPage( (sal_uInt16)nKey, aModName );
- pTabBar->Sort();
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- if ( !pCurWin )
- SetCurWindow( pWin, sal_False, sal_False );
-
- bCreatingWindow = sal_False;
- return pWin;
-}
-
-ModulWindow* BasicIDEShell::FindBasWin( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended )
-{
- ModulWindow* pModWin = 0;
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin && !pModWin )
- {
- if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( ModulWindow ) ) )
- {
- if ( !rLibName.Len() ) // nur irgendeins finden...
- pModWin = (ModulWindow*)pWin;
- else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rModName )
- pModWin = (ModulWindow*)pWin;
- }
- pWin = aIDEWindowTable.Next();
- }
- if ( !pModWin && bCreateIfNotExist )
- pModWin = CreateBasWin( rDocument, rLibName, rModName );
-
- return pModWin;
-}
-
-void BasicIDEShell::Move()
-{
- if ( pCurWin && pCurWin->ISA( ModulWindow ) )
- ((ModulWindow*)pCurWin)->FrameWindowMoved();
-}
-
-void BasicIDEShell::ShowCursor( bool bOn )
-{
- if ( pCurWin && pCurWin->ISA( ModulWindow ) )
- ((ModulWindow*)pCurWin)->ShowCursor( bOn );
-}
-
-// Hack for #101048
-sal_Int32 getBasicIDEShellCount( void );
-
-// Nur wenn Basicfenster oben:
-void BasicIDEShell::ExecuteBasic( SfxRequest& rReq )
-{
- if ( !pCurWin || !pCurWin->IsA( TYPE( ModulWindow ) ) )
- return;
-
- pCurWin->ExecuteCommand( rReq );
- sal_Int32 nCount = getBasicIDEShellCount();
- if( nCount )
- CheckWindows();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basides3.cxx b/basctl/source/basicide/basides3.cxx
deleted file mode 100644
index dc518e40f..000000000
--- a/basctl/source/basicide/basides3.cxx
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#define SI_NOCONTROL
-#define SI_NOSBXCONTROLS
-
-#include <basidesh.hrc>
-#include <ide_pch.hxx>
-
-
-#define _SOLAR__PRIVATE 1
-
-#include <basidesh.hxx>
-#include <baside2.hxx>
-#include <baside3.hxx>
-#include <basobj.hxx>
-#include <localizationmgr.hxx>
-#include <dlgedview.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <xmlscript/xmldlg_imexp.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace comphelper;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::io;
-
-
-DialogWindow* BasicIDEShell::CreateDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName )
-{
- bCreatingWindow = sal_True;
-
- sal_uLong nKey = 0;
- DialogWindow* pWin = 0;
- String aLibName( rLibName );
- String aDlgName( rDlgName );
-
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
-
- rDocument.getOrCreateLibrary( E_DIALOGS, aLibName );
-
- if ( !aDlgName.Len() )
- aDlgName = rDocument.createObjectName( E_DIALOGS, aLibName );
-
- // Vielleicht gibt es ein suspendiertes?
- pWin = FindDlgWin( rDocument, aLibName, aDlgName, sal_False, sal_True );
-
- if ( !pWin )
- {
- try
- {
- Reference< io::XInputStreamProvider > xISP;
- if ( rDocument.hasDialog( aLibName, aDlgName ) )
- rDocument.getDialog( aLibName, aDlgName, xISP );
- else
- rDocument.createDialog( aLibName, aDlgName, xISP );
-
- if ( xISP.is() )
- {
- // create dialog model
- Reference< lang::XMultiServiceFactory > xMSF = getProcessServiceFactory();
- Reference< container::XNameContainer > xDialogModel( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
- Reference< XInputStream > xInput( xISP->createInputStream() );
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rDocument.isDocument() ? rDocument.getDocument() : Reference< frame::XModel >() );
- LocalizationMgr::setStringResourceAtDialog( rDocument, rLibName, aDlgName, xDialogModel );
-
- // new dialog window
- pWin = new DialogWindow( &GetViewFrame()->GetWindow(), rDocument, aLibName, aDlgName, xDialogModel );
- nKey = InsertWindowInTable( pWin );
- }
- }
- catch ( uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- else
- {
- pWin->SetStatus( pWin->GetStatus() & ~BASWIN_SUSPENDED );
- IDEBaseWindow* pTmp = aIDEWindowTable.First();
- while ( pTmp && !nKey )
- {
- if ( pTmp == pWin )
- nKey = aIDEWindowTable.GetCurKey();
- pTmp = aIDEWindowTable.Next();
- }
- DBG_ASSERT( nKey, "CreateDlgWin: Kein Key - Fenster nicht gefunden!" );
- }
-
- if( pWin )
- {
- pWin->GrabScrollBars( &aHScrollBar, &aVScrollBar );
- pTabBar->InsertPage( (sal_uInt16)nKey, aDlgName );
- pTabBar->Sort();
- if ( !pCurWin )
- SetCurWindow( pWin, sal_False, sal_False );
- }
-
- bCreatingWindow = sal_False;
- return pWin;
-}
-
-DialogWindow* BasicIDEShell::FindDlgWin( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName, sal_Bool bCreateIfNotExist, sal_Bool bFindSuspended )
-{
- DialogWindow* pDlgWin = 0;
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin && !pDlgWin )
- {
- if ( ( !pWin->IsSuspended() || bFindSuspended ) && pWin->IsA( TYPE( DialogWindow ) ) )
- {
- if ( !rLibName.Len() ) // nur irgendeins finden...
- pDlgWin = (DialogWindow*)pWin;
- else if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName && pWin->GetName() == rDlgName )
- pDlgWin = (DialogWindow*)pWin;
- }
- pWin = aIDEWindowTable.Next();
- }
- if ( !pDlgWin && bCreateIfNotExist )
- pDlgWin = CreateDlgWin( rDocument, rLibName, rDlgName );
-
- return pDlgWin;
-}
-
-SdrView* BasicIDEShell::GetCurDlgView() const
-{
- if ( !pCurWin || !pCurWin->IsA( TYPE( DialogWindow ) ) )
- return NULL;
-
- DialogWindow* pWin = (DialogWindow*)pCurWin;
- return pWin->GetView();
-}
-
-// Nur wenn Dialogfenster oben:
-void BasicIDEShell::ExecuteDialog( SfxRequest& rReq )
-{
- if ( pCurWin && ( pCurWin->IsA( TYPE( DialogWindow) ) ||
- (rReq.GetSlot() == SID_IMPORT_DIALOG &&pCurWin->IsA( TYPE( ModulWindow) ) ) ) )
- {
- pCurWin->ExecuteCommand( rReq );
- }
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
deleted file mode 100644
index 7c90d17e1..000000000
--- a/basctl/source/basicide/basidesh.cxx
+++ /dev/null
@@ -1,1053 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-// CLOOKS:
-//#define _MENUBTN_HXX
-#define _SPIN_HXX
-#define _PRVWIN_HXX
-//#define _FIELD_HXX ***
-//#define _TAB_HXX ***
-#define _DIALOGS_HXX
-#define _SVRTF_HXX
-#define _ISETBRW_HXX
-#define _VCTRLS_HXX
-#define SI_NOCONTROL
-#define SI_NOSBXCONTROLS
-
-#define ITEMID_SIZE 0
-
-// Falls ohne PCH's:
-#include <ide_pch.hxx>
-
-
-#define _SOLAR__PRIVATE 1
-#include <basic/sbx.hxx>
-#include <svl/hint.hxx>
-#include <tools/diagnose_ex.h>
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <basdoc.hxx>
-#include <basobj.hxx>
-#include <bastypes.hxx>
-#include <basicbox.hxx>
-#include <objdlg.hxx>
-#include <sbxitem.hxx>
-#include <tbxctl.hxx>
-#include <iderdll2.hxx>
-#include <basidectrlr.hxx>
-#include <localizationmgr.hxx>
-
-#define BasicIDEShell
-#define SFX_TYPEMAP
-#include <idetemp.hxx>
-#include <basslots.hxx>
-#include <iderdll.hxx>
-#include <svx/pszctrl.hxx>
-#include <svx/insctrl.hxx>
-#include <svx/srchdlg.hxx>
-#include <svx/lboxctrl.hxx>
-#include <svx/tbcontrl.hxx>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/container/XContainer.hpp>
-#include <com/sun/star/container/XContainerListener.hpp>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-
-#include <svx/xmlsecctrl.hxx>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-using ::rtl::OUString;
-
-static const rtl::OUString sStandardLibName( RTL_CONSTASCII_USTRINGPARAM("Standard"));
-
-typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerBASE;
-
-class ContainerListenerImpl : public ContainerListenerBASE
-{
- BasicIDEShell* mpShell;
-public:
-
- ContainerListenerImpl( BasicIDEShell* pShell ) : mpShell( pShell ) {}
-
- ~ContainerListenerImpl()
- {
- }
-
- void addContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
- {
- try
- {
- uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, sal_False ), uno::UNO_QUERY );
- if ( xContainer.is() )
- {
- uno::Reference< container::XContainerListener > xContainerListener( this );
- xContainer->addContainerListener( xContainerListener );
- }
- }
- catch( uno::Exception& ) {}
- }
- void removeContainerListener( const ScriptDocument& rScriptDocument, const String& aLibName )
- {
- try
- {
- uno::Reference< container::XContainer > xContainer( rScriptDocument.getLibrary( E_SCRIPTS, aLibName, sal_False ), uno::UNO_QUERY );
- if ( xContainer.is() )
- {
- uno::Reference< container::XContainerListener > xContainerListener( this );
- xContainer->removeContainerListener( xContainerListener );
- }
- }
- catch( uno::Exception& ) {}
- }
-
- // XEventListener
- virtual void SAL_CALL disposing( const lang::EventObject& ) throw( uno::RuntimeException ) {}
-
- // XContainerListener
- virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event ) throw( uno::RuntimeException )
- {
- rtl::OUString sModuleName;
- if( mpShell && ( Event.Accessor >>= sModuleName ) )
- mpShell->FindBasWin( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, sal_True, sal_False );
- }
- virtual void SAL_CALL elementReplaced( const container::ContainerEvent& ) throw( com::sun::star::uno::RuntimeException ) { }
- virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event ) throw( com::sun::star::uno::RuntimeException )
- {
- rtl::OUString sModuleName;
- if( mpShell && ( Event.Accessor >>= sModuleName ) )
- {
- IDEBaseWindow* pWin = mpShell->FindWindow( mpShell->m_aCurDocument, mpShell->m_aCurLibName, sModuleName, BASICIDE_TYPE_MODULE, sal_True );
- if( pWin )
- mpShell->RemoveWindow( pWin, sal_True, sal_True );
- }
- }
-
-};
-
-TYPEINIT1( BasicIDEShell, SfxViewShell );
-
-SFX_IMPL_NAMED_VIEWFACTORY( BasicIDEShell, "Default" )
-{
- SFX_VIEW_REGISTRATION( BasicDocShell );
-}
-
-
-SFX_IMPL_INTERFACE( BasicIDEShell, SfxViewShell, IDEResId( RID_STR_IDENAME ) )
-{
- SFX_CHILDWINDOW_REGISTRATION( SID_SEARCH_DLG );
- SFX_FEATURED_CHILDWINDOW_REGISTRATION(SID_SHOW_PROPERTYBROWSER, BASICIDE_UI_FEATURE_SHOW_BROWSER);
- SFX_POPUPMENU_REGISTRATION( IDEResId( RID_POPUP_DLGED ) );
-}
-
-
-
-#define IDE_VIEWSHELL_FLAGS SFX_VIEW_CAN_PRINT|SFX_VIEW_NO_NEWWINDOW
-
-
-static sal_Int32 GnBasicIDEShellCount;
-sal_Int32 getBasicIDEShellCount( void )
- { return GnBasicIDEShellCount; }
-
-BasicIDEShell::BasicIDEShell( SfxViewFrame* pFrame_, SfxViewShell* /* pOldShell */ ) :
- SfxViewShell( pFrame_, IDE_VIEWSHELL_FLAGS ),
- m_aCurDocument( ScriptDocument::getApplicationScriptDocument() ),
- aHScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_HSCROLL | WB_DRAG ) ),
- aVScrollBar( &GetViewFrame()->GetWindow(), WinBits( WB_VSCROLL | WB_DRAG ) ),
- aScrollBarBox( &GetViewFrame()->GetWindow(), WinBits( WB_SIZEABLE ) ),
- m_bAppBasicModified( sal_False ),
- m_aNotifier( *this )
-{
- m_xLibListener = new ContainerListenerImpl( this );
- Init();
- GnBasicIDEShellCount++;
-}
-
-
-
-void BasicIDEShell::Init()
-{
- TbxControls::RegisterControl( SID_CHOOSE_CONTROLS );
- SvxPosSizeStatusBarControl::RegisterControl();
- SvxInsertStatusBarControl::RegisterControl();
- XmlSecStatusBarControl::RegisterControl( SID_SIGNATURE );
- SvxSimpleUndoRedoController::RegisterControl( SID_UNDO );
- SvxSimpleUndoRedoController::RegisterControl( SID_REDO );
-
- SvxSearchDialogWrapper::RegisterChildWindow( sal_False );
-
- IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_True;
-
- SetName( String( RTL_CONSTASCII_USTRINGPARAM( "BasicIDE" ) ) );
- SetHelpId( SVX_INTERFACE_BASIDE_VIEWSH );
-
- LibBoxControl::RegisterControl( SID_BASICIDE_LIBSELECTOR );
- LanguageBoxControl::RegisterControl( SID_BASICIDE_CURRENT_LANG );
-
- CreateModulWindowLayout();
-
- GetViewFrame()->GetWindow().SetBackground();
-
- pCurWin = 0;
- m_aCurDocument = ScriptDocument::getApplicationScriptDocument();
- pObjectCatalog = 0;
- bCreatingWindow = sal_False;
-
- m_pCurLocalizationMgr = NULL;
-
- pTabBar = new BasicIDETabBar( &GetViewFrame()->GetWindow() );
- pTabBar->SetSplitHdl( LINK( this, BasicIDEShell, TabBarSplitHdl ) );
- bTabBarSplitted = sal_False;
-
- nCurKey = 100;
- InitScrollBars();
- InitTabBar();
-
- SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), false, false );
-
- if ( IDE_DLL() && IDE_DLL()->pShell == NULL )
- IDE_DLL()->pShell = this;
-
- IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_False;
-
- // It's enough to create the controller ...
- // It will be public by using magic :-)
- new BasicIDEController( this );
-
- // Force updating the title ! Because it must be set to the controller
- // it has to be called directly after creating those controller.
- SetMDITitle ();
-
- UpdateWindows();
-}
-
-BasicIDEShell::~BasicIDEShell()
-{
- m_aNotifier.dispose();
-
- if ( IDE_DLL() && IDE_DLL()->pShell == this )
- IDE_DLL()->pShell = NULL;
-
- // Damit bei einem Basic-Fehler beim Speichern die Shell nicht sofort
- // wieder hoch kommt:
- IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_True;
-
- SetWindow( 0 );
- SetCurWindow( 0 );
-
- // Alle Fenster zerstoeren:
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- // Kein Store, passiert bereits, wenn die BasicManager zerstoert werden.
- delete pWin;
- pWin = aIDEWindowTable.Next();
- }
-
- aIDEWindowTable.Clear();
- delete pTabBar;
- delete pObjectCatalog;
- DestroyModulWindowLayout();
-
- ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
- // Destroy all ContainerListeners for Basic Container.
- if ( pListener )
- pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
-
- IDE_DLL()->GetExtraData()->ShellInCriticalSection() = sal_False;
-
- GnBasicIDEShellCount--;
-}
-
-void BasicIDEShell::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateWindows();
-}
-
-void BasicIDEShell::onDocumentOpened( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateWindows();
-}
-
-void BasicIDEShell::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
-{
- StoreAllWindowData();
-}
-
-void BasicIDEShell::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
-{
- // #i115671: Update SID_SAVEDOC after saving is completed
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_SAVEDOC );
-}
-
-void BasicIDEShell::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
-{
- StoreAllWindowData();
-}
-
-void BasicIDEShell::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicIDEShell::onDocumentClosed( const ScriptDocument& _rDocument )
-{
- if ( !_rDocument.isValid() )
- return;
-
- bool bSetCurWindow = false;
- bool bSetCurLib = ( _rDocument == m_aCurDocument );
-
- // remove all windows which belong to this document
- for ( sal_uLong nWin = aIDEWindowTable.Count(); nWin; )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin );
- if ( pWin->IsDocument( _rDocument ) )
- {
- if ( pWin->GetStatus() & (BASWIN_RUNNINGBASIC|BASWIN_INRESCHEDULE) )
- {
- pWin->AddStatus( BASWIN_TOBEKILLED );
- pWin->Hide();
- StarBASIC::Stop();
- // there's no notify
- pWin->BasicStopped();
- }
- else
- {
- pWin->StoreData();
- if ( pWin == pCurWin )
- bSetCurWindow = true;
- RemoveWindow( pWin, sal_True, sal_False );
- }
- }
- }
-
- // remove lib info
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- pData->GetLibInfos().RemoveInfoFor( _rDocument );
-
- if ( bSetCurLib )
- SetCurLib( ScriptDocument::getApplicationScriptDocument(), String::CreateFromAscii( "Standard" ), true, false );
- else if ( bSetCurWindow )
- SetCurWindow( FindApplicationWindow(), sal_True );
-}
-
-void BasicIDEShell::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
-{
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR, sal_True, sal_False );
- SetMDITitle();
-}
-
-void BasicIDEShell::onDocumentModeChanged( const ScriptDocument& _rDocument )
-{
- for ( sal_uLong nWin = aIDEWindowTable.Count(); nWin; )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( --nWin );
- if ( pWin->IsDocument( _rDocument ) && _rDocument.isDocument() )
- pWin->SetReadOnly( _rDocument.isReadOnly() );
- }
-}
-
-void BasicIDEShell::StoreAllWindowData( sal_Bool bPersistent )
-{
- for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- DBG_ASSERT( pWin, "PrepareClose: NULL-Pointer in Table?" );
- if ( !pWin->IsSuspended() )
- pWin->StoreData();
- }
-
- if ( bPersistent )
- {
- SFX_APP()->SaveBasicAndDialogContainer();
- SetAppBasicModified( sal_False );
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Update( SID_SAVEDOC );
- }
- }
-}
-
-
-sal_uInt16 BasicIDEShell::PrepareClose( sal_Bool bUI, sal_Bool bForBrowsing )
-{
- (void)bForBrowsing;
-
- // da es nach Drucken etc. (DocInfo) modifiziert ist, hier resetten
- GetViewFrame()->GetObjectShell()->SetModified(sal_False);
-
- if ( StarBASIC::IsRunning() )
- {
- if( bUI )
- {
- String aErrorStr( IDEResId( RID_STR_CANNOTCLOSE ) );
- Window *pParent = &GetViewFrame()->GetWindow();
- InfoBox( pParent, aErrorStr ).Execute();
- }
- return sal_False;
- }
- else
- {
- sal_Bool bCanClose = sal_True;
- for ( sal_uLong nWin = 0; bCanClose && ( nWin < aIDEWindowTable.Count() ); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( !pWin->CanClose() )
- {
- if ( m_aCurLibName.Len() && ( pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName ) )
- SetCurLib( ScriptDocument::getApplicationScriptDocument(), String(), false );
- SetCurWindow( pWin, sal_True );
- bCanClose = sal_False;
- }
- }
-
- if ( bCanClose )
- StoreAllWindowData( sal_False ); // Nicht auf Platte schreiben, das passiert am Ende automatisch
-
- return bCanClose;
- }
-}
-
-void BasicIDEShell::InitScrollBars()
-{
- aVScrollBar.SetLineSize( 300 );
- aVScrollBar.SetPageSize( 2000 );
- aHScrollBar.SetLineSize( 300 );
- aHScrollBar.SetPageSize( 2000 );
- aHScrollBar.Enable();
- aVScrollBar.Enable();
- aVScrollBar.Show();
- aHScrollBar.Show();
- aScrollBarBox.Show();
-}
-
-
-
-void BasicIDEShell::InitTabBar()
-{
- pTabBar->Enable();
- pTabBar->Show();
- pTabBar->SetSelectHdl( LINK( this, BasicIDEShell, TabBarHdl ) );
-}
-
-
-Size BasicIDEShell::GetOptimalSizePixel() const
-{
- return Size( 400, 300 );
-}
-
-
-
-void BasicIDEShell::OuterResizePixel( const Point &rPos, const Size &rSize )
-{
- // Adjust fliegt irgendwann raus...
- AdjustPosSizePixel( rPos, rSize );
-}
-
-
-IMPL_LINK_INLINE_START( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar )
-{
- (void)pTBar;
- bTabBarSplitted = sal_True;
- ArrangeTabBar();
-
- return 0;
-}
-IMPL_LINK_INLINE_END( BasicIDEShell, TabBarSplitHdl, TabBar *, pTBar )
-
-
-
-IMPL_LINK( BasicIDEShell, TabBarHdl, TabBar *, pCurTabBar )
-{
- sal_uInt16 nCurId = pCurTabBar->GetCurPageId();
- IDEBaseWindow* pWin = aIDEWindowTable.Get( nCurId );
- DBG_ASSERT( pWin, "Eintrag in TabBar passt zu keinem Fenster!" );
- SetCurWindow( pWin );
-
- return 0;
-}
-
-
-
-sal_Bool BasicIDEShell::NextPage( sal_Bool bPrev )
-{
- sal_Bool bRet = sal_False;
- sal_uInt16 nPos = pTabBar->GetPagePos( pTabBar->GetCurPageId() );
-
- if ( bPrev )
- --nPos;
- else
- ++nPos;
-
- if ( nPos < pTabBar->GetPageCount() )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.Get( pTabBar->GetPageId( nPos ) );
- SetCurWindow( pWin, sal_True );
- bRet = sal_True;
- }
-
- return bRet;
-}
-
-
-
-void BasicIDEShell::ArrangeTabBar()
-{
- Size aSz( GetViewFrame()->GetWindow().GetOutputSizePixel() );
- long nBoxPos = aScrollBarBox.GetPosPixel().X() - 1;
- long nPos = pTabBar->GetSplitSize();
- if ( nPos <= nBoxPos )
- {
- Point aPnt( pTabBar->GetPosPixel() );
- long nH = aHScrollBar.GetSizePixel().Height();
- pTabBar->SetPosSizePixel( aPnt, Size( nPos, nH ) );
- long nScrlStart = aPnt.X() + nPos;
- aHScrollBar.SetPosSizePixel( Point( nScrlStart, aPnt.Y() ), Size( nBoxPos - nScrlStart + 2, nH ) );
- aHScrollBar.Update();
- }
-}
-
-
-
-::svl::IUndoManager* BasicIDEShell::GetUndoManager()
-{
- ::svl::IUndoManager* pMgr = NULL;
- if( pCurWin )
- pMgr = pCurWin->GetUndoManager();
-
- return pMgr;
-}
-
-
-
-void BasicIDEShell::ShowObjectDialog( sal_Bool bShow, sal_Bool bCreateOrDestroy )
-{
- if ( bShow )
- {
- if ( !pObjectCatalog && bCreateOrDestroy )
- {
- pObjectCatalog = new ObjectCatalog( &GetViewFrame()->GetWindow() );
- // Position wird in BasicIDEData gemerkt und vom Dlg eingestellt
- if ( pObjectCatalog )
- {
- pObjectCatalog->SetCancelHdl( LINK( this, BasicIDEShell, ObjectDialogCancelHdl ) );
- BasicEntryDescriptor aDesc;
- IDEBaseWindow* pCurWin_ = GetCurWindow();
- if ( pCurWin_ )
- aDesc = pCurWin_->CreateEntryDescriptor();
- pObjectCatalog->SetCurrentEntry( aDesc );
- }
- }
-
- // Die allerletzten Aenderungen...
- if ( pCurWin )
- pCurWin->StoreData();
-
- if ( pObjectCatalog )
- {
- pObjectCatalog->UpdateEntries();
- pObjectCatalog->Show();
- }
- }
- else if ( pObjectCatalog )
- {
- pObjectCatalog->Hide();
- if ( bCreateOrDestroy )
- {
- // Wegen OS/2-Focus-Problem pObjectCatalog vorm delete auf NULL
- ObjectCatalog* pTemp = pObjectCatalog;
- pObjectCatalog = 0;
- delete pTemp;
- }
- }
-}
-
-
-
-void BasicIDEShell::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId&,
- const SfxHint& rHint, const TypeId& )
-{
- if ( IDE_DLL()->GetShell() )
- {
- if ( rHint.IsA( TYPE( SfxSimpleHint ) ) )
- {
- switch ( ((SfxSimpleHint&)rHint).GetId() )
- {
- case SFX_HINT_DYING:
- {
- EndListening( rBC, sal_True /* Alle abmelden */ );
- if ( pObjectCatalog )
- pObjectCatalog->UpdateEntries();
- }
- break;
- }
-
- if ( rHint.IsA( TYPE( SbxHint ) ) )
- {
- SbxHint& rSbxHint = (SbxHint&)rHint;
- sal_uLong nHintId = rSbxHint.GetId();
- if ( ( nHintId == SBX_HINT_BASICSTART ) ||
- ( nHintId == SBX_HINT_BASICSTOP ) )
- {
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICRUN );
- pBindings->Update( SID_BASICRUN );
- pBindings->Invalidate( SID_BASICCOMPILE );
- pBindings->Update( SID_BASICCOMPILE );
- pBindings->Invalidate( SID_BASICSTEPOVER );
- pBindings->Update( SID_BASICSTEPOVER );
- pBindings->Invalidate( SID_BASICSTEPINTO );
- pBindings->Update( SID_BASICSTEPINTO );
- pBindings->Invalidate( SID_BASICSTEPOUT );
- pBindings->Update( SID_BASICSTEPOUT );
- pBindings->Invalidate( SID_BASICSTOP );
- pBindings->Update( SID_BASICSTOP );
- pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT );
- pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT );
- pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS );
- pBindings->Update( SID_BASICIDE_MANAGEBRKPNTS );
- pBindings->Invalidate( SID_BASICIDE_MODULEDLG );
- pBindings->Update( SID_BASICIDE_MODULEDLG );
- pBindings->Invalidate( SID_BASICLOAD );
- pBindings->Update( SID_BASICLOAD );
- }
-
- if ( nHintId == SBX_HINT_BASICSTOP )
- {
- // Nicht nur bei Error/Break oder explizitem anhalten,
- // falls durch einen Programmierfehler das Update abgeschaltet ist.
- BasicIDE::BasicStopped();
- UpdateModulWindowLayout( true ); // Leer machen...
- if( m_pCurLocalizationMgr )
- m_pCurLocalizationMgr->handleBasicStopped();
- }
- else if( m_pCurLocalizationMgr )
- {
- m_pCurLocalizationMgr->handleBasicStarted();
- }
-
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- while ( pWin )
- {
- if ( nHintId == SBX_HINT_BASICSTART )
- pWin->BasicStarted();
- else
- pWin->BasicStopped();
- pWin = aIDEWindowTable.Next();
- }
- }
- }
- }
- }
-}
-
-
-
-void BasicIDEShell::CheckWindows()
-{
- sal_Bool bSetCurWindow = sal_False;
- for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( pWin->GetStatus() & BASWIN_TOBEKILLED )
- {
- pWin->StoreData();
- if ( pWin == pCurWin )
- bSetCurWindow = sal_True;
- RemoveWindow( pWin, sal_True, sal_False );
- nWin--;
- }
- }
- if ( bSetCurWindow )
- SetCurWindow( FindApplicationWindow(), sal_True );
-}
-
-
-
-void BasicIDEShell::RemoveWindows( const ScriptDocument& rDocument, const String& rLibName, sal_Bool bDestroy )
-{
- sal_Bool bChangeCurWindow = pCurWin ? sal_False : sal_True;
- for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( pWin->IsDocument( rDocument ) && pWin->GetLibName() == rLibName )
- {
- if ( pWin == pCurWin )
- bChangeCurWindow = sal_True;
- pWin->StoreData();
- RemoveWindow( pWin, bDestroy, sal_False );
- nWin--;
- }
- }
- if ( bChangeCurWindow )
- SetCurWindow( FindApplicationWindow(), sal_True );
-}
-
-
-
-void BasicIDEShell::UpdateWindows()
-{
- // Alle Fenster, die nicht angezeigt werden duerfen, entfernen
- sal_Bool bChangeCurWindow = pCurWin ? sal_False : sal_True;
- if ( m_aCurLibName.Len() )
- {
- for ( sal_uLong nWin = 0; nWin < aIDEWindowTable.Count(); nWin++ )
- {
- IDEBaseWindow* pWin = aIDEWindowTable.GetObject( nWin );
- if ( !pWin->IsDocument( m_aCurDocument ) || pWin->GetLibName() != m_aCurLibName )
- {
- if ( pWin == pCurWin )
- bChangeCurWindow = sal_True;
- pWin->StoreData();
- // Die Abfrage auf RUNNING verhindert den Absturz, wenn in Reschedule.
- // Fenster bleibt erstmal stehen, spaeter sowieso mal umstellen,
- // dass Fenster nur als Hidden markiert werden und nicht
- // geloescht.
- if ( !(pWin->GetStatus() & ( BASWIN_TOBEKILLED | BASWIN_RUNNINGBASIC | BASWIN_SUSPENDED ) ) )
- {
- RemoveWindow( pWin, sal_False, sal_False );
- nWin--;
- }
- }
- }
- }
-
- if ( bCreatingWindow )
- return;
-
- IDEBaseWindow* pNextActiveWindow = 0;
-
- // Alle anzuzeigenden Fenster anzeigen
- ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- StartListening( *doc->getBasicManager(), sal_True /* Nur einmal anmelden */ );
-
- // libraries
- Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- String aLibName = pLibNames[ i ];
-
- if ( !m_aCurLibName.Len() || ( *doc == m_aCurDocument && aLibName == m_aCurLibName ) )
- {
- // check, if library is password protected and not verified
- sal_Bool bProtected = sal_False;
- Reference< script::XLibraryContainer > xModLibContainer( doc->getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aLibName ) && !xPasswd->isLibraryPasswordVerified( aLibName ) )
- {
- bProtected = sal_True;
- }
- }
-
- if ( !bProtected )
- {
- LibInfoItem* pLibInfoItem = 0;
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- pLibInfoItem = pData->GetLibInfos().GetInfo( LibInfoKey( *doc, aLibName ) );
-
- // modules
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aLibName ) )
- {
- StarBASIC* pLib = doc->getBasicManager()->GetLib( aLibName );
- if ( pLib )
- ImplStartListening( pLib );
-
- try
- {
- Sequence< ::rtl::OUString > aModNames( doc->getObjectNames( E_SCRIPTS, aLibName ) );
- sal_Int32 nModCount = aModNames.getLength();
- const ::rtl::OUString* pModNames = aModNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
- {
- String aModName = pModNames[ j ];
- ModulWindow* pWin = FindBasWin( *doc, aLibName, aModName, sal_False );
- if ( !pWin )
- pWin = CreateBasWin( *doc, aLibName, aModName );
- if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
- pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_MODULE )
- {
- pNextActiveWindow = (IDEBaseWindow*)pWin;
- }
- }
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- // dialogs
- Reference< script::XLibraryContainer > xDlgLibContainer( doc->getLibraryContainer( E_DIALOGS ) );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aLibName ) )
- {
- try
- {
- Sequence< ::rtl::OUString > aDlgNames = doc->getObjectNames( E_DIALOGS, aLibName );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
-
- for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
- {
- String aDlgName = pDlgNames[ j ];
- // this find only looks for non-suspended windows;
- // suspended windows are handled in CreateDlgWin
- DialogWindow* pWin = FindDlgWin( *doc, aLibName, aDlgName, sal_False );
- if ( !pWin )
- pWin = CreateDlgWin( *doc, aLibName, aDlgName );
- if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
- pLibInfoItem->GetCurrentType() == BASICIDE_TYPE_DIALOG )
- {
- pNextActiveWindow = (IDEBaseWindow*)pWin;
- }
- }
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
- }
- }
- }
-
- if ( bChangeCurWindow )
- {
- if ( !pNextActiveWindow )
- pNextActiveWindow = FindApplicationWindow();
- SetCurWindow( pNextActiveWindow, sal_True );
- }
-}
-
-void BasicIDEShell::RemoveWindow( IDEBaseWindow* pWindow_, sal_Bool bDestroy, sal_Bool bAllowChangeCurWindow )
-{
- DBG_ASSERT( pWindow_, "Kann keinen NULL-Pointer loeschen!" );
- sal_uLong nKey = aIDEWindowTable.GetKey( pWindow_ );
- pTabBar->RemovePage( (sal_uInt16)nKey );
- aIDEWindowTable.Remove( nKey );
- if ( pWindow_ == pCurWin )
- {
- if ( bAllowChangeCurWindow )
- SetCurWindow( FindApplicationWindow(), sal_True );
- else
- SetCurWindow( NULL, sal_False );
- }
- if ( bDestroy )
- {
- if ( !( pWindow_->GetStatus() & BASWIN_INRESCHEDULE ) )
- {
- delete pWindow_;
- }
- else
- {
- pWindow_->AddStatus( BASWIN_TOBEKILLED );
- pWindow_->Hide();
- // In normal mode stop basic in windows to be deleted
- // In VBA stop basic only if the running script is trying to delete
- // its parent module
- bool bStop = true;
- if ( pWindow_->GetDocument().isInVBAMode() )
- {
- SbModule* pMod = StarBASIC::GetActiveModule();
- if ( !pMod || ( pMod && ( pMod->GetName() != pWindow_->GetName() ) ) )
- bStop = false;
- }
- if ( bStop )
- {
- StarBASIC::Stop();
- // Es kommt kein Notify...
- pWindow_->BasicStopped();
- }
- aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen
- }
- }
- else
- {
- pWindow_->Hide();
- pWindow_->AddStatus( BASWIN_SUSPENDED );
- pWindow_->Deactivating();
- aIDEWindowTable.Insert( nKey, pWindow_ ); // wieder einhaegen
- }
-
-}
-
-
-
-sal_uInt16 BasicIDEShell::InsertWindowInTable( IDEBaseWindow* pNewWin )
-{
- // Eigentlich prueffen,
- nCurKey++;
- aIDEWindowTable.Insert( nCurKey, pNewWin );
- return nCurKey;
-}
-
-
-
-void BasicIDEShell::InvalidateBasicIDESlots()
-{
- // Nur die, die eine optische Auswirkung haben...
-
- if ( IDE_DLL()->GetShell() )
- {
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_UNDO );
- pBindings->Invalidate( SID_REDO );
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Invalidate( SID_SIGNATURE );
- pBindings->Invalidate( SID_BASICIDE_CHOOSEMACRO );
- pBindings->Invalidate( SID_BASICIDE_MODULEDLG );
- pBindings->Invalidate( SID_BASICIDE_OBJCAT );
- pBindings->Invalidate( SID_BASICSTOP );
- pBindings->Invalidate( SID_BASICRUN );
- pBindings->Invalidate( SID_BASICCOMPILE );
- pBindings->Invalidate( SID_BASICLOAD );
- pBindings->Invalidate( SID_BASICSAVEAS );
- pBindings->Invalidate( SID_BASICIDE_MATCHGROUP );
- pBindings->Invalidate( SID_BASICSTEPINTO );
- pBindings->Invalidate( SID_BASICSTEPOVER );
- pBindings->Invalidate( SID_BASICSTEPOUT );
- pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT );
- pBindings->Invalidate( SID_BASICIDE_MANAGEBRKPNTS );
- pBindings->Invalidate( SID_BASICIDE_ADDWATCH );
- pBindings->Invalidate( SID_BASICIDE_REMOVEWATCH );
- pBindings->Invalidate( SID_CHOOSE_CONTROLS );
- pBindings->Invalidate( SID_PRINTDOC );
- pBindings->Invalidate( SID_PRINTDOCDIRECT );
- pBindings->Invalidate( SID_SETUPPRINTER );
- pBindings->Invalidate( SID_DIALOG_TESTMODE );
-
- pBindings->Invalidate( SID_DOC_MODIFIED );
- pBindings->Invalidate( SID_BASICIDE_STAT_TITLE );
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- pBindings->Invalidate( SID_ATTR_INSERT );
- pBindings->Invalidate( SID_ATTR_SIZE );
- }
- }
-}
-
-void BasicIDEShell::EnableScrollbars( sal_Bool bEnable )
-{
- if ( bEnable )
- {
- aHScrollBar.Enable();
- aVScrollBar.Enable();
- }
- else
- {
- aHScrollBar.Disable();
- aVScrollBar.Disable();
- }
-}
-
-void BasicIDEShell::SetCurLib( const ScriptDocument& rDocument, String aLibName, bool bUpdateWindows, bool bCheck )
-{
- if ( !bCheck || ( rDocument != m_aCurDocument || aLibName != m_aCurLibName ) )
- {
- ContainerListenerImpl* pListener = static_cast< ContainerListenerImpl* >( m_xLibListener.get() );
-
- m_aCurDocument = rDocument;
- m_aCurLibName = aLibName;
-
- if ( pListener )
- {
- pListener->removeContainerListener( m_aCurDocument, m_aCurLibName );
- pListener->addContainerListener( m_aCurDocument, aLibName );
- }
-
- if ( bUpdateWindows )
- UpdateWindows();
-
- SetMDITitle();
-
- SetCurLibForLocalization( rDocument, aLibName );
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR );
- pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
- pBindings->Invalidate( SID_BASICIDE_MANAGE_LANG );
- }
- }
-}
-
-void BasicIDEShell::SetCurLibForLocalization( const ScriptDocument& rDocument, String aLibName )
-{
- // Create LocalizationMgr
- delete m_pCurLocalizationMgr;
- Reference< resource::XStringResourceManager > xStringResourceManager;
- try
- {
- if( aLibName.Len() )
- {
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) );
- xStringResourceManager = LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- }
- }
- catch ( container::NoSuchElementException& )
- {}
- m_pCurLocalizationMgr = new LocalizationMgr
- ( this, rDocument, aLibName, xStringResourceManager );
-
- m_pCurLocalizationMgr->handleTranslationbar();
-}
-
-void BasicIDEShell::ImplStartListening( StarBASIC* pBasic )
-{
- StartListening( pBasic->GetBroadcaster(), sal_True /* Nur einmal anmelden */ );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basidesh.src b/basctl/source/basicide/basidesh.src
deleted file mode 100644
index babb05aab..000000000
--- a/basctl/source/basicide/basidesh.src
+++ /dev/null
@@ -1,638 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <baside2.hrc>
-#include <helpid.hrc>
-#ifndef _GLOBLMN_HRC
-#include <svx/globlmn.hrc>
-#endif
-#include "dlgresid.hrc"
-#include <sfx2/sfxcommands.h>
-#include <svx/svxcommands.h>
-
-#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
-
-String RID_STR_IDENAME
-{
- Text = "BasicIDE" ;
-};
-String RID_STR_FILTER_ALLFILES
-{
- Text [ en-US ] = "<All>" ;
-};
-String RID_STR_NOMODULE
-{
- Text [ en-US ] = "< No Module >" ;
-};
-String RID_STR_WRONGPASSWORD
-{
- Text [ en-US ] = "Incorrect Password" ;
-};
-String RID_STR_OPEN
-{
- Text [ en-US ] = "Load" ;
-};
-String RID_STR_SAVE
-{
- Text [ en-US ] = "Save" ;
-};
-String RID_STR_SOURCETOBIG
-{
- Text [ en-US ] = "The source text is too large and can be neither compiled nor saved.\nDelete some of the comments or transfer some methods into another module." ;
-};
-String RID_STR_ERROROPENSTORAGE
-{
- Text [ en-US ] = "Error opening file" ;
-};
-String RID_STR_ERROROPENLIB
-{
- Text [ en-US ] = "Error loading library" ;
-};
-String RID_STR_NOLIBINSTORAGE
-{
- Text [ en-US ] = "The file does not contain any BASIC libraries" ;
-};
-String RID_STR_BADSBXNAME
-{
- Text [ en-US ] = "Invalid Name" ;
-};
-String RID_STR_LIBNAMETOLONG
-{
- Text [ en-US ] = "A library name can have up to 30 characters.";
-};
-String RID_STR_ERRORCHOOSEMACRO
-{
- Text [ en-US ] = "Macros from other documents are not accessible.";
-};
-String RID_STR_LIBISREADONLY
-{
- Text [ en-US ] = "This library is read-only.";
-};
-String RID_STR_REPLACELIB
-{
- Text [ en-US ] = "'XX' cannot be replaced.";
-};
-String RID_STR_IMPORTNOTPOSSIBLE
-{
- Text [ en-US ] = "'XX' cannot be added.";
-};
-String RID_STR_NOIMPORT
-{
- Text [ en-US ] = "'XX' was not added.";
-};
-String RID_STR_ENTERPASSWORD
-{
- Text [ en-US ] = "Enter password for 'XX'";
-};
-String RID_STR_SBXNAMEALLREADYUSED
-{
- Text [ en-US ] = "Name already exists" ;
-};
-String RID_STR_SIGNED
-{
- Text [ en-US ] = "(Signed)" ;
-};
-String RID_STR_SBXNAMEALLREADYUSED2
-{
- Text [ en-US ] = "Object with same name already exists" ;
-};
-String RID_STR_FILEEXISTS
-{
- Text [ en-US ] = "The 'XX' file already exists" ;
-};
-String RID_STR_CANNOTRUNMACRO
-{
- Text [ en-US ] = "For security reasons, you cannot run this macro.\n\nFor more information, check the security settings." ;
-};
-String RID_STR_COMPILEERROR
-{
- Text [ en-US ] = "Compile Error: " ;
-};
-String RID_STR_RUNTIMEERROR
-{
- Text [ en-US ] = "Runtime Error: #" ;
-};
-String RID_STR_SEARCHNOTFOUND
-{
- Text [ en-US ] = "Search key not found" ;
-};
-String RID_STR_SEARCHFROMSTART
-{
- Text [ en-US ] = "Search to last module complete. Continue at first module?" ;
-};
-String RID_STR_SEARCHREPLACES
-{
- Text [ en-US ] = "Search key replaced XX times" ;
-};
-String RID_STR_COULDNTREAD
-{
- Text [ en-US ] = "The file could not be read" ;
-};
-String RID_STR_COULDNTWRITE
-{
- Text [ en-US ] = "The file could not be saved" ;
-};
-String RID_STR_CANNOTCHANGENAMESTDLIB
-{
- Text [ en-US ] = "The name of the default library cannot be changed." ;
-};
-String RID_STR_CANNOTCHANGENAMEREFLIB
-{
- Text [ en-US ] = "The name of a referenced library cannot be changed." ;
-};
-String RID_STR_CANNOTUNLOADSTDLIB
-{
- Text [ en-US ] = "The default library cannot be deactivated" ;
-};
-String RID_STR_GENERATESOURCE
-{
- Text [ en-US ] = "Generating source" ;
-};
-String RID_STR_FILENAME
-{
- Text [ en-US ] = "File name:" ;
-};
-String RID_STR_APPENDLIBS
-{
- Text [ en-US ] = "Import Libraries" ;
-};
-String RID_STR_QUERYDELMACRO
-{
- Text [ en-US ] = "Do you want to delete the macro XX?" ;
-};
-String RID_STR_QUERYDELDIALOG
-{
- Text [ en-US ] = "Do you want to delete the XX dialog?" ;
-};
-String RID_STR_QUERYDELLIB
-{
- Text [ en-US ] = "Do you want to delete the XX library?" ;
-};
-String RID_STR_QUERYDELLIBREF
-{
- Text [ en-US ] = "Do you want to delete the reference to the XX library?" ;
-};
-String RID_STR_QUERYDELMODULE
-{
- Text [ en-US ] = "Do you want to delete the XX module?" ;
-};
-String RID_STR_OBJNOTFOUND
-{
- Text [ en-US ] = "Object or method not found" ;
-};
-String RID_STR_BASIC
-{
- Text [ en-US ] = "BASIC" ;
-};
-String RID_STR_LINE
-{
- // Abkuerzung fuer 'Zeile'
- Text [ en-US ] = "Ln" ;
-};
-String RID_STR_COLUMN
-{
- // Abkuerzung fuer 'Spalte'
- Text [ en-US ] = "Col" ;
-};
-String RID_STR_DOC
-{
- Text [ en-US ] = "Document" ;
-};
-String RID_BASICIDE_OBJECTBAR
-{
- Text [ en-US ] = "Macro Bar" ;
-};
-String RID_STR_CANNOTCLOSE
-{
- Text [ en-US ] = "The window cannot be closed while BASIC is running." ;
-};
-String RID_STR_REPLACESTDLIB
-{
- Text [ en-US ] = "The default library cannot be replaced." ;
-};
-String RID_STR_REFNOTPOSSIBLE
-{
- Text [ en-US ] = "Reference to 'XX' not possible." ;
-};
-String RID_STR_WATCHNAME
-{
- Text [ en-US ] = "Watch" ;
-};
-String RID_STR_WATCHVARIABLE
-{
- Text [ en-US ] = "Variable" ;
-};
-String RID_STR_WATCHVALUE
-{
- Text [ en-US ] = "Value" ;
-};
-String RID_STR_WATCHTYPE
-{
- Text [ en-US ] = "Type" ;
-};
-String RID_STR_STACKNAME
-{
- Text [ en-US ] = "Call Stack" ;
-};
-String RID_STR_INITIDE
-{
- Text [ en-US ] = "BASIC Initialization" ;
-};
-String RID_STR_STDMODULENAME
-{
- Text [ en-US ] = "Module" ;
-};
-String RID_STR_STDDIALOGNAME
-{
- Text [ en-US ] = "Dialog" ;
-};
-String RID_STR_STDLIBNAME
-{
- Text [ en-US ] = "Library" ;
-};
-String RID_STR_NEWLIB
-{
- Text [ en-US ] = "New Library" ;
-};
-String RID_STR_NEWMOD
-{
- Text [ en-US ] = "New Module" ;
-};
-String RID_STR_NEWDLG
-{
- Text [ en-US ] = "New Dialog" ;
-};
-String RID_STR_ALL
-{
- Text [ en-US ] = "All" ;
-};
-String RID_STR_PAGE
-{
- Text [ en-US ] = "Page" ;
-};
-String RID_STR_MACRONAMEREQ
-{
- Text [ en-US ] = "A name must be entered." ;
-};
-String RID_STR_WILLSTOPPRG
-{
- Text [ en-US ] = "You will have to restart the program after this edit.\nContinue?" ;
-};
-String RID_STR_SEARCHALLMODULES
-{
- Text [ en-US ] = "Do you want to replace the text in all active modules?" ;
-};
-Edit RID_EDT_WATCHEDIT
-{
- HelpId = HID_BASICIDE_WATCHWINDOW_EDIT ;
- Border = TRUE ;
- SvLook = TRUE ;
- Size = MAP_APPFONT ( 80 , 12 ) ;
-};
-ImageButton RID_IMGBTN_REMOVEWATCH
-{
- HelpId = HID_BASICIDE_REMOVEWATCH ;
- SmallStyle = TRUE ;
- ButtonImage = Image
- {
- ImageBitmap = Bitmap { File = "baswatr.bmp" ; };
- MASKCOLOR
- };
- QuickHelpText [ en-US ] = "Remove Watch" ;
-};
-
-String RID_STR_REMOVEWATCH
-{
- Text [ en-US ] = "Watch:" ;
-};
-
-String RID_STR_STACK
-{
- Text [ en-US ] = "Calls: " ;
-};
-
-String RID_STR_USERMACROS
-{
- Text [ en-US ] = "My Macros" ;
-};
-
-String RID_STR_USERDIALOGS
-{
- Text [ en-US ] = "My Dialogs" ;
-};
-
-String RID_STR_USERMACROSDIALOGS
-{
- Text [ en-US ] = "My Macros & Dialogs" ;
-};
-
-String RID_STR_SHAREMACROS
-{
- Text [ en-US ] = "%PRODUCTNAME Macros" ;
-};
-
-String RID_STR_SHAREDIALOGS
-{
- Text [ en-US ] = "%PRODUCTNAME Dialogs" ;
-};
-
-String RID_STR_SHAREMACROSDIALOGS
-{
- Text [ en-US ] = "%PRODUCTNAME Macros & Dialogs" ;
-};
-
-Menu RID_POPUP_BRKPROPS
-{
- Text [ en-US ] = "Properties" ;
- DefaultItemId = RID_BRKPROPS ;
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_ACTIV ;
- HelpId = HID_BASICIDE_ACTIV ;
- Text [ en-US ] = "Active" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = RID_BRKPROPS ;
- HelpId = HID_BASICIDE_BRKPROPS ;
- Text [ en-US ] = "Properties..." ;
- };
- };
-};
-
-Menu RID_POPUP_BRKDLG
-{
- Text [ en-US ] = "Manage Breakpoints" ;
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_BRKDLG ;
- HelpId = HID_BASICIDE_BRKDLG ;
- Text [ en-US ] = "Manage Breakpoints..." ;
- };
- };
-};
-
-Menu RID_POPUP_TABBAR
-{
- DefaultItemId = SID_BASICIDE_HIDECURPAGE ;
- ItemList =
- {
- MenuItem
- {
- Identifier = RID_INSERT ;
- Text [ en-US ] = "Insert" ;
- Submenu = Menu
- {
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_BASICIDE_NEWMODULE ;
- HelpId = CMD_SID_BASICIDE_NEWMODULE ;
- Text [ en-US ] = "BASIC Module" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_NEWDIALOG ;
- HelpId = CMD_SID_BASICIDE_NEWDIALOG ;
- Text [ en-US ] = "BASIC Dialog" ;
- };
- };
- };
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_DELETECURRENT ;
- HelpId = CMD_SID_BASICIDE_DELETECURRENT ;
- Text [ en-US ] = "Delete" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_RENAMECURRENT ;
- HelpId = CMD_SID_BASICIDE_RENAMECURRENT ;
- Text [ en-US ] = "Rename" ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_HIDECURPAGE ;
- HelpId = CMD_SID_BASICIDE_HIDECURPAGE ;
- Text [ en-US ] = "Hide" ;
- };
- MenuItem
- {
- Separator = TRUE ;
- };
- MenuItem
- {
- Identifier = SID_BASICIDE_MODULEDLG ;
- HelpId = CMD_SID_BASICIDE_MODULEDLG ;
- Text [ en-US ] = "Modules..." ;
- };
- };
-};
-
-Menu RID_POPUP_DLGED
-{
- DefaultItemId = SID_SHOW_PROPERTYBROWSER ;
- ItemList =
- {
- MenuItem
- {
- Identifier = SID_SHOW_PROPERTYBROWSER ;
- HelpId = CMD_SID_SHOW_PROPERTYBROWSER ;
- Text [ en-US ] = "Properties...";
- };
- };
-};
-
-ImageList RID_IMGLST_LAYOUT
-{
- Prefix = "im";
- MASKCOLOR
- IdList =
- {
- IMGID_BRKENABLED ;
- IMGID_BRKDISABLED ;
- IMGID_STEPMARKER ;
- IMGID_ERRORMARKER ;
- };
-};
-Image RID_IMG_LOCKED
-{
- ImageBitmap = Bitmap { File = "locked.bmp" ; };
- MASKCOLOR
-};
-
-Image RID_IMG_INSTALLATION
-{
- ImageBitmap = Bitmap { File = "harddisk_16.png"; };
- MASKCOLOR
-};
-Image RID_IMG_DOCUMENT
-{
- ImageBitmap = Bitmap { File = "im30826.png"; };
- MASKCOLOR
-};
-Image RID_IMG_MODLIB
-{
- ImageBitmap = Bitmap { File = "im30820.png"; };
- MASKCOLOR
-};
-Image RID_IMG_MODLIBNOTLOADED
-{
- ImageBitmap = Bitmap { File = "im30827.png"; };
- MASKCOLOR
-};
-Image RID_IMG_MODULE
-{
- ImageBitmap = Bitmap { File = "im30821.png"; };
- MASKCOLOR
-};
-Image RID_IMG_MACRO
-{
- ImageBitmap = Bitmap { File = "im30822.png"; };
- MASKCOLOR
-};
-Image RID_IMG_DLGLIB
-{
- ImageBitmap = Bitmap { File = "dialogfolder_16.png"; };
- MASKCOLOR
-};
-Image RID_IMG_DLGLIBNOTLOADED
-{
- ImageBitmap = Bitmap { File = "dialogfoldernot_16.png"; };
- MASKCOLOR
-};
-Image RID_IMG_DIALOG
-{
- ImageBitmap = Bitmap { File = "im30823.png"; };
- MASKCOLOR
-};
-String RID_STR_QUERYREPLACEMACRO
-{
- Text [ en-US ] = "Do you want to overwrite the XX macro?" ;
-};
-
-String RID_STR_TRANSLATION_NOTLOCALIZED
-{
- Text [ en-US ] = "<Not localized>" ;
-};
-
-String RID_STR_TRANSLATION_DEFAULT
-{
- Text [ en-US ] = "[Default Language]" ;
-};
-
-String RID_STR_DOCUMENT_OBJECTS
-{
- Text [ en-US ] = "Document Objects" ;
-};
-
-String RID_STR_USERFORMS
-{
- Text [ en-US ] = "Forms" ;
-};
-
-String RID_STR_NORMAL_MODULES
-{
- Text [ en-US ] = "Modules" ;
-};
-
-String RID_STR_CLASS_MODULES
-{
- Text [ en-US ] = "Class Modules" ;
-};
-
-String RID_STR_DLGIMP_CLASH_RENAME
-{
- Text [ en-US ] = "Rename" ;
-};
-
-String RID_STR_DLGIMP_CLASH_REPLACE
-{
- Text [ en-US ] = "Replace" ;
-};
-
-String RID_STR_DLGIMP_CLASH_TITLE
-{
- Text [ en-US ] = "Dialog Import - Name already used" ;
-};
-
-String RID_STR_DLGIMP_CLASH_TEXT
-{
- Text [ en-US ] = "The library already contains a dialog with the name:\n\n$(ARG1)\n\nRename dialog to keep current dialog or replace existing dialog.\n " ;
-};
-
-String RID_STR_DLGIMP_MISMATCH_ADD
-{
- Text [ en-US ] = "Add" ;
-};
-
-String RID_STR_DLGIMP_MISMATCH_OMIT
-{
- Text [ en-US ] = "Omit" ;
-};
-
-String RID_STR_DLGIMP_MISMATCH_TITLE
-{
- Text [ en-US ] = "Dialog Import - Language Mismatch" ;
-};
-
-String RID_STR_DLGIMP_MISMATCH_TEXT
-{
- Text [ en-US ] = "The dialog to be imported supports other languages than the target library.\n\nAdd these languages to the library to keep additional language resources provided by the dialog or omit them to stay with the current library languages.\n\nNote: For languages not supported by the dialog the resources of the dialog's default language will be used.\n " ;
-};
-
-
-#define MN_EDIT 20
-#define MN_VIEW 21
-#define MN_EXTRA 22
-#define MN_WIN 30
-#define MN_HELP 31
-#define MN_TEMPLATES 11
-
-#define MN_PLEDIT 20
-#define MN_PLVIEW 21
-#define MN_PLEXTRA 22
-#define MN_PLWIN 30
-#define MN_PLHELP 31
-#define MN_PLTEMPLATES 11
-
-/*
-
-The application menu bar resource has become obsolete. You can now find the menu bar definition at:
-<project>/basicide/menubar/menubar.xml.
-
-*/
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
deleted file mode 100644
index 0b37c7b65..000000000
--- a/basctl/source/basicide/basobj2.cxx
+++ /dev/null
@@ -1,458 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <ide_pch.hxx>
-
-#include "basobj.hxx"
-#include "iderdll.hxx"
-#include "iderdll2.hxx"
-#include "iderid.hxx"
-#include "macrodlg.hxx"
-#include "moduldlg.hxx"
-#include "basidesh.hxx"
-#include "basidesh.hrc"
-#include "baside2.hxx"
-#include "basicmod.hxx"
-#include "basdoc.hxx"
-
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <com/sun/star/document/XScriptInvocationContext.hpp>
-
-#include <basic/sbx.hxx>
-#include <framework/documentundoguard.hxx>
-#include <tools/diagnose_ex.h>
-#include <unotools/moduleoptions.hxx>
-
-#include <vector>
-#include <algorithm>
-#include <memory>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-
-
-//----------------------------------------------------------------------------
-
-extern "C" {
- SAL_DLLPUBLIC_EXPORT rtl_uString* basicide_choose_macro( void* pOnlyInDocument_AsXModel, sal_Bool bChooseOnly, rtl_uString* pMacroDesc )
- {
- ::rtl::OUString aMacroDesc( pMacroDesc );
- Reference< frame::XModel > aDocument( static_cast< frame::XModel* >( pOnlyInDocument_AsXModel ) );
- ::rtl::OUString aScriptURL = BasicIDE::ChooseMacro( aDocument, bChooseOnly, aMacroDesc );
- rtl_uString* pScriptURL = aScriptURL.pData;
- rtl_uString_acquire( pScriptURL );
-
- return pScriptURL;
- }
- SAL_DLLPUBLIC_EXPORT void basicide_macro_organizer( sal_Int16 nTabId )
- {
- OSL_TRACE("in basicide_macro_organizer");
- BasicIDE::Organize( nTabId );
- }
-}
-
-namespace BasicIDE
-{
-//----------------------------------------------------------------------------
-
-void Organize( sal_Int16 tabId )
-{
- BasicIDEDLL::Init();
-
- BasicEntryDescriptor aDesc;
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow();
- if ( pCurWin )
- aDesc = pCurWin->CreateEntryDescriptor();
- }
-
- Window* pParent = Application::GetDefDialogParent();
- OrganizeDialog* pDlg = new OrganizeDialog( pParent, tabId, aDesc );
- pDlg->Execute();
- delete pDlg;
-}
-
-//----------------------------------------------------------------------------
-
-sal_Bool IsValidSbxName( const String& rName )
-{
- for ( sal_uInt16 nChar = 0; nChar < rName.Len(); nChar++ )
- {
- sal_Bool bValid = ( ( rName.GetChar(nChar) >= 'A' && rName.GetChar(nChar) <= 'Z' ) ||
- ( rName.GetChar(nChar) >= 'a' && rName.GetChar(nChar) <= 'z' ) ||
- ( rName.GetChar(nChar) >= '0' && rName.GetChar(nChar) <= '9' && nChar ) ||
- ( rName.GetChar(nChar) == '_' ) );
- if ( !bValid )
- return sal_False;
- }
- return sal_True;
-}
-
-static sal_Bool StringCompareLessThan( const String& rStr1, const String& rStr2 )
-{
- return (rStr1.CompareIgnoreCaseToAscii( rStr2 ) == COMPARE_LESS);
-}
-
-//----------------------------------------------------------------------------
-
-Sequence< ::rtl::OUString > GetMergedLibraryNames( const Reference< script::XLibraryContainer >& xModLibContainer, const Reference< script::XLibraryContainer >& xDlgLibContainer )
-{
- // create a sorted list of module library names
- ::std::vector<String> aModLibList;
- if ( xModLibContainer.is() )
- {
- Sequence< ::rtl::OUString > aModLibNames = xModLibContainer->getElementNames();
- sal_Int32 nModLibCount = aModLibNames.getLength();
- const ::rtl::OUString* pModLibNames = aModLibNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nModLibCount ; i++ )
- aModLibList.push_back( pModLibNames[ i ] );
- ::std::sort( aModLibList.begin() , aModLibList.end() , StringCompareLessThan );
- }
-
- // create a sorted list of dialog library names
- ::std::vector<String> aDlgLibList;
- if ( xDlgLibContainer.is() )
- {
- Sequence< ::rtl::OUString > aDlgLibNames = xDlgLibContainer->getElementNames();
- sal_Int32 nDlgLibCount = aDlgLibNames.getLength();
- const ::rtl::OUString* pDlgLibNames = aDlgLibNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nDlgLibCount ; i++ )
- aDlgLibList.push_back( pDlgLibNames[ i ] );
- ::std::sort( aDlgLibList.begin() , aDlgLibList.end() , StringCompareLessThan );
- }
-
- // merge both lists
- ::std::vector<String> aLibList( aModLibList.size() + aDlgLibList.size() );
- ::std::merge( aModLibList.begin(), aModLibList.end(), aDlgLibList.begin(), aDlgLibList.end(), aLibList.begin(), StringCompareLessThan );
- ::std::vector<String>::iterator aIterEnd = ::std::unique( aLibList.begin(), aLibList.end() ); // move unique elements to the front
- aLibList.erase( aIterEnd, aLibList.end() ); // remove duplicates
-
- // copy to sequence
- sal_Int32 nLibCount = aLibList.size();
- Sequence< ::rtl::OUString > aSeqLibNames( nLibCount );
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- aSeqLibNames.getArray()[ i ] = aLibList[ i ];
-
- return aSeqLibNames;
-}
-
-//----------------------------------------------------------------------------
-
-bool RenameModule( Window* pErrorParent, const ScriptDocument& rDocument, const String& rLibName, const String& rOldName, const String& rNewName )
-{
- if ( !rDocument.hasModule( rLibName, rOldName ) )
- {
- OSL_FAIL( "BasicIDE::RenameModule: old module name is invalid!" );
- return false;
- }
-
- if ( rDocument.hasModule( rLibName, rNewName ) )
- {
- ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) );
- aError.Execute();
- return false;
- }
-
- // #i74440
- if ( rNewName.Len() == 0 )
- {
- ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) );
- aError.Execute();
- return false;
- }
-
- if ( !rDocument.renameModule( rLibName, rOldName, rNewName ) )
- return false;
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- IDEBaseWindow* pWin = pIDEShell->FindWindow( rDocument, rLibName, rNewName, BASICIDE_TYPE_MODULE, sal_True );
- if ( pWin )
- {
- // set new name in window
- pWin->SetName( rNewName );
-
- // set new module in module window
- ModulWindow* pModWin = (ModulWindow*)pWin;
- pModWin->SetSbModule( (SbModule*)pModWin->GetBasic()->FindModule( rNewName ) );
-
- // update tabwriter
- sal_uInt16 nId = (sal_uInt16)(pIDEShell->GetIDEWindowTable()).GetKey( pWin );
- DBG_ASSERT( nId, "No entry in Tabbar!" );
- if ( nId )
- {
- BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar();
- pTabBar->SetPageText( nId, rNewName );
- pTabBar->Sort();
- pTabBar->MakeVisible( pTabBar->GetCurPageId() );
- }
- }
- }
- return true;
-}
-
-
-//----------------------------------------------------------------------------
-
-namespace
-{
- struct MacroExecutionData
- {
- ScriptDocument aDocument;
- SbMethodRef xMethod;
-
- MacroExecutionData()
- :aDocument( ScriptDocument::NoDocument )
- ,xMethod( NULL )
- {
- }
- };
-
- class MacroExecution
- {
- public:
- DECL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData* );
- };
-
-
- IMPL_STATIC_LINK( MacroExecution, ExecuteMacroEvent, MacroExecutionData*, i_pData )
- {
- (void)pThis;
- ENSURE_OR_RETURN( i_pData, "wrong MacroExecutionData", 0L );
- // take ownership of the data
- ::std::auto_ptr< MacroExecutionData > pData( i_pData );
-
- DBG_ASSERT( pData->xMethod->GetParent()->GetFlags() & SBX_EXTSEARCH, "Kein EXTSEARCH!" );
-
- // in case this is a document-local macro, try to protect the document's Undo Manager from
- // flawed scripts
- ::std::auto_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
- if ( pData->aDocument.isDocument() )
- pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) );
-
- BasicIDE::RunMethod( pData->xMethod );
-
- return 1L;
- }
-}
-
-//----------------------------------------------------------------------------
-
-::rtl::OUString ChooseMacro( const uno::Reference< frame::XModel >& rxLimitToDocument, sal_Bool bChooseOnly, const ::rtl::OUString& rMacroDesc )
-{
- (void)rMacroDesc;
-
- BasicIDEDLL::Init();
-
- IDE_DLL()->GetExtraData()->ChoosingMacro() = sal_True;
-
- String aScriptURL;
- sal_Bool bError = sal_False;
- SbMethod* pMethod = NULL;
-
- ::std::auto_ptr< MacroChooser > pChooser( new MacroChooser( NULL, sal_True ) );
- if ( bChooseOnly || !SvtModuleOptions().IsBasicIDE() )
- pChooser->SetMode( MACROCHOOSER_CHOOSEONLY );
-
- if ( !bChooseOnly && rxLimitToDocument.is() )
- // Hack!
- pChooser->SetMode( MACROCHOOSER_RECORDING );
-
- short nRetValue = pChooser->Execute();
-
- IDE_DLL()->GetExtraData()->ChoosingMacro() = sal_False;
-
- switch ( nRetValue )
- {
- case MACRO_OK_RUN:
- {
- pMethod = pChooser->GetMacro();
- if ( !pMethod && pChooser->GetMode() == MACROCHOOSER_RECORDING )
- pMethod = pChooser->CreateMacro();
-
- if ( !pMethod )
- break;
-
- SbModule* pModule = pMethod->GetModule();
- ENSURE_OR_BREAK( pModule, "BasicIDE::ChooseMacro: No Module found!" );
-
- StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
- ENSURE_OR_BREAK( pBasic, "BasicIDE::ChooseMacro: No Basic found!" );
-
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
- ENSURE_OR_BREAK( pBasMgr, "BasicIDE::ChooseMacro: No BasicManager found!" );
-
- // name
- String aName;
- aName += pBasic->GetName();
- aName += '.';
- aName += pModule->GetName();
- aName += '.';
- aName += pMethod->GetName();
-
- // language
- String aLanguage = String::CreateFromAscii("Basic");
-
- // location
- String aLocation;
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- if ( aDocument.isDocument() )
- {
- // document basic
- aLocation = String::CreateFromAscii("document");
-
- if ( rxLimitToDocument.is() )
- {
- uno::Reference< frame::XModel > xLimitToDocument( rxLimitToDocument );
-
- uno::Reference< document::XEmbeddedScripts > xScripts( rxLimitToDocument, UNO_QUERY );
- if ( !xScripts.is() )
- { // the document itself does not support embedding scripts
- uno::Reference< document::XScriptInvocationContext > xContext( rxLimitToDocument, UNO_QUERY );
- if ( xContext.is() )
- xScripts = xContext->getScriptContainer();
- if ( xScripts.is() )
- { // but it is able to refer to a document which actually does support this
- xLimitToDocument.set( xScripts, UNO_QUERY );
- if ( !xLimitToDocument.is() )
- {
- OSL_ENSURE( false, "BasicIDE::ChooseMacro: a script container which is no document!?" );
- xLimitToDocument = rxLimitToDocument;
- }
- }
- }
-
- if ( xLimitToDocument != aDocument.getDocument() )
- {
- // error
- bError = sal_True;
- ErrorBox( NULL, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_ERRORCHOOSEMACRO ) ) ).Execute();
- }
- }
- }
- else
- {
- // application basic
- aLocation = String::CreateFromAscii("application");
- }
-
- // script URL
- if ( !bError )
- {
- aScriptURL = String::CreateFromAscii("vnd.sun.star.script:");
- aScriptURL += aName;
- aScriptURL += String::CreateFromAscii("?language=");
- aScriptURL += aLanguage;
- aScriptURL += String::CreateFromAscii("&location=");
- aScriptURL += aLocation;
- }
-
- if ( !rxLimitToDocument.is() )
- {
- MacroExecutionData* pExecData = new MacroExecutionData;
- pExecData->aDocument = aDocument;
- pExecData->xMethod = pMethod; // keep alive until the event has been processed
- Application::PostUserEvent( STATIC_LINK( NULL, MacroExecution, ExecuteMacroEvent ), pExecData );
- }
- }
- break;
- }
-
- return aScriptURL;
-}
-
-//----------------------------------------------------------------------------
-
-Sequence< ::rtl::OUString > GetMethodNames( const ScriptDocument& rDocument, const String& rLibName, const String& rModName )
- throw(NoSuchElementException )
-{
- Sequence< ::rtl::OUString > aSeqMethods;
-
- // get module
- ::rtl::OUString aOUSource;
- if ( rDocument.getModule( rLibName, rModName, aOUSource ) )
- {
- SbModuleRef xModule = new SbModule( rModName );
- xModule->SetSource32( aOUSource );
- sal_uInt16 nCount = xModule->GetMethods()->Count();
- sal_uInt16 nRealCount = nCount;
- for ( sal_uInt16 i = 0; i < nCount; i++ )
- {
- SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
- if( pMethod->IsHidden() )
- --nRealCount;
- }
- aSeqMethods.realloc( nRealCount );
-
- sal_uInt16 iTarget = 0;
- for ( sal_uInt16 i = 0 ; i < nCount; ++i )
- {
- SbMethod* pMethod = (SbMethod*)xModule->GetMethods()->Get( i );
- if( pMethod->IsHidden() )
- continue;
- DBG_ASSERT( pMethod, "Method not found! (NULL)" );
- aSeqMethods.getArray()[ iTarget++ ] = pMethod->GetName();
- }
- }
-
- return aSeqMethods;
-}
-
-//----------------------------------------------------------------------------
-
-sal_Bool HasMethod( const ScriptDocument& rDocument, const String& rLibName, const String& rModName, const String& rMethName )
-{
- sal_Bool bHasMethod = sal_False;
-
- ::rtl::OUString aOUSource;
- if ( rDocument.hasModule( rLibName, rModName ) && rDocument.getModule( rLibName, rModName, aOUSource ) )
- {
- SbModuleRef xModule = new SbModule( rModName );
- xModule->SetSource32( aOUSource );
- SbxArray* pMethods = xModule->GetMethods();
- if ( pMethods )
- {
- SbMethod* pMethod = (SbMethod*)pMethods->Find( rMethName, SbxCLASS_METHOD );
- if ( pMethod && !pMethod->IsHidden() )
- bHasMethod = sal_True;
- }
- }
-
- return bHasMethod;
-}
-} //namespace BasicIDE
-//----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/basobj3.cxx b/basctl/source/basicide/basobj3.cxx
deleted file mode 100644
index 76f45d5a6..000000000
--- a/basctl/source/basicide/basobj3.cxx
+++ /dev/null
@@ -1,519 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <ide_pch.hxx>
-
-#include <vector>
-#include <algorithm>
-#include <basic/sbx.hxx>
-#include <unotools/moduleoptions.hxx>
-
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <basobj.hxx>
-#include <basidesh.hxx>
-#include <objdlg.hxx>
-#include <bastypes.hxx>
-#include <basdoc.hxx>
-#include <basidesh.hrc>
-
-#include <baside2.hxx>
-#include <baside3.hxx>
-#include <basicmod.hxx>
-#include <localizationmgr.hxx>
-#include "dlged.hxx"
-#include <dlgeddef.hxx>
-#include <comphelper/processfactory.hxx>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <xmlscript/xmldlg_imexp.hxx>
-#include <rtl/uri.hxx>
-#include <osl/process.h>
-#include <osl/file.hxx>
-
-using namespace comphelper;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::container;
-
-
-//----------------------------------------------------------------------------
-
-extern "C" {
- SAL_DLLPUBLIC_EXPORT long basicide_handle_basic_error( void* pPtr )
- {
- return BasicIDE::HandleBasicError( (StarBASIC*)pPtr );
- }
-}
-
-namespace BasicIDE
-{
-//----------------------------------------------------------------------------
-
-SbMethod* CreateMacro( SbModule* pModule, const String& rMacroName )
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
-
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
- }
-
- if ( pModule->GetMethods()->Find( rMacroName, SbxCLASS_METHOD ) )
- return 0;
-
- String aMacroName( rMacroName );
- if ( aMacroName.Len() == 0 )
- {
- if ( !pModule->GetMethods()->Count() )
- aMacroName = String( RTL_CONSTASCII_USTRINGPARAM( "Main" ) );
- else
- {
- sal_Bool bValid = sal_False;
- String aStdMacroText( RTL_CONSTASCII_USTRINGPARAM( "Macro" ) );
- sal_uInt16 nMacro = 1;
- while ( !bValid )
- {
- aMacroName = aStdMacroText;
- aMacroName += String::CreateFromInt32( nMacro );
- // Pruefen, ob vorhanden...
- bValid = pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ) ? sal_False : sal_True;
- nMacro++;
- }
- }
- }
-
- ::rtl::OUString aOUSource( pModule->GetSource32() );
-
- // Nicht zu viele Leerzeilen erzeugen...
- sal_Int32 nSourceLen = aOUSource.getLength();
- if ( nSourceLen > 2 )
- {
- const sal_Unicode* pStr = aOUSource.getStr();
- if ( pStr[ nSourceLen - 1 ] != LINE_SEP )
- aOUSource += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\n" ) );
- else if ( pStr[ nSourceLen - 2 ] != LINE_SEP )
- aOUSource += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ) );
- else if ( pStr[ nSourceLen - 3 ] == LINE_SEP )
- aOUSource = aOUSource.copy( 0, nSourceLen-1 );
- }
-
- ::rtl::OUString aSubStr;
- aSubStr = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Sub " ) );
- aSubStr += aMacroName;
- aSubStr += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n\nEnd Sub" ) );
-
- aOUSource += aSubStr;
-
- // update module in library
- ScriptDocument aDocument( ScriptDocument::NoDocument );
- SbxObject* pParent = pModule->GetParent();
- StarBASIC* pBasic = PTR_CAST(StarBASIC,pParent);
- DBG_ASSERT(pBasic, "BasicIDE::CreateMacro: No Basic found!");
- if ( pBasic )
- {
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
- DBG_ASSERT(pBasMgr, "BasicIDE::CreateMacro: No BasicManager found!");
- if ( pBasMgr )
- {
- aDocument = ScriptDocument::getDocumentForBasicManager( pBasMgr );
- OSL_ENSURE( aDocument.isValid(), "BasicIDE::CreateMacro: no document for the given BasicManager!" );
- if ( aDocument.isValid() )
- {
- String aLibName = pBasic->GetName();
- String aModName = pModule->GetName();
- OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aOUSource ) );
- }
- }
- }
-
- SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD );
-
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_UPDATEALLMODULESOURCES );
- }
-
- if ( aDocument.isAlive() )
- BasicIDE::MarkDocumentModified( aDocument );
-
- return pMethod;
-}
-
-//----------------------------------------------------------------------------
-
-bool RenameDialog( Window* pErrorParent, const ScriptDocument& rDocument, const String& rLibName, const String& rOldName, const String& rNewName )
- throw(ElementExistException, NoSuchElementException)
-{
- if ( !rDocument.hasDialog( rLibName, rOldName ) )
- {
- OSL_FAIL( "BasicIDE::RenameDialog: old module name is invalid!" );
- return false;
- }
-
- if ( rDocument.hasDialog( rLibName, rNewName ) )
- {
- ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) );
- aError.Execute();
- return false;
- }
-
- // #i74440
- if ( rNewName.Len() == 0 )
- {
- ErrorBox aError( pErrorParent, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) );
- aError.Execute();
- return false;
- }
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- IDEBaseWindow* pWin = pIDEShell ? pIDEShell->FindWindow( rDocument, rLibName, rOldName, BASICIDE_TYPE_DIALOG, sal_False ) : NULL;
- Reference< XNameContainer > xExistingDialog;
- if ( pWin )
- xExistingDialog = ((DialogWindow*)pWin)->GetEditor()->GetDialog();
-
- if ( xExistingDialog.is() )
- LocalizationMgr::renameStringResourceIDs( rDocument, rLibName, rNewName, xExistingDialog );
-
- if ( !rDocument.renameDialog( rLibName, rOldName, rNewName, xExistingDialog ) )
- return false;
-
- if ( pWin )
- {
- // set new name in window
- pWin->SetName( rNewName );
-
- // update property browser
- ((DialogWindow*)pWin)->UpdateBrowser();
-
- // update tabwriter
- sal_uInt16 nId = (sal_uInt16)(pIDEShell->GetIDEWindowTable()).GetKey( pWin );
- DBG_ASSERT( nId, "No entry in Tabbar!" );
- if ( nId )
- {
- BasicIDETabBar* pTabBar = (BasicIDETabBar*)pIDEShell->GetTabBar();
- pTabBar->SetPageText( nId, rNewName );
- pTabBar->Sort();
- pTabBar->MakeVisible( pTabBar->GetCurPageId() );
- }
- }
- return true;
-}
-
-//----------------------------------------------------------------------------
-
-bool RemoveDialog( const ScriptDocument& rDocument, const String& rLibName, const String& rDlgName )
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- DialogWindow* pDlgWin = pIDEShell->FindDlgWin( rDocument, rLibName, rDlgName, sal_False );
- if( pDlgWin )
- {
- Reference< container::XNameContainer > xDialogModel = pDlgWin->GetDialog();
- LocalizationMgr::removeResourceForDialog( rDocument, rLibName, rDlgName, xDialogModel );
- }
- }
-
- return rDocument.removeDialog( rLibName, rDlgName );
-}
-
-//----------------------------------------------------------------------------
-
-StarBASIC* FindBasic( const SbxVariable* pVar )
-{
- const SbxVariable* pSbx = pVar;
- while ( pSbx && !pSbx->ISA( StarBASIC ) )
- pSbx = pSbx->GetParent();
-
- DBG_ASSERT( !pSbx || pSbx->ISA( StarBASIC ), "Find Basic: Kein Basic!" );
- return (StarBASIC*)pSbx;
-}
-
-//----------------------------------------------------------------------------
-
-BasicManager* FindBasicManager( StarBASIC* pLib )
-{
- ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::AllWithApplication ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- BasicManager* pBasicMgr = doc->getBasicManager();
- OSL_ENSURE( pBasicMgr, "BasicIDE::FindBasicManager: no basic manager for the document!" );
- if ( !pBasicMgr )
- continue;
-
- Sequence< ::rtl::OUString > aLibNames( doc->getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- StarBASIC* pL = pBasicMgr->GetLib( pLibNames[ i ] );
- if ( pL == pLib )
- return pBasicMgr;
- }
- }
- return NULL;
-}
-
-//----------------------------------------------------------------------------
-
-void MarkDocumentModified( const ScriptDocument& rDocument )
-{
- // Muss ja nicht aus einem Document kommen...
- if ( rDocument.isApplication() )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- pIDEShell->SetAppBasicModified();
- }
- else
- {
- rDocument.setDocumentModified();
- }
-
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_SIGNATURE );
- pBindings->Invalidate( SID_SAVEDOC );
- pBindings->Update( SID_SAVEDOC );
- }
-
- // Objectcatalog updaten...
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- ObjectCatalog* pObjCatalog = pIDEShell ? pIDEShell->GetObjectCatalog() : 0;
- if ( pObjCatalog )
- pObjCatalog->UpdateEntries();
-}
-
-//----------------------------------------------------------------------------
-
-void RunMethod( SbMethod* pMethod )
-{
- SbxValues aRes;
- aRes.eType = SbxVOID;
- pMethod->Get( aRes );
-}
-
-//----------------------------------------------------------------------------
-
-void StopBasic()
-{
- StarBASIC::Stop();
- BasicIDEShell* pShell = IDE_DLL()->GetShell();
- if ( pShell )
- {
- IDEWindowTable& rWindows = pShell->GetIDEWindowTable();
- IDEBaseWindow* pWin = rWindows.First();
- while ( pWin )
- {
- // BasicStopped von Hand rufen, da das Stop-Notify ggf. sonst nicht
- // durchkommen kann.
- pWin->BasicStopped();
- pWin = rWindows.Next();
- }
- }
- BasicIDE::BasicStopped();
-}
-
-//----------------------------------------------------------------------------
-
-void BasicStopped( sal_Bool* pbAppWindowDisabled,
- sal_Bool* pbDispatcherLocked, sal_uInt16* pnWaitCount,
- SfxUInt16Item** ppSWActionCount, SfxUInt16Item** ppSWLockViewCount )
-{
- // Nach einem Error oder dem expliziten abbrechen des Basics muessen
- // ggf. einige Locks entfernt werden...
-
- if ( pbAppWindowDisabled )
- *pbAppWindowDisabled = sal_False;
- if ( pbDispatcherLocked )
- *pbDispatcherLocked = sal_False;
- if ( pnWaitCount )
- *pnWaitCount = 0;
- if ( ppSWActionCount )
- *ppSWActionCount = 0;
- if ( ppSWLockViewCount )
- *ppSWLockViewCount = 0;
-
- // AppWait ?
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if( pIDEShell )
- {
- sal_uInt16 nWait = 0;
- while ( pIDEShell->GetViewFrame()->GetWindow().IsWait() )
- {
- pIDEShell->GetViewFrame()->GetWindow().LeaveWait();
- nWait++;
- }
- if ( pnWaitCount )
- *pnWaitCount = nWait;
- }
-
- Window* pDefParent = Application::GetDefDialogParent();
- if ( pDefParent && !pDefParent->IsEnabled() )
- {
- pDefParent->Enable( sal_True );
- if ( pbAppWindowDisabled )
- *pbAppWindowDisabled = sal_True;
- }
-
-}
-
-//----------------------------------------------------------------------------
-
-void InvalidateDebuggerSlots()
-{
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICSTOP );
- pBindings->Update( SID_BASICSTOP );
- pBindings->Invalidate( SID_BASICRUN );
- pBindings->Update( SID_BASICRUN );
- pBindings->Invalidate( SID_BASICCOMPILE );
- pBindings->Update( SID_BASICCOMPILE );
- pBindings->Invalidate( SID_BASICSTEPOVER );
- pBindings->Update( SID_BASICSTEPOVER );
- pBindings->Invalidate( SID_BASICSTEPINTO );
- pBindings->Update( SID_BASICSTEPINTO );
- pBindings->Invalidate( SID_BASICSTEPOUT );
- pBindings->Update( SID_BASICSTEPOUT );
- pBindings->Invalidate( SID_BASICIDE_TOGGLEBRKPNT );
- pBindings->Update( SID_BASICIDE_TOGGLEBRKPNT );
- pBindings->Invalidate( SID_BASICIDE_STAT_POS );
- pBindings->Update( SID_BASICIDE_STAT_POS );
- }
-}
-
-//----------------------------------------------------------------------------
-
-long HandleBasicError( StarBASIC* pBasic )
-{
- BasicIDEDLL::Init();
- BasicIDE::BasicStopped();
-
- // no error output during macro choosing
- if ( IDE_DLL()->GetExtraData()->ChoosingMacro() )
- return 1;
- if ( IDE_DLL()->GetExtraData()->ShellInCriticalSection() )
- return 2;
-
- long nRet = 0;
- BasicIDEShell* pIDEShell = 0;
- if ( SvtModuleOptions().IsBasicIDE() )
- {
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
- if ( pBasMgr )
- {
- sal_Bool bProtected = sal_False;
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- OSL_ENSURE( aDocument.isValid(), "BasicIDE::HandleBasicError: no document for the given BasicManager!" );
- if ( aDocument.isValid() )
- {
- ::rtl::OUString aOULibName( pBasic->GetName() );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- bProtected = sal_True;
- }
- }
- }
-
- if ( !bProtected )
- {
- pIDEShell = IDE_DLL()->GetShell();
- if ( !pIDEShell )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
- pIDEShell = IDE_DLL()->GetShell();
- }
- }
- }
- }
-
- if ( pIDEShell )
- nRet = pIDEShell->CallBasicErrorHdl( pBasic );
- else
- ErrorHandler::HandleError( StarBASIC::GetErrorCode() );
-
- return nRet;
-}
-
-//----------------------------------------------------------------------------
-
-SfxBindings* GetBindingsPtr()
-{
- SfxBindings* pBindings = NULL;
-
- SfxViewFrame* pFrame = NULL;
- BasicIDEDLL* pIDEDLL = IDE_DLL();
- if ( pIDEDLL && pIDEDLL->GetShell() )
- {
- pFrame = pIDEDLL->GetShell()->GetViewFrame();
- }
- else
- {
- SfxViewFrame* pView = SfxViewFrame::GetFirst();
- while ( pView )
- {
- SfxObjectShell* pObjShell = pView->GetObjectShell();
- if ( pObjShell && pObjShell->ISA( BasicDocShell ) )
- {
- pFrame = pView;
- break;
- }
- pView = SfxViewFrame::GetNext( *pView );
- }
- }
- if ( pFrame != NULL )
- pBindings = &pFrame->GetBindings();
-
- return pBindings;
-}
-
-} //namespace BasicIDE
-
-//----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastype2.cxx b/basctl/source/basicide/bastype2.cxx
deleted file mode 100644
index 7ecf56fff..000000000
--- a/basctl/source/basicide/bastype2.cxx
+++ /dev/null
@@ -1,880 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <memory>
-
-#include "vcl/bitmap.hxx"
-
-#include <ide_pch.hxx>
-
-
-#include <basidesh.hrc>
-#include <bastypes.hxx>
-#include <bastype2.hxx>
-#include <basobj.hxx>
-#include <baside2.hrc>
-#include <iderid.hxx>
-#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
-#include <basic/sbx.hxx>
-#include <svtools/imagemgr.hxx>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/componentcontext.hxx>
-#include <map>
-#include <com/sun/star/script/ModuleType.hpp>
-#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/container/XNamed.hpp>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-
-void ModuleInfoHelper::getObjectName( const uno::Reference< container::XNameContainer >& rLib, const String& rModName, String& rObjName )
-{
- try
- {
- uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
- if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
- {
- script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
- uno::Any aObject( aModuleInfo.ModuleObject );
- uno::Reference< lang::XServiceInfo > xServiceInfo( aObject, uno::UNO_QUERY );
- if( xServiceInfo.is() && xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Worksheet" )) ) )
- {
- uno::Reference< container::XNamed > xNamed( aObject, uno::UNO_QUERY );
- if( xNamed.is() )
- rObjName = xNamed->getName();
- }
- }
- }
- catch( uno::Exception& )
- {
- }
-}
-
-sal_Int32 ModuleInfoHelper::getModuleType( const uno::Reference< container::XNameContainer >& rLib, const String& rModName )
-{
- sal_Int32 nType = script::ModuleType::NORMAL;
- uno::Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( rLib, uno::UNO_QUERY );
- if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( rModName ) )
- {
- script::ModuleInfo aModuleInfo = xVBAModuleInfo->getModuleInfo( rModName );
- nType = aModuleInfo.ModuleType;
- }
- return nType;
-}
-
-BasicEntry::~BasicEntry()
-{
-}
-
-BasicDocumentEntry::BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType )
- :BasicEntry( eType )
- ,m_aDocument( rDocument )
- ,m_eLocation( eLocation )
-{
- OSL_ENSURE( m_aDocument.isValid(), "BasicDocumentEntry::BasicDocumentEntry: illegal document!" );
-}
-
-BasicDocumentEntry::~BasicDocumentEntry()
-{
-}
-
-BasicLibEntry::BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, BasicEntryType eType )
- :BasicDocumentEntry( rDocument, eLocation, eType )
- ,m_aLibName( rLibName )
-{
-}
-
-BasicLibEntry::~BasicLibEntry()
-{
-}
-
-BasicEntryDescriptor::BasicEntryDescriptor()
- :m_aDocument( ScriptDocument::getApplicationScriptDocument() )
- ,m_eLocation( LIBRARY_LOCATION_UNKNOWN )
- ,m_eType( OBJ_TYPE_UNKNOWN )
-{
-}
-
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
- ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_eType( eType )
-{
- OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
-}
-
-BasicEntryDescriptor::BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType )
- :m_aDocument( rDocument )
- ,m_eLocation( eLocation )
- ,m_aLibName( rLibName )
- ,m_aLibSubName( rLibSubName )
- ,m_aName( rName )
- ,m_aMethodName( rMethodName )
- ,m_eType( eType )
-{
- OSL_ENSURE( m_aDocument.isValid(), "BasicEntryDescriptor::BasicEntryDescriptor: invalid document!" );
-}
-
-BasicEntryDescriptor::~BasicEntryDescriptor()
-{
-}
-
-BasicEntryDescriptor::BasicEntryDescriptor( const BasicEntryDescriptor& rDesc )
- :m_aDocument( rDesc.m_aDocument )
- ,m_eLocation( rDesc.m_eLocation )
- ,m_aLibName( rDesc.m_aLibName )
- ,m_aLibSubName( rDesc.m_aLibSubName )
- ,m_aName( rDesc.m_aName )
- ,m_aMethodName( rDesc.m_aMethodName )
- ,m_eType( rDesc.m_eType )
-{
-}
-
-BasicEntryDescriptor& BasicEntryDescriptor::operator=( const BasicEntryDescriptor& rDesc )
-{
- m_aDocument = rDesc.m_aDocument;
- m_eLocation = rDesc.m_eLocation;
- m_aLibName = rDesc.m_aLibName;
- m_aLibSubName = rDesc.m_aLibSubName;
- m_aName = rDesc.m_aName;
- m_aMethodName = rDesc.m_aMethodName;
- m_eType = rDesc.m_eType;
-
- return *this;
-}
-
-bool BasicEntryDescriptor::operator==( const BasicEntryDescriptor& rDesc ) const
-{
- return m_aDocument == rDesc.m_aDocument &&
- m_eLocation == rDesc.m_eLocation &&
- m_aLibName == rDesc.m_aLibName &&
- m_aLibSubName == rDesc.m_aLibSubName &&
- m_aName == rDesc.m_aName &&
- m_aMethodName == rDesc.m_aMethodName &&
- m_eType == rDesc.m_eType;
-}
-
-BasicTreeListBox::BasicTreeListBox( Window* pParent, const ResId& rRes ) :
- SvTreeListBox( pParent, IDEResId( sal::static_int_cast<sal_uInt16>( rRes.GetId() ) ) ),
- m_aNotifier( *this )
-{
- SetNodeDefaultImages();
- SetSelectionMode( SINGLE_SELECTION );
- nMode = 0xFF; // Alles
-}
-
-
-
-BasicTreeListBox::~BasicTreeListBox()
-{
- m_aNotifier.dispose();
-
- // UserDaten zerstoeren
- SvLBoxEntry* pEntry = First();
- while ( pEntry )
- {
- delete (BasicEntry*)pEntry->GetUserData();
- pEntry = Next( pEntry );
- }
-}
-
-void BasicTreeListBox::ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
-{
- OSL_ENSURE( rDocument.isAlive(), "BasicTreeListBox::ScanEntry: illegal document!" );
- if ( !rDocument.isAlive() )
- return;
-
- // can be called multiple times for updating!
-
- // eigentlich prueffen, ob Basic bereits im Baum ?!
- SetUpdateMode( sal_False );
-
- // level 1: BasicManager (application, document, ...)
- SvLBoxEntry* pDocumentRootEntry = FindRootEntry( rDocument, eLocation );
- if ( pDocumentRootEntry && IsExpanded( pDocumentRootEntry ) )
- ImpCreateLibEntries( pDocumentRootEntry, rDocument, eLocation );
- if ( !pDocumentRootEntry )
- {
- String aRootName( GetRootEntryName( rDocument, eLocation ) );
- Image aImage;
- GetRootEntryBitmaps( rDocument, aImage );
- pDocumentRootEntry = AddEntry(
- aRootName,
- aImage,
- 0, true,
- std::auto_ptr< BasicEntry >( new BasicDocumentEntry( rDocument, eLocation ) ) );
- }
-
- SetUpdateMode( sal_True );
-}
-
-void BasicTreeListBox::ImpCreateLibEntries( SvLBoxEntry* pDocumentRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation )
-{
- // get a sorted list of library names
- Sequence< ::rtl::OUString > aLibNames( rDocument.getLibraryNames() );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- String aLibName = pLibNames[ i ];
-
- if ( eLocation == rDocument.getLibraryLocation( aLibName ) )
- {
- // check, if the module library is loaded
- sal_Bool bModLibLoaded = sal_False;
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
- bModLibLoaded = sal_True;
-
- // check, if the dialog library is loaded
- sal_Bool bDlgLibLoaded = sal_False;
- Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- bDlgLibLoaded = sal_True;
-
- sal_Bool bLoaded = bModLibLoaded || bDlgLibLoaded;
-
- // if only one of the libraries is loaded, load also the other
- if ( bLoaded )
- {
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- xModLibContainer->loadLibrary( aOULibName );
-
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- xDlgLibContainer->loadLibrary( aOULibName );
- }
-
- // create tree list box entry
- sal_uInt16 nId;
- if ( ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES ) )
- nId = bLoaded ? RID_IMG_DLGLIB : RID_IMG_DLGLIBNOTLOADED;
- else
- nId = bLoaded ? RID_IMG_MODLIB : RID_IMG_MODLIBNOTLOADED;
- SvLBoxEntry* pLibRootEntry = FindEntry( pDocumentRootEntry, aLibName, OBJ_TYPE_LIBRARY );
- if ( pLibRootEntry )
- {
- SetEntryBitmaps( pLibRootEntry, Image( IDEResId( nId ) ) );
- if ( IsExpanded( pLibRootEntry ) )
- ImpCreateLibSubEntries( pLibRootEntry, rDocument, aLibName );
- }
- else
- {
- pLibRootEntry = AddEntry(
- aLibName,
- Image( IDEResId( nId ) ),
- pDocumentRootEntry, true,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) );
- }
- }
- }
-}
-
-void BasicTreeListBox::ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-{
- ::rtl::OUString aOULibName( rLibName );
-
- // modules
- if ( nMode & BROWSEMODE_MODULES )
- {
- Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) );
-
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- try
- {
- 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();
-
- 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 ) ),
- pLibRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-
- // methods
- if ( nMode & BROWSEMODE_SUBS )
- {
- 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 ) ),
- pModuleEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
- }
- }
- }
- }
- }
- catch ( const container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-
- // dialogs
- if ( nMode & BROWSEMODE_DIALOGS )
- {
- Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) );
-
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- {
- try
- {
- // get a sorted list of dialog names
- Sequence< ::rtl::OUString > aDlgNames( rDocument.getObjectNames( E_DIALOGS, rLibName ) );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
- {
- String aDlgName = pDlgNames[ i ];
- SvLBoxEntry* pDialogEntry = FindEntry( pLibRootEntry, aDlgName, OBJ_TYPE_DIALOG );
- if ( !pDialogEntry )
- pDialogEntry = AddEntry(
- aDlgName,
- Image( IDEResId( RID_IMG_DIALOG ) ),
- pLibRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) );
- }
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-}
-
-void BasicTreeListBox::ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-{
-
- ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > > aEntries;
- aEntries.push_back( ::std::make_pair( OBJ_TYPE_DOCUMENT_OBJECTS, String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) );
- aEntries.push_back( ::std::make_pair( OBJ_TYPE_USERFORMS, String( IDEResId( RID_STR_USERFORMS ) ) ) );
- aEntries.push_back( ::std::make_pair( OBJ_TYPE_NORMAL_MODULES, String( IDEResId( RID_STR_NORMAL_MODULES ) ) ) );
- aEntries.push_back( ::std::make_pair( OBJ_TYPE_CLASS_MODULES, String( IDEResId( RID_STR_CLASS_MODULES ) ) ) );
-
- ::std::vector< std::pair< BasicEntryType, ::rtl::OUString > >::iterator iter;
- for( iter = aEntries.begin(); iter != aEntries.end(); ++iter )
- {
- BasicEntryType eType = iter->first;
- ::rtl::OUString aEntryName = iter->second;
- SvLBoxEntry* pLibSubRootEntry = FindEntry( pLibRootEntry, aEntryName, eType );
- if( pLibSubRootEntry )
- {
- SetEntryBitmaps( pLibSubRootEntry, Image( IDEResId( RID_IMG_MODLIB ) ) );
- if ( IsExpanded( pLibSubRootEntry ) )
- ImpCreateLibSubSubEntriesInVBAMode( pLibSubRootEntry, rDocument, rLibName );
- }
- else
- {
- pLibSubRootEntry = AddEntry(
- aEntryName,
- Image( IDEResId( RID_IMG_MODLIB ) ),
- pLibRootEntry, true,
- std::auto_ptr< BasicEntry >( new BasicEntry( eType ) ) );
- }
- }
-}
-
-void BasicTreeListBox::ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName )
-{
- uno::Reference< container::XNameContainer > xLib = rDocument.getOrCreateLibrary( E_SCRIPTS, rLibName );
- if( !xLib.is() )
- return;
-
- try
- {
- // 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();
-
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pLibSubRootEntry ) );
- BasicEntryType eCurrentType( aDesc.GetType() );
-
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
- {
- String aModName = pModNames[ i ];
- BasicEntryType eType = OBJ_TYPE_UNKNOWN;
- switch( ModuleInfoHelper::getModuleType( xLib, aModName ) )
- {
- case script::ModuleType::DOCUMENT:
- eType = OBJ_TYPE_DOCUMENT_OBJECTS;
- break;
- case script::ModuleType::FORM:
- eType = OBJ_TYPE_USERFORMS;
- break;
- case script::ModuleType::NORMAL:
- eType = OBJ_TYPE_NORMAL_MODULES;
- break;
- case script::ModuleType::CLASS:
- eType = OBJ_TYPE_CLASS_MODULES;
- break;
- }
- if( eType != eCurrentType )
- continue;
-
- // display a nice friendly name in the ObjectModule tab,
- // combining the objectname and module name, e.g. Sheet1 ( Financials )
- String aEntryName( aModName );
- if( eType == OBJ_TYPE_DOCUMENT_OBJECTS )
- {
- String sObjName;
- ModuleInfoHelper::getObjectName( xLib, aModName, sObjName );
- if( sObjName.Len() )
- {
- aEntryName.AppendAscii(" (").Append(sObjName).AppendAscii(")");
- }
- }
- SvLBoxEntry* pModuleEntry = FindEntry( pLibSubRootEntry, aEntryName, OBJ_TYPE_MODULE );
- if ( !pModuleEntry )
- pModuleEntry = AddEntry(
- aEntryName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- pLibSubRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
-
- // methods
- if ( nMode & BROWSEMODE_SUBS )
- {
- 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 ) ),
- pModuleEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_METHOD ) ) );
- }
- }
- }
- }
- catch ( const container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-}
-
-SvLBoxEntry* BasicTreeListBox::ImpFindEntry( SvLBoxEntry* pParent, const String& rText )
-{
- sal_uLong nRootPos = 0;
- SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
- while ( pEntry )
- {
- if ( GetEntryText( pEntry ) == rText )
- return pEntry;
-
- pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
- }
- return 0;
-}
-
-void BasicTreeListBox::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateEntries();
-}
-
-void BasicTreeListBox::onDocumentOpened( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateEntries();
-}
-
-void BasicTreeListBox::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicTreeListBox::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicTreeListBox::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicTreeListBox::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateEntries();
-}
-
-void BasicTreeListBox::onDocumentClosed( const ScriptDocument& /*_rDocument*/ )
-{
- UpdateEntries();
-}
-
-void BasicTreeListBox::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicTreeListBox::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ )
-{
- // not interested in
-}
-
-void BasicTreeListBox::UpdateEntries()
-{
- BasicEntryDescriptor aCurDesc( GetEntryDescriptor( FirstSelected() ) );
-
- // Erstmal die vorhandenen Eintraege auf existens pruefen:
- SvLBoxEntry* pLastValid = 0;
- SvLBoxEntry* pEntry = First();
- while ( pEntry )
- {
- if ( IsValidEntry( pEntry ) )
- pLastValid = pEntry;
- else
- {
- delete (BasicEntry*)pEntry->GetUserData();
- GetModel()->Remove( pEntry );
- }
- pEntry = pLastValid ? Next( pLastValid ) : First();
- }
-
- // Jetzt ueber die Basics rennen und in die Zweige eintragen
- ScanAllEntries();
-
- SetCurrentEntry( aCurDesc );
-}
-
-SvLBoxEntry* BasicTreeListBox::CloneEntry( SvLBoxEntry* pSource )
-{
- SvLBoxEntry* pNew = SvTreeListBox::CloneEntry( pSource );
- BasicEntry* pUser = (BasicEntry*)pSource->GetUserData();
-
- DBG_ASSERT( pUser, "User-Daten?!" );
- DBG_ASSERT( pUser->GetType() != OBJ_TYPE_DOCUMENT, "BasicTreeListBox::CloneEntry: document?!" );
-
- BasicEntry* pNewUser = new BasicEntry( *pUser );
- pNew->SetUserData( pNewUser );
- return pNew;
-}
-
-SvLBoxEntry* BasicTreeListBox::FindEntry( SvLBoxEntry* pParent, const String& rText, BasicEntryType eType )
-{
- sal_uLong nRootPos = 0;
- SvLBoxEntry* pEntry = pParent ? FirstChild( pParent ) : GetEntry( nRootPos );
- while ( pEntry )
- {
- BasicEntry* pBasicEntry = (BasicEntry*)pEntry->GetUserData();
- DBG_ASSERT( pBasicEntry, "FindEntry: Kein BasicEntry ?!" );
- if ( ( pBasicEntry->GetType() == eType ) && ( GetEntryText( pEntry ) == rText ) )
- return pEntry;
-
- pEntry = pParent ? NextSibling( pEntry ) : GetEntry( ++nRootPos );
- }
- return 0;
-}
-
-long BasicTreeListBox::ExpandingHdl()
-{
- // Expanding oder Collaps?
- sal_Bool bOK = sal_True;
- if ( GetModel()->GetDepth( GetHdlEntry() ) == 1 )
- {
- SvLBoxEntry* pCurEntry = GetCurEntry();
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::ExpandingHdl: no document, or document is dead!" );
- if ( aDocument.isAlive() )
- {
- String aLibName( aDesc.GetLibName() );
- String aLibSubName( aDesc.GetLibSubName() );
- String aName( aDesc.GetName() );
- String aMethodName( aDesc.GetMethodName() );
-
- if ( aLibName.Len() && !aLibSubName.Len() && !aName.Len() && !aMethodName.Len() )
- {
- // check password, if library is password protected and not verified
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- String aPassword;
- bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
- }
- }
- }
- }
- }
- return bOK;
-}
-
-sal_Bool BasicTreeListBox::IsEntryProtected( SvLBoxEntry* pEntry )
-{
- sal_Bool bProtected = sal_False;
- if ( pEntry && ( GetModel()->GetDepth( pEntry ) == 1 ) )
- {
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::IsEntryProtected: no document, or document is dead!" );
- if ( aDocument.isAlive() )
- {
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- bProtected = sal_True;
- }
- }
- }
- }
- return bProtected;
-}
-
-SvLBoxEntry* BasicTreeListBox::AddEntry(
- const String& rText,
- const Image& rImage,
- SvLBoxEntry* pParent,
- bool bChildrenOnDemand,
- std::auto_ptr< BasicEntry > aUserData
-)
-{
- SvLBoxEntry* p = InsertEntry(
- rText, rImage, rImage, pParent, bChildrenOnDemand, LIST_APPEND,
- aUserData.release() ); // XXX possible leak
- return p;
-}
-
-void BasicTreeListBox::SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage )
-{
- SetExpandedEntryBmp( pEntry, rImage );
- SetCollapsedEntryBmp( pEntry, rImage );
-}
-
-LibraryType BasicTreeListBox::GetLibraryType() const
-{
- LibraryType eType = LIBRARY_TYPE_ALL;
- if ( ( nMode & BROWSEMODE_MODULES ) && !( nMode & BROWSEMODE_DIALOGS ) )
- eType = LIBRARY_TYPE_MODULE;
- else if ( !( nMode & BROWSEMODE_MODULES ) && ( nMode & BROWSEMODE_DIALOGS ) )
- eType = LIBRARY_TYPE_DIALOG;
- return eType;
-}
-
-String BasicTreeListBox::GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const
-{
- return rDocument.getTitle( eLocation, GetLibraryType() );
-}
-
-void BasicTreeListBox::GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage )
-{
- OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::GetRootEntryBitmaps: illegal document!" );
- if ( !rDocument.isValid() )
- return;
-
- if ( rDocument.isDocument() )
- {
- ::rtl::OUString sFactoryURL;
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< ::com::sun::star::frame::XModuleManager > xModuleManager;
- if ( aContext.createComponent( "com.sun.star.frame.ModuleManager", xModuleManager ) )
- {
- try
- {
- ::rtl::OUString sModule( xModuleManager->identify( rDocument.getDocument() ) );
- Reference< container::XNameAccess > xModuleConfig( xModuleManager, UNO_QUERY );
- if ( xModuleConfig.is() )
- {
- Sequence< beans::PropertyValue > aModuleDescr;
- xModuleConfig->getByName( sModule ) >>= aModuleDescr;
- sal_Int32 nCount = aModuleDescr.getLength();
- const beans::PropertyValue* pModuleDescr = aModuleDescr.getConstArray();
- for ( sal_Int32 i = 0; i < nCount; ++i )
- {
- if ( pModuleDescr[ i ].Name.equalsAsciiL(
- RTL_CONSTASCII_STRINGPARAM( "ooSetupFactoryEmptyDocumentURL" ) ) )
- {
- pModuleDescr[ i ].Value >>= sFactoryURL;
- break;
- }
- }
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- if ( sFactoryURL.getLength() )
- {
- rImage = SvFileInformationManager::GetFileImage( INetURLObject( sFactoryURL ), sal_False );
- }
- else
- {
- // default icon
- rImage = Image( IDEResId( RID_IMG_DOCUMENT ) );
- }
- }
- else
- {
- rImage = Image( IDEResId( RID_IMG_INSTALLATION ) );
- }
-}
-
-void BasicTreeListBox::SetCurrentEntry( BasicEntryDescriptor& rDesc )
-{
- SvLBoxEntry* pCurEntry = 0;
- BasicEntryDescriptor aDesc( rDesc );
- if ( aDesc.GetType() == OBJ_TYPE_UNKNOWN )
- {
- aDesc = BasicEntryDescriptor(
- ScriptDocument::getApplicationScriptDocument(),
- LIBRARY_LOCATION_USER, String::CreateFromAscii( "Standard" ),
- String(), String::CreateFromAscii( "." ), OBJ_TYPE_UNKNOWN );
- }
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isValid(), "BasicTreeListBox::SetCurrentEntry: invalid document!" );
- LibraryLocation eLocation( aDesc.GetLocation() );
- SvLBoxEntry* pRootEntry = FindRootEntry( aDocument, eLocation );
- if ( pRootEntry )
- {
- pCurEntry = pRootEntry;
- String aLibName( aDesc.GetLibName() );
- if ( aLibName.Len() )
- {
- Expand( pRootEntry );
- SvLBoxEntry* pLibEntry = FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY );
- if ( pLibEntry )
- {
- pCurEntry = pLibEntry;
- String aLibSubName( aDesc.GetLibSubName() );
- if( aLibSubName.Len() )
- {
- Expand( pLibEntry );
- SvLBoxEntry* pLibSubEntry = ImpFindEntry( pLibEntry, aLibSubName );
- if( pLibSubEntry )
- {
- pCurEntry = pLibSubEntry;
- }
- }
- String aName( aDesc.GetName() );
- if ( aName.Len() )
- {
- Expand( pCurEntry );
- BasicEntryType eType = OBJ_TYPE_MODULE;
- if ( aDesc.GetType() == OBJ_TYPE_DIALOG )
- eType = OBJ_TYPE_DIALOG;
- SvLBoxEntry* pEntry = FindEntry( pCurEntry, aName, eType );
- if ( pEntry )
- {
- pCurEntry = pEntry;
- String aMethodName( aDesc.GetMethodName() );
- if ( aMethodName.Len() )
- {
- Expand( pEntry );
- SvLBoxEntry* pSubEntry = FindEntry( pEntry, aMethodName, OBJ_TYPE_METHOD );
- if ( pSubEntry )
- {
- pCurEntry = pSubEntry;
- }
- else
- {
- pSubEntry = FirstChild( pEntry );
- if ( pSubEntry )
- pCurEntry = pSubEntry;
- }
- }
- }
- else
- {
- pEntry = FirstChild( pLibEntry );
- if ( pEntry )
- pCurEntry = pEntry;
- }
- }
- }
- else
- {
- pLibEntry = FirstChild( pRootEntry );
- if ( pLibEntry )
- pCurEntry = pLibEntry;
- }
- }
- }
- else
- {
- pRootEntry = First();
- if ( pRootEntry )
- pCurEntry = pRootEntry;
- }
-
- SetCurEntry( pCurEntry );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastype2.hxx b/basctl/source/basicide/bastype2.hxx
deleted file mode 100644
index 04b566f34..000000000
--- a/basctl/source/basicide/bastype2.hxx
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASTYPE2_HXX
-#define _BASTYPE2_HXX
-
-#include "doceventnotifier.hxx"
-
-#include <memory>
-#include "tools/solar.h"
-
-#define _SVICNVW_HXX
-#include <svtools/svtreebx.hxx>
-#include <svl/lstner.hxx>
-#include <basic/sbstar.hxx>
-#include <sbxitem.hxx>
-#include "basobj.hxx"
-
-enum BasicEntryType { OBJ_TYPE_UNKNOWN, OBJ_TYPE_DOCUMENT, OBJ_TYPE_LIBRARY, OBJ_TYPE_MODULE, OBJ_TYPE_DIALOG, OBJ_TYPE_METHOD, OBJ_TYPE_DOCUMENT_OBJECTS, OBJ_TYPE_USERFORMS, OBJ_TYPE_NORMAL_MODULES, OBJ_TYPE_CLASS_MODULES };
-
-#define BROWSEMODE_MODULES 0x01
-#define BROWSEMODE_SUBS 0x02
-#define BROWSEMODE_DIALOGS 0x04
-
-class SbMethod;
-class SbxObject;
-class SbModule;
-class SvLBoxEntry;
-class SbxVariable;
-class String;
-
-
-class BasicEntry
-{
-private:
- BasicEntryType m_eType;
-
-public:
- BasicEntry( BasicEntryType eType ) { m_eType = eType; }
- BasicEntry( const BasicEntry& r ) { m_eType = r.m_eType; }
- virtual ~BasicEntry();
-
- BasicEntryType GetType() const { return m_eType; }
-};
-
-class BasicDocumentEntry : public BasicEntry
-{
-private:
- ScriptDocument m_aDocument;
- LibraryLocation m_eLocation;
-
-public:
- BasicDocumentEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, BasicEntryType eType = OBJ_TYPE_DOCUMENT );
- virtual ~BasicDocumentEntry();
-
- const ScriptDocument&
- GetDocument() const { return m_aDocument; }
- LibraryLocation GetLocation() const { return m_eLocation; }
-};
-
-class BasicLibEntry : public BasicDocumentEntry
-{
-private:
- String m_aLibName;
-
-public:
- BasicLibEntry( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, BasicEntryType eType = OBJ_TYPE_LIBRARY );
- virtual ~BasicLibEntry();
-
- const String& GetLibName() const { return m_aLibName; }
-};
-
-class BasicEntryDescriptor
-{
- ScriptDocument m_aDocument;
- LibraryLocation m_eLocation;
- String m_aLibName;
- String m_aLibSubName; // for vba entry: Document Objects, Class Modules, Forms and Normal Modules
- String m_aName;
- String m_aMethodName;
- BasicEntryType m_eType;
-
-public:
- BasicEntryDescriptor();
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, BasicEntryType eType );
- BasicEntryDescriptor( const ScriptDocument& rDocument, LibraryLocation eLocation, const String& rLibName, const String& rLibSubName, const String& rName, const String& rMethodName, BasicEntryType eType );
- virtual ~BasicEntryDescriptor();
-
- BasicEntryDescriptor( const BasicEntryDescriptor& rDesc );
- BasicEntryDescriptor& operator=( const BasicEntryDescriptor& rDesc );
- bool operator==( const BasicEntryDescriptor& rDesc ) const;
-
- const ScriptDocument&
- GetDocument() const { return m_aDocument; }
- void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
-
- LibraryLocation GetLocation() const { return m_eLocation; }
- void SetLocation( LibraryLocation eLocation ) { m_eLocation = eLocation; }
-
- const String& GetLibName() const { return m_aLibName; }
- void SetLibName( const String& aLibName ) { m_aLibName = aLibName; }
-
- const String& GetLibSubName() const { return m_aLibSubName; }
- void SetLibSubName( const String& aLibSubName ) { m_aLibSubName = aLibSubName; }
-
- const String& GetName() const { return m_aName; }
- void SetName( const String& aName ) { m_aName = aName; }
-
- const String& GetMethodName() const { return m_aMethodName; }
- void SetMethodName( const String& aMethodName ) { m_aMethodName = aMethodName; }
-
- BasicEntryType GetType() const { return m_eType; }
- void SetType( BasicEntryType eType ) { m_eType = eType; }
-};
-
-
-/****************************************
- Zuordnung von Typen und Pointern in BasicEntrys:
-
- OBJ_TYPE_DOCUMENT BasicDocumentEntry
- OBJ_TYPE_LIBRARY BasicEntry
- OBJ_TYPE_MODULE BasicEntry
- OBJ_TYPE_DIALOG BasicEntry
- OBJ_TYPE_METHOD BasicEntry
-
-******************************************/
-
-class BasicTreeListBox :public SvTreeListBox
- ,public ::basctl::DocumentEventListener
-{
-private:
- sal_uInt16 nMode;
- ::basctl::DocumentEventNotifier m_aNotifier;
-
- void SetEntryBitmaps( SvLBoxEntry * pEntry, const Image& rImage );
-
-protected:
- virtual void RequestingChilds( SvLBoxEntry* pParent );
- virtual void ExpandedHdl();
- virtual SvLBoxEntry* CloneEntry( SvLBoxEntry* pSource );
- virtual long ExpandingHdl();
-
- void ImpCreateLibEntries( SvLBoxEntry* pShellRootEntry, const ScriptDocument& rDocument, LibraryLocation eLocation );
- void ImpCreateLibSubEntries( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
- void ImpCreateLibSubEntriesInVBAMode( SvLBoxEntry* pLibRootEntry, const ScriptDocument& rDocument, const String& rLibName );
- void ImpCreateLibSubSubEntriesInVBAMode( SvLBoxEntry* pLibSubRootEntry, const ScriptDocument& rDocument, const String& rLibName );
- SvLBoxEntry* ImpFindEntry( SvLBoxEntry* pParent, const String& rText );
-
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
- virtual void onDocumentOpened( const ScriptDocument& _rDocument );
- virtual void onDocumentSave( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
- virtual void onDocumentClosed( const ScriptDocument& _rDocument );
- virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
- virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
-
-public:
- BasicTreeListBox( Window* pParent, const ResId& rRes );
- ~BasicTreeListBox();
-
- void ScanEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
- void ScanAllEntries();
- void UpdateEntries();
-
- sal_Bool IsEntryProtected( SvLBoxEntry* pEntry );
-
- void SetMode( sal_uInt16 nM ) { nMode = nM; }
- sal_uInt16 GetMode() const { return nMode; }
-
- SbModule* FindModule( SvLBoxEntry* pEntry );
- SbxVariable* FindVariable( SvLBoxEntry* pEntry );
- SvLBoxEntry* FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
- SvLBoxEntry* FindEntry( SvLBoxEntry* pParent, const String& rText, BasicEntryType eType );
-
- BasicEntryDescriptor GetEntryDescriptor( SvLBoxEntry* pEntry );
-
- sal_uInt16 ConvertType( BasicEntryType eType );
- bool IsValidEntry( SvLBoxEntry* pEntry );
-
- SvLBoxEntry* AddEntry( const String& rText, const Image& rImage,
- SvLBoxEntry* pParent, bool bChildrenOnDemand,
- std::auto_ptr< BasicEntry > aUserData );
-
- String GetRootEntryName( const ScriptDocument& rDocument, LibraryLocation eLocation ) const;
- void GetRootEntryBitmaps( const ScriptDocument& rDocument, Image& rImage );
-
- void SetCurrentEntry( BasicEntryDescriptor& rDesc );
-
-private:
- LibraryType GetLibraryType() const;
-};
-
-#endif // _BASTYPE2_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastype3.cxx b/basctl/source/basicide/bastype3.cxx
deleted file mode 100644
index 8567753fe..000000000
--- a/basctl/source/basicide/bastype3.cxx
+++ /dev/null
@@ -1,507 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-
-#include <ide_pch.hxx>
-
-#define _SI_NOSBXCONTROLS
-
-#include <basic/sbx.hxx>
-#include <bastype2.hxx>
-#include <basobj.hxx>
-#include <baside2.hrc>
-#include <iderid.hxx>
-#include <bastypes.hxx>
-#include <basdoc.hxx>
-#include <com/sun/star/script/XLibraryContainer.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <deque>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-
-
-typedef std::deque< SvLBoxEntry* > EntryArray;
-
-
-void BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
-{
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isAlive(), "BasicTreeListBox::RequestingChilds: invalid document!" );
- if ( !aDocument.isAlive() )
- return;
-
- LibraryLocation eLocation( aDesc.GetLocation() );
- BasicEntryType eType( aDesc.GetType() );
-
- if ( eType == OBJ_TYPE_DOCUMENT )
- {
- ImpCreateLibEntries( pEntry, aDocument, eLocation );
- }
- else if ( eType == OBJ_TYPE_LIBRARY )
- {
- String aLibName( aDesc.GetLibName() );
- ::rtl::OUString aOULibName( aLibName );
-
- // check password
- sal_Bool bOK = sal_True;
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- String aPassword;
- bOK = QueryPassword( xModLibContainer, aLibName, aPassword );
- }
- }
-
- if ( bOK )
- {
- // load module library
- sal_Bool bModLibLoaded = sal_False;
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- EnterWait();
- xModLibContainer->loadLibrary( aOULibName );
- LeaveWait();
- }
- bModLibLoaded = xModLibContainer->isLibraryLoaded( aOULibName );
- }
-
- // load dialog library
- sal_Bool bDlgLibLoaded = sal_False;
- Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
- {
- if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- {
- EnterWait();
- xDlgLibContainer->loadLibrary( aOULibName );
- LeaveWait();
- }
- bDlgLibLoaded = xDlgLibContainer->isLibraryLoaded( aOULibName );
- }
-
- if ( bModLibLoaded || bDlgLibLoaded )
- {
- // create the sub entries
- ImpCreateLibSubEntries( pEntry, aDocument, aLibName );
-
- // exchange image
- bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
- Image aImage( IDEResId( bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB ) );
- SetEntryBitmaps( pEntry, aImage );
- }
- else
- {
- OSL_FAIL( "BasicTreeListBox::RequestingChilds: Error loading library!" );
- }
- }
- }
- else if ( eType == OBJ_TYPE_DOCUMENT_OBJECTS
- || eType == OBJ_TYPE_USERFORMS
- || eType == OBJ_TYPE_NORMAL_MODULES
- || eType == OBJ_TYPE_CLASS_MODULES )
- {
- String aLibName( aDesc.GetLibName() );
- ImpCreateLibSubSubEntriesInVBAMode( pEntry, aDocument, aLibName );
- }
- else {
- OSL_FAIL( "BasicTreeListBox::RequestingChilds: Unknown Type!" );
- }
-}
-
-void BasicTreeListBox::ExpandedHdl()
-{
- SvLBoxEntry* pEntry = GetHdlEntry();
- DBG_ASSERT( pEntry, "Was wurde zugeklappt?" );
- // Die OnDemand erzeugten Childs loeschen,
- // SubChilds werden automatisch geloescht.
- if ( !IsExpanded( pEntry ) && pEntry->HasChildsOnDemand() )
- {
- SvLBoxEntry* pChild = FirstChild( pEntry );
- while ( pChild )
- {
- GetModel()->Remove( pChild ); // Ruft auch den DTOR
- pChild = FirstChild( pEntry );
- }
- }
-}
-
-void BasicTreeListBox::ScanAllEntries()
-{
- ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER );
- ScanEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
-
- ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- if ( doc->isAlive() )
- ScanEntry( *doc, LIBRARY_LOCATION_DOCUMENT );
- }
-}
-
-SbxVariable* BasicTreeListBox::FindVariable( SvLBoxEntry* pEntry )
-{
- if ( !pEntry )
- return 0;
-
- String aLib, aModOrObj, aSubOrPropOrSObj, aPropOrSubInSObj;
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- EntryArray aEntries;
-
- while ( pEntry )
- {
- sal_uInt16 nDepth = GetModel()->GetDepth( pEntry );
- switch ( nDepth )
- {
- case 4:
- case 3:
- case 2:
- case 1:
- {
- aEntries.push_front( pEntry );
- }
- break;
- case 0:
- {
- aDocument = ((BasicDocumentEntry*)pEntry->GetUserData())->GetDocument();
- }
- break;
- }
- pEntry = GetParent( pEntry );
- }
-
- SbxVariable* pVar = 0;
- bool bDocumentObjects = false;
- if ( !aEntries.empty() )
- {
- for ( size_t n = 0; n < aEntries.size(); n++ )
- {
- SvLBoxEntry* pLE = aEntries[n];
- DBG_ASSERT( pLE, "Can not find entry in array" );
- BasicEntry* pBE = (BasicEntry*)pLE->GetUserData();
- DBG_ASSERT( pBE, "The data in the entry not found!" );
- String aName( GetEntryText( pLE ) );
-
- switch ( pBE->GetType() )
- {
- case OBJ_TYPE_LIBRARY:
- {
- BasicManager* pBasMgr = aDocument.getBasicManager();
- if ( pBasMgr )
- pVar = pBasMgr->GetLib( aName );
- }
- break;
- case OBJ_TYPE_MODULE:
- {
- DBG_ASSERT( pVar && pVar->IsA( TYPE(StarBASIC) ), "FindVariable: Ungueltiges Basic" );
- // extract the module name from the string like "Sheet1 (Example1)"
- if( bDocumentObjects )
- {
- sal_uInt16 nIndex = 0;
- aName = aName.GetToken( 0, ' ', nIndex );
- }
- pVar = ((StarBASIC*)pVar)->FindModule( aName );
- }
- break;
- case OBJ_TYPE_METHOD:
- {
- DBG_ASSERT( pVar && ( (pVar->IsA( TYPE(SbModule) )) || (pVar->IsA( TYPE(SbxObject) )) ), "FindVariable: Ungueltiges Modul/Objekt" );
- pVar = ((SbxObject*)pVar)->GetMethods()->Find( aName, SbxCLASS_METHOD );
- }
- break;
- case OBJ_TYPE_DIALOG:
- {
- // sbx dialogs removed
- }
- break;
- case OBJ_TYPE_DOCUMENT_OBJECTS:
- bDocumentObjects = true;
- case OBJ_TYPE_USERFORMS:
- case OBJ_TYPE_NORMAL_MODULES:
- case OBJ_TYPE_CLASS_MODULES:
- {
- // skip, to find the child entry.
- continue;
- }
- default:
- {
- OSL_FAIL( "FindVariable: Unbekannter Typ!" );
- pVar = 0;
- }
- break;
- }
- if ( !pVar )
- break;
- }
- }
-
- return pVar;
-}
-
-BasicEntryDescriptor BasicTreeListBox::GetEntryDescriptor( SvLBoxEntry* pEntry )
-{
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
- String aLibName;
- String aLibSubName;
- String aName;
- String aMethodName;
- BasicEntryType eType = OBJ_TYPE_UNKNOWN;
-
- if ( !pEntry )
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
-
- EntryArray aEntries;
-
- while ( pEntry )
- {
- sal_uInt16 nDepth = GetModel()->GetDepth( pEntry );
- switch ( nDepth )
- {
- case 4:
- case 3:
- case 2:
- case 1:
- {
- aEntries.push_front( pEntry );
- }
- break;
- case 0:
- {
- BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pEntry->GetUserData();
- if ( pBasicDocumentEntry )
- {
- aDocument = pBasicDocumentEntry->GetDocument();
- eLocation = pBasicDocumentEntry->GetLocation();
- eType = OBJ_TYPE_DOCUMENT;
- }
- }
- break;
- }
- pEntry = GetParent( pEntry );
- }
-
- if ( !aEntries.empty() )
- {
- for ( size_t n = 0; n < aEntries.size(); n++ )
- {
- SvLBoxEntry* pLE = aEntries[n];
- DBG_ASSERT( pLE, "Entrie im Array nicht gefunden" );
- BasicEntry* pBE = (BasicEntry*)pLE->GetUserData();
- DBG_ASSERT( pBE, "Keine Daten im Eintrag gefunden!" );
-
- switch ( pBE->GetType() )
- {
- case OBJ_TYPE_LIBRARY:
- {
- aLibName = GetEntryText( pLE );
- eType = pBE->GetType();
- }
- break;
- case OBJ_TYPE_MODULE:
- {
- aName = GetEntryText( pLE );
- eType = pBE->GetType();
- }
- break;
- case OBJ_TYPE_METHOD:
- {
- aMethodName = GetEntryText( pLE );
- eType = pBE->GetType();
- }
- break;
- case OBJ_TYPE_DIALOG:
- {
- aName = GetEntryText( pLE );
- eType = pBE->GetType();
- }
- break;
- case OBJ_TYPE_DOCUMENT_OBJECTS:
- case OBJ_TYPE_USERFORMS:
- case OBJ_TYPE_NORMAL_MODULES:
- case OBJ_TYPE_CLASS_MODULES:
- {
- aLibSubName = GetEntryText( pLE );
- eType = pBE->GetType();
- }
- break;
- default:
- {
- OSL_FAIL( "GetEntryDescriptor: Unbekannter Typ!" );
- eType = OBJ_TYPE_UNKNOWN;
- }
- break;
- }
-
- if ( eType == OBJ_TYPE_UNKNOWN )
- break;
- }
- }
-
- return BasicEntryDescriptor( aDocument, eLocation, aLibName, aLibSubName, aName, aMethodName, eType );
-}
-
-sal_uInt16 BasicTreeListBox::ConvertType( BasicEntryType eType )
-{
- sal_uInt16 nType = OBJ_TYPE_UNKNOWN;
-
- switch ( eType )
- {
- case OBJ_TYPE_DOCUMENT:
- {
- nType = BASICIDE_TYPE_SHELL;
- }
- break;
- case OBJ_TYPE_LIBRARY:
- {
- nType = BASICIDE_TYPE_LIBRARY;
- }
- break;
- case OBJ_TYPE_MODULE:
- {
- nType = BASICIDE_TYPE_MODULE;
- }
- break;
- case OBJ_TYPE_DIALOG:
- {
- nType = BASICIDE_TYPE_DIALOG;
- }
- break;
- case OBJ_TYPE_METHOD:
- {
- nType = BASICIDE_TYPE_METHOD;
- }
- break;
- default: ;
- }
-
- return nType;
-}
-
-bool BasicTreeListBox::IsValidEntry( SvLBoxEntry* pEntry )
-{
- bool bIsValid = false;
-
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- LibraryLocation eLocation( aDesc.GetLocation() );
- String aLibName( aDesc.GetLibName() );
- String aName( aDesc.GetName() );
- String aMethodName( aDesc.GetMethodName() );
- BasicEntryType eType( aDesc.GetType() );
-
- switch ( eType )
- {
- case OBJ_TYPE_DOCUMENT:
- {
- bIsValid = aDocument.isAlive()
- && ( aDocument.isApplication()
- || GetRootEntryName( aDocument, eLocation ) == GetEntryText( pEntry )
- );
- }
- break;
- case OBJ_TYPE_LIBRARY:
- {
- bIsValid = aDocument.hasLibrary( E_SCRIPTS, aLibName ) || aDocument.hasLibrary( E_DIALOGS, aLibName );
- }
- break;
- case OBJ_TYPE_MODULE:
- {
- bIsValid = aDocument.hasModule( aLibName, aName );
- }
- break;
- case OBJ_TYPE_DIALOG:
- {
- bIsValid = aDocument.hasDialog( aLibName, aName );
- }
- break;
- case OBJ_TYPE_METHOD:
- {
- bIsValid = BasicIDE::HasMethod( aDocument, aLibName, aName, aMethodName );
- }
- break;
- case OBJ_TYPE_DOCUMENT_OBJECTS:
- case OBJ_TYPE_USERFORMS:
- case OBJ_TYPE_NORMAL_MODULES:
- case OBJ_TYPE_CLASS_MODULES:
- {
- bIsValid = true;
- }
- break;
- default: ;
- }
-
- return bIsValid;
-}
-
-SbModule* BasicTreeListBox::FindModule( SvLBoxEntry* pEntry )
-{
- SbxVariable* pVar = FindVariable( pEntry );
- if ( pVar && pVar->IsA( TYPE(SbModule ) ) )
- return (SbModule*)pVar;
- return 0;
-}
-
-SvLBoxEntry* BasicTreeListBox::FindRootEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
-{
- OSL_ENSURE( rDocument.isValid(), "BasicTreeListBox::FindRootEntry: invalid document!" );
- sal_uLong nRootPos = 0;
- SvLBoxEntry* pRootEntry = GetEntry( nRootPos );
- while ( pRootEntry )
- {
- DBG_ASSERT( (((BasicEntry*)pRootEntry->GetUserData())->GetType() == OBJ_TYPE_DOCUMENT ), "Kein Shelleintrag?" );
- BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pRootEntry->GetUserData();
- if ( pBasicDocumentEntry && ( pBasicDocumentEntry->GetDocument() == rDocument ) && pBasicDocumentEntry->GetLocation() == eLocation )
- return pRootEntry;
- pRootEntry = GetEntry( ++nRootPos );
- }
- return 0;
-}
-
-String CreateMgrAndLibStr( const String& rMgrName, const String& rLibName )
-{
- String aName( '[' );
- aName += rMgrName;
- aName += String( RTL_CONSTASCII_USTRINGPARAM( "]." ) );
- aName += rLibName;
- return aName;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastype3.hxx b/basctl/source/basicide/bastype3.hxx
deleted file mode 100644
index 016c4ee48..000000000
--- a/basctl/source/basicide/bastype3.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASTYPE3_HXX
-#define _BASTYPE3_HXX
-
-#include <svheader.hxx>
-
-#include <svtools/svmedit.hxx>
-
-#include <iderid.hxx>
-
-class EditorWindow;
-
-#ifndef NO_SPECIALEDIT
-
-class ExtendedEdit : public Edit
-{
-private:
- Accelerator aAcc;
- Link aAccHdl;
- Link aGotFocusHdl;
- Link aLoseFocusHdl;
-
-protected:
- DECL_LINK( EditAccHdl, Accelerator * );
- DECL_LINK( ImplGetFocusHdl, Control* );
- DECL_LINK( ImplLoseFocusHdl, Control* );
-
-public:
- ExtendedEdit( Window* pParent, IDEResId nRes );
-
- void SetAccHdl( const Link& rLink ) { aAccHdl = rLink; }
- void SetLoseFocusHdl( const Link& rLink ) { aLoseFocusHdl = rLink; }
- void SetGotFocusHdl( const Link& rLink ) { aGotFocusHdl = rLink; }
- Accelerator& GetAccelerator() { return aAcc; }
-};
-
-#endif //NO_SPECIALEDIT
-
-#endif // _BASTYPE3_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastype4.hxx b/basctl/source/basicide/bastype4.hxx
deleted file mode 100644
index be49835fb..000000000
--- a/basctl/source/basicide/bastype4.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASTYPE4_HXX
-#define _BASTYPE4_HXX
-
-
-#include <svtools/tabbar.hxx>
-
-class EditEngine;
-class EditView;
-
-class ExtendedTabBar : public TabBar
-{
- EditEngine* pEditEngine;
- EditView* pEditView;
- sal_Bool bIsInKeyInput;
-#if _SOLAR__PRIVATE
- void ImpCheckEditEngine( sal_Bool bKeepNewText );
-#endif
-protected:
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void MouseButtonUp( const MouseEvent& rMEvt );
- virtual void MouseMove( const MouseEvent& rMEvt );
- virtual void LoseFocus();
- virtual void KeyInput( const KeyEvent& rKEvent );
- virtual void Paint( const Rectangle& );
-
- virtual sal_Bool StartRenamingTab( sal_uInt16 nCurId );
- virtual sal_Bool AllowRenamingTab( sal_uInt16 nCurId, const String& rNewName );
- virtual void TabRenamed( sal_uInt16 nCurId, const String& rNewName );
-
-public:
- ExtendedTabBar( Window* pParent, WinBits nStyle );
- ~ExtendedTabBar();
-
- void RenameSelectedTab();
- sal_Bool IsInEditMode() const { return pEditEngine ? sal_True : sal_False; }
- void StopEditMode( sal_Bool bKeepCurText = sal_False );
-};
-
-#endif //_BASTYPE4_HXX
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/bastypes.cxx b/basctl/source/basicide/bastypes.cxx
deleted file mode 100644
index b7562d058..000000000
--- a/basctl/source/basicide/bastypes.cxx
+++ /dev/null
@@ -1,1054 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-
-#include <vector>
-#include <algorithm>
-
-#include <ide_pch.hxx>
-
-
-#include <basic/sbx.hxx>
-#include <helpid.hrc>
-#include <basidesh.hrc>
-#include <bastypes.hxx>
-#include <bastype2.hxx>
-#include <baside2.hxx> // Leider brauche ich teilweise pModulWindow...
-#include <baside3.hxx>
-#include <baside2.hrc>
-#include <svtools/textview.hxx>
-#include <svtools/texteng.hxx>
-#include <basobj.hxx>
-#include <sbxitem.hxx>
-#include <iderdll.hxx>
-
-#include <sfx2/passwd.hxx>
-
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/script/ModuleType.hpp>
-
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star;
-
-using ::std::vector;
-
-DBG_NAME( IDEBaseWindow )
-
-const char* pRegName = "BasicIDETabBar";
-
-TYPEINIT0( IDEBaseWindow )
-TYPEINIT1( SbxItem, SfxPoolItem );
-
-IDEBaseWindow::IDEBaseWindow( Window* pParent, const ScriptDocument& rDocument, String aLibName, String aName )
- :Window( pParent, WinBits( WB_3DLOOK ) )
- ,m_aDocument( rDocument )
- ,m_aLibName( aLibName )
- ,m_aName( aName )
-{
- DBG_CTOR( IDEBaseWindow, 0 );
- pShellHScrollBar = 0;
- pShellVScrollBar = 0;
- nStatus = 0;
-}
-
-
-
-IDEBaseWindow::~IDEBaseWindow()
-{
- DBG_DTOR( IDEBaseWindow, 0 );
- if ( pShellVScrollBar )
- pShellVScrollBar->SetScrollHdl( Link() );
- if ( pShellHScrollBar )
- pShellHScrollBar->SetScrollHdl( Link() );
-}
-
-
-
-void IDEBaseWindow::Init()
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
- if ( pShellVScrollBar )
- pShellVScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) );
- if ( pShellHScrollBar )
- pShellHScrollBar->SetScrollHdl( LINK( this, IDEBaseWindow, ScrollHdl ) );
- DoInit(); // virtuell...
-}
-
-
-
-void IDEBaseWindow::DoInit()
-{
-}
-
-
-
-void IDEBaseWindow::GrabScrollBars( ScrollBar* pHScroll, ScrollBar* pVScroll )
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
- pShellHScrollBar = pHScroll;
- pShellVScrollBar = pVScroll;
-// Init(); // macht kein Sinn, fuehrt zu flackern, fuehr zu Fehlern...
-}
-
-
-
-IMPL_LINK_INLINE_START( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
- DoScroll( pCurScrollBar );
- return 0;
-}
-IMPL_LINK_INLINE_END( IDEBaseWindow, ScrollHdl, ScrollBar *, pCurScrollBar )
-
-
-
-void IDEBaseWindow::ExecuteCommand( SfxRequest& )
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
-}
-
-
-
-void IDEBaseWindow::GetState( SfxItemSet& )
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
-}
-
-
-long IDEBaseWindow::Notify( NotifyEvent& rNEvt )
-{
- long nDone = 0;
-
- if ( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- KeyEvent aKEvt = *rNEvt.GetKeyEvent();
- KeyCode aCode = aKEvt.GetKeyCode();
- sal_uInt16 nCode = aCode.GetCode();
-
- switch ( nCode )
- {
- case KEY_PAGEUP:
- case KEY_PAGEDOWN:
- {
- if ( aCode.IsMod1() )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- pIDEShell->NextPage( nCode == KEY_PAGEUP );
-
- nDone = 1;
- }
- }
- break;
- }
- }
-
- return nDone ? nDone : Window::Notify( rNEvt );
-}
-
-
-void IDEBaseWindow::DoScroll( ScrollBar* )
-{
- DBG_CHKTHIS( IDEBaseWindow, 0 );
-}
-
-
-void IDEBaseWindow::StoreData()
-{
-}
-
-sal_Bool IDEBaseWindow::CanClose()
-{
- return sal_True;
-}
-
-sal_Bool IDEBaseWindow::AllowUndo()
-{
- return sal_True;
-}
-
-
-
-void IDEBaseWindow::UpdateData()
-{
-}
-
-
-String IDEBaseWindow::GetTitle()
-{
- return String();
-}
-
-
-
-String IDEBaseWindow::CreateQualifiedName()
-{
- String aName;
- if ( m_aLibName.Len() )
- {
- LibraryLocation eLocation = m_aDocument.getLibraryLocation( m_aLibName );
- aName = m_aDocument.getTitle( eLocation );
- aName += '.';
- aName += m_aLibName;
- aName += '.';
- aName += GetTitle();
- }
-
- return aName;
-}
-
-void IDEBaseWindow::SetReadOnly( sal_Bool )
-{
-}
-
-sal_Bool IDEBaseWindow::IsReadOnly()
-{
- return sal_False;
-}
-
-void IDEBaseWindow::BasicStarted()
-{
-}
-
-void IDEBaseWindow::BasicStopped()
-{
-}
-
-sal_Bool IDEBaseWindow::IsModified()
-{
- return sal_True;
-}
-
-sal_Bool IDEBaseWindow::IsPasteAllowed()
-{
- return sal_False;
-}
-
-Window* IDEBaseWindow::GetLayoutWindow()
-{
- return this;
-}
-
-::svl::IUndoManager* IDEBaseWindow::GetUndoManager()
-{
- return NULL;
-}
-
-BreakPointList::BreakPointList()
-{}
-
-BreakPointList::BreakPointList(BreakPointList const & rList)
-{
- for (size_t i = 0; i < rList.size(); ++i)
- maBreakPoints.push_back( new BreakPoint(*rList.at( i ) ) );
-}
-
-BreakPointList::~BreakPointList()
-{
- reset();
-}
-
-void BreakPointList::reset()
-{
- for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
- delete maBreakPoints[ i ];
- maBreakPoints.clear();
-}
-
-void BreakPointList::transfer(BreakPointList & rList)
-{
- reset();
- for (size_t i = 0; i < rList.size(); ++i)
- maBreakPoints.push_back( rList.at( i ) );
- rList.reset();
-}
-
-void BreakPointList::InsertSorted( BreakPoint* pNewBrk )
-{
- for ( vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
- {
- if ( pNewBrk->nLine <= (*i)->nLine )
- {
- DBG_ASSERT( ( (*i)->nLine != pNewBrk->nLine ) || pNewBrk->bTemp, "BreakPoint existiert schon!" );
- maBreakPoints.insert( i, pNewBrk );
- return;
- }
- }
- // Keine Einfuegeposition gefunden => LIST_APPEND
- maBreakPoints.push_back( pNewBrk );
-}
-
-void BreakPointList::SetBreakPointsInBasic( SbModule* pModule )
-{
- pModule->ClearAllBP();
-
- for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
- {
- BreakPoint* pBrk = maBreakPoints[ i ];
- if ( pBrk->bEnabled )
- pModule->SetBP( (sal_uInt16)pBrk->nLine );
- }
-}
-
-BreakPoint* BreakPointList::FindBreakPoint( size_t nLine )
-{
- for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
- {
- BreakPoint* pBrk = maBreakPoints[ i ];
- if ( pBrk->nLine == nLine )
- return pBrk;
- }
- return NULL;
-}
-
-void BreakPointList::AdjustBreakPoints( size_t nLine, bool bInserted )
-{
- for ( size_t i = 0; i < maBreakPoints.size(); )
- {
- BreakPoint* pBrk = maBreakPoints[ i ];
- bool bDelBrk = false;
- if ( pBrk->nLine == nLine )
- {
- if ( bInserted )
- pBrk->nLine++;
- else
- bDelBrk = true;
- }
- else if ( pBrk->nLine > nLine )
- {
- if ( bInserted )
- pBrk->nLine++;
- else
- pBrk->nLine--;
- }
-
- if ( bDelBrk )
- {
- delete remove( pBrk );
- }
- else
- {
- ++i;
- }
- }
-}
-
-void BreakPointList::ResetHitCount()
-{
- for ( size_t i = 0, n = maBreakPoints.size(); i < n; ++i )
- {
- BreakPoint* pBrk = maBreakPoints[ i ];
- pBrk->nHitCount = 0;
- }
-}
-
-size_t BreakPointList::size() const
-{
- return maBreakPoints.size();
-}
-
-BreakPoint* BreakPointList::at( size_t i )
-{
- if ( i < maBreakPoints.size() )
- return maBreakPoints[ i ];
- else
- return NULL;
-}
-
-const BreakPoint* BreakPointList::at( size_t i ) const
-{
- return maBreakPoints[ i ];
-}
-
-BreakPoint* BreakPointList::remove( BreakPoint* ptr )
-{
- for ( vector< BreakPoint* >::iterator i = maBreakPoints.begin(); i < maBreakPoints.end(); ++i )
- {
- if ( ptr == *i )
- {
- maBreakPoints.erase( i );
- return ptr;
- }
- }
- return NULL;
-}
-
-void BreakPointList::push_back( BreakPoint* item )
-{
- maBreakPoints.push_back( item );
-}
-
-void BreakPointList::clear()
-{
- maBreakPoints.clear();
-}
-
-
-void IDEBaseWindow::Deactivating()
-{
-}
-
-sal_uInt16 IDEBaseWindow::GetSearchOptions()
-{
- return 0;
-}
-
-
-BasicDockingWindow::BasicDockingWindow( Window* pParent ) :
- DockingWindow( pParent, WB_BORDER | WB_3DLOOK | WB_DOCKABLE | WB_MOVEABLE |
- WB_SIZEABLE | WB_ROLLABLE |
- WB_DOCKABLE | WB_CLIPCHILDREN )
-{
-}
-
-
-
-sal_Bool BasicDockingWindow::Docking( const Point& rPos, Rectangle& rRect )
-{
- ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent();
- Rectangle aTmpRec( rRect );
- sal_Bool bDock = IsDockingPrevented() ? sal_False : pLayout->IsToBeDocked( this, rPos, aTmpRec );
- if ( bDock )
- {
- rRect.SetSize( aTmpRec.GetSize() );
- }
- else // Alte Groesse einstellen
- {
- if ( !aFloatingPosAndSize.IsEmpty() )
- rRect.SetSize( aFloatingPosAndSize.GetSize() );
- }
- return !bDock; // bFloat
-}
-
-
-
-void BasicDockingWindow::EndDocking( const Rectangle& rRect, sal_Bool bFloatMode )
-{
- if ( bFloatMode )
- DockingWindow::EndDocking( rRect, bFloatMode );
- else
- {
- SetFloatingMode( sal_False );
- ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent();
- pLayout->DockaWindow( this );
- }
-}
-
-
-
-void BasicDockingWindow::ToggleFloatingMode()
-{
- ModulWindowLayout* pLayout = (ModulWindowLayout*)GetParent();
- if ( IsFloatingMode() )
- {
- if ( !aFloatingPosAndSize.IsEmpty() )
- SetPosSizePixel( GetParent()->ScreenToOutputPixel( aFloatingPosAndSize.TopLeft() ),
- aFloatingPosAndSize.GetSize() );
- }
- pLayout->DockaWindow( this );
-}
-
-
-
-sal_Bool BasicDockingWindow::PrepareToggleFloatingMode()
-{
- if ( IsFloatingMode() )
- {
- // Position und Groesse auf dem Desktop merken...
- aFloatingPosAndSize.SetPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) );
- aFloatingPosAndSize.SetSize( GetSizePixel() );
- }
- return sal_True;
-}
-
-
-
-void BasicDockingWindow::StartDocking()
-{
- // Position und Groesse auf dem Desktop merken...
- if ( IsFloatingMode() )
- {
- aFloatingPosAndSize.SetPos( GetParent()->OutputToScreenPixel( GetPosPixel() ) );
- aFloatingPosAndSize.SetSize( GetSizePixel() );
- }
-}
-
-
-
-ExtendedEdit::ExtendedEdit( Window* pParent, IDEResId nRes ) :
- Edit( pParent, nRes )
-{
- aAcc.SetSelectHdl( LINK( this, ExtendedEdit, EditAccHdl ) );
- Control::SetGetFocusHdl( LINK( this, ExtendedEdit, ImplGetFocusHdl ) );
- Control::SetLoseFocusHdl( LINK( this, ExtendedEdit, ImplLoseFocusHdl ) );
-}
-
-IMPL_LINK( ExtendedEdit, ImplGetFocusHdl, Control*, EMPTYARG )
-{
- Application::InsertAccel( &aAcc );
- aLoseFocusHdl.Call( this );
- return 0;
-}
-
-
-IMPL_LINK( ExtendedEdit, ImplLoseFocusHdl, Control*, EMPTYARG )
-{
- Application::RemoveAccel( &aAcc );
- return 0;
-}
-
-
-IMPL_LINK_INLINE_START( ExtendedEdit, EditAccHdl, Accelerator *, pAcc )
-{
- aAccHdl.Call( pAcc );
- return 0;
-}
-IMPL_LINK_INLINE_END( ExtendedEdit, EditAccHdl, Accelerator *, pAcc )
-
-
-
-struct TabBarDDInfo
-{
- sal_uLong npTabBar;
- sal_uInt16 nPage;
-
- TabBarDDInfo() { npTabBar = 0; nPage = 0; }
- TabBarDDInfo( sal_uLong _npTabBar, sal_uInt16 _nPage ) { npTabBar = _npTabBar; nPage = _nPage; }
-};
-
-
-BasicIDETabBar::BasicIDETabBar( Window* pParent ) :
- TabBar( pParent, WinBits( WB_3DLOOK | WB_SCROLL | WB_BORDER | WB_SIZEABLE | WB_DRAG ) )
-{
- EnableEditMode( sal_True );
-
- SetHelpId( HID_BASICIDE_TABBAR );
-}
-
-void BasicIDETabBar::MouseButtonDown( const MouseEvent& rMEvt )
-{
- if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) && !IsInEditMode() )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_MODULEDLG );
- }
- }
- else
- {
- TabBar::MouseButtonDown( rMEvt );
- }
-}
-
-void BasicIDETabBar::Command( const CommandEvent& rCEvt )
-{
- if ( ( rCEvt.GetCommand() == COMMAND_CONTEXTMENU ) && !IsInEditMode() )
- {
- Point aPos( rCEvt.IsMouseEvent() ? rCEvt.GetMousePosPixel() : Point(1,1) );
- if ( rCEvt.IsMouseEvent() ) // Richtige Tab selektieren
- {
- Point aP = PixelToLogic( aPos );
- MouseEvent aMouseEvent( aP, 1, MOUSE_SIMPLECLICK, MOUSE_LEFT );
- TabBar::MouseButtonDown( aMouseEvent );
- }
-
- PopupMenu aPopup( IDEResId( RID_POPUP_TABBAR ) );
- if ( GetPageCount() == 0 )
- {
- aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False );
- aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False );
- aPopup.EnableItem( SID_BASICIDE_HIDECURPAGE, sal_False );
- }
-
- if ( StarBASIC::IsRunning() )
- {
- aPopup.EnableItem(SID_BASICIDE_DELETECURRENT, false);
- aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, false);
- aPopup.EnableItem(SID_BASICIDE_MODULEDLG, false);
- }
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- ScriptDocument aDocument( pIDEShell->GetCurDocument() );
- ::rtl::OUString aOULibName( pIDEShell->GetCurLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
- {
- aPopup.EnableItem( aPopup.GetItemId( 0 ), sal_False );
- aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False );
- aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False );
- aPopup.RemoveDisabledEntries();
- }
- if ( aDocument.isInVBAMode() )
- {
- // disable to delete or remove object modules in IDE
- BasicManager* pBasMgr = aDocument.getBasicManager();
- if ( pBasMgr )
- {
- StarBASIC* pBasic = pBasMgr->GetLib( aOULibName );
- if( pBasic )
- {
- IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
- IDEBaseWindow* pWin = aIDEWindowTable.Get( GetCurPageId() );
- if( pWin && pWin->ISA( ModulWindow ) )
- {
- SbModule* pActiveModule = (SbModule*)pBasic->FindModule( pWin->GetName() );
- if( pActiveModule && ( pActiveModule->GetModuleType() == script::ModuleType::DOCUMENT ) )
- {
- aPopup.EnableItem( SID_BASICIDE_DELETECURRENT, sal_False );
- aPopup.EnableItem( SID_BASICIDE_RENAMECURRENT, sal_False );
- }
- }
- }
- }
- }
- }
-
-
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
- pDispatcher->Execute( aPopup.Execute( this, aPos ) );
- }
-}
-
-long BasicIDETabBar::AllowRenaming()
-{
- sal_Bool bValid = BasicIDE::IsValidSbxName( GetEditText() );
-
- if ( !bValid )
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
-
- return bValid ? TABBAR_RENAMING_YES : TABBAR_RENAMING_NO;
-}
-
-
-void BasicIDETabBar::EndRenaming()
-{
- if ( !IsEditModeCanceled() )
- {
- SfxUInt16Item aID( SID_BASICIDE_ARG_TABID, GetEditPageId() );
- SfxStringItem aNewName( SID_BASICIDE_ARG_MODULENAME, GetEditText() );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_NAMECHANGEDONTAB,
- SFX_CALLMODE_SYNCHRON, &aID, &aNewName, 0L );
- }
- }
-}
-
-
-void BasicIDETabBar::Sort()
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
- TabBarSortHelper aTabBarSortHelper;
- ::std::vector<TabBarSortHelper> aModuleList;
- ::std::vector<TabBarSortHelper> aDialogList;
- sal_uInt16 nPageCount = GetPageCount();
- sal_uInt16 i;
-
- // create module and dialog lists for sorting
- for ( i = 0; i < nPageCount; i++)
- {
- sal_uInt16 nId = GetPageId( i );
- aTabBarSortHelper.nPageId = nId;
- aTabBarSortHelper.aPageText = GetPageText( nId );
- IDEBaseWindow* pWin = aIDEWindowTable.Get( nId );
-
- if ( pWin->IsA( TYPE( ModulWindow ) ) )
- {
- aModuleList.push_back( aTabBarSortHelper );
- }
- else if ( pWin->IsA( TYPE( DialogWindow ) ) )
- {
- aDialogList.push_back( aTabBarSortHelper );
- }
- }
-
- // sort module and dialog lists by page text
- ::std::sort( aModuleList.begin() , aModuleList.end() );
- ::std::sort( aDialogList.begin() , aDialogList.end() );
-
-
- sal_uInt16 nModules = sal::static_int_cast<sal_uInt16>( aModuleList.size() );
- sal_uInt16 nDialogs = sal::static_int_cast<sal_uInt16>( aDialogList.size() );
-
- // move module pages to new positions
- for (i = 0; i < nModules; i++)
- {
- MovePage( aModuleList[i].nPageId , i );
- }
-
- // move dialog pages to new positions
- for (i = 0; i < nDialogs; i++)
- {
- MovePage( aDialogList[i].nPageId , nModules + i );
- }
- }
-}
-
-void CutLines( ::rtl::OUString& rStr, sal_Int32 nStartLine, sal_Int32 nLines, sal_Bool bEraseTrailingEmptyLines )
-{
- sal_Int32 nStartPos = 0;
- sal_Int32 nLine = 0;
- while ( nLine < nStartLine )
- {
- nStartPos = searchEOL( rStr, nStartPos );
- if( nStartPos == -1 )
- break;
- nStartPos++; // nicht das \n.
- nLine++;
- }
-
- DBG_ASSERTWARNING( nStartPos != -1, "CutLines: Startzeile nicht gefunden!" );
-
- if ( nStartPos != -1 )
- {
- sal_Int32 nEndPos = nStartPos;
-
- for ( sal_Int32 i = 0; i < nLines; i++ )
- nEndPos = searchEOL( rStr, nEndPos+1 );
-
- if ( nEndPos == -1 ) // kann bei letzter Zeile passieren
- nEndPos = rStr.getLength();
- else
- nEndPos++;
-
- ::rtl::OUString aEndStr = rStr.copy( nEndPos );
- rStr = rStr.copy( 0, nStartPos );
- rStr += aEndStr;
- }
- if ( bEraseTrailingEmptyLines )
- {
- sal_Int32 n = nStartPos;
- sal_Int32 nLen = rStr.getLength();
- while ( ( n < nLen ) && ( rStr.getStr()[ n ] == LINE_SEP ||
- rStr.getStr()[ n ] == LINE_SEP_CR ) )
- {
- n++;
- }
-
- if ( n > nStartPos )
- {
- ::rtl::OUString aEndStr = rStr.copy( n );
- rStr = rStr.copy( 0, nStartPos );
- rStr += aEndStr;
- }
- }
-}
-
-sal_uLong CalcLineCount( SvStream& rStream )
-{
- sal_uLong nLFs = 0;
- sal_uLong nCRs = 0;
- char c;
-
- rStream.Seek( 0 );
- rStream >> c;
- while ( !rStream.IsEof() )
- {
- if ( c == '\n' )
- nLFs++;
- else if ( c == '\r' )
- nCRs++;
- rStream >> c;
- }
-
- rStream.Seek( 0 );
- if ( nLFs > nCRs )
- return nLFs;
- return nCRs;
-}
-
-LibInfoKey::LibInfoKey( const ScriptDocument& rDocument, const String& rLibName )
- :m_aDocument( rDocument )
- ,m_aLibName( rLibName )
-{
-}
-
-LibInfoKey::~LibInfoKey()
-{
-}
-
-LibInfoKey::LibInfoKey( const LibInfoKey& rKey )
- :m_aDocument( rKey.m_aDocument )
- ,m_aLibName( rKey.m_aLibName )
-{
-}
-
-LibInfoKey& LibInfoKey::operator=( const LibInfoKey& rKey )
-{
- m_aDocument = rKey.m_aDocument;
- m_aLibName = rKey.m_aLibName;
- return *this;
-}
-
-bool LibInfoKey::operator==( const LibInfoKey& rKey ) const
-{
- bool bRet = false;
- if ( m_aDocument == rKey.m_aDocument && m_aLibName == rKey.m_aLibName )
- bRet = true;
- return bRet;
-}
-
-LibInfoItem::LibInfoItem( const ScriptDocument& rDocument, const String& rLibName, const String& rCurrentName, sal_uInt16 nCurrentType )
- :m_aDocument( rDocument )
- ,m_aLibName( rLibName )
- ,m_aCurrentName( rCurrentName )
- ,m_nCurrentType( nCurrentType )
-{
-}
-
-LibInfoItem::~LibInfoItem()
-{
-}
-
-LibInfoItem::LibInfoItem( const LibInfoItem& rItem )
- :m_aDocument( rItem.m_aDocument )
- ,m_aLibName( rItem.m_aLibName )
- ,m_aCurrentName( rItem.m_aCurrentName )
- ,m_nCurrentType( rItem.m_nCurrentType )
-{
-}
-
-LibInfoItem& LibInfoItem::operator=( const LibInfoItem& rItem )
-{
- m_aDocument = rItem.m_aDocument;
- m_aLibName = rItem.m_aLibName;
- m_aCurrentName = rItem.m_aCurrentName;
- m_nCurrentType = rItem.m_nCurrentType;
-
- return *this;
-}
-
-LibInfos::LibInfos()
-{
-}
-
-LibInfos::~LibInfos()
-{
- LibInfoMap::iterator end = m_aLibInfoMap.end();
- for ( LibInfoMap::iterator it = m_aLibInfoMap.begin(); it != end; ++it )
- delete it->second;
- m_aLibInfoMap.clear();
-}
-
-void LibInfos::InsertInfo( LibInfoItem* pItem )
-{
- LibInfoKey aKey( pItem->GetDocument(), pItem->GetLibName() );
- LibInfoMap::iterator it = m_aLibInfoMap.find( aKey );
- if ( it != m_aLibInfoMap.end() )
- {
- LibInfoItem* pI = it->second;
- m_aLibInfoMap.erase( it );
- delete pI;
- }
- m_aLibInfoMap.insert( LibInfoMap::value_type( aKey, pItem ) );
-}
-
-void LibInfos::RemoveInfoFor( const ScriptDocument& _rDocument )
-{
- for ( LibInfoMap::iterator it = m_aLibInfoMap.begin();
- it != m_aLibInfoMap.end();
- )
- {
- if ( it->first.GetDocument() != _rDocument )
- {
- ++it;
- continue;
- }
-
- LibInfoItem* pItem = it->second;
-
- LibInfoMap::iterator next_it = it; ++next_it;
- m_aLibInfoMap.erase( it );
- it = next_it;
-
- delete pItem;
- }
-}
-
-LibInfoItem* LibInfos::GetInfo( const LibInfoKey& rKey )
-{
- LibInfoItem* pItem = 0;
- LibInfoMap::iterator it = m_aLibInfoMap.find( rKey );
- if ( it != m_aLibInfoMap.end() )
- pItem = it->second;
- return pItem;
-}
-
-SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const String& aLibName, const String& aName, sal_uInt16 nType )
- :SfxPoolItem( nWhich_ )
- ,m_aDocument(rDocument)
- ,m_aLibName(aLibName)
- ,m_aName(aName)
- ,m_nType(nType)
-{
-}
-
-SbxItem::SbxItem(sal_uInt16 nWhich_, const ScriptDocument& rDocument, const String& aLibName, const String& aName, const String& aMethodName, sal_uInt16 nType )
- :SfxPoolItem( nWhich_ )
- ,m_aDocument(rDocument)
- ,m_aLibName(aLibName)
- ,m_aName(aName)
- ,m_aMethodName(aMethodName)
- ,m_nType(nType)
-{
-}
-
-SbxItem::SbxItem(const SbxItem& rCopy)
- :SfxPoolItem( rCopy )
- ,m_aDocument( rCopy.m_aDocument )
-{
- m_aLibName = rCopy.m_aLibName;
- m_aName = rCopy.m_aName;
- m_aMethodName = rCopy.m_aMethodName;
- m_nType = rCopy.m_nType;
-}
-
-int SbxItem::operator==( const SfxPoolItem& rCmp) const
-{
- DBG_ASSERT( rCmp.ISA( SbxItem ), "==: Kein SbxItem!" );
- return ( SfxPoolItem::operator==( rCmp ) && ( m_aDocument == ((const SbxItem&)rCmp).m_aDocument )
- && ( m_aLibName == ((const SbxItem&)rCmp).m_aLibName )
- && ( m_aName == ((const SbxItem&)rCmp).m_aName )
- && ( m_aMethodName == ((const SbxItem&)rCmp).m_aMethodName )
- && ( m_nType == ((const SbxItem&)rCmp).m_nType ) );
-}
-
-SfxPoolItem *SbxItem::Clone( SfxItemPool* ) const
-{
- return new SbxItem(*this);
-}
-
-sal_Bool QueryDel( const String& rName, const ResId& rId, Window* pParent )
-{
- String aQuery( rId );
- String aName( rName );
- aName += '\'';
- aName.Insert( '\'', 0 );
- aQuery.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aName );
- QueryBox aQueryBox( pParent, WB_YES_NO | WB_DEF_YES, aQuery );
- if ( aQueryBox.Execute() == RET_YES )
- return sal_True;
- return sal_False;
-}
-
-sal_Bool QueryDelMacro( const String& rName, Window* pParent )
-{
- return QueryDel( rName, IDEResId( RID_STR_QUERYDELMACRO ), pParent );
-}
-
-sal_Bool QueryReplaceMacro( const String& rName, Window* pParent )
-{
- return QueryDel( rName, IDEResId( RID_STR_QUERYREPLACEMACRO ), pParent );
-}
-
-sal_Bool QueryDelDialog( const String& rName, Window* pParent )
-{
- return QueryDel( rName, IDEResId( RID_STR_QUERYDELDIALOG ), pParent );
-}
-
-sal_Bool QueryDelLib( const String& rName, sal_Bool bRef, Window* pParent )
-{
- return QueryDel( rName, IDEResId( bRef ? RID_STR_QUERYDELLIBREF : RID_STR_QUERYDELLIB ), pParent );
-}
-
-sal_Bool QueryDelModule( const String& rName, Window* pParent )
-{
- return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent );
-}
-
-sal_Bool QueryPassword( const Reference< script::XLibraryContainer >& xLibContainer, const String& rLibName, String& rPassword, sal_Bool bRepeat, sal_Bool bNewTitle )
-{
- sal_Bool bOK = sal_False;
- sal_uInt16 nRet = 0;
-
- do
- {
- // password dialog
- SfxPasswordDialog* pDlg = new SfxPasswordDialog( Application::GetDefDialogParent() );
- pDlg->SetMinLen( 1 );
-
- // set new title
- if ( bNewTitle )
- {
- String aTitle( IDEResId( RID_STR_ENTERPASSWORD ) );
- aTitle.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), rLibName );
- pDlg->SetText( aTitle );
- }
-
- // execute dialog
- nRet = pDlg->Execute();
-
- // verify password
- if ( nRet == RET_OK )
- {
- ::rtl::OUString aOULibName( rLibName );
- if ( xLibContainer.is() && xLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- rPassword = pDlg->GetPassword();
- ::rtl::OUString aOUPassword( rPassword );
- bOK = xPasswd->verifyLibraryPassword( aOULibName, aOUPassword );
-
- if ( !bOK )
- {
- ErrorBox aErrorBox( Application::GetDefDialogParent(), WB_OK, String( IDEResId( RID_STR_WRONGPASSWORD ) ) );
- aErrorBox.Execute();
- }
- }
- }
- }
-
- delete pDlg;
- }
- while ( bRepeat && !bOK && nRet == RET_OK );
-
- return bOK;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/brkdlg.cxx b/basctl/source/basicide/brkdlg.cxx
deleted file mode 100644
index 7b25f3124..000000000
--- a/basctl/source/basicide/brkdlg.cxx
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <limits>
-
-#include <vcl/sound.hxx>
-
-#define _SVX_NOIDERESIDS
-#include <brkdlg.hxx>
-#include <brkdlg.hrc>
-#include <basidesh.hxx>
-#include <basidesh.hrc>
-#include <iderdll.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/viewfrm.hxx>
-
-// FIXME Why does BreakPointDialog allow only sal_uInt16 for break-point line
-// numbers, whereas BreakPoint supports sal_uLong?
-
-bool lcl_ParseText( String aText, size_t& rLineNr )
-{
- // aText should look like "# n" where
- // n > 0 && n < std::numeric_limits< sal_uInt16 >::max().
- // All spaces are ignored, so there can even be spaces within the
- // number n. (Maybe it would be better to ignore all whitespace instead
- // of just spaces.)
- aText.EraseAllChars(' ');
- sal_Unicode cFirst = aText.GetChar(0);
- if (cFirst != '#' && !(cFirst >= '0' && cFirst <= '9'))
- return false;
- if (cFirst == '#')
- aText.Erase(0, 1);
- // XXX Assumes that sal_uInt16 is contained within sal_Int32:
- sal_Int32 n = aText.ToInt32();
- if ( n <= 0 )
- return false;
- rLineNr = static_cast< size_t >(n);
- return true;
-}
-
-BreakPointDialog::BreakPointDialog( Window* pParent, BreakPointList& rBrkPntList ) :
- ModalDialog( pParent, IDEResId( RID_BASICIDE_BREAKPOINTDLG ) ),
- aComboBox( this, IDEResId( RID_CB_BRKPOINTS ) ),
- aOKButton( this, IDEResId( RID_PB_OK ) ),
- aCancelButton( this, IDEResId( RID_PB_CANCEL ) ),
- aNewButton( this, IDEResId( RID_PB_NEW ) ),
- aDelButton( this, IDEResId( RID_PB_DEL ) ),
- aCheckBox( this, IDEResId( RID_CHKB_ACTIVE ) ),
- aBrkText( this, IDEResId( RID_FT_BRKPOINTS ) ),
- aPassText( this, IDEResId( RID_FT_PASS ) ),
- aNumericField( this, IDEResId( RID_FLD_PASS ) ),
- m_rOriginalBreakPointList(rBrkPntList),
- m_aModifiedBreakPointList(rBrkPntList)
-{
- FreeResource();
-
- aComboBox.SetUpdateMode( sal_False );
- for ( size_t i = 0, n = m_aModifiedBreakPointList.size(); i < n; ++i )
- {
- BreakPoint* pBrk = m_aModifiedBreakPointList.at( i );
- String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) );
- aEntryStr += String::CreateFromInt32( pBrk->nLine );
- aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND );
- }
- aComboBox.SetUpdateMode( sal_True );
-
- aOKButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) );
- aNewButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) );
- aDelButton.SetClickHdl( LINK( this, BreakPointDialog, ButtonHdl ) );
-
- aCheckBox.SetClickHdl( LINK( this, BreakPointDialog, CheckBoxHdl ) );
- aComboBox.SetSelectHdl( LINK( this, BreakPointDialog, ComboBoxHighlightHdl ) );
- aComboBox.SetModifyHdl( LINK( this, BreakPointDialog, EditModifyHdl ) );
- aComboBox.GrabFocus();
-
- aNumericField.SetMin( 0 );
- aNumericField.SetMax( 0x7FFFFFFF );
- aNumericField.SetSpinSize( 1 );
- aNumericField.SetStrictFormat( sal_True );
- aNumericField.SetModifyHdl( LINK( this, BreakPointDialog, EditModifyHdl ) );
-
- aComboBox.SetText( aComboBox.GetEntry( 0 ) );
- UpdateFields( m_aModifiedBreakPointList.at( 0 ) );
-
- CheckButtons();
-}
-
-void BreakPointDialog::SetCurrentBreakPoint( BreakPoint* pBrk )
-{
- String aStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) );
- aStr += String::CreateFromInt32( pBrk->nLine );
- aComboBox.SetText( aStr );
- UpdateFields( pBrk );
-}
-
-void BreakPointDialog::CheckButtons()
-{
- // "New" button is enabled if the combo box edit contains a valid line
- // number that is not already present in the combo box list; otherwise
- // "OK" and "Delete" buttons are enabled:
- size_t nLine;
- if (lcl_ParseText(aComboBox.GetText(), nLine)
- && m_aModifiedBreakPointList.FindBreakPoint(nLine) == 0)
- {
- aNewButton.Enable();
- aOKButton.Disable();
- aDelButton.Disable();
- }
- else
- {
- aNewButton.Disable();
- aOKButton.Enable();
- aDelButton.Enable();
- }
-}
-
-IMPL_LINK_INLINE_START( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx )
-{
- BreakPoint* pBrk = GetSelectedBreakPoint();
- if ( pBrk )
- pBrk->bEnabled = pChkBx->IsChecked();
-
- return 0;
-}
-IMPL_LINK_INLINE_END( BreakPointDialog, CheckBoxHdl, CheckBox *, pChkBx )
-
-
-
-IMPL_LINK( BreakPointDialog, ComboBoxHighlightHdl, ComboBox *, pBox )
-{
- aNewButton.Disable();
- aOKButton.Enable();
- aDelButton.Enable();
-
- sal_uInt16 nEntry = pBox->GetEntryPos( pBox->GetText() );
- BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry );
- DBG_ASSERT( pBrk, "Kein passender Breakpoint zur Liste ?" );
- UpdateFields( pBrk );
-
- return 0;
-}
-
-
-
-IMPL_LINK( BreakPointDialog, EditModifyHdl, Edit *, pEdit )
-{
- if ( pEdit == &aComboBox )
- CheckButtons();
- else if ( pEdit == &aNumericField )
- {
- BreakPoint* pBrk = GetSelectedBreakPoint();
- if ( pBrk )
- pBrk->nStopAfter = pEdit->GetText().ToInt32();
- }
- return 0;
-}
-
-
-
-IMPL_LINK( BreakPointDialog, ButtonHdl, Button *, pButton )
-{
- if ( pButton == &aOKButton )
- {
- m_rOriginalBreakPointList.transfer(m_aModifiedBreakPointList);
- EndDialog( 1 );
- }
- else if ( pButton == &aNewButton )
- {
- // Checkbox beruecksichtigen!
- String aText( aComboBox.GetText() );
- size_t nLine;
- bool bValid = lcl_ParseText( aText, nLine );
- if ( bValid )
- {
- BreakPoint* pBrk = new BreakPoint( nLine );
- pBrk->bEnabled = aCheckBox.IsChecked();
- pBrk->nStopAfter = (size_t) aNumericField.GetValue();
- m_aModifiedBreakPointList.InsertSorted( pBrk );
- String aEntryStr( RTL_CONSTASCII_USTRINGPARAM( "# " ) );
- aEntryStr += String::CreateFromInt32( pBrk->nLine );
- aComboBox.InsertEntry( aEntryStr, COMBOBOX_APPEND );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED );
- }
- }
- else
- {
- aComboBox.SetText( aText );
- aComboBox.GrabFocus();
- Sound::Beep();
- }
- CheckButtons();
- }
- else if ( pButton == &aDelButton )
- {
- size_t nEntry = aComboBox.GetEntryPos( aComboBox.GetText() );
- BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry );
- if ( pBrk )
- {
- delete m_aModifiedBreakPointList.remove( pBrk );
- aComboBox.RemoveEntry( nEntry );
- if ( nEntry && !( nEntry < aComboBox.GetEntryCount() ) )
- nEntry--;
- aComboBox.SetText( aComboBox.GetEntry( nEntry ) );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
-
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_BRKPNTSCHANGED );
- }
- }
- CheckButtons();
- }
-
- return 0;
-}
-
-
-
-void BreakPointDialog::UpdateFields( BreakPoint* pBrk )
-{
- if ( pBrk )
- {
- aCheckBox.Check( pBrk->bEnabled );
- aNumericField.SetValue( pBrk->nStopAfter );
- }
-}
-
-
-
-BreakPoint* BreakPointDialog::GetSelectedBreakPoint()
-{
- size_t nEntry = aComboBox.GetEntryPos( aComboBox.GetText() );
- BreakPoint* pBrk = m_aModifiedBreakPointList.at( nEntry );
- return pBrk;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/brkdlg.hrc b/basctl/source/basicide/brkdlg.hrc
deleted file mode 100644
index 1f313374f..000000000
--- a/basctl/source/basicide/brkdlg.hrc
+++ /dev/null
@@ -1,45 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BRKDLG_HRC
-#define _BRKDLG_HRC
-
-#include <svl/solar.hrc>
-
-#define RID_BASICIDE_BREAKPOINTDLG ( RID_BASICIDE_START + 80 )
-
-#define RID_CB_BRKPOINTS 2
-#define RID_PB_OK 3
-#define RID_PB_CANCEL 4
-#define RID_PB_NEW 5
-#define RID_PB_DEL 6
-#define RID_CHKB_ACTIVE 7
-#define RID_FT_PASS 8
-#define RID_FT_BRKPOINTS 9
-#define RID_FLD_PASS 10
-
-#endif // _BRKDLG_HRC
-
diff --git a/basctl/source/basicide/brkdlg.hxx b/basctl/source/basicide/brkdlg.hxx
deleted file mode 100644
index 5513b416f..000000000
--- a/basctl/source/basicide/brkdlg.hxx
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BRKDLG_HXX
-#define _BRKDLG_HXX
-
-#include <svheader.hxx>
-#include <bastypes.hxx>
-#include <vcl/dialog.hxx>
-
-#include <vcl/button.hxx>
-#include <vcl/field.hxx>
-#include <vcl/fixed.hxx>
-
-class BreakPointDialog : public ModalDialog
-{
-private:
- ComboBox aComboBox;
- OKButton aOKButton;
- CancelButton aCancelButton;
- PushButton aNewButton;
- PushButton aDelButton;
-// PushButton aShowButton;
- CheckBox aCheckBox;
- FixedText aBrkText;
- FixedText aPassText;
- NumericField aNumericField;
-
- BreakPointList & m_rOriginalBreakPointList;
- BreakPointList m_aModifiedBreakPointList;
-
-protected:
- void CheckButtons();
- DECL_LINK( CheckBoxHdl, CheckBox * );
- DECL_LINK( ComboBoxHighlightHdl, ComboBox * );
- DECL_LINK( EditModifyHdl, Edit * );
- DECL_LINK( ButtonHdl, Button * );
- void UpdateFields( BreakPoint* pBrk );
- BreakPoint* GetSelectedBreakPoint();
-
-
-public:
- BreakPointDialog( Window* pParent, BreakPointList& rBrkList );
-
- void SetCurrentBreakPoint( BreakPoint* pBrk );
-};
-
-#endif // _BRKDLG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/brkdlg.src b/basctl/source/basicide/brkdlg.src
deleted file mode 100644
index 3f08bb23f..000000000
--- a/basctl/source/basicide/brkdlg.src
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "helpid.hrc"
-#include <brkdlg.hrc>
-ModalDialog RID_BASICIDE_BREAKPOINTDLG
-{
- HelpId = "basctl:RID_BASICIDE_BREAKPOINTDLG" ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 178 , 116 ) ;
- Moveable = TRUE ;
- // Closeable = TRUE;
- ComboBox RID_CB_BRKPOINTS
- {
- HelpID = "basctl:ComboBox:RID_BASICIDE_BREAKPOINTDLG:RID_CB_BRKPOINTS";
- Pos = MAP_APPFONT ( 6 , 14 ) ;
- Size = MAP_APPFONT ( 110 , 70 ) ;
- TabStop = TRUE ;
- };
- OKButton RID_PB_OK
- {
- Pos = MAP_APPFONT ( 122 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- CancelButton RID_PB_CANCEL
- {
- Pos = MAP_APPFONT ( 122 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEW
- {
- HelpID = "basctl:PushButton:RID_BASICIDE_BREAKPOINTDLG:RID_PB_NEW";
- Pos = MAP_APPFONT ( 122 , 57 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "New" ;
- };
- PushButton RID_PB_DEL
- {
- HelpID = "basctl:PushButton:RID_BASICIDE_BREAKPOINTDLG:RID_PB_DEL";
- Pos = MAP_APPFONT ( 122 , 74 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Delete" ;
- };
- CheckBox RID_CHKB_ACTIVE
- {
- HelpID = "basctl:CheckBox:RID_BASICIDE_BREAKPOINTDLG:RID_CHKB_ACTIVE";
- Pos = MAP_APPFONT ( 6 , 87 ) ;
- Size = MAP_APPFONT ( 40 , 12 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Active" ;
- };
- FixedText RID_FT_PASS
- {
- Pos = MAP_APPFONT ( 6 , 102 ) ;
- Size = MAP_APPFONT ( 75 , 10 ) ;
- Text [ en-US ] = "Pass Count:" ;
- };
- FixedText RID_FT_BRKPOINTS
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 110, 10 ) ;
- Text [ en-US ] = "Breakpoints" ;
- };
- NumericField RID_FLD_PASS
- {
- HelpID = "basctl:NumericField:RID_BASICIDE_BREAKPOINTDLG:RID_FLD_PASS";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 81 , 100 ) ;
- Size = MAP_APPFONT ( 35 , 12 ) ;
- TabStop = TRUE ;
- };
- Text [ en-US ] = "Manage Breakpoints" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/basctl/source/basicide/doceventnotifier.cxx b/basctl/source/basicide/doceventnotifier.cxx
deleted file mode 100644
index 64b41dc48..000000000
--- a/basctl/source/basicide/doceventnotifier.cxx
+++ /dev/null
@@ -1,280 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "doceventnotifier.hxx"
-#include "scriptdocument.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/document/XEventBroadcaster.hpp>
-/** === end UNO includes === **/
-
-#include <vcl/svapp.hxx>
-
-#include <tools/diagnose_ex.h>
-
-#include <comphelper/componentcontext.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <osl/mutex.hxx>
-#include <sal/macros.h>
-
-#include <cppuhelper/compbase1.hxx>
-#include <cppuhelper/basemutex.hxx>
-
-//........................................................................
-namespace basctl
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEventListener;
- using ::com::sun::star::document::EventObject;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::uno::UNO_QUERY;
- /** === end UNO using === **/
- namespace csslang = ::com::sun::star::lang;
-
- //====================================================================
- //= DocumentEventNotifier_Impl
- //====================================================================
- typedef ::cppu::WeakComponentImplHelper1 < XEventListener
- > DocumentEventNotifier_Impl_Base;
-
- enum ListenerAction
- {
- RegisterListener,
- RemoveListener
- };
-
- /** impl class for DocumentEventNotifier
- */
- class DocumentEventNotifier_Impl :public ::boost::noncopyable
- ,public ::cppu::BaseMutex
- ,public DocumentEventNotifier_Impl_Base
- {
- public:
- DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument );
-
- // document::XEventListener
- virtual void SAL_CALL notifyEvent( const EventObject& Event ) throw (RuntimeException);
-
- // lang::XEventListener
- virtual void SAL_CALL disposing( const csslang::EventObject& Event ) throw (RuntimeException);
-
- // ComponentHelper
- virtual void SAL_CALL disposing();
-
- protected:
- ~DocumentEventNotifier_Impl();
-
- private:
- /// determines whether the instance is already disposed
- bool impl_isDisposed_nothrow() const { return m_pListener == NULL; }
-
- /// disposes the instance
- void impl_dispose_nothrow();
-
- /// registers or revokes the instance as listener at the global event broadcaster
- void impl_listenerAction_nothrow( ListenerAction _eAction );
-
- private:
- DocumentEventListener* m_pListener;
- Reference< XModel > m_xModel;
- };
-
- //--------------------------------------------------------------------
- DocumentEventNotifier_Impl::DocumentEventNotifier_Impl( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument )
- :DocumentEventNotifier_Impl_Base( m_aMutex )
- ,m_pListener( &_rListener )
- ,m_xModel( _rxDocument )
- {
- osl_incrementInterlockedCount( &m_refCount );
- impl_listenerAction_nothrow( RegisterListener );
- osl_decrementInterlockedCount( &m_refCount );
- }
-
- //--------------------------------------------------------------------
- DocumentEventNotifier_Impl::~DocumentEventNotifier_Impl()
- {
- if ( !impl_isDisposed_nothrow() )
- {
- acquire();
- dispose();
- }
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL DocumentEventNotifier_Impl::notifyEvent( const EventObject& _rEvent ) throw (RuntimeException)
- {
- ::osl::ClearableMutexGuard aGuard( m_aMutex );
-
- OSL_PRECOND( !impl_isDisposed_nothrow(), "DocumentEventNotifier_Impl::notifyEvent: disposed, but still getting events?" );
- if ( impl_isDisposed_nothrow() )
- return;
-
- Reference< XModel > xDocument( _rEvent.Source, UNO_QUERY );
- OSL_ENSURE( xDocument.is(), "DocumentEventNotifier_Impl::notifyEvent: illegal source document!" );
- if ( !xDocument.is() )
- return;
-
- struct EventEntry
- {
- const sal_Char* pEventName;
- void (DocumentEventListener::*listenerMethod)( const ScriptDocument& _rDocument );
- };
- EventEntry aEvents[] = {
- { "OnNew", &DocumentEventListener::onDocumentCreated },
- { "OnLoad", &DocumentEventListener::onDocumentOpened },
- { "OnSave", &DocumentEventListener::onDocumentSave },
- { "OnSaveDone", &DocumentEventListener::onDocumentSaveDone },
- { "OnSaveAs", &DocumentEventListener::onDocumentSaveAs },
- { "OnSaveAsDone", &DocumentEventListener::onDocumentSaveAsDone },
- { "OnUnload", &DocumentEventListener::onDocumentClosed },
- { "OnTitleChanged", &DocumentEventListener::onDocumentTitleChanged },
- { "OnModeChanged", &DocumentEventListener::onDocumentModeChanged }
- };
-
- for ( size_t i=0; i < SAL_N_ELEMENTS( aEvents ); ++i )
- {
- if ( !_rEvent.EventName.equalsAscii( aEvents[i].pEventName ) )
- continue;
-
- ScriptDocument aDocument( xDocument );
- {
- // the listener implementations usually require the SolarMutex, so lock it here.
- // But ensure the proper order of locking the solar and the own mutex
- aGuard.clear();
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard2( m_aMutex );
-
- if ( impl_isDisposed_nothrow() )
- // somebody took the chance to dispose us -> bail out
- return;
-
- (m_pListener->*aEvents[i].listenerMethod)( aDocument );
- }
- break;
- }
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL DocumentEventNotifier_Impl::disposing( const csslang::EventObject& /*Event*/ ) throw (RuntimeException)
- {
- SolarMutexGuard aSolarGuard;
- ::osl::MutexGuard aGuard( m_aMutex );
-
- if ( !impl_isDisposed_nothrow() )
- impl_dispose_nothrow();
- }
-
- //--------------------------------------------------------------------
- void SAL_CALL DocumentEventNotifier_Impl::disposing()
- {
- impl_listenerAction_nothrow( RemoveListener );
- impl_dispose_nothrow();
- }
-
- //--------------------------------------------------------------------
- void DocumentEventNotifier_Impl::impl_dispose_nothrow()
- {
- m_pListener = NULL;
- m_xModel.clear();
- }
-
- //--------------------------------------------------------------------
- void DocumentEventNotifier_Impl::impl_listenerAction_nothrow( ListenerAction _eAction )
- {
- try
- {
- Reference< XEventBroadcaster > xBroadcaster;
- if ( m_xModel.is() )
- xBroadcaster.set( m_xModel, UNO_QUERY_THROW );
- else
- {
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- xBroadcaster.set(
- aContext.createComponent( "com.sun.star.frame.GlobalEventBroadcaster" ),
- UNO_QUERY_THROW );
- }
-
- void ( SAL_CALL XEventBroadcaster::*listenerAction )( const Reference< XEventListener >& ) =
- ( _eAction == RegisterListener ) ? &XEventBroadcaster::addEventListener : &XEventBroadcaster::removeEventListener;
- (xBroadcaster.get()->*listenerAction)( this );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //====================================================================
- //= DocumentEventNotifier
- //====================================================================
- //--------------------------------------------------------------------
- DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener, const Reference< XModel >& _rxDocument )
- :m_pImpl( new DocumentEventNotifier_Impl( _rListener, _rxDocument ) )
- {
- }
-
- //--------------------------------------------------------------------
- DocumentEventNotifier::DocumentEventNotifier( DocumentEventListener& _rListener )
- :m_pImpl( new DocumentEventNotifier_Impl( _rListener, Reference< XModel >() ) )
- {
- }
-
- //--------------------------------------------------------------------
- DocumentEventNotifier::~DocumentEventNotifier()
- {
- }
-
- //--------------------------------------------------------------------
- void DocumentEventNotifier::dispose()
- {
- m_pImpl->dispose();
- }
-
- //====================================================================
- //= DocumentEventListener
- //====================================================================
- DocumentEventListener::~DocumentEventListener()
- {
- }
-
-//........................................................................
-} // namespace basctl
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/docsignature.cxx b/basctl/source/basicide/docsignature.cxx
deleted file mode 100644
index 07c258cc3..000000000
--- a/basctl/source/basicide/docsignature.cxx
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "docsignature.hxx"
-#include "scriptdocument.hxx"
-
-/** === begin UNO includes === **/
-/** === end UNO includes === **/
-
-#include <sfx2/objsh.hxx>
-#include <sfx2/signaturestate.hxx>
-
-//........................................................................
-namespace basctl
-{
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::frame::XModel;
- /** === end UNO using === **/
-
- //====================================================================
- //= DocumentSignature_Data
- //====================================================================
- struct DocumentSignature_Data
- {
- SfxObjectShell* pShell;
-
- DocumentSignature_Data() : pShell( NULL ) { }
- };
-
- //====================================================================
- //= DocumentSignature
- //====================================================================
- //--------------------------------------------------------------------
- DocumentSignature::DocumentSignature( const ScriptDocument& _rDocument )
- :m_pData( new DocumentSignature_Data )
- {
- if ( _rDocument.isDocument() )
- {
- Reference< XModel > xDocument( _rDocument.getDocument() );
- // find object shell for document
- SfxObjectShell* pShell = SfxObjectShell::GetFirst();
- while ( pShell )
- {
- if ( pShell->GetModel() == xDocument )
- break;
- pShell = SfxObjectShell::GetNext( *pShell );
- }
- m_pData->pShell = pShell;
- }
- }
-
- //--------------------------------------------------------------------
- DocumentSignature::~DocumentSignature()
- {
- }
-
- //--------------------------------------------------------------------
- bool DocumentSignature::supportsSignatures() const
- {
- return ( m_pData->pShell != NULL );
- }
-
- //--------------------------------------------------------------------
- void DocumentSignature::signScriptingContent() const
- {
- OSL_PRECOND( supportsSignatures(), "DocumentSignature::signScriptingContent: signatures not supported by this document!" );
- if ( m_pData->pShell )
- m_pData->pShell->SignScriptingContent();
- }
-
- //--------------------------------------------------------------------
- sal_uInt16 DocumentSignature::getScriptingSignatureState() const
- {
- if ( m_pData->pShell )
- return m_pData->pShell->GetScriptingSignatureState();
- return SIGNATURESTATE_NOSIGNATURES;
- }
-
-//........................................................................
-} // namespace basctl
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/documentenumeration.cxx b/basctl/source/basicide/documentenumeration.cxx
deleted file mode 100644
index dc1d108d9..000000000
--- a/basctl/source/basicide/documentenumeration.cxx
+++ /dev/null
@@ -1,206 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "documentenumeration.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/frame/XFramesSupplier.hpp>
-/** === end UNO includes === **/
-
-#include <tools/diagnose_ex.h>
-
-#include <comphelper/stl_types.hxx>
-
-//........................................................................
-namespace basctl { namespace docs {
-//........................................................................
-
- /** === begin UNO using === **/
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::frame::XDesktop;
- using ::com::sun::star::container::XEnumerationAccess;
- using ::com::sun::star::container::XEnumeration;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::frame::XFramesSupplier;
- using ::com::sun::star::frame::XFrames;
- using ::com::sun::star::frame::XController;
- using ::com::sun::star::frame::XModel2;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::lang::XServiceInfo;
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::frame::XFrame;
- /** === end UNO using === **/
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-
- //====================================================================
- //= DocumentEnumeration_Data
- //====================================================================
- struct DocumentEnumeration_Data
- {
- ::comphelper::ComponentContext aContext;
- const IDocumentDescriptorFilter* pFilter;
-
- DocumentEnumeration_Data( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter )
- :aContext( _rContext )
- ,pFilter( _pFilter )
- {
- }
- };
-
- //====================================================================
- //= DocumentEnumeration
- //====================================================================
- //--------------------------------------------------------------------
- DocumentEnumeration::DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter )
- :m_pData( new DocumentEnumeration_Data( _rContext, _pFilter ) )
- {
- }
-
- //--------------------------------------------------------------------
- DocumentEnumeration::~DocumentEnumeration()
- {
- }
-
- //--------------------------------------------------------------------
- namespace
- {
- //................................................................
- void lcl_getDocumentControllers_nothrow( DocumentDescriptor& _io_rDocDesc )
- {
- OSL_PRECOND( _io_rDocDesc.xModel.is(), "lcl_getDocumentControllers_nothrow: illegal model!" );
-
- _io_rDocDesc.aControllers.clear();
- try
- {
- Reference< XModel2 > xModel2( _io_rDocDesc.xModel, UNO_QUERY );
- if ( xModel2.is() )
- {
- Reference< XEnumeration > xEnum( xModel2->getControllers(), UNO_SET_THROW );
- while ( xEnum->hasMoreElements() )
- {
- Reference< XController > xController( xEnum->nextElement(), UNO_QUERY_THROW );
- _io_rDocDesc.aControllers.push_back( xController );
- }
- }
- else if ( _io_rDocDesc.xModel.is() )
- _io_rDocDesc.aControllers.push_back( _io_rDocDesc.xModel->getCurrentController() );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- //................................................................
- void lcl_getDocuments_nothrow( const Sequence< Reference< XFrame > >& _rFrames, Documents& _out_rDocuments,
- const IDocumentDescriptorFilter* _pFilter )
- {
- // ensure we don't encounter some models multiple times
- ::std::set< Reference< XModel >, ::comphelper::OInterfaceCompare< XModel > > aEncounteredModels;
-
- for ( const Reference< XFrame >* pFrame = _rFrames.getConstArray();
- pFrame != _rFrames.getConstArray() + _rFrames.getLength();
- ++pFrame
- )
- {
- try
- {
- OSL_ENSURE( pFrame->is(), "lcl_getDocuments_nothrow: illegal frame!" );
- if ( !pFrame->is() )
- continue;
- Reference< XController > xController( (*pFrame)->getController() );
- if ( !xController.is() )
- continue;
-
- Reference< XModel > xModel( xController->getModel() );
- if ( !xModel.is() )
- // though it's legal for a controller to not have a model, we're not interested in
- // those
- continue;
-
- if ( aEncounteredModels.find( xModel ) != aEncounteredModels.end() )
- // there might be multiple frames for the same model
- // handle it only once
- continue;
- aEncounteredModels.insert( xModel );
-
- // create a DocumentDescriptor
- DocumentDescriptor aDescriptor;
- aDescriptor.xModel = xModel;
- lcl_getDocumentControllers_nothrow( aDescriptor );
-
- // consult filter, if there is one
- if ( _pFilter && !_pFilter->includeDocument( aDescriptor ) )
- continue;
-
- _out_rDocuments.push_back( aDescriptor );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
- }
-
- //--------------------------------------------------------------------
- void DocumentEnumeration::getDocuments( Documents& _out_rDocuments ) const
- {
- _out_rDocuments.clear();
-
- try
- {
- const Reference< XDesktop > xDesktop( m_pData->aContext.createComponent( "com.sun.star.frame.Desktop" ), UNO_QUERY_THROW );
- const Reference< XFramesSupplier > xSuppFrames( xDesktop, UNO_QUERY_THROW );
- const Reference< XFrames > xFrames( xSuppFrames->getFrames(), UNO_SET_THROW );
- const Sequence< Reference< XFrame > > aFrames( xFrames->queryFrames( FrameSearchFlag::ALL ) );
-
- lcl_getDocuments_nothrow( aFrames, _out_rDocuments, m_pData->pFilter );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
-//........................................................................
-} } // namespace basctl::docs
-//........................................................................
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/documentenumeration.hxx b/basctl/source/basicide/documentenumeration.hxx
deleted file mode 100644
index a0767ac1f..000000000
--- a/basctl/source/basicide/documentenumeration.hxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef BASCTL_DOCUMENTENUMERATION_HXX
-#define BASCTL_DOCUMENTENUMERATION_HXX
-
-/** === begin UNO includes === **/
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XController.hpp>
-/** === end UNO includes === **/
-
-#include <comphelper/componentcontext.hxx>
-
-#include <memory>
-#include <vector>
-
-//........................................................................
-namespace basctl { namespace docs {
-//........................................................................
-
- typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > Model;
- typedef ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController > > Controllers;
-
- struct DocumentDescriptor
- {
- Model xModel;
- Controllers aControllers;
- };
-
- typedef ::std::vector< DocumentDescriptor > Documents;
-
- //====================================================================
- //= IDocumentDescriptorFilter
- //====================================================================
- /// allows pre-filtering when enumerating document descriptors
- class SAL_NO_VTABLE IDocumentDescriptorFilter
- {
- public:
- virtual bool includeDocument( const DocumentDescriptor& _rDocument ) const = 0;
- };
-
- //====================================================================
- //= DocumentEnumeration
- //====================================================================
- struct DocumentEnumeration_Data;
- /** is a helper class for enumerating documents in OOo
-
- If you need a list of all open documents in OOo, this is little bit of
- a hassle: You need to iterate though all components at the desktop, which
- might or might not be documents.
-
- Additionally, you need to examine the existing documents' frames
- for sub frames, which might contain sub documents (e.g. embedded objects
- edited out-place).
-
- DocumentEnumeration relieves you from this hassle.
- */
- class DocumentEnumeration
- {
- public:
- DocumentEnumeration( const ::comphelper::ComponentContext& _rContext, const IDocumentDescriptorFilter* _pFilter = NULL );
- ~DocumentEnumeration();
-
- /** retrieves a list of all currently known documents in the application
-
- @param _out_rDocuments
- output parameter taking the collected document information
- @
- */
- void getDocuments(
- Documents& _out_rDocuments
- ) const;
-
- private:
- ::std::auto_ptr< DocumentEnumeration_Data > m_pData;
- };
-
-//........................................................................
-} } // namespace basctl::docs
-//........................................................................
-
-#endif // BASCTL_DOCUMENTENUMERATION_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/ide_pch.cxx b/basctl/source/basicide/ide_pch.cxx
deleted file mode 100644
index 3a80c6552..000000000
--- a/basctl/source/basicide/ide_pch.cxx
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-#include <ide_pch.hxx>
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/ide_pch.hxx b/basctl/source/basicide/ide_pch.hxx
deleted file mode 100644
index 0c14f7ea1..000000000
--- a/basctl/source/basicide/ide_pch.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include <svheader.hxx>
-
-#define ITEMID_SEARCH 0
-#define ITEMID_SIZE 0
-
-#include <vcl/wrkwin.hxx>
-#include <vcl/msgbox.hxx>
-#include <vcl/menu.hxx>
-
-#include <svl/svarray.hxx>
-#include <svl/itemset.hxx>
-#include <svl/aeitem.hxx>
-#include <svl/stritem.hxx>
-#include <svl/whiter.hxx>
-#include <svl/intitem.hxx>
-#include <svl/srchitem.hxx>
-
-#define _BASIC_TEXTPORTIONS
-#include <basic/sbdef.hxx>
-#include <basic/sbstar.hxx>
-#include <basic/sbmeth.hxx>
-#include <basic/sbmod.hxx>
-#include <basic/basmgr.hxx>
-
-#include <sfx2/app.hxx>
-#include <sfx2/objface.hxx>
-#include <sfx2/printer.hxx>
-#include <sfx2/viewsh.hxx>
-#include <sfx2/event.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/request.hxx>
-#include <sfx2/childwin.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/objsh.hxx>
-#include <sfx2/genlink.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/minfitem.hxx>
-#include <sfx2/dinfdlg.hxx>
-#include <sfx2/docfac.hxx>
-#include <sfx2/progress.hxx>
-#include <editeng/sizeitem.hxx>
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/iderdll.cxx b/basctl/source/basicide/iderdll.cxx
deleted file mode 100644
index e231b2844..000000000
--- a/basctl/source/basicide/iderdll.cxx
+++ /dev/null
@@ -1,201 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-
-#include <ide_pch.hxx>
-
-
-#include <svheader.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/dispatch.hxx>
-#include <sfx2/genlink.hxx>
-
-
-#include <svl/solar.hrc>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <iderid.hxx>
-#include <svx/svxids.hrc>
-#include <basidesh.hxx>
-#include <basidesh.hrc>
-#include <basobj.hxx>
-#include <bastypes.hxx>
-#include <basdoc.hxx>
-#include <basicmod.hxx>
-#include <propbrw.hxx>
-
-
-#define ITEMID_SEARCH 0
-#include <svl/srchitem.hxx>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-
-static BasicIDEDLL* pBasicIDEDLL = 0;
-
-BasicIDEDLL* BasicIDEDLL::GetDLL()
-{
- return pBasicIDEDLL;
-}
-
-IDEResId::IDEResId( sal_uInt16 nId ):
- ResId( nId, *(*(BasicIDEModule**)GetAppData(SHL_IDE))->GetResMgr() )
-{
-}
-
-BasicIDEDLL::BasicIDEDLL()
-{
- pBasicIDEDLL = this;
- pShell = 0;
- pExtraData = 0;
-
- GetExtraData(); // damit GlobalErrorHdl gesetzt wird.
-}
-
-BasicIDEDLL::~BasicIDEDLL()
-{
- delete pExtraData;
- *(BasicIDEDLL**)GetAppData(SHL_IDE) = NULL;
-}
-
-void BasicIDEDLL::Init()
-{
- if ( pBasicIDEDLL )
- return;
-
- SfxObjectFactory* pFact = &BasicDocShell::Factory();
- (void)pFact;
-
- ResMgr* pMgr = ResMgr::CreateResMgr(
- "basctl", Application::GetSettings().GetUILocale() );
-
- BASIC_MOD() = new BasicIDEModule( pMgr, &BasicDocShell::Factory() );
-
- new BasicIDEDLL;
- SfxModule* pMod = BASIC_MOD();
-
- SfxObjectFactory& rFactory = BasicDocShell::Factory();
- rFactory.SetDocumentServiceName( String::CreateFromAscii( "com.sun.star.script.BasicIDE" ) );
-
- BasicDocShell::RegisterInterface( pMod );
- BasicIDEShell::RegisterFactory( SVX_INTERFACE_BASIDE_VIEWSH );
- BasicIDEShell::RegisterInterface( pMod );
-
- PropBrwMgr::RegisterChildWindow();
-}
-
-BasicIDEData* BasicIDEDLL::GetExtraData()
-{
- if ( !pExtraData )
- pExtraData = new BasicIDEData;
- return pExtraData;
-}
-
-BasicIDEData::BasicIDEData() : aObjCatPos( INVPOSITION, INVPOSITION )
-{
- nBasicDialogCount = 0;
- bChoosingMacro = sal_False;
- bShellInCriticalSection = sal_False;
- pSearchItem = new SvxSearchItem( SID_SEARCH_ITEM );
-
- StarBASIC::SetGlobalBreakHdl( LINK( this, BasicIDEData, GlobalBasicBreakHdl ) );
-
- pAccelerator = 0;
-}
-
-BasicIDEData::~BasicIDEData()
-{
- // ErrorHdl zuruecksetzen ist zwar sauberer, aber diese Instanz wird
- // sowieso sehr spaet, nach dem letzten Basic, zerstoert.
- // Durch den Aufruf werden dann aber wieder AppDaten erzeugt und nicht
- // mehr zerstoert => MLK's beim Purify
-// StarBASIC::SetGlobalErrorHdl( Link() );
-// StarBASIC::SetGlobalBreakHdl( Link() );
-// StarBASIC::setGlobalStarScriptListener( XEngineListenerRef() );
-
- delete pSearchItem;
- //delete pAccelerator;
-}
-
-SvxSearchItem& BasicIDEData::GetSearchItem() const
-{
- return *pSearchItem;
-}
-
-void BasicIDEData::SetSearchItem( const SvxSearchItem& rItem )
-{
- delete pSearchItem;
- pSearchItem = (SvxSearchItem*)rItem.Clone();
-}
-
-IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic )
-{
- long nRet = 0;
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
- if ( pBasMgr )
- {
- // Hier lande ich zweimal, wenn Step into protected Basic
- // => schlecht, wenn Passwortabfrage 2x, ausserdem sieht man in
- // dem PasswordDlg nicht, fuer welche Lib...
- // => An dieser Stelle keine Passwort-Abfrage starten
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- OSL_ENSURE( aDocument.isValid(), "BasicIDEData::GlobalBasicBreakHdl: no document for the basic manager!" );
- if ( aDocument.isValid() )
- {
- ::rtl::OUString aOULibName( pBasic->GetName() );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- // Ein Step-Out muesste mich aus den geschuetzten Bereich befoerdern...
- nRet = SbDEBUG_STEPOUT;
- }
- else
- {
- nRet = pIDEShell->CallBasicBreakHdl( pBasic );
- }
- }
- }
- }
- }
-
- return nRet;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/iderdll2.hxx b/basctl/source/basicide/iderdll2.hxx
deleted file mode 100644
index 3ed3ee642..000000000
--- a/basctl/source/basicide/iderdll2.hxx
+++ /dev/null
@@ -1,109 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _IDERDLL2_HXX
-#define _IDERDLL2_HXX
-
-class StarBASIC;
-class SvxSearchItem;
-class Accelerator;
-
-#include <tools/string.hxx>
-#include <tools/gen.hxx>
-#include <tools/link.hxx>
-
-#include <bastypes.hxx>
-#include <bastype2.hxx>
-
-#define INVPOSITION 0x7fff
-
-class BasicIDEData
-{
-private:
- Accelerator* pAccelerator;
- SvxSearchItem* pSearchItem;
-
- LibInfos aLibInfos;
-
- BasicEntryDescriptor m_aLastEntryDesc;
-
- Point aObjCatPos;
- Size aObjCatSize;
-
- String aAddLibPath;
- String aAddLibFilter;
-
- sal_uInt16 nBasicDialogCount;
-
- sal_Bool OLD_bRelMacroRecording;
- sal_Bool bChoosingMacro;
- sal_Bool bShellInCriticalSection;
-
-protected:
- DECL_LINK( GlobalBasicBreakHdl, StarBASIC * );
-
-public:
- BasicIDEData();
- ~BasicIDEData();
-
- LibInfos& GetLibInfos() { return aLibInfos; }
-
- BasicEntryDescriptor& GetLastEntryDescriptor() { return m_aLastEntryDesc; }
- void SetLastEntryDescriptor( BasicEntryDescriptor& rDesc ) { m_aLastEntryDesc = rDesc; }
-
- sal_Bool& ChoosingMacro() { return bChoosingMacro; }
- sal_Bool& ShellInCriticalSection() { return bShellInCriticalSection; }
-
- sal_uInt16 GetBasicDialogCount() const { return nBasicDialogCount; }
- void IncBasicDialogCount() { nBasicDialogCount++; }
- void DecBasicDialogCount() { nBasicDialogCount--; }
-
- SvxSearchItem& GetSearchItem() const;
- void SetSearchItem( const SvxSearchItem& rItem );
-
- void SetObjectCatalogPos( const Point& rPnt )
- { aObjCatPos = rPnt; }
- const Point& GetObjectCatalogPos() const
- { return aObjCatPos; }
-
- void SetObjectCatalogSize( const Size& rSize )
- { aObjCatSize = rSize; }
- const Size& GetObjectCatalogSize() const
- { return aObjCatSize; }
-
- const String& GetAddLibPath() const { return aAddLibPath; }
- void SetAddLibPath( const String& rPath ) { aAddLibPath = rPath; }
-
- const String& GetAddLibFilter() const { return aAddLibFilter; }
- void SetAddLibFilter( const String& rFilter ) { aAddLibFilter = rFilter; }
-};
-
-
-#endif //_IDERDLL2_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/idetemp.hxx b/basctl/source/basicide/idetemp.hxx
deleted file mode 100644
index 2d8d826bd..000000000
--- a/basctl/source/basicide/idetemp.hxx
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _IDETEMP_HXX
-#define _IDETEMP_HXX
-
-
-enum SvxChooseControlEnum
-{
- SVX_SNAP_PUSHBUTTON,
- SVX_SNAP_CHECKBOX,
- SVX_SNAP_RADIOBUTTON,
- SVX_SNAP_SPINBUTTON,
- SVX_SNAP_FIXEDTEXT,
- SVX_SNAP_GROUPBOX,
- SVX_SNAP_LISTBOX,
- SVX_SNAP_COMBOBOX,
- SVX_SNAP_EDIT,
- SVX_SNAP_HSCROLLBAR,
- SVX_SNAP_VSCROLLBAR,
- SVX_SNAP_PREVIEW,
- SVX_SNAP_SELECT,
- SVX_SNAP_URLBUTTON,
- SVX_SNAP_NOTHING,
- SVX_SNAP_IMAGECONTROL,
- SVX_SNAP_PROGRESSBAR,
- SVX_SNAP_HFIXEDLINE,
- SVX_SNAP_VFIXEDLINE,
- SVX_SNAP_DATEFIELD,
- SVX_SNAP_TIMEFIELD,
- SVX_SNAP_NUMERICFIELD,
- SVX_SNAP_CURRENCYFIELD,
- SVX_SNAP_FORMATTEDFIELD,
- SVX_SNAP_PATTERNFIELD,
- SVX_SNAP_FILECONTROL,
- SVX_SNAP_TREECONTROL
-};
-
-#define SvxChooseControlItem SfxAllEnumItem
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx
deleted file mode 100644
index 499de7996..000000000
--- a/basctl/source/basicide/localizationmgr.cxx
+++ /dev/null
@@ -1,1180 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "precompiled_basctl.hxx"
-#include <ide_pch.hxx>
-
-#include <basidesh.hxx>
-#include <baside3.hxx>
-#include <basobj.hxx>
-#include <iderdll.hxx>
-#include "dlged.hxx"
-
-#include <localizationmgr.hxx>
-#include <com/sun/star/resource/XStringResourceSupplier.hpp>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::beans;
-using namespace ::com::sun::star::resource;
-
-static ::rtl::OUString aDot( RTL_CONSTASCII_USTRINGPARAM( "." ));
-static ::rtl::OUString aEsc( RTL_CONSTASCII_USTRINGPARAM( "&" ));
-static ::rtl::OUString aSemi( RTL_CONSTASCII_USTRINGPARAM( ";" ));
-
-
-LocalizationMgr::LocalizationMgr( BasicIDEShell* pIDEShell,
- const ScriptDocument& rDocument, String aLibName,
- const Reference< XStringResourceManager >& xStringResourceManager )
- : m_xStringResourceManager( xStringResourceManager )
- , m_pIDEShell( pIDEShell )
- , m_aDocument( rDocument )
- , m_aLibName( aLibName )
-{
-}
-
-bool LocalizationMgr::isLibraryLocalized( void )
-{
- bool bRet = false;
- if( m_xStringResourceManager.is() )
- {
- Sequence< Locale > aLocaleSeq = m_xStringResourceManager->getLocales();
- bRet = ( aLocaleSeq.getLength() > 0 );
- }
- return bRet;
-}
-
-void LocalizationMgr::handleTranslationbar( void )
-{
- static ::rtl::OUString aLayoutManagerName( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ));
- static ::rtl::OUString aToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/translationbar" ));
-
- Reference< beans::XPropertySet > xFrameProps
- ( m_pIDEShell->GetViewFrame()->GetFrame().GetFrameInterface(), uno::UNO_QUERY );
- if ( xFrameProps.is() )
- {
- Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
- uno::Any a = xFrameProps->getPropertyValue( aLayoutManagerName );
- a >>= xLayoutManager;
- if ( xLayoutManager.is() )
- {
- if ( !isLibraryLocalized() )
- {
- xLayoutManager->destroyElement( aToolBarResName );
- }
- else
- {
- xLayoutManager->createElement( aToolBarResName );
- xLayoutManager->requestElement( aToolBarResName );
- }
- }
- }
-}
-
-
-// TODO: -> export from toolkit
-
-struct LanguageDependentProp
-{
- const char* pPropName;
- sal_Int32 nPropNameLength;
-};
-
-static LanguageDependentProp aLanguageDependentProp[] =
-{
- { "Text", 4 },
- { "Label", 5 },
- { "Title", 5 },
- { "HelpText", 8 },
- { "CurrencySymbol", 14 },
- { "StringItemList", 14 },
- { 0, 0 }
-};
-
-bool isLanguageDependentProperty( ::rtl::OUString aName )
-{
- bool bRet = false;
-
- LanguageDependentProp* pLangDepProp = aLanguageDependentProp;
- while( pLangDepProp->pPropName != 0 )
- {
- if( aName.equalsAsciiL( pLangDepProp->pPropName, pLangDepProp->nPropNameLength ))
- {
- bRet = true;
- break;
- }
- pLangDepProp++;
- }
- return bRet;
-}
-
-
-void LocalizationMgr::implEnableDisableResourceForAllLibraryDialogs( HandleResourceMode eMode )
-{
- Sequence< ::rtl::OUString > aDlgNames = m_aDocument.getObjectNames( E_DIALOGS, m_aLibName );
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
-
- Reference< XStringResourceResolver > xDummyStringResolver;
- for( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
- {
- String aDlgName = pDlgNames[ i ];
- DialogWindow* pWin = m_pIDEShell->FindDlgWin( m_aDocument, m_aLibName, aDlgName, sal_False );
- if( pWin && pWin->IsA( TYPE( DialogWindow ) ) )
- {
- DialogWindow* pDialogWin = static_cast< DialogWindow* >( pWin );
- Reference< container::XNameContainer > xDialog = pDialogWin->GetDialog();
- if( xDialog.is() )
- {
- // Handle dialog itself as control
- Any aDialogCtrl;
- aDialogCtrl <<= xDialog;
- implHandleControlResourceProperties( aDialogCtrl, aDlgName,
- ::rtl::OUString(), m_xStringResourceManager, xDummyStringResolver, eMode );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialog->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 j = 0 ; j < nCtrls ; ++j )
- {
- ::rtl::OUString aCtrlName( pNames[j] );
- Any aCtrl = xDialog->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDlgName,
- aCtrlName, m_xStringResourceManager, xDummyStringResolver, eMode );
- }
- }
- }
- }
-}
-
-
-::rtl::OUString implCreatePureResourceId
- ( const ::rtl::OUString& aDialogName, const ::rtl::OUString& aCtrlName,
- const ::rtl::OUString& aPropName,
- Reference< XStringResourceManager > xStringResourceManager )
-{
- sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
- ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId );
- aPureIdStr += aDot;
- aPureIdStr += aDialogName;
- aPureIdStr += aDot;
- if( aCtrlName.getLength() )
- {
- aPureIdStr += aCtrlName;
- aPureIdStr += aDot;
- }
- aPureIdStr += aPropName;
- return aPureIdStr;
-}
-
-extern bool localesAreEqual( const ::com::sun::star::lang::Locale& rLocaleLeft,
- const ::com::sun::star::lang::Locale& rLocaleRight );
-
-// Works on xStringResourceManager's current language for SET_IDS/RESET_IDS,
-// anyway only one language should exist when calling this method then,
-// either the first one for mode SET_IDS or the last one for mode RESET_IDS
-sal_Int32 LocalizationMgr::implHandleControlResourceProperties
- ( Any aControlAny, const ::rtl::OUString& aDialogName, const ::rtl::OUString& aCtrlName,
- Reference< XStringResourceManager > xStringResourceManager,
- Reference< XStringResourceResolver > xSourceStringResolver, HandleResourceMode eMode )
-{
- sal_Int32 nChangedCount = 0;
-
- Reference< XPropertySet > xPropertySet;
- aControlAny >>= xPropertySet;
- if( xPropertySet.is() )
- {
- Sequence< Locale > aLocaleSeq = xStringResourceManager->getLocales();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
- if( nLocaleCount == 0 )
- return 0;
-
- Reference< XPropertySetInfo > xPropertySetInfo = xPropertySet->getPropertySetInfo();
- if( xPropertySetInfo.is() )
- {
- // get sequence of control properties
- Sequence< Property > aPropSeq = xPropertySetInfo->getProperties();
- const Property* pProps = aPropSeq.getConstArray();
- sal_Int32 nCtrlProps = aPropSeq.getLength();
-
- // create a map of tab indices and control names, sorted by tab index
- for( sal_Int32 j = 0 ; j < nCtrlProps ; ++j )
- {
- const Property& rProp = pProps[j];
- ::rtl::OUString aPropName = rProp.Name;
- TypeClass eType = rProp.Type.getTypeClass();
- bool bLanguageDependentProperty =
- (eType == TypeClass_STRING || eType == TypeClass_SEQUENCE)
- && isLanguageDependentProperty( aPropName );
- if( !bLanguageDependentProperty )
- continue;
-
- if( eType == TypeClass_STRING )
- {
- Any aPropAny = xPropertySet->getPropertyValue( aPropName );
- ::rtl::OUString aPropStr;
- aPropAny >>= aPropStr;
-
- // Replace string by id, add id+string to StringResource
- if( eMode == SET_IDS )
- {
- bool bEscAlreadyExisting = (aPropStr.getLength() && aPropStr.getStr()[0] == '&' );
- if( bEscAlreadyExisting )
- continue;
-
- ::rtl::OUString aPureIdStr = implCreatePureResourceId
- ( aDialogName, aCtrlName, aPropName, xStringResourceManager );
-
- // Set Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale );
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- // TODO?: Change here and in toolkit
- (void)aSemi;
- aPropAny <<= aPropIdStr;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Replace id by string from StringResource
- else if( eMode == RESET_IDS )
- {
- if( aPropStr.getLength() > 1 )
- {
- ::rtl::OUString aPureIdStr = aPropStr.copy( 1 );
- ::rtl::OUString aNewPropStr = aPropStr;
- try
- {
- aNewPropStr = xStringResourceManager->resolveString( aPureIdStr );
- }
- catch(MissingResourceException&)
- {
- }
- aPropAny <<= aNewPropStr;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- }
- // Remove Id for all locales
- else if( eMode == REMOVE_IDS_FROM_RESOURCE )
- {
- if( aPropStr.getLength() > 1 )
- {
- ::rtl::OUString aPureIdStr = aPropStr.copy( 1 );
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- try
- {
- xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- }
- }
- }
- }
- // Rename resource id
- else if( eMode == RENAME_DIALOG_IDS || eMode == RENAME_CONTROL_IDS )
- {
- ::rtl::OUString aSourceIdStr = aPropStr;
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- ::rtl::OUString aPureIdStr = implCreatePureResourceId
- ( aDialogName, aCtrlName, aPropName, xStringResourceManager );
-
- // Set new Id and remove old one for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xStringResourceManager->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- xStringResourceManager->removeIdForLocale( aPureSourceIdStr, rLocale );
- xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale );
- }
- catch(MissingResourceException&)
- {}
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- // TODO?: Change here and in toolkit
- (void)aSemi;
- aPropAny <<= aPropIdStr;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Replace string by string from source StringResourceResolver
- else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() )
- {
- ::rtl::OUString aSourceIdStr = aPropStr;
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- ::rtl::OUString aPureIdStr = implCreatePureResourceId
- ( aDialogName, aCtrlName, aPropName, xStringResourceManager );
-
- const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
-
- // Set Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rDefaultLocale );
- }
- xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale );
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- // TODO?: Change here and in toolkit
- (void)aSemi;
- aPropAny <<= aPropIdStr;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Copy string from source to target resource
- else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() )
- {
- ::rtl::OUString aSourceIdStr = aPropStr;
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
-
- // Copy Id for all locales
- const Locale* pLocales = aLocaleSeq.getConstArray();
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rDefaultLocale );
- }
- xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale );
- }
- }
- nChangedCount++;
- }
-
- // Listbox / Combobox
- else if( eType == TypeClass_SEQUENCE )
- {
- Any aPropAny = xPropertySet->getPropertyValue( aPropName );
- Sequence< ::rtl::OUString > aPropStrings;
- aPropAny >>= aPropStrings;
-
- const ::rtl::OUString* pPropStrings = aPropStrings.getConstArray();
- sal_Int32 nPropStringCount = aPropStrings.getLength();
- if( nPropStringCount == 0 )
- continue;
-
- // Replace string by id, add id+string to StringResource
- if( eMode == SET_IDS )
- {
- Sequence< ::rtl::OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
- ::rtl::OUString* pIdStrings = aIdStrings.getArray();
-
- ::rtl::OUString aIdStrBase = aDot;
- aIdStrBase += aCtrlName;
- aIdStrBase += aDot;
- aIdStrBase += aPropName;
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aPropStr = pPropStrings[i];
- bool bEscAlreadyExisting = (aPropStr.getLength() && aPropStr.getStr()[0] == '&' );
- if( bEscAlreadyExisting )
- {
- pIdStrings[i] = aPropStr;
- continue;
- }
-
- sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
- ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId );
- aPureIdStr += aIdStrBase;
-
- // Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const Locale& rLocale = pLocales[ iLocale ];
- xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale );
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- pIdStrings[i] = aPropIdStr;
- }
- aPropAny <<= aIdStrings;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Replace id by string from StringResource
- else if( eMode == RESET_IDS )
- {
- Sequence< ::rtl::OUString > aNewPropStrings;
- aNewPropStrings.realloc( nPropStringCount );
- ::rtl::OUString* pNewPropStrings = aNewPropStrings.getArray();
-
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aIdStr = pPropStrings[i];
- ::rtl::OUString aNewPropStr = aIdStr;
- if( aIdStr.getLength() > 1 )
- {
- ::rtl::OUString aPureIdStr = aIdStr.copy( 1 );
- try
- {
- aNewPropStr = xStringResourceManager->resolveString( aPureIdStr );
- }
- catch(MissingResourceException&)
- {
- }
- }
- pNewPropStrings[i] = aNewPropStr;
- }
- aPropAny <<= aNewPropStrings;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Remove Id for all locales
- else if( eMode == REMOVE_IDS_FROM_RESOURCE )
- {
- Sequence< ::rtl::OUString > aNewPropStrings;
- aNewPropStrings.realloc( nPropStringCount );
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aIdStr = pPropStrings[i];
- if( aIdStr.getLength() > 1 )
- {
- ::rtl::OUString aPureIdStr = aIdStr.copy( 1 );
-
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const Locale& rLocale = pLocales[iLocale];
- try
- {
- xStringResourceManager->removeIdForLocale( aPureIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- }
- }
- }
- }
- }
- // Rename resource id
- else if( eMode == RENAME_CONTROL_IDS )
- {
- Sequence< ::rtl::OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
- ::rtl::OUString* pIdStrings = aIdStrings.getArray();
-
- ::rtl::OUString aIdStrBase = aDot;
- aIdStrBase += aCtrlName;
- aIdStrBase += aDot;
- aIdStrBase += aPropName;
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aSourceIdStr = pPropStrings[i];
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
- ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId );
- aPureIdStr += aIdStrBase;
-
- // Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const Locale& rLocale = pLocales[ iLocale ];
-
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xStringResourceManager->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- xStringResourceManager->removeIdForLocale( aPureSourceIdStr, rLocale );
- xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale );
- }
- catch(MissingResourceException&)
- {}
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- pIdStrings[i] = aPropIdStr;
- }
- aPropAny <<= aIdStrings;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Replace string by string from source StringResourceResolver
- else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() )
- {
- Sequence< ::rtl::OUString > aIdStrings;
- aIdStrings.realloc( nPropStringCount );
- ::rtl::OUString* pIdStrings = aIdStrings.getArray();
-
- ::rtl::OUString aIdStrBase = aDot;
- aIdStrBase += aCtrlName;
- aIdStrBase += aDot;
- aIdStrBase += aPropName;
-
- const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aSourceIdStr = pPropStrings[i];
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- sal_Int32 nUniqueId = xStringResourceManager->getUniqueNumericId();
- ::rtl::OUString aPureIdStr = ::rtl::OUString::valueOf( nUniqueId );
- aPureIdStr += aIdStrBase;
-
- // Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const Locale& rLocale = pLocales[ iLocale ];
-
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rDefaultLocale );
- }
- xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale );
- }
-
- ::rtl::OUString aPropIdStr = aEsc;
- aPropIdStr += aPureIdStr;
- pIdStrings[i] = aPropIdStr;
- }
- aPropAny <<= aIdStrings;
- xPropertySet->setPropertyValue( aPropName, aPropAny );
- }
- // Copy string from source to target resource
- else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() )
- {
- const Locale& rDefaultLocale = xSourceStringResolver->getDefaultLocale();
-
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 i;
- for ( i = 0; i < nPropStringCount; ++i )
- {
- ::rtl::OUString aSourceIdStr = pPropStrings[i];
- ::rtl::OUString aPureSourceIdStr = aSourceIdStr.copy( 1 );
-
- // Set Id for all locales
- for( sal_Int32 iLocale = 0 ; iLocale < nLocaleCount ; iLocale++ )
- {
- const Locale& rLocale = pLocales[ iLocale ];
-
- ::rtl::OUString aResStr;
- try
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rLocale );
- }
- catch(MissingResourceException&)
- {
- aResStr = xSourceStringResolver->resolveStringForLocale
- ( aPureSourceIdStr, rDefaultLocale );
- }
- xStringResourceManager->setStringForLocale( aPureSourceIdStr, aResStr, rLocale );
- }
- }
- }
- nChangedCount++;
- }
- }
- }
- }
- return nChangedCount;
-}
-
-
-void LocalizationMgr::handleAddLocales( Sequence< Locale > aLocaleSeq )
-{
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
-
- if( isLibraryLocalized() )
- {
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- m_xStringResourceManager->newLocale( rLocale );
- }
- }
- else
- {
- DBG_ASSERT( nLocaleCount==1, "LocalizationMgr::handleAddLocales(): Only one first locale allowed" );
-
- const Locale& rLocale = pLocales[ 0 ];
- m_xStringResourceManager->newLocale( rLocale );
- enableResourceForAllLibraryDialogs();
- }
-
- BasicIDE::MarkDocumentModified( m_aDocument );
-
- // update locale toolbar
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
-
- handleTranslationbar();
-}
-
-
-void LocalizationMgr::handleRemoveLocales( Sequence< Locale > aLocaleSeq )
-{
- const Locale* pLocales = aLocaleSeq.getConstArray();
- sal_Int32 nLocaleCount = aLocaleSeq.getLength();
- bool bConsistant = true;
- bool bModified = false;
-
- for( sal_Int32 i = 0 ; i < nLocaleCount ; i++ )
- {
- const Locale& rLocale = pLocales[ i ];
- bool bRemove = true;
-
- // Check if last locale
- Sequence< Locale > aResLocaleSeq = m_xStringResourceManager->getLocales();
- if( aResLocaleSeq.getLength() == 1 )
- {
- const Locale& rLastResLocale = aResLocaleSeq.getConstArray()[ 0 ];
- if( localesAreEqual( rLocale, rLastResLocale ) )
- {
- disableResourceForAllLibraryDialogs();
- }
- else
- {
- // Inconsistancy, keep last locale
- bConsistant = false;
- bRemove = false;
- }
- }
-
- if( bRemove )
- {
- try
- {
- m_xStringResourceManager->removeLocale( rLocale );
- bModified = true;
- }
- catch(IllegalArgumentException&)
- {
- bConsistant = false;
- }
- }
- }
- if( bModified )
- {
- BasicIDE::MarkDocumentModified( m_aDocument );
-
- // update slots
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
- pBindings->Invalidate( SID_BASICIDE_MANAGE_LANG );
- }
-
- handleTranslationbar();
- }
-
- DBG_ASSERT( bConsistant,
- "LocalizationMgr::handleRemoveLocales(): sequence contains unsupported locales" );
- (void)bConsistant;
-}
-
-void LocalizationMgr::handleSetDefaultLocale( Locale aLocale )
-{
- if( m_xStringResourceManager.is() )
- {
- try
- {
- m_xStringResourceManager->setDefaultLocale( aLocale );
- }
- catch(IllegalArgumentException&)
- {
- OSL_FAIL( "LocalizationMgr::handleSetDefaultLocale: Invalid locale" );
- }
-
- // update locale toolbar
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
- }
-}
-
-void LocalizationMgr::handleSetCurrentLocale( ::com::sun::star::lang::Locale aLocale )
-{
- if( m_xStringResourceManager.is() )
- {
- try
- {
- m_xStringResourceManager->setCurrentLocale( aLocale, false );
- }
- catch(IllegalArgumentException&)
- {
- OSL_FAIL( "LocalizationMgr::handleSetCurrentLocale: Invalid locale" );
- }
-
- // update locale toolbar
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG );
-
- IDEBaseWindow* pCurWin = m_pIDEShell->GetCurWindow();
- if ( pCurWin && !pCurWin->IsSuspended() && pCurWin->IsA( TYPE( DialogWindow ) ) )
- {
- DialogWindow* pDlgWin = (DialogWindow*)pCurWin;
- DlgEditor* pWinEditor = pDlgWin->GetEditor();
- if( pWinEditor )
- pWinEditor->UpdatePropertyBrowserDelayed();
- }
- }
-}
-
-void LocalizationMgr::handleBasicStarted( void )
-{
- if( m_xStringResourceManager.is() )
- m_aLocaleBeforeBasicStart = m_xStringResourceManager->getCurrentLocale();
-}
-
-void LocalizationMgr::handleBasicStopped( void )
-{
- try
- {
- if( m_xStringResourceManager.is() )
- m_xStringResourceManager->setCurrentLocale( m_aLocaleBeforeBasicStart, true );
- }
- catch(IllegalArgumentException&)
- {
- }
-}
-
-
-DialogWindow* FindDialogWindowForEditor( DlgEditor* pEditor )
-{
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- IDEWindowTable& aIDEWindowTable = pIDEShell->GetIDEWindowTable();
- IDEBaseWindow* pWin = aIDEWindowTable.First();
- DialogWindow* pFoundDlgWin = NULL;
- while( pWin )
- {
- if ( !pWin->IsSuspended() && pWin->IsA( TYPE( DialogWindow ) ) )
- {
- DialogWindow* pDlgWin = (DialogWindow*)pWin;
- DlgEditor* pWinEditor = pDlgWin->GetEditor();
- if( pWinEditor == pEditor )
- {
- pFoundDlgWin = pDlgWin;
- break;
- }
- }
- pWin = aIDEWindowTable.Next();
- }
- return pFoundDlgWin;
-}
-
-
-void LocalizationMgr::setControlResourceIDsForNewEditorObject( DlgEditor* pEditor,
- Any aControlAny, const ::rtl::OUString& aCtrlName )
-{
- // Get library for DlgEditor
- DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
- if( !pDlgWin )
- return;
- ScriptDocument aDocument( pDlgWin->GetDocument() );
- DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::setControlResourceIDsForNewEditorObject: invalid document!" );
- if ( !aDocument.isValid() )
- return;
- const String& rLibName = pDlgWin->GetLibName();
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
-
- // Set resource property
- if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 )
- return;
-
- ::rtl::OUString aDialogName = pDlgWin->GetName();
- Reference< XStringResourceResolver > xDummyStringResolver;
- sal_Int32 nChangedCount = implHandleControlResourceProperties
- ( aControlAny, aDialogName, aCtrlName, xStringResourceManager,
- xDummyStringResolver, SET_IDS );
-
- if( nChangedCount )
- BasicIDE::MarkDocumentModified( aDocument );
-}
-
-void LocalizationMgr::renameControlResourceIDsForEditorObject( DlgEditor* pEditor,
- ::com::sun::star::uno::Any aControlAny, const ::rtl::OUString& aNewCtrlName )
-{
- // Get library for DlgEditor
- DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
- if( !pDlgWin )
- return;
- ScriptDocument aDocument( pDlgWin->GetDocument() );
- DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::renameControlResourceIDsForEditorObject: invalid document!" );
- if ( !aDocument.isValid() )
- return;
- const String& rLibName = pDlgWin->GetLibName();
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
-
- // Set resource property
- if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 )
- return;
-
- ::rtl::OUString aDialogName = pDlgWin->GetName();
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties
- ( aControlAny, aDialogName, aNewCtrlName, xStringResourceManager,
- xDummyStringResolver, RENAME_CONTROL_IDS );
-}
-
-
-void LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject( DlgEditor* pEditor,
- Any aControlAny, const ::rtl::OUString& aCtrlName )
-{
- // Get library for DlgEditor
- DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
- if( !pDlgWin )
- return;
- ScriptDocument aDocument( pDlgWin->GetDocument() );
- DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::deleteControlResourceIDsForDeletedEditorObject: invalid document!" );
- if ( !aDocument.isValid() )
- return;
- const String& rLibName = pDlgWin->GetLibName();
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
-
- ::rtl::OUString aDialogName = pDlgWin->GetName();
- Reference< XStringResourceResolver > xDummyStringResolver;
- sal_Int32 nChangedCount = implHandleControlResourceProperties
- ( aControlAny, aDialogName, aCtrlName, xStringResourceManager,
- xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE );
-
- if( nChangedCount )
- BasicIDE::MarkDocumentModified( aDocument );
-}
-
-void LocalizationMgr::setStringResourceAtDialog( const ScriptDocument& rDocument, const String& aLibName,
- const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
-{
- static ::rtl::OUString aResourceResolverPropName( RTL_CONSTASCII_USTRINGPARAM( "ResourceResolver" ));
-
- // Get library
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
-
- // Set resource property
- if( xStringResourceManager.is() )
- {
- // Not very elegant as dialog may or may not be localized yet
- // TODO: Find better place, where dialog is created
- if( xStringResourceManager->getLocales().getLength() > 0 )
- {
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties( aDialogCtrl, aDlgName,
- ::rtl::OUString(), xStringResourceManager,
- xDummyStringResolver, SET_IDS );
- }
-
- Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY );
- Any aStringResourceManagerAny;
- aStringResourceManagerAny <<= xStringResourceManager;
- xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
- }
-}
-
-void LocalizationMgr::renameStringResourceIDs( const ScriptDocument& rDocument, const String& aLibName,
- const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
-{
- // Get library
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- if( !xStringResourceManager.is() )
- return;
-
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties( aDialogCtrl, aDlgName,
- ::rtl::OUString(), xStringResourceManager,
- xDummyStringResolver, RENAME_DIALOG_IDS );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDlgName,
- aCtrlName, xStringResourceManager,
- xDummyStringResolver, RENAME_DIALOG_IDS );
- }
-}
-
-void LocalizationMgr::removeResourceForDialog( const ScriptDocument& rDocument, const String& aLibName,
- const String& aDlgName, Reference< container::XNameContainer > xDialogModel )
-{
- // Get library
- Reference< container::XNameContainer > xDialogLib( rDocument.getLibrary( E_DIALOGS, aLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- if( !xStringResourceManager.is() )
- return;
-
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties( aDialogCtrl, aDlgName,
- ::rtl::OUString(), xStringResourceManager,
- xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDlgName,
- aCtrlName, xStringResourceManager,
- xDummyStringResolver, REMOVE_IDS_FROM_RESOURCE );
- }
-}
-
-void LocalizationMgr::resetResourceForDialog( Reference< container::XNameContainer > xDialogModel,
- Reference< XStringResourceManager > xStringResourceManager )
-{
- if( !xStringResourceManager.is() )
- return;
-
- // Dialog as control
- ::rtl::OUString aDummyName;
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties( aDialogCtrl, aDummyName,
- aDummyName, xStringResourceManager, xDummyStringResolver, RESET_IDS );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDummyName,
- aCtrlName, xStringResourceManager, xDummyStringResolver, RESET_IDS );
- }
-}
-
-void LocalizationMgr::setResourceIDsForDialog( Reference< container::XNameContainer > xDialogModel,
- Reference< XStringResourceManager > xStringResourceManager )
-{
- if( !xStringResourceManager.is() )
- return;
-
- // Dialog as control
- ::rtl::OUString aDummyName;
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- Reference< XStringResourceResolver > xDummyStringResolver;
- implHandleControlResourceProperties( aDialogCtrl, aDummyName,
- aDummyName, xStringResourceManager, xDummyStringResolver, SET_IDS );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDummyName,
- aCtrlName, xStringResourceManager, xDummyStringResolver, SET_IDS );
- }
-}
-
-void LocalizationMgr::copyResourcesForPastedEditorObject( DlgEditor* pEditor,
- Any aControlAny, const ::rtl::OUString& aCtrlName,
- Reference< XStringResourceResolver > xSourceStringResolver )
-{
- // Get library for DlgEditor
- DialogWindow* pDlgWin = FindDialogWindowForEditor( pEditor );
- if( !pDlgWin )
- return;
- ScriptDocument aDocument( pDlgWin->GetDocument() );
- DBG_ASSERT( aDocument.isValid(), "LocalizationMgr::copyResourcesForPastedEditorObject: invalid document!" );
- if ( !aDocument.isValid() )
- return;
- const String& rLibName = pDlgWin->GetLibName();
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, rLibName, sal_True ) );
- Reference< XStringResourceManager > xStringResourceManager =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
-
- // Set resource property
- if( !xStringResourceManager.is() || xStringResourceManager->getLocales().getLength() == 0 )
- return;
-
- ::rtl::OUString aDialogName = pDlgWin->GetName();
- implHandleControlResourceProperties
- ( aControlAny, aDialogName, aCtrlName, xStringResourceManager,
- xSourceStringResolver, MOVE_RESOURCES );
-}
-
-void LocalizationMgr::copyResourceForDroppedDialog( Reference< container::XNameContainer > xDialogModel,
- const ::rtl::OUString& aDialogName, Reference< XStringResourceManager > xStringResourceManager,
- Reference< XStringResourceResolver > xSourceStringResolver )
-{
- if( !xStringResourceManager.is() )
- return;
-
- // Dialog as control
- ::rtl::OUString aDummyName;
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- implHandleControlResourceProperties( aDialogCtrl, aDialogName,
- aDummyName, xStringResourceManager, xSourceStringResolver, MOVE_RESOURCES );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDialogName,
- aCtrlName, xStringResourceManager, xSourceStringResolver, MOVE_RESOURCES );
- }
-}
-
-void LocalizationMgr::copyResourceForDialog(
- const Reference< container::XNameContainer >& xDialogModel,
- const Reference< XStringResourceResolver >& xSourceStringResolver,
- const Reference< XStringResourceManager >& xTargetStringResourceManager )
-{
- if( !xDialogModel.is() || !xSourceStringResolver.is() || !xTargetStringResourceManager.is() )
- return;
-
- ::rtl::OUString aDummyName;
- Any aDialogCtrl;
- aDialogCtrl <<= xDialogModel;
- implHandleControlResourceProperties
- ( aDialogCtrl, aDummyName, aDummyName, xTargetStringResourceManager,
- xSourceStringResolver, COPY_RESOURCES );
-
- // Handle all controls
- Sequence< ::rtl::OUString > aNames = xDialogModel->getElementNames();
- const ::rtl::OUString* pNames = aNames.getConstArray();
- sal_Int32 nCtrls = aNames.getLength();
- for( sal_Int32 i = 0 ; i < nCtrls ; ++i )
- {
- ::rtl::OUString aCtrlName( pNames[i] );
- Any aCtrl = xDialogModel->getByName( aCtrlName );
- implHandleControlResourceProperties( aCtrl, aDummyName, aDummyName,
- xTargetStringResourceManager, xSourceStringResolver, COPY_RESOURCES );
- }
-}
-
-Reference< XStringResourceManager > LocalizationMgr::getStringResourceFromDialogLibrary
- ( Reference< container::XNameContainer > xDialogLib )
-{
- Reference< XStringResourceManager > xStringResourceManager;
- if( xDialogLib.is() )
- {
- Reference< resource::XStringResourceSupplier > xStringResourceSupplier( xDialogLib, UNO_QUERY );
- if( xStringResourceSupplier.is() )
- {
- Reference< resource::XStringResourceResolver >
- xStringResourceResolver = xStringResourceSupplier->getStringResource();
-
- xStringResourceManager =
- Reference< resource::XStringResourceManager >( xStringResourceResolver, UNO_QUERY );
- }
- }
- return xStringResourceManager;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/macrodlg.cxx b/basctl/source/basicide/macrodlg.cxx
deleted file mode 100644
index b2a11d1c9..000000000
--- a/basctl/source/basicide/macrodlg.cxx
+++ /dev/null
@@ -1,910 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <memory>
-
-#include <ide_pch.hxx>
-
-
-#include <macrodlg.hxx>
-#include <macrodlg.hrc>
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <baside2.hrc> // ID's fuer Imagese
-#include <basobj.hxx>
-#include <baside3.hxx>
-
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <iderid.hxx>
-
-#include <moduldlg.hxx>
-#include <basic/sbx.hxx>
-
-#include <bastypes.hxx>
-#include <sbxitem.hxx>
-#include <sfx2/minfitem.hxx>
-
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/document/MacroExecMode.hpp>
-
-#include <map>
-using ::std::map;
-using ::std::pair;
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-
-MacroChooser::MacroChooser( Window* pParnt, sal_Bool bCreateEntries ) :
- SfxModalDialog( pParnt, IDEResId( RID_MACROCHOOSER ) ),
- aMacroNameTxt( this, IDEResId( RID_TXT_MACRONAME ) ),
- aMacroNameEdit( this, IDEResId( RID_ED_MACRONAME ) ),
- aMacroFromTxT( this, IDEResId( RID_TXT_MACROFROM ) ),
- aMacrosSaveInTxt( this, IDEResId( RID_TXT_SAVEMACRO ) ),
- aBasicBox( this, IDEResId( RID_CTRL_LIB ) ),
- aMacrosInTxt( this, IDEResId( RID_TXT_MACROSIN ) ),
- aMacroBox( this, IDEResId( RID_CTRL_MACRO ) ),
- aRunButton( this, IDEResId( RID_PB_RUN ) ),
- aCloseButton( this, IDEResId( RID_PB_CLOSE ) ),
- aAssignButton( this, IDEResId( RID_PB_ASSIGN ) ),
- aEditButton( this, IDEResId( RID_PB_EDIT ) ),
- aNewDelButton( this, IDEResId( RID_PB_DEL ) ),
- aOrganizeButton( this, IDEResId( RID_PB_ORG ) ),
- aHelpButton( this, IDEResId( RID_PB_HELP ) ),
- aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) ),
- aNewModButton( this, IDEResId( RID_PB_NEWMOD ) )
-{
- FreeResource();
-
- nMode = MACROCHOOSER_ALL;
- bNewDelIsDel = sal_True;
-
- // Der Sfx fragt den BasicManager nicht, ob modified
- // => Speichern anschmeissen, wenn Aenderung, aber kein Sprung in
- // die BasicIDE.
- bForceStoreBasic = sal_False;
-
- aMacrosInTxtBaseStr = aMacrosInTxt.GetText();
-
- aMacroBox.SetSelectionMode( SINGLE_SELECTION );
- aMacroBox.SetHighlightRange(); // ueber ganze Breite selektieren
-
- aRunButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aCloseButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aAssignButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aEditButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aNewDelButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aOrganizeButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
-
- // Buttons only for MACROCHOOSER_RECORDING
- aNewLibButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aNewModButton.SetClickHdl( LINK( this, MacroChooser, ButtonHdl ) );
- aNewLibButton.Hide(); // default
- aNewModButton.Hide(); // default
- aMacrosSaveInTxt.Hide(); // default
-
- aMacrosInTxt.SetStyle( WB_NOMULTILINE | WB_PATHELLIPSIS );
-
- aMacroNameEdit.SetModifyHdl( LINK( this, MacroChooser, EditModifyHdl ) );
-
- aBasicBox.SetSelectHdl( LINK( this, MacroChooser, BasicSelectHdl ) );
-
- aMacroBox.SetDoubleClickHdl( LINK( this, MacroChooser, MacroDoubleClickHdl ) );
- aMacroBox.SetSelectHdl( LINK( this, MacroChooser, MacroSelectHdl ) );
-
- aBasicBox.SetMode( BROWSEMODE_MODULES );
- aBasicBox.SetStyle( WB_TABSTOP | WB_BORDER |
- WB_HASLINES | WB_HASLINESATROOT |
- WB_HASBUTTONS | WB_HASBUTTONSATROOT |
- WB_HSCROLL );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
- }
-
- if ( bCreateEntries )
- aBasicBox.ScanAllEntries();
-}
-
-MacroChooser::~MacroChooser()
-{
- if ( bForceStoreBasic )
- SFX_APP()->SaveBasicAndDialogContainer();
-}
-
-void MacroChooser::StoreMacroDescription()
-{
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) );
- String aMethodName;
- SvLBoxEntry* pEntry = aMacroBox.FirstSelected();
- if ( pEntry )
- aMethodName = aMacroBox.GetEntryText( pEntry );
- else
- aMethodName = aMacroNameEdit.GetText();
- if ( aMethodName.Len() )
- {
- aDesc.SetMethodName( aMethodName );
- aDesc.SetType( OBJ_TYPE_METHOD );
- }
-
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- pData->SetLastEntryDescriptor( aDesc );
-}
-
-void MacroChooser::RestoreMacroDescription()
-{
- BasicEntryDescriptor aDesc;
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- {
- IDEBaseWindow* pCurWin = pIDEShell->GetCurWindow();
- if ( pCurWin )
- aDesc = pCurWin->CreateEntryDescriptor();
- }
- else
- {
- BasicIDEData* pData = IDE_DLL()->GetExtraData();
- if ( pData )
- aDesc = pData->GetLastEntryDescriptor();
- }
-
- aBasicBox.SetCurrentEntry( aDesc );
-
- String aLastMacro( aDesc.GetMethodName() );
- if ( aLastMacro.Len() )
- {
- // find entry in macro box
- SvLBoxEntry* pEntry = 0;
- sal_uLong nPos = 0;
- SvLBoxEntry* pE = aMacroBox.GetEntry( nPos );
- while ( pE )
- {
- if ( aMacroBox.GetEntryText( pE ) == aLastMacro )
- {
- pEntry = pE;
- break;
- }
- pE = aMacroBox.GetEntry( ++nPos );
- }
-
- if ( pEntry )
- aMacroBox.SetCurEntry( pEntry );
- else
- {
- aMacroNameEdit.SetText( aLastMacro );
- aMacroNameEdit.SetSelection( Selection( 0, 0 ) );
- }
- }
-}
-
-short MacroChooser::Execute()
-{
- RestoreMacroDescription();
- aRunButton.GrabFocus();
-
- // #104198 Check if "wrong" document is active
- SvLBoxEntry* pSelectedEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pSelectedEntry ) );
- const ScriptDocument& rSelectedDoc( aDesc.GetDocument() );
-
- // App Basic is always ok, so only check if shell was found
- if( rSelectedDoc.isDocument() && !rSelectedDoc.isActive() )
- {
- // Search for the right entry
- sal_uLong nRootPos = 0;
- SvLBoxEntry* pRootEntry = aBasicBox.GetEntry( nRootPos );
- while( pRootEntry )
- {
- BasicEntryDescriptor aCmpDesc( aBasicBox.GetEntryDescriptor( pRootEntry ) );
- const ScriptDocument& rCmpDoc( aCmpDesc.GetDocument() );
- if ( rCmpDoc.isDocument() && rCmpDoc.isActive() )
- {
- SvLBoxEntry* pEntry = pRootEntry;
- SvLBoxEntry* pLastValid = pEntry;
- while ( pEntry )
- {
- pLastValid = pEntry;
- pEntry = aBasicBox.FirstChild( pEntry );
- }
- if( pLastValid )
- aBasicBox.SetCurEntry( pLastValid );
- }
- pRootEntry = aBasicBox.GetEntry( ++nRootPos );
- }
- }
-
- CheckButtons();
- UpdateFields();
-
- if ( StarBASIC::IsRunning() )
- aCloseButton.GrabFocus();
-
- Window* pPrevDlgParent = Application::GetDefDialogParent();
- Application::SetDefDialogParent( this );
- short nRet = ModalDialog::Execute();
- // #57314# Wenn die BasicIDE aktiviert wurde, dann nicht den DefModalDialogParent auf das inaktive Dokument zuruecksetzen.
- if ( Application::GetDefDialogParent() == this )
- Application::SetDefDialogParent( pPrevDlgParent );
- return nRet;
-}
-
-
-void MacroChooser::EnableButton( Button& rButton, sal_Bool bEnable )
-{
- if ( bEnable )
- {
- if ( nMode == MACROCHOOSER_CHOOSEONLY || nMode == MACROCHOOSER_RECORDING )
- {
- // Nur der RunButton kann enabled werden
- if ( &rButton == &aRunButton )
- rButton.Enable();
- else
- rButton.Disable();
- }
- else
- rButton.Enable();
- }
- else
- rButton.Disable();
-}
-
-
-
-
-SbMethod* MacroChooser::GetMacro()
-{
- SbMethod* pMethod = 0;
- SbModule* pModule = aBasicBox.FindModule( aBasicBox.GetCurEntry() );
- if ( pModule )
- {
- SvLBoxEntry* pEntry = aMacroBox.FirstSelected();
- if ( pEntry )
- {
- String aMacroName( aMacroBox.GetEntryText( pEntry ) );
- pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD );
- }
- }
- return pMethod;
-}
-
-
-
-void MacroChooser::DeleteMacro()
-{
- SbMethod* pMethod = GetMacro();
- DBG_ASSERT( pMethod, "DeleteMacro: Kein Macro !" );
- if ( pMethod && QueryDelMacro( pMethod->GetName(), this ) )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
- }
-
- // Aktuelles Doc als geaendert markieren:
- StarBASIC* pBasic = BasicIDE::FindBasic( pMethod );
- DBG_ASSERT( pBasic, "Basic?!" );
- BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
- DBG_ASSERT( pBasMgr, "BasMgr?" );
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- if ( aDocument.isDocument() ) // Muss ja nicht aus einem Document kommen...
- {
- aDocument.setDocumentModified();
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- pBindings->Invalidate( SID_SAVEDOC );
- }
-
- SbModule* pModule = pMethod->GetModule();
- DBG_ASSERT( pModule, "DeleteMacro: Kein Modul?!" );
- ::rtl::OUString aSource( pModule->GetSource32() );
- sal_uInt16 nStart, nEnd;
- pMethod->GetLineRange( nStart, nEnd );
- pModule->GetMethods()->Remove( pMethod );
- CutLines( aSource, nStart-1, nEnd-nStart+1, sal_True );
- pModule->SetSource32( aSource );
-
- // update module in library
- String aLibName = pBasic->GetName();
- String aModName = pModule->GetName();
- OSL_VERIFY( aDocument.updateModule( aLibName, aModName, aSource ) );
-
- SvLBoxEntry* pEntry = aMacroBox.FirstSelected();
- DBG_ASSERT( pEntry, "DeleteMacro: Entry ?!" );
- aMacroBox.GetModel()->Remove( pEntry );
- bForceStoreBasic = sal_True;
- }
-}
-
-SbMethod* MacroChooser::CreateMacro()
-{
- SbMethod* pMethod = 0;
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" );
- if ( !aDocument.isAlive() )
- return NULL;
-
- String aLibName( aDesc.GetLibName() );
-
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
-
- aDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
-
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- xModLibContainer->loadLibrary( aOULibName );
- Reference< script::XLibraryContainer > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ) );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- xDlgLibContainer->loadLibrary( aOULibName );
-
- BasicManager* pBasMgr = aDocument.getBasicManager();
- StarBASIC* pBasic = pBasMgr ? pBasMgr->GetLib( aLibName ) : 0;
- if ( pBasic )
- {
- SbModule* pModule = 0;
- String aModName( aDesc.GetName() );
- if ( aModName.Len() )
- {
- // extract the module name from the string like "Sheet1 (Example1)"
- if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
- {
- sal_uInt16 nIndex = 0;
- aModName = aModName.GetToken( 0, ' ', nIndex );
- }
- pModule = pBasic->FindModule( aModName );
- }
- else if ( pBasic->GetModules()->Count() )
- pModule = (SbModule*)pBasic->GetModules()->Get( 0 );
-
- if ( !pModule )
- {
- pModule = createModImpl( static_cast<Window*>( this ),
- aDocument, aBasicBox, aLibName, aModName );
- }
-
- String aSubName = aMacroNameEdit.GetText();
- DBG_ASSERT( !pModule || !pModule->GetMethods()->Find( aSubName, SbxCLASS_METHOD ), "Macro existiert schon!" );
- pMethod = pModule ? BasicIDE::CreateMacro( pModule, aSubName ) : NULL;
- }
-
- return pMethod;
-}
-
-void MacroChooser::SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry )
-{
- // Durch das Highlight wird das Edit sonst platt gemacht:
-
- String aSaveText( aMacroNameEdit.GetText() );
- Selection aCurSel( aMacroNameEdit.GetSelection() );
-
- rBox.SetCurEntry( pEntry );
- aMacroNameEdit.SetText( aSaveText );
- aMacroNameEdit.SetSelection( aCurSel );
-}
-
-void MacroChooser::CheckButtons()
-{
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- SvLBoxEntry* pMacroEntry = aMacroBox.FirstSelected();
- SbMethod* pMethod = GetMacro();
-
- // check, if corresponding libraries are readonly
- sal_Bool bReadOnly = sal_False;
- sal_uInt16 nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
- if ( nDepth == 1 || nDepth == 2 )
- {
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
- {
- bReadOnly = sal_True;
- }
- }
-
- if ( nMode != MACROCHOOSER_RECORDING )
- {
- // Run...
- sal_Bool bEnable = pMethod ? sal_True : sal_False;
- if ( ( nMode != MACROCHOOSER_CHOOSEONLY ) && StarBASIC::IsRunning() )
- bEnable = sal_False;
- EnableButton( aRunButton, bEnable );
- }
-
- // Organisieren immer moeglich ?
-
- // Assign...
- EnableButton( aAssignButton, pMethod ? sal_True : sal_False );
-
- // Edit...
- EnableButton( aEditButton, pMacroEntry ? sal_True : sal_False );
-
- // aOrganizeButton
- EnableButton( aOrganizeButton, !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ));
-
- // aNewDelButton....
- bool bProtected = aBasicBox.IsEntryProtected( pCurEntry );
- bool bShare = ( aDesc.GetLocation() == LIBRARY_LOCATION_SHARE );
- EnableButton( aNewDelButton,
- !StarBASIC::IsRunning() && ( nMode == MACROCHOOSER_ALL ) && !bProtected && !bReadOnly && !bShare );
- sal_Bool bPrev = bNewDelIsDel;
- bNewDelIsDel = pMethod ? sal_True : sal_False;
- if ( ( bPrev != bNewDelIsDel ) && ( nMode == MACROCHOOSER_ALL ) )
- {
- String aBtnText( bNewDelIsDel ? IDEResId( RID_STR_BTNDEL) : IDEResId( RID_STR_BTNNEW ) );
- aNewDelButton.SetText( aBtnText );
- }
-
- if ( nMode == MACROCHOOSER_RECORDING )
- {
- // save button
- if ( !bProtected && !bReadOnly && !bShare )
- aRunButton.Enable();
- else
- aRunButton.Disable();
-
- // new library button
- if ( !bShare )
- aNewLibButton.Enable();
- else
- aNewLibButton.Disable();
-
- // new module button
- if ( !bProtected && !bReadOnly && !bShare )
- aNewModButton.Enable();
- else
- aNewModButton.Disable();
- }
-}
-
-
-
-IMPL_LINK_INLINE_START( MacroChooser, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG )
-{
- StoreMacroDescription();
- if ( nMode == MACROCHOOSER_RECORDING )
- {
- SbMethod* pMethod = GetMacro();
- if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) )
- return 0;
- }
-
- EndDialog( MACRO_OK_RUN );
- return 0;
-}
-IMPL_LINK_INLINE_END( MacroChooser, MacroDoubleClickHdl, SvTreeListBox *, EMPTYARG )
-
-IMPL_LINK( MacroChooser, MacroSelectHdl, SvTreeListBox *, pBox )
-{
- // Wird auch gerufen, wenn Deselektiert!
- // 2 Funktionsaufrufe in jedem SelectHdl, nur weil Olli
- // keinen separatren DeselctHdl einfuehren wollte:
- // Also: Feststellen, ob Select oder Deselect:
- if ( pBox->IsSelected( pBox->GetHdlEntry() ) )
- {
- UpdateFields();
- CheckButtons();
- }
- return 0;
-}
-
-IMPL_LINK( MacroChooser, BasicSelectHdl, SvTreeListBox *, pBox )
-{
- static String aSpaceStr = String::CreateFromAscii(" ");
-
- // Wird auch gerufen, wenn Deselektiert!
- // 2 Funktionsaufrufe in jedem SelectHdl, nur weil Olli
- // keinen separatren DeselctHdl einfuehren wollte:
- // Also: Feststellen, ob Select oder Deselect:
- if ( !pBox->IsSelected( pBox->GetHdlEntry() ) )
- return 0;
-
- SbModule* pModule = aBasicBox.FindModule( aBasicBox.GetCurEntry() );
-
- aMacroBox.Clear();
- if ( pModule )
- {
- String aStr = aMacrosInTxtBaseStr;
- aStr += aSpaceStr;
- aStr += pModule->GetName();
-
- aMacrosInTxt.SetText( aStr );
-
- // Die Macros sollen in der Reihenfolge angezeigt werden,
- // wie sie im Modul stehen.
-
- map< sal_uInt16, SbMethod* > aMacros;
- size_t nMacroCount = pModule->GetMethods()->Count();
- for ( size_t iMeth = 0; iMeth < nMacroCount; iMeth++ )
- {
- SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Get( iMeth );
- if( pMethod->IsHidden() )
- continue;
- DBG_ASSERT( pMethod, "Methode nicht gefunden! (NULL)" );
- // Eventuell weiter vorne ?
- sal_uInt16 nStart, nEnd;
- pMethod->GetLineRange( nStart, nEnd );
- aMacros.insert( map< sal_uInt16, SbMethod*>::value_type( nStart, pMethod ) );
- }
-
- aMacroBox.SetUpdateMode( sal_False );
- for ( map< sal_uInt16, SbMethod* >::iterator it = aMacros.begin(); it != aMacros.end(); ++it )
- aMacroBox.InsertEntry( (*it).second->GetName() );
- aMacroBox.SetUpdateMode( sal_True );
-
- if ( aMacroBox.GetEntryCount() )
- {
- SvLBoxEntry* pEntry = aMacroBox.GetEntry( 0 );
- DBG_ASSERT( pEntry, "Entry ?!" );
- aMacroBox.SetCurEntry( pEntry );
- }
- }
-
- UpdateFields();
- CheckButtons();
- return 0;
-}
-
-
-
-IMPL_LINK( MacroChooser, EditModifyHdl, Edit *, pEdit )
-{
- (void)pEdit;
-
- // Das Modul, in dem bei Neu das Macro landet, selektieren,
- // wenn BasicManager oder Lib selektiert.
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- if ( pCurEntry )
- {
- sal_uInt16 nDepth = aBasicBox.GetModel()->GetDepth( pCurEntry );
- if ( ( nDepth == 1 ) && ( aBasicBox.IsEntryProtected( pCurEntry ) ) )
- {
- // Dann auf die entsprechende Std-Lib stellen...
- SvLBoxEntry* pManagerEntry = aBasicBox.GetModel()->GetParent( pCurEntry );
- pCurEntry = aBasicBox.GetModel()->FirstChild( pManagerEntry );
- }
- if ( nDepth < 2 )
- {
- SvLBoxEntry* pNewEntry = pCurEntry;
- while ( pCurEntry && ( nDepth < 2 ) )
- {
- pCurEntry = aBasicBox.FirstChild( pCurEntry );
- if ( pCurEntry )
- {
- pNewEntry = pCurEntry;
- nDepth = aBasicBox.GetModel()->GetDepth( pCurEntry );
- }
- }
- SaveSetCurEntry( aBasicBox, pNewEntry );
- }
- if ( aMacroBox.GetEntryCount() )
- {
- String aEdtText( aMacroNameEdit.GetText() );
- sal_Bool bFound = sal_False;
- for ( sal_uInt16 n = 0; n < aMacroBox.GetEntryCount(); n++ )
- {
- SvLBoxEntry* pEntry = aMacroBox.GetEntry( n );
- DBG_ASSERT( pEntry, "Entry ?!" );
- if ( aMacroBox.GetEntryText( pEntry ).CompareIgnoreCaseToAscii( aEdtText ) == COMPARE_EQUAL )
- {
- SaveSetCurEntry( aMacroBox, pEntry );
- bFound = sal_True;
- break;
- }
- }
- if ( !bFound )
- {
- SvLBoxEntry* pEntry = aMacroBox.FirstSelected();
- // Wenn es den Eintrag gibt ->Select ->Desription...
- if ( pEntry )
- aMacroBox.Select( pEntry, sal_False );
- }
- }
- }
-
- CheckButtons();
- return 0;
-}
-
-
-
-IMPL_LINK( MacroChooser, ButtonHdl, Button *, pButton )
-{
- // ausser bei New/Record wird die Description durch LoseFocus uebernommen.
- if ( pButton == &aRunButton )
- {
- StoreMacroDescription();
-
- // #116444# check security settings before macro execution
- if ( nMode == MACROCHOOSER_ALL )
- {
- SbMethod* pMethod = GetMacro();
- SbModule* pModule = pMethod ? pMethod->GetModule() : NULL;
- StarBASIC* pBasic = pModule ? (StarBASIC*)pModule->GetParent() : NULL;
- BasicManager* pBasMgr = pBasic ? BasicIDE::FindBasicManager( pBasic ) : NULL;
- if ( pBasMgr )
- {
- ScriptDocument aDocument( ScriptDocument::getDocumentForBasicManager( pBasMgr ) );
- if ( aDocument.isDocument() && !aDocument.allowMacros() )
- {
- WarningBox( this, WB_OK, String( IDEResId( RID_STR_CANNOTRUNMACRO ) ) ).Execute();
- return 0;
- }
- }
- }
- else if ( nMode == MACROCHOOSER_RECORDING )
- {
- sal_Bool bValid = BasicIDE::IsValidSbxName( aMacroNameEdit.GetText() );
- if ( !bValid )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
- aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) );
- aMacroNameEdit.GrabFocus();
- return 0;
- }
-
- SbMethod* pMethod = GetMacro();
- if ( pMethod && !QueryReplaceMacro( pMethod->GetName(), this ) )
- return 0;
- }
-
- EndDialog( MACRO_OK_RUN );
- }
- else if ( pButton == &aCloseButton )
- {
- StoreMacroDescription();
- EndDialog( MACRO_CLOSE );
- }
- else if ( ( pButton == &aEditButton ) || ( pButton == &aNewDelButton ) )
- {
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
- if ( !aDocument.isAlive() )
- return 0;
- BasicManager* pBasMgr = aDocument.getBasicManager();
- String aLib( aDesc.GetLibName() );
- String aMod( aDesc.GetName() );
- // extract the module name from the string like "Sheet1 (Example1)"
- if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
- {
- sal_uInt16 nIndex = 0;
- aMod = aMod.GetToken( 0, ' ', nIndex );
- }
- String aSub( aDesc.GetMethodName() );
- SfxMacroInfoItem aInfoItem( SID_BASICIDE_ARG_MACROINFO, pBasMgr, aLib, aMod, aSub, String() );
- if ( pButton == &aEditButton )
- {
- SvLBoxEntry* pEntry = aMacroBox.FirstSelected();
- if ( pEntry )
- aInfoItem.SetMethod( aMacroBox.GetEntryText( pEntry ) );
- StoreMacroDescription();
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L );
- EndDialog( MACRO_EDIT );
- }
- else
- {
- if ( bNewDelIsDel )
- {
- DeleteMacro();
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_UPDATEMODULESOURCE,
- SFX_CALLMODE_SYNCHRON, &aInfoItem, 0L );
- }
- CheckButtons();
- UpdateFields();
- //if ( aMacroBox.GetCurEntry() ) // OV-Bug ?
- // aMacroBox.Select( aMacroBox.GetCurEntry() );
- }
- else
- {
- sal_Bool bValid = BasicIDE::IsValidSbxName( aMacroNameEdit.GetText() );
- if ( !bValid )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
- aMacroNameEdit.SetSelection( Selection( 0, aMacroNameEdit.GetText().Len() ) );
- aMacroNameEdit.GrabFocus();
- return 1;
- }
- SbMethod* pMethod = CreateMacro();
- if ( pMethod )
- {
- aInfoItem.SetMethod( pMethod->GetName() );
- aInfoItem.SetModule( pMethod->GetModule()->GetName() );
- aInfoItem.SetLib( pMethod->GetModule()->GetParent()->GetName() );
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
- pDispatcher->Execute( SID_BASICIDE_EDITMACRO, SFX_CALLMODE_ASYNCHRON, &aInfoItem, 0L );
- StoreMacroDescription();
- EndDialog( MACRO_NEW );
- }
- }
- }
- }
-
- else if ( pButton == &aAssignButton )
- {
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
- if ( !aDocument.isAlive() )
- return 0;
- BasicManager* pBasMgr = aDocument.getBasicManager();
- String aLib( aDesc.GetLibName() );
- String aMod( aDesc.GetName() );
- String aSub( aMacroNameEdit.GetText() );
- SbMethod* pMethod = GetMacro();
- DBG_ASSERT( pBasMgr, "BasMgr?" );
- DBG_ASSERT( pMethod, "Method?" );
- String aComment( GetInfo( pMethod ) );
- SfxMacroInfoItem aItem( SID_MACROINFO, pBasMgr, aLib, aMod, aSub, aComment );
- SfxAllItemSet Args( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_CONFIG, SFX_CALLMODE_SYNCHRON, Args );
- aRequest.AppendItem( aItem );
- SFX_APP()->ExecuteSlot( aRequest );
- }
- else if ( pButton == &aNewLibButton )
- {
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- createLibImpl( static_cast<Window*>( this ), aDocument, NULL, &aBasicBox );
- }
- else if ( pButton == &aNewModButton )
- {
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- String aLibName( aDesc.GetLibName() );
- String aModName;
- createModImpl( static_cast<Window*>( this ), aDocument,
- aBasicBox, aLibName, aModName, true );
- }
- else if ( pButton == &aOrganizeButton )
- {
- StoreMacroDescription();
-
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( aBasicBox.FirstSelected() ) );
- OrganizeDialog* pDlg = new OrganizeDialog( this, 0, aDesc );
- sal_uInt16 nRet = pDlg->Execute();
- delete pDlg;
-
- if ( nRet ) // Nicht einfach nur geschlossen
- {
- EndDialog( MACRO_EDIT );
- return 0;
- }
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell && pIDEShell->IsAppBasicModified() )
- bForceStoreBasic = sal_True;
-
- aBasicBox.UpdateEntries();
- }
- return 0;
-}
-
-
-
-void MacroChooser::UpdateFields()
-{
- SvLBoxEntry* pMacroEntry = aMacroBox.GetCurEntry();
- String aEmptyStr;
-
- aMacroNameEdit.SetText( aEmptyStr );
- if ( pMacroEntry )
- aMacroNameEdit.SetText( aMacroBox.GetEntryText( pMacroEntry ) );
-}
-
-void MacroChooser::SetMode( sal_uInt16 nM )
-{
- nMode = nM;
- if ( nMode == MACROCHOOSER_ALL )
- {
- aRunButton.SetText( String( IDEResId( RID_STR_RUN ) ) );
- EnableButton( aNewDelButton, sal_True );
- EnableButton( aOrganizeButton, sal_True );
- }
- else if ( nMode == MACROCHOOSER_CHOOSEONLY )
- {
- aRunButton.SetText( String( IDEResId( RID_STR_CHOOSE ) ) );
- EnableButton( aNewDelButton, sal_False );
- EnableButton( aOrganizeButton, sal_False );
- }
- else if ( nMode == MACROCHOOSER_RECORDING )
- {
- aRunButton.SetText( String( IDEResId( RID_STR_RECORD ) ) );
- EnableButton( aNewDelButton, sal_False );
- EnableButton( aOrganizeButton, sal_False );
-
- aAssignButton.Hide();
- aEditButton.Hide();
- aNewDelButton.Hide();
- aOrganizeButton.Hide();
- aMacroFromTxT.Hide();
-
- aNewLibButton.Show();
- aNewModButton.Show();
- aMacrosSaveInTxt.Show();
-
- Point aHelpPos = aHelpButton.GetPosPixel();
- Point aHelpPosLogic = PixelToLogic( aHelpPos, MapMode(MAP_APPFONT) );
- aHelpPosLogic.Y() -= 34;
- aHelpPos = LogicToPixel( aHelpPosLogic, MapMode(MAP_APPFONT) );
- aHelpButton.SetPosPixel( aHelpPos );
- }
- CheckButtons();
-}
-
-String MacroChooser::GetInfo( SbxVariable* pVar )
-{
- String aComment;
- SbxInfoRef xInfo = pVar->GetInfo();
- if ( xInfo.Is() )
- aComment = xInfo->GetComment();
- return aComment;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/macrodlg.hrc b/basctl/source/basicide/macrodlg.hrc
deleted file mode 100644
index e209ae060..000000000
--- a/basctl/source/basicide/macrodlg.hrc
+++ /dev/null
@@ -1,59 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _MACRODLG_HRC
-#define _MACRODLG_HRC
-
-#include <svl/solar.hrc>
-
-#define RID_MACROCHOOSER ( RID_BASICIDE_START + 50 )
-#define RID_STR_BTNDEL ( RID_BASICIDE_START + 51 )
-#define RID_STR_BTNNEW ( RID_BASICIDE_START + 52 )
-#define RID_STR_CHOOSE ( RID_BASICIDE_START + 53 )
-#define RID_STR_RUN ( RID_BASICIDE_START + 54 )
-#define RID_STR_RECORD ( RID_BASICIDE_START + 56 )
-
-#define RID_CTRL_MACRO 1
-#define RID_CTRL_LIB 2
-#define RID_TXT_MACRONAME 3
-#define RID_TXT_MACROFROM 4
-#define RID_ED_MACRONAME 5
-#define RID_TXT_DESCRIPTION 6
-#define RID_PB_RUN 8
-#define RID_PB_CLOSE 9
-#define RID_PB_EDIT 10
-#define RID_PB_ORG 11
-#define RID_PB_DEL 12
-#define RID_PB_ASSIGN 13
-#define RID_PB_HELP 15
-#define RID_ML_DESCRIPTION 16
-#define RID_TXT_MACROSIN 17
-#define RID_TXT_SAVEMACRO 18
-#define RID_PB_NEWLIB 19
-#define RID_PB_NEWMOD 20
-
-#endif // _MACRODLG_HRC
-
diff --git a/basctl/source/basicide/macrodlg.hxx b/basctl/source/basicide/macrodlg.hxx
deleted file mode 100644
index 3934dca52..000000000
--- a/basctl/source/basicide/macrodlg.hxx
+++ /dev/null
@@ -1,114 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-//
-#ifndef _MACRODLG_HXX
-#define _MACRODLG_HXX
-
-#include <svheader.hxx>
-
-#include <bastype2.hxx>
-#include <bastype3.hxx>
-#include <sfx2/basedlgs.hxx>
-#include <vcl/fixed.hxx>
-
-#include <vcl/button.hxx>
-
-#define MACRO_CLOSE 10
-#define MACRO_OK_RUN 11
-#define MACRO_NEW 12
-#define MACRO_EDIT 14
-#define MACRO_ORGANIZE 15
-#define MACRO_ASSIGN 16
-
-#define MACROCHOOSER_ALL 1
-#define MACROCHOOSER_CHOOSEONLY 2
-#define MACROCHOOSER_RECORDING 3
-
-class BasicManager;
-
-class MacroChooser : public SfxModalDialog
-{
-private:
- FixedText aMacroNameTxt;
- Edit aMacroNameEdit;
- FixedText aMacroFromTxT;
- FixedText aMacrosSaveInTxt;
- BasicTreeListBox aBasicBox;
- FixedText aMacrosInTxt;
- String aMacrosInTxtBaseStr;
- SvTreeListBox aMacroBox;
-
- PushButton aRunButton;
- CancelButton aCloseButton;
- PushButton aAssignButton;
- PushButton aEditButton;
- PushButton aNewDelButton;
- PushButton aOrganizeButton;
- HelpButton aHelpButton;
- PushButton aNewLibButton;
- PushButton aNewModButton;
-
- sal_Bool bNewDelIsDel;
- sal_Bool bForceStoreBasic;
-
- sal_uInt16 nMode;
-
- DECL_LINK( MacroSelectHdl, SvTreeListBox * );
- DECL_LINK( MacroDoubleClickHdl, SvTreeListBox * );
- DECL_LINK( BasicSelectHdl, SvTreeListBox * );
- DECL_LINK( EditModifyHdl, Edit * );
- DECL_LINK( ButtonHdl, Button * );
-
- void CheckButtons();
- void SaveSetCurEntry( SvTreeListBox& rBox, SvLBoxEntry* pEntry );
- void UpdateFields();
-
- void EnableButton( Button& rButton, sal_Bool bEnable );
-
- String GetInfo( SbxVariable* pVar );
-
- void StoreMacroDescription();
- void RestoreMacroDescription();
-
-public:
- MacroChooser( Window* pParent, sal_Bool bCreateEntries = sal_True );
- ~MacroChooser();
-
- SbMethod* GetMacro();
- void DeleteMacro();
- SbMethod* CreateMacro();
-
- virtual short Execute();
-
- void SetMode( sal_uInt16 nMode );
- sal_uInt16 GetMode() const { return nMode; }
-};
-
-#endif // _MACRODLG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/macrodlg.src b/basctl/source/basicide/macrodlg.src
deleted file mode 100644
index 5201da429..000000000
--- a/basctl/source/basicide/macrodlg.src
+++ /dev/null
@@ -1,234 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <sfx2/sfx.hrc>
-#include <macrodlg.hrc>
-#include <basidesh.hrc>
-#include <helpid.hrc>
-ModalDialog RID_MACROCHOOSER
-{
- HelpId = "basctl:ModalDialog:RID_MACROCHOOSER" ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 287 , 165 ) ;
- Text [ en-US ] = "%PRODUCTNAME Basic Macros" ;
- Moveable = TRUE ;
- // Closeable = TRUE;
-
- FixedText RID_TXT_MACROSIN
- {
- Pos = MAP_APPFONT ( 122 , 30 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "Existing macros ~in:";
- };
- Control RID_CTRL_MACRO
- {
- HelpID = HID_BASICIDE_MACROS ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 122 , 41 ) ;
- Size = MAP_APPFONT ( 100 , 117 ) ;
- // Size = MAP_APPFONT ( 100 , 117 ) ;
- TabStop = TRUE ;
- };
- Control RID_CTRL_LIB
- {
- HelpID = HID_BASICIDE_LIBS ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 41 ) ;
- Size = MAP_APPFONT ( 110 , 117 ) ;
- TabStop = TRUE ;
- };
- FixedText RID_TXT_MACRONAME
- {
- Pos = MAP_APPFONT ( 6 , 3 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "~Macro name" ;
- };
- Edit RID_ED_MACRONAME
- {
- HelpID = "basctl:Edit:RID_MACROCHOOSER:RID_ED_MACRONAME";
- Border = TRUE ;
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 6 , 14 ) ;
- Size = MAP_APPFONT ( 110 , 12 ) ;
- TabStop = TRUE ;
- };
- FixedText RID_TXT_MACROFROM
- {
- Pos = MAP_APPFONT ( 6 , 30 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "Macro ~from" ;
- };
- FixedText RID_TXT_SAVEMACRO
- {
- Pos = MAP_APPFONT ( 6 , 30 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "Save m~acro in";
- };
-
- FixedText RID_TXT_DESCRIPTION
- {
- Pos = MAP_APPFONT ( 6 , 117 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "De~scription" ;
- };
- PushButton RID_PB_RUN
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_RUN";
- Pos = MAP_APPFONT ( 231 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- DefButton = TRUE;
- Text [ en-US ] = "R~un" ;
- TabStop = TRUE ;
- };
- CancelButton RID_PB_CLOSE
- {
- Pos = MAP_APPFONT ( 231 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Close";
- };
-
- PushButton RID_PB_ASSIGN
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_ASSIGN";
- Pos = MAP_APPFONT ( 231 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Assign..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_EDIT
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_EDIT";
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Pos = MAP_APPFONT ( 231 , 77 ) ;
- Text [ en-US ] = "~Edit" ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEWLIB
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_NEWLIB";
- Pos = MAP_APPFONT ( 231 , 60 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "New ~Library";
- };
- PushButton RID_PB_NEWMOD
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_NEWMOD";
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Pos = MAP_APPFONT ( 231 , 77 ) ;
- Text [ en-US ] = "New M~odule";
- };
- PushButton RID_PB_DEL
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_DEL";
- Pos = MAP_APPFONT ( 231 , 94 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Delete" ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_ORG
- {
- HelpID = "basctl:PushButton:RID_MACROCHOOSER:RID_PB_ORG";
- Pos = MAP_APPFONT ( 231 , 114 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- Text [ en-US ] = "~Organizer..." ;
- };
- HelpButton RID_PB_HELP
- {
- Pos = MAP_APPFONT ( 231 , 131 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- MultiLineEdit RID_ML_DESCRIPTION
- {
- HelpID = "basctl:MultiLineEdit:RID_MACROCHOOSER:RID_ML_DESCRIPTION";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 131 ) ;
- Size = MAP_APPFONT ( 216 , 28 ) ;
- TabStop = TRUE ;
- VScroll = TRUE ;
- IgnoreTab = TRUE ;
- };
-};
-String RID_STR_STDMACRONAME
-{
- Text [ en-US ] = "Macro" ;
-};
-String RID_STR_BTNDEL
-{
- Text [ en-US ] = "~Delete" ;
-};
-String RID_STR_BTNNEW
-{
- Text [ en-US ] = "~New" ;
-};
-String RID_STR_CLOSE
-{
- Text [ en-US ] = "Close" ;
-};
-String RID_STR_CHOOSE
-{
- Text [ en-US ] = "Choose" ;
-};
-String RID_STR_RUN
-{
- Text [ en-US ] = "Run" ;
-};
-
-String RID_STR_RECORD
-{
- Text [ en-US ] = "~Save" ;
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx
deleted file mode 100644
index f1759d633..000000000
--- a/basctl/source/basicide/moduldl2.cxx
+++ /dev/null
@@ -1,1706 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#define GLOBALOVERFLOW
-
-#include <ide_pch.hxx>
-
-#include <sot/storinfo.hxx>
-
-#include <moduldlg.hrc>
-#include <moduldlg.hxx>
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <bastypes.hxx>
-#include <basobj.hxx>
-#include <baside2.hrc>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <svx/passwd.hxx>
-#include <sbxitem.hxx>
-#include <basdoc.hxx>
-#include <ucbhelper/content.hxx>
-#include "rtl/uri.hxx"
-#include <tools/urlobj.hxx>
-#include <tools/diagnose_ex.h>
-
-#include <sot/storage.hxx>
-#include <com/sun/star/ui/dialogs/XFilePicker.hpp>
-#include <com/sun/star/ui/dialogs/XFolderPicker.hpp>
-#include <com/sun/star/ui/dialogs/XFilterManager.hpp>
-#include <com/sun/star/ui/dialogs/TemplateDescription.hpp>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/script/XLibraryContainerExport.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include "com/sun/star/ucb/XCommandEnvironment.hpp"
-#include <com/sun/star/ucb/NameClash.hpp>
-#include "com/sun/star/packages/manifest/XManifestWriter.hpp"
-#include <unotools/pathoptions.hxx>
-#include <comphelper/processfactory.hxx>
-
-#include <com/sun/star/util/VetoException.hpp>
-#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
-
-using namespace ::comphelper;
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::ucb;
-using namespace ::com::sun::star::ui::dialogs;
-
-
-typedef ::cppu::WeakImplHelper1< task::XInteractionHandler > HandlerImpl_BASE;
-
-class DummyInteractionHandler : public HandlerImpl_BASE
-{
- Reference< task::XInteractionHandler > m_xHandler;
-public:
- DummyInteractionHandler( const Reference< task::XInteractionHandler >& xHandler ) : m_xHandler( xHandler ){}
-
- virtual void SAL_CALL handle( const Reference< task::XInteractionRequest >& rRequest ) throw (::com::sun::star::uno::RuntimeException)
- {
- if ( m_xHandler.is() )
- {
- script::ModuleSizeExceededRequest aModSizeException;
- if ( rRequest->getRequest() >>= aModSizeException )
- m_xHandler->handle( rRequest );
- }
- }
-};
-
-//----------------------------------------------------------------------------
-// BasicLibUserData
-//----------------------------------------------------------------------------
-class BasicLibUserData
-{
-private:
- ScriptDocument m_aDocument;
-
-public:
- BasicLibUserData( const ScriptDocument& rDocument ) : m_aDocument( rDocument ) { }
- virtual ~BasicLibUserData() {};
-
- const ScriptDocument&
- GetDocument() const { return m_aDocument; }
-};
-
-
-//----------------------------------------------------------------------------
-// BasicLibLBoxString
-//----------------------------------------------------------------------------
-
-class BasicLibLBoxString : public SvLBoxString
-{
-public:
- BasicLibLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rTxt ) :
- SvLBoxString( pEntry, nFlags, rTxt ) {}
-
- virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry );
-};
-
-//----------------------------------------------------------------------------
-
-void BasicLibLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry )
-{
- // Change text color if library is read only:
- bool bReadOnly = false;
- if (pEntry && pEntry->GetUserData())
- {
- ScriptDocument aDocument(
- static_cast< BasicLibUserData * >(pEntry->GetUserData())->
- GetDocument() );
-
- rtl::OUString aLibName(
- static_cast< SvLBoxString * >(pEntry->GetItem(1))->GetText());
- Reference< script::XLibraryContainer2 > xModLibContainer(
- aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY);
- Reference< script::XLibraryContainer2 > xDlgLibContainer(
- aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY);
- bReadOnly
- = (xModLibContainer.is() && xModLibContainer->hasByName(aLibName)
- && xModLibContainer->isLibraryReadOnly(aLibName))
- || (xDlgLibContainer.is() && xDlgLibContainer->hasByName(aLibName)
- && xDlgLibContainer->isLibraryReadOnly(aLibName));
- }
- if (bReadOnly)
- rDev.DrawCtrlText(rPos, GetText(), 0, STRING_LEN, TEXT_DRAW_DISABLE);
- else
- rDev.DrawText(rPos, GetText());
-}
-
-
-//----------------------------------------------------------------------------
-// BasicCheckBox
-//----------------------------------------------------------------------------
-
-BasicCheckBox::BasicCheckBox( Window* pParent, const ResId& rResId )
- :SvTabListBox( pParent, rResId )
- ,m_aDocument( ScriptDocument::getApplicationScriptDocument() )
-{
- nMode = LIBMODE_MANAGER;
- long aTabs_[] = { 1, 12 }; // Mindestens einen braucht die TabPos...
- // 12 wegen der Checkbox
- SetTabs( aTabs_ );
- Init();
-}
-
-//----------------------------------------------------------------------------
-
-BasicCheckBox::~BasicCheckBox()
-{
- delete pCheckButton;
-
- // delete user data
- SvLBoxEntry* pEntry = First();
- while ( pEntry )
- {
- delete (BasicLibUserData*)pEntry->GetUserData();
- pEntry = Next( pEntry );
- }
-}
-
-//----------------------------------------------------------------------------
-
-void BasicCheckBox::Init()
-{
- pCheckButton = new SvLBoxButtonData(this);
-
- if ( nMode == LIBMODE_CHOOSER )
- EnableCheckButton( pCheckButton );
- else
- EnableCheckButton( 0 );
-
- SetHighlightRange();
-}
-
-//----------------------------------------------------------------------------
-
-void BasicCheckBox::SetMode( sal_uInt16 n )
-{
- nMode = n;
-
- if ( nMode == LIBMODE_CHOOSER )
- EnableCheckButton( pCheckButton );
- else
- EnableCheckButton( 0 );
-}
-
-//----------------------------------------------------------------------------
-
-SvLBoxEntry* BasicCheckBox::DoInsertEntry( const String& rStr, sal_uLong nPos )
-{
- return SvTabListBox::InsertEntryToColumn( rStr, nPos, 0 );
-}
-
-//----------------------------------------------------------------------------
-
-SvLBoxEntry* BasicCheckBox::FindEntry( const String& rName )
-{
- sal_uLong nCount = GetEntryCount();
- for ( sal_uLong i = 0; i < nCount; i++ )
- {
- SvLBoxEntry* pEntry = GetEntry( i );
- DBG_ASSERT( pEntry, "pEntry?!" );
- if ( rName.CompareIgnoreCaseToAscii( GetEntryText( pEntry, 0 ) ) == COMPARE_EQUAL )
- return pEntry;
- }
- return 0;
-}
-
-//----------------------------------------------------------------------------
-
-void BasicCheckBox::CheckEntryPos( sal_uLong nPos, sal_Bool bCheck )
-{
- if ( nPos < GetEntryCount() )
- {
- SvLBoxEntry* pEntry = GetEntry( nPos );
-
- if ( bCheck != GetCheckButtonState( pEntry ) )
- SetCheckButtonState( pEntry,
- bCheck
- ? SvButtonState(SV_BUTTON_CHECKED)
- : SvButtonState(SV_BUTTON_UNCHECKED) );
- }
-}
-
-//----------------------------------------------------------------------------
-
-sal_Bool BasicCheckBox::IsChecked( sal_uLong nPos ) const
-{
- if ( nPos < GetEntryCount() )
- return (GetCheckButtonState( GetEntry( nPos ) ) == SV_BUTTON_CHECKED);
- return sal_False;
-}
-
-//----------------------------------------------------------------------------
-
-void BasicCheckBox::InitEntry( SvLBoxEntry* pEntry, const XubString& rTxt, const Image& rImg1, const Image& rImg2, SvLBoxButtonKind eButtonKind )
-{
- SvTabListBox::InitEntry( pEntry, rTxt, rImg1, rImg2, eButtonKind );
-
- if ( nMode == LIBMODE_MANAGER )
- {
- // initialize all columns with own string class (column 0 == bitmap)
- sal_uInt16 nCount = pEntry->ItemCount();
- for ( sal_uInt16 nCol = 1; nCol < nCount; ++nCol )
- {
- SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nCol );
- BasicLibLBoxString* pStr = new BasicLibLBoxString( pEntry, 0, pCol->GetText() );
- pEntry->ReplaceItem( pStr, nCol );
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-sal_Bool BasicCheckBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
-{
- if ( nMode != LIBMODE_MANAGER )
- return sal_False;
-
- DBG_ASSERT( pEntry, "Kein Eintrag?" );
-
- // check, if Standard library
- String aLibName = GetEntryText( pEntry, 0 );
- if ( aLibName.EqualsIgnoreCaseAscii( "Standard" ) )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_CANNOTCHANGENAMESTDLIB ) ) ).Execute();
- return sal_False;
- }
-
- // check, if library is readonly
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBISREADONLY ) ) ).Execute();
- return sal_False;
- }
-
- // i24094: Password verification necessary for renaming
- sal_Bool bOK = sal_True;
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- // check password
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- String aPassword;
- Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY );
- bOK = QueryPassword( xModLibContainer1, aLibName, aPassword );
- }
- if ( !bOK )
- return sal_False;
- }
-
- // TODO: check if library is reference/link
-
- return sal_True;
-}
-
-//----------------------------------------------------------------------------
-
-sal_Bool BasicCheckBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText )
-{
- sal_Bool bValid = ( rNewText.Len() <= 30 ) && BasicIDE::IsValidSbxName( rNewText );
- String aCurText( GetEntryText( pEntry, 0 ) );
- if ( bValid && ( aCurText != rNewText ) )
- {
- try
- {
- ::rtl::OUString aOUOldName( aCurText );
- ::rtl::OUString aOUNewName( rNewText );
-
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() )
- {
- xModLibContainer->renameLibrary( aOUOldName, aOUNewName );
- }
-
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( xDlgLibContainer.is() )
- {
- xDlgLibContainer->renameLibrary( aOUOldName, aOUNewName );
- }
-
- BasicIDE::MarkDocumentModified( m_aDocument );
- SfxBindings* pBindings = BasicIDE::GetBindingsPtr();
- if ( pBindings )
- {
- pBindings->Invalidate( SID_BASICIDE_LIBSELECTOR );
- pBindings->Update( SID_BASICIDE_LIBSELECTOR );
- }
- }
- catch ( container::ElementExistException& )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) ) ).Execute();
- return sal_False;
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- return sal_False;
- }
- }
-
- if ( !bValid )
- {
- if ( rNewText.Len() > 30 )
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBNAMETOLONG ) ) ).Execute();
- else
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
- }
-
- return bValid;
-}
-
-//----------------------------------------------------------------------------
-// NewObjectDialog
-//----------------------------------------------------------------------------
-
-IMPL_LINK(NewObjectDialog, OkButtonHandler, Button *, EMPTYARG)
-{
- if (BasicIDE::IsValidSbxName(aEdit.GetText()))
- EndDialog(1);
- else
- {
- ErrorBox(this, WB_OK | WB_DEF_OK,
- String(IDEResId(RID_STR_BADSBXNAME))).Execute();
- aEdit.GrabFocus();
- }
- return 0;
-}
-
-NewObjectDialog::NewObjectDialog(Window * pParent, sal_uInt16 nMode,
- bool bCheckName)
- : ModalDialog( pParent, IDEResId( RID_DLG_NEWLIB ) ),
- aText( this, IDEResId( RID_FT_NEWLIB ) ),
- aEdit( this, IDEResId( RID_ED_LIBNAME ) ),
- aOKButton( this, IDEResId( RID_PB_OK ) ),
- aCancelButton( this, IDEResId( RID_PB_CANCEL ) )
-{
- FreeResource();
- aEdit.GrabFocus();
-
- if ( nMode == NEWOBJECTMODE_LIB )
- {
- SetText( String( IDEResId( RID_STR_NEWLIB ) ) );
- }
- else if ( nMode == NEWOBJECTMODE_MOD )
- {
- SetText( String( IDEResId( RID_STR_NEWMOD ) ) );
- }
- else if ( nMode == NEWOBJECTMODE_METH )
- {
- SetText( String( IDEResId( RID_STR_NEWMETH ) ) );
- }
- else
- {
- SetText( String( IDEResId( RID_STR_NEWDLG ) ) );
- }
-
- if (bCheckName)
- aOKButton.SetClickHdl(LINK(this, NewObjectDialog, OkButtonHandler));
-}
-
-//----------------------------------------------------------------------------
-
-NewObjectDialog::~NewObjectDialog()
-{
-}
-
-//----------------------------------------------------------------------------
-// ExportDialog
-//----------------------------------------------------------------------------
-
-IMPL_LINK(ExportDialog, OkButtonHandler, Button *, EMPTYARG)
-{
- mbExportAsPackage = maExportAsPackageButton.IsChecked();
- EndDialog(1);
- return 0;
-}
-
-ExportDialog::ExportDialog( Window * pParent )
- : ModalDialog( pParent, IDEResId( RID_DLG_EXPORT ) ),
- maExportAsPackageButton( this, IDEResId( RB_EXPORTASPACKAGE ) ),
- maExportAsBasicButton( this, IDEResId( RB_EXPORTASBASIC ) ),
- maOKButton( this, IDEResId( RID_PB_OK ) ),
- maCancelButton( this, IDEResId( RID_PB_CANCEL ) )
-{
- FreeResource();
- maExportAsPackageButton.Check();
- maOKButton.SetClickHdl(LINK(this, ExportDialog, OkButtonHandler));
-}
-
-//----------------------------------------------------------------------------
-
-ExportDialog::~ExportDialog()
-{
-}
-
-//----------------------------------------------------------------------------
-// LibPage
-//----------------------------------------------------------------------------
-
-LibPage::LibPage( Window * pParent )
- :TabPage( pParent, IDEResId( RID_TP_LIBS ) )
- ,aBasicsText( this, IDEResId( RID_STR_BASICS ) )
- ,aBasicsBox( this, IDEResId( RID_LB_BASICS ) )
- ,aLibText( this, IDEResId( RID_STR_LIB ) )
- ,aLibBox( this, IDEResId( RID_TRLBOX ) )
- ,aEditButton( this, IDEResId( RID_PB_EDIT ) )
- ,aCloseButton( this, IDEResId( RID_PB_CLOSE ) )
- ,aPasswordButton( this, IDEResId( RID_PB_PASSWORD ) )
- ,aNewLibButton( this, IDEResId( RID_PB_NEWLIB ) )
- ,aInsertLibButton( this, IDEResId( RID_PB_APPEND ) )
- ,aExportButton( this, IDEResId( RID_PB_EXPORT ) )
- ,aDelButton( this, IDEResId( RID_PB_DELETE ) )
- ,m_aCurDocument( ScriptDocument::getApplicationScriptDocument() )
- ,m_eCurLocation( LIBRARY_LOCATION_UNKNOWN )
-{
- FreeResource();
- pTabDlg = 0;
-
- aEditButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aNewLibButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aPasswordButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aExportButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aInsertLibButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aDelButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aCloseButton.SetClickHdl( LINK( this, LibPage, ButtonHdl ) );
- aLibBox.SetSelectHdl( LINK( this, LibPage, TreeListHighlightHdl ) );
-
- aBasicsBox.SetSelectHdl( LINK( this, LibPage, BasicSelectHdl ) );
-
- aLibBox.SetMode( LIBMODE_MANAGER );
- aLibBox.EnableInplaceEditing( sal_True );
- aLibBox.SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP );
- aCloseButton.GrabFocus();
-
- long aTabs[] = { 2, 30, 120 };
- aLibBox.SetTabs( aTabs, MAP_PIXEL );
-
- FillListBox();
- aBasicsBox.SelectEntryPos( 0 );
- SetCurLib();
-
- CheckButtons();
-}
-
-//----------------------------------------------------------------------------
-
-LibPage::~LibPage()
-{
- sal_uInt16 nCount = aBasicsBox.GetEntryCount();
- for ( sal_uInt16 i = 0; i < nCount; ++i )
- {
- BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( i );
- delete pEntry;
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::CheckButtons()
-{
- SvLBoxEntry* pCur = aLibBox.GetCurEntry();
- if ( pCur )
- {
- String aLibName = aLibBox.GetEntryText( pCur, 0 );
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
-
- if ( m_eCurLocation == LIBRARY_LOCATION_SHARE )
- {
- aPasswordButton.Disable();
- aNewLibButton.Disable();
- aInsertLibButton.Disable();
- aDelButton.Disable();
- }
- else if ( aLibName.EqualsIgnoreCaseAscii( "Standard" ) )
- {
- aPasswordButton.Disable();
- aNewLibButton.Enable();
- aInsertLibButton.Enable();
- aExportButton.Disable();
- aDelButton.Disable();
- if ( !aLibBox.HasFocus() )
- aCloseButton.GrabFocus();
- }
- else if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
- {
- aPasswordButton.Disable();
- aNewLibButton.Enable();
- aInsertLibButton.Enable();
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) )
- aDelButton.Disable();
- else
- aDelButton.Enable();
- }
- else
- {
- if ( xModLibContainer.is() && !xModLibContainer->hasByName( aOULibName ) )
- aPasswordButton.Disable();
- else
- aPasswordButton.Enable();
-
- aNewLibButton.Enable();
- aInsertLibButton.Enable();
- aExportButton.Enable();
- aDelButton.Enable();
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::ActivatePage()
-{
- SetCurLib();
-}
-
-//----------------------------------------------------------------------------
-
-
-void LibPage::DeactivatePage()
-{
-}
-
-//----------------------------------------------------------------------------
-
-
-IMPL_LINK_INLINE_START( LibPage, TreeListHighlightHdl, SvTreeListBox *, pBox )
-{
- if ( pBox->IsSelected( pBox->GetHdlEntry() ) )
- CheckButtons();
- return 0;
-}
-IMPL_LINK_INLINE_END( LibPage, TreeListHighlightHdl, SvTreeListBox *, pBox )
-
-//----------------------------------------------------------------------------
-
-IMPL_LINK_INLINE_START( LibPage, BasicSelectHdl, ListBox *, pBox )
-{
- (void)pBox;
- SetCurLib();
- CheckButtons();
- return 0;
-}
-IMPL_LINK_INLINE_END( LibPage, BasicSelectHdl, ListBox *, pBox )
-
-//----------------------------------------------------------------------------
-
-IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
-{
- if ( pButton == &aEditButton )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
-
- SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( m_aCurDocument.getDocumentOrNull() ) );
- SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Entry?!" );
- String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
- SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_LIBSELECTED,
- SFX_CALLMODE_ASYNCHRON, &aDocItem, &aLibNameItem, 0L );
- }
- EndTabDialog( 1 );
- return 0;
- }
- else if ( pButton == &aNewLibButton )
- NewLib();
- else if ( pButton == &aInsertLibButton )
- InsertLib();
- else if ( pButton == &aExportButton )
- Export();
- else if ( pButton == &aDelButton )
- DeleteCurrent();
- else if ( pButton == &aCloseButton )
- {
- EndTabDialog( 0 );
- return 0;
- }
- else if ( pButton == &aPasswordButton )
- {
- SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
- String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
- ::rtl::OUString aOULibName( aLibName );
-
- // load module library (if not loaded)
- Reference< script::XLibraryContainer > xModLibContainer = m_aCurDocument.getLibraryContainer( E_SCRIPTS );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- pIDEShell->GetViewFrame()->GetWindow().EnterWait();
- xModLibContainer->loadLibrary( aOULibName );
- if ( pIDEShell )
- pIDEShell->GetViewFrame()->GetWindow().LeaveWait();
- }
-
- // load dialog library (if not loaded)
- Reference< script::XLibraryContainer > xDlgLibContainer = m_aCurDocument.getLibraryContainer( E_DIALOGS );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- if ( pIDEShell )
- pIDEShell->GetViewFrame()->GetWindow().EnterWait();
- xDlgLibContainer->loadLibrary( aOULibName );
- if ( pIDEShell )
- pIDEShell->GetViewFrame()->GetWindow().LeaveWait();
- }
-
- // check, if library is password protected
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() )
- {
- sal_Bool bProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
-
- // change password dialog
- SvxPasswordDialog* pDlg = new SvxPasswordDialog( this, sal_True, !bProtected );
- pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) );
-
- if ( pDlg->Execute() == RET_OK )
- {
- sal_Bool bNewProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
-
- if ( bNewProtected != bProtected )
- {
- sal_uLong nPos = (sal_uLong)aLibBox.GetModel()->GetAbsPos( pCurEntry );
- aLibBox.GetModel()->Remove( pCurEntry );
- ImpInsertLibEntry( aLibName, nPos );
- aLibBox.SetCurEntry( aLibBox.GetEntry( nPos ) );
- }
-
- BasicIDE::MarkDocumentModified( m_aCurDocument );
- }
- delete pDlg;
- }
- }
- }
- CheckButtons();
- return 0;
-}
-
-//----------------------------------------------------------------------------
-
-IMPL_LINK_INLINE_START( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg )
-{
- long nRet = 0;
-
- SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
- ::rtl::OUString aOULibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
- Reference< script::XLibraryContainerPassword > xPasswd( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
-
- if ( xPasswd.is() )
- {
- try
- {
- ::rtl::OUString aOUOldPassword( pDlg->GetOldPassword() );
- ::rtl::OUString aOUNewPassword( pDlg->GetNewPassword() );
- xPasswd->changeLibraryPassword( aOULibName, aOUOldPassword, aOUNewPassword );
- nRet = 1;
- }
- catch (...)
- {
- }
- }
-
- return nRet;
-}
-IMPL_LINK_INLINE_END( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg )
-
-//----------------------------------------------------------------------------
-
-void LibPage::NewLib()
-{
- createLibImpl( static_cast<Window*>( this ), m_aCurDocument, &aLibBox, NULL);
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::InsertLib()
-{
- // file open dialog
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILEOPEN_SIMPLE;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
- xFP->setTitle( String( IDEResId( RID_STR_APPENDLIBS ) ) );
-
- // filter
- ::rtl::OUString aTitle = String( IDEResId( RID_STR_BASIC ) );
- ::rtl::OUString aFilter;
- aFilter = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.sbl;*.xlc;*.xlb" ) ); // library files
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdw;*.sxw;*.odt" ) ); // text
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.vor;*.stw;*.ott" ) ); // text template
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sgl;*.sxg;*.odm" ) ); // master document
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.oth" ) ); // html document template
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdc;*.sxc;*.ods" ) ); // spreadsheet
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.stc;*.ots" ) ); // spreadsheet template
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sda;*.sxd;*.odg" ) ); // drawing
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.std;*.otg" ) ); // drawing template
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sdd;*.sxi;*.odp" ) ); // presentation
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sti;*.otp" ) ); // presentation template
- aFilter += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ";*.sxm;*.odf" ) ); // formula
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( aTitle, aFilter );
-
- // set display directory and filter
- String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() );
- if ( aPath.Len() )
- {
- xFP->setDisplayDirectory( aPath );
- }
- else
- {
- // macro path from configuration management
- xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() );
- }
-
- String aLastFilter( IDE_DLL()->GetExtraData()->GetAddLibFilter() );
- if ( aLastFilter.Len() )
- {
- xFltMgr->setCurrentFilter( aLastFilter );
- }
- else
- {
- xFltMgr->setCurrentFilter( String( IDEResId( RID_STR_BASIC ) ) );
- }
-
- if ( xFP->execute() == RET_OK )
- {
- IDE_DLL()->GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() );
- IDE_DLL()->GetExtraData()->SetAddLibFilter( xFltMgr->getCurrentFilter() );
-
- // library containers for import
- Reference< script::XLibraryContainer2 > xModLibContImport;
- Reference< script::XLibraryContainer2 > xDlgLibContImport;
-
- // file URLs
- Sequence< ::rtl::OUString > aFiles = xFP->getFiles();
- INetURLObject aURLObj( aFiles[0] );
- INetURLObject aModURLObj( aURLObj );
- INetURLObject aDlgURLObj( aURLObj );
-
- String aBase = aURLObj.getBase();
- String aModBase = String::CreateFromAscii( "script" );
- String aDlgBase = String::CreateFromAscii( "dialog" );
-
- if ( aBase == aModBase || aBase == aDlgBase )
- {
- aModURLObj.setBase( aModBase );
- aDlgURLObj.setBase( aDlgBase );
- }
-
- if ( xMSF.is() )
- {
- Reference< XSimpleFileAccess > xSFA( xMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY );
-
- if ( xSFA.is() )
- {
- ::rtl::OUString aModURL( aModURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
- if ( xSFA->exists( aModURL ) )
- {
- Sequence <Any> aSeqModURL(1);
- aSeqModURL[0] <<= aModURL;
- xModLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentScriptLibraryContainer" ) ), aSeqModURL ), UNO_QUERY );
- }
-
- ::rtl::OUString aDlgURL( aDlgURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
- if ( xSFA->exists( aDlgURL ) )
- {
- Sequence <Any> aSeqDlgURL(1);
- aSeqDlgURL[0] <<= aDlgURL;
- xDlgLibContImport = Reference< script::XLibraryContainer2 >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.DocumentDialogLibraryContainer" ) ), aSeqDlgURL ), UNO_QUERY );
- }
- }
- }
-
- if ( xModLibContImport.is() || xDlgLibContImport.is() )
- {
- LibDialog* pLibDlg = 0;
-
- Reference< script::XLibraryContainer > xModLibContImp( xModLibContImport, UNO_QUERY );
- Reference< script::XLibraryContainer > xDlgLibContImp( xDlgLibContImport, UNO_QUERY );
- Sequence< ::rtl::OUString > aLibNames = BasicIDE::GetMergedLibraryNames( xModLibContImp, xDlgLibContImp );
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- // library import dialog
- if ( !pLibDlg )
- {
- pLibDlg = new LibDialog( this );
- pLibDlg->SetStorageName( aURLObj.getName() );
- pLibDlg->GetLibBox().SetMode( LIBMODE_CHOOSER );
- }
-
- // libbox entries
- String aLibName( pLibNames[ i ] );
- String aOULibName( aLibName );
- if ( !( ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) && xModLibContImport->isLibraryLink( aOULibName ) ) ||
- ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aOULibName ) && xDlgLibContImport->isLibraryLink( aOULibName ) ) ) )
- {
- SvLBoxEntry* pEntry = pLibDlg->GetLibBox().DoInsertEntry( aLibName );
- sal_uInt16 nPos = (sal_uInt16) pLibDlg->GetLibBox().GetModel()->GetAbsPos( pEntry );
- pLibDlg->GetLibBox().CheckEntryPos( nPos, sal_True);
- }
- }
-
- if ( !pLibDlg )
- InfoBox( this, String( IDEResId( RID_STR_NOLIBINSTORAGE ) ) ).Execute();
- else
- {
- sal_Bool bChanges = sal_False;
- String aExtension( aURLObj.getExtension() );
- String aLibExtension( String::CreateFromAscii( "xlb" ) );
- String aContExtension( String::CreateFromAscii( "xlc" ) );
-
- // disable reference checkbox for documents and sbls
- if ( aExtension != aLibExtension && aExtension != aContExtension )
- pLibDlg->EnableReference( sal_False );
-
- if ( pLibDlg->Execute() )
- {
- sal_uLong nNewPos = aLibBox.GetEntryCount();
- sal_Bool bRemove = sal_False;
- sal_Bool bReplace = pLibDlg->IsReplace();
- sal_Bool bReference = pLibDlg->IsReference();
- for ( sal_uInt16 nLib = 0; nLib < pLibDlg->GetLibBox().GetEntryCount(); nLib++ )
- {
- if ( pLibDlg->GetLibBox().IsChecked( nLib ) )
- {
- SvLBoxEntry* pEntry = pLibDlg->GetLibBox().GetEntry( nLib );
- DBG_ASSERT( pEntry, "Entry?!" );
- String aLibName( pLibDlg->GetLibBox().GetEntryText( pEntry, 0 ) );
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
-
- // check, if the library is already existing
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) ) )
- {
- if ( bReplace )
- {
- // check, if the library is the Standard library
- if ( aLibName.EqualsAscii( "Standard" ) )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_REPLACESTDLIB ) ) ).Execute();
- continue;
- }
-
- // check, if the library is readonly and not a link
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) && !xModLibContainer->isLibraryLink( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) && !xDlgLibContainer->isLibraryLink( aOULibName ) ) )
- {
- String aErrStr( IDEResId( RID_STR_REPLACELIB ) );
- aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName );
- aErrStr += '\n';
- aErrStr += String( IDEResId( RID_STR_LIBISREADONLY ) );
- ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
- continue;
- }
-
- // remove existing libraries
- bRemove = sal_True;
- }
- else
- {
- String aErrStr;
- if ( bReference )
- aErrStr = String( IDEResId( RID_STR_REFNOTPOSSIBLE ) );
- else
- aErrStr = String( IDEResId( RID_STR_IMPORTNOTPOSSIBLE ) );
- aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName );
- aErrStr += '\n';
- aErrStr += String( IDEResId( RID_STR_SBXNAMEALLREADYUSED ) );
- ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
- continue;
- }
- }
-
- // check, if the library is password protected
- sal_Bool bOK = sal_False;
- String aPassword;
- if ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContImport, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) && !bReference )
- {
- bOK = QueryPassword( xModLibContImp, aLibName, aPassword, sal_True, sal_True );
-
- if ( !bOK )
- {
- String aErrStr( IDEResId( RID_STR_NOIMPORT ) );
- aErrStr.SearchAndReplace( String( RTL_CONSTASCII_USTRINGPARAM( "XX" ) ), aLibName );
- ErrorBox( this, WB_OK | WB_DEF_OK, aErrStr ).Execute();
- continue;
- }
- }
- }
-
- // remove existing libraries
- if ( bRemove )
- {
- // remove listbox entry
- SvLBoxEntry* pEntry_ = aLibBox.FindEntry( aLibName );
- if ( pEntry_ )
- aLibBox.SvTreeListBox::GetModel()->Remove( pEntry_ );
-
- // remove module library
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- xModLibContainer->removeLibrary( aOULibName );
-
- // remove dialog library
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
- xDlgLibContainer->removeLibrary( aOULibName );
- }
-
- // copy module library
- if ( xModLibContImport.is() && xModLibContImport->hasByName( aOULibName ) && xModLibContainer.is() && !xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< container::XNameContainer > xModLib;
- if ( bReference )
- {
- // storage URL
- INetURLObject aModStorageURLObj( aModURLObj );
- if ( aExtension == aContExtension )
- {
- sal_Int32 nCount = aModStorageURLObj.getSegmentCount();
- aModStorageURLObj.insertName( aLibName, false, nCount-1 );
- aModStorageURLObj.setExtension( aLibExtension );
- aModStorageURLObj.setFinalSlash();
- }
- ::rtl::OUString aModStorageURL( aModStorageURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
-
- // create library link
- xModLib = Reference< container::XNameContainer >( xModLibContainer->createLibraryLink( aOULibName, aModStorageURL, sal_True ), UNO_QUERY);
- }
- else
- {
- // create library
- xModLib = xModLibContainer->createLibrary( aOULibName );
- if ( xModLib.is() )
- {
- // get import library
- Reference< container::XNameContainer > xModLibImport;
- Any aElement = xModLibContImport->getByName( aOULibName );
- aElement >>= xModLibImport;
-
- if ( xModLibImport.is() )
- {
- // load library
- if ( !xModLibContImport->isLibraryLoaded( aOULibName ) )
- xModLibContImport->loadLibrary( aOULibName );
-
- // copy all modules
- Sequence< ::rtl::OUString > aModNames = xModLibImport->getElementNames();
- sal_Int32 nModCount = aModNames.getLength();
- const ::rtl::OUString* pModNames = aModNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nModCount ; i++ )
- {
- ::rtl::OUString aOUModName( pModNames[ i ] );
- Any aElement_ = xModLibImport->getByName( aOUModName );
- xModLib->insertByName( aOUModName, aElement_ );
- }
-
- // set password
- if ( bOK )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() )
- {
- try
- {
- ::rtl::OUString aOUPassword( aPassword );
- xPasswd->changeLibraryPassword( aOULibName, ::rtl::OUString(), aOUPassword );
- }
- catch (...)
- {
- }
- }
- }
- }
- }
- }
- }
-
- // copy dialog library
- if ( xDlgLibContImport.is() && xDlgLibContImport->hasByName( aOULibName ) && xDlgLibContainer.is() && !xDlgLibContainer->hasByName( aOULibName ) )
- {
- Reference< container::XNameContainer > xDlgLib;
- if ( bReference )
- {
- // storage URL
- INetURLObject aDlgStorageURLObj( aDlgURLObj );
- if ( aExtension == aContExtension )
- {
- sal_Int32 nCount = aDlgStorageURLObj.getSegmentCount();
- aDlgStorageURLObj.insertName( aLibName, false, nCount - 1 );
- aDlgStorageURLObj.setExtension( aLibExtension );
- aDlgStorageURLObj.setFinalSlash();
- }
- ::rtl::OUString aDlgStorageURL( aDlgStorageURLObj.GetMainURL( INetURLObject::NO_DECODE ) );
-
- // create library link
- xDlgLib = Reference< container::XNameContainer >( xDlgLibContainer->createLibraryLink( aOULibName, aDlgStorageURL, sal_True ), UNO_QUERY);
- }
- else
- {
- // create library
- xDlgLib = xDlgLibContainer->createLibrary( aOULibName );
- if ( xDlgLib.is() )
- {
- // get import library
- Reference< container::XNameContainer > xDlgLibImport;
- Any aElement = xDlgLibContImport->getByName( aOULibName );
- aElement >>= xDlgLibImport;
-
- if ( xDlgLibImport.is() )
- {
- // load library
- if ( !xDlgLibContImport->isLibraryLoaded( aOULibName ) )
- xDlgLibContImport->loadLibrary( aOULibName );
-
- // copy all dialogs
- Sequence< ::rtl::OUString > aDlgNames = xDlgLibImport->getElementNames();
- sal_Int32 nDlgCount = aDlgNames.getLength();
- const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
- for ( sal_Int32 i = 0 ; i < nDlgCount ; i++ )
- {
- ::rtl::OUString aOUDlgName( pDlgNames[ i ] );
- Any aElement_ = xDlgLibImport->getByName( aOUDlgName );
- xDlgLib->insertByName( aOUDlgName, aElement_ );
- }
- }
- }
- }
- }
-
- // insert listbox entry
- ImpInsertLibEntry( aLibName, aLibBox.GetEntryCount() );
- bChanges = sal_True;
- }
- }
-
- SvLBoxEntry* pFirstNew = aLibBox.GetEntry( nNewPos );
- if ( pFirstNew )
- aLibBox.SetCurEntry( pFirstNew );
- }
-
- delete pLibDlg;
- if ( bChanges )
- BasicIDE::MarkDocumentModified( m_aCurDocument );
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::Export( void )
-{
- SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
- String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
-
- // Password verification
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
-
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- sal_Bool bOK = sal_True;
-
- // check password
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- String aPassword;
- Reference< script::XLibraryContainer > xModLibContainer1( xModLibContainer, UNO_QUERY );
- bOK = QueryPassword( xModLibContainer1, aLibName, aPassword );
- }
- if ( !bOK )
- return;
- }
-
-
- Window* pWin = static_cast<Window*>( this );
- std::auto_ptr< ExportDialog > xNewDlg( new ExportDialog( pWin ) );
-
- if ( xNewDlg->Execute() == RET_OK )
- {
- try
- {
- if( xNewDlg->isExportAsPackage() )
- ExportAsPackage( aLibName );
- else
- ExportAsBasic( aLibName );
- }
- catch( util::VetoException& ) // user cancled operation
- {
- }
- }
-}
-
-void LibPage::implExportLib( const String& aLibName, const String& aTargetURL,
- const Reference< task::XInteractionHandler >& Handler )
-{
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainerExport > xModLibContainerExport
- ( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainerExport > xDlgLibContainerExport
- ( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( xModLibContainerExport.is() )
- xModLibContainerExport->exportLibrary( aOULibName, aTargetURL, Handler );
-
- if ( xDlgLibContainerExport.is() )
- xDlgLibContainerExport->exportLibrary( aOULibName, aTargetURL, Handler );
-}
-
-
-//===========================================================================
-// Implementation XCommandEnvironment
-
-typedef cppu::WeakImplHelper1< XCommandEnvironment > LibCommandEnvironmentHelper;
-
-class OLibCommandEnvironment : public LibCommandEnvironmentHelper
-{
- Reference< task::XInteractionHandler > mxInteraction;
-
-public:
- OLibCommandEnvironment( Reference< task::XInteractionHandler > xInteraction )
- : mxInteraction( xInteraction )
- {}
-
- // Methods
- virtual Reference< task::XInteractionHandler > SAL_CALL getInteractionHandler()
- throw(RuntimeException);
- virtual Reference< XProgressHandler > SAL_CALL getProgressHandler()
- throw(RuntimeException);
-};
-
-Reference< task::XInteractionHandler > OLibCommandEnvironment::getInteractionHandler()
- throw(RuntimeException)
-{
- return mxInteraction;
-}
-
-Reference< XProgressHandler > OLibCommandEnvironment::getProgressHandler()
- throw(RuntimeException)
-{
- Reference< XProgressHandler > xRet;
- return xRet;
-}
-
-
-
-void LibPage::ExportAsPackage( const String& aLibName )
-{
- // file open dialog
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference< task::XInteractionHandler > xHandler;
- Reference< XSimpleFileAccess > xSFA;
- Reference < XFilePicker > xFP;
- if( xMSF.is() )
- {
- xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance
- ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY );
-
- xSFA = Reference< XSimpleFileAccess > ( xMSF->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) ) ), UNO_QUERY );
- if( !xSFA.is() )
- {
- OSL_FAIL( "No simpleFileAccess" );
- return;
- }
-
- Sequence <Any> aServiceType(1);
- aServiceType[0] <<= TemplateDescription::FILESAVE_SIMPLE;
- xFP = Reference< XFilePicker >( xMSF->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FilePicker" ) ), aServiceType ), UNO_QUERY );
- }
- xFP->setTitle( String( IDEResId( RID_STR_EXPORTPACKAGE ) ) );
-
- // filter
- ::rtl::OUString aTitle = String( IDEResId( RID_STR_PACKAGE_BUNDLE ) );
- ::rtl::OUString aFilter;
- aFilter = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "*.oxt" ) ); // library files
- Reference< XFilterManager > xFltMgr(xFP, UNO_QUERY);
- xFltMgr->appendFilter( aTitle, aFilter );
-
- // set display directory and filter
- String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() );
- if ( aPath.Len() )
- {
- xFP->setDisplayDirectory( aPath );
- }
- else
- {
- // macro path from configuration management
- xFP->setDisplayDirectory( SvtPathOptions().GetWorkPath() );
- }
- xFltMgr->setCurrentFilter( aTitle );
-
- if ( xFP->execute() == RET_OK )
- {
- IDE_DLL()->GetExtraData()->SetAddLibPath( xFP->getDisplayDirectory() );
-
- Sequence< ::rtl::OUString > aFiles = xFP->getFiles();
- INetURLObject aURL( aFiles[0] );
- if( !aURL.getExtension().getLength() )
- aURL.setExtension( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "oxt" ) ) );
-
- ::rtl::OUString aPackageURL( aURL.GetMainURL( INetURLObject::NO_DECODE ) );
-
- String aTmpPath = SvtPathOptions().GetTempPath();
- INetURLObject aInetObj( aTmpPath );
- aInetObj.insertName( aLibName, sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- OUString aSourcePath = aInetObj.GetMainURL( INetURLObject::NO_DECODE );
- if( xSFA->exists( aSourcePath ) )
- xSFA->kill( aSourcePath );
- Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) );
- implExportLib( aLibName, aTmpPath, xDummyHandler );
-
- Reference< XCommandEnvironment > xCmdEnv =
- static_cast<XCommandEnvironment*>( new OLibCommandEnvironment( xHandler ) );
-
- ::ucbhelper::Content sourceContent( aSourcePath, xCmdEnv );
-
- ::rtl::OUStringBuffer buf;
- buf.appendAscii( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.zip://") );
- buf.append( ::rtl::Uri::encode( aPackageURL,
- rtl_UriCharClassRegName,
- rtl_UriEncodeIgnoreEscapes,
- RTL_TEXTENCODING_UTF8 ) );
- buf.append( static_cast<sal_Unicode>('/') );
- OUString destFolder( buf.makeStringAndClear() );
-
- if( xSFA->exists( aPackageURL ) )
- xSFA->kill( aPackageURL );
-
- ::ucbhelper::Content destFolderContent( destFolder, xCmdEnv );
- destFolderContent.transferContent(
- sourceContent, ::ucbhelper::InsertOperation_COPY,
- OUString(), NameClash::OVERWRITE );
-
- INetURLObject aMetaInfInetObj( aTmpPath );
- aMetaInfInetObj.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "META-INF" ) ),
- sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
- OUString aMetaInfFolder = aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE );
- if( xSFA->exists( aMetaInfFolder ) )
- xSFA->kill( aMetaInfFolder );
- xSFA->createFolder( aMetaInfFolder );
-
- ::std::vector< Sequence<beans::PropertyValue> > manifest;
- const OUString strMediaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
- const OUString strFullPath = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "FullPath" ) );
- const OUString strBasicMediaType = ::rtl::OUString
- ( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.basic-library" ) );
-
- Sequence<beans::PropertyValue> attribs( 2 );
- beans::PropertyValue * pattribs = attribs.getArray();
- pattribs[ 0 ].Name = strFullPath;
- OUString fullPath = aLibName;
- fullPath += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/") );
- pattribs[ 0 ].Value <<= fullPath;
- pattribs[ 1 ].Name = strMediaType;
- pattribs[ 1 ].Value <<= strBasicMediaType;
- manifest.push_back( attribs );
-
- // write into pipe:
- Reference<packages::manifest::XManifestWriter> xManifestWriter( xMSF->createInstance
- ( DEFINE_CONST_UNICODE("com.sun.star.packages.manifest.ManifestWriter") ), UNO_QUERY );
- Reference<io::XOutputStream> xPipe( xMSF->createInstance
- ( DEFINE_CONST_UNICODE("com.sun.star.io.Pipe") ), UNO_QUERY );
- xManifestWriter->writeManifestSequence(
- xPipe, Sequence< Sequence<beans::PropertyValue> >(
- &manifest[ 0 ], manifest.size() ) );
-
- aMetaInfInetObj.insertName( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "manifest.xml" ) ),
- sal_True, INetURLObject::LAST_SEGMENT, sal_True, INetURLObject::ENCODE_ALL );
-
- // write buffered pipe data to content:
- ::ucbhelper::Content manifestContent( aMetaInfInetObj.GetMainURL( INetURLObject::NO_DECODE ), xCmdEnv );
- manifestContent.writeStream( Reference<io::XInputStream>( xPipe, UNO_QUERY_THROW ), true );
-
- ::ucbhelper::Content MetaInfContent( aMetaInfFolder, xCmdEnv );
- destFolderContent.transferContent(
- MetaInfContent, ::ucbhelper::InsertOperation_COPY,
- OUString(), NameClash::OVERWRITE );
-
- if( xSFA->exists( aSourcePath ) )
- xSFA->kill( aSourcePath );
- if( xSFA->exists( aMetaInfFolder ) )
- xSFA->kill( aMetaInfFolder );
- }
-}
-
-void LibPage::ExportAsBasic( const String& aLibName )
-{
- // Folder picker
- Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference< XFolderPicker > xFolderPicker;
- Reference< task::XInteractionHandler > xHandler;
- if( xMSF.is() )
- {
- xFolderPicker = Reference< XFolderPicker >( xMSF->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.dialogs.FolderPicker" ) ) ), UNO_QUERY );
-
- xHandler = Reference< task::XInteractionHandler >( xMSF->createInstance
- ( DEFINE_CONST_UNICODE("com.sun.star.task.InteractionHandler") ), UNO_QUERY );
- }
-
- if( xFolderPicker.is() )
- {
- xFolderPicker->setTitle( String( IDEResId( RID_STR_EXPORTBASIC ) ) );
-
- // set display directory and filter
- String aPath( IDE_DLL()->GetExtraData()->GetAddLibPath() );
- if( !aPath.Len() )
- aPath = SvtPathOptions().GetWorkPath();
-
- // INetURLObject aURL(m_sSavePath, INET_PROT_FILE);
- xFolderPicker->setDisplayDirectory( aPath );
- short nRet = xFolderPicker->execute();
- if( nRet == RET_OK )
- {
- String aTargetURL = xFolderPicker->getDirectory();
- IDE_DLL()->GetExtraData()->SetAddLibPath( aTargetURL );
-
- Reference< task::XInteractionHandler > xDummyHandler( new DummyInteractionHandler( xHandler ) );
- implExportLib( aLibName, aTargetURL, xDummyHandler );
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::DeleteCurrent()
-{
- SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
- String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
-
- // check, if library is link
- sal_Bool bIsLibraryLink = sal_False;
- ::rtl::OUString aOULibName( aLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( m_aCurDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLink( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryLink( aOULibName ) ) )
- {
- bIsLibraryLink = sal_True;
- }
-
- if ( QueryDelLib( aLibName, bIsLibraryLink, this ) )
- {
- // inform BasicIDE
- SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( m_aCurDocument.getDocumentOrNull() ) );
- SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_LIBREMOVED,
- SFX_CALLMODE_SYNCHRON, &aDocItem, &aLibNameItem, 0L );
- }
-
- // remove library from module and dialog library containers
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- xModLibContainer->removeLibrary( aOULibName );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
- xDlgLibContainer->removeLibrary( aOULibName );
-
- ((SvLBox&)aLibBox).GetModel()->Remove( pCurEntry );
- BasicIDE::MarkDocumentModified( m_aCurDocument );
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::EndTabDialog( sal_uInt16 nRet )
-{
- DBG_ASSERT( pTabDlg, "TabDlg nicht gesetzt!" );
- if ( pTabDlg )
- pTabDlg->EndDialog( nRet );
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::FillListBox()
-{
- InsertListBoxEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_USER );
- InsertListBoxEntry( ScriptDocument::getApplicationScriptDocument(), LIBRARY_LOCATION_SHARE );
-
- ScriptDocuments aDocuments( ScriptDocument::getAllScriptDocuments( ScriptDocument::DocumentsSorted ) );
- for ( ScriptDocuments::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- InsertListBoxEntry( *doc, LIBRARY_LOCATION_DOCUMENT );
- }
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation )
-{
- String aEntryText( rDocument.getTitle( eLocation ) );
- sal_uInt16 nPos = aBasicsBox.InsertEntry( aEntryText, LISTBOX_APPEND );
- aBasicsBox.SetEntryData( nPos, new BasicDocumentEntry( rDocument, eLocation ) );
-}
-
-//----------------------------------------------------------------------------
-
-void LibPage::SetCurLib()
-{
- sal_uInt16 nSelPos = aBasicsBox.GetSelectEntryPos();
- BasicDocumentEntry* pEntry = (BasicDocumentEntry*)aBasicsBox.GetEntryData( nSelPos );
- if ( pEntry )
- {
- ScriptDocument aDocument( pEntry->GetDocument() );
- DBG_ASSERT( aDocument.isAlive(), "LibPage::SetCurLib: no document, or document is dead!" );
- if ( !aDocument.isAlive() )
- return;
- LibraryLocation eLocation = pEntry->GetLocation();
- if ( aDocument != m_aCurDocument || eLocation != m_eCurLocation )
- {
- m_aCurDocument = aDocument;
- m_eCurLocation = eLocation;
- aLibBox.SetDocument( aDocument );
- aLibBox.Clear();
-
- // get a sorted list of library names
- Sequence< ::rtl::OUString > aLibNames = aDocument.getLibraryNames();
- sal_Int32 nLibCount = aLibNames.getLength();
- const ::rtl::OUString* pLibNames = aLibNames.getConstArray();
-
- for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
- {
- String aLibName( pLibNames[ i ] );
- if ( eLocation == aDocument.getLibraryLocation( aLibName ) )
- ImpInsertLibEntry( aLibName, i );
- }
-
- SvLBoxEntry* pEntry_ = aLibBox.FindEntry( String::CreateFromAscii( "Standard" ) );
- if ( !pEntry_ )
- pEntry_ = aLibBox.GetEntry( 0 );
- aLibBox.SetCurEntry( pEntry_ );
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, sal_uLong nPos )
-{
- // check, if library is password protected
- sal_Bool bProtected = sal_False;
- ::rtl::OUString aOULibName( rLibName );
- Reference< script::XLibraryContainer2 > xModLibContainer( m_aCurDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
- {
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() )
- {
- bProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
- }
- }
-
- SvLBoxEntry* pNewEntry = aLibBox.DoInsertEntry( rLibName, nPos );
- pNewEntry->SetUserData( new BasicLibUserData( m_aCurDocument ) );
-
- if (bProtected)
- {
- Image aImage(IDEResId(RID_IMG_LOCKED));
- aLibBox.SetExpandedEntryBmp(pNewEntry, aImage);
- aLibBox.SetCollapsedEntryBmp(pNewEntry, aImage);
- }
-
- // check, if library is link
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLink( aOULibName ) )
- {
- String aLinkURL = xModLibContainer->getLibraryLinkURL( aOULibName );
- aLibBox.SetEntryText( aLinkURL, pNewEntry, 1 );
- }
-
- return pNewEntry;
-}
-
-//----------------------------------------------------------------------------
-
-// Helper function
-void createLibImpl( Window* pWin, const ScriptDocument& rDocument,
- BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox )
-{
- OSL_ENSURE( rDocument.isAlive(), "createLibImpl: invalid document!" );
- if ( !rDocument.isAlive() )
- return;
-
- // create library name
- String aLibName;
- String aLibStdName( String( RTL_CONSTASCII_USTRINGPARAM( "Library" ) ) );
- //String aLibStdName( IDEResId( RID_STR_STDLIBNAME ) );
- sal_Bool bValid = sal_False;
- sal_uInt16 i = 1;
- while ( !bValid )
- {
- aLibName = aLibStdName;
- aLibName += String::CreateFromInt32( i );
- if ( !rDocument.hasLibrary( E_SCRIPTS, aLibName ) && !rDocument.hasLibrary( E_DIALOGS, aLibName ) )
- bValid = sal_True;
- i++;
- }
-
- std::auto_ptr< NewObjectDialog > xNewDlg( new NewObjectDialog( pWin, NEWOBJECTMODE_LIB ) );
- xNewDlg->SetObjectName( aLibName );
-
- if ( xNewDlg->Execute() )
- {
- if ( xNewDlg->GetObjectName().Len() )
- aLibName = xNewDlg->GetObjectName();
-
- if ( aLibName.Len() > 30 )
- {
- ErrorBox( pWin, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_LIBNAMETOLONG ) ) ).Execute();
- }
- else if ( !BasicIDE::IsValidSbxName( aLibName ) )
- {
- ErrorBox( pWin, WB_OK | WB_DEF_OK,
- String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
- }
- else if ( rDocument.hasLibrary( E_SCRIPTS, aLibName ) || rDocument.hasLibrary( E_DIALOGS, aLibName ) )
- {
- ErrorBox( pWin, WB_OK | WB_DEF_OK,
- String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute();
- }
- else
- {
- try
- {
- // create module and dialog library
- Reference< container::XNameContainer > xModLib( rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName ) );
- Reference< container::XNameContainer > xDlgLib( rDocument.getOrCreateLibrary( E_DIALOGS, aLibName ) );
-
- if( pLibBox )
- {
- SvLBoxEntry* pEntry = pLibBox->DoInsertEntry( aLibName );
- pEntry->SetUserData( new BasicLibUserData( rDocument ) );
- pLibBox->SetCurEntry( pEntry );
- }
-
- // create a module
- String aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
- ::rtl::OUString sModuleCode;
- if ( !rDocument.createModule( aLibName, aModName, sal_True, sModuleCode ) )
- throw Exception();
-
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_SBXINSERTED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
-
- if( pBasicBox )
- {
- SvLBoxEntry* pEntry = pBasicBox->GetCurEntry();
- SvLBoxEntry* pRootEntry = NULL;
- while( pEntry )
- {
- pRootEntry = pEntry;
- pEntry = pBasicBox->GetParent( pEntry );
- }
-
- sal_uInt16 nMode = pBasicBox->GetMode();
- bool bDlgMode = ( nMode & BROWSEMODE_DIALOGS ) && !( nMode & BROWSEMODE_MODULES );
- sal_uInt16 nId = bDlgMode ? RID_IMG_DLGLIB : RID_IMG_MODLIB;
- SvLBoxEntry* pNewLibEntry = pBasicBox->AddEntry(
- aLibName,
- Image( IDEResId( nId ) ),
- pRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_LIBRARY ) ) );
- DBG_ASSERT( pNewLibEntry, "InsertEntry fehlgeschlagen!" );
-
- if( pNewLibEntry )
- {
- SvLBoxEntry* pEntry_ = pBasicBox->AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- pNewLibEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
- DBG_ASSERT( pEntry_, "InsertEntry fehlgeschlagen!" );
- pBasicBox->SetCurEntry( pEntry_ );
- pBasicBox->Select( pBasicBox->GetCurEntry() ); // OV-Bug?!
- }
- }
- }
- catch ( uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-}
-
-//----------------------------------------------------------------------------
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/moduldlg.cxx b/basctl/source/basicide/moduldlg.cxx
deleted file mode 100644
index 977c6dea0..000000000
--- a/basctl/source/basicide/moduldlg.cxx
+++ /dev/null
@@ -1,1067 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <memory>
-
-#include <ide_pch.hxx>
-
-
-#include <moduldlg.hrc>
-#include <moduldlg.hxx>
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <bastypes.hxx>
-#include <baside3.hxx>
-#include <basobj.hxx>
-#include <baside2.hrc>
-#include <sbxitem.hxx>
-#include <iderdll.hxx>
-
-#include <com/sun/star/io/XInputStreamProvider.hpp>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/script/XLibraryContainerPassword.hpp>
-#include <com/sun/star/resource/XStringResourceManager.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <comphelper/processfactory.hxx>
-#include <xmlscript/xmldlg_imexp.hxx>
-
-#include "localizationmgr.hxx"
-#include <basic/sbx.hxx>
-#include <tools/diagnose_ex.h>
-
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::resource;
-
-
-ExtBasicTreeListBox::ExtBasicTreeListBox( Window* pParent, const ResId& rRes )
- : BasicTreeListBox( pParent, rRes )
-{
-}
-
-
-
-ExtBasicTreeListBox::~ExtBasicTreeListBox()
-{
-}
-
-sal_Bool ExtBasicTreeListBox::EditingEntry( SvLBoxEntry* pEntry, Selection& )
-{
- sal_Bool bRet = sal_False;
-
- if ( pEntry )
- {
- sal_uInt16 nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth >= 2 )
- {
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) )
- {
- // allow editing only for libraries, which are not readonly
- bRet = sal_True;
- }
- }
- }
-
- return bRet;
-}
-
-sal_Bool ExtBasicTreeListBox::EditedEntry( SvLBoxEntry* pEntry, const String& rNewText )
-{
- sal_Bool bValid = BasicIDE::IsValidSbxName( rNewText );
- if ( !bValid )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK, String( IDEResId( RID_STR_BADSBXNAME ) ) ).Execute();
- return sal_False;
- }
-
- String aCurText( GetEntryText( pEntry ) );
- if ( aCurText == rNewText )
- // nothing to do
- return sal_True;
-
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- DBG_ASSERT( aDocument.isValid(), "ExtBasicTreeListBox::EditedEntry: no document!" );
- if ( !aDocument.isValid() )
- return sal_False;
- String aLibName( aDesc.GetLibName() );
- BasicEntryType eType( aDesc.GetType() );
-
- bool bSuccess = ( eType == OBJ_TYPE_MODULE )
- ? BasicIDE::RenameModule( this, aDocument, aLibName, aCurText, rNewText )
- : BasicIDE::RenameDialog( this, aDocument, aLibName, aCurText, rNewText );
-
- if ( !bSuccess )
- return sal_False;
-
- BasicIDE::MarkDocumentModified( aDocument );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, rNewText, ConvertType( eType ) );
- pDispatcher->Execute( SID_BASICIDE_SBXRENAMED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
-
- // OV-Bug?!
- SetEntryText( pEntry, rNewText );
- SetCurEntry( pEntry );
- SetCurEntry( pEntry );
- Select( pEntry, sal_False );
- Select( pEntry ); // damit Handler gerufen wird => Edit updaten
-
- return sal_True;
-}
-
-
-DragDropMode ExtBasicTreeListBox::NotifyStartDrag( TransferDataContainer&, SvLBoxEntry* pEntry )
-{
- DragDropMode nMode_ = SV_DRAGDROP_NONE;
-
- if ( pEntry )
- {
- sal_uInt16 nDepth = GetModel()->GetDepth( pEntry );
- if ( nDepth >= 2 )
- {
- nMode_ = SV_DRAGDROP_CTRL_COPY;
- BasicEntryDescriptor aDesc( GetEntryDescriptor( pEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- // allow MOVE mode only for libraries, which are not readonly
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( !( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) ) )
- {
- // Only allow copy for localized libraries
- bool bAllowMove = true;
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
- {
- // Get StringResourceManager
- Reference< container::XNameContainer > xDialogLib( aDocument.getLibrary( E_DIALOGS, aOULibName, sal_True ) );
- Reference< XStringResourceManager > xSourceMgr =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDialogLib );
- if( xSourceMgr.is() )
- bAllowMove = ( xSourceMgr->getLocales().getLength() == 0 );
- }
- if( bAllowMove )
- nMode_ |= SV_DRAGDROP_CTRL_MOVE;
- }
- }
- }
-
- return nMode_;
-}
-
-
-sal_Bool ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
-{
- // don't drop on a BasicManager (nDepth == 0)
- sal_uInt16 nDepth = pEntry ? GetModel()->GetDepth( pEntry ) : 0;
- sal_Bool bValid = nDepth ? sal_True : sal_False;
-
- // don't drop in the same library
- SvLBoxEntry* pSelected = FirstSelected();
- if ( ( nDepth == 1 ) && ( pEntry == GetParent( pSelected ) ) )
- bValid = sal_False;
- else if ( ( nDepth == 2 ) && ( GetParent( pEntry ) == GetParent( pSelected ) ) )
- bValid = sal_False;
-
- // don't drop on a library, which is not loaded, readonly or password protected
- // or which already has a module/dialog with this name
- if ( bValid && ( nDepth > 0 ) )
- {
- // get source module/dialog name
- BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( pSelected ) );
- String aSourceName( aSourceDesc.GetName() );
- BasicEntryType eSourceType( aSourceDesc.GetType() );
-
- // get target shell and target library name
- BasicEntryDescriptor aDestDesc( GetEntryDescriptor( pEntry ) );
- const ScriptDocument& rDestDoc( aDestDesc.GetDocument() );
- String aDestLibName( aDestDesc.GetLibName() );
- ::rtl::OUString aOUDestLibName( aDestLibName );
-
- // check if module library is not loaded, readonly or password protected
- Reference< script::XLibraryContainer2 > xModLibContainer( rDestDoc.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOUDestLibName ) )
- {
- if ( !xModLibContainer->isLibraryLoaded( aOUDestLibName ) )
- bValid = sal_False;
-
- if ( xModLibContainer->isLibraryReadOnly( aOUDestLibName ) )
- bValid = sal_False;
-
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOUDestLibName ) && !xPasswd->isLibraryPasswordVerified( aOUDestLibName ) )
- bValid = sal_False;
- }
-
- // check if dialog library is not loaded or readonly
- Reference< script::XLibraryContainer2 > xDlgLibContainer( rDestDoc.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOUDestLibName ) )
- {
- if ( !xDlgLibContainer->isLibraryLoaded( aOUDestLibName ) )
- bValid = sal_False;
-
- if ( xDlgLibContainer->isLibraryReadOnly( aOUDestLibName ) )
- bValid = sal_False;
- }
-
- // check, if module/dialog with this name is already existing in target library
- if ( ( eSourceType == OBJ_TYPE_MODULE && rDestDoc.hasModule( aDestLibName, aSourceName ) ) ||
- ( eSourceType == OBJ_TYPE_DIALOG && rDestDoc.hasDialog( aDestLibName, aSourceName ) ) )
- {
- bValid = sal_False;
- }
- }
-
- return bValid;
-}
-
-
-sal_Bool ExtBasicTreeListBox::NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
- return NotifyCopyingMoving( pTarget, pEntry,
- rpNewParent, rNewChildPos, sal_True );
-}
-
-
-sal_Bool ExtBasicTreeListBox::NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos )
-{
-// return sal_False; // Wie kopiere ich ein SBX ?!
- return NotifyCopyingMoving( pTarget, pEntry,
- rpNewParent, rNewChildPos, sal_False );
-}
-
-
-void BasicIDEShell::CopyDialogResources( Reference< io::XInputStreamProvider >& io_xISP,
- const ScriptDocument& rSourceDoc, const String& rSourceLibName, const ScriptDocument& rDestDoc,
- const String& rDestLibName, const String& rDlgName )
-{
- if ( !io_xISP.is() )
- return;
-
- // Get StringResourceManager
- Reference< container::XNameContainer > xSourceDialogLib( rSourceDoc.getLibrary( E_DIALOGS, rSourceLibName, sal_True ) );
- Reference< XStringResourceManager > xSourceMgr =
- LocalizationMgr::getStringResourceFromDialogLibrary( xSourceDialogLib );
- if( !xSourceMgr.is() )
- return;
- bool bSourceLocalized = ( xSourceMgr->getLocales().getLength() > 0 );
-
- Reference< container::XNameContainer > xDestDialogLib( rDestDoc.getLibrary( E_DIALOGS, rDestLibName, sal_True ) );
- Reference< XStringResourceManager > xDestMgr =
- LocalizationMgr::getStringResourceFromDialogLibrary( xDestDialogLib );
- if( !xDestMgr.is() )
- return;
- bool bDestLocalized = ( xDestMgr->getLocales().getLength() > 0 );
-
- if( !bSourceLocalized && !bDestLocalized )
- return;
-
- // create dialog model
- Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory();
- Reference< container::XNameContainer > xDialogModel = Reference< container::XNameContainer >( xMSF->createInstance
- ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlDialogModel" ) ) ), UNO_QUERY );
- Reference< io::XInputStream > xInput( io_xISP->createInputStream() );
- Reference< XComponentContext > xContext;
- Reference< beans::XPropertySet > xProps( xMSF, UNO_QUERY );
- OSL_ASSERT( xProps.is() );
- OSL_VERIFY( xProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("DefaultContext")) ) >>= xContext );
- ::xmlscript::importDialogModel( xInput, xDialogModel, xContext, rSourceDoc.isDocument() ? rSourceDoc.getDocument() : Reference< frame::XModel >() );
-
- if( xDialogModel.is() )
- {
- if( bSourceLocalized && bDestLocalized )
- {
- Reference< resource::XStringResourceResolver > xSourceStringResolver( xSourceMgr, UNO_QUERY );
- LocalizationMgr::copyResourceForDroppedDialog( xDialogModel, rDlgName, xDestMgr, xSourceStringResolver );
- }
- else if( bSourceLocalized )
- {
- LocalizationMgr::resetResourceForDialog( xDialogModel, xSourceMgr );
- }
- else if( bDestLocalized )
- {
- LocalizationMgr::setResourceIDsForDialog( xDialogModel, xDestMgr );
- }
- io_xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, rDestDoc.isDocument() ? rDestDoc.getDocument() : Reference< frame::XModel >() );
- }
-}
-
-
-sal_Bool ExtBasicTreeListBox::NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove )
-{
- (void)pEntry;
- DBG_ASSERT( pEntry, "Kein Eintrag?" ); // Hier ASS ok, sollte nicht mit
- DBG_ASSERT( pTarget, "Kein Ziel?" ); // NULL (ganz vorne) erreicht werden
- sal_uInt16 nDepth = GetModel()->GetDepth( pTarget );
- DBG_ASSERT( nDepth, "Tiefe?" );
- if ( nDepth == 1 )
- {
- // Target = Basic => Modul/Dialog unter das Basic haengen...
- rpNewParent = pTarget;
- rNewChildPos = 0;
- }
- else if ( nDepth >= 2 )
- {
- // Target = Modul/Dialog => Modul/Dialog unter das uebergeordnete Basic haengen...
- rpNewParent = GetParent( pTarget );
- rNewChildPos = GetModel()->GetRelPos( pTarget ) + 1;
- }
-
- // get target shell and target library name
- BasicEntryDescriptor aDestDesc( GetEntryDescriptor( rpNewParent ) );
- const ScriptDocument& rDestDoc( aDestDesc.GetDocument() );
- String aDestLibName( aDestDesc.GetLibName() );
-
- // get source shell, library name and module/dialog name
- BasicEntryDescriptor aSourceDesc( GetEntryDescriptor( FirstSelected() ) );
- const ScriptDocument rSourceDoc( aSourceDesc.GetDocument() );
- String aSourceLibName( aSourceDesc.GetLibName() );
- String aSourceName( aSourceDesc.GetName() );
- BasicEntryType eType( aSourceDesc.GetType() );
-
- // get dispatcher
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
-
- if ( bMove ) // move
- {
- // remove source module/dialog window
- if ( rSourceDoc != rDestDoc || aSourceLibName != aDestLibName )
- {
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rSourceDoc, aSourceLibName, aSourceName, ConvertType( eType ) );
- pDispatcher->Execute( SID_BASICIDE_SBXDELETED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
-
- try
- {
- if ( eType == OBJ_TYPE_MODULE ) // module
- {
- // get module
- ::rtl::OUString aModule;
- if ( rSourceDoc.getModule( aSourceLibName, aSourceName, aModule ) )
- {
- // remove module from source library
- if ( rSourceDoc.removeModule( aSourceLibName, aSourceName ) )
- {
- BasicIDE::MarkDocumentModified( rSourceDoc );
-
- // insert module into target library
- if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) )
- BasicIDE::MarkDocumentModified( rDestDoc );
- }
- }
- }
- else if ( eType == OBJ_TYPE_DIALOG ) // dialog
- {
- // get dialog
- Reference< io::XInputStreamProvider > xISP;
- if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) )
- {
- BasicIDEShell::CopyDialogResources( xISP, rSourceDoc,
- aSourceLibName, rDestDoc, aDestLibName, aSourceName );
-
- // remove dialog from source library
- if ( BasicIDE::RemoveDialog( rSourceDoc, aSourceLibName, aSourceName ) )
- {
- BasicIDE::MarkDocumentModified( rSourceDoc );
-
- // insert dialog into target library
- if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) )
- BasicIDE::MarkDocumentModified( rDestDoc );
- }
- }
- }
- }
- catch ( uno::Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- else // copy
- {
- try
- {
- if ( eType == OBJ_TYPE_MODULE ) // module
- {
- // get module
- ::rtl::OUString aModule;
- if ( rSourceDoc.getModule( aSourceLibName, aSourceName, aModule ) )
- {
- // insert module into target library
- if ( rDestDoc.insertModule( aDestLibName, aSourceName, aModule ) )
- BasicIDE::MarkDocumentModified( rDestDoc );
- }
- }
- else if ( eType == OBJ_TYPE_DIALOG ) // dialog
- {
- // get dialog
- Reference< io::XInputStreamProvider > xISP;
- if ( rSourceDoc.getDialog( aSourceLibName, aSourceName, xISP ) )
- {
- BasicIDEShell::CopyDialogResources( xISP, rSourceDoc,
- aSourceLibName, rDestDoc, aDestLibName, aSourceName );
-
- // insert dialog into target library
- if ( rDestDoc.insertDialog( aDestLibName, aSourceName, xISP ) )
- BasicIDE::MarkDocumentModified( rDestDoc );
- }
- }
- }
- catch ( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
- // create target module/dialog window
- if ( rSourceDoc != rDestDoc || aSourceLibName != aDestLibName )
- {
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDestDoc, aDestLibName, aSourceName, ConvertType( eType ) );
- pDispatcher->Execute( SID_BASICIDE_SBXINSERTED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
-
- return 2; // Aufklappen...
-}
-
-OrganizeDialog::OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc )
- :TabDialog( pParent, IDEResId( RID_TD_ORGANIZE ) )
- ,aTabCtrl( this, IDEResId( RID_TC_ORGANIZE ) )
- ,m_aCurEntry( rDesc )
-{
- FreeResource();
- aTabCtrl.SetActivatePageHdl( LINK( this, OrganizeDialog, ActivatePageHdl ) );
- if( tabId == 0 )
- {
- aTabCtrl.SetCurPageId( RID_TP_MOD );
- }
- else if ( tabId == 1 )
- {
- aTabCtrl.SetCurPageId( RID_TP_DLG );
- }
- else
- {
- aTabCtrl.SetCurPageId( RID_TP_LIB );
- }
-
- ActivatePageHdl( &aTabCtrl );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_STOREALLMODULESOURCES );
- }
-}
-
-OrganizeDialog::~OrganizeDialog()
-{
- for ( sal_uInt16 i = 0; i < aTabCtrl.GetPageCount(); i++ )
- delete aTabCtrl.GetTabPage( aTabCtrl.GetPageId( i ) );
-};
-
-short OrganizeDialog::Execute()
-{
- Window* pPrevDlgParent = Application::GetDefDialogParent();
- Application::SetDefDialogParent( this );
- short nRet = TabDialog::Execute();
- Application::SetDefDialogParent( pPrevDlgParent );
- return nRet;
-}
-
-
-IMPL_LINK( OrganizeDialog, ActivatePageHdl, TabControl *, pTabCtrl )
-{
- sal_uInt16 nId = pTabCtrl->GetCurPageId();
- // Wenn TabPage noch nicht erzeugt wurde, dann erzeugen
- if ( !pTabCtrl->GetTabPage( nId ) )
- {
- TabPage* pNewTabPage = 0;
- switch ( nId )
- {
- case RID_TP_MOD:
- {
- pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_MODULS ), BROWSEMODE_MODULES );
- ((ObjectPage*)pNewTabPage)->SetTabDlg( this );
- ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry );
- }
- break;
- case RID_TP_DLG:
- {
- pNewTabPage = new ObjectPage( pTabCtrl, IDEResId( RID_TP_DLGS ), BROWSEMODE_DIALOGS );
- ((ObjectPage*)pNewTabPage)->SetTabDlg( this );
- ((ObjectPage*)pNewTabPage)->SetCurrentEntry( m_aCurEntry );
- }
- break;
- case RID_TP_LIB:
- {
- pNewTabPage = new LibPage( pTabCtrl );
- ((LibPage*)pNewTabPage)->SetTabDlg( this );
- }
- break;
- default: OSL_FAIL( "PageHdl: Unbekannte ID!" );
- }
- DBG_ASSERT( pNewTabPage, "Keine Page!" );
- pTabCtrl->SetTabPage( nId, pNewTabPage );
- }
- return 0;
-}
-
-ObjectPage::ObjectPage( Window * pParent, const ResId& rResId, sal_uInt16 nMode ) :
- TabPage( pParent, rResId ),
- aLibText( this, IDEResId( RID_STR_LIB ) ),
- aBasicBox( this, IDEResId( RID_TRLBOX ) ),
- aEditButton( this, IDEResId( RID_PB_EDIT ) ),
- aCloseButton( this, IDEResId( RID_PB_CLOSE ) ),
- aNewModButton( this, IDEResId( RID_PB_NEWMOD ) ),
- aNewDlgButton( this, IDEResId( RID_PB_NEWDLG ) ),
- aDelButton( this, IDEResId( RID_PB_DELETE ) )
-{
- FreeResource();
- pTabDlg = 0;
-
- aEditButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
- aDelButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
- aCloseButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
- aBasicBox.SetSelectHdl( LINK( this, ObjectPage, BasicBoxHighlightHdl ) );
-
- if( nMode & BROWSEMODE_MODULES )
- {
- aNewModButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
- aNewDlgButton.Hide();
- }
- else if ( nMode & BROWSEMODE_DIALOGS )
- {
- aNewDlgButton.SetClickHdl( LINK( this, ObjectPage, ButtonHdl ) );
- aNewModButton.Hide();
- }
-
- aBasicBox.SetDragDropMode( SV_DRAGDROP_CTRL_MOVE | SV_DRAGDROP_CTRL_COPY );
- aBasicBox.EnableInplaceEditing( sal_True );
- aBasicBox.SetMode( nMode );
- aBasicBox.SetStyle( WB_BORDER | WB_TABSTOP |
- WB_HASLINES | WB_HASLINESATROOT |
- WB_HASBUTTONS | WB_HASBUTTONSATROOT |
- WB_HSCROLL );
- aBasicBox.ScanAllEntries();
-
- aEditButton.GrabFocus();
- CheckButtons();
-}
-
-void ObjectPage::SetCurrentEntry( BasicEntryDescriptor& rDesc )
-{
- aBasicBox.SetCurrentEntry( rDesc );
-}
-
-void ObjectPage::ActivatePage()
-{
- aBasicBox.UpdateEntries();
-}
-
-void ObjectPage::DeactivatePage()
-{
-}
-
-void ObjectPage::CheckButtons()
-{
- // enable/disable edit button
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- ::rtl::OUString aOULibName( aDesc.GetLibName() );
- String aLibSubName( aDesc.GetLibSubName() );
- sal_Bool bVBAEnabled = aDocument.isInVBAMode();
- sal_uInt16 nMode = aBasicBox.GetMode();
-
- sal_uInt16 nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
- if ( nDepth >= 2 )
- {
- if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( nDepth == 2 ) )
- aEditButton.Disable();
- else
- aEditButton.Enable();
- }
- else
- aEditButton.Disable();
-
- // enable/disable new module/dialog buttons
- LibraryLocation eLocation( aDesc.GetLocation() );
- sal_Bool bReadOnly = sal_False;
- if ( nDepth > 0 )
- {
- Reference< script::XLibraryContainer2 > xModLibContainer( aDocument.getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- Reference< script::XLibraryContainer2 > xDlgLibContainer( aDocument.getLibraryContainer( E_DIALOGS ), UNO_QUERY );
- if ( ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryReadOnly( aOULibName ) ) ||
- ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && xDlgLibContainer->isLibraryReadOnly( aOULibName ) ) )
- {
- bReadOnly = sal_True;
- }
- }
- if ( bReadOnly || eLocation == LIBRARY_LOCATION_SHARE )
- {
- aNewModButton.Disable();
- aNewDlgButton.Disable();
- }
- else
- {
- aNewModButton.Enable();
- aNewDlgButton.Enable();
- }
-
- // enable/disable delete button
- if ( nDepth >= 2 && !bReadOnly && eLocation != LIBRARY_LOCATION_SHARE )
- {
- if( bVBAEnabled && ( nMode & BROWSEMODE_MODULES ) && ( ( nDepth == 2 ) || aLibSubName.Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) ) )
- aDelButton.Disable();
- else
- aDelButton.Enable();
- }
- else
- aDelButton.Disable();
-}
-
-IMPL_LINK( ObjectPage, BasicBoxHighlightHdl, BasicTreeListBox *, pBox )
-{
- if ( !pBox->IsSelected( pBox->GetHdlEntry() ) )
- return 0;
-
- CheckButtons();
- return 0;
-}
-
-IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
-{
- if ( pButton == &aEditButton )
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
-
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Entry?!" );
- if ( aBasicBox.GetModel()->GetDepth( pCurEntry ) >= 2 )
- {
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- if ( pDispatcher )
- {
- String aModName( aDesc.GetName() );
- // extract the module name from the string like "Sheet1 (Example1)"
- if( aDesc.GetLibSubName().Equals( String( IDEResId( RID_STR_DOCUMENT_OBJECTS ) ) ) )
- {
- sal_uInt16 nIndex = 0;
- aModName = aModName.GetToken( 0, ' ', nIndex );
- }
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(),
- aModName, aBasicBox.ConvertType( aDesc.GetType() ) );
- pDispatcher->Execute( SID_BASICIDE_SHOWSBX, SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
- else // Nur Lib selektiert
- {
- DBG_ASSERT( aBasicBox.GetModel()->GetDepth( pCurEntry ) == 1, "Kein LibEntry?!" );
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- SvLBoxEntry* pParentEntry = aBasicBox.GetParent( pCurEntry );
- if ( pParentEntry )
- {
- BasicDocumentEntry* pBasicDocumentEntry = (BasicDocumentEntry*)pParentEntry->GetUserData();
- if ( pBasicDocumentEntry )
- aDocument = pBasicDocumentEntry->GetDocument();
- }
- SfxUsrAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, makeAny( aDocument.getDocumentOrNull() ) );
- String aLibName( aBasicBox.GetEntryText( pCurEntry ) );
- SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
- if ( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_LIBSELECTED, SFX_CALLMODE_ASYNCHRON, &aDocItem, &aLibNameItem, 0L );
- }
- }
- EndTabDialog( 1 );
- }
- else if ( pButton == &aNewModButton )
- NewModule();
- else if ( pButton == &aNewDlgButton )
- NewDialog();
- else if ( pButton == &aDelButton )
- DeleteCurrent();
- else if ( pButton == &aCloseButton )
- EndTabDialog( 0 );
-
- return 0;
-}
-
-bool ObjectPage::GetSelection( ScriptDocument& rDocument, String& rLibName )
-{
- bool bRet = false;
-
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- rDocument = aDesc.GetDocument();
- rLibName = aDesc.GetLibName();
- if ( !rLibName.Len() )
- rLibName = String::CreateFromAscii( "Standard" );
-
- DBG_ASSERT( rDocument.isAlive(), "ObjectPage::GetSelection: no or dead ScriptDocument in the selection!" );
- if ( !rDocument.isAlive() )
- return false;
-
- // check if the module library is loaded
- sal_Bool bOK = sal_True;
- ::rtl::OUString aOULibName( rLibName );
- Reference< script::XLibraryContainer > xModLibContainer( rDocument.getLibraryContainer( E_SCRIPTS ) );
- if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
- {
- // check password
- Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
- if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
- {
- String aPassword;
- bOK = QueryPassword( xModLibContainer, rLibName, aPassword );
- }
-
- // load library
- if ( bOK )
- xModLibContainer->loadLibrary( aOULibName );
- }
-
- // check if the dialog library is loaded
- Reference< script::XLibraryContainer > xDlgLibContainer( rDocument.getLibraryContainer( E_DIALOGS ) );
- if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
- {
- // load library
- if ( bOK )
- xDlgLibContainer->loadLibrary( aOULibName );
- }
-
- if ( bOK )
- bRet = true;
-
- return bRet;
-}
-
-void ObjectPage::NewModule()
-{
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- String aLibName;
-
- if ( GetSelection( aDocument, aLibName ) )
- {
- String aModName;
- createModImpl( static_cast<Window*>( this ), aDocument,
- aBasicBox, aLibName, aModName, true );
- }
-}
-
-void ObjectPage::NewDialog()
-{
- ScriptDocument aDocument( ScriptDocument::getApplicationScriptDocument() );
- String aLibName;
-
- if ( GetSelection( aDocument, aLibName ) )
- {
- aDocument.getOrCreateLibrary( E_DIALOGS, aLibName );
-
- std::auto_ptr< NewObjectDialog > xNewDlg(
- new NewObjectDialog(this, NEWOBJECTMODE_DLG, true));
- xNewDlg->SetObjectName( aDocument.createObjectName( E_DIALOGS, aLibName ) );
-
- if (xNewDlg->Execute() != 0)
- {
- String aDlgName( xNewDlg->GetObjectName() );
- if (aDlgName.Len() == 0)
- aDlgName = aDocument.createObjectName( E_DIALOGS, aLibName);
-
- if ( aDocument.hasDialog( aLibName, aDlgName ) )
- {
- ErrorBox( this, WB_OK | WB_DEF_OK,
- String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute();
- }
- else
- {
- Reference< io::XInputStreamProvider > xISP;
- if ( !aDocument.createDialog( aLibName, aDlgName, xISP ) )
- return;
-
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aDlgName, BASICIDE_TYPE_DIALOG );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_SBXINSERTED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- LibraryLocation eLocation = aDocument.getLibraryLocation( aLibName );
- SvLBoxEntry* pRootEntry = aBasicBox.FindRootEntry( aDocument, eLocation );
- if ( pRootEntry )
- {
- if ( !aBasicBox.IsExpanded( pRootEntry ) )
- aBasicBox.Expand( pRootEntry );
- SvLBoxEntry* pLibEntry = aBasicBox.FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY );
- DBG_ASSERT( pLibEntry, "Libeintrag nicht gefunden!" );
- if ( pLibEntry )
- {
- if ( !aBasicBox.IsExpanded( pLibEntry ) )
- aBasicBox.Expand( pLibEntry );
- SvLBoxEntry* pEntry = aBasicBox.FindEntry( pLibEntry, aDlgName, OBJ_TYPE_DIALOG );
- if ( !pEntry )
- {
- pEntry = aBasicBox.AddEntry(
- aDlgName,
- Image( IDEResId( RID_IMG_DIALOG ) ),
- pLibEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_DIALOG ) ) );
- DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
- }
- aBasicBox.SetCurEntry( pEntry );
- aBasicBox.Select( aBasicBox.GetCurEntry() ); // OV-Bug?!
- }
- }
- }
- }
- }
-}
-
-void ObjectPage::DeleteCurrent()
-{
- SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Kein aktueller Eintrag!" );
- BasicEntryDescriptor aDesc( aBasicBox.GetEntryDescriptor( pCurEntry ) );
- ScriptDocument aDocument( aDesc.GetDocument() );
- DBG_ASSERT( aDocument.isAlive(), "ObjectPage::DeleteCurrent: no document!" );
- if ( !aDocument.isAlive() )
- return;
- String aLibName( aDesc.GetLibName() );
- String aName( aDesc.GetName() );
- BasicEntryType eType( aDesc.GetType() );
-
- if ( ( eType == OBJ_TYPE_MODULE && QueryDelModule( aName, this ) ) ||
- ( eType == OBJ_TYPE_DIALOG && QueryDelDialog( aName, this ) ) )
- {
- aBasicBox.GetModel()->Remove( pCurEntry );
- if ( aBasicBox.GetCurEntry() ) // OV-Bug ?
- aBasicBox.Select( aBasicBox.GetCurEntry() );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDocument, aLibName, aName, aBasicBox.ConvertType( eType ) );
- pDispatcher->Execute( SID_BASICIDE_SBXDELETED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
-
- try
- {
- bool bSuccess = false;
- if ( eType == OBJ_TYPE_MODULE )
- bSuccess = aDocument.removeModule( aLibName, aName );
- else if ( eType == OBJ_TYPE_DIALOG )
- bSuccess = BasicIDE::RemoveDialog( aDocument, aLibName, aName );
-
- if ( bSuccess )
- BasicIDE::MarkDocumentModified( aDocument );
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-}
-
-
-
-void ObjectPage::EndTabDialog( sal_uInt16 nRet )
-{
- DBG_ASSERT( pTabDlg, "TabDlg nicht gesetzt!" );
- if ( pTabDlg )
- pTabDlg->EndDialog( nRet );
-}
-
-
-LibDialog::LibDialog( Window* pParent )
- : ModalDialog( pParent, IDEResId( RID_DLG_LIBS ) ),
- aOKButton( this, IDEResId( RID_PB_OK ) ),
- aCancelButton( this, IDEResId( RID_PB_CANCEL ) ),
- aStorageName( this, IDEResId( RID_FT_STORAGENAME ) ),
- aLibBox( this, IDEResId( RID_CTRL_LIBS ) ),
- aFixedLine( this, IDEResId( RID_FL_OPTIONS ) ),
- aReferenceBox( this, IDEResId( RID_CB_REF ) ),
- aReplaceBox( this, IDEResId( RID_CB_REPL ) )
-{
- SetText( String( IDEResId( RID_STR_APPENDLIBS ) ) );
- FreeResource();
-}
-
-
-LibDialog::~LibDialog()
-{
-}
-
-void LibDialog::SetStorageName( const String& rName )
-{
- String aName( IDEResId( RID_STR_FILENAME ) );
- aName += rName;
- aStorageName.SetText( aName );
-}
-
-// Helper function
-SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
- BasicTreeListBox& rBasicBox, const String& rLibName, String aModName, bool bMain )
-{
- OSL_ENSURE( rDocument.isAlive(), "createModImpl: invalid document!" );
- if ( !rDocument.isAlive() )
- return NULL;
-
- SbModule* pModule = NULL;
-
- String aLibName( rLibName );
- if ( !aLibName.Len() )
- aLibName = String::CreateFromAscii( "Standard" );
- rDocument.getOrCreateLibrary( E_SCRIPTS, aLibName );
- if ( !aModName.Len() )
- aModName = rDocument.createObjectName( E_SCRIPTS, aLibName );
-
- std::auto_ptr< NewObjectDialog > xNewDlg(
- new NewObjectDialog( pWin, NEWOBJECTMODE_MOD, true ) );
- xNewDlg->SetObjectName( aModName );
-
- if (xNewDlg->Execute() != 0)
- {
- if ( xNewDlg->GetObjectName().Len() )
- aModName = xNewDlg->GetObjectName();
-
- try
- {
- ::rtl::OUString sModuleCode;
- // the module has existed
- if( rDocument.hasModule( aLibName, aModName ) )
- return NULL;
- rDocument.createModule( aLibName, aModName, bMain, sModuleCode );
- BasicManager* pBasMgr = rDocument.getBasicManager();
- StarBASIC* pBasic = pBasMgr? pBasMgr->GetLib( aLibName ) : 0;
- if ( pBasic )
- pModule = pBasic->FindModule( aModName );
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, rDocument, aLibName, aModName, BASICIDE_TYPE_MODULE );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_BASICIDE_SBXINSERTED,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- LibraryLocation eLocation = rDocument.getLibraryLocation( aLibName );
- SvLBoxEntry* pRootEntry = rBasicBox.FindRootEntry( rDocument, eLocation );
- if ( pRootEntry )
- {
- if ( !rBasicBox.IsExpanded( pRootEntry ) )
- rBasicBox.Expand( pRootEntry );
- SvLBoxEntry* pLibEntry = rBasicBox.FindEntry( pRootEntry, aLibName, OBJ_TYPE_LIBRARY );
- DBG_ASSERT( pLibEntry, "Libeintrag nicht gefunden!" );
- if ( pLibEntry )
- {
- if ( !rBasicBox.IsExpanded( pLibEntry ) )
- rBasicBox.Expand( pLibEntry );
- SvLBoxEntry* pSubRootEntry = pLibEntry;
- if( pBasic && rDocument.isInVBAMode() )
- {
- // add the new module in the "Modules" entry
- SvLBoxEntry* pLibSubEntry = rBasicBox.FindEntry( pLibEntry, String( IDEResId( RID_STR_NORMAL_MODULES ) ) , OBJ_TYPE_NORMAL_MODULES );
- if( pLibSubEntry )
- {
- if( !rBasicBox.IsExpanded( pLibSubEntry ) )
- rBasicBox.Expand( pLibSubEntry );
- pSubRootEntry = pLibSubEntry;
- }
- }
-
- SvLBoxEntry* pEntry = rBasicBox.FindEntry( pSubRootEntry, aModName, OBJ_TYPE_MODULE );
- if ( !pEntry )
- {
- pEntry = rBasicBox.AddEntry(
- aModName,
- Image( IDEResId( RID_IMG_MODULE ) ),
- pSubRootEntry, false,
- std::auto_ptr< BasicEntry >( new BasicEntry( OBJ_TYPE_MODULE ) ) );
- DBG_ASSERT( pEntry, "InsertEntry fehlgeschlagen!" );
- }
- rBasicBox.SetCurEntry( pEntry );
- rBasicBox.Select( rBasicBox.GetCurEntry() ); // OV-Bug?!
- }
- }
- }
- catch ( container::ElementExistException& )
- {
- ErrorBox( pWin, WB_OK | WB_DEF_OK,
- String( IDEResId( RID_STR_SBXNAMEALLREADYUSED2 ) ) ).Execute();
- }
- catch ( container::NoSuchElementException& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return pModule;
-}
-
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/moduldlg.hrc b/basctl/source/basicide/moduldlg.hrc
deleted file mode 100644
index 1504b3bd1..000000000
--- a/basctl/source/basicide/moduldlg.hrc
+++ /dev/null
@@ -1,68 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _MODULDLG_HRC
-#define _MODULDLG_HRC
-
-#include <svl/solar.hrc>
-
-#define RID_STR_LIB 1
-#define RID_TRLBOX 2
-// free
-#define RID_PB_EDIT 4
-#define RID_PB_CLOSE 5
-#define RID_PB_NEWMOD 6
-#define RID_PB_NEWDLG 7
-#define RID_PB_DELETE 8
-#define RID_PB_NEWLIB 9
-#define RID_PB_APPEND 10
-#define RID_PB_PASSWORD 11
-#define RID_LB_BASICS 12
-#define RID_STR_BASICS 13
-
-#define RID_PB_EXPORT 14
-#define RID_PB_EXPORT_PACKAGE 15
-
-#define RID_TP_MOD 20
-#define RID_TP_LIB 21
-#define RID_TP_DLG 22
-
-#define RID_TC_ORGANIZE 30
-
-#define RID_PB_OK 31
-#define RID_PB_CANCEL 32
-#define RID_CTRL_LIBS 33
-#define RID_FL_OPTIONS 34
-#define RID_CB_REF 35
-#define RID_CB_REPL 36
-#define RID_FT_STORAGENAME 38
-
-#define RID_FT_NEWLIB 40
-#define RID_ED_LIBNAME 41
-#define RB_EXPORTASPACKAGE 42
-#define RB_EXPORTASBASIC 43
-
-#endif // _MODULDLG_HRC
diff --git a/basctl/source/basicide/moduldlg.hxx b/basctl/source/basicide/moduldlg.hxx
deleted file mode 100644
index cef66b226..000000000
--- a/basctl/source/basicide/moduldlg.hxx
+++ /dev/null
@@ -1,277 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _MODULDLG_HXX
-#define _MODULDLG_HXX
-
-#include <svheader.hxx>
-
-#include <bastype2.hxx>
-#include <vcl/dialog.hxx>
-
-#include <vcl/button.hxx>
-#include <vcl/fixed.hxx>
-#include <svtools/svtabbx.hxx>
-#include <vcl/tabdlg.hxx>
-#include <vcl/tabpage.hxx>
-#include "com/sun/star/task/XInteractionHandler.hpp"
-
-#include <vcl/tabctrl.hxx>
-#include <vcl/lstbox.hxx>
-
-class StarBASIC;
-
-
-#define NEWOBJECTMODE_LIB 1
-#define NEWOBJECTMODE_MOD 2
-#define NEWOBJECTMODE_DLG 3
-#define NEWOBJECTMODE_METH 4
-
-class NewObjectDialog : public ModalDialog
-{
-private:
- FixedText aText;
- Edit aEdit;
- OKButton aOKButton;
- CancelButton aCancelButton;
-
- DECL_LINK(OkButtonHandler, Button *);
-
-public:
- NewObjectDialog(Window * pParent, sal_uInt16 nMode, bool bCheckName = false);
- ~NewObjectDialog();
-
- String GetObjectName() const { return aEdit.GetText(); }
- void SetObjectName( const String& rName ) { aEdit.SetText( rName ); aEdit.SetSelection( Selection( 0, rName.Len() ) );}
-};
-
-class ExportDialog : public ModalDialog
-{
-private:
- RadioButton maExportAsPackageButton;
- RadioButton maExportAsBasicButton;
- OKButton maOKButton;
- CancelButton maCancelButton;
-
- sal_Bool mbExportAsPackage;
-
- DECL_LINK(OkButtonHandler, Button *);
-
-public:
- ExportDialog( Window * pParent );
- ~ExportDialog();
-
- sal_Bool isExportAsPackage( void ) { return mbExportAsPackage; }
-};
-
-
-class ExtBasicTreeListBox : public BasicTreeListBox
-{
-protected:
- virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel );
- virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
-
- virtual DragDropMode NotifyStartDrag( TransferDataContainer& rData, SvLBoxEntry* pEntry );
- virtual sal_Bool NotifyAcceptDrop( SvLBoxEntry* pEntry );
-
- virtual sal_Bool NotifyMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos );
- virtual sal_Bool NotifyCopying( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos );
- sal_Bool NotifyCopyingMoving( SvLBoxEntry* pTarget, SvLBoxEntry* pEntry,
- SvLBoxEntry*& rpNewParent, sal_uLong& rNewChildPos, sal_Bool bMove );
-
-public:
- ExtBasicTreeListBox( Window* pParent, const ResId& rRes );
- ~ExtBasicTreeListBox();
-};
-
-#define LIBMODE_CHOOSER 1
-#define LIBMODE_MANAGER 2
-
-class BasicCheckBox : public SvTabListBox
-{
-private:
- sal_uInt16 nMode;
- SvLBoxButtonData* pCheckButton;
- ScriptDocument m_aDocument;
- void Init();
-
-public:
- BasicCheckBox( Window* pParent, const ResId& rResId );
- ~BasicCheckBox();
-
- SvLBoxEntry* DoInsertEntry( const String& rStr, sal_uLong nPos = LISTBOX_APPEND );
- SvLBoxEntry* FindEntry( const String& rName );
-
- void CheckEntryPos( sal_uLong nPos, sal_Bool bCheck = sal_True );
- sal_Bool IsChecked( sal_uLong nPos ) const;
-
- virtual void InitEntry( SvLBoxEntry*, const XubString&, const Image&, const Image&, SvLBoxButtonKind eButtonKind );
- virtual sal_Bool EditingEntry( SvLBoxEntry* pEntry, Selection& rSel );
- virtual sal_Bool EditedEntry( SvLBoxEntry* pEntry, const String& rNewText );
-
- void SetDocument( const ScriptDocument& rDocument ) { m_aDocument = rDocument; }
-
- void SetMode( sal_uInt16 n );
- sal_uInt16 GetMode() const { return nMode; }
-};
-
-class LibDialog: public ModalDialog
-{
-private:
- OKButton aOKButton;
- CancelButton aCancelButton;
- FixedText aStorageName;
- BasicCheckBox aLibBox;
- FixedLine aFixedLine;
- CheckBox aReferenceBox;
- CheckBox aReplaceBox;
-
-public:
- LibDialog( Window* pParent );
- ~LibDialog();
-
- void SetStorageName( const String& rName );
-
- BasicCheckBox& GetLibBox() { return aLibBox; }
- sal_Bool IsReference() const { return aReferenceBox.IsChecked(); }
- sal_Bool IsReplace() const { return aReplaceBox.IsChecked(); }
-
- void EnableReference( sal_Bool b ) { aReferenceBox.Enable( b ); }
- void EnableReplace( sal_Bool b ) { aReplaceBox.Enable( b ); }
-};
-
-
-class OrganizeDialog : public TabDialog
-{
-private:
- TabControl aTabCtrl;
- BasicEntryDescriptor m_aCurEntry;
-
-public:
- OrganizeDialog( Window* pParent, sal_Int16 tabId, BasicEntryDescriptor& rDesc );
- ~OrganizeDialog();
-
- virtual short Execute();
-
- DECL_LINK( ActivatePageHdl, TabControl * );
-};
-
-class ObjectPage: public TabPage
-{
-protected:
- FixedText aLibText;
- ExtBasicTreeListBox aBasicBox;
- PushButton aEditButton;
- CancelButton aCloseButton;
- PushButton aNewModButton;
- PushButton aNewDlgButton;
- PushButton aDelButton;
-
- DECL_LINK( BasicBoxHighlightHdl, BasicTreeListBox * );
- DECL_LINK( ButtonHdl, Button * );
- void CheckButtons();
- bool GetSelection( ScriptDocument& rDocument, String& rLibName );
- void DeleteCurrent();
- void NewModule();
- void NewDialog();
- void EndTabDialog( sal_uInt16 nRet );
-
- TabDialog* pTabDlg;
-
- virtual void ActivatePage();
- virtual void DeactivatePage();
-
-public:
- ObjectPage( Window* pParent, const ResId& rResId, sal_uInt16 nMode );
-
- void SetCurrentEntry( BasicEntryDescriptor& rDesc );
- void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
-};
-
-
-class SvxPasswordDialog;
-
-class LibPage: public TabPage
-{
-protected:
- FixedText aBasicsText;
- ListBox aBasicsBox;
- FixedText aLibText;
- BasicCheckBox aLibBox;
- PushButton aEditButton;
- CancelButton aCloseButton;
- PushButton aPasswordButton;
- PushButton aNewLibButton;
- PushButton aInsertLibButton;
- PushButton aExportButton;
- PushButton aDelButton;
-
- ScriptDocument m_aCurDocument;
- LibraryLocation m_eCurLocation;
-
- DECL_LINK( TreeListHighlightHdl, SvTreeListBox * );
- DECL_LINK( BasicSelectHdl, ListBox * );
- DECL_LINK( ButtonHdl, Button * );
- DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * );
- void CheckButtons();
- void DeleteCurrent();
- void NewLib();
- void InsertLib();
- void implExportLib( const String& aLibName, const String& aTargetURL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
- void Export();
- void ExportAsPackage( const String& aLibName );
- void ExportAsBasic( const String& aLibName );
- void EndTabDialog( sal_uInt16 nRet );
- void FillListBox();
- void InsertListBoxEntry( const ScriptDocument& rDocument, LibraryLocation eLocation );
- void SetCurLib();
- SvLBoxEntry* ImpInsertLibEntry( const String& rLibName, sal_uLong nPos );
- virtual void ActivatePage();
- virtual void DeactivatePage();
-
- TabDialog* pTabDlg;
-
-public:
- LibPage( Window* pParent );
- virtual ~LibPage();
-
- void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
-};
-
-// Helper functions
-SbModule* createModImpl( Window* pWin, const ScriptDocument& rDocument,
- BasicTreeListBox& rBasicBox, const String& rLibName, String aModName, bool bMain = false );
-void createLibImpl( Window* pWin, const ScriptDocument& rDocument,
- BasicCheckBox* pLibBox, BasicTreeListBox* pBasicBox );
-
-#endif // _MODULDLG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/moduldlg.src b/basctl/source/basicide/moduldlg.src
deleted file mode 100644
index a00f13646..000000000
--- a/basctl/source/basicide/moduldlg.src
+++ /dev/null
@@ -1,427 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "helpid.hrc"
-#include <moduldlg.hrc>
-#include <basidesh.hrc>
-TabDialog RID_TD_ORGANIZE
-{
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Text[ en-US ] = "%PRODUCTNAME Basic Macro Organizer";
- Moveable = TRUE ;
- Closeable = TRUE ;
- // Da Cancel-Button auf TabPage, nicht auf Dialog!
- TabControl RID_TC_ORGANIZE
- {
- // HelpID = HID_BASICIDE_ORG_TC;
- OutputSize = TRUE ;
- PageList =
- {
- PageItem
- {
- Identifier = RID_TP_MOD ;
- Text [ en-US ] = "Modules" ;
- };
- PageItem
- {
- Identifier = RID_TP_DLG ;
- Text [ en-US ] = "Dialogs" ;
- };
- PageItem
- {
- Identifier = RID_TP_LIB ;
- Text [ en-US ] = "Libraries" ;
- };
- };
- };
-};
-TabPage RID_TP_MODULS
-{
- HelpId = "basctl:TabPage:RID_TP_MODULS" ;
- Hide = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 210 , 140 ) ;
- FixedText RID_STR_LIB
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 130 , 10 ) ;
- Text [ en-US ] = "M~odule" ;
- };
- Control RID_TRLBOX
- {
- HelpId = HID_BASICIDE_MODULES_TREE ;
- Pos = MAP_APPFONT ( 6 , 17 ) ;
- Size = MAP_APPFONT ( 130 , 117 ) ;
- TabStop = TRUE ;
- Border = TRUE ;
- };
- PushButton RID_PB_EDIT
- {
- HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_EDIT";
- Text [ en-US ] = "~Edit";
- Pos = MAP_APPFONT ( 144 , 6 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CLOSE
- {
- Text [ en-US ] = "Close";
- Pos = MAP_APPFONT ( 144 , 23 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEWMOD
- {
- HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_NEWMOD";
- Pos = MAP_APPFONT ( 144 , 103 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~New..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEWDLG
- {
- HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_NEWDLG";
- Pos = MAP_APPFONT ( 144 , 103 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~New..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_DELETE
- {
- HelpID = "basctl:PushButton:RID_TP_MODULS:RID_PB_DELETE";
- Pos = MAP_APPFONT ( 144 , 120 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Delete" ;
- TabStop = TRUE ;
- };
-};
-TabPage RID_TP_DLGS
-{
- HelpID = "basctl:TabPage:RID_TP_DLGS";
- Hide = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 210 , 140 ) ;
- FixedText RID_STR_LIB
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 130 , 10 ) ;
- Text [ en-US ] = "Dialog" ;
- };
- Control RID_TRLBOX
- {
- HelpId = HID_BASICIDE_MODULES_TREE ;
- Pos = MAP_APPFONT ( 6 , 17 ) ;
- Size = MAP_APPFONT ( 130 , 117 ) ;
- TabStop = TRUE ;
- Border = TRUE ;
- };
- PushButton RID_PB_EDIT
- {
- HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_EDIT";
- Text [ en-US ] = "~Edit";
- Pos = MAP_APPFONT ( 144 , 6 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CLOSE
- {
- Text[ en-US ] = "Close";
- Pos = MAP_APPFONT ( 144 , 23 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEWMOD
- {
- HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_NEWMOD";
- Pos = MAP_APPFONT ( 144 , 103 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~New..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_NEWDLG
- {
- HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_NEWDLG";
- Pos = MAP_APPFONT ( 144 , 103 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~New..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_DELETE
- {
- HelpID = "basctl:PushButton:RID_TP_DLGS:RID_PB_DELETE";
- Pos = MAP_APPFONT ( 144 , 120 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Delete" ;
- TabStop = TRUE ;
- };
-};
-TabPage RID_TP_LIBS
-{
- HelpId = "basctl:TabPage:RID_TP_LIBS" ;
- Hide = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 210 , 140 ) ;
- FixedText RID_STR_BASICS
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 130 , 10 ) ;
- Text [ en-US ] = "L~ocation";
- };
- ListBox RID_LB_BASICS
- {
- HelpID = "basctl:ListBox:RID_TP_LIBS:RID_LB_BASICS";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 17 ) ;
- Size = MAP_APPFONT ( 130 , 80 ) ;
- TabStop = TRUE ;
- DropDown = TRUE ;
- };
- FixedText RID_STR_LIB
- {
- Pos = MAP_APPFONT ( 6 , 36 ) ;
- Size = MAP_APPFONT ( 130 , 10 ) ;
- Text [ en-US ] = "~Library" ;
- };
- Control RID_TRLBOX
- {
- HelpID = HID_BASICIDE_LIBS_TREE ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 47 ) ;
- Size = MAP_APPFONT ( 130 , 87 ) ;
- TabStop = TRUE ;
- };
-
- PushButton RID_PB_EDIT
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_EDIT";
- Text [ en-US ] = "~Edit";
- Pos = MAP_APPFONT ( 144 , 6 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CLOSE
- {
- Text [ en-US ] = "Close";
- Pos = MAP_APPFONT ( 144 , 23 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_PASSWORD
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_PASSWORD";
- Pos = MAP_APPFONT ( 144 , 43 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Password..." ;
- TabStop = TRUE ;
- };
-
- PushButton RID_PB_NEWLIB
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_NEWLIB";
- Pos = MAP_APPFONT ( 144 , 69 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~New..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_APPEND
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_APPEND";
- Pos = MAP_APPFONT ( 144 , 86 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Import..." ;
- };
- PushButton RID_PB_EXPORT
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_EXPORT";
- Pos = MAP_APPFONT ( 144 , 103 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "E~xport..." ;
- TabStop = TRUE ;
- };
- PushButton RID_PB_DELETE
- {
- HelpID = "basctl:PushButton:RID_TP_LIBS:RID_PB_DELETE";
- Pos = MAP_APPFONT ( 144 , 120 ) ;
- Size = MAP_APPFONT ( 60 , 14 ) ;
- Text [ en-US ] = "~Delete" ;
- TabStop = TRUE ;
- };
-};
-ModalDialog RID_DLG_LIBS
-{
- HelpId = "basctl:ModalDialog:RID_DLG_LIBS" ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 168 , 132 ) ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- OKButton RID_PB_OK
- {
- Pos = MAP_APPFONT ( 112 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CANCEL
- {
- Pos = MAP_APPFONT ( 112 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- FixedText RID_FT_STORAGENAME
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- };
- Control RID_CTRL_LIBS
- {
- HelpID = HID_BASICIDE_LIBSDLG_TREE ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 19 ) ;
- Size = MAP_APPFONT ( 100 , 67 ) ;
- TabStop = TRUE ;
- };
- FixedLine RID_FL_OPTIONS
- {
- Pos = MAP_APPFONT ( 6 , 89 ) ;
- Size = MAP_APPFONT ( 156 , 8 ) ;
- Text [ en-US ] = "Options" ;
- };
- CheckBox RID_CB_REF
- {
- HelpID = "basctl:CheckBox:RID_DLG_LIBS:RID_CB_REF";
- Pos = MAP_APPFONT ( 12 , 100 ) ;
- Size = MAP_APPFONT ( 146 , 10 ) ;
- TabStop = TRUE ;
- Text [ en-US ] = "Insert as reference (read-only)" ;
- };
- CheckBox RID_CB_REPL
- {
- HelpID = "basctl:CheckBox:RID_DLG_LIBS:RID_CB_REPL";
- Pos = MAP_APPFONT ( 12 , 113 ) ;
- Size = MAP_APPFONT ( 146 , 10 ) ;
- Text [ en-US ] = "Replace existing libraries" ;
- };
-};
-ModalDialog RID_DLG_NEWLIB
-{
- HelpID = "basctl:ModalDialog:RID_DLG_NEWLIB";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 160 , 55 ) ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- OKButton RID_PB_OK
- {
- Pos = MAP_APPFONT ( 104 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CANCEL
- {
- Pos = MAP_APPFONT ( 104 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- FixedText RID_FT_NEWLIB
- {
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 100 , 10 ) ;
- Text [ en-US ] = "~Name:" ;
- };
- Edit RID_ED_LIBNAME
- {
- HelpID = "basctl:Edit:RID_DLG_NEWLIB:RID_ED_LIBNAME";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 6 , 19 ) ;
- Size = MAP_APPFONT ( 92 , 12 ) ;
- TabStop = TRUE ;
- };
-};
-
-ModalDialog RID_DLG_EXPORT
-{
- HelpID = "basctl:ModalDialog:RID_DLG_EXPORT";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 115 , 55 ) ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- Text [ en-US ] = "Export Basic library";
- OKButton RID_PB_OK
- {
- Pos = MAP_APPFONT ( 6 , 35 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CANCEL
- {
- Pos = MAP_APPFONT ( 59 , 35 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
-
- RadioButton RB_EXPORTASPACKAGE
- {
- HelpID = "basctl:RadioButton:RID_DLG_EXPORT:RB_EXPORTASPACKAGE";
- Pos = MAP_APPFONT( 6, 6 );
- Size = MAP_APPFONT( 103, 10 );
- Group = TRUE;
- Text [ en-US ] = "Export as ~extension";
- TabStop = TRUE ;
- };
- RadioButton RB_EXPORTASBASIC
- {
- HelpID = "basctl:RadioButton:RID_DLG_EXPORT:RB_EXPORTASBASIC";
- Pos = MAP_APPFONT( 6, 19 );
- Size = MAP_APPFONT( 103, 10 );
- //Group = TRUE;
- Text [ en-US ] = "Export as BASIC library";
- };
-};
-
-String RID_STR_EXPORTPACKAGE
-{
- Text [ en-US ] = "Export library as extension";
-};
-
-String RID_STR_EXPORTBASIC
-{
- Text [ en-US ] = "Export as BASIC library";
-};
-
-String RID_STR_PACKAGE_BUNDLE
-{
- Text [ en-US ] = "Extension";
-};
-
diff --git a/basctl/source/basicide/moptions.hrc b/basctl/source/basicide/moptions.hrc
deleted file mode 100644
index b57cbdedd..000000000
--- a/basctl/source/basicide/moptions.hrc
+++ /dev/null
@@ -1,47 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _MOPTIONS_HRC
-#define _MOPTIONS_HRC
-
-#include <svl/solar.hrc>
-
-#define RID_MACROOPTIONS ( RID_BASICIDE_START + 55 )
-
-#define RID_FT_SBXNAME 2
-#define RID_PB_OK 3
-#define RID_PB_CANCEL 4
-#define RID_PB_HELP 5
-#define RID_FT_DESCR 6
-#define RID_ME_DESCR 7
-#define RID_FL_HELP 8
-#define RID_FT_HELPID 9
-#define RID_NF_HELPID 10
-#define RID_FT_HELPNAME 11
-#define RID_ED_HELPNAME 12
-
-#endif // _MOPTIONS_HRC
-
diff --git a/basctl/source/basicide/moptions.src b/basctl/source/basicide/moptions.src
deleted file mode 100644
index e300d4f73..000000000
--- a/basctl/source/basicide/moptions.src
+++ /dev/null
@@ -1,150 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "helpid.hrc"
-#include <moptions.hrc>
-ModalDialog RID_MACROOPTIONS
-{
- HelpId = "basctl:ModalDialog:RID_MACROOPTIONS" ;
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 224 , 121 ) ;
- Text [ en-US ] = "Description" ;
- Moveable = TRUE ;
- Closeable = TRUE ;
- FixedText RID_FT_SBXNAME
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 6 , 6 ) ;
- Size = MAP_APPFONT ( 150 , 10 ) ;
- };
- OKButton RID_PB_OK
- {
- Pos = MAP_APPFONT ( 168 , 6 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- DefButton = TRUE ;
- };
- CancelButton RID_PB_CANCEL
- {
- Pos = MAP_APPFONT ( 168 , 23 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- HelpButton RID_PB_HELP
- {
- Pos = MAP_APPFONT ( 168 , 53 ) ;
- Size = MAP_APPFONT ( 50 , 14 ) ;
- TabStop = TRUE ;
- };
- FixedText RID_FT_DESCR
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 6 , 19 ) ;
- Size = MAP_APPFONT ( 69 , 10 ) ;
- Text [ en-US ] = "Description" ;
- };
- MultiLineEdit RID_ME_DESCR
- {
- HelpID = "basctl:MultiLineEdit:RID_MACROOPTIONS:RID_ME_DESCR";
- Border = TRUE ;
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 6 , 32 ) ;
- Size = MAP_APPFONT ( 154 , 36 ) ;
- TabStop = TRUE ;
- VScroll = TRUE ;
- IgnoreTab = TRUE ;
- };
- FixedLine RID_FL_HELP
- {
- Pos = MAP_APPFONT ( 6 , 73 ) ;
- Size = MAP_APPFONT ( 212 , 8 ) ;
- Text [ en-US ] = "Help information" ;
- };
- FixedText RID_FT_HELPID
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 9 , 83 ) ;
- Size = MAP_APPFONT ( 80 , 10 ) ;
- Text [ en-US ] = "Help ID" ;
- };
- NumericField RID_NF_HELPID
- {
- HelpID = "basctl:NumericField:RID_MACROOPTIONS:RID_NF_HELPID";
- Border = TRUE ;
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 95 , 83 ) ;
- Size = MAP_APPFONT ( 120 , 12 ) ;
- TabStop = TRUE ;
- Minimum = 0 ;
- Maximum = 0xFFFFFFFF ;
- };
- FixedText RID_FT_HELPNAME
- {
- SVLook = TRUE ;
- Pos = MAP_APPFONT ( 9 , 99 ) ;
- Size = MAP_APPFONT ( 80 , 10 ) ;
- Text [ en-US ] = "Help file name" ;
- };
- Edit RID_ED_HELPNAME
- {
- HelpID = "basctl:Edit:RID_MACROOPTIONS:RID_ED_HELPNAME";
- Border = TRUE ;
- Pos = MAP_APPFONT ( 95 , 99 ) ;
- Size = MAP_APPFONT ( 120 , 12 ) ;
- TabStop = TRUE ;
- };
-};
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/basctl/source/basicide/objdlg.cxx b/basctl/source/basicide/objdlg.cxx
deleted file mode 100644
index 39aa894fc..000000000
--- a/basctl/source/basicide/objdlg.cxx
+++ /dev/null
@@ -1,298 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include <ide_pch.hxx>
-
-
-#include <basic/sbx.hxx>
-#include <vcl/cmdevt.hxx>
-#include <vcl/taskpanelist.hxx>
-#include <vcl/sound.hxx>
-#include <objdlg.hrc>
-#include <objdlg.hxx>
-#include <bastypes.hxx>
-#include <basidesh.hrc>
-#include <basidesh.hxx>
-#include <iderdll.hxx>
-#include <iderdll2.hxx>
-#include <sbxitem.hxx>
-
-
-ObjectTreeListBox::ObjectTreeListBox( Window* pParent, const ResId& rRes )
- : BasicTreeListBox( pParent, rRes )
-{
-}
-
-ObjectTreeListBox::~ObjectTreeListBox()
-{
-}
-
-void ObjectTreeListBox::Command( const CommandEvent& )
-{
-}
-
-void ObjectTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
-{
- BasicTreeListBox::MouseButtonDown( rMEvt );
-
- if ( rMEvt.IsLeft() && ( rMEvt.GetClicks() == 2 ) )
- {
- BasicEntryDescriptor aDesc( GetEntryDescriptor( GetCurEntry() ) );
-
- if ( aDesc.GetType() == OBJ_TYPE_METHOD )
- {
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(),
- aDesc.GetMethodName(), ConvertType( aDesc.GetType() ) );
- pDispatcher->Execute( SID_BASICIDE_SHOWSBX,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
- }
-}
-
-
-
-ObjectCatalog::ObjectCatalog( Window * pParent )
- :FloatingWindow( pParent, IDEResId( RID_BASICIDE_OBJCAT ) )
- ,aMacroTreeList( this, IDEResId( RID_TLB_MACROS ) )
- ,aToolBox(this, IDEResId(RID_TB_TOOLBOX))
- ,aMacroDescr( this, IDEResId( RID_FT_MACRODESCR ) )
-{
- FreeResource();
-
- aToolBox.SetOutStyle( TOOLBOX_STYLE_FLAT );
- aToolBox.SetSizePixel( aToolBox.CalcWindowSizePixel() );
- aToolBox.SetSelectHdl( LINK( this, ObjectCatalog, ToolBoxHdl ) );
-
- aMacroTreeList.SetStyle( WB_BORDER | WB_TABSTOP |
- WB_HASLINES | WB_HASLINESATROOT |
- WB_HASBUTTONS | WB_HASBUTTONSATROOT |
- WB_HSCROLL );
-
- aMacroTreeList.SetSelectHdl( LINK( this, ObjectCatalog, TreeListHighlightHdl ) );
- aMacroTreeList.SetAccessibleName(String(IDEResId(RID_STR_TLB_MACROS)));
- aMacroTreeList.ScanAllEntries();
- aMacroTreeList.GrabFocus();
-
- CheckButtons();
-
- Point aPos = IDE_DLL()->GetExtraData()->GetObjectCatalogPos();
- Size aSize = IDE_DLL()->GetExtraData()->GetObjectCatalogSize();
- if ( aPos.X() == INVPOSITION )
- {
- // Zentriert nach AppWin:
- Window* pWin = GetParent();
- aPos = pWin->OutputToScreenPixel( Point( 0, 0 ) );
- Size aAppWinSz = pWin->GetSizePixel();
- Size aDlgWinSz = GetSizePixel();
- aPos.X() += aAppWinSz.Width() / 2;
- aPos.X() -= aDlgWinSz.Width() / 2;
- aPos.Y() += aAppWinSz.Height() / 2;
- aPos.Y() -= aDlgWinSz.Height() / 2;
- }
- SetPosPixel( aPos );
- if ( aSize.Width() )
- SetOutputSizePixel( aSize );
-
- Resize(); // damit der Resize-Handler die Controls anordnet
-
- // make object catalog keyboard accessible
- pParent->GetSystemWindow()->GetTaskPaneList()->AddWindow( this );
-}
-
-ObjectCatalog::~ObjectCatalog()
-{
- GetParent()->GetSystemWindow()->GetTaskPaneList()->RemoveWindow( this );
-}
-
-void ObjectCatalog::Move()
-{
- IDE_DLL()->GetExtraData()->SetObjectCatalogPos( GetPosPixel() );
-}
-
-sal_Bool ObjectCatalog::Close()
-{
- aCancelHdl.Call( this );
- return sal_True;
-}
-
-void ObjectCatalog::Resize()
-{
- Size aOutSz = GetOutputSizePixel();
- IDE_DLL()->GetExtraData()->SetObjectCatalogSize( aOutSz );
-
- Point aTreePos = aMacroTreeList.GetPosPixel();
- Size aDescrSz = aMacroDescr.GetSizePixel();
-
- Size aTreeSz;
- long nCtrlWidth = aOutSz.Width() - 2*aTreePos.X();
- aTreeSz.Width() = nCtrlWidth;
- aTreeSz.Height() = aOutSz.Height() - aTreePos.Y() -
- 2*aTreePos.X() - aDescrSz.Height();
-
- if ( aTreeSz.Height() > 0 )
- {
- aMacroTreeList.SetSizePixel( aTreeSz );
-
- Point aDescrPos( aTreePos.X(), aTreePos.Y()+aTreeSz.Height()+aTreePos.X() );
-
- aMacroDescr.SetPosSizePixel( aDescrPos, Size( nCtrlWidth, aDescrSz.Height() ) );
-
- String aDesc = aMacroDescr.GetText();
- aMacroDescr.SetText(String());
- aMacroDescr.SetText(aDesc);
- }
-
- // Die Buttons oben bleiben immer unveraendert stehen...
-}
-
-IMPL_LINK( ObjectCatalog, ToolBoxHdl, ToolBox*, pToolBox )
-{
- sal_uInt16 nCurItem = pToolBox->GetCurItemId();
- switch ( nCurItem )
- {
- case TBITEM_SHOW:
- {
- SfxAllItemSet aArgs( SFX_APP()->GetPool() );
- SfxRequest aRequest( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON, aArgs );
- SFX_APP()->ExecuteSlot( aRequest );
-
- SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry();
- DBG_ASSERT( pCurEntry, "Entry?!" );
- BasicEntryDescriptor aDesc( aMacroTreeList.GetEntryDescriptor( pCurEntry ) );
- BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
- SfxViewFrame* pViewFrame = pIDEShell ? pIDEShell->GetViewFrame() : NULL;
- SfxDispatcher* pDispatcher = pViewFrame ? pViewFrame->GetDispatcher() : NULL;
- if ( aDesc.GetType() == OBJ_TYPE_MODULE ||
- aDesc.GetType() == OBJ_TYPE_DIALOG ||
- aDesc.GetType() == OBJ_TYPE_METHOD )
- {
- if( pDispatcher )
- {
- SbxItem aSbxItem( SID_BASICIDE_ARG_SBX, aDesc.GetDocument(), aDesc.GetLibName(), aDesc.GetName(),
- aDesc.GetMethodName(), aMacroTreeList.ConvertType( aDesc.GetType() ) );
- pDispatcher->Execute( SID_BASICIDE_SHOWSBX,
- SFX_CALLMODE_SYNCHRON, &aSbxItem, 0L );
- }
- }
- else
- {
- ErrorBox( this, WB_OK, String( IDEResId( RID_STR_OBJNOTFOUND ) ) ).Execute();
- aMacroTreeList.GetModel()->Remove( pCurEntry );
- CheckButtons();
- }
- }
- break;
- }
-
- return 0;
-}
-
-
-
-void ObjectCatalog::CheckButtons()
-{
- SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry();
- BasicEntryType eType = pCurEntry ? ((BasicEntry*)pCurEntry->GetUserData())->GetType() : OBJ_TYPE_UNKNOWN;
- if ( eType == OBJ_TYPE_DIALOG || eType == OBJ_TYPE_MODULE || eType == OBJ_TYPE_METHOD )
- aToolBox.EnableItem( TBITEM_SHOW, sal_True );
- else
- aToolBox.EnableItem( TBITEM_SHOW, sal_False );
-}
-
-
-
-IMPL_LINK_INLINE_START( ObjectCatalog, TreeListHighlightHdl, SvTreeListBox *, pBox )
-{
- if ( pBox->IsSelected( pBox->GetHdlEntry() ) )
- UpdateFields();
- return 0;
-}
-IMPL_LINK_INLINE_END( ObjectCatalog, TreeListHighlightHdl, SvTreeListBox *, pBox )
-
-
-void ObjectCatalog::UpdateFields()
-{
- SvLBoxEntry* pCurEntry = aMacroTreeList.GetCurEntry();
- if ( pCurEntry )
- {
- CheckButtons();
- aMacroDescr.SetText( String() );
- SbxVariable* pVar = aMacroTreeList.FindVariable( pCurEntry );
- if ( pVar )
- {
- SbxInfoRef xInfo = pVar->GetInfo();
- if ( xInfo.Is() )
- aMacroDescr.SetText( xInfo->GetComment() );
- }
- }
-}
-
-
-void ObjectCatalog::UpdateEntries()
-{
- aMacroTreeList.UpdateEntries();
-}
-
-void ObjectCatalog::SetCurrentEntry( BasicEntryDescriptor& rDesc )
-{
- aMacroTreeList.SetCurrentEntry( rDesc );
-}
-
-ObjectCatalogToolBox_Impl::ObjectCatalogToolBox_Impl(
- Window * pParent, ResId const & rResId)
- : ToolBox(pParent, rResId)
- , m_aImagesNormal(GetImageList())
-{
- setImages();
-}
-
-// virtual
-void ObjectCatalogToolBox_Impl::DataChanged(DataChangedEvent const & rDCEvt)
-{
- ToolBox::DataChanged(rDCEvt);
- if ((rDCEvt.GetType() == DATACHANGED_SETTINGS
- || rDCEvt.GetType() == DATACHANGED_DISPLAY)
- && (rDCEvt.GetFlags() & SETTINGS_STYLE) != 0)
- setImages();
-}
-
-void ObjectCatalogToolBox_Impl::setImages()
-{
- SetImageList(m_aImagesNormal);
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/objdlg.hrc b/basctl/source/basicide/objdlg.hrc
deleted file mode 100644
index 4ecc73f8e..000000000
--- a/basctl/source/basicide/objdlg.hrc
+++ /dev/null
@@ -1,41 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _OBJDLG_HRC
-#define _OBJDLG_HRC
-
-#include <svl/solar.hrc>
-
-#define RID_BASICIDE_OBJCAT ( RID_BASICIDE_START + 70 )
-#define RID_FT_MACRODESCR 8
-#define RID_TLB_MACROS 10
-#define RID_TB_TOOLBOX 11
-
-#define TBITEM_SHOW 1
-
-#define RID_STR_TLB_MACROS ( RID_BASICIDE_START + 71 )
-
-#endif // _OBJDLG_HXX
diff --git a/basctl/source/basicide/objdlg.hxx b/basctl/source/basicide/objdlg.hxx
deleted file mode 100644
index 343d89083..000000000
--- a/basctl/source/basicide/objdlg.hxx
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _OBJDLG_HXX
-#define _OBJDLG_HXX
-
-#include <svheader.hxx>
-#include <vcl/floatwin.hxx>
-#include <vcl/toolbox.hxx>
-#include <vcl/fixed.hxx>
-#include "vcl/image.hxx"
-
-#include <bastype2.hxx>
-
-class StarBASIC;
-
-class ObjectTreeListBox : public BasicTreeListBox
-{
-private:
-
- virtual void Command( const CommandEvent& rCEvt );
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
-
-public:
- ObjectTreeListBox( Window* pParent, const ResId& rRes );
- ~ObjectTreeListBox();
-};
-
-class ObjectCatalogToolBox_Impl: public ToolBox
-{
-public:
- ObjectCatalogToolBox_Impl(Window * pParent, ResId const & rResId);
-
-private:
- virtual void DataChanged(DataChangedEvent const & rDCEvt);
-
- void setImages();
-
- ImageList m_aImagesNormal;
-};
-
-class ObjectCatalog : public FloatingWindow
-{
-private:
- ObjectTreeListBox aMacroTreeList;
- ObjectCatalogToolBox_Impl aToolBox;
- FixedText aMacroDescr;
- Link aCancelHdl;
-
-protected:
- DECL_LINK( ToolBoxHdl, ToolBox* );
- void CheckButtons();
- DECL_LINK( TreeListHighlightHdl, SvTreeListBox * );
- void UpdateFields();
- virtual void Move();
- virtual sal_Bool Close();
- virtual void Resize();
-
-public:
- ObjectCatalog( Window * pParent );
- virtual ~ObjectCatalog();
-
- void UpdateEntries();
- void SetCurrentEntry( BasicEntryDescriptor& rDesc );
-
- void SetCancelHdl( const Link& rLink ) { aCancelHdl = rLink; }
-};
-
-#endif //_OBJDLG_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/objdlg.src b/basctl/source/basicide/objdlg.src
deleted file mode 100644
index 45cc031cc..000000000
--- a/basctl/source/basicide/objdlg.src
+++ /dev/null
@@ -1,91 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include <objdlg.hrc>
-#include <helpid.hrc>
-
-#define MASKCOLOR MaskColor = Color { Red = 0xFFFF; Green = 0x0000; Blue = 0xFFFF; };
-
-FloatingWindow RID_BASICIDE_OBJCAT
-{
- HelpID = "basctl:FloatingWindow:RID_BASICIDE_OBJCAT";
- OutputSize = TRUE ;
- SVLook = TRUE ;
- Size = MAP_APPFONT ( 191 , 179 ) ;
- Text [ en-US ] = "Objects" ;
- Closeable = TRUE ;
- Moveable = TRUE ;
- Sizeable = TRUE ;
- Zoomable = TRUE ;
- Hide = TRUE ;
- ClipChildren = TRUE ;
- Control RID_TLB_MACROS
- {
- HelpId = HID_BASICIDE_OBJECTCAT ;
- Border = TRUE ;
- Pos = MAP_APPFONT ( 3 , 24 ) ;
- Size = MAP_APPFONT ( 185 , 126 ) ;
- TabStop = TRUE ;
- };
- ToolBox RID_TB_TOOLBOX
- {
- HelpId = HID_BASICIDE_OBJECTS ;
- SVLook = TRUE ;
- Align = BOXALIGN_TOP ;
- Pos = MAP_APPFONT ( 4 , 6 ) ;
- ItemImageList = ImageList
- {
- Prefix = "im";
- MASKCOLOR
- IdList =
- {
- TBITEM_SHOW ;
- };
- };
- ItemList =
- {
- ToolBoxItem
- {
- Identifier = TBITEM_SHOW ;
- HelpId = HID_BASICIDE_OBJCAT_SHOW ;
- Text [ en-US ] = "Show" ;
- };
- };
- };
- FixedText RID_FT_MACRODESCR
- {
- WordBreak = TRUE ;
- Pos = MAP_APPFONT ( 3 , 156 ) ;
- Size = MAP_APPFONT ( 185 , 18 ) ;
- };
-};
-
-String RID_STR_TLB_MACROS
-{
- Text [ en-US ] = "Objects Tree";
-};
-
diff --git a/basctl/source/basicide/register.cxx b/basctl/source/basicide/register.cxx
deleted file mode 100644
index 82f417dee..000000000
--- a/basctl/source/basicide/register.cxx
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/uno/Sequence.h>
-#include <rtl/ustring.hxx>
-
-#include <cppuhelper/factory.hxx>
-
-#include "unomodel.hxx"
-
-using ::rtl::OUString;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void* SAL_CALL component_getFactory( const sal_Char* pImplementationName,
- void* pServiceManager,
- void* pRegistryKey )
-{
- (void)pRegistryKey;
-
- // Set default return value for this operation - if it failed.
- void* pReturn = NULL ;
-
- if (
- ( pImplementationName != NULL ) &&
- ( pServiceManager != NULL )
- )
- {
- // Define variables which are used in following macros.
- Reference< XSingleServiceFactory > xFactory ;
- Reference< XMultiServiceFactory > xServiceManager( reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
-
- if( SIDEModel::getImplementationName_Static().equalsAscii( pImplementationName ) )
- {
- xFactory = ::cppu::createSingleFactory( xServiceManager,
- SIDEModel::getImplementationName_Static(),
- SIDEModel_createInstance,
- SIDEModel::getSupportedServiceNames_Static() );
- }
-
- // Factory is valid - service was found.
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pReturn = xFactory.get();
- }
- }
-
- // Return with result of this operation.
- return pReturn ;
-}
-} // extern "C"
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/scriptdocument.cxx b/basctl/source/basicide/scriptdocument.cxx
deleted file mode 100644
index fd06e7b71..000000000
--- a/basctl/source/basicide/scriptdocument.cxx
+++ /dev/null
@@ -1,1604 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "scriptdocument.hxx"
-#include "basobj.hxx"
-#include "basidesh.hrc"
-#include "iderid.hxx"
-#include "dlgeddef.hxx"
-#include "localizationmgr.hxx"
-#include "doceventnotifier.hxx"
-#include "documentenumeration.hxx"
-
-/** === begin UNO includes === **/
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/script/XLibraryContainer2.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/uri/XUriReferenceFactory.hpp>
-#include <com/sun/star/util/XMacroExpander.hpp>
-#include <com/sun/star/document/MacroExecMode.hpp>
-#include <com/sun/star/document/XEventBroadcaster.hpp>
-#include <com/sun/star/frame/XStorable.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/frame/XDispatchProvider.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/frame/XModel2.hpp>
-#include <com/sun/star/awt/XWindow2.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp>
-#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
-/** === end UNO includes === **/
-
-#include <sfx2/objsh.hxx>
-#include <sfx2/app.hxx>
-#include <sfx2/viewfrm.hxx>
-#include <sfx2/bindings.hxx>
-#include <sfx2/docfile.hxx>
-
-#include <vcl/svapp.hxx>
-
-#include <basic/basicmanagerrepository.hxx>
-
-#include <xmlscript/xmldlg_imexp.hxx>
-
-#include <unotools/syslocale.hxx>
-
-#include <unotools/collatorwrapper.hxx>
-
-#include <tools/diagnose_ex.h>
-#include <tools/urlobj.hxx>
-
-#include <comphelper/processfactory.hxx>
-#include <comphelper/documentinfo.hxx>
-#include <comphelper/componentcontext.hxx>
-
-#include <osl/mutex.hxx>
-
-#include <cppuhelper/implbase1.hxx>
-
-#include <rtl/uri.hxx>
-#include <rtl/bootstrap.hxx>
-
-#include <osl/process.h>
-#include <osl/file.hxx>
-
-#include <algorithm>
-#include <functional>
-#include <set>
-
-
-namespace basctl
-{
- using ::com::sun::star::uno::Sequence;
- using ::com::sun::star::uno::Reference;
- using ::com::sun::star::frame::XModel;
- using ::com::sun::star::beans::XPropertySet;
- using ::com::sun::star::script::XLibraryContainer;
- using ::com::sun::star::uno::UNO_QUERY_THROW;
- using ::com::sun::star::uno::UNO_SET_THROW;
- using ::com::sun::star::beans::XPropertySetInfo;
- using ::com::sun::star::uno::Exception;
- using ::com::sun::star::container::XNameContainer;
- using ::com::sun::star::container::NoSuchElementException;
- using ::com::sun::star::uno::UNO_QUERY;
- using ::com::sun::star::task::XStatusIndicator;
- using ::com::sun::star::uno::makeAny;
- using ::com::sun::star::script::XLibraryContainer2;
- using ::com::sun::star::lang::XMultiServiceFactory;
- using ::com::sun::star::uri::XUriReferenceFactory;
- using ::com::sun::star::uri::XUriReference;
- using ::com::sun::star::uno::XComponentContext;
- using ::com::sun::star::util::XMacroExpander;
- using ::com::sun::star::io::XInputStreamProvider;
- using ::com::sun::star::uno::Any;
- using ::com::sun::star::io::XInputStream;
- using ::com::sun::star::frame::XStorable;
- using ::com::sun::star::util::XModifiable;
- using ::com::sun::star::frame::XController;
- using ::com::sun::star::frame::XFrame;
- using ::com::sun::star::util::URL;
- using ::com::sun::star::frame::XDispatchProvider;
- using ::com::sun::star::frame::XDispatch;
- using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::frame::XDesktop;
- using ::com::sun::star::container::XEnumerationAccess;
- using ::com::sun::star::container::XEnumeration;
- using ::com::sun::star::frame::XModel2;
- using ::com::sun::star::awt::XWindow2;
- using ::com::sun::star::document::XEventListener;
- using ::com::sun::star::lang::EventObject;
- using ::com::sun::star::uno::RuntimeException;
- using ::com::sun::star::document::XEventBroadcaster;
- using ::com::sun::star::document::XEmbeddedScripts;
- using ::com::sun::star::script::ModuleInfo;
- using ::com::sun::star::script::vba::XVBACompatibility;
- using ::com::sun::star::script::vba::XVBAModuleInfo;
- /** === end UNO using === **/
- namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
- namespace FrameSearchFlag = ::com::sun::star::frame::FrameSearchFlag;
-
- //====================================================================
- //= helper
- //====================================================================
- namespace
- {
- static bool StringCompareLessThan( const String& lhs, const String& rhs )
- {
- return ( lhs.CompareIgnoreCaseToAscii( rhs ) == COMPARE_LESS );
- }
-
- class FilterDocuments : public docs::IDocumentDescriptorFilter
- {
- public:
- FilterDocuments( bool _bFilterInvisible ) : m_bFilterInvisible( _bFilterInvisible ) { }
-
- virtual bool includeDocument( const docs::DocumentDescriptor& _rDocument ) const;
-
- private:
- bool impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const;
-
- private:
- bool m_bFilterInvisible;
- };
-
- bool FilterDocuments::impl_isDocumentVisible_nothrow( const docs::DocumentDescriptor& _rDocument ) const
- {
- try
- {
- for ( docs::Controllers::const_iterator controller = _rDocument.aControllers.begin();
- controller != _rDocument.aControllers.end();
- ++controller
- )
- {
- Reference< XFrame > xFrame( (*controller)->getFrame(), UNO_SET_THROW );
- Reference< XWindow2 > xContainer( xFrame->getContainerWindow(), UNO_QUERY_THROW );
- if ( xContainer->isVisible() )
- return true;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
- bool FilterDocuments::includeDocument( const docs::DocumentDescriptor& _rDocument ) const
- {
- Reference< XEmbeddedScripts > xScripts( _rDocument.xModel, UNO_QUERY );
- if ( !xScripts.is() )
- return false;
- if ( !m_bFilterInvisible || impl_isDocumentVisible_nothrow( _rDocument ) )
- return true;
- return false;
- }
-
- void lcl_getAllModels_throw( docs::Documents& _out_rModels, bool _bVisibleOnly )
- {
- _out_rModels.clear();
-
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- FilterDocuments aFilter( _bVisibleOnly );
- docs::DocumentEnumeration aEnum( aContext, &aFilter );
-
- aEnum.getDocuments( _out_rModels );
- }
- }
-
- class ScriptDocument_Impl : public DocumentEventListener
- {
- private:
- bool m_bIsApplication;
- bool m_bValid;
- bool m_bDocumentClosed;
- Reference< XModel > m_xDocument;
- Reference< XModifiable > m_xDocModify;
- Reference< XEmbeddedScripts > m_xScriptAccess;
- ::std::auto_ptr< DocumentEventNotifier >
- m_pDocListener;
-
- public:
- ScriptDocument_Impl( );
- ScriptDocument_Impl( const Reference< XModel >& _rxDocument );
- ~ScriptDocument_Impl();
-
- /** determines whether the instance refers to a valid "document" with script and
- dialog libraries
- */
- inline bool isValid() const { return m_bValid; }
- /** determines whether the instance refers to a non-closed document
- */
- inline bool isAlive() const { return m_bValid ? ( m_bIsApplication ? true : !m_bDocumentClosed ) : false; }
- /// determines whether the "document" refers to the application in real
- inline bool isApplication() const { return m_bValid && m_bIsApplication; }
- /// determines whether the document refers to a real document (instead of the application)
- inline bool isDocument() const { return m_bValid && !m_bIsApplication; }
-
- /** invalidates the instance
- */
- void invalidate();
-
- const Reference< XModel >&
- getDocumentRef() const { return m_xDocument; }
-
- /// returns a library container belonging to the document
- Reference< XLibraryContainer >
- getLibraryContainer( LibraryContainerType _eType ) const;
-
- /// determines whether a given library is part of the shared installation
- bool isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType );
-
- /** returns the current frame of the document
-
- To be called for documents only, not for the application.
-
- If <FALSE/> is returned, an assertion will be raised in non-product builds.
- */
- bool getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const;
-
- // versions with the same signature/semantics as in ScriptDocument itself
- bool isReadOnly() const;
- bool isInVBAMode() const;
- BasicManager*
- getBasicManager() const;
- Reference< XModel >
- getDocument() const;
- void setDocumentModified() const;
- bool isDocumentModified() const;
- bool saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const;
-
- ::rtl::OUString
- getTitle() const;
- ::rtl::OUString
- getURL() const;
-
- bool allowMacros() const;
-
- Reference< XNameContainer >
- getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const
- SAL_THROW((NoSuchElementException));
- bool hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const;
- Reference< XNameContainer >
- getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const;
-
- void loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary );
-
- bool removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName );
- bool hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const;
- bool getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog );
- bool renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel );
- bool createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const;
- bool insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rObjectName, const ::rtl::OUString& _rModName, const Any& _rElement ) const;
- bool updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const;
- bool createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const;
-
- protected:
- // DocumentEventListener
- virtual void onDocumentCreated( const ScriptDocument& _rDocument );
- virtual void onDocumentOpened( const ScriptDocument& _rDocument );
- virtual void onDocumentSave( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveDone( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAs( const ScriptDocument& _rDocument );
- virtual void onDocumentSaveAsDone( const ScriptDocument& _rDocument );
- virtual void onDocumentClosed( const ScriptDocument& _rDocument );
- virtual void onDocumentTitleChanged( const ScriptDocument& _rDocument );
- virtual void onDocumentModeChanged( const ScriptDocument& _rDocument );
-
- private:
- bool impl_initDocument_nothrow( const Reference< XModel >& _rxModel );
- };
-
- //====================================================================
- //= ScriptDocument_Impl - implementation
- //====================================================================
- ScriptDocument_Impl::ScriptDocument_Impl()
- :m_bIsApplication( true )
- ,m_bValid( true )
- ,m_bDocumentClosed( false )
- {
- }
-
- ScriptDocument_Impl::ScriptDocument_Impl( const Reference< XModel >& _rxDocument )
- :m_bIsApplication( false )
- ,m_bValid( false )
- ,m_bDocumentClosed( false )
- {
- if ( _rxDocument.is() )
- {
- if ( impl_initDocument_nothrow( _rxDocument ) )
- {
- }
- }
- }
-
- ScriptDocument_Impl::~ScriptDocument_Impl()
- {
- invalidate();
- }
-
- void ScriptDocument_Impl::invalidate()
- {
- m_bIsApplication = false;
- m_bValid = false;
- m_bDocumentClosed = false;
-
- m_xDocument.clear();
- m_xDocModify.clear();
- m_xScriptAccess.clear();
-
- if ( m_pDocListener.get() )
- m_pDocListener->dispose();
- }
-
- bool ScriptDocument_Impl::impl_initDocument_nothrow( const Reference< XModel >& _rxModel )
- {
- try
- {
- m_xDocument.set ( _rxModel, UNO_SET_THROW );
- m_xDocModify.set ( _rxModel, UNO_QUERY_THROW );
- m_xScriptAccess.set ( _rxModel, UNO_QUERY );
-
- m_bValid = m_xScriptAccess.is();
-
- if ( m_bValid )
- m_pDocListener.reset( new DocumentEventNotifier( *this, _rxModel ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- m_bValid = false;
- }
-
- if ( !m_bValid )
- {
- invalidate();
- }
-
- return m_bValid;
- }
-
- Reference< XLibraryContainer > ScriptDocument_Impl::getLibraryContainer( LibraryContainerType _eType ) const
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibraryContainer: invalid!" );
-
- Reference< XLibraryContainer > xContainer;
- if ( !isValid() )
- return xContainer;
-
- try
- {
- if ( isApplication() )
- xContainer.set( _eType == E_SCRIPTS ? SFX_APP()->GetBasicContainer() : SFX_APP()->GetDialogContainer(), UNO_QUERY_THROW );
- else
- {
- xContainer.set(
- _eType == E_SCRIPTS ? m_xScriptAccess->getBasicLibraries() : m_xScriptAccess->getDialogLibraries(),
- UNO_QUERY_THROW );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xContainer;
- }
-
- bool ScriptDocument_Impl::isReadOnly() const
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::isReadOnly: invalid state!" );
- OSL_ENSURE( !isApplication(), "ScriptDocument_Impl::isReadOnly: not allowed to be called for the application!" );
-
- bool bIsReadOnly = true;
- if ( isValid() && !isApplication() )
- {
- try
- {
- // note that XStorable is required by the OfficeDocument service
- Reference< XStorable > xDocStorable( m_xDocument, UNO_QUERY_THROW );
- bIsReadOnly = xDocStorable->isReadonly();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return bIsReadOnly;
- }
-
- bool ScriptDocument_Impl::isInVBAMode() const
- {
- bool bResult = false;
- if ( !isApplication() )
- {
- Reference< XVBACompatibility > xVBACompat( getLibraryContainer( E_SCRIPTS ), UNO_QUERY );
- if ( xVBACompat.is() )
- bResult = xVBACompat->getVBACompatibilityMode();
- }
- return bResult;
- }
-
-
- BasicManager* ScriptDocument_Impl::getBasicManager() const
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::getBasicManager: invalid state!" );
- if ( !isValid() )
- return NULL;
-
- if ( isApplication() )
- return SFX_APP()->GetBasicManager();
-
- return ::basic::BasicManagerRepository::getDocumentBasicManager( m_xDocument );
- }
-
-
- Reference< XModel > ScriptDocument_Impl::getDocument() const
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::getDocument: invalid state!" );
- OSL_ENSURE( isDocument(), "ScriptDocument_Impl::getDocument: for documents only!" );
- if ( !isValid() || !isDocument() )
- return NULL;
-
- return m_xDocument;
- }
-
-
- Reference< XNameContainer > ScriptDocument_Impl::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const
- SAL_THROW((NoSuchElementException))
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::getLibrary: invalid state!" );
-
- Reference< XNameContainer > xContainer;
- try
- {
- Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType );
- if ( isValid() )
- {
- if ( xLibContainer.is() )
- xContainer.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
- }
-
- if ( !xContainer.is() )
- throw NoSuchElementException();
-
- // load library
- if ( _bLoadLibrary && !xLibContainer->isLibraryLoaded( _rLibName ) )
- xLibContainer->loadLibrary( _rLibName );
- }
- catch( const NoSuchElementException& )
- {
- throw; // allowed to leave
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return xContainer;
- }
-
-
- bool ScriptDocument_Impl::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- bool bHas = false;
- try
- {
- Reference< XLibraryContainer > xLibContainer = getLibraryContainer( _eType );
- bHas = xLibContainer.is() && xLibContainer->hasByName( _rLibName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return bHas;
- }
-
-
- Reference< XNameContainer > ScriptDocument_Impl::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- Reference< XNameContainer > xLibrary;
- try
- {
- Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW );
- if ( xLibContainer->hasByName( _rLibName ) )
- xLibrary.set( xLibContainer->getByName( _rLibName ), UNO_QUERY_THROW );
- else
- xLibrary.set( xLibContainer->createLibrary( _rLibName ), UNO_QUERY_THROW );
-
- if ( !xLibContainer->isLibraryLoaded( _rLibName ) )
- xLibContainer->loadLibrary( _rLibName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return xLibrary;
- }
-
-
- void ScriptDocument_Impl::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary )
- {
- try
- {
- Reference< XLibraryContainer > xLibContainer( getLibraryContainer( _eType ) );
- if ( xLibContainer.is() && xLibContainer->hasByName( _rLibrary ) && !xLibContainer->isLibraryLoaded( _rLibrary ) )
- xLibContainer->loadLibrary( _rLibrary );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
-
-
- bool ScriptDocument_Impl::removeModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName )
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::removeModuleOrDialog: invalid!" );
- if ( isValid() )
- {
- try
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ) );
- if ( xLib.is() )
- {
- xLib->removeByName( _rModuleName );
- return true;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::hasModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName ) const
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::hasModuleOrDialog: invalid!" );
- if ( !isValid() )
- return false;
-
- try
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ) );
- if ( xLib.is() )
- return xLib->hasByName( _rModName );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::getModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, Any& _out_rModuleOrDialog )
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::getModuleOrDialog: invalid!" );
- if ( !isValid() )
- return false;
-
- _out_rModuleOrDialog.clear();
- try
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ), UNO_QUERY_THROW );
- if ( xLib->hasByName( _rObjectName ) )
- {
- _out_rModuleOrDialog = xLib->getByName( _rObjectName );
- return true;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::renameModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName,
- const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel )
- {
- OSL_ENSURE( isValid(), "ScriptDocument_Impl::renameModuleOrDialog: invalid!" );
- if ( !isValid() )
- return false;
-
- try
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, sal_True ), UNO_QUERY_THROW );
-
- // get element
- Any aElement( xLib->getByName( _rOldName ) );
-
- // remove element from container
- xLib->removeByName( _rOldName );
-
- // if it's a dialog, import and export, to reflect the new name
- if ( _eType == E_DIALOGS )
- {
- // create dialog model
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XNameContainer > xDialogModel;
- if ( _rxExistingDialogModel.is() )
- xDialogModel = _rxExistingDialogModel;
- else
- if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) )
- return false;
-
- // import dialog model
- Reference< XInputStreamProvider > xISP( aElement, UNO_QUERY_THROW );
- if ( !_rxExistingDialogModel.is() )
- {
- Reference< XInputStream > xInput( xISP->createInputStream(), UNO_QUERY_THROW );
- ::xmlscript::importDialogModel( xInput, xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- }
-
- // set new name as property
- Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW );
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rNewName ) );
-
- // export dialog model
- xISP = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
- aElement <<= xISP;
- }
-
- // insert element by new name in container
- if ( _eType == E_SCRIPTS )
- {
- Reference< XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
- if ( xVBAModuleInfo->hasModuleInfo( _rOldName ) )
- {
- ModuleInfo sModuleInfo = xVBAModuleInfo->getModuleInfo( _rOldName );
- xVBAModuleInfo->removeModuleInfo( _rOldName );
- xVBAModuleInfo->insertModuleInfo( _rNewName, sModuleInfo );
- }
- }
- xLib->insertByName( _rNewName, aElement );
- return true;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const
- {
- _out_rNewModuleCode = ::rtl::OUString();
- try
- {
- Reference< XNameContainer > xLib( getLibrary( E_SCRIPTS, _rLibName, sal_True ) );
- if ( !xLib.is() || xLib->hasByName( _rModName ) )
- return false;
-
- // create new module
- _out_rNewModuleCode = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "REM ***** BASIC *****\n\n" ) );
- if ( _bCreateMain )
- _out_rNewModuleCode += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Sub Main\n\nEnd Sub\n" ) );
-
- // insert module into library
- xLib->insertByName( _rModName, makeAny( _out_rNewModuleCode ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- return false;
- }
-
- return true;
- }
-
-
- bool ScriptDocument_Impl::insertModuleOrDialog( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rObjectName, const Any& _rElement ) const
- {
- try
- {
- Reference< XNameContainer > xLib( getOrCreateLibrary( _eType, _rLibName ), UNO_QUERY_THROW );
- if ( xLib->hasByName( _rObjectName ) )
- return false;
-
- xLib->insertByName( _rObjectName, _rElement );
- return true;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const
- {
- try
- {
- Reference< XNameContainer > xLib( getOrCreateLibrary( E_SCRIPTS, _rLibName ), UNO_QUERY_THROW );
- if ( !xLib->hasByName( _rModName ) )
- return false;
- xLib->replaceByName( _rModName, makeAny( _rModuleCode ) );
- return true;
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return false;
- }
-
-
- bool ScriptDocument_Impl::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
- {
- try
- {
- Reference< XNameContainer > xLib( getLibrary( E_DIALOGS, _rLibName, sal_True ), UNO_QUERY_THROW );
-
- // create dialog
- _out_rDialogProvider.clear();
- if ( xLib->hasByName( _rDialogName ) )
- return false;
-
- // create new dialog model
- ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
- Reference< XNameContainer > xDialogModel;
- if ( !aContext.createComponent( "com.sun.star.awt.UnoControlDialogModel", xDialogModel ) )
- return false;
-
- // set name property
- Reference< XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY_THROW );
- xDlgPSet->setPropertyValue( DLGED_PROP_NAME, makeAny( _rDialogName ) );
-
- // export dialog model
- _out_rDialogProvider = ::xmlscript::exportDialogModel( xDialogModel, aContext.getUNOContext(), isDocument() ? getDocument() : Reference< XModel >() );
-
- // insert dialog into library
- xLib->insertByName( _rDialogName, makeAny( _out_rDialogProvider ) );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return _out_rDialogProvider.is();
- }
-
-
- void ScriptDocument_Impl::setDocumentModified() const
- {
- OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::setDocumentModified: only to be called for real documents!" );
- if ( isValid() && isDocument() )
- {
- try
- {
- m_xDocModify->setModified( sal_True );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- }
-
-
- bool ScriptDocument_Impl::isDocumentModified() const
- {
- OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::isDocumentModified: only to be called for real documents!" );
- bool bIsModified = false;
- if ( isValid() && isDocument() )
- {
- try
- {
- bIsModified = m_xDocModify->isModified();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return bIsModified;
- }
-
-
- bool ScriptDocument_Impl::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const
- {
- Reference< XFrame > xFrame;
- if ( !getCurrentFrame( xFrame ) )
- return false;
-
- Sequence< PropertyValue > aArgs;
- if ( _rxStatusIndicator.is() )
- {
- aArgs.realloc(1);
- aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "StatusIndicator" ) );
- aArgs[0].Value <<= _rxStatusIndicator;
- }
-
- try
- {
- URL aURL;
- aURL.Complete = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:Save" ) );
- aURL.Main = aURL.Complete;
- aURL.Protocol = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ".uno:" ) );
- aURL.Path = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Save" ) );
-
- Reference< XDispatchProvider > xDispProv( xFrame, UNO_QUERY_THROW );
- Reference< XDispatch > xDispatch(
- xDispProv->queryDispatch( aURL, ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "_self" ) ), FrameSearchFlag::AUTO ),
- UNO_SET_THROW );
-
- xDispatch->dispatch( aURL, aArgs );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- return false;
- }
-
- return true;
- }
-
-
- ::rtl::OUString ScriptDocument_Impl::getTitle() const
- {
- OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getTitle: for documents only!" );
-
- ::rtl::OUString sTitle;
- if ( isValid() && isDocument() )
- {
- sTitle = ::comphelper::DocumentInfo::getDocumentTitle( m_xDocument );
- }
- return sTitle;
- }
-
-
- ::rtl::OUString ScriptDocument_Impl::getURL() const
- {
- OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getURL: for documents only!" );
-
- ::rtl::OUString sURL;
- if ( isValid() && isDocument() )
- {
- try
- {
- sURL = m_xDocument->getURL();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return sURL;
- }
-
-
- bool ScriptDocument_Impl::allowMacros() const
- {
- OSL_ENSURE( isValid() && isDocument(), "ScriptDocument_Impl::allowMacros: for documents only!" );
- bool bAllow = false;
- if ( isValid() && isDocument() )
- {
- try
- {
- bAllow = m_xScriptAccess->getAllowMacroExecution();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- }
- return bAllow;
- }
-
-
- bool ScriptDocument_Impl::getCurrentFrame( Reference< XFrame >& _out_rxFrame ) const
- {
- _out_rxFrame.clear();
- OSL_PRECOND( isValid() && isDocument(), "ScriptDocument_Impl::getCurrentFrame: documents only!" );
- if ( !isValid() || !isDocument() )
- return false;
-
- try
- {
- Reference< XModel > xDocument( m_xDocument, UNO_SET_THROW );
- Reference< XController > xController( xDocument->getCurrentController(), UNO_SET_THROW );
- _out_rxFrame.set( xController->getFrame(), UNO_SET_THROW );
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return _out_rxFrame.is();
- }
-
-
- bool ScriptDocument_Impl::isLibraryShared( const ::rtl::OUString& _rLibName, LibraryContainerType _eType )
- {
- bool bIsShared = false;
- try
- {
- Reference< XLibraryContainer2 > xLibContainer( getLibraryContainer( _eType ), UNO_QUERY_THROW );
-
- if ( !xLibContainer->hasByName( _rLibName ) || !xLibContainer->isLibraryLink( _rLibName ) )
- return false;
- ::rtl::OUString aFileURL;
- Reference< XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory() );
- Reference< XUriReferenceFactory > xUriFac;
- if ( xMSF.is() )
- {
- xUriFac.set(
- xMSF->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.uri.UriReferenceFactory" ) ) ),
- UNO_QUERY_THROW );
- }
-
- ::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( _rLibName ) );
- Reference< XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY_THROW );
-
- ::rtl::OUString aScheme = xUriRef->getScheme();
- if ( aScheme.equalsIgnoreAsciiCaseAscii( "file" ) )
- {
- aFileURL = aLinkURL;
- }
- else if ( aScheme.equalsIgnoreAsciiCaseAscii( "vnd.sun.star.pkg" ) )
- {
- ::rtl::OUString aAuthority = xUriRef->getAuthority();
- if ( aAuthority.matchIgnoreAsciiCaseAsciiL( RTL_CONSTASCII_STRINGPARAM( "vnd.sun.star.expand:" ) ) )
- {
- ::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
- aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- Reference< XComponentContext > xContext;
- Reference< XPropertySet > xProps( xMSF, UNO_QUERY_THROW );
- xContext.set( xProps->getPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
- Reference< XMacroExpander > xMacroExpander(
- xContext->getValueByName(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/singletons/com.sun.star.util.theMacroExpander" )) ),
- UNO_QUERY_THROW );
- aFileURL = xMacroExpander->expandMacros( aDecodedURL );
- }
- }
-
- if ( aFileURL.getLength() )
- {
- ::osl::DirectoryItem aFileItem;
- ::osl::FileStatus aFileStatus( osl_FileStatus_Mask_FileURL );
- OSL_VERIFY( ::osl::DirectoryItem::get( aFileURL, aFileItem ) == ::osl::FileBase::E_None );
- OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None );
- ::rtl::OUString aCanonicalFileURL( aFileStatus.getFileURL() );
-
- ::rtl::OUString aSearchURL1( RTL_CONSTASCII_USTRINGPARAM( "share/basic" ) );
- ::rtl::OUString aSearchURL2( RTL_CONSTASCII_USTRINGPARAM( "share/uno_packages" ) );
- ::rtl::OUString aSearchURL3( RTL_CONSTASCII_USTRINGPARAM( "share/extensions" ) );
- if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 ||
- aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 ||
- aCanonicalFileURL.indexOf( aSearchURL3 ) != -1 )
- bIsShared = true;
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- return bIsShared;
- }
-
-
- void ScriptDocument_Impl::onDocumentCreated( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentOpened( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentSave( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentSaveDone( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentSaveAs( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentSaveAsDone( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentClosed( const ScriptDocument& _rDocument )
- {
- DBG_TESTSOLARMUTEX();
- OSL_PRECOND( isValid(), "ScriptDocument_Impl::onDocumentClosed: should not be listening if I'm not valid!" );
-
- bool bMyDocument = m_xDocument == _rDocument.getDocument();
- OSL_PRECOND( bMyDocument, "ScriptDocument_Impl::onDocumentClosed: didn't want to know *this*!" );
- if ( bMyDocument )
- {
- m_bDocumentClosed = true;
- }
- }
-
-
- void ScriptDocument_Impl::onDocumentTitleChanged( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- void ScriptDocument_Impl::onDocumentModeChanged( const ScriptDocument& /*_rDocument*/ )
- {
- // not interested in
- }
-
- //====================================================================
- //= ScriptDocument
- //====================================================================
- ScriptDocument::ScriptDocument()
- :m_pImpl( new ScriptDocument_Impl() )
- {
- }
-
-
- ScriptDocument::ScriptDocument( ScriptDocument::SpecialDocument _eType )
- :m_pImpl( new ScriptDocument_Impl( Reference< XModel >() ) )
- {
- OSL_ENSURE( _eType == NoDocument, "ScriptDocument::ScriptDocument: unknown SpecialDocument type!" );
- (void)_eType;
- }
-
-
- ScriptDocument::ScriptDocument( const Reference< XModel >& _rxDocument )
- :m_pImpl( new ScriptDocument_Impl( _rxDocument ) )
- {
- OSL_ENSURE( _rxDocument.is(), "ScriptDocument::ScriptDocument: document must not be NULL!" );
- // a NULL document results in an uninitialized instance, and for this
- // purpose, there is a dedicated constructor
- }
-
-
- ScriptDocument::ScriptDocument( const ScriptDocument& _rSource )
- :m_pImpl( _rSource.m_pImpl )
- {
- }
-
-
- ScriptDocument::~ScriptDocument()
- {
- }
-
-
- const ScriptDocument& ScriptDocument::getApplicationScriptDocument()
- {
- static ScriptDocument s_aApplicationScripts;
- return s_aApplicationScripts;
- }
-
-
- ScriptDocument ScriptDocument::getDocumentForBasicManager( const BasicManager* _pManager )
- {
- if ( _pManager == SFX_APP()->GetBasicManager() )
- return getApplicationScriptDocument();
-
- docs::Documents aDocuments;
- lcl_getAllModels_throw( aDocuments, false );
-
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- const BasicManager* pDocBasicManager = ::basic::BasicManagerRepository::getDocumentBasicManager( doc->xModel );
- if ( ( pDocBasicManager != SFX_APP()->GetBasicManager() )
- && ( pDocBasicManager == _pManager )
- )
- {
- return ScriptDocument( doc->xModel );
- }
- }
-
- OSL_FAIL( "ScriptDocument::getDocumentForBasicManager: did not find a document for this manager!" );
- return ScriptDocument( NoDocument );
- }
-
-
- ScriptDocument ScriptDocument::getDocumentWithURLOrCaption( const ::rtl::OUString& _rUrlOrCaption )
- {
- ScriptDocument aDocument( getApplicationScriptDocument() );
- if ( _rUrlOrCaption.getLength() == 0 )
- return aDocument;
-
- docs::Documents aDocuments;
- lcl_getAllModels_throw( aDocuments, false );
-
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- const ScriptDocument aCheck = ScriptDocument( doc->xModel );
- if ( _rUrlOrCaption == aCheck.getTitle()
- || _rUrlOrCaption == aCheck.getURL()
- )
- {
- aDocument = aCheck;
- break;
- }
- }
-
- return aDocument;
- }
-
-
- namespace
- {
- struct DocumentTitleLess : public ::std::binary_function< ScriptDocument, ScriptDocument, bool >
- {
- DocumentTitleLess( const CollatorWrapper& _rCollator )
- :m_aCollator( _rCollator )
- {
- }
-
- bool operator()( const ScriptDocument& _lhs, const ScriptDocument& _rhs ) const
- {
- return m_aCollator.compareString( _lhs.getTitle(), _rhs.getTitle() ) < 0;
- }
- private:
- const CollatorWrapper m_aCollator;
- };
- }
-
-
- ScriptDocuments ScriptDocument::getAllScriptDocuments( ScriptDocument::ScriptDocumentList _eListType )
- {
- ScriptDocuments aScriptDocs;
-
- // include application?
- if ( _eListType == AllWithApplication )
- aScriptDocs.push_back( getApplicationScriptDocument() );
-
- // obtain documents
- try
- {
- docs::Documents aDocuments;
- lcl_getAllModels_throw( aDocuments, true /* exclude invisible */ );
-
- for ( docs::Documents::const_iterator doc = aDocuments.begin();
- doc != aDocuments.end();
- ++doc
- )
- {
- // exclude documents without script/library containers
- ScriptDocument aDoc( doc->xModel );
- if ( !aDoc.isValid() )
- continue;
-
- aScriptDocs.push_back( aDoc );
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- // sort document list by doc title?
- if ( _eListType == DocumentsSorted )
- {
- CollatorWrapper aCollator( ::comphelper::getProcessServiceFactory() );
- aCollator.loadDefaultCollator( SvtSysLocale().GetLocaleData().getLocale(), 0 );
- ::std::sort( aScriptDocs.begin(), aScriptDocs.end(), DocumentTitleLess( aCollator ) );
- }
-
- return aScriptDocs;
- }
-
-
- bool ScriptDocument::operator==( const ScriptDocument& _rhs ) const
- {
- return m_pImpl->getDocumentRef() == _rhs.m_pImpl->getDocumentRef();
- }
-
-
- sal_Int32 ScriptDocument::hashCode() const
- {
- return sal::static_int_cast<sal_Int32>(reinterpret_cast< sal_IntPtr >( m_pImpl->getDocumentRef().get() ));
- }
-
-
- bool ScriptDocument::isValid() const
- {
- return m_pImpl->isValid();
- }
-
-
- bool ScriptDocument::isAlive() const
- {
- return m_pImpl->isAlive();
- }
-
-
- Reference< XLibraryContainer > ScriptDocument::getLibraryContainer( LibraryContainerType _eType ) const
- {
- return m_pImpl->getLibraryContainer( _eType );
- }
-
-
- Reference< XNameContainer > ScriptDocument::getLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName, bool _bLoadLibrary ) const
- SAL_THROW((NoSuchElementException))
- {
- return m_pImpl->getLibrary( _eType, _rLibName, _bLoadLibrary );
- }
-
-
- bool ScriptDocument::hasLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- return m_pImpl->hasLibrary( _eType, _rLibName );
- }
-
-
- Reference< XNameContainer > ScriptDocument::getOrCreateLibrary( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- return m_pImpl->getOrCreateLibrary( _eType, _rLibName );
- }
-
-
- void ScriptDocument::loadLibraryIfExists( LibraryContainerType _eType, const ::rtl::OUString& _rLibrary )
- {
- m_pImpl->loadLibraryIfExists( _eType, _rLibrary );
- }
-
-
- Sequence< ::rtl::OUString > ScriptDocument::getObjectNames( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- Sequence< ::rtl::OUString > aModuleNames;
-
- try
- {
- if ( hasLibrary( _eType, _rLibName ) )
- {
- Reference< XNameContainer > xLib( getLibrary( _eType, _rLibName, false ) );
- if ( xLib.is() )
- aModuleNames = xLib->getElementNames();
- }
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
-
- // sort
- ::std::sort( aModuleNames.getArray() , aModuleNames.getArray() + aModuleNames.getLength() , StringCompareLessThan );
-
- return aModuleNames;
- }
-
-
- ::rtl::OUString ScriptDocument::createObjectName( LibraryContainerType _eType, const ::rtl::OUString& _rLibName ) const
- {
- ::rtl::OUString aObjectName;
-
- ::rtl::OUString aBaseName = _eType == E_SCRIPTS
- ? ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Module" ) )
- : ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Dialog" ) );
-
- Sequence< ::rtl::OUString > aUsedNames( getObjectNames( _eType, _rLibName ) );
- ::std::set< ::rtl::OUString > aUsedNamesCheck;
- ::std::copy( aUsedNames.getConstArray(), aUsedNames.getConstArray() + aUsedNames.getLength(),
- ::std::insert_iterator< ::std::set< ::rtl::OUString > >( aUsedNamesCheck, aUsedNamesCheck.begin() ) );
-
- bool bValid = false;
- sal_uInt16 i = 1;
- while ( !bValid )
- {
- aObjectName = aBaseName;
- aObjectName += String::CreateFromInt32( i );
-
- if ( aUsedNamesCheck.find( aObjectName ) == aUsedNamesCheck.end() )
- bValid = sal_True;
-
- ++i;
- }
-
- return aObjectName;
- }
-
-
- Sequence< ::rtl::OUString > ScriptDocument::getLibraryNames() const
- {
- return BasicIDE::GetMergedLibraryNames( getLibraryContainer( E_SCRIPTS ), getLibraryContainer( E_DIALOGS ) );
- }
-
-
- bool ScriptDocument::isReadOnly() const
- {
- return m_pImpl->isReadOnly();
- }
-
-
- bool ScriptDocument::isApplication() const
- {
- return m_pImpl->isApplication();
- }
-
- bool ScriptDocument::isInVBAMode() const
- {
- return m_pImpl->isInVBAMode();
- }
-
-
- BasicManager* ScriptDocument::getBasicManager() const
- {
- return m_pImpl->getBasicManager();
- }
-
-
- Reference< XModel > ScriptDocument::getDocument() const
- {
- return m_pImpl->getDocument();
- }
-
-
- Reference< XModel > ScriptDocument::getDocumentOrNull() const
- {
- if ( isDocument() )
- return m_pImpl->getDocument();
- return NULL;
- }
-
-
- bool ScriptDocument::removeModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) const
- {
- return m_pImpl->removeModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName );
- }
-
-
- bool ScriptDocument::hasModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModuleName ) const
- {
- return m_pImpl->hasModuleOrDialog( E_SCRIPTS, _rLibName, _rModuleName );
- }
-
-
- bool ScriptDocument::getModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, ::rtl::OUString& _out_rModuleSource ) const
- {
- Any aCode;
- if ( !m_pImpl->getModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, aCode ) )
- return false;
- OSL_VERIFY( aCode >>= _out_rModuleSource );
- return true;
- }
-
-
- bool ScriptDocument::renameModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName ) const
- {
- return m_pImpl->renameModuleOrDialog( E_SCRIPTS, _rLibName, _rOldName, _rNewName, NULL );
- }
-
-
- bool ScriptDocument::createModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, bool _bCreateMain, ::rtl::OUString& _out_rNewModuleCode ) const
- {
- if ( !m_pImpl->createModule( _rLibName, _rModName, _bCreateMain, _out_rNewModuleCode ) )
- return false;
-
- // doc shell modified
- BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here?
- return true;
- }
-
-
- bool ScriptDocument::insertModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const
- {
- return m_pImpl->insertModuleOrDialog( E_SCRIPTS, _rLibName, _rModName, makeAny( _rModuleCode ) );
- }
-
-
- bool ScriptDocument::updateModule( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rModName, const ::rtl::OUString& _rModuleCode ) const
- {
- return m_pImpl->updateModule( _rLibName, _rModName, _rModuleCode );
- }
-
-
- bool ScriptDocument::removeDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const
- {
- return m_pImpl->removeModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName );
- }
-
-
- bool ScriptDocument::hasDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName ) const
- {
- return m_pImpl->hasModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName );
- }
-
-
- bool ScriptDocument::getDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
- {
- Any aCode;
- if ( !m_pImpl->getModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, aCode ) )
- return false;
- OSL_VERIFY( aCode >>= _out_rDialogProvider );
- return _out_rDialogProvider.is();
- }
-
-
- bool ScriptDocument::renameDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rOldName, const ::rtl::OUString& _rNewName, const Reference< XNameContainer >& _rxExistingDialogModel ) const
- {
- return m_pImpl->renameModuleOrDialog( E_DIALOGS, _rLibName, _rOldName, _rNewName, _rxExistingDialogModel );
- }
-
-
- bool ScriptDocument::createDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, Reference< XInputStreamProvider >& _out_rDialogProvider ) const
- {
- if ( !m_pImpl->createDialog( _rLibName, _rDialogName, _out_rDialogProvider ) )
- return false;
-
- BasicIDE::MarkDocumentModified( *const_cast< ScriptDocument* >( this ) ); // here?
- return true;
- }
-
-
- bool ScriptDocument::insertDialog( const ::rtl::OUString& _rLibName, const ::rtl::OUString& _rDialogName, const Reference< XInputStreamProvider >& _rxDialogProvider ) const
- {
- return m_pImpl->insertModuleOrDialog( E_DIALOGS, _rLibName, _rDialogName, makeAny( _rxDialogProvider ) );
- }
-
-
- void ScriptDocument::setDocumentModified() const
- {
- m_pImpl->setDocumentModified();
- }
-
-
- bool ScriptDocument::isDocumentModified() const
- {
- return m_pImpl->isDocumentModified();
- }
-
-
- bool ScriptDocument::saveDocument( const Reference< XStatusIndicator >& _rxStatusIndicator ) const
- {
- return m_pImpl->saveDocument( _rxStatusIndicator );
- }
-
-
- LibraryLocation ScriptDocument::getLibraryLocation( const ::rtl::OUString& _rLibName ) const
- {
- LibraryLocation eLocation = LIBRARY_LOCATION_UNKNOWN;
- if ( _rLibName.getLength() )
- {
- if ( isDocument() )
- {
- eLocation = LIBRARY_LOCATION_DOCUMENT;
- }
- else
- {
- if ( ( hasLibrary( E_SCRIPTS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_SCRIPTS ) )
- || ( hasLibrary( E_DIALOGS, _rLibName ) && !m_pImpl->isLibraryShared( _rLibName, E_DIALOGS ) )
- )
- {
- eLocation = LIBRARY_LOCATION_USER;
- }
- else
- {
- eLocation = LIBRARY_LOCATION_SHARE;
- }
- }
- }
-
- return eLocation;
- }
-
-
- ::rtl::OUString ScriptDocument::getTitle( LibraryLocation _eLocation, LibraryType _eType ) const
- {
- ::rtl::OUString aTitle;
-
- switch ( _eLocation )
- {
- case LIBRARY_LOCATION_USER:
- {
- switch ( _eType )
- {
- case LIBRARY_TYPE_MODULE: aTitle = String( IDEResId( RID_STR_USERMACROS ) ); break;
- case LIBRARY_TYPE_DIALOG: aTitle = String( IDEResId( RID_STR_USERDIALOGS ) ); break;
- case LIBRARY_TYPE_ALL: aTitle = String( IDEResId( RID_STR_USERMACROSDIALOGS ) ); break;
- default:
- break;
- }
- break;
- case LIBRARY_LOCATION_SHARE:
- {
- switch ( _eType )
- {
- case LIBRARY_TYPE_MODULE: aTitle = String( IDEResId( RID_STR_SHAREMACROS ) ); break;
- case LIBRARY_TYPE_DIALOG: aTitle = String( IDEResId( RID_STR_SHAREDIALOGS ) ); break;
- case LIBRARY_TYPE_ALL: aTitle = String( IDEResId( RID_STR_SHAREMACROSDIALOGS ) ); break;
- default:
- break;
- }
- }
- break;
- case LIBRARY_LOCATION_DOCUMENT:
- aTitle = getTitle();
- break;
- default:
- break;
- }
- }
-
- return aTitle;
- }
-
-
- ::rtl::OUString ScriptDocument::getTitle() const
- {
- return m_pImpl->getTitle();
- }
-
-
- ::rtl::OUString ScriptDocument::getURL() const
- {
- return m_pImpl->getURL();
- }
-
-
- bool ScriptDocument::isActive() const
- {
- bool bIsActive( false );
- try
- {
- Reference< XFrame > xFrame;
- if ( m_pImpl->getCurrentFrame( xFrame ) )
- bIsActive = xFrame->isActive();
- }
- catch( const Exception& )
- {
- DBG_UNHANDLED_EXCEPTION();
- }
- return bIsActive;
- }
-
-
- bool ScriptDocument::allowMacros() const
- {
- return m_pImpl->allowMacros();
- }
-
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/tbxctl.cxx b/basctl/source/basicide/tbxctl.cxx
deleted file mode 100644
index a2a0c03c1..000000000
--- a/basctl/source/basicide/tbxctl.cxx
+++ /dev/null
@@ -1,164 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-
-#include <ide_pch.hxx>
-
-
-#define _BASIDE_POPUPWINDOWTBX
-#include <tbxctl.hxx>
-#include <svx/svxids.hrc>
-#include <iderid.hxx>
-#include <tbxctl.hrc>
-#include <idetemp.hxx>
-#include <sfx2/imagemgr.hxx>
-#include <svl/aeitem.hxx>
-#include <vcl/toolbox.hxx>
-
-using namespace ::com::sun::star::uno;
-
-
-static ::rtl::OUString aSubToolBarResName( RTL_CONSTASCII_USTRINGPARAM( "private:resource/toolbar/insertcontrolsbar" ) );
-
-SFX_IMPL_TOOLBOX_CONTROL( TbxControls, SfxAllEnumItem )
-
-/*************************************************************************
-|*
-|* Klasse fuer Toolbox
-|*
-\************************************************************************/
-
-TbxControls::TbxControls( sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx ) :
- SfxToolBoxControl( nSlotId, nId, rTbx )
-{
- nLastSlot = USHRT_MAX;
-
- rTbx.SetItemBits( nId, TIB_DROPDOWN | rTbx.GetItemBits( nId ) );
- rTbx.Invalidate();
-}
-
-/*************************************************************************
-|*
-|* Wenn man ein PopupWindow erzeugen will
-|*
-\************************************************************************/
-SfxPopupWindowType TbxControls::GetPopupWindowType() const
-{
- if( nLastSlot == USHRT_MAX )
- return(SFX_POPUPWINDOW_ONCLICK);
- return(SFX_POPUPWINDOW_ONTIMEOUT);
-}
-
-void TbxControls::StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState )
-{
- if( pState )
- {
- SfxAllEnumItem* pItem = PTR_CAST(SfxAllEnumItem, pState);
- if( pItem )
- {
- sal_uInt16 nLastEnum = pItem->GetValue();
- sal_uInt16 nTemp = 0;
- switch( nLastEnum )
- {
- case SVX_SNAP_PUSHBUTTON: nTemp = SID_INSERT_PUSHBUTTON; break;
- case SVX_SNAP_CHECKBOX: nTemp = SID_INSERT_CHECKBOX; break;
- case SVX_SNAP_RADIOBUTTON: nTemp = SID_INSERT_RADIOBUTTON; break;
- case SVX_SNAP_SPINBUTTON: nTemp = SID_INSERT_SPINBUTTON; break;
- case SVX_SNAP_FIXEDTEXT: nTemp = SID_INSERT_FIXEDTEXT; break;
- case SVX_SNAP_GROUPBOX: nTemp = SID_INSERT_GROUPBOX; break;
- case SVX_SNAP_LISTBOX: nTemp = SID_INSERT_LISTBOX; break;
- case SVX_SNAP_COMBOBOX: nTemp = SID_INSERT_COMBOBOX; break;
- case SVX_SNAP_EDIT: nTemp = SID_INSERT_EDIT; break;
- case SVX_SNAP_HSCROLLBAR: nTemp = SID_INSERT_HSCROLLBAR; break;
- case SVX_SNAP_VSCROLLBAR: nTemp = SID_INSERT_VSCROLLBAR; break;
- case SVX_SNAP_PREVIEW: nTemp = SID_INSERT_PREVIEW; break;
- case SVX_SNAP_URLBUTTON: nTemp = SID_INSERT_URLBUTTON; break;
- case SVX_SNAP_IMAGECONTROL: nTemp = SID_INSERT_IMAGECONTROL; break;
- case SVX_SNAP_PROGRESSBAR: nTemp = SID_INSERT_PROGRESSBAR; break;
- case SVX_SNAP_HFIXEDLINE: nTemp = SID_INSERT_HFIXEDLINE; break;
- case SVX_SNAP_VFIXEDLINE: nTemp = SID_INSERT_VFIXEDLINE; break;
- case SVX_SNAP_DATEFIELD: nTemp = SID_INSERT_DATEFIELD; break;
- case SVX_SNAP_TIMEFIELD: nTemp = SID_INSERT_TIMEFIELD; break;
- case SVX_SNAP_NUMERICFIELD: nTemp = SID_INSERT_NUMERICFIELD; break;
- case SVX_SNAP_CURRENCYFIELD: nTemp = SID_INSERT_CURRENCYFIELD; break;
- case SVX_SNAP_FORMATTEDFIELD: nTemp = SID_INSERT_FORMATTEDFIELD; break;
- case SVX_SNAP_PATTERNFIELD: nTemp = SID_INSERT_PATTERNFIELD; break;
- case SVX_SNAP_FILECONTROL: nTemp = SID_INSERT_FILECONTROL; break;
- case SVX_SNAP_TREECONTROL: nTemp = SID_INSERT_TREECONTROL; break;
- }
- if( nTemp )
- {
- rtl::OUString aSlotURL( RTL_CONSTASCII_USTRINGPARAM( "slot:" ));
- aSlotURL += rtl::OUString::valueOf( sal_Int32( nTemp ));
- Image aImage = GetImage( m_xFrame,
- aSlotURL,
- hasBigImages()
- );
- ToolBox& rBox = GetToolBox();
- rBox.SetItemImage(GetId(), aImage);
- nLastSlot = nLastEnum;
- }
- }
- }
- SfxToolBoxControl::StateChanged( nSID, eState,pState );
-}
-
-void TbxControls::Select( sal_uInt16 nModifier )
-{
- (void)nModifier;
- SfxAllEnumItem aItem( SID_CHOOSE_CONTROLS, nLastSlot );
- SfxViewFrame* pCurFrame = SfxViewFrame::Current();
- DBG_ASSERT( pCurFrame != NULL, "No current view frame!" );
- SfxDispatcher* pDispatcher = pCurFrame ? pCurFrame->GetDispatcher() : NULL;
- if( pDispatcher )
- {
- pDispatcher->Execute( SID_CHOOSE_CONTROLS, SFX_CALLMODE_SYNCHRON, &aItem, 0L );
- }
-}
-
-/*************************************************************************
-|*
-|* Hier wird das Fenster erzeugt
-|* Lage der Toolbox mit GetToolBox() abfragbar
-|* rItemRect sind die Screen-Koordinaten
-|*
-\************************************************************************/
-SfxPopupWindow* TbxControls::CreatePopupWindow()
-{
- if ( GetSlotId() == SID_CHOOSE_CONTROLS )
- createAndPositionSubToolBar( aSubToolBarResName );
-
- return(0);
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/tbxctl.hrc b/basctl/source/basicide/tbxctl.hrc
deleted file mode 100644
index ea4a1e471..000000000
--- a/basctl/source/basicide/tbxctl.hrc
+++ /dev/null
@@ -1,30 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#include <svl/solar.hrc>
-
-#define RID_TBXCONTROLS ( RID_BASICIDE_START + 65 )
-#define RID_TOOLBOX ( RID_BASICIDE_START + 66 )
diff --git a/basctl/source/basicide/tbxctl.hxx b/basctl/source/basicide/tbxctl.hxx
deleted file mode 100644
index 92115d652..000000000
--- a/basctl/source/basicide/tbxctl.hxx
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef _BASIDE_TBXCTL_HXX
-#define _BASIDE_TBXCTL_HXX
-
-#include <sfx2/tbxctrl.hxx>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-
-//-------------------
-// class TbxControls
-//-------------------
-class TbxControls : public SfxToolBoxControl
-{
-private:
-
- struct StateChangedInfo
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
- bool bDisabled;
- };
-
- sal_uInt16 nLastSlot;
-
-protected:
- virtual void StateChanged( sal_uInt16 nSID, SfxItemState eState,
- const SfxPoolItem* pState );
-public:
- SFX_DECL_TOOLBOX_CONTROL();
-
- TbxControls(sal_uInt16 nSlotId, sal_uInt16 nId, ToolBox& rTbx );
- ~TbxControls() {}
-
- virtual SfxPopupWindowType GetPopupWindowType() const;
- virtual SfxPopupWindow* CreatePopupWindow();
-
- using SfxToolBoxControl::Select;
- void Select( sal_uInt16 nModifier );
-};
-
-
-#endif // _BASIDE_TBXCTL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/unomodel.cxx b/basctl/source/basicide/unomodel.cxx
deleted file mode 100644
index 76b3057b6..000000000
--- a/basctl/source/basicide/unomodel.cxx
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_basctl.hxx"
-
-#include "unomodel.hxx"
-#include <osl/mutex.hxx>
-#include <vcl/svapp.hxx>
-
-#include <sfx2/docfac.hxx>
-#include <sfx2/objsh.hxx>
-
-#include <iderdll.hxx>
-#include <basdoc.hxx>
-
-using ::rtl::OUString;
-using namespace ::cppu;
-using namespace ::std;
-using namespace ::com::sun::star;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-
-SIDEModel::SIDEModel( SfxObjectShell *pObjSh )
-: SfxBaseModel(pObjSh)
-{
-}
-
-SIDEModel::~SIDEModel()
-{
-}
-
-uno::Any SAL_CALL SIDEModel::queryInterface( const uno::Type& rType ) throw(uno::RuntimeException)
-{
- uno::Any aRet = ::cppu::queryInterface ( rType,
- // OWeakObject interfaces
- static_cast< XInterface* >( static_cast< OWeakObject* >( this ) ),
- static_cast< XWeak* > ( this ),
- static_cast< XServiceInfo* > ( this ) );
- if (!aRet.hasValue())
- aRet = SfxBaseModel::queryInterface ( rType );
- return aRet;
-}
-
-void SAL_CALL SIDEModel::acquire() throw()
-{
- SolarMutexGuard aGuard;
- OWeakObject::acquire();
-}
-
-void SAL_CALL SIDEModel::release() throw()
-{
- SolarMutexGuard aGuard;
- OWeakObject::release();
-}
-
-uno::Sequence< uno::Type > SAL_CALL SIDEModel::getTypes( ) throw(uno::RuntimeException)
-{
- uno::Sequence< uno::Type > aTypes = SfxBaseModel::getTypes();
- sal_Int32 nLen = aTypes.getLength();
- aTypes.realloc(nLen + 1);
- uno::Type* pTypes = aTypes.getArray();
- pTypes[nLen++] = ::getCppuType((Reference<XServiceInfo>*)0);
-
- return aTypes;
-}
-
-OUString SIDEModel::getImplementationName(void) throw( uno::RuntimeException )
-{
- return getImplementationName_Static();
-}
-
-::rtl::OUString SIDEModel::getImplementationName_Static()
-{
- return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.basic.BasicIDE" ));
-}
-
-sal_Bool SIDEModel::supportsService(const OUString& rServiceName) throw( uno::RuntimeException )
-{
- return rServiceName == ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ));
-}
-uno::Sequence< OUString > SIDEModel::getSupportedServiceNames(void) throw( uno::RuntimeException )
-{
- return getSupportedServiceNames_Static();
-}
-
-uno::Sequence< OUString > SIDEModel::getSupportedServiceNames_Static(void)
-{
- uno::Sequence< OUString > aRet(1);
- OUString* pArray = aRet.getArray();
- pArray[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.script.BasicIDE" ));
- return aRet;
-}
-
-uno::Reference< uno::XInterface > SAL_CALL SIDEModel_createInstance(
- const uno::Reference< lang::XMultiServiceFactory > & ) throw( uno::Exception )
-{
- SolarMutexGuard aGuard;
- BasicIDEDLL::Init();
- SfxObjectShell* pShell = new BasicDocShell();
- return uno::Reference< uno::XInterface >( pShell->GetModel() );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basctl/source/basicide/unomodel.hxx b/basctl/source/basicide/unomodel.hxx
deleted file mode 100644
index 45333df93..000000000
--- a/basctl/source/basicide/unomodel.hxx
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-#ifndef UNOMODEL_HXX
-#define UNOMODEL_HXX
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <sfx2/sfxbasemodel.hxx>
-
-//-----------------------------------------------------------------------------
-class SIDEModel : public SfxBaseModel,
- public com::sun::star::lang::XServiceInfo
-{
-public:
- SIDEModel( SfxObjectShell *pObjSh = 0 );
- virtual ~SIDEModel();
-
- //XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL acquire( ) throw();
- virtual void SAL_CALL release( ) throw();
-
- //XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( ) throw(::com::sun::star::uno::RuntimeException);
-
- //XServiceInfo
- virtual rtl::OUString SAL_CALL getImplementationName(void)
- throw( ::com::sun::star::uno::RuntimeException );
- virtual sal_Bool SAL_CALL supportsService(const rtl::OUString& ServiceName)
- throw( ::com::sun::star::uno::RuntimeException );
- virtual ::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(void)
- throw( ::com::sun::star::uno::RuntimeException );
-
- static ::com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static();
- static ::rtl::OUString getImplementationName_Static();
-};
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL SIDEModel_createInstance(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr )
- throw( com::sun::star::uno::Exception );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */