#92173# Reimplement Basic password protection UI in Basic IDE
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: basides1.cxx,v $
|
||||
*
|
||||
* $Revision: 1.17 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-10-24 10:27:33 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -98,6 +98,13 @@
|
||||
#include <sfx2/minfitem.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINER_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
|
||||
@@ -550,33 +557,34 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
|
||||
|
||||
StarBASIC* pLib = 0;
|
||||
BasicManager* pMgr = 0;
|
||||
SfxObjectShell* pShell = 0;
|
||||
String aLibName;
|
||||
::rtl::OUString aOULibName;
|
||||
if ( aBasMgrAndLib.Len() )
|
||||
{
|
||||
String aBasMgr( GetMgrFromMgrAndLib( aBasMgrAndLib ) );
|
||||
String aLib( GetLibFromMgrAndLib( aBasMgrAndLib ) );
|
||||
aLibName = GetLibFromMgrAndLib( aBasMgrAndLib );
|
||||
aOULibName = aLibName;
|
||||
|
||||
pMgr = BasicIDE::FindBasicManager( aBasMgr );
|
||||
if ( !pMgr ) // Doc schon weg...
|
||||
return;
|
||||
pLib = pMgr->GetLib( aLib );
|
||||
pShell = BasicIDE::FindDocShell( pMgr );
|
||||
pLib = pMgr->GetLib( aLibName );
|
||||
if ( !pLib && ( nSlot == SID_BASICIDE_LIBSELECTED ) )
|
||||
{
|
||||
// LoadOnDemand
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pMgr );
|
||||
::rtl::OUString aOULibName( aLib );
|
||||
|
||||
// load module library (if not loaded)
|
||||
Reference< script::XLibraryContainer > xModLibContainer = BasicIDE::GetModuleLibraryContainer( pShell );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
xModLibContainer->loadLibrary( aOULibName );
|
||||
|
||||
// load dialog library (if not loaded)
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer = BasicIDE::GetDialogLibraryContainer( pShell );
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
xDlgLibContainer->loadLibrary( aOULibName );
|
||||
|
||||
// get Basic
|
||||
pLib = pMgr->GetLib( aLib );
|
||||
pLib = pMgr->GetLib( aLibName );
|
||||
|
||||
if ( !pLib )
|
||||
{
|
||||
@@ -591,21 +599,23 @@ void __EXPORT BasicIDEShell::ExecuteGlobal( SfxRequest& rReq )
|
||||
{
|
||||
// Keine Abfrage, ob pCurBasic == pLib,
|
||||
// falls welche ausgeblendet waren.
|
||||
BOOL bSet = TRUE;
|
||||
BOOL bOK = TRUE;
|
||||
|
||||
// TODO: check password
|
||||
/* old code
|
||||
if ( pLib )
|
||||
{
|
||||
USHORT nLib = pMgr->GetLibId( pLib );
|
||||
if ( pMgr->HasPassword( nLib ) &&
|
||||
!pMgr->IsPasswordVerified( nLib ) )
|
||||
// check password, if library is password protected and not verified
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
bSet = QueryPassword( pMgr, nLib );
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bOK = QueryPassword( pShell, aLibName );
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( bSet )
|
||||
|
||||
if ( bOK )
|
||||
SetCurBasic( pLib );
|
||||
else // alten Wert einstellen...
|
||||
BasicIDE::GetBindings().Invalidate( SID_BASICIDE_LIBSELECTOR, TRUE, FALSE );
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: basidesh.cxx,v $
|
||||
*
|
||||
* $Revision: 1.17 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-10-17 10:12:29 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -110,11 +110,13 @@
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINER_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
|
||||
#include <com/sun/star/container/XNameAccess.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::rtl;
|
||||
@@ -724,64 +726,72 @@ void BasicIDEShell::UpdateWindows()
|
||||
|
||||
for ( sal_Int32 i = 0 ; i < nLibCount ; i++ )
|
||||
{
|
||||
// check, if library is password protected and not verified
|
||||
BOOL bProtected = FALSE;
|
||||
String aLibName = pLibNames[ i ];
|
||||
|
||||
// TODO: check password
|
||||
/* old code
|
||||
if ( !pBasicMgr->HasPassword( nLib ) ||
|
||||
pBasicMgr->IsPasswordVerified( nLib ) )
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pDocShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
*/
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bProtected = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
StarBASIC* pLib = pBasicMgr->GetLib( aLibName );
|
||||
|
||||
if ( pLib && ( !pCurBasic || ( pLib == pCurBasic ) ) )
|
||||
if ( !bProtected )
|
||||
{
|
||||
ImplStartListening( pLib );
|
||||
StarBASIC* pLib = pBasicMgr->GetLib( aLibName );
|
||||
|
||||
LibInfo* pLibInf = IDE_DLL()->GetExtraData()->GetLibInfos().GetInfo( pLib );
|
||||
|
||||
// modules
|
||||
try
|
||||
if ( pLib && ( !pCurBasic || ( pLib == pCurBasic ) ) )
|
||||
{
|
||||
Sequence< ::rtl::OUString > aModNames = BasicIDE::GetModuleNames( pDocShell, aLibName );
|
||||
sal_Int32 nModCount = aModNames.getLength();
|
||||
const ::rtl::OUString* pModNames = aModNames.getConstArray();
|
||||
ImplStartListening( pLib );
|
||||
|
||||
for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
|
||||
LibInfo* pLibInf = IDE_DLL()->GetExtraData()->GetLibInfos().GetInfo( pLib );
|
||||
|
||||
// modules
|
||||
try
|
||||
{
|
||||
String aModName = pModNames[ j ];
|
||||
if ( !FindBasWin( pLib, aModName, FALSE ) )
|
||||
CreateBasWin( pLib, aModName );
|
||||
Sequence< ::rtl::OUString > aModNames = BasicIDE::GetModuleNames( pDocShell, aLibName );
|
||||
sal_Int32 nModCount = aModNames.getLength();
|
||||
const ::rtl::OUString* pModNames = aModNames.getConstArray();
|
||||
|
||||
if ( pLibInf && !pNextActiveModule && ( aModName == pLibInf->aCurrentModule ) )
|
||||
pNextActiveModule = pLib->FindModule( aModName );
|
||||
for ( sal_Int32 j = 0 ; j < nModCount ; j++ )
|
||||
{
|
||||
String aModName = pModNames[ j ];
|
||||
if ( !FindBasWin( pLib, aModName, FALSE ) )
|
||||
CreateBasWin( pLib, aModName );
|
||||
|
||||
if ( pLibInf && !pNextActiveModule && ( aModName == pLibInf->aCurrentModule ) )
|
||||
pNextActiveModule = pLib->FindModule( aModName );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch ( container::NoSuchElementException& e )
|
||||
{
|
||||
ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
|
||||
DBG_ERROR( aBStr.GetBuffer() );
|
||||
}
|
||||
|
||||
// dialogs
|
||||
try
|
||||
{
|
||||
Sequence< ::rtl::OUString > aDlgNames = BasicIDE::GetDialogNames( pDocShell, aLibName );
|
||||
sal_Int32 nDlgCount = aDlgNames.getLength();
|
||||
const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
|
||||
|
||||
for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
|
||||
catch ( container::NoSuchElementException& e )
|
||||
{
|
||||
String aDlgName = pDlgNames[ j ];
|
||||
if ( !FindDlgWin( pLib, aDlgName, FALSE ) ) // this find only looks for non-suspended windows;
|
||||
CreateDlgWin( pLib, aDlgName ); // suspended windows are handled in CreateDlgWin
|
||||
ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
|
||||
DBG_ERROR( aBStr.GetBuffer() );
|
||||
}
|
||||
|
||||
// dialogs
|
||||
try
|
||||
{
|
||||
Sequence< ::rtl::OUString > aDlgNames = BasicIDE::GetDialogNames( pDocShell, aLibName );
|
||||
sal_Int32 nDlgCount = aDlgNames.getLength();
|
||||
const ::rtl::OUString* pDlgNames = aDlgNames.getConstArray();
|
||||
|
||||
for ( sal_Int32 j = 0 ; j < nDlgCount ; j++ )
|
||||
{
|
||||
String aDlgName = pDlgNames[ j ];
|
||||
if ( !FindDlgWin( pLib, aDlgName, FALSE ) ) // this find only looks for non-suspended windows;
|
||||
CreateDlgWin( pLib, aDlgName ); // suspended windows are handled in CreateDlgWin
|
||||
}
|
||||
}
|
||||
catch ( container::NoSuchElementException& e )
|
||||
{
|
||||
ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
|
||||
DBG_ERROR( aBStr.GetBuffer() );
|
||||
}
|
||||
}
|
||||
catch ( container::NoSuchElementException& e )
|
||||
{
|
||||
ByteString aBStr( String(e.Message), RTL_TEXTENCODING_ASCII_US );
|
||||
DBG_ERROR( aBStr.GetBuffer() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: basobj3.cxx,v $
|
||||
*
|
||||
* $Revision: 1.17 $
|
||||
* $Revision: 1.18 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-09-26 15:25:17 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -99,6 +99,9 @@
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HPP_
|
||||
#include <com/sun/star/container/XNameContainer.hpp>
|
||||
#endif
|
||||
@@ -904,19 +907,29 @@ long BasicIDE::HandleBasicError( StarBASIC* pBasic )
|
||||
return 2;
|
||||
|
||||
long nRet = 0;
|
||||
BasicIDEShell* pShell = 0;
|
||||
BasicIDEShell* pIDEShell = 0;
|
||||
if ( SvtModuleOptions().IsBasicIDE() )
|
||||
{
|
||||
BasicManager* pBasicManager = BasicIDE::FindBasicManager( pBasic );
|
||||
if ( pBasicManager )
|
||||
BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
|
||||
if ( pBasMgr )
|
||||
{
|
||||
USHORT nLib = pBasicManager->GetLibId( pBasic );
|
||||
// TODO: check password
|
||||
//if ( !pBasicManager->HasPassword( nLib ) ||
|
||||
// pBasicManager->IsPasswordVerified( nLib ) )
|
||||
//{
|
||||
pShell = IDE_DLL()->GetShell();
|
||||
if ( !pShell )
|
||||
BOOL bProtected = FALSE;
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
::rtl::OUString aOULibName( pBasic->GetName() );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bProtected = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !bProtected )
|
||||
{
|
||||
pIDEShell = IDE_DLL()->GetShell();
|
||||
if ( !pIDEShell )
|
||||
{
|
||||
SfxViewFrame* pCurFrame = SfxViewFrame::Current();
|
||||
DBG_ASSERT( pCurFrame != NULL, "No current view frame!" );
|
||||
@@ -925,14 +938,14 @@ long BasicIDE::HandleBasicError( StarBASIC* pBasic )
|
||||
{
|
||||
pDispatcher->Execute( SID_BASICIDE_APPEAR, SFX_CALLMODE_SYNCHRON );
|
||||
}
|
||||
pShell = IDE_DLL()->GetShell();
|
||||
pIDEShell = IDE_DLL()->GetShell();
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( pShell )
|
||||
nRet = pShell->CallBasicErrorHdl( pBasic );
|
||||
if ( pIDEShell )
|
||||
nRet = pIDEShell->CallBasicErrorHdl( pBasic );
|
||||
else
|
||||
ErrorHandler::HandleError( StarBASIC::GetErrorCode() );
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: bastype2.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-10-24 17:00:15 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -78,6 +78,9 @@
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINER_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star;
|
||||
@@ -399,21 +402,24 @@ long BasicTreeListBox::ExpandingHdl()
|
||||
BOOL bOK = TRUE;
|
||||
if ( GetModel()->GetDepth( GetHdlEntry() ) == 1 )
|
||||
{
|
||||
String aLib, aDummy1, aDummy2;
|
||||
BasicManager* pBasicManager = GetSelectedSbx( aLib, aDummy1, aDummy2 );
|
||||
if ( aLib.Len() && !aDummy1.Len() && !aDummy2.Len() )
|
||||
String aLibName, aDummy1, aDummy2;
|
||||
BasicManager* pBasMgr = GetSelectedSbx( aLibName, aDummy1, aDummy2 );
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
|
||||
if ( aLibName.Len() && !aDummy1.Len() && !aDummy2.Len() )
|
||||
{
|
||||
// TODO: check password
|
||||
/* old code
|
||||
// Beim expandieren einer Lib pruefen, ob Passwortschutz!
|
||||
USHORT nLib = pBasicManager->GetLibId( aLib );
|
||||
if ( pBasicManager->HasPassword( nLib ) &&
|
||||
!pBasicManager->IsPasswordVerified( nLib ) )
|
||||
// check password, if library is password protected and not verified
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
bOK = QueryPassword( pBasicManager, nLib );
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bOK = QueryPassword( pShell, aLibName );
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
return bOK;
|
||||
}
|
||||
@@ -423,17 +429,19 @@ BOOL BasicTreeListBox::IsEntryProtected( SvLBoxEntry* pEntry )
|
||||
BOOL bProtected = FALSE;
|
||||
if ( pEntry && ( GetModel()->GetDepth( pEntry ) == 1 ) )
|
||||
{
|
||||
String aLib, aDummy1, aDummy2, aDummy3;
|
||||
BasicManager* pBasicManager = GetSbx( pEntry, aLib, aDummy1, aDummy2, aDummy3 );
|
||||
USHORT nLib = pBasicManager->GetLibId( aLib );
|
||||
// TODO: check password
|
||||
/* old code
|
||||
if ( pBasicManager->HasPassword( nLib ) &&
|
||||
!pBasicManager->IsPasswordVerified( nLib ) )
|
||||
String aLibName, aDummy1, aDummy2, aDummy3;
|
||||
BasicManager* pBasMgr = GetSbx( pEntry, aLibName, aDummy1, aDummy2, aDummy3 );
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
bProtected = TRUE;
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bProtected = TRUE;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
return bProtected;
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: bastype3.cxx,v $
|
||||
*
|
||||
* $Revision: 1.10 $
|
||||
* $Revision: 1.11 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-10-24 17:00:15 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -76,6 +76,9 @@
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINER_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star;
|
||||
@@ -110,60 +113,62 @@ void __EXPORT BasicTreeListBox::RequestingChilds( SvLBoxEntry* pEntry )
|
||||
BasicManager* pBasMgr = ((BasicManagerEntry*)pUser)->GetBasicManager();
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
|
||||
/*
|
||||
// check password
|
||||
BOOL bOK = TRUE;
|
||||
if ( pBasMgr->HasPassword( nLib ) &&
|
||||
!pBasMgr->IsPasswordVerified( nLib ) )
|
||||
{
|
||||
bOK = QueryPassword( pBasMgr, nLib );
|
||||
}
|
||||
if ( bOK )
|
||||
{
|
||||
*/
|
||||
|
||||
// load module library
|
||||
BOOL bModLibLoaded = FALSE;
|
||||
Reference< script::XLibraryContainer > xModLibContainer = BasicIDE::GetModuleLibraryContainer( pShell );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
EnterWait();
|
||||
xModLibContainer->loadLibrary( aOULibName );
|
||||
LeaveWait();
|
||||
bOK = QueryPassword( pShell, aLibName );
|
||||
}
|
||||
bModLibLoaded = TRUE;
|
||||
}
|
||||
|
||||
// load dialog library
|
||||
BOOL bDlgLibLoaded = FALSE;
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer = BasicIDE::GetDialogLibraryContainer( pShell );
|
||||
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
|
||||
if ( bOK )
|
||||
{
|
||||
if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
// load module library
|
||||
BOOL bModLibLoaded = FALSE;
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
EnterWait();
|
||||
xDlgLibContainer->loadLibrary( aOULibName );
|
||||
LeaveWait();
|
||||
if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
{
|
||||
EnterWait();
|
||||
xModLibContainer->loadLibrary( aOULibName );
|
||||
LeaveWait();
|
||||
}
|
||||
bModLibLoaded = xModLibContainer->isLibraryLoaded( aOULibName );
|
||||
}
|
||||
bDlgLibLoaded = TRUE;
|
||||
}
|
||||
|
||||
if ( bModLibLoaded || bDlgLibLoaded )
|
||||
{
|
||||
// create the sub entries
|
||||
ImpCreateLibSubEntries( pEntry, pShell, aLibName );
|
||||
// load dialog library
|
||||
BOOL bDlgLibLoaded = FALSE;
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
if ( !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
{
|
||||
EnterWait();
|
||||
xDlgLibContainer->loadLibrary( aOULibName );
|
||||
LeaveWait();
|
||||
}
|
||||
bDlgLibLoaded = xDlgLibContainer->isLibraryLoaded( aOULibName );
|
||||
}
|
||||
|
||||
// exchange image
|
||||
Image aImage( aImages.GetImage( IMGID_LIB ) );
|
||||
SetExpandedEntryBmp( pEntry, aImage );
|
||||
SetCollapsedEntryBmp( pEntry, aImage );
|
||||
}
|
||||
else
|
||||
{
|
||||
// library couldn't be loaded
|
||||
ErrorBox( this, WB_OK|WB_DEF_OK, String( IDEResId( RID_STR_ERROROPENLIB ) ) ).Execute();
|
||||
if ( bModLibLoaded || bDlgLibLoaded )
|
||||
{
|
||||
// create the sub entries
|
||||
ImpCreateLibSubEntries( pEntry, pShell, aLibName );
|
||||
|
||||
// exchange image
|
||||
Image aImage( aImages.GetImage( IMGID_LIB ) );
|
||||
SetExpandedEntryBmp( pEntry, aImage );
|
||||
SetCollapsedEntryBmp( pEntry, aImage );
|
||||
}
|
||||
else
|
||||
{
|
||||
// library couldn't be loaded
|
||||
ErrorBox( this, WB_OK|WB_DEF_OK, String( IDEResId( RID_STR_ERROROPENLIB ) ) ).Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: bastypes.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-09-25 09:14:46 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -86,6 +86,13 @@
|
||||
#include <sfx2/passwd.hxx>
|
||||
#endif
|
||||
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
using namespace ::com::sun::star::uno;
|
||||
using namespace ::com::sun::star;
|
||||
|
||||
|
||||
DBG_NAME( IDEBaseWindow );
|
||||
|
||||
@@ -1017,28 +1024,32 @@ BOOL QueryDelModule( const String& rName, Window* pParent )
|
||||
return QueryDel( rName, IDEResId( RID_STR_QUERYDELMODULE ), pParent );
|
||||
}
|
||||
|
||||
BOOL QueryPassword( BasicManager* pBasicManager, USHORT nLib )
|
||||
BOOL QueryPassword( SfxObjectShell* pShell, const String& rLibName )
|
||||
{
|
||||
BOOL bOK = FALSE;
|
||||
SfxPasswordDialog* pDlg = new SfxPasswordDialog( Application::GetDefDialogParent() );
|
||||
pDlg->SetMinLen( 1 );
|
||||
if ( pDlg->Execute() )
|
||||
{
|
||||
String aPassword = pDlg->GetPassword();
|
||||
if ( aPassword == pBasicManager->GetPassword( nLib ) )
|
||||
::rtl::OUString aOULibName( rLibName );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
bOK = TRUE;
|
||||
pBasicManager->SetPasswordVerified( nLib );
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorBox aErrorBox( Application::GetDefDialogParent(), WB_OK, String( IDEResId( RID_STR_WRONGPASSWORD ) ) );
|
||||
aErrorBox.Execute();
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
::rtl::OUString aOUPassword( pDlg->GetPassword() );
|
||||
bOK = xPasswd->verifyLibraryPassword( aOULibName, aOUPassword );
|
||||
|
||||
if ( !bOK )
|
||||
{
|
||||
ErrorBox aErrorBox( Application::GetDefDialogParent(), WB_OK, String( IDEResId( RID_STR_WRONGPASSWORD ) ) );
|
||||
aErrorBox.Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
delete pDlg;
|
||||
return bOK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: iderdll.cxx,v $
|
||||
*
|
||||
* $Revision: 1.8 $
|
||||
* $Revision: 1.9 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-09-11 15:40:15 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:09 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -95,6 +95,15 @@
|
||||
#define ITEMID_SEARCH 0
|
||||
#include <svx/srchitem.hxx>
|
||||
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
using namespace ::rtl;
|
||||
using namespace ::com::sun::star;
|
||||
using namespace ::com::sun::star::uno;
|
||||
|
||||
|
||||
class BasicIDEModule : public BasicIDEModuleDummy
|
||||
{
|
||||
public:
|
||||
@@ -237,38 +246,37 @@ void BasicIDEData::SetSearchItem( const SvxSearchItem& rItem )
|
||||
|
||||
IMPL_LINK( BasicIDEData, GlobalBasicBreakHdl, StarBASIC *, pBasic )
|
||||
{
|
||||
BasicIDEShell* pShell = IDE_DLL()->GetShell();
|
||||
if ( pShell )
|
||||
long nRet = 0;
|
||||
BasicIDEShell* pIDEShell = IDE_DLL()->GetShell();
|
||||
if ( pIDEShell )
|
||||
{
|
||||
BasicManager* pBasicManager = BasicIDE::FindBasicManager( pBasic );
|
||||
if ( pBasicManager )
|
||||
BasicManager* pBasMgr = BasicIDE::FindBasicManager( pBasic );
|
||||
if ( pBasMgr )
|
||||
{
|
||||
// TODO: check password
|
||||
/* old code
|
||||
USHORT nLib = pBasicManager->GetLibId( pBasic );
|
||||
// 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
|
||||
if ( !pBasicManager->HasPassword( nLib ) ||
|
||||
pBasicManager->IsPasswordVerified( nLib )
|
||||
//|| QueryPassword( pBasicManager, nLib )
|
||||
)
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
::rtl::OUString aOULibName( pBasic->GetName() );
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
return pShell->CallBasicBreakHdl( pBasic );
|
||||
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 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ein Step-Out muesste mich aus den geschuetzten Bereich befoerdern...
|
||||
return SbDEBUG_STEPOUT;
|
||||
}
|
||||
*/
|
||||
/* new code */
|
||||
return pShell->CallBasicBreakHdl( pBasic );
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return nRet;
|
||||
}
|
||||
|
||||
IMPL_LINK( BasicIDEData, ExecuteMacroEvent, void *, pData )
|
||||
|
@@ -2,9 +2,9 @@
|
||||
#
|
||||
# $RCSfile: makefile.mk,v $
|
||||
#
|
||||
# $Revision: 1.11 $
|
||||
# $Revision: 1.12 $
|
||||
#
|
||||
# last change: $Author: tbe $ $Date: 2001-10-10 16:23:05 $
|
||||
# last change: $Author: tbe $ $Date: 2001-11-02 13:45:10 $
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# either of the following licenses
|
||||
@@ -120,7 +120,10 @@ EXCEPTIONSFILES=$(SLO)$/basidesh.obj \
|
||||
$(SLO)$/baside3.obj \
|
||||
$(SLO)$/basobj2.obj \
|
||||
$(SLO)$/basobj3.obj \
|
||||
$(SLO)$/bastypes.obj \
|
||||
$(SLO)$/bastype2.obj \
|
||||
$(SLO)$/bastype3.obj \
|
||||
$(SLO)$/iderdll.obj \
|
||||
$(SLO)$/macrodlg.obj \
|
||||
$(SLO)$/moduldlg.obj \
|
||||
$(SLO)$/moduldl2.obj \
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: moduldl2.cxx,v $
|
||||
*
|
||||
* $Revision: 1.22 $
|
||||
* $Revision: 1.23 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-10-24 17:00:15 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:10 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -104,6 +104,9 @@
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRYARYCONTAINER2_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainer2.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef INCLUDED_SVTOOLS_PATHOPTIONS_HXX
|
||||
#include <svtools/pathoptions.hxx>
|
||||
@@ -152,6 +155,7 @@ LibPage::LibPage( Window * pParent ) :
|
||||
aLibBox.SetMode( LIBMODE_MANAGER );
|
||||
aLibBox.EnableInplaceEditing( TRUE );
|
||||
//aLibBox.SetCheckButtonHdl( LINK( this, LibPage, CheckBoxHdl ) );
|
||||
aLibBox.SetWindowBits( WB_HSCROLL );
|
||||
aCloseButton.GrabFocus();
|
||||
|
||||
long aTabs[] = { 2, 30, 120 };
|
||||
@@ -290,26 +294,8 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
|
||||
}
|
||||
else if ( pButton == &aPasswordButton )
|
||||
{
|
||||
String aBasicManager( aBasicsBox.GetSelectEntry() );
|
||||
BasicManager* pBasMgr = BasicIDE::FindBasicManager( aBasicManager );
|
||||
DBG_ASSERT( pBasMgr, "BasicManager?!" );
|
||||
|
||||
SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
|
||||
USHORT nLib = (USHORT)aLibBox.GetModel()->GetAbsPos( pCurEntry );
|
||||
|
||||
BOOL bHadPassword = aLibBox.GetBasicManager()->HasPassword( nLib );
|
||||
// Noch nicht geladen, falls gerade erst aktiviert.
|
||||
// Wuerde sonst erst beim Beenden des Dlg's geschehen.
|
||||
/* old code
|
||||
if ( !aLibBox.GetBasicManager()->IsLibLoaded( nLib ) )
|
||||
{
|
||||
Application::EnterWait();
|
||||
aLibBox.GetBasicManager()->LoadLib( nLib );
|
||||
Application::LeaveWait();
|
||||
}
|
||||
*/
|
||||
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( aLibBox.GetBasicManager() );
|
||||
SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
|
||||
String aLibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
|
||||
@@ -331,30 +317,67 @@ IMPL_LINK( LibPage, ButtonHdl, Button *, pButton )
|
||||
Application::LeaveWait();
|
||||
}
|
||||
|
||||
SvxPasswordDialog* pDlg = new SvxPasswordDialog( this, TRUE );
|
||||
String aPassword = pBasMgr->GetPassword( nLib );
|
||||
#ifdef DEBUG
|
||||
InfoBox( 0, aPassword ).Execute();
|
||||
#endif
|
||||
pDlg->SetOldPassword( aPassword );
|
||||
|
||||
if ( pDlg->Execute() == RET_OK )
|
||||
// check, if library is password protected
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
pBasMgr->SetPassword( nLib, pDlg->GetNewPassword() );
|
||||
pBasMgr->SetPasswordVerified( nLib );
|
||||
if ( bHadPassword != aLibBox.GetBasicManager()->HasPassword( nLib ) )
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() )
|
||||
{
|
||||
aLibBox.GetModel()->Remove( pCurEntry );
|
||||
ImpInsertLibEntry( pBasMgr->GetLibName( nLib ), nLib );
|
||||
aLibBox.GetBasicManager()->SetPasswordVerified( nLib );
|
||||
BOOL bProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
|
||||
|
||||
// change password dialog
|
||||
SvxPasswordDialog* pDlg = new SvxPasswordDialog( this, TRUE, !bProtected );
|
||||
pDlg->SetCheckPasswordHdl( LINK( this, LibPage, CheckPasswordHdl ) );
|
||||
|
||||
if ( pDlg->Execute() == RET_OK )
|
||||
{
|
||||
BOOL bNewProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
|
||||
|
||||
if ( bNewProtected != bProtected )
|
||||
{
|
||||
ULONG nPos = (ULONG)aLibBox.GetModel()->GetAbsPos( pCurEntry );
|
||||
aLibBox.GetModel()->Remove( pCurEntry );
|
||||
ImpInsertLibEntry( aLibName, nPos );
|
||||
aLibBox.SetCurEntry( aLibBox.GetEntry( nPos ) );
|
||||
}
|
||||
}
|
||||
delete pDlg;
|
||||
}
|
||||
}
|
||||
delete pDlg;
|
||||
}
|
||||
CheckButtons();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
IMPL_LINK_INLINE_START( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg )
|
||||
{
|
||||
long nRet = 0;
|
||||
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( aLibBox.GetBasicManager() );
|
||||
SvLBoxEntry* pCurEntry = aLibBox.GetCurEntry();
|
||||
::rtl::OUString aOULibName( aLibBox.GetEntryText( pCurEntry, 0 ) );
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( BasicIDE::GetModuleLibraryContainer( pShell ), 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()
|
||||
{
|
||||
BasicManager* pBasMgr = BasicIDE::FindBasicManager( aCurBasMgr );
|
||||
@@ -738,6 +761,7 @@ void LibPage::SetCurLib()
|
||||
if ( !pEntry )
|
||||
pEntry = aLibBox.GetEntry( 0 );
|
||||
aLibBox.SetCurEntry( pEntry );
|
||||
//aLibBox.MakeVisible( pEntry );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -790,33 +814,38 @@ void LibPage::ActivateCurrentLibSettings()
|
||||
|
||||
SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, ULONG nPos )
|
||||
{
|
||||
//BasicManager* pBasicManager = aLibBox.GetBasicManager();
|
||||
//DBG_ASSERT( pBasicManager, "ImpInsertLibEntry: Kein BasicManager!" );
|
||||
// check, if library is password protected
|
||||
BOOL bProtected = FALSE;
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( aLibBox.GetBasicManager() );
|
||||
::rtl::OUString aOULibName( rLibName );
|
||||
Reference< script::XLibraryContainer2 > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() )
|
||||
{
|
||||
bProtected = xPasswd->isLibraryPasswordProtected( aOULibName );
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: check password
|
||||
//BOOL bPassword = pBasicManager->HasPassword( nLib );
|
||||
// if ( !pBasicManager->IsLibLoaded( nLib ) )
|
||||
// {
|
||||
// // Lib muss geladen sein, wenn Passwortabfrage...
|
||||
// pBasicManager->LoadLib( nLib );
|
||||
// bPassword = pBasicManager->HasPassword( nLib );
|
||||
// pBasicManager->UnloadLib( nLib );
|
||||
// }
|
||||
|
||||
/*
|
||||
if ( bPassword )
|
||||
if ( bProtected )
|
||||
{
|
||||
Image aImg = Image( IDEResId( RID_IMG_LOCKED ) );
|
||||
Size aSz = aImg.GetSizePixel();
|
||||
aLibBox.SetDefaultExpandedEntryBmp( aImg );
|
||||
aLibBox.SetDefaultCollapsedEntryBmp( aImg );
|
||||
}
|
||||
*/
|
||||
|
||||
SvLBoxEntry* pNewEntry = aLibBox.InsertEntry( rLibName, nPos );
|
||||
|
||||
// TODO: check, if library is reference/link
|
||||
/*
|
||||
// check, if library is link
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && xModLibContainer->isLibraryLink( aOULibName ) )
|
||||
{
|
||||
String aLinkURL = xModLibContainer->getLibraryLinkURL( aOULibName );
|
||||
aLibBox.SetEntryText( aLinkURL, pNewEntry, 1 );
|
||||
}
|
||||
|
||||
/* old code
|
||||
if ( pBasicManager->IsReference( nLib ) || pBasicManager->IsExtern( nLib ) )
|
||||
{
|
||||
String aLibStorage = pBasicManager->GetLibStorageName( nLib );
|
||||
@@ -839,15 +868,12 @@ SvLBoxEntry* LibPage::ImpInsertLibEntry( const String& rLibName, ULONG nPos )
|
||||
|
||||
//aLibBox.CheckEntryPos( nLib, pBasicManager->IsLibLoaded( nLib ) );
|
||||
|
||||
|
||||
/*
|
||||
if ( bPassword )
|
||||
if ( bProtected )
|
||||
{
|
||||
Image aImg; // Default zuruecksetzen
|
||||
aLibBox.SetDefaultExpandedEntryBmp( aImg );
|
||||
aLibBox.SetDefaultCollapsedEntryBmp( aImg );
|
||||
}
|
||||
*/
|
||||
|
||||
return pNewEntry;
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: moduldlg.cxx,v $
|
||||
*
|
||||
* $Revision: 1.11 $
|
||||
* $Revision: 1.12 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-09-06 09:17:41 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:10 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -77,6 +77,9 @@
|
||||
#ifndef _COM_SUN_STAR_IO_XINPUTSTREAMPROVIDER_HXX_
|
||||
#include <com/sun/star/io/XInputStreamProvider.hpp>
|
||||
#endif
|
||||
#ifndef _COM_SUN_STAR_SCRIPT_XLIBRARYCONTAINERPASSWORD_HPP_
|
||||
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef _SBXCLASS_HXX //autogen
|
||||
#include <svtools/sbx.hxx>
|
||||
@@ -190,27 +193,23 @@ BOOL __EXPORT ExtBasicTreeListBox::NotifyAcceptDrop( SvLBoxEntry* pEntry )
|
||||
BasicManager* pBasMgr = BasicIDE::FindBasicManager( aBasMgrName );
|
||||
if ( pBasMgr )
|
||||
{
|
||||
// TODO: check password
|
||||
/* old code
|
||||
USHORT nLib = pBasicManager->GetLibId( aLib );
|
||||
if ( !pBasicManager->IsLibLoaded( nLib ) || (
|
||||
pBasicManager->HasPassword( nLib ) &&
|
||||
!pBasicManager->IsPasswordVerified( nLib ) ) )
|
||||
{
|
||||
bValid = FALSE;
|
||||
}
|
||||
*/
|
||||
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
|
||||
// check if module library is loaded
|
||||
Reference< script::XLibraryContainer > xModLibContainer = BasicIDE::GetModuleLibraryContainer( pShell );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
bValid = FALSE;
|
||||
// check if module library is loaded and password protected
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
if ( !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
bValid = FALSE;
|
||||
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
bValid = FALSE;
|
||||
}
|
||||
|
||||
// check if dialog library is loaded
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer = BasicIDE::GetDialogLibraryContainer( pShell );
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
bValid = FALSE;
|
||||
}
|
||||
@@ -592,17 +591,6 @@ void ObjectPage::CheckButtons()
|
||||
SvLBoxEntry* pCurEntry = aBasicBox.GetCurEntry();
|
||||
USHORT nDepth = pCurEntry ? aBasicBox.GetModel()->GetDepth( pCurEntry ) : 0;
|
||||
|
||||
if ( nDepth == 1 || nDepth == 2 )
|
||||
{
|
||||
aNewModButton.Enable();
|
||||
aNewDlgButton.Enable();
|
||||
}
|
||||
else
|
||||
{
|
||||
aNewModButton.Disable();
|
||||
aNewDlgButton.Disable();
|
||||
}
|
||||
|
||||
if ( nDepth == 2 )
|
||||
aEditButton.Enable();
|
||||
else
|
||||
@@ -732,57 +720,57 @@ IMPL_LINK( ObjectPage, ButtonHdl, Button *, pButton )
|
||||
|
||||
StarBASIC* ObjectPage::GetSelectedBasic()
|
||||
{
|
||||
StarBASIC* pBasic = 0;
|
||||
String aLibName, aModOrDlg, aSub;
|
||||
BasicManager* pBasMgr = aBasicBox.GetSelectedSbx( aLibName, aModOrDlg, aSub );
|
||||
DBG_ASSERT( pBasMgr, "Kein BasicManager!" );
|
||||
SfxObjectShell* pShell = BasicIDE::FindDocShell( pBasMgr );
|
||||
|
||||
/* old code
|
||||
StarBASIC* pLib = aLibName.Len() ? pBasMgr->GetLib( aLibName ) : pBasMgr->GetLib( 0 );
|
||||
if ( !pLib && aLibName.Len() )
|
||||
{
|
||||
USHORT nLib = pBasMgr->GetLibId( aLibName );
|
||||
BOOL bOK = TRUE;
|
||||
if ( pBasMgr->HasPassword( nLib ) &&
|
||||
!pBasMgr->IsPasswordVerified( nLib ) )
|
||||
{
|
||||
bOK = QueryPassword( pBasMgr, nLib );
|
||||
}
|
||||
if ( bOK )
|
||||
{
|
||||
pBasMgr->LoadLib( nLib );
|
||||
pLib = pBasMgr->GetLib( nLib );
|
||||
if ( !pLib )
|
||||
ErrorBox( this, WB_OK|WB_DEF_OK, String( IDEResId( RID_STR_ERROROPENLIB ) ) ).Execute();
|
||||
}
|
||||
}
|
||||
*/
|
||||
if ( !aLibName.Len() )
|
||||
aLibName = String::CreateFromAscii("Standard");
|
||||
|
||||
StarBASIC* pBasic = 0;
|
||||
DBG_ASSERT( aLibName.Len(), "ObjectPage::GetSelectedBasic(): No library name!" );
|
||||
if ( aLibName.Len() )
|
||||
{
|
||||
// TODO: check password
|
||||
|
||||
|
||||
BOOL bOK = TRUE;
|
||||
::rtl::OUString aOULibName( aLibName );
|
||||
|
||||
// load module library (if not loaded)
|
||||
Reference< script::XLibraryContainer > xModLibContainer = BasicIDE::GetModuleLibraryContainer( pShell );
|
||||
// check, if the module library is not loaded
|
||||
Reference< script::XLibraryContainer > xModLibContainer( BasicIDE::GetModuleLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) && !xModLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
xModLibContainer->loadLibrary( aOULibName );
|
||||
{
|
||||
// check password
|
||||
Reference< script::XLibraryContainerPassword > xPasswd( xModLibContainer, UNO_QUERY );
|
||||
if ( xPasswd.is() && xPasswd->isLibraryPasswordProtected( aOULibName ) && !xPasswd->isLibraryPasswordVerified( aOULibName ) )
|
||||
{
|
||||
bOK = QueryPassword( pShell, aLibName );
|
||||
}
|
||||
|
||||
// load dialog library (if not loaded)
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer = BasicIDE::GetDialogLibraryContainer( pShell );
|
||||
// load library
|
||||
if ( bOK )
|
||||
xModLibContainer->loadLibrary( aOULibName );
|
||||
}
|
||||
|
||||
// check, if the dialog library is not loaded
|
||||
Reference< script::XLibraryContainer > xDlgLibContainer( BasicIDE::GetDialogLibraryContainer( pShell ), UNO_QUERY );
|
||||
if ( xDlgLibContainer.is() && xDlgLibContainer->hasByName( aOULibName ) && !xDlgLibContainer->isLibraryLoaded( aOULibName ) )
|
||||
xDlgLibContainer->loadLibrary( aOULibName );
|
||||
{
|
||||
// load library
|
||||
if ( bOK )
|
||||
xDlgLibContainer->loadLibrary( aOULibName );
|
||||
}
|
||||
|
||||
// get Basic
|
||||
pBasic = pBasMgr->GetLib( aLibName );
|
||||
}
|
||||
if ( xModLibContainer.is() && xModLibContainer->hasByName( aOULibName ) )
|
||||
{
|
||||
if ( bOK )
|
||||
{
|
||||
pBasic = pBasMgr->GetLib( aLibName );
|
||||
|
||||
if ( !pBasic )
|
||||
ErrorBox( this, WB_OK|WB_DEF_OK, String( IDEResId( RID_STR_ERROROPENLIB ) ) ).Execute();
|
||||
if ( !pBasic )
|
||||
ErrorBox( this, WB_OK|WB_DEF_OK, String( IDEResId( RID_STR_ERROROPENLIB ) ) ).Execute();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pBasic;
|
||||
}
|
||||
|
@@ -2,9 +2,9 @@
|
||||
*
|
||||
* $RCSfile: moduldlg.hxx,v $
|
||||
*
|
||||
* $Revision: 1.7 $
|
||||
* $Revision: 1.8 $
|
||||
*
|
||||
* last change: $Author: tbe $ $Date: 2001-09-27 12:12:19 $
|
||||
* last change: $Author: tbe $ $Date: 2001-11-02 13:45:10 $
|
||||
*
|
||||
* The Contents of this file are made available subject to the terms of
|
||||
* either of the following licenses
|
||||
@@ -295,6 +295,9 @@ public:
|
||||
void SetTabDlg( TabDialog* p ) { pTabDlg = p;}
|
||||
};
|
||||
|
||||
|
||||
class SvxPasswordDialog;
|
||||
|
||||
class LibPage: public TabPage
|
||||
{
|
||||
protected:
|
||||
@@ -315,6 +318,7 @@ protected:
|
||||
DECL_LINK( BasicSelectHdl, ListBox * );
|
||||
//DECL_LINK( CheckBoxHdl, SvTreeListBox * );
|
||||
DECL_LINK( ButtonHdl, Button * );
|
||||
DECL_LINK( CheckPasswordHdl, SvxPasswordDialog * );
|
||||
void CheckButtons();
|
||||
void DeleteCurrent();
|
||||
void NewLib();
|
||||
|
Reference in New Issue
Block a user