Files
libreoffice/basic/source/basmgr/basmgr.cxx

2482 lines
81 KiB
C++
Raw Normal View History

/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
2000-09-18 15:18:56 +00:00
#include <tools/stream.hxx>
#include <sot/storage.hxx>
#include <tools/urlobj.hxx>
#include <svl/smplhint.hxx>
#include <vcl/svapp.hxx>
#include <vcl/window.hxx>
#include <vcl/wrkwin.hxx>
#include <vcl/msgbox.hxx>
#include <basic/sbx.hxx>
#include <sot/storinfo.hxx>
#include <unotools/pathoptions.hxx>
#include <tools/debug.hxx>
#include <tools/diagnose_ex.h>
#include <basic/sbmod.hxx>
#include <unotools/intlwrapper.hxx>
#include <comphelper/processfactory.hxx>
#include <comphelper/string.hxx>
2000-09-18 15:18:56 +00:00
#include <basic/sbuno.hxx>
#include <basic/basmgr.hxx>
#include "global.hxx"
#include <sbunoobj.hxx>
#include "basrid.hxx"
#include "sbintern.hxx"
#include <sb.hrc>
#include <vector>
#define LIB_SEP 0x01
#define LIBINFO_SEP 0x02
#define LIBINFO_ID 0x1491
#define PASSWORD_MARKER 0x31452134
// Library API, implemented for XML import/export
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
#include <com/sun/star/script/XStarBasicAccess.hpp>
#include <com/sun/star/script/XStarBasicModuleInfo.hpp>
#include <com/sun/star/script/XStarBasicDialogInfo.hpp>
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <cppuhelper/implbase1.hxx>
using com::sun::star::uno::Reference;
using ::std::vector;
using ::std::advance;
using namespace com::sun::star;
using namespace com::sun::star::script;
using namespace cppu;
typedef WeakImplHelper1< container::XNameContainer > NameContainerHelper;
typedef WeakImplHelper1< script::XStarBasicModuleInfo > ModuleInfoHelper;
typedef WeakImplHelper1< script::XStarBasicDialogInfo > DialogInfoHelper;
typedef WeakImplHelper1< script::XStarBasicLibraryInfo > LibraryInfoHelper;
typedef WeakImplHelper1< script::XStarBasicAccess > StarBasicAccessHelper;
// Version 1
// sal_uIntPtr nEndPos
// sal_uInt16 nId
// sal_uInt16 nVer
// sal_Bool bDoLoad
// String LibName
// String AbsStorageName
// String RelStorageName
// Version 2
// + sal_Bool bReference
static const char szStdLibName[] = "Standard";
static const char szBasicStorage[] = "StarBASIC";
static const char szOldManagerStream[] = "BasicManager";
static const char szManagerStream[] = "BasicManager2";
static const char szImbedded[] = "LIBIMBEDDED";
static const char szCryptingKey[] = "CryptedBasic";
static const char szScriptLanguage[] = "StarBasic";
TYPEINIT1( BasicManager, SfxBroadcaster );
2000-09-18 15:18:56 +00:00
DBG_NAME( BasicManager );
StreamMode eStreamReadMode = STREAM_READ | STREAM_NOCREATE | STREAM_SHARE_DENYALL;
StreamMode eStorageReadMode = STREAM_READ | STREAM_SHARE_DENYWRITE;
// BasicManager impl data
struct BasicManagerImpl
{
LibraryContainerInfo maContainerInfo;
// Save stream data
SvMemoryStream* mpManagerStream;
SvMemoryStream** mppLibStreams;
sal_Int32 mnLibStreamCount;
BasicManagerImpl( void )
: mpManagerStream( NULL )
, mppLibStreams( NULL )
, mnLibStreamCount( 0 )
{}
~BasicManagerImpl();
};
BasicManagerImpl::~BasicManagerImpl()
{
delete mpManagerStream;
if( mppLibStreams )
{
for( sal_Int32 i = 0 ; i < mnLibStreamCount ; i++ )
delete mppLibStreams[i];
delete[] mppLibStreams;
}
}
//============================================================================
// BasMgrContainerListenerImpl
//============================================================================
typedef ::cppu::WeakImplHelper1< container::XContainerListener > ContainerListenerHelper;
class BasMgrContainerListenerImpl: public ContainerListenerHelper
{
BasicManager* mpMgr;
OUString maLibName; // empty -> no lib, but lib container
public:
BasMgrContainerListenerImpl( BasicManager* pMgr, OUString aLibName )
: mpMgr( pMgr )
, maLibName( aLibName ) {}
static void insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont, BasicManager* pMgr,
uno::Any aLibAny, OUString aLibName );
static void addLibraryModulesImpl( BasicManager* pMgr, uno::Reference< container::XNameAccess > xLibNameAccess,
OUString aLibName );
// XEventListener
virtual void SAL_CALL disposing( const lang::EventObject& Source )
throw(uno::RuntimeException);
// XContainerListener
virtual void SAL_CALL elementInserted( const container::ContainerEvent& Event )
throw(uno::RuntimeException);
virtual void SAL_CALL elementReplaced( const container::ContainerEvent& Event )
throw(uno::RuntimeException);
virtual void SAL_CALL elementRemoved( const container::ContainerEvent& Event )
throw(uno::RuntimeException);
};
//============================================================================
// BasMgrContainerListenerImpl
//============================================================================
void BasMgrContainerListenerImpl::insertLibraryImpl( const uno::Reference< script::XLibraryContainer >& xScriptCont,
BasicManager* pMgr, uno::Any aLibAny, OUString aLibName )
{
Reference< container::XNameAccess > xLibNameAccess;
aLibAny >>= xLibNameAccess;
if( !pMgr->GetLib( aLibName ) )
{
BasicManager* pBasMgr = static_cast< BasicManager* >( pMgr );
#ifdef DBG_UTIL
StarBASIC* pLib =
#endif
pBasMgr->CreateLibForLibContainer( aLibName, xScriptCont );
DBG_ASSERT( pLib, "XML Import: Basic library could not be created");
}
uno::Reference< container::XContainer> xLibContainer( xLibNameAccess, uno::UNO_QUERY );
if( xLibContainer.is() )
{
// Register listener for library
Reference< container::XContainerListener > xLibraryListener
= static_cast< container::XContainerListener* >
( new BasMgrContainerListenerImpl( pMgr, aLibName ) );
xLibContainer->addContainerListener( xLibraryListener );
}
if( xScriptCont->isLibraryLoaded( aLibName ) )
{
addLibraryModulesImpl( pMgr, xLibNameAccess, aLibName );
}
}
void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
uno::Reference< container::XNameAccess > xLibNameAccess, OUString aLibName )
{
uno::Sequence< OUString > aModuleNames = xLibNameAccess->getElementNames();
sal_Int32 nModuleCount = aModuleNames.getLength();
StarBASIC* pLib = pMgr->GetLib( aLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::addLibraryModulesImpl: Unknown lib!");
if( pLib )
{
const OUString* pNames = aModuleNames.getConstArray();
for( sal_Int32 j = 0 ; j < nModuleCount ; j++ )
{
OUString aModuleName = pNames[ j ];
uno::Any aElement = xLibNameAccess->getByName( aModuleName );
OUString aMod;
aElement >>= aMod;
uno::Reference< vba::XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, uno::UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aModuleName );
OSL_TRACE("#addLibraryModulesImpl - aMod");
pLib->MakeModule32( aModuleName, mInfo, aMod );
}
else
pLib->MakeModule32( aModuleName, aMod );
}
pLib->SetModified( sal_False );
}
}
// XEventListener
void SAL_CALL BasMgrContainerListenerImpl::disposing( const lang::EventObject& Source )
throw( uno::RuntimeException )
{
(void)Source;
}
// XContainerListener
void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const container::ContainerEvent& Event )
throw( uno::RuntimeException )
{
bool bLibContainer = maLibName.isEmpty();
OUString aName;
Event.Accessor >>= aName;
if( bLibContainer )
{
uno::Reference< script::XLibraryContainer > xScriptCont( Event.Source, uno::UNO_QUERY );
insertLibraryImpl( xScriptCont, mpMgr, Event.Element, aName );
StarBASIC* pLib = mpMgr->GetLib( aName );
if ( pLib )
{
uno::Reference< vba::XVBACompatibility > xVBACompat( xScriptCont, uno::UNO_QUERY );
if ( xVBACompat.is() )
pLib->SetVBAEnabled( xVBACompat->getVBACompatibilityMode() );
}
}
else
{
StarBASIC* pLib = mpMgr->GetLib( maLibName );
DBG_ASSERT( pLib, "BasMgrContainerListenerImpl::elementInserted: Unknown lib!");
if( pLib )
{
SbModule* pMod = pLib->FindModule( aName );
if( !pMod )
{
OUString aMod;
Event.Element >>= aMod;
uno::Reference< vba::XVBAModuleInfo > xVBAModuleInfo( Event.Source, uno::UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aName );
pLib->MakeModule32( aName, mInfo, aMod );
}
else
pLib->MakeModule32( aName, aMod );
pLib->SetModified( sal_False );
}
}
}
}
void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const container::ContainerEvent& Event )
throw( uno::RuntimeException )
{
OUString aName;
Event.Accessor >>= aName;
// Replace not possible for library container
#ifdef DBG_UTIL
bool bLibContainer = maLibName.isEmpty();
#endif
DBG_ASSERT( !bLibContainer, "library container fired elementReplaced()");
StarBASIC* pLib = mpMgr->GetLib( maLibName );
if( pLib )
{
SbModule* pMod = pLib->FindModule( aName );
OUString aMod;
Event.Element >>= aMod;
if( pMod )
pMod->SetSource32( aMod );
else
pLib->MakeModule32( aName, aMod );
pLib->SetModified( sal_False );
}
}
void SAL_CALL BasMgrContainerListenerImpl::elementRemoved( const container::ContainerEvent& Event )
throw( uno::RuntimeException )
{
OUString aName;
Event.Accessor >>= aName;
bool bLibContainer = maLibName.isEmpty();
if( bLibContainer )
{
StarBASIC* pLib = mpMgr->GetLib( aName );
if( pLib )
{
sal_uInt16 nLibId = mpMgr->GetLibId( aName );
mpMgr->RemoveLib( nLibId, sal_False );
}
}
else
{
StarBASIC* pLib = mpMgr->GetLib( maLibName );
SbModule* pMod = pLib ? pLib->FindModule( aName ) : NULL;
if( pMod )
{
pLib->Remove( pMod );
pLib->SetModified( sal_False );
}
}
}
BasicError::BasicError( sal_uIntPtr nId, sal_uInt16 nR, const OUString& rErrStr ) :
aErrStr( rErrStr )
{
nErrorId = nId;
nReason = nR;
}
BasicError::BasicError( const BasicError& rErr ) :
aErrStr( rErr.aErrStr )
{
nErrorId = rErr.nErrorId;
nReason = rErr.nReason;
}
//=====================================================================
class BasicLibInfo
{
private:
StarBASICRef xLib;
OUString aLibName;
OUString aStorageName; // string is sufficient, unique at runtime
OUString aRelStorageName;
OUString aPassword;
sal_Bool bDoLoad;
sal_Bool bReference;
sal_Bool bPasswordVerified;
// Lib represents library in new UNO library container
uno::Reference< script::XLibraryContainer > mxScriptCont;
public:
BasicLibInfo();
sal_Bool IsReference() const { return bReference; }
sal_Bool& IsReference() { return bReference; }
sal_Bool IsExtern() const { return ! aStorageName.equalsAscii(szImbedded); }
void SetStorageName( const OUString& rName ) { aStorageName = rName; }
const OUString& GetStorageName() const { return aStorageName; }
void SetRelStorageName( const OUString& rN ) { aRelStorageName = rN; }
const OUString& GetRelStorageName() const { return aRelStorageName; }
StarBASICRef GetLib() const
{
if( mxScriptCont.is() && mxScriptCont->hasByName( aLibName ) &&
!mxScriptCont->isLibraryLoaded( aLibName ) )
return StarBASICRef();
return xLib;
}
StarBASICRef& GetLibRef() { return xLib; }
void SetLib( StarBASIC* pBasic ) { xLib = pBasic; }
const OUString& GetLibName() const { return aLibName; }
void SetLibName( const OUString& rName ) { aLibName = rName; }
// Only temporary for Load/Save
sal_Bool DoLoad() { return bDoLoad; }
sal_Bool HasPassword() const { return !aPassword.isEmpty(); }
const OUString& GetPassword() const { return aPassword; }
void SetPassword( const OUString& rNewPassword )
{ aPassword = rNewPassword; }
sal_Bool IsPasswordVerified() const { return bPasswordVerified; }
void SetPasswordVerified() { bPasswordVerified = sal_True; }
static BasicLibInfo* Create( SotStorageStream& rSStream );
uno::Reference< script::XLibraryContainer > GetLibraryContainer( void )
{ return mxScriptCont; }
void SetLibraryContainer( const uno::Reference< script::XLibraryContainer >& xScriptCont )
{ mxScriptCont = xScriptCont; }
};
//=====================================================================
class BasicLibs
{
private:
vector< BasicLibInfo* > aList;
size_t CurrentLib;
public:
BasicLibs()
: CurrentLib(0)
{
}
~BasicLibs();
OUString aBasicLibPath; // TODO: Should be member of manager, but currently not incompatible
BasicLibInfo* GetObject( size_t i );
BasicLibInfo* First();
BasicLibInfo* Next();
size_t GetPos( BasicLibInfo* LibInfo );
size_t Count() const { return aList.size(); };
size_t GetCurPos() const { return CurrentLib; };
void Insert( BasicLibInfo* LibInfo );
BasicLibInfo* Remove( BasicLibInfo* LibInfo );
};
BasicLibs::~BasicLibs() {
for ( size_t i = 0, n = aList.size(); i < n; ++i )
delete aList[ i ];
aList.clear();
}
BasicLibInfo* BasicLibs::GetObject( size_t i )
{
if ( aList.empty()
|| aList.size() <= i
)
return NULL;
CurrentLib = i;
return aList[ CurrentLib ];
}
BasicLibInfo* BasicLibs::First()
{
if ( aList.empty() )
return NULL;
CurrentLib = 0;
return aList[ CurrentLib ];
}
BasicLibInfo* BasicLibs::Next()
{
if ( aList.empty()
|| CurrentLib >= ( aList.size() - 1 )
)
return NULL;
++CurrentLib;
return aList[ CurrentLib ];
}
size_t BasicLibs::GetPos( BasicLibInfo* LibInfo )
{
for ( size_t i = 0, n = aList.size(); i < n; ++i )
if ( aList[ i ] == LibInfo )
return i;
return size_t( -1 );
}
void BasicLibs::Insert( BasicLibInfo* LibInfo )
{
aList.push_back( LibInfo );
CurrentLib = aList.size() - 1;
}
BasicLibInfo* BasicLibs::Remove( BasicLibInfo* LibInfo )
{
2012-04-13 02:16:31 +09:00
vector< BasicLibInfo* >::iterator it, eit = aList.end();
for (it = aList.begin(); it != eit; ++it)
{
2012-04-13 02:16:31 +09:00
if (*it == LibInfo)
{
aList.erase(it);
break;
}
}
return LibInfo;
}
//=====================================================================
BasicLibInfo::BasicLibInfo()
{
bReference = sal_False;
bPasswordVerified = sal_False;
bDoLoad = sal_False;
mxScriptCont = NULL;
aStorageName = szImbedded;
aRelStorageName = szImbedded;
}
BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
{
BasicLibInfo* pInfo = new BasicLibInfo;
sal_uInt32 nEndPos;
sal_uInt16 nId;
sal_uInt16 nVer;
rSStream.ReadUInt32( nEndPos );
rSStream.ReadUInt16( nId );
rSStream.ReadUInt16( nVer );
DBG_ASSERT( nId == LIBINFO_ID, "No BasicLibInfo?!" );
if( nId == LIBINFO_ID )
{
// Reload?
sal_Bool bDoLoad;
rSStream.ReadUChar( bDoLoad );
pInfo->bDoLoad = bDoLoad;
// The name of the lib...
OUString aName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetLibName( aName );
// Absolute path...
OUString aStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetStorageName( aStorageName );
// Relative path...
OUString aRelStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetRelStorageName( aRelStorageName );
if ( nVer >= 2 )
{
sal_Bool bReferenz;
rSStream.ReadUChar( bReferenz );
pInfo->IsReference() = bReferenz;
}
rSStream.Seek( nEndPos );
}
return pInfo;
}
BasicManager::BasicManager( SotStorage& rStorage, const OUString& rBaseURL, StarBASIC* pParentFromStdLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
DBG_CTOR( BasicManager, 0 );
Init();
if( pLibPath )
{
pLibs->aBasicLibPath = *pLibPath;
}
OUString aStorName( rStorage.GetName() );
maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
2001-08-28 07:17:03 +00:00
// If there is no Manager Stream, no further actions are necessary
if ( rStorage.IsStream( OUString(szManagerStream) ) )
{
LoadBasicManager( rStorage, rBaseURL );
// StdLib contains Parent:
StarBASIC* pStdLib = GetStdLib();
DBG_ASSERT( pStdLib, "Standard-Lib not loaded?" );
if ( !pStdLib )
{
// Should never happen, but if it happens we wont crash...
pStdLib = new StarBASIC( NULL, mbDocMgr );
BasicLibInfo* pStdLibInfo = pLibs->GetObject( 0 );
if ( !pStdLibInfo )
pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( pStdLib );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
xStdLib->SetName( OUString(szStdLibName) );
pStdLibInfo->SetLibName( OUString(szStdLibName) );
xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
xStdLib->SetModified( sal_False );
}
else
{
pStdLib->SetParent( pParentFromStdLib );
// The other get StdLib as parent:
for ( sal_uInt16 nBasic = 1; nBasic < GetLibCount(); nBasic++ )
{
StarBASIC* pBasic = GetLib( nBasic );
if ( pBasic )
{
pStdLib->Insert( pBasic );
pBasic->SetFlag( SBX_EXTSEARCH );
}
}
// Modified through insert
pStdLib->SetModified( sal_False );
}
// #91626 Save all stream data to save it unmodified if basic isn't modified
// in an 6.0+ office. So also the old basic dialogs can be saved.
SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szManagerStream), eStreamReadMode );
mpImpl->mpManagerStream = new SvMemoryStream();
static_cast<SvStream*>(&xManagerStream)->ReadStream( *mpImpl->mpManagerStream );
SotStorageRef xBasicStorage = rStorage.OpenSotStorage( OUString(szBasicStorage), eStorageReadMode, sal_False );
if( xBasicStorage.Is() && !xBasicStorage->GetError() )
{
sal_uInt16 nLibs = GetLibCount();
mpImpl->mppLibStreams = new SvMemoryStream*[ nLibs ];
for( sal_uInt16 nL = 0; nL < nLibs; nL++ )
{
BasicLibInfo* pInfo = pLibs->GetObject( nL );
DBG_ASSERT( pInfo, "pInfo?!" );
SotStorageStreamRef xBasicStream = xBasicStorage->OpenSotStream( pInfo->GetLibName(), eStreamReadMode );
mpImpl->mppLibStreams[nL] = new SvMemoryStream();
static_cast<SvStream*>(&xBasicStream)->ReadStream( *( mpImpl->mppLibStreams[nL] ) );
}
}
}
else
{
ImpCreateStdLib( pParentFromStdLib );
if ( rStorage.IsStream( OUString(szOldManagerStream) ) )
LoadOldBasicManager( rStorage );
}
}
void copyToLibraryContainer( StarBASIC* pBasic, const LibraryContainerInfo& rInfo )
{
uno::Reference< script::XLibraryContainer > xScriptCont( rInfo.mxScriptCont.get() );
if ( !xScriptCont.is() )
return;
OUString aLibName = pBasic->GetName();
if( !xScriptCont->hasByName( aLibName ) )
xScriptCont->createLibrary( aLibName );
uno::Any aLibAny = xScriptCont->getByName( aLibName );
uno::Reference< container::XNameContainer > xLib;
aLibAny >>= xLib;
if ( !xLib.is() )
return;
sal_uInt16 nModCount = pBasic->GetModules()->Count();
for ( sal_uInt16 nMod = 0 ; nMod < nModCount ; nMod++ )
{
SbModule* pModule = (SbModule*)pBasic->GetModules()->Get( nMod );
DBG_ASSERT( pModule, "Module not received!" );
OUString aModName = pModule->GetName();
if( !xLib->hasByName( aModName ) )
{
OUString aSource = pModule->GetSource32();
uno::Any aSourceAny;
aSourceAny <<= aSource;
xLib->insertByName( aModName, aSourceAny );
}
}
}
const uno::Reference< script::XPersistentLibraryContainer >& BasicManager::GetDialogLibraryContainer() const
{
return mpImpl->maContainerInfo.mxDialogCont;
}
const uno::Reference< script::XPersistentLibraryContainer >& BasicManager::GetScriptLibraryContainer() const
{
return mpImpl->maContainerInfo.mxScriptCont;
}
void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
{
mpImpl->maContainerInfo = rInfo;
uno::Reference< script::XLibraryContainer > xScriptCont( mpImpl->maContainerInfo.mxScriptCont.get() );
if( xScriptCont.is() )
{
// Register listener for lib container
OUString aEmptyLibName;
uno::Reference< container::XContainerListener > xLibContainerListener
= static_cast< container::XContainerListener* >
( new BasMgrContainerListenerImpl( this, aEmptyLibName ) );
uno::Reference< container::XContainer> xLibContainer( xScriptCont, uno::UNO_QUERY );
xLibContainer->addContainerListener( xLibContainerListener );
uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames();
const OUString* pScriptLibName = aScriptLibNames.getConstArray();
sal_Int32 i, nNameCount = aScriptLibNames.getLength();
if( nNameCount )
{
for( i = 0 ; i < nNameCount ; ++i, ++pScriptLibName )
{
uno::Any aLibAny = xScriptCont->getByName( *pScriptLibName );
if ( *pScriptLibName == "Standard" )
xScriptCont->loadLibrary( *pScriptLibName );
BasMgrContainerListenerImpl::insertLibraryImpl
( xScriptCont, this, aLibAny, *pScriptLibName );
}
}
else
{
// No libs? Maybe an 5.2 document already loaded
sal_uInt16 nLibs = GetLibCount();
for( sal_uInt16 nL = 0; nL < nLibs; nL++ )
{
BasicLibInfo* pBasLibInfo = pLibs->GetObject( nL );
StarBASIC* pLib = pBasLibInfo->GetLib();
if( !pLib )
{
sal_Bool bLoaded = ImpLoadLibrary( pBasLibInfo, NULL, sal_False );
if( bLoaded )
pLib = pBasLibInfo->GetLib();
}
if( pLib )
{
copyToLibraryContainer( pLib, mpImpl->maContainerInfo );
if( pBasLibInfo->HasPassword() )
{
OldBasicPassword* pOldBasicPassword =
mpImpl->maContainerInfo.mpOldBasicPassword;
if( pOldBasicPassword )
{
pOldBasicPassword->setLibraryPassword
( pLib->GetName(), pBasLibInfo->GetPassword() );
pBasLibInfo->SetPasswordVerified();
}
}
}
}
}
}
SetGlobalUNOConstant( "BasicLibraries", makeAny( mpImpl->maContainerInfo.mxScriptCont ) );
SetGlobalUNOConstant( "DialogLibraries", makeAny( mpImpl->maContainerInfo.mxDialogCont ) );
}
BasicManager::BasicManager( StarBASIC* pSLib, OUString* pLibPath, bool bDocMgr ) : mbDocMgr( bDocMgr )
{
DBG_CTOR( BasicManager, 0 );
Init();
DBG_ASSERT( pSLib, "BasicManager cannot be created with a NULL-Pointer!" );
if( pLibPath )
{
pLibs->aBasicLibPath = *pLibPath;
}
BasicLibInfo* pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( pSLib );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
xStdLib->SetName(OUString(szStdLibName));
pStdLibInfo->SetLibName(OUString(szStdLibName) );
pSLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
// Save is only necessary if basic has changed
xStdLib->SetModified( sal_False );
}
void BasicManager::ImpMgrNotLoaded( const OUString& rStorageName )
{
// pErrInf is only destroyed if the error os processed by an
// ErrorHandler
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, rStorageName, ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENMGRSTREAM, rStorageName));
// Create a stdlib otherwise we crash!
BasicLibInfo* pStdLibInfo = CreateLibInfo();
pStdLibInfo->SetLib( new StarBASIC( NULL, mbDocMgr ) );
StarBASICRef xStdLib = pStdLibInfo->GetLib();
xStdLib->SetName( OUString(szStdLibName) );
pStdLibInfo->SetLibName( OUString(szStdLibName) );
xStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
xStdLib->SetModified( sal_False );
}
void BasicManager::ImpCreateStdLib( StarBASIC* pParentFromStdLib )
{
BasicLibInfo* pStdLibInfo = CreateLibInfo();
StarBASIC* pStdLib = new StarBASIC( pParentFromStdLib, mbDocMgr );
pStdLibInfo->SetLib( pStdLib );
pStdLib->SetName( OUString(szStdLibName) );
pStdLibInfo->SetLibName( OUString(szStdLibName) );
pStdLib->SetFlag( SBX_DONTSTORE | SBX_EXTSEARCH );
}
void BasicManager::LoadBasicManager( SotStorage& rStorage, const OUString& rBaseURL, sal_Bool bLoadLibs )
{
DBG_CHKTHIS( BasicManager, 0 );
SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szManagerStream), eStreamReadMode );
OUString aStorName( rStorage.GetName() );
// #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
if ( !xManagerStream.Is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
{
ImpMgrNotLoaded( aStorName );
return;
}
maStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
// #i13114 removed, DBG_ASSERT(aStorageName.Len() != 0, "Bad storage name");
OUString aRealStorageName = maStorageName; // for relative paths, can be modified through BaseURL
if ( !rBaseURL.isEmpty() )
{
INetURLObject aObj( rBaseURL );
if ( aObj.GetProtocol() == INET_PROT_FILE )
{
aRealStorageName = aObj.PathToFileName();
}
}
xManagerStream->SetBufferSize( 1024 );
xManagerStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_uInt32 nEndPos;
xManagerStream->ReadUInt32( nEndPos );
sal_uInt16 nLibs;
xManagerStream->ReadUInt16( nLibs );
// Plausibility!
if( nLibs & 0xF000 )
{
DBG_ASSERT( !this, "BasicManager-Stream defect!" );
return;
}
for ( sal_uInt16 nL = 0; nL < nLibs; nL++ )
{
BasicLibInfo* pInfo = BasicLibInfo::Create( *xManagerStream );
// Correct absolute pathname if relative is existing.
// Always try relative first if there are two stands on disk
if ( !pInfo->GetRelStorageName().isEmpty() && ( ! pInfo->GetRelStorageName().equalsAscii(szImbedded) ) )
{
INetURLObject aObj( aRealStorageName, INET_PROT_FILE );
aObj.removeSegment();
bool bWasAbsolute = false;
aObj = aObj.smartRel2Abs( pInfo->GetRelStorageName(), bWasAbsolute );
//*** TODO: Replace if still necessary
//*** TODO-End
if ( ! pLibs->aBasicLibPath.isEmpty() )
{
// Search lib in path
OUString aSearchFile = pInfo->GetRelStorageName();
OUString aSearchFileOldFormat(aSearchFile);
SvtPathOptions aPathCFG;
if( aPathCFG.SearchFile( aSearchFileOldFormat, SvtPathOptions::PATH_BASIC ) )
{
pInfo->SetStorageName( aSearchFile );
}
}
}
pLibs->Insert( pInfo );
// Libs from external files should be loaded only when necessary.
// But references are loaded at once, otherwise some big customers get into trouble
if ( bLoadLibs && pInfo->DoLoad() &&
( !pInfo->IsExtern() || pInfo->IsReference()))
{
ImpLoadLibrary( pInfo, &rStorage );
}
}
xManagerStream->Seek( nEndPos );
xManagerStream->SetBufferSize( 0 );
xManagerStream.Clear();
}
void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
{
DBG_CHKTHIS( BasicManager, 0 );
SotStorageStreamRef xManagerStream = rStorage.OpenSotStream( OUString(szOldManagerStream), eStreamReadMode );
OUString aStorName( rStorage.GetName() );
DBG_ASSERT( aStorName.getLength(), "No Storage Name!" );
if ( !xManagerStream.Is() || xManagerStream->GetError() || ( xManagerStream->Seek( STREAM_SEEK_TO_END ) == 0 ) )
{
ImpMgrNotLoaded( aStorName );
return;
}
xManagerStream->SetBufferSize( 1024 );
xManagerStream->Seek( STREAM_SEEK_TO_BEGIN );
sal_uInt32 nBasicStartOff, nBasicEndOff;
xManagerStream->ReadUInt32( nBasicStartOff );
xManagerStream->ReadUInt32( nBasicEndOff );
DBG_ASSERT( !xManagerStream->GetError(), "Invalid Manager-Stream!" );
xManagerStream->Seek( nBasicStartOff );
if( !ImplLoadBasic( *xManagerStream, pLibs->GetObject(0)->GetLibRef() ) )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, aStorName, ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENMGRSTREAM, aStorName));
// and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
OUString aLibs = xManagerStream->ReadUniOrByteString(xManagerStream->GetStreamCharSet());
xManagerStream->SetBufferSize( 0 );
xManagerStream.Clear(); // Close stream
if ( !aLibs.isEmpty() )
{
OUString aCurStorageName( aStorName );
INetURLObject aCurStorage( aCurStorageName, INET_PROT_FILE );
sal_Int32 nLibs = comphelper::string::getTokenCount(aLibs, LIB_SEP);
for ( sal_Int32 nLib = 0; nLib < nLibs; nLib++ )
{
OUString aLibInfo(comphelper::string::getToken(aLibs, nLib, LIB_SEP));
// TODO: Remove == 2
DBG_ASSERT( ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 2 ) || ( comphelper::string::getTokenCount(aLibInfo, LIBINFO_SEP) == 3 ), "Invalid Lib-Info!" );
OUString aLibName( aLibInfo.getToken( 0, LIBINFO_SEP ) );
OUString aLibAbsStorageName( aLibInfo.getToken( 1, LIBINFO_SEP ) );
OUString aLibRelStorageName( aLibInfo.getToken( 2, LIBINFO_SEP ) );
INetURLObject aLibAbsStorage( aLibAbsStorageName, INET_PROT_FILE );
INetURLObject aLibRelStorage( aStorName );
aLibRelStorage.removeSegment();
bool bWasAbsolute = false;
aLibRelStorage = aLibRelStorage.smartRel2Abs( aLibRelStorageName, bWasAbsolute);
DBG_ASSERT(!bWasAbsolute, "RelStorageName was absolute!" );
SotStorageRef xStorageRef;
if ( ( aLibAbsStorage == aCurStorage ) || ( aLibRelStorageName.equalsAscii(szImbedded) ) )
{
xStorageRef = &rStorage;
}
else
{
xStorageRef = new SotStorage( false, aLibAbsStorage.GetMainURL
( INetURLObject::NO_DECODE ), eStorageReadMode );
if ( xStorageRef->GetError() != ERRCODE_NONE )
xStorageRef = new SotStorage( false, aLibRelStorage.
GetMainURL( INetURLObject::NO_DECODE ), eStorageReadMode );
}
if ( xStorageRef.Is() )
{
AddLib( *xStorageRef, aLibName, sal_False );
}
else
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, aStorName, ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_STORAGENOTFOUND, aStorName));
}
}
}
}
2000-09-18 15:18:56 +00:00
BasicManager::~BasicManager()
{
DBG_DTOR( BasicManager, 0 );
// Notify listener if something needs to be saved
Broadcast( SfxSimpleHint( SFX_HINT_DYING) );
// Destroy Basic-Infos...
// In reverse order
delete pLibs;
delete mpImpl;
}
void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
{
delete _rpManager;
_rpManager = NULL;
}
bool BasicManager::HasExeCode( const OUString& sLib )
{
StarBASIC* pLib = GetLib(sLib);
if ( pLib )
{
SbxArray* pMods = pLib->GetModules();
Merge commit 'ooo/DEV300_m101' into integration/dev300_m101 Conflicts: avmedia/inc/avmedia/mediaitem.hxx avmedia/prj/build.lst avmedia/source/framework/mediaitem.cxx avmedia/source/gstreamer/gstcommon.hxx avmedia/source/gstreamer/gstframegrabber.cxx avmedia/source/gstreamer/gstframegrabber.hxx avmedia/source/gstreamer/gstmanager.cxx avmedia/source/gstreamer/gstmanager.hxx avmedia/source/gstreamer/gstplayer.cxx avmedia/source/gstreamer/gstplayer.hxx avmedia/source/gstreamer/gstuno.cxx avmedia/source/gstreamer/gstwindow.cxx avmedia/source/gstreamer/gstwindow.hxx avmedia/source/gstreamer/makefile.mk avmedia/source/quicktime/quicktimeuno.cxx avmedia/source/viewer/mediawindow.cxx avmedia/source/viewer/mediawindow_impl.cxx avmedia/source/viewer/mediawindow_impl.hxx avmedia/source/viewer/mediawindowbase_impl.cxx avmedia/source/win/winuno.cxx basic/inc/basic/basmgr.hxx basic/inc/basic/mybasic.hxx basic/inc/basic/process.hxx basic/inc/basic/sbmeth.hxx basic/inc/basic/sbmod.hxx basic/inc/basic/sbxdef.hxx basic/inc/basic/sbxvar.hxx basic/source/app/app.cxx basic/source/app/app.hxx basic/source/app/appbased.cxx basic/source/app/appedit.cxx basic/source/app/appwin.cxx basic/source/app/appwin.hxx basic/source/app/brkpnts.cxx basic/source/app/brkpnts.hxx basic/source/app/dialogs.cxx basic/source/app/dialogs.hxx basic/source/app/msgedit.cxx basic/source/app/mybasic.cxx basic/source/app/process.cxx basic/source/app/processw.hxx basic/source/app/textedit.cxx basic/source/basmgr/basicmanagerrepository.cxx basic/source/basmgr/basmgr.cxx basic/source/classes/disas.cxx basic/source/classes/eventatt.cxx basic/source/classes/image.cxx basic/source/classes/sb.cxx basic/source/classes/sbunoobj.cxx basic/source/classes/sbxmod.cxx basic/source/comp/codegen.cxx basic/source/comp/dim.cxx basic/source/comp/exprgen.cxx basic/source/comp/exprnode.cxx basic/source/comp/exprtree.cxx basic/source/comp/sbcomp.cxx basic/source/inc/expr.hxx basic/source/inc/object.hxx basic/source/inc/sbunoobj.hxx basic/source/runtime/dllmgr-x86.cxx basic/source/runtime/iosys.cxx basic/source/runtime/makefile.mk basic/source/runtime/methods.cxx basic/source/runtime/methods1.cxx basic/source/runtime/runtime.cxx basic/source/runtime/stdobj.cxx basic/source/runtime/step0.cxx basic/source/runtime/step1.cxx basic/source/runtime/step2.cxx basic/source/sbx/sbxarray.cxx basic/source/sbx/sbxbase.cxx basic/source/sbx/sbxbool.cxx basic/source/sbx/sbxbyte.cxx basic/source/sbx/sbxcoll.cxx basic/source/sbx/sbxconv.hxx basic/source/sbx/sbxcurr.cxx basic/source/sbx/sbxexec.cxx basic/source/sbx/sbxint.cxx basic/source/sbx/sbxobj.cxx basic/source/sbx/sbxscan.cxx basic/source/sbx/sbxstr.cxx basic/source/sbx/sbxvals.cxx basic/source/sbx/sbxvalue.cxx basic/source/sbx/sbxvar.cxx basic/workben/mgrtest.cxx configmgr/prj/build.lst configmgr/source/access.cxx configmgr/source/configurationprovider.cxx configmgr/source/defaultprovider.cxx configmgr/source/pad.cxx configmgr/source/services.cxx configmgr/source/update.cxx configmgr/source/xmlreader.cxx configmgr/source/xmlreader.hxx connectivity/prj/build.lst connectivity/qa/complex/connectivity/TestCase.java connectivity/source/cpool/Zregistration.cxx connectivity/source/drivers/adabas/Bservices.cxx connectivity/source/drivers/ado/Aservices.cxx connectivity/source/drivers/calc/Cservices.cxx connectivity/source/drivers/calc/makefile.mk connectivity/source/drivers/dbase/DIndex.cxx connectivity/source/drivers/dbase/DIndexIter.cxx connectivity/source/drivers/dbase/DNoException.cxx connectivity/source/drivers/dbase/DTable.cxx connectivity/source/drivers/dbase/Dservices.cxx connectivity/source/drivers/dbase/dindexnode.cxx connectivity/source/drivers/evoab/LNoException.cxx connectivity/source/drivers/evoab/LServices.cxx connectivity/source/drivers/evoab2/NServices.cxx connectivity/source/drivers/file/FNoException.cxx connectivity/source/drivers/file/FPreparedStatement.cxx connectivity/source/drivers/file/FResultSet.cxx connectivity/source/drivers/file/FStatement.cxx connectivity/source/drivers/file/quotedstring.cxx connectivity/source/drivers/flat/ETable.cxx connectivity/source/drivers/flat/Eservices.cxx connectivity/source/drivers/hsqldb/Hservices.cxx connectivity/source/drivers/jdbc/jservices.cxx connectivity/source/drivers/kab/KServices.cxx connectivity/source/drivers/macab/MacabServices.cxx connectivity/source/drivers/mozab/MResultSet.cxx connectivity/source/drivers/mozab/bootstrap/MNSFolders.cxx connectivity/source/drivers/mozab/bootstrap/MNSProfileDiscover.cxx connectivity/source/drivers/mysql/Yservices.cxx connectivity/source/drivers/odbc/OFunctions.cxx connectivity/source/drivers/odbc/oservices.cxx connectivity/source/inc/dbase/DIndexPage.hxx connectivity/source/inc/file/FTable.hxx connectivity/source/manager/mregistration.cxx connectivity/source/parse/PColumn.cxx desktop/prj/build.lst desktop/qa/deployment_misc/test_dp_version.cxx desktop/source/app/app.cxx desktop/source/app/appfirststart.cxx desktop/source/app/cmdlineargs.cxx desktop/source/app/cmdlineargs.hxx desktop/source/app/sofficemain.cxx desktop/source/deployment/gui/dp_gui.hrc desktop/source/deployment/gui/dp_gui_dialog2.cxx desktop/source/deployment/gui/dp_gui_dialog2.hxx desktop/source/deployment/gui/dp_gui_updatedialog.cxx desktop/source/deployment/gui/dp_gui_updatedialog.hxx desktop/source/deployment/manager/dp_extensionmanager.cxx desktop/source/deployment/manager/dp_extensionmanager.hxx desktop/source/deployment/misc/dp_misc.src desktop/source/deployment/registry/component/dp_component.cxx desktop/source/deployment/registry/configuration/dp_configuration.cxx desktop/source/deployment/registry/dp_backend.cxx desktop/source/deployment/registry/help/dp_help.cxx desktop/source/deployment/registry/script/dp_script.cxx desktop/source/migration/pages.cxx desktop/source/migration/pages.hxx desktop/source/migration/wizard.cxx desktop/source/migration/wizard.hrc desktop/source/migration/wizard.hxx desktop/source/migration/wizard.src desktop/source/pkgchk/unopkg/unopkg_shared.h desktop/source/so_comp/services.cxx desktop/source/splash/makefile.mk desktop/source/splash/services_spl.cxx desktop/source/splash/splash.cxx drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx editeng/inc/editeng/adjitem.hxx editeng/inc/editeng/bolnitem.hxx editeng/inc/editeng/borderline.hxx editeng/inc/editeng/boxitem.hxx editeng/inc/editeng/brkitem.hxx editeng/inc/editeng/brshitem.hxx editeng/inc/editeng/bulitem.hxx editeng/inc/editeng/charreliefitem.hxx editeng/inc/editeng/charrotateitem.hxx editeng/inc/editeng/charscaleitem.hxx editeng/inc/editeng/cmapitem.hxx editeng/inc/editeng/colritem.hxx editeng/inc/editeng/crsditem.hxx editeng/inc/editeng/editdata.hxx editeng/inc/editeng/editeng.hxx editeng/inc/editeng/editobj.hxx editeng/inc/editeng/editstat.hxx editeng/inc/editeng/editview.hxx editeng/inc/editeng/emphitem.hxx editeng/inc/editeng/escpitem.hxx editeng/inc/editeng/fhgtitem.hxx editeng/inc/editeng/flstitem.hxx editeng/inc/editeng/fontitem.hxx editeng/inc/editeng/frmdiritem.hxx editeng/inc/editeng/fwdtitem.hxx editeng/inc/editeng/hyznitem.hxx editeng/inc/editeng/kernitem.hxx editeng/inc/editeng/langitem.hxx editeng/inc/editeng/lrspitem.hxx editeng/inc/editeng/lspcitem.hxx editeng/inc/editeng/numitem.hxx editeng/inc/editeng/outliner.hxx editeng/inc/editeng/paravertalignitem.hxx editeng/inc/editeng/pmdlitem.hxx editeng/inc/editeng/postitem.hxx editeng/inc/editeng/protitem.hxx editeng/inc/editeng/shaditem.hxx editeng/inc/editeng/sizeitem.hxx editeng/inc/editeng/svxacorr.hxx editeng/inc/editeng/svxfont.hxx editeng/inc/editeng/svxrtf.hxx editeng/inc/editeng/swafopt.hxx editeng/inc/editeng/tstpitem.hxx editeng/inc/editeng/twolinesitem.hxx editeng/inc/editeng/txtrange.hxx editeng/inc/editeng/udlnitem.hxx editeng/inc/editeng/ulspitem.hxx editeng/inc/editeng/wghtitem.hxx editeng/inc/editeng/writingmodeitem.hxx editeng/inc/editeng/xmlcnitm.hxx editeng/inc/helpid.hrc editeng/inc/pch/precompiled_editeng.hxx editeng/source/editeng/editdbg.cxx editeng/source/editeng/editdoc.cxx editeng/source/editeng/editdoc.hxx editeng/source/editeng/editdoc2.cxx editeng/source/editeng/editeng.cxx editeng/source/editeng/editobj.cxx editeng/source/editeng/editobj2.hxx editeng/source/editeng/editsel.cxx editeng/source/editeng/editundo.cxx editeng/source/editeng/editundo.hxx editeng/source/editeng/editview.cxx editeng/source/editeng/edtspell.hxx editeng/source/editeng/eehtml.cxx editeng/source/editeng/eehtml.hxx editeng/source/editeng/eeobj.cxx editeng/source/editeng/eerdll.cxx editeng/source/editeng/eertfpar.cxx editeng/source/editeng/impedit.cxx editeng/source/editeng/impedit.hxx editeng/source/editeng/impedit2.cxx editeng/source/editeng/impedit3.cxx editeng/source/editeng/impedit4.cxx editeng/source/editeng/impedit5.cxx editeng/source/editeng/makefile.mk editeng/source/items/bulitem.cxx editeng/source/items/charhiddenitem.cxx editeng/source/items/flditem.cxx editeng/source/items/frmitems.cxx editeng/source/items/makefile.mk editeng/source/items/numitem.cxx editeng/source/items/paraitem.cxx editeng/source/items/svxfont.cxx editeng/source/items/textitem.cxx editeng/source/items/writingmodeitem.cxx editeng/source/items/xmlcnitm.cxx editeng/source/misc/SvXMLAutoCorrectImport.cxx editeng/source/misc/svxacorr.cxx editeng/source/misc/txtrange.cxx editeng/source/misc/unolingu.cxx editeng/source/outliner/outleeng.cxx editeng/source/outliner/outliner.cxx editeng/source/outliner/outlundo.hxx editeng/source/outliner/outlvw.cxx editeng/source/outliner/paralist.cxx editeng/source/outliner/paralist.hxx editeng/source/rtf/rtfgrf.cxx editeng/source/rtf/rtfitem.cxx editeng/source/rtf/svxrtf.cxx editeng/source/uno/unoipset.cxx editeng/util/makefile.mk embeddedobj/prj/build.lst embeddedobj/source/commonembedding/miscobj.cxx eventattacher/prj/build.lst fileaccess/source/FileAccess.cxx formula/inc/formula/FormulaCompiler.hxx formula/inc/formula/token.hxx formula/inc/formula/tokenarray.hxx formula/source/core/api/FormulaCompiler.cxx formula/source/core/api/token.cxx formula/source/ui/dlg/FormulaHelper.cxx formula/source/ui/dlg/formula.cxx formula/source/ui/dlg/parawin.cxx formula/source/ui/dlg/structpg.cxx fpicker/prj/d.lst fpicker/source/aqua/FPentry.cxx fpicker/source/office/OfficeControlAccess.cxx fpicker/source/office/iodlg.cxx fpicker/source/office/iodlg.hxx fpicker/source/office/iodlg.src fpicker/source/office/iodlgimp.cxx fpicker/source/unx/gnome/FPentry.cxx fpicker/source/unx/gnome/SalGtkFilePicker.cxx fpicker/source/unx/gnome/SalGtkPicker.cxx fpicker/source/unx/kde4/KDE4FPEntry.cxx fpicker/source/win32/filepicker/FPentry.cxx framework/AllLangResTarget_fwe.mk framework/inc/dispatch/interaction.hxx framework/inc/framework/addonmenu.hxx framework/inc/framework/addonsoptions.hxx framework/inc/framework/bmkmenu.hxx framework/inc/framework/imageproducer.hxx framework/inc/framework/sfxhelperfunctions.hxx framework/inc/framework/statusbarconfiguration.hxx framework/inc/framework/titlehelper.hxx framework/inc/framework/toolboxconfiguration.hxx framework/inc/threadhelp/lockhelper.hxx framework/inc/xml/eventsdocumenthandler.hxx framework/inc/xml/statusbardocumenthandler.hxx framework/inc/xml/toolboxconfiguration.hxx framework/inc/xml/toolboxconfigurationdefines.hxx framework/inc/xml/toolboxdocumenthandler.hxx framework/prj/build.lst framework/qa/complex/ModuleManager/makefile.mk framework/qa/complex/accelerators/makefile.mk framework/qa/complex/framework/recovery/makefile.mk framework/qa/complex/imageManager/_XInitialization.java framework/source/classes/menumanager.cxx framework/source/dispatch/interaction.cxx framework/source/fwe/classes/bmkmenu.cxx framework/source/fwe/helper/actiontriggerhelper.cxx framework/source/fwe/helper/imageproducer.cxx framework/source/fwe/xml/menuconfiguration.cxx framework/source/fwe/xml/toolboxdocumenthandler.cxx framework/source/helper/uiconfigelementwrapperbase.cxx framework/source/helper/uielementwrapperbase.cxx framework/source/inc/pattern/window.hxx framework/source/jobs/jobdata.cxx framework/source/layoutmanager/layoutmanager.cxx framework/source/layoutmanager/panel.hxx framework/source/loadenv/loadenv.cxx framework/source/register/registerservices.cxx framework/source/services/menudocumenthandler.cxx framework/source/uiconfiguration/moduleuiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanager.cxx framework/source/uiconfiguration/uiconfigurationmanagerimpl.cxx framework/source/uielement/addonstoolbarmanager.cxx framework/source/uielement/controlmenucontroller.cxx framework/source/uielement/fontsizemenucontroller.cxx framework/source/uielement/imagebuttontoolbarcontroller.cxx framework/source/uielement/macrosmenucontroller.cxx framework/source/uielement/menubarmanager.cxx framework/source/uielement/newmenucontroller.cxx framework/source/uielement/togglebuttontoolbarcontroller.cxx framework/source/uielement/toolbarmanager.cxx framework/source/uielement/toolbarsmenucontroller.cxx framework/test/makefile.mk framework/test/threadtest/makefile.mk framework/test/typecfg/makefile.mk framework/util/guiapps/makefile.mk framework/util/makefile.mk idl/inc/bastype.hxx idl/inc/hash.hxx idl/inc/lex.hxx idl/inc/module.hxx idl/inc/object.hxx idl/inc/slot.hxx idl/inc/types.hxx idl/source/cmptools/hash.cxx idl/source/cmptools/lex.cxx idl/source/objects/basobj.cxx idl/source/objects/bastype.cxx idl/source/objects/module.cxx idl/source/objects/object.cxx idl/source/objects/slot.cxx idl/source/objects/types.cxx idl/source/prj/command.cxx idl/source/prj/database.cxx idl/source/prj/globals.cxx idl/source/prj/svidl.cxx linguistic/inc/linguistic/misc.hxx linguistic/prj/build.lst linguistic/source/convdic.cxx linguistic/source/convdiclist.cxx linguistic/source/dicimp.cxx linguistic/source/dlistimp.cxx linguistic/source/gciterator.cxx linguistic/source/iprcache.cxx linguistic/source/lngopt.cxx linguistic/source/lngprophelp.cxx linguistic/source/lngsvcmgr.cxx linguistic/source/lngsvcmgr.hxx linguistic/source/misc2.cxx linguistic/workben/sprophelp.cxx officecfg/registry/data/org/openoffice/VCL.xcu officecfg/util/makefile.mk oovbaapi/ooo/vba/XApplicationBase.idl oovbaapi/ooo/vba/XVBAAppService.idl oovbaapi/ooo/vba/XVBADocService.idl oovbaapi/ooo/vba/excel/XApplication.idl oovbaapi/ooo/vba/excel/XRange.idl oovbaapi/ooo/vba/excel/XWorkbook.idl oovbaapi/ooo/vba/excel/XWorksheet.idl oovbaapi/ooo/vba/word/XApplication.idl oovbaapi/ooo/vba/word/XGlobals.idl oovbaapi/ooo/vba/word/XTableOfContents.idl readlicense_oo/prj/build.lst scripting/prj/build.lst scripting/prj/d.lst scripting/source/basprov/basprov.cxx scripting/source/basprov/basscript.cxx scripting/source/basprov/basscript.hxx scripting/source/dlgprov/dlgprov.cxx scripting/source/inc/util/util.hxx scripting/source/protocolhandler/scripthandler.cxx scripting/source/provider/ProviderCache.cxx scripting/source/pyprov/makefile.mk scripting/source/runtimemgr/ScriptNameResolverImpl.cxx scripting/source/runtimemgr/ScriptRuntimeManager.cxx scripting/source/runtimemgr/StorageBridge.cxx scripting/source/storage/ScriptMetadataImporter.cxx scripting/source/storage/ScriptSecurityManager.cxx scripting/source/storage/ScriptStorage.cxx scripting/source/storage/ScriptStorageManager.cxx sfx2/inc/about.hxx sfx2/inc/brokenpackageint.hxx sfx2/inc/docvor.hxx sfx2/inc/pch/precompiled_sfx2.hxx sfx2/inc/sfx2/app.hxx sfx2/inc/sfx2/basmgr.hxx sfx2/inc/sfx2/bindings.hxx sfx2/inc/sfx2/childwin.hxx sfx2/inc/sfx2/ctrlitem.hxx sfx2/inc/sfx2/dinfdlg.hxx sfx2/inc/sfx2/dispatch.hxx sfx2/inc/sfx2/docfilt.hxx sfx2/inc/sfx2/evntconf.hxx sfx2/inc/sfx2/fcontnr.hxx sfx2/inc/sfx2/frame.hxx sfx2/inc/sfx2/imagemgr.hxx sfx2/inc/sfx2/imgmgr.hxx sfx2/inc/sfx2/linksrc.hxx sfx2/inc/sfx2/macrconf.hxx sfx2/inc/sfx2/macropg.hxx sfx2/inc/sfx2/mnuitem.hxx sfx2/inc/sfx2/mnumgr.hxx sfx2/inc/sfx2/module.hxx sfx2/inc/sfx2/msg.hxx sfx2/inc/sfx2/objsh.hxx sfx2/inc/sfx2/passwd.hxx sfx2/inc/sfx2/prnmon.hxx sfx2/inc/sfx2/request.hxx sfx2/inc/sfx2/sfx.hrc sfx2/inc/sfx2/sfxbasemodel.hxx sfx2/inc/sfx2/sfxhtml.hxx sfx2/inc/sfx2/sfxresid.hxx sfx2/inc/sfx2/sfxsids.hrc sfx2/inc/sfx2/sfxuno.hxx sfx2/inc/sfx2/shell.hxx sfx2/inc/sfx2/stbitem.hxx sfx2/inc/sfx2/styfitem.hxx sfx2/inc/sfx2/tabdlg.hxx sfx2/inc/sfx2/tbxctrl.hxx sfx2/inc/sfx2/tplpitem.hxx sfx2/inc/sfx2/viewfrm.hxx sfx2/inc/sfx2/viewsh.hxx sfx2/inc/sfxbasic.hxx sfx2/inc/sorgitm.hxx sfx2/prj/build.lst sfx2/qa/complex/docinfo/makefile.mk sfx2/qa/cppunit/makefile.mk sfx2/sdi/makefile.mk sfx2/source/appl/app.cxx sfx2/source/appl/app.hrc sfx2/source/appl/app.src sfx2/source/appl/appbas.cxx sfx2/source/appl/appcfg.cxx sfx2/source/appl/appchild.cxx sfx2/source/appl/appmain.cxx sfx2/source/appl/appmisc.cxx sfx2/source/appl/appopen.cxx sfx2/source/appl/appquit.cxx sfx2/source/appl/appserv.cxx sfx2/source/appl/appuno.cxx sfx2/source/appl/childwin.cxx sfx2/source/appl/fileobj.cxx sfx2/source/appl/helpinterceptor.cxx sfx2/source/appl/imagemgr.cxx sfx2/source/appl/impldde.cxx sfx2/source/appl/impldde.hxx sfx2/source/appl/linkmgr2.cxx sfx2/source/appl/lnkbase2.cxx sfx2/source/appl/makefile.mk sfx2/source/appl/module.cxx sfx2/source/appl/newhelp.cxx sfx2/source/appl/opengrf.cxx sfx2/source/appl/sfxdll.cxx sfx2/source/appl/sfxhelp.cxx sfx2/source/appl/shutdownicon.cxx sfx2/source/appl/shutdowniconunx.cxx sfx2/source/appl/workwin.cxx sfx2/source/bastyp/fltfnc.cxx sfx2/source/bastyp/frmhtml.cxx sfx2/source/bastyp/frmhtmlw.cxx sfx2/source/bastyp/helper.cxx sfx2/source/bastyp/minarray.cxx sfx2/source/bastyp/progress.cxx sfx2/source/bastyp/sfxhtml.cxx sfx2/source/config/evntconf.cxx sfx2/source/control/bindings.cxx sfx2/source/control/ctrlitem.cxx sfx2/source/control/dispatch.cxx sfx2/source/control/macrconf.cxx sfx2/source/control/macro.cxx sfx2/source/control/makefile.mk sfx2/source/control/minfitem.cxx sfx2/source/control/msg.cxx sfx2/source/control/msgpool.cxx sfx2/source/control/objface.cxx sfx2/source/control/request.cxx sfx2/source/control/shell.cxx sfx2/source/control/sorgitm.cxx sfx2/source/dialog/about.cxx sfx2/source/dialog/basedlgs.cxx sfx2/source/dialog/dinfdlg.cxx sfx2/source/dialog/dinfedt.cxx sfx2/source/dialog/dockwin.cxx sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/mailmodel.cxx sfx2/source/dialog/mailmodelapi.cxx sfx2/source/dialog/makefile.mk sfx2/source/dialog/mgetempl.cxx sfx2/source/dialog/passwd.cxx sfx2/source/dialog/passwd.hrc sfx2/source/dialog/printopt.cxx sfx2/source/dialog/securitypage.cxx sfx2/source/dialog/splitwin.cxx sfx2/source/dialog/styfitem.cxx sfx2/source/dialog/tabdlg.cxx sfx2/source/dialog/taskpane.cxx sfx2/source/dialog/templdlg.cxx sfx2/source/dialog/tplpitem.cxx sfx2/source/dialog/versdlg.cxx sfx2/source/doc/QuerySaveDocument.cxx sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/applet.cxx sfx2/source/doc/doc.hrc sfx2/source/doc/doc.src sfx2/source/doc/docfile.cxx sfx2/source/doc/docinf.cxx sfx2/source/doc/doctempl.cxx sfx2/source/doc/doctemplates.cxx sfx2/source/doc/docvor.cxx sfx2/source/doc/guisaveas.cxx sfx2/source/doc/makefile.mk sfx2/source/doc/objcont.cxx sfx2/source/doc/objitem.cxx sfx2/source/doc/objmisc.cxx sfx2/source/doc/objserv.cxx sfx2/source/doc/printhelper.cxx sfx2/source/doc/sfxacldetect.cxx sfx2/source/doc/sfxbasemodel.cxx sfx2/source/inc/applet.hxx sfx2/source/inc/fltoptint.hxx sfx2/source/inc/sfxlocal.hrc sfx2/source/inc/virtmenu.hxx sfx2/source/inc/workwin.hxx sfx2/source/menu/mnuitem.cxx sfx2/source/menu/objmnctl.cxx sfx2/source/menu/virtmenu.cxx sfx2/source/notify/eventsupplier.cxx sfx2/source/notify/makefile.mk sfx2/source/toolbox/imgmgr.cxx sfx2/source/toolbox/tbxitem.cxx sfx2/source/view/frame.cxx sfx2/source/view/orgmgr.cxx sfx2/source/view/printer.cxx sfx2/source/view/prnmon.cxx sfx2/source/view/viewfrm.cxx sfx2/source/view/viewprn.cxx sfx2/source/view/viewsh.cxx sfx2/util/makefile.mk sfx2/workben/custompanel/makefile.mk shell/source/backends/desktopbe/desktopbackend.cxx shell/source/backends/gconfbe/gconfbackend.cxx shell/source/backends/kde4be/kde4backend.cxx shell/source/backends/kdebe/kdebackend.cxx shell/source/win32/SysShentry.cxx shell/source/win32/shlxthandler/propsheets/propsheets.cxx shell/source/win32/simplemail/smplmailentry.cxx svx/inc/float3d.hrc svx/inc/fmhelp.hrc svx/inc/globlmn_tmpl.hrc svx/inc/helpid.hrc svx/inc/pch/precompiled_svx.hxx svx/inc/sjctrl.hxx svx/inc/srchitem.hxx svx/inc/svdibrow.hxx svx/inc/svx/SmartTagItem.hxx svx/inc/svx/algitem.hxx svx/inc/svx/camera3d.hxx svx/inc/svx/chrtitem.hxx svx/inc/svx/clipfmtitem.hxx svx/inc/svx/ctredlin.hxx svx/inc/svx/dbtoolsclient.hxx svx/inc/svx/deflt3d.hxx svx/inc/svx/dialogs.hrc svx/inc/svx/drawitem.hxx svx/inc/svx/e3ditem.hxx svx/inc/svx/extrud3d.hxx svx/inc/svx/flagsdef.hxx svx/inc/svx/float3d.hxx svx/inc/svx/frmsel.hxx svx/inc/svx/gallery.hxx svx/inc/svx/gallery1.hxx svx/inc/svx/galtheme.hxx svx/inc/svx/grfcrop.hxx svx/inc/svx/hdft.hxx svx/inc/svx/hlnkitem.hxx svx/inc/svx/hyprlink.hxx svx/inc/svx/itemwin.hxx svx/inc/svx/lathe3d.hxx svx/inc/svx/linkwarn.hxx svx/inc/svx/modctrl.hxx svx/inc/svx/msdffdef.hxx svx/inc/svx/obj3d.hxx svx/inc/svx/optgenrl.hxx svx/inc/svx/optgrid.hxx svx/inc/svx/pageitem.hxx svx/inc/svx/paraprev.hxx svx/inc/svx/postattr.hxx svx/inc/svx/rotmodit.hxx svx/inc/svx/ruler.hxx svx/inc/svx/rulritem.hxx svx/inc/svx/scene3d.hxx svx/inc/svx/sdasaitm.hxx svx/inc/svx/sdasitm.hxx svx/inc/svx/sdggaitm.hxx svx/inc/svx/sdmetitm.hxx svx/inc/svx/sdtaaitm.hxx svx/inc/svx/sdtaditm.hxx svx/inc/svx/sdtaitm.hxx svx/inc/svx/sdtakitm.hxx svx/inc/svx/sdtfchim.hxx svx/inc/svx/sdtfsitm.hxx svx/inc/svx/srchdlg.hxx svx/inc/svx/svddrag.hxx svx/inc/svx/svdetc.hxx svx/inc/svx/svdglue.hxx svx/inc/svx/svdhlpln.hxx svx/inc/svx/svdlayer.hxx svx/inc/svx/svdmark.hxx svx/inc/svx/svdmodel.hxx svx/inc/svx/svdoashp.hxx svx/inc/svx/svdobj.hxx svx/inc/svx/svdocirc.hxx svx/inc/svx/svdoedge.hxx svx/inc/svx/svdogrp.hxx svx/inc/svx/svdomeas.hxx svx/inc/svx/svdoole2.hxx svx/inc/svx/svdorect.hxx svx/inc/svx/svdotable.hxx svx/inc/svx/svdotext.hxx svx/inc/svx/svdovirt.hxx svx/inc/svx/svdpage.hxx svx/inc/svx/svdsnpv.hxx svx/inc/svx/svdtrans.hxx svx/inc/svx/svdundo.hxx svx/inc/svx/svimbase.hxx svx/inc/svx/svx3ditems.hxx svx/inc/svx/svxdlg.hxx svx/inc/svx/sxcikitm.hxx svx/inc/svx/sxekitm.hxx svx/inc/svx/sxelditm.hxx svx/inc/svx/sxenditm.hxx svx/inc/svx/sxmkitm.hxx svx/inc/svx/sxmtpitm.hxx svx/inc/svx/sxmuitm.hxx svx/inc/svx/tabarea.hxx svx/inc/svx/tabline.hxx svx/inc/svx/unoprov.hxx svx/inc/svx/viewlayoutitem.hxx svx/inc/svx/xbitmap.hxx svx/inc/svx/xbtmpit.hxx svx/inc/svx/xcolit.hxx svx/inc/svx/xfillit0.hxx svx/inc/svx/xflclit.hxx svx/inc/svx/xflftrit.hxx svx/inc/svx/xflgrit.hxx svx/inc/svx/xflhtit.hxx svx/inc/svx/xftadit.hxx svx/inc/svx/xftsfit.hxx svx/inc/svx/xftshit.hxx svx/inc/svx/xlineit0.hxx svx/inc/svx/xlinjoit.hxx svx/inc/svx/xlnclit.hxx svx/inc/svx/xlndsit.hxx svx/inc/svx/xlnedcit.hxx svx/inc/svx/xlnedit.hxx svx/inc/svx/xlnedwit.hxx svx/inc/svx/xlnstcit.hxx svx/inc/svx/xlnstit.hxx svx/inc/svx/xlnstwit.hxx svx/inc/svx/xlnwtit.hxx svx/inc/svx/xtextit0.hxx svx/inc/svx/zoomitem.hxx svx/inc/svx/zoomslideritem.hxx svx/inc/xpolyimp.hxx svx/inc/zoom_def.hxx svx/prj/d.lst svx/source/accessibility/AccessibleShape.cxx svx/source/accessibility/DescriptionGenerator.cxx svx/source/customshapes/EnhancedCustomShapeEngine.cxx svx/source/customshapes/EnhancedCustomShapeFontWork.cxx svx/source/dialog/_bmpmask.cxx svx/source/dialog/_contdlg.cxx svx/source/dialog/connctrl.cxx svx/source/dialog/contwnd.cxx svx/source/dialog/ctredlin.cxx svx/source/dialog/ctredlin.hrc svx/source/dialog/ctredlin.src svx/source/dialog/dialcontrol.cxx svx/source/dialog/dlgctrl.cxx svx/source/dialog/docrecovery.cxx svx/source/dialog/fntctrl.cxx svx/source/dialog/fontwork.cxx svx/source/dialog/frmsel.cxx svx/source/dialog/graphctl.cxx svx/source/dialog/grfflt.cxx svx/source/dialog/hdft.cxx svx/source/dialog/hyperdlg.cxx svx/source/dialog/hyprdlg.hxx svx/source/dialog/hyprlink.cxx svx/source/dialog/hyprlink.hxx svx/source/dialog/hyprlink.src svx/source/dialog/imapdlg.cxx svx/source/dialog/imapwnd.cxx svx/source/dialog/linkwarn.hrc svx/source/dialog/makefile.mk svx/source/dialog/optgrid.cxx svx/source/dialog/orienthelper.cxx svx/source/dialog/pagectrl.cxx svx/source/dialog/prtqry.cxx svx/source/dialog/rlrcitem.cxx svx/source/dialog/rubydialog.cxx svx/source/dialog/rulritem.cxx svx/source/dialog/simptabl.cxx svx/source/dialog/srchdlg.cxx svx/source/dialog/svxbmpnumvalueset.cxx svx/source/dialog/svxruler.cxx svx/source/dialog/swframeexample.cxx svx/source/engine3d/float3d.cxx svx/source/engine3d/float3d.src svx/source/engine3d/svx3ditems.cxx svx/source/fmcomp/gridctrl.cxx svx/source/fmcomp/trace.cxx svx/source/form/ParseContext.cxx svx/source/form/datanavi.cxx svx/source/form/filtnav.cxx svx/source/form/fmexch.cxx svx/source/form/fmexpl.cxx svx/source/form/fmobjfac.cxx svx/source/form/fmpage.cxx svx/source/form/fmshell.cxx svx/source/form/fmshimp.cxx svx/source/form/fmsrcimp.cxx svx/source/form/fmvwimp.cxx svx/source/form/makefile.mk svx/source/form/tabwin.cxx svx/source/form/tbxform.cxx svx/source/form/typemap.cxx svx/source/gallery2/galbrws1.cxx svx/source/gallery2/galbrws2.cxx svx/source/gallery2/galexpl.cxx svx/source/gallery2/gallery1.cxx svx/source/gallery2/galtheme.cxx svx/source/gallery2/makefile.mk svx/source/gengal/gengal.cxx svx/source/gengal/makefile.mk svx/source/inc/fmgroup.hxx svx/source/intro/about_ooo.hrc svx/source/intro/iso.src svx/source/intro/ooo.src svx/source/items/SmartTagItem.cxx svx/source/items/algitem.cxx svx/source/items/chrtitem.cxx svx/source/items/clipfmtitem.cxx svx/source/items/customshapeitem.cxx svx/source/items/drawitem.cxx svx/source/items/e3ditem.cxx svx/source/items/grfitem.cxx svx/source/items/hlnkitem.cxx svx/source/items/makefile.mk svx/source/items/pageitem.cxx svx/source/items/rotmodit.cxx svx/source/items/viewlayoutitem.cxx svx/source/items/zoomitem.cxx svx/source/items/zoomslideritem.cxx svx/source/src/app.hrc svx/source/stbctrls/makefile.mk svx/source/stbctrls/modctrl.cxx svx/source/stbctrls/xmlsecctrl.cxx svx/source/stbctrls/zoomctrl.cxx svx/source/svdraw/clonelist.cxx svx/source/svdraw/svdattr.cxx svx/source/svdraw/svdcrtv.cxx svx/source/svdraw/svdedtv1.cxx svx/source/svdraw/svdedtv2.cxx svx/source/svdraw/svdedxv.cxx svx/source/svdraw/svdetc.cxx svx/source/svdraw/svdfmtf.cxx svx/source/svdraw/svdfmtf.hxx svx/source/svdraw/svdglue.cxx svx/source/svdraw/svdhdl.cxx svx/source/svdraw/svdhlpln.cxx svx/source/svdraw/svdibrow.cxx svx/source/svdraw/svdlayer.cxx svx/source/svdraw/svdmodel.cxx svx/source/svdraw/svdoashp.cxx svx/source/svdraw/svdobj.cxx svx/source/svdraw/svdocapt.cxx svx/source/svdraw/svdocirc.cxx svx/source/svdraw/svdoedge.cxx svx/source/svdraw/svdograf.cxx svx/source/svdraw/svdogrp.cxx svx/source/svdraw/svdomeas.cxx svx/source/svdraw/svdomedia.cxx svx/source/svdraw/svdopath.cxx svx/source/svdraw/svdotext.cxx svx/source/svdraw/svdotxdr.cxx svx/source/svdraw/svdotxed.cxx svx/source/svdraw/svdotxfl.cxx svx/source/svdraw/svdotxln.cxx svx/source/svdraw/svdotxtr.cxx svx/source/svdraw/svdoutl.cxx svx/source/svdraw/svdpage.cxx svx/source/svdraw/svdpagv.cxx svx/source/svdraw/svdpntv.cxx svx/source/svdraw/svdpoev.cxx svx/source/svdraw/svdsnpv.cxx svx/source/svdraw/svdstr.src svx/source/svdraw/svdtrans.cxx svx/source/svdraw/svdundo.cxx svx/source/svdraw/svdview.cxx svx/source/svdraw/svdxcgv.cxx svx/source/table/svdotable.cxx svx/source/tbxctrls/colorwindow.hxx svx/source/tbxctrls/extrusioncontrols.cxx svx/source/tbxctrls/fillctrl.cxx svx/source/tbxctrls/grafctrl.cxx svx/source/tbxctrls/itemwin.cxx svx/source/tbxctrls/layctrl.cxx svx/source/tbxctrls/lboxctrl.cxx svx/source/tbxctrls/linectrl.cxx svx/source/tbxctrls/tbcontrl.cxx svx/source/tbxctrls/verttexttbxctrl.cxx svx/source/unodraw/unomod.cxx svx/source/unodraw/unopage.cxx svx/source/unodraw/unoprov.cxx svx/source/unodraw/unoshape.cxx svx/source/unodraw/unoshtxt.cxx svx/source/xml/xmlxtexp.cxx svx/source/xoutdev/_xpoly.cxx svx/source/xoutdev/xattr.cxx svx/source/xoutdev/xattr2.cxx svx/source/xoutdev/xattrbmp.cxx svx/source/xoutdev/xtabcolr.cxx svx/util/makefile.mk svx/workben/edittest.cxx sysui/desktop/productversion.mk ucb/prj/build.lst ucb/source/cacher/cacheserv.cxx ucb/source/core/ucb1.component ucb/source/core/ucbserv.cxx ucb/source/core/ucbstore.cxx ucb/source/core/ucbstore.hxx ucb/source/sorter/sortmain.cxx ucb/source/ucp/file/prov.cxx ucb/source/ucp/file/shell.cxx ucb/source/ucp/ftp/ftpservices.cxx ucb/source/ucp/gio/gio_provider.cxx ucb/source/ucp/gvfs/gvfs_provider.cxx ucb/source/ucp/hierarchy/hierarchyservices.cxx ucb/source/ucp/odma/odma_lib.cxx ucb/source/ucp/odma/odma_services.cxx ucb/source/ucp/package/pkgservices.cxx ucb/source/ucp/tdoc/tdoc_services.cxx ucb/source/ucp/webdav/ContentProperties.cxx ucb/source/ucp/webdav/NeonHeadRequest.cxx ucb/source/ucp/webdav/webdavcontent.cxx ucb/source/ucp/webdav/webdavservices.cxx uui/source/iahndl.cxx uui/source/iahndl.hxx uui/source/loginerr.hxx uui/source/nameclashdlg.hxx uui/source/passcrtdlg.cxx uui/source/passworddlg.cxx uui/source/passworddlg.hxx uui/source/services.cxx vbahelper/inc/vbahelper/vbahelper.hxx vbahelper/prj/build.lst vbahelper/prj/d.lst vbahelper/source/msforms/makefile.mk vbahelper/source/msforms/vbauserform.cxx vbahelper/source/vbahelper/makefile.mk vbahelper/source/vbahelper/vbaapplicationbase.cxx vbahelper/source/vbahelper/vbacommandbarcontrol.cxx vbahelper/source/vbahelper/vbadocumentbase.cxx vbahelper/source/vbahelper/vbadocumentsbase.cxx vbahelper/source/vbahelper/vbahelper.cxx vbahelper/util/makefile.mk xmlhelp/source/cxxhelp/provider/databases.cxx xmlhelp/source/cxxhelp/provider/services.cxx xmlhelp/source/treeview/tvfactory.cxx xmloff/JunitTest_xmloff_unoapi.mk xmloff/inc/functional.hxx xmloff/inc/xmloff/formlayerexport.hxx xmloff/inc/xmloff/formlayerimport.hxx xmloff/inc/xmloff/functional.hxx xmloff/inc/xmloff/shapeimport.hxx xmloff/inc/xmloff/xmlcnitm.hxx xmloff/inc/xmloff/xmlnumfi.hxx xmloff/prj/build.lst xmloff/source/chart/SchXMLChartContext.cxx xmloff/source/chart/SchXMLExport.cxx xmloff/source/chart/SchXMLImport.cxx xmloff/source/chart/SchXMLLegendContext.hxx xmloff/source/chart/SchXMLPlotAreaContext.cxx xmloff/source/core/xmluconv.cxx xmloff/source/draw/sdxmlexp.cxx xmloff/source/draw/shapeexport4.cxx xmloff/source/draw/ximp3dobject.cxx xmloff/source/draw/ximp3dscene.cxx xmloff/source/forms/formlayerexport.cxx xmloff/source/forms/formlayerimport.cxx xmloff/source/forms/handler/vcl_time_handler.hxx xmloff/source/forms/layerimport.cxx xmloff/source/forms/layerimport.hxx xmloff/source/forms/property_meta_data.hxx xmloff/source/style/PageHeaderFooterContext.cxx xmloff/source/style/PageMasterStyleMap.cxx xmloff/source/style/prstylei.cxx xmloff/source/style/xmlimppr.cxx xmloff/source/style/xmlnumfi.cxx xmloff/source/style/xmlstyle.cxx xmloff/source/table/tabledesignsimporter.cxx xmloff/source/text/XMLTextNumRuleInfo.cxx xmloff/source/text/XMLTextShapeStyleContext.cxx xmloff/source/text/txtstyle.cxx xmloff/source/transform/ChartOOoTContext.cxx xmloff/source/transform/EventOOoTContext.cxx xmloff/source/transform/TransformerBase.cxx xmloff/util/makefile.mk xmlscript/util/xcr.component
2011-03-12 02:42:58 +01:00
sal_uInt16 nMods = pMods ? pMods->Count() : 0;
for( sal_uInt16 i = 0; i < nMods; i++ )
{
SbModule* p = (SbModule*) pMods->Get( i );
if ( p )
if ( p->HasExeCode() )
return true;
}
}
return false;
}
void BasicManager::Init()
{
DBG_CHKTHIS( BasicManager, 0 );
pLibs = new BasicLibs;
mpImpl = new BasicManagerImpl();
}
BasicLibInfo* BasicManager::CreateLibInfo()
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = new BasicLibInfo;
pLibs->Insert( pInf );
return pInf;
}
sal_Bool BasicManager::ImpLoadLibrary( BasicLibInfo* pLibInfo, SotStorage* pCurStorage, sal_Bool bInfosOnly )
{
DBG_CHKTHIS( BasicManager, 0 );
DBG_ASSERT( pLibInfo, "LibInfo!?" );
OUString aStorageName( pLibInfo->GetStorageName() );
if ( aStorageName.isEmpty() || ( aStorageName.equalsAscii(szImbedded) ) )
{
aStorageName = GetStorageName();
}
SotStorageRef xStorage;
// The current must not be opened again...
if ( pCurStorage )
{
OUString aStorName( pCurStorage->GetName() );
// #i13114 removed, DBG_ASSERT( aStorName.Len(), "No Storage Name!" );
INetURLObject aCurStorageEntry(aStorName, INET_PROT_FILE);
// #i13114 removed, DBG_ASSERT(aCurStorageEntry.GetMainURL( INetURLObject::NO_DECODE ).Len() != 0, "Bad storage name");
INetURLObject aStorageEntry(aStorageName, INET_PROT_FILE);
// #i13114 removed, DBG_ASSERT(aCurStorageEntry.GetMainURL( INetURLObject::NO_DECODE ).Len() != 0, "Bad storage name");
if ( aCurStorageEntry == aStorageEntry )
{
xStorage = pCurStorage;
}
}
if ( !xStorage.Is() )
{
xStorage = new SotStorage( false, aStorageName, eStorageReadMode );
}
SotStorageRef xBasicStorage = xStorage->OpenSotStorage( OUString(szBasicStorage), eStorageReadMode, sal_False );
if ( !xBasicStorage.Is() || xBasicStorage->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_MGROPEN, xStorage->GetName(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName()));
}
else
{
// In the Basic-Storage every lib is in a Stream...
SotStorageStreamRef xBasicStream = xBasicStorage->OpenSotStream( pLibInfo->GetLibName(), eStreamReadMode );
if ( !xBasicStream.Is() || xBasicStream->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD , pLibInfo->GetLibName(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTREAM, pLibInfo->GetLibName()));
}
else
{
sal_Bool bLoaded = sal_False;
if ( xBasicStream->Seek( STREAM_SEEK_TO_END ) != 0 )
{
if ( !bInfosOnly )
{
if ( !pLibInfo->GetLib().Is() )
{
pLibInfo->SetLib( new StarBASIC( GetStdLib(), mbDocMgr ) );
}
xBasicStream->SetBufferSize( 1024 );
xBasicStream->Seek( STREAM_SEEK_TO_BEGIN );
bLoaded = ImplLoadBasic( *xBasicStream, pLibInfo->GetLibRef() );
xBasicStream->SetBufferSize( 0 );
StarBASICRef xStdLib = pLibInfo->GetLib();
xStdLib->SetName( pLibInfo->GetLibName() );
xStdLib->SetModified( sal_False );
xStdLib->SetFlag( SBX_DONTSTORE );
}
else
{
// Skip Basic...
xBasicStream->Seek( STREAM_SEEK_TO_BEGIN );
ImplEncryptStream( *xBasicStream );
SbxBase::Skip( *xBasicStream );
bLoaded = sal_True;
}
}
if ( !bLoaded )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, pLibInfo->GetLibName(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_BASICLOADERROR, pLibInfo->GetLibName()));
}
else
{
// Perhaps there are additional information in the stream...
xBasicStream->SetCryptMaskKey(szCryptingKey);
xBasicStream->RefreshBuffer();
sal_uInt32 nPasswordMarker = 0;
xBasicStream->ReadUInt32( nPasswordMarker );
if ( ( nPasswordMarker == PASSWORD_MARKER ) && !xBasicStream->IsEof() )
{
OUString aPassword = xBasicStream->ReadUniOrByteString(
xBasicStream->GetStreamCharSet());
pLibInfo->SetPassword( aPassword );
}
xBasicStream->SetCryptMaskKey(OString());
CheckModules( pLibInfo->GetLib(), pLibInfo->IsReference() );
}
return bLoaded;
}
}
return sal_False;
}
sal_Bool BasicManager::ImplEncryptStream( SvStream& rStrm ) const
{
sal_Size nPos = rStrm.Tell();
sal_uInt32 nCreator;
rStrm.ReadUInt32( nCreator );
rStrm.Seek( nPos );
sal_Bool bProtected = sal_False;
if ( nCreator != SBXCR_SBX )
{
// Should only be the case for encrypted Streams
bProtected = sal_True;
rStrm.SetCryptMaskKey(szCryptingKey);
rStrm.RefreshBuffer();
}
return bProtected;
}
// This code is necessary to load the BASIC of Beta 1
// TODO: Which Beta 1?
sal_Bool BasicManager::ImplLoadBasic( SvStream& rStrm, StarBASICRef& rOldBasic ) const
{
sal_Bool bProtected = ImplEncryptStream( rStrm );
SbxBaseRef xNew = SbxBase::Load( rStrm );
sal_Bool bLoaded = sal_False;
if( xNew.Is() )
{
if( xNew->IsA( TYPE(StarBASIC) ) )
{
StarBASIC* pNew = (StarBASIC*)(SbxBase*) xNew;
// Use the Parent of the old BASICs
if( rOldBasic.Is() )
{
pNew->SetParent( rOldBasic->GetParent() );
if( pNew->GetParent() )
{
pNew->GetParent()->Insert( pNew );
}
pNew->SetFlag( SBX_EXTSEARCH );
}
rOldBasic = pNew;
// Fill new libray container (5.2 -> 6.0)
copyToLibraryContainer( pNew, mpImpl->maContainerInfo );
pNew->SetModified( sal_False );
bLoaded = sal_True;
}
}
if ( bProtected )
{
rStrm.SetCryptMaskKey(OString());
}
return bLoaded;
}
void BasicManager::CheckModules( StarBASIC* pLib, sal_Bool bReference ) const
{
if ( !pLib )
{
return;
}
sal_Bool bModified = pLib->IsModified();
for ( sal_uInt16 nMod = 0; nMod < pLib->GetModules()->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pLib->GetModules()->Get( nMod );
DBG_ASSERT( pModule, "Module not received!" );
if ( !pModule->IsCompiled() && !StarBASIC::GetErrorCode() )
{
pLib->Compile( pModule );
}
}
// #67477, AB 8.12.99 On demand compile in referenced libs should not
// cause modified
if( !bModified && bReference )
{
OSL_FAIL( "Referenced basic library is not compiled!" );
pLib->SetModified( sal_False );
}
}
StarBASIC* BasicManager::AddLib( SotStorage& rStorage, const OUString& rLibName, sal_Bool bReference )
{
DBG_CHKTHIS( BasicManager, 0 );
OUString aStorName( rStorage.GetName() );
DBG_ASSERT( !aStorName.isEmpty(), "No Storage Name!" );
OUString aStorageName = INetURLObject(aStorName, INET_PROT_FILE).GetMainURL( INetURLObject::NO_DECODE );
DBG_ASSERT(!aStorageName.isEmpty(), "Bad storage name");
OUString aNewLibName( rLibName );
while ( HasLib( aNewLibName ) )
{
aNewLibName += "_";
}
BasicLibInfo* pLibInfo = CreateLibInfo();
// Use original name otherwise ImpLoadLibrary failes...
pLibInfo->SetLibName( rLibName );
// but doesn't work this way if name exists twice
sal_uInt16 nLibId = (sal_uInt16) pLibs->GetPos( pLibInfo );
// Set StorageName before load because it is compared with pCurStorage
pLibInfo->SetStorageName( aStorageName );
sal_Bool bLoaded = ImpLoadLibrary( pLibInfo, &rStorage );
if ( bLoaded )
{
if ( aNewLibName != rLibName )
{
SetLibName( nLibId, aNewLibName );
}
if ( bReference )
{
pLibInfo->GetLib()->SetModified( sal_False ); // Don't save in this case
pLibInfo->SetRelStorageName( OUString() );
pLibInfo->IsReference() = sal_True;
}
else
{
pLibInfo->GetLib()->SetModified( sal_True ); // Must be saved after Add!
pLibInfo->SetStorageName( OUString(szImbedded) ); // Save in BasicManager-Storage
}
}
else
{
RemoveLib( nLibId, sal_False );
pLibInfo = 0;
}
return pLibInfo ? &*pLibInfo->GetLib() : 0;
}
sal_Bool BasicManager::IsReference( sal_uInt16 nLib )
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
{
return pLibInfo->IsReference();
}
return sal_False;
}
sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib )
{
// Only pyhsical deletion if no reference
return RemoveLib( nLib, !IsReference( nLib ) );
}
sal_Bool BasicManager::RemoveLib( sal_uInt16 nLib, sal_Bool bDelBasicFromStorage )
{
DBG_CHKTHIS( BasicManager, 0 );
DBG_ASSERT( nLib, "Standard-Lib cannot be removed!" );
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib not found!" );
if ( !pLibInfo || !nLib )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_STDLIB, pLibInfo->GetLibName()));
return sal_False;
}
// If one of the streams cannot be opened, this is not an error,
// because BASIC was never written before...
if ( bDelBasicFromStorage && !pLibInfo->IsReference() &&
( !pLibInfo->IsExtern() || SotStorage::IsStorageFile( pLibInfo->GetStorageName() ) ) )
{
SotStorageRef xStorage;
if ( !pLibInfo->IsExtern() )
{
xStorage = new SotStorage( false, GetStorageName() );
}
else
{
xStorage = new SotStorage( false, pLibInfo->GetStorageName() );
}
if ( xStorage->IsStorage( OUString(szBasicStorage) ) )
{
SotStorageRef xBasicStorage = xStorage->OpenSotStorage
( OUString(szBasicStorage), STREAM_STD_READWRITE, sal_False );
if ( !xBasicStorage.Is() || xBasicStorage->GetError() )
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_REMOVELIB, OUString(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_OPENLIBSTORAGE, pLibInfo->GetLibName()));
}
else if ( xBasicStorage->IsStream( pLibInfo->GetLibName() ) )
{
xBasicStorage->Remove( pLibInfo->GetLibName() );
xBasicStorage->Commit();
// If no further stream available,
// delete the SubStorage.
SvStorageInfoList aInfoList;
xBasicStorage->FillInfoList( &aInfoList );
if ( aInfoList.empty() )
{
xBasicStorage.Clear();
xStorage->Remove( OUString(szBasicStorage) );
xStorage->Commit();
// If no further Streams or SubStorages available,
// delete the Storage, too.
aInfoList.clear();
xStorage->FillInfoList( &aInfoList );
if ( aInfoList.empty() )
{
//OUString aName_( xStorage->GetName() );
xStorage.Clear();
//*** TODO: Replace if still necessary
//SfxContentHelper::Kill( aName );
//*** TODO-End
}
}
}
}
}
if ( pLibInfo->GetLib().Is() )
{
GetStdLib()->Remove( pLibInfo->GetLib() );
}
delete pLibs->Remove( pLibInfo );
return sal_True; // Remove was successful, del unimportant
}
sal_uInt16 BasicManager::GetLibCount() const
{
DBG_CHKTHIS( BasicManager, 0 );
return (sal_uInt16)pLibs->Count();
}
StarBASIC* BasicManager::GetLib( sal_uInt16 nLib ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->GetObject( nLib );
DBG_ASSERT( pInf, "Lib does not exist!" );
if ( pInf )
{
return pInf->GetLib();
}
return 0;
}
StarBASIC* BasicManager::GetStdLib() const
{
DBG_CHKTHIS( BasicManager, 0 );
StarBASIC* pLib = GetLib( 0 );
return pLib;
}
StarBASIC* BasicManager::GetLib( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
if ( pInf->GetLibName().equalsIgnoreAsciiCase( rName ))// Check if available...
{
return pInf->GetLib();
}
pInf = pLibs->Next();
}
return 0;
}
sal_uInt16 BasicManager::GetLibId( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
if ( pInf->GetLibName().equalsIgnoreAsciiCase( rName ))
{
return (sal_uInt16)pLibs->GetCurPos();
}
pInf = pLibs->Next();
}
return LIB_NOTFOUND;
}
sal_Bool BasicManager::HasLib( const OUString& rName ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
if ( pInf->GetLibName().equalsIgnoreAsciiCase(rName))
{
return sal_True;
}
pInf = pLibs->Next();
}
return sal_False;
}
sal_Bool BasicManager::SetLibName( sal_uInt16 nLib, const OUString& rName )
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
{
pLibInfo->SetLibName( rName );
if ( pLibInfo->GetLib().Is() )
{
StarBASICRef xStdLib = pLibInfo->GetLib();
xStdLib->SetName( rName );
xStdLib->SetModified( sal_True );
}
return sal_True;
}
return sal_False;
}
OUString BasicManager::GetLibName( sal_uInt16 nLib )
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
{
return pLibInfo->GetLibName();
}
return OUString();
}
sal_Bool BasicManager::LoadLib( sal_uInt16 nLib )
{
DBG_CHKTHIS( BasicManager, 0 );
sal_Bool bDone = sal_False;
BasicLibInfo* pLibInfo = pLibs->GetObject( nLib );
DBG_ASSERT( pLibInfo, "Lib?!" );
if ( pLibInfo )
{
uno::Reference< script::XLibraryContainer > xLibContainer = pLibInfo->GetLibraryContainer();
if( xLibContainer.is() )
{
OUString aLibName = pLibInfo->GetLibName();
xLibContainer->loadLibrary( aLibName );
bDone = xLibContainer->isLibraryLoaded( aLibName );;
}
else
{
bDone = ImpLoadLibrary( pLibInfo, NULL, sal_False );
StarBASIC* pLib = GetLib( nLib );
if ( pLib )
{
GetStdLib()->Insert( pLib );
pLib->SetFlag( SBX_EXTSEARCH );
}
}
}
else
{
StringErrorInfo* pErrInf = new StringErrorInfo( ERRCODE_BASMGR_LIBLOAD, OUString(), ERRCODE_BUTTON_OK );
aErrors.push_back(BasicError(*pErrInf, BASERR_REASON_LIBNOTFOUND, OUString::number(nLib)));
}
return bDone;
}
StarBASIC* BasicManager::CreateLib( const OUString& rLibName )
{
DBG_CHKTHIS( BasicManager, 0 );
if ( GetLib( rLibName ) )
{
return 0;
}
BasicLibInfo* pLibInfo = CreateLibInfo();
StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr );
GetStdLib()->Insert( pNew );
pNew->SetFlag( SBX_EXTSEARCH | SBX_DONTSTORE );
pLibInfo->SetLib( pNew );
pLibInfo->SetLibName( rLibName );
pLibInfo->GetLib()->SetName( rLibName );
return pLibInfo->GetLib();
}
// For XML import/export:
StarBASIC* BasicManager::CreateLib( const OUString& rLibName, const OUString& Password,
const OUString& LinkTargetURL )
{
// Ask if lib exists because standard lib is always there
StarBASIC* pLib = GetLib( rLibName );
if( !pLib )
{
if( !LinkTargetURL.isEmpty())
{
SotStorageRef xStorage = new SotStorage( false, LinkTargetURL, STREAM_READ | STREAM_SHARE_DENYWRITE );
if( !xStorage->GetError() )
{
pLib = AddLib( *xStorage, rLibName, sal_True );
}
DBG_ASSERT( pLib, "XML Import: Linked basic library could not be loaded");
}
else
{
pLib = CreateLib( rLibName );
if( Password.isEmpty())
{
BasicLibInfo* pLibInfo = FindLibInfo( pLib );
pLibInfo ->SetPassword( Password );
}
}
//ExternalSourceURL ?
}
return pLib;
}
StarBASIC* BasicManager::CreateLibForLibContainer( const OUString& rLibName,
const uno::Reference< script::XLibraryContainer >& xScriptCont )
{
DBG_CHKTHIS( BasicManager, 0 );
if ( GetLib( rLibName ) )
{
return 0;
}
BasicLibInfo* pLibInfo = CreateLibInfo();
StarBASIC* pNew = new StarBASIC( GetStdLib(), mbDocMgr );
GetStdLib()->Insert( pNew );
pNew->SetFlag( SBX_EXTSEARCH | SBX_DONTSTORE );
pLibInfo->SetLib( pNew );
pLibInfo->SetLibName( rLibName );
pLibInfo->GetLib()->SetName( rLibName );
pLibInfo->SetLibraryContainer( xScriptCont );
return pNew;
}
BasicLibInfo* BasicManager::FindLibInfo( StarBASIC* pBasic ) const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = ((BasicManager*)this)->pLibs->First();
while ( pInf )
{
if ( pInf->GetLib() == pBasic )
{
return pInf;
}
pInf = ((BasicManager*)this)->pLibs->Next();
}
return 0;
}
sal_Bool BasicManager::IsBasicModified() const
{
DBG_CHKTHIS( BasicManager, 0 );
BasicLibInfo* pInf = pLibs->First();
while ( pInf )
{
if ( pInf->GetLib().Is() && pInf->GetLib()->IsModified() )
{
return sal_True;
}
pInf = pLibs->Next();
}
return sal_False;
}
std::vector<BasicError>& BasicManager::GetErrors()
{
return aErrors;
}
bool BasicManager::GetGlobalUNOConstant( const sal_Char* _pAsciiName, uno::Any& aOut )
{
bool bRes = false;
StarBASIC* pStandardLib = GetStdLib();
OSL_PRECOND( pStandardLib, "BasicManager::GetGlobalUNOConstant: no lib to read from!" );
if ( pStandardLib )
bRes = pStandardLib->GetUNOConstant( _pAsciiName, aOut );
return bRes;
}
uno::Any BasicManager::SetGlobalUNOConstant( const sal_Char* _pAsciiName, const uno::Any& _rValue )
{
uno::Any aOldValue;
StarBASIC* pStandardLib = GetStdLib();
OSL_PRECOND( pStandardLib, "BasicManager::SetGlobalUNOConstant: no lib to insert into!" );
if ( !pStandardLib )
return aOldValue;
OUString sVarName( OUString::createFromAscii( _pAsciiName ) );
// obtain the old value
SbxVariable* pVariable = pStandardLib->Find( sVarName, SbxCLASS_OBJECT );
if ( pVariable )
aOldValue = sbxToUnoValue( pVariable );
SbxObjectRef xUnoObj = GetSbUnoObject( sVarName, _rValue );
xUnoObj->SetFlag( SBX_DONTSTORE );
pStandardLib->Insert( xUnoObj );
return aOldValue;
}
bool BasicManager::LegacyPsswdBinaryLimitExceeded( uno::Sequence< OUString >& _out_rModuleNames )
{
try
{
uno::Reference< container::XNameAccess > xScripts( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
uno::Reference< script::XLibraryContainerPassword > xPassword( GetScriptLibraryContainer(), uno::UNO_QUERY_THROW );
uno::Sequence< OUString > aNames( xScripts->getElementNames() );
const OUString* pNames = aNames.getConstArray();
const OUString* pNamesEnd = aNames.getConstArray() + aNames.getLength();
for ( ; pNames != pNamesEnd; ++pNames )
{
if( !xPassword->isLibraryPasswordProtected( *pNames ) )
continue;
StarBASIC* pBasicLib = GetLib( *pNames );
if ( !pBasicLib )
continue;
uno::Reference< container::XNameAccess > xScriptLibrary( xScripts->getByName( *pNames ), uno::UNO_QUERY_THROW );
uno::Sequence< OUString > aElementNames( xScriptLibrary->getElementNames() );
sal_Int32 nLen = aElementNames.getLength();
uno::Sequence< OUString > aBigModules( nLen );
sal_Int32 nBigModules = 0;
const OUString* pElementNames = aElementNames.getConstArray();
const OUString* pElementNamesEnd = aElementNames.getConstArray() + aElementNames.getLength();
for ( ; pElementNames != pElementNamesEnd; ++pElementNames )
{
SbModule* pMod = pBasicLib->FindModule( *pElementNames );
if ( pMod && pMod->ExceedsLegacyModuleSize() )
aBigModules[ nBigModules++ ] = *pElementNames;
}
if ( nBigModules )
{
aBigModules.realloc( nBigModules );
_out_rModuleNames = aBigModules;
return true;
}
}
}
catch( const uno::Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
return false;
}
namespace
{
SbMethod* lcl_queryMacro( BasicManager* i_manager, OUString const& i_fullyQualifiedName )
{
sal_Int32 nLast = 0;
const OUString sParse = i_fullyQualifiedName;
OUString sLibName = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
OUString sModule = sParse.getToken( (sal_Int32)0, (sal_Unicode)'.', nLast );
OUString sMacro;
if(nLast >= 0)
{
sMacro = OUString(sParse.getStr() + nLast, sParse.getLength() - nLast );
}
else
{
sMacro = sParse;
}
2012-02-11 21:25:24 +00:00
utl::TransliterationWrapper& rTransliteration = SbGlobal::GetTransliteration();
sal_uInt16 nLibCount = i_manager->GetLibCount();
for ( sal_uInt16 nLib = 0; nLib < nLibCount; ++nLib )
{
2012-02-11 21:25:24 +00:00
if ( rTransliteration.isEqual( i_manager->GetLibName( nLib ), sLibName ) )
{
StarBASIC* pLib = i_manager->GetLib( nLib );
if( !pLib )
{
i_manager->LoadLib( nLib );
pLib = i_manager->GetLib( nLib );
}
if( pLib )
{
sal_uInt16 nModCount = pLib->GetModules()->Count();
for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod )
{
SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod );
2012-02-11 21:25:24 +00:00
if ( pMod && rTransliteration.isEqual( pMod->GetName(), sModule ) )
{
SbMethod* pMethod = (SbMethod*)pMod->Find( sMacro, SbxCLASS_METHOD );
if( pMethod )
{
return pMethod;
}
}
}
}
}
}
return 0;
}
}
bool BasicManager::HasMacro( OUString const& i_fullyQualifiedName ) const
{
return ( NULL != lcl_queryMacro( const_cast< BasicManager* >( this ), i_fullyQualifiedName ) );
}
ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, SbxArray* i_arguments, SbxValue* i_retValue )
{
SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName );
ErrCode nError = 0;
if ( pMethod )
{
if ( i_arguments )
pMethod->SetParameters( i_arguments );
nError = pMethod->Call( i_retValue );
}
else
nError = ERRCODE_BASIC_PROC_UNDEFINED;
return nError;
}
ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, OUString const& i_commaSeparatedArgs, SbxValue* i_retValue )
{
SbMethod* pMethod = lcl_queryMacro( this, i_fullyQualifiedName );
if ( !pMethod )
{
return ERRCODE_BASIC_PROC_UNDEFINED;
}
// arguments must be quoted
OUString sQuotedArgs;
OUStringBuffer sArgs( i_commaSeparatedArgs );
if ( sArgs.getLength()<2 || sArgs[1] == '\"')
{
// no args or already quoted args
sQuotedArgs = sArgs.makeStringAndClear();
}
else
{
// quote parameters
sArgs.remove( 0, 1 );
sArgs.remove( sArgs.getLength() - 1, 1 );
sQuotedArgs = "(";
OUString sArgs2 = sArgs.makeStringAndClear();
sal_Int32 nCount = comphelper::string::getTokenCount(sArgs2, ',');
for (sal_Int32 n = 0; n < nCount; ++n)
{
sQuotedArgs += "\"";
sQuotedArgs += comphelper::string::getToken(sArgs2, n, ',');
sQuotedArgs += "\"";
if ( n < nCount - 1 )
{
sQuotedArgs += ",";
}
}
sQuotedArgs += ")";
}
// add quoted arguments and do the call
OUString sCall;
sCall += "[";
sCall += pMethod->GetName();
sCall += sQuotedArgs;
sCall += "]";
SbxVariable* pRet = pMethod->GetParent()->Execute( sCall );
if ( pRet && ( pRet != pMethod ) )
{
*i_retValue = *pRet;
}
return SbxBase::GetError();
}
//=====================================================================
class ModuleInfo_Impl : public ModuleInfoHelper
{
OUString maName;
OUString maLanguage;
OUString maSource;
public:
ModuleInfo_Impl( const OUString& aName, const OUString& aLanguage, const OUString& aSource )
: maName( aName ), maLanguage( aLanguage), maSource( aSource ) {}
// Methods XStarBasicModuleInfo
virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
virtual OUString SAL_CALL getLanguage() throw(uno::RuntimeException)
{ return maLanguage; }
virtual OUString SAL_CALL getSource() throw(uno::RuntimeException)
{ return maSource; }
};
//=====================================================================
class DialogInfo_Impl : public DialogInfoHelper
{
OUString maName;
uno::Sequence< sal_Int8 > mData;
public:
DialogInfo_Impl( const OUString& aName, uno::Sequence< sal_Int8 > Data )
: maName( aName ), mData( Data ) {}
// Methods XStarBasicDialogInfo
virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
virtual uno::Sequence< sal_Int8 > SAL_CALL getData() throw(uno::RuntimeException)
{ return mData; }
};
//=====================================================================
class LibraryInfo_Impl : public LibraryInfoHelper
{
OUString maName;
uno::Reference< container::XNameContainer > mxModuleContainer;
uno::Reference< container::XNameContainer > mxDialogContainer;
OUString maPassword;
OUString maExternaleSourceURL;
OUString maLinkTargetURL;
public:
LibraryInfo_Impl
(
const OUString& aName,
uno::Reference< container::XNameContainer > xModuleContainer,
uno::Reference< container::XNameContainer > xDialogContainer,
const OUString& aPassword,
const OUString& aExternaleSourceURL,
const OUString& aLinkTargetURL
)
: maName( aName )
, mxModuleContainer( xModuleContainer )
, mxDialogContainer( xDialogContainer )
, maPassword( aPassword )
, maExternaleSourceURL( aExternaleSourceURL )
, maLinkTargetURL( aLinkTargetURL )
{}
// Methods XStarBasicLibraryInfo
virtual OUString SAL_CALL getName() throw(uno::RuntimeException)
{ return maName; }
virtual uno::Reference< container::XNameContainer > SAL_CALL getModuleContainer() throw(uno::RuntimeException)
{ return mxModuleContainer; }
virtual uno::Reference< container::XNameContainer > SAL_CALL getDialogContainer() throw(uno::RuntimeException)
{ return mxDialogContainer; }
virtual OUString SAL_CALL getPassword() throw(uno::RuntimeException)
{ return maPassword; }
virtual OUString SAL_CALL getExternalSourceURL() throw(uno::RuntimeException)
{ return maExternaleSourceURL; }
virtual OUString SAL_CALL getLinkTargetURL() throw(uno::RuntimeException)
{ return maLinkTargetURL; }
};
//=====================================================================
class ModuleContainer_Impl : public NameContainerHelper
{
StarBASIC* mpLib;
public:
ModuleContainer_Impl( StarBASIC* pLib )
:mpLib( pLib ) {}
// Methods XElementAccess
virtual uno::Type SAL_CALL getElementType()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements()
throw(uno::RuntimeException);
// Methods XNameAccess
virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException,
lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException,
lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
// Methods XElementAccess
uno::Type ModuleContainer_Impl::getElementType()
throw(uno::RuntimeException)
{
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicModuleInfo > *)0 );
return aModuleType;
}
sal_Bool ModuleContainer_Impl::hasElements()
throw(uno::RuntimeException)
{
SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL;
return pMods && pMods->Count() > 0;
}
// Methods XNameAccess
uno::Any ModuleContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL;
if( !pMod )
throw container::NoSuchElementException();
uno::Reference< script::XStarBasicModuleInfo > xMod = (XStarBasicModuleInfo*)new ModuleInfo_Impl
( aName, OUString::createFromAscii( szScriptLanguage ), pMod->GetSource32() );
uno::Any aRetAny;
aRetAny <<= xMod;
return aRetAny;
}
uno::Sequence< OUString > ModuleContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
SbxArray* pMods = mpLib ? mpLib->GetModules() : NULL;
sal_uInt16 nMods = pMods ? pMods->Count() : 0;
uno::Sequence< OUString > aRetSeq( nMods );
OUString* pRetSeq = aRetSeq.getArray();
for( sal_uInt16 i = 0 ; i < nMods ; i++ )
{
SbxVariable* pMod = pMods->Get( i );
pRetSeq[i] = OUString( pMod->GetName() );
}
return aRetSeq;
}
sal_Bool ModuleContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( aName ) : NULL;
sal_Bool bRet = (pMod != NULL);
return bRet;
}
// Methods XNameReplace
void ModuleContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
insertByName( aName, aElement );
}
// Methods XNameContainer
void ModuleContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicModuleInfo > *)0 );
uno::Type aAnyType = aElement.getValueType();
if( aModuleType != aAnyType )
{
throw lang::IllegalArgumentException();
}
uno::Reference< script::XStarBasicModuleInfo > xMod;
aElement >>= xMod;
mpLib->MakeModule32( aName, xMod->getSource() );
}
void ModuleContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbModule* pMod = mpLib ? mpLib->FindModule( Name ) : NULL;
if( !pMod )
{
throw container::NoSuchElementException();
}
mpLib->Remove( pMod );
}
//=====================================================================
uno::Sequence< sal_Int8 > implGetDialogData( SbxObject* pDialog )
{
SvMemoryStream aMemStream;
pDialog->Store( aMemStream );
sal_Size nLen = aMemStream.Tell();
uno::Sequence< sal_Int8 > aData( nLen );
sal_Int8* pDestData = aData.getArray();
const sal_Int8* pSrcData = (const sal_Int8*)aMemStream.GetData();
memcpy( pDestData, pSrcData, nLen );
return aData;
}
SbxObject* implCreateDialog( uno::Sequence< sal_Int8 > aData )
{
sal_Int8* pData = aData.getArray();
SvMemoryStream aMemStream( pData, aData.getLength(), STREAM_READ );
SbxBase* pBase = SbxBase::Load( aMemStream );
return dynamic_cast<SbxObject*>(pBase);
}
// HACK! Because this value is defined in basctl/inc/vcsbxdef.hxx
// which we can't include here, we have to use the value directly
#define SBXID_DIALOG 101
class DialogContainer_Impl : public NameContainerHelper
{
StarBASIC* mpLib;
public:
DialogContainer_Impl( StarBASIC* pLib )
:mpLib( pLib ) {}
// Methods XElementAccess
virtual uno::Type SAL_CALL getElementType()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements()
throw(uno::RuntimeException);
// Methods XNameAccess
virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
// Methods XElementAccess
uno::Type DialogContainer_Impl::getElementType()
throw(uno::RuntimeException)
{
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicDialogInfo > *)0 );
return aModuleType;
}
sal_Bool DialogContainer_Impl::hasElements()
throw(uno::RuntimeException)
{
sal_Bool bRet = sal_False;
mpLib->GetAll( SbxCLASS_OBJECT );
sal_Int16 nCount = mpLib->GetObjects()->Count();
for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ )
{
SbxVariable* pVar = mpLib->GetObjects()->Get( nObj );
if ( pVar->ISA( SbxObject ) && ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) )
{
bRet = sal_True;
break;
}
}
return bRet;
}
// Methods XNameAccess
uno::Any DialogContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE );
if( !( pVar && pVar->ISA( SbxObject ) &&
( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) )
{
throw container::NoSuchElementException();
}
uno::Reference< script::XStarBasicDialogInfo > xDialog =
(XStarBasicDialogInfo*)new DialogInfo_Impl
( aName, implGetDialogData( (SbxObject*)pVar ) );
uno::Any aRetAny;
aRetAny <<= xDialog;
return aRetAny;
}
uno::Sequence< OUString > DialogContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
mpLib->GetAll( SbxCLASS_OBJECT );
sal_Int16 nCount = mpLib->GetObjects()->Count();
uno::Sequence< OUString > aRetSeq( nCount );
OUString* pRetSeq = aRetSeq.getArray();
sal_Int32 nDialogCounter = 0;
for( sal_Int16 nObj = 0; nObj < nCount ; nObj++ )
{
SbxVariable* pVar = mpLib->GetObjects()->Get( nObj );
if ( pVar->ISA( SbxObject ) && ( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) )
{
pRetSeq[ nDialogCounter ] = OUString( pVar->GetName() );
nDialogCounter++;
}
}
aRetSeq.realloc( nDialogCounter );
return aRetSeq;
}
sal_Bool DialogContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
sal_Bool bRet = sal_False;
SbxVariable* pVar = mpLib->GetObjects()->Find( aName, SbxCLASS_DONTCARE );
if( pVar && pVar->ISA( SbxObject ) &&
( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) )
{
bRet = sal_True;
}
return bRet;
}
// Methods XNameReplace
void DialogContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
insertByName( aName, aElement );
}
// Methods XNameContainer
void DialogContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)aName;
uno::Type aModuleType = ::getCppuType( (const uno::Reference< script::XStarBasicDialogInfo > *)0 );
uno::Type aAnyType = aElement.getValueType();
if( aModuleType != aAnyType )
{
throw lang::IllegalArgumentException();
}
uno::Reference< script::XStarBasicDialogInfo > xMod;
aElement >>= xMod;
SbxObjectRef xDialog = implCreateDialog( xMod->getData() );
mpLib->Insert( xDialog );
}
void DialogContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)Name;
SbxVariable* pVar = mpLib->GetObjects()->Find( Name, SbxCLASS_DONTCARE );
if( !( pVar && pVar->ISA( SbxObject ) &&
( ((SbxObject*)pVar)->GetSbxId() == SBXID_DIALOG ) ) )
{
throw container::NoSuchElementException();
}
mpLib->Remove( pVar );
}
//=====================================================================
class LibraryContainer_Impl : public NameContainerHelper
{
BasicManager* mpMgr;
public:
LibraryContainer_Impl( BasicManager* pMgr )
:mpMgr( pMgr ) {}
// Methods XElementAccess
virtual uno::Type SAL_CALL getElementType()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasElements()
throw(uno::RuntimeException);
// Methods XNameAccess
virtual uno::Any SAL_CALL getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
virtual uno::Sequence< OUString > SAL_CALL getElementNames()
throw(uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByName( const OUString& aName )
throw(uno::RuntimeException);
// Methods XNameReplace
virtual void SAL_CALL replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException);
virtual void SAL_CALL removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException);
};
// Methods XElementAccess
uno::Type LibraryContainer_Impl::getElementType()
throw(uno::RuntimeException)
{
uno::Type aType = ::getCppuType( (const uno::Reference< script::XStarBasicLibraryInfo > *)0 );
return aType;
}
sal_Bool LibraryContainer_Impl::hasElements()
throw(uno::RuntimeException)
{
sal_Int32 nLibs = mpMgr->GetLibCount();
sal_Bool bRet = (nLibs > 0);
return bRet;
}
// Methods XNameAccess
uno::Any LibraryContainer_Impl::getByName( const OUString& aName )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
uno::Any aRetAny;
if( !mpMgr->HasLib( aName ) )
throw container::NoSuchElementException();
StarBASIC* pLib = mpMgr->GetLib( aName );
uno::Reference< container::XNameContainer > xModuleContainer =
(container::XNameContainer*)new ModuleContainer_Impl( pLib );
uno::Reference< container::XNameContainer > xDialogContainer =
(container::XNameContainer*)new DialogContainer_Impl( pLib );
BasicLibInfo* pLibInfo = mpMgr->FindLibInfo( pLib );
OUString aPassword = pLibInfo->GetPassword();
// TODO Only provide extern info!
OUString aExternaleSourceURL;
OUString aLinkTargetURL;
if( pLibInfo->IsReference() )
{
aLinkTargetURL = pLibInfo->GetStorageName();
}
else if( pLibInfo->IsExtern() )
{
aExternaleSourceURL = pLibInfo->GetStorageName();
}
uno::Reference< script::XStarBasicLibraryInfo > xLibInfo = new LibraryInfo_Impl
(
aName,
xModuleContainer,
xDialogContainer,
aPassword,
aExternaleSourceURL,
aLinkTargetURL
);
aRetAny <<= xLibInfo;
return aRetAny;
}
uno::Sequence< OUString > LibraryContainer_Impl::getElementNames()
throw(uno::RuntimeException)
{
sal_uInt16 nLibs = mpMgr->GetLibCount();
uno::Sequence< OUString > aRetSeq( nLibs );
OUString* pRetSeq = aRetSeq.getArray();
for( sal_uInt16 i = 0 ; i < nLibs ; i++ )
{
pRetSeq[i] = OUString( mpMgr->GetLibName( i ) );
}
return aRetSeq;
}
sal_Bool LibraryContainer_Impl::hasByName( const OUString& aName )
throw(uno::RuntimeException)
{
sal_Bool bRet = mpMgr->HasLib( aName );
return bRet;
}
// Methods XNameReplace
void LibraryContainer_Impl::replaceByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
removeByName( aName );
insertByName( aName, aElement );
}
// Methods XNameContainer
void LibraryContainer_Impl::insertByName( const OUString& aName, const uno::Any& aElement )
throw(lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, uno::RuntimeException)
{
(void)aName;
(void)aElement;
// TODO: Insert a complete Library?!
}
void LibraryContainer_Impl::removeByName( const OUString& Name )
throw(container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
{
StarBASIC* pLib = mpMgr->GetLib( Name );
if( !pLib )
{
throw container::NoSuchElementException();
}
sal_uInt16 nLibId = mpMgr->GetLibId( Name );
mpMgr->RemoveLib( nLibId );
}
//=====================================================================
typedef WeakImplHelper1< script::XStarBasicAccess > StarBasicAccessHelper;
class StarBasicAccess_Impl : public StarBasicAccessHelper
{
BasicManager* mpMgr;
uno::Reference< container::XNameContainer > mxLibContainer;
public:
StarBasicAccess_Impl( BasicManager* pMgr )
:mpMgr( pMgr ) {}
public:
// Methods
virtual uno::Reference< container::XNameContainer > SAL_CALL getLibraryContainer()
throw(uno::RuntimeException);
virtual void SAL_CALL createLibrary( const OUString& LibName, const OUString& Password,
const OUString& ExternalSourceURL, const OUString& LinkTargetURL )
throw(container::ElementExistException, uno::RuntimeException);
virtual void SAL_CALL addModule( const OUString& LibraryName, const OUString& ModuleName,
const OUString& Language, const OUString& Source )
throw(container::NoSuchElementException, uno::RuntimeException);
virtual void SAL_CALL addDialog( const OUString& LibraryName, const OUString& DialogName,
const uno::Sequence< sal_Int8 >& Data )
throw(container::NoSuchElementException, uno::RuntimeException);
};
uno::Reference< container::XNameContainer > SAL_CALL StarBasicAccess_Impl::getLibraryContainer()
throw(uno::RuntimeException)
{
if( !mxLibContainer.is() )
mxLibContainer = (container::XNameContainer*)new LibraryContainer_Impl( mpMgr );
return mxLibContainer;
}
void SAL_CALL StarBasicAccess_Impl::createLibrary
(
const OUString& LibName,
const OUString& Password,
const OUString& ExternalSourceURL,
const OUString& LinkTargetURL
)
throw(container::ElementExistException, uno::RuntimeException)
{
(void)ExternalSourceURL;
#ifdef DBG_UTIL
StarBASIC* pLib =
#endif
mpMgr->CreateLib( LibName, Password, LinkTargetURL );
DBG_ASSERT( pLib, "XML Import: Basic library could not be created");
}
void SAL_CALL StarBasicAccess_Impl::addModule
(
const OUString& LibraryName,
const OUString& ModuleName,
const OUString& Language,
const OUString& Source
)
throw(container::NoSuchElementException, uno::RuntimeException)
{
(void)Language;
StarBASIC* pLib = mpMgr->GetLib( LibraryName );
DBG_ASSERT( pLib, "XML Import: Lib for module unknown");
if( pLib )
{
pLib->MakeModule32( ModuleName, Source );
}
}
void SAL_CALL StarBasicAccess_Impl::addDialog
(
const OUString& LibraryName,
const OUString& DialogName,
const uno::Sequence< sal_Int8 >& Data
)
throw(container::NoSuchElementException, uno::RuntimeException)
{
(void)LibraryName;
(void)DialogName;
(void)Data;
}
// Basic XML Import/Export
uno::Reference< script::XStarBasicAccess > getStarBasicAccess( BasicManager* pMgr )
{
uno::Reference< script::XStarBasicAccess > xRet =
new StarBasicAccess_Impl( (BasicManager*)pMgr );
return xRet;
2000-09-18 15:18:56 +00:00
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */