dr78: rebase to DEV300m96

This commit is contained in:
Daniel Rentz [dr] 2010-12-29 17:02:32 +01:00
commit fb49e1f42d
1365 changed files with 26351 additions and 21054 deletions

View File

@ -1,4 +1,4 @@
av avmedia : l10n tools sfx2 NULL
av avmedia : l10n tools sfx2 LIBXSLT:libxslt NULL
av avmedia usr1 - all av_mkout NULL
av avmedia\prj get - all av_prj NULL
av avmedia\inc get - all av_inv NULL

View File

@ -46,6 +46,7 @@ class SbProcedureProperty;
class SbIfaceMapperMethod;
class SbClassModuleObject;
class ModuleInitDependencyMap;
struct ClassModuleRunInitItem;
struct SbClassData;
class SbModuleImpl;
@ -62,6 +63,8 @@ class SbModule : public SbxObject
SbModuleImpl* mpSbModuleImpl; // Impl data
std::vector< String > mModuleVariableNames;
void implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic );
protected:
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
::rtl::OUString aOUSource;
@ -74,7 +77,7 @@ protected:
SbxObjectRef pDocObject; // an impl object ( used by Document Modules )
bool bIsProxyModule;
static void implProcessModuleRunInit( ClassModuleRunInitItem& rItem );
static void implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem );
void StartDefinitions();
SbMethod* GetMethod( const String&, SbxDataType );
SbProperty* GetProperty( const String&, SbxDataType );
@ -84,6 +87,7 @@ protected:
USHORT Run( SbMethod* );
void RunInit();
void ClearPrivateVars();
void ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic );
void GlobalRunInit( BOOL bBasicStart ); // for all modules
void GlobalRunDeInit( void );
const BYTE* FindNextStmnt( const BYTE*, USHORT&, USHORT& ) const;
@ -94,6 +98,7 @@ protected:
virtual BOOL LoadCompleted();
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
void handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint );
virtual ~SbModule();
public:
SBX_DECL_PERSIST_NODATA(SBXCR_SBX,SBXID_BASICMOD,2);

View File

@ -52,10 +52,18 @@ class SbObjModule : public SbModule
{
SbObjModule( const SbObjModule& );
SbObjModule();
protected:
virtual ~SbObjModule();
public:
TYPEINFO();
SbObjModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVbaCompatible );
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
virtual void SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType );
using SbxValue::GetObject;
SbxVariable* GetObject();
void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
@ -81,7 +89,7 @@ public:
SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
virtual ~SbUserFormModule();
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
void ResetApiObj();
void ResetApiObj( bool bTriggerTerminateEvent = true );
void Unload();
void Load();
void triggerMethod( const String& );
@ -93,6 +101,11 @@ public:
void triggerLayoutEvent();
void triggerResizeEvent();
bool getInitState( void )
{ return mbInit; }
void setInitState( bool bInit )
{ mbInit = bInit; }
class SbUserFormModuleInstance* CreateInstance();
};

View File

@ -38,6 +38,7 @@
#include <basic/sbdef.hxx>
#include <basic/sberrors.hxx>
#include <com/sun/star/script/ModuleInfo.hpp>
#include <com/sun/star/frame/XModel.hpp>
class SbModule; // completed module
class SbiInstance; // runtime instance
@ -77,6 +78,8 @@ class StarBASIC : public SbxObject
SbxObjectRef pVBAGlobals;
SbxObject* getVBAGlobals( );
void implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic );
protected:
BOOL CError( SbError, const String&, xub_StrLen, xub_StrLen, xub_StrLen );
private:
@ -206,6 +209,9 @@ public:
bool GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::uno::Any& aOut );
void QuitAndExitApplication();
BOOL IsQuitApplication() { return bQuit; };
static ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >
GetModelFromBasic( SbxObject* pBasic );
};
#ifndef __SB_SBSTARBASICREF_HXX

View File

@ -106,6 +106,7 @@ enum SbxDataType {
};
const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000;
const UINT32 SBX_TYPE_DIM_AS_NEW_FLAG = 0x20000;
const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
#endif
@ -317,6 +318,8 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion
#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN
#define SBX_DIM_AS_NEW 0x0800 // Same value as SBX_GBLSEARCH, cannot conflict as one
// is used for objects, the other for variables only
// Broadcaster-IDs:
#define SBX_HINT_DYING SFX_HINT_DYING

View File

@ -439,6 +439,7 @@ SV_DECL_REF(SbxInfo)
class SfxBroadcaster;
class SbxVariableImpl;
class StarBASIC;
class SbxVariable : public SbxValue
{
@ -499,7 +500,9 @@ public:
const String& GetDeclareClassName( void );
void SetDeclareClassName( const String& );
void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener );
void SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
StarBASIC* pParentBasic );
void ClearComListener( void );
static USHORT MakeHashCode( const String& rName );
};

2
basic/prj/build.lst Executable file → Normal file
View File

@ -1,4 +1,4 @@
sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper NULL
sb basic : l10n offuh oovbaapi svtools xmlscript framework salhelper LIBXSLT:libxslt NULL
sb basic usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class sb_inc NULL

View File

@ -20,41 +20,10 @@ mkdir: %COMMON_DEST%\res%_EXT%
..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a
mkdir: %_DEST%\inc%_EXT%\basic
..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc
..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc
..\inc\basic\ttglobal.hrc %_DEST%\inc%_EXT%\basic\ttglobal.hrc
..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\basic\svtmsg.hrc
..\inc\basic\*.hxx %_DEST%\inc%_EXT%\basic\*.hxx
..\inc\basic\*.hrc %_DEST%\inc%_EXT%\basic\*.hrc
..\inc\basic\*.h %_DEST%\inc%_EXT%\basic\*.h
..\inc\basic\sbdef.hxx %_DEST%\inc%_EXT%\basic\sbdef.hxx
..\inc\basic\sbmod.hxx %_DEST%\inc%_EXT%\basic\sbmod.hxx
..\inc\basic\sbjsmod.hxx %_DEST%\inc%_EXT%\basic\sbjsmod.hxx
..\inc\basic\sbmeth.hxx %_DEST%\inc%_EXT%\basic\sbmeth.hxx
..\inc\basic\sbprop.hxx %_DEST%\inc%_EXT%\basic\sbprop.hxx
..\inc\basic\sbstar.hxx %_DEST%\inc%_EXT%\basic\sbstar.hxx
..\inc\basic\sbuno.hxx %_DEST%\inc%_EXT%\basic\sbuno.hxx
..\inc\basic\basmgr.hxx %_DEST%\inc%_EXT%\basic\basmgr.hxx
..\inc\basic\sberrors.hxx %_DEST%\inc%_EXT%\basic\sberrors.hxx
..\inc\basic\basrdll.hxx %_DEST%\inc%_EXT%\basic\basrdll.hxx
..\inc\basic\sbstdobj.hxx %_DEST%\inc%_EXT%\basic\sbstdobj.hxx
..\inc\basic\process.hxx %_DEST%\inc%_EXT%\basic\process.hxx
..\inc\basic\mybasic.hxx %_DEST%\inc%_EXT%\basic\mybasic.hxx
..\inc\basic\testtool.hxx %_DEST%\inc%_EXT%\basic\testtool.hxx
..\inc\basic\basicrt.hxx %_DEST%\inc%_EXT%\basic\basicrt.hxx
..\inc\basic\dispdefs.hxx %_DEST%\inc%_EXT%\basic\dispdefs.hxx
..\inc\basic\ttstrhlp.hxx %_DEST%\inc%_EXT%\basic\ttstrhlp.hxx
..\inc\basic\sbx.hxx %_DEST%\inc%_EXT%\basic\sbx.hxx
..\inc\basic\sbxcore.hxx %_DEST%\inc%_EXT%\basic\sbxcore.hxx
..\inc\basic\sbxdef.hxx %_DEST%\inc%_EXT%\basic\sbxdef.hxx
..\inc\basic\sbxform.hxx %_DEST%\inc%_EXT%\basic\sbxform.hxx
..\inc\basic\sbxmeth.hxx %_DEST%\inc%_EXT%\basic\sbxmeth.hxx
..\inc\basic\sbxobj.hxx %_DEST%\inc%_EXT%\basic\sbxobj.hxx
..\inc\basic\sbxprop.hxx %_DEST%\inc%_EXT%\basic\sbxprop.hxx
..\inc\basic\sbxvar.hxx %_DEST%\inc%_EXT%\basic\sbxvar.hxx
..\inc\basic\sbxbase.hxx %_DEST%\inc%_EXT%\basic\sbxbase.hxx
..\inc\basic\sbxfac.hxx %_DEST%\inc%_EXT%\basic\sbxfac.hxx
..\inc\basic\sbxmstrm.hxx %_DEST%\inc%_EXT%\basic\sbxmstrm.hxx
..\inc\basic\basicmanagerrepository.hxx %_DEST%\inc%_EXT%\basic\basicmanagerrepository.hxx
..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component

View File

@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "svtmsg.hrc"
#include "basic/svtmsg.hrc"
// Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten

View File

@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "testtool.hrc"
#include "basic/testtool.hrc"
///////////////////////////////

View File

@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "ttmsg.hrc"
#include "basic/ttmsg.hrc"
// Hier sind die Messages aus dem Verzeichnis /basic/source/testtool enhalten

View File

@ -139,9 +139,17 @@ namespace basic
impl_getLocationForModel( const Reference< XModel >& _rxDocumentModel );
/** creates a new BasicManager instance for the given model
@param _out_rpBasicManager
reference to the pointer variable that will hold the new
BasicManager.
@param _rxDocumentModel
the model whose BasicManager will be created. Must not be <NULL/>.
*/
BasicManagerPointer
impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel );
void impl_createManagerForModel(
BasicManagerPointer& _out_rpBasicManager,
const Reference< XModel >& _rxDocumentModel );
/** creates the application-wide BasicManager
*/
@ -244,9 +252,17 @@ namespace basic
{
::osl::MutexGuard aGuard( m_aMutex );
/* #163556# (DR) - This function may be called recursively while
constructing the Basic manager and loading the Basic storage. By
passing the map entry received from impl_getLocationForModel() to
the function impl_createManagerForModel(), the new Basic manager
will be put immediately into the map of existing Basic managers,
thus a recursive call of this function will find and return it
without creating another instance.
*/
BasicManagerPointer& pBasicManager = impl_getLocationForModel( _rxDocumentModel );
if ( pBasicManager == NULL )
pBasicManager = impl_createManagerForModel( _rxDocumentModel );
impl_createManagerForModel( pBasicManager, _rxDocumentModel );
return pBasicManager;
}
@ -408,21 +424,21 @@ namespace basic
}
//--------------------------------------------------------------------
BasicManagerPointer ImplRepository::impl_createManagerForModel( const Reference< XModel >& _rxDocumentModel )
void ImplRepository::impl_createManagerForModel( BasicManagerPointer& _out_rpBasicManager, const Reference< XModel >& _rxDocumentModel )
{
StarBASIC* pAppBasic = impl_getDefaultAppBasicLibrary();
BasicManager* pBasicManager( NULL );
_out_rpBasicManager = 0;
Reference< XStorage > xStorage;
if ( !impl_getDocumentStorage_nothrow( _rxDocumentModel, xStorage ) )
// the document is not able to provide the storage it is based on.
return pBasicManager;
return;
Reference< XPersistentLibraryContainer > xBasicLibs;
Reference< XPersistentLibraryContainer > xDialogLibs;
if ( !impl_getDocumentLibraryContainers_nothrow( _rxDocumentModel, xBasicLibs, xDialogLibs ) )
// the document does not have BasicLibraries and DialogLibraries
return pBasicManager;
return;
if ( xStorage.is() )
{
@ -433,24 +449,24 @@ namespace basic
// Storage and BaseURL are only needed by binary documents!
SotStorageRef xDummyStor = new SotStorage( ::rtl::OUString() );
pBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */,
_out_rpBasicManager = new BasicManager( *xDummyStor, String() /* TODO/LATER: xStorage */,
pAppBasic,
&aAppBasicDir, TRUE );
if ( pBasicManager->HasErrors() )
if ( _out_rpBasicManager->HasErrors() )
{
// handle errors
BasicError* pErr = pBasicManager->GetFirstError();
BasicError* pErr = _out_rpBasicManager->GetFirstError();
while ( pErr )
{
// show message to user
if ( ERRCODE_BUTTON_CANCEL == ErrorHandler::HandleError( pErr->GetErrorId() ) )
{
// user wants to break loading of BASIC-manager
BasicManagerCleaner::deleteBasicManager( pBasicManager );
BasicManagerCleaner::deleteBasicManager( _out_rpBasicManager );
xStorage.clear();
break;
}
pErr = pBasicManager->GetNextError();
pErr = _out_rpBasicManager->GetNextError();
}
}
}
@ -461,14 +477,14 @@ namespace basic
// create new BASIC-manager
StarBASIC* pBasic = new StarBASIC( pAppBasic );
pBasic->SetFlag( SBX_EXTSEARCH );
pBasicManager = new BasicManager( pBasic, NULL, TRUE );
_out_rpBasicManager = new BasicManager( pBasic, NULL, TRUE );
}
// knit the containers with the BasicManager
LibraryContainerInfo aInfo( xBasicLibs, xDialogLibs, dynamic_cast< OldBasicPassword* >( xBasicLibs.get() ) );
OSL_ENSURE( aInfo.mpOldBasicPassword, "ImplRepository::impl_createManagerForModel: wrong BasicLibraries implementation!" );
pBasicManager->SetLibraryContainerInfo( aInfo );
//pBasicCont->setBasicManager( pBasicManager );
_out_rpBasicManager->SetLibraryContainerInfo( aInfo );
//pBasicCont->setBasicManager( _out_rpBasicManager );
// that's not needed anymore today. The containers will retrieve their associated
// BasicManager from the BasicManagerRepository, when needed.
@ -476,13 +492,13 @@ namespace basic
impl_initDocLibraryContainers_nothrow( xBasicLibs, xDialogLibs );
// damit auch Dialoge etc. 'qualifiziert' angesprochen werden k"onnen
pBasicManager->GetLib(0)->SetParent( pAppBasic );
_out_rpBasicManager->GetLib(0)->SetParent( pAppBasic );
// global properties in the document's Basic
pBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) );
_out_rpBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxDocumentModel ) );
// notify
impl_notifyCreationListeners( _rxDocumentModel, *pBasicManager );
impl_notifyCreationListeners( _rxDocumentModel, *_out_rpBasicManager );
// register as listener for this model being disposed/closed
Reference< XComponent > xDocumentComponent( _rxDocumentModel, UNO_QUERY );
@ -490,9 +506,7 @@ namespace basic
startComponentListening( xDocumentComponent );
// register as listener for the BasicManager being destroyed
StartListening( *pBasicManager );
return pBasicManager;
StartListening( *_out_rpBasicManager );
}
//--------------------------------------------------------------------

View File

@ -88,54 +88,6 @@ using namespace ::cppu;
using namespace ::osl;
Reference< frame::XModel > getModelFromBasic( SbxObject* pBasic )
{
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
if ( !pBasic )
return NULL;
// look for the ThisComponent variable, first in the parent (which
// might be the document's Basic), then in the parent's parent (which might be
// the application Basic)
const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) );
SbxVariable* pThisComponent = NULL;
SbxObject* pLookup = pBasic->GetParent();
while ( pLookup && !pThisComponent )
{
pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT );
pLookup = pLookup->GetParent();
}
if ( !pThisComponent )
{
OSL_TRACE("Failed to get ThisComponent");
// the application Basic, at the latest, should have this variable
return NULL;
}
Any aThisComponent( sbxToUnoValue( pThisComponent ) );
Reference< frame::XModel > xModel( aThisComponent, UNO_QUERY );
if ( !xModel.is() )
{
// it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
Reference< frame::XController > xController( aThisComponent, UNO_QUERY );
if ( xController.is() )
xModel = xController->getModel();
}
if ( !xModel.is() )
return NULL;
#if OSL_DEBUG_LEVEL > 0
OSL_TRACE("Have model ThisComponent points to url %s",
::rtl::OUStringToOString( xModel->getURL(),
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif
return xModel;
}
void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel )
{
OSL_TRACE("SFURL_firing_impl() processing script url %s",
@ -569,7 +521,7 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
bool bDocDialog = false;
StarBASIC* pFoundBasic = NULL;
OSL_TRACE("About to try get a hold of ThisComponent");
Reference< frame::XModel > xModel = getModelFromBasic( pINST->GetBasic() ) ;
Reference< frame::XModel > xModel = StarBASIC::GetModelFromBasic( pINST->GetBasic() ) ;
aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
// If we found the dialog then it belongs to the Search basic
if ( !pFoundBasic )

View File

@ -71,6 +71,7 @@ TYPEINIT1(StarBASIC,SbxObject)
#define RTLNAME "@SBRTL"
// i#i68894#
using namespace ::com::sun::star;
using com::sun::star::uno::Reference;
using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY;
@ -345,8 +346,19 @@ SbxObject* SbFormFactory::CreateObject( const String& rClassName )
if( SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT ) )
{
if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) )
{
bool bInitState = pFormModule->getInitState();
if( bInitState )
{
// Not the first instantiate, reset
bool bTriggerTerminateEvent = false;
pFormModule->ResetApiObj( bTriggerTerminateEvent );
pFormModule->setInitState( false );
}
else
{
pFormModule->Load();
}
return pFormModule->CreateInstance();
}
}
@ -564,7 +576,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
if( pObj != NULL )
{
String aObjClass = pObj->GetClassName();
(void)aObjClass;
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL )
@ -611,93 +622,7 @@ SbClassModuleObject::~SbClassModuleObject()
void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType )
{
bool bDone = false;
const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
if( pHint )
{
SbxVariable* pVar = pHint->GetVar();
SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
if( pProcProperty )
{
bDone = true;
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
String aProcName;
aProcName.AppendAscii( "Property Get " );
aProcName += pProcProperty->GetName();
SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
if( pMeth )
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
SbxArray* pArg = pVar->GetParameters();
USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
if( nVarParCount > 1 )
{
SbxArrayRef xMethParameters = new SbxArray;
xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
for( USHORT i = 1 ; i < nVarParCount ; ++i )
{
SbxVariable* pPar = pArg->Get( i );
xMethParameters->Put( pPar, i );
}
pMeth->SetParameters( xMethParameters );
pMeth->Get( aVals );
pMeth->SetParameters( NULL );
}
else
{
pMeth->Get( aVals );
}
pVar->Put( aVals );
}
}
else if( pHint->GetId() == SBX_HINT_DATACHANGED )
{
SbxVariable* pMeth = NULL;
bool bSet = pProcProperty->isSet();
if( bSet )
{
pProcProperty->setSet( false );
String aProcName;
aProcName.AppendAscii( "Property Set " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
if( !pMeth ) // Let
{
String aProcName;
aProcName.AppendAscii( "Property Let " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
if( pMeth )
{
// Setup parameters
SbxArrayRef xArray = new SbxArray;
xArray->Put( pMeth, 0 ); // Method as parameter 0
xArray->Put( pVar, 1 );
pMeth->SetParameters( xArray );
SbxValues aVals;
pMeth->Get( aVals );
pMeth->SetParameters( NULL );
}
}
}
}
if( !bDone )
SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
handleProcedureProperties( rBC, rHint );
}
SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
@ -809,6 +734,9 @@ SbModule* SbClassFactory::FindClass( const String& rClassName )
return pMod;
}
typedef std::vector< StarBASIC* > DocBasicVector;
static DocBasicVector GaDocBasics;
StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
{
@ -822,8 +750,6 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
{
pSBFAC = new SbiFactory;
AddFactory( pSBFAC );
pUNOFAC = new SbUnoFactory;
AddFactory( pUNOFAC );
pTYPEFAC = new SbTypeFactory;
AddFactory( pTYPEFAC );
pCLASSFAC = new SbClassFactory;
@ -832,12 +758,17 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
AddFactory( pOLEFAC );
pFORMFAC = new SbFormFactory;
AddFactory( pFORMFAC );
pUNOFAC = new SbUnoFactory;
AddFactory( pUNOFAC );
}
pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
// Search via StarBasic is always global
SetFlag( SBX_GBLSEARCH );
pVBAGlobals = NULL;
bQuit = FALSE;
if( bDocBasic )
GaDocBasics.push_back( this );
}
// #51727 Override SetModified so that the modified state
@ -877,6 +808,29 @@ StarBASIC::~StarBASIC()
}
#endif
}
else if( bDocBasic )
{
SbxError eOld = SbxBase::GetError();
DocBasicVector::iterator it;
for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
{
if( *it == this )
{
GaDocBasics.erase( it );
break;
}
}
for( it = GaDocBasics.begin() ; it != GaDocBasics.end() ; ++it )
{
StarBASIC* pBasic = *it;
pBasic->implClearDependingVarsOnDelete( this );
}
SbxBase::ResetError();
if( eOld != SbxERR_OK )
SbxBase::SetError( eOld );
}
// #100326 Set Parent NULL in registered listeners
if( xUnoListeners.Is() )
@ -889,6 +843,9 @@ StarBASIC::~StarBASIC()
}
xUnoListeners = NULL;
}
clearUnoMethodsForBasic( this );
disposeComVariablesForBasic( this );
}
// Override new() operator, so that everyone can create a new instance
@ -907,6 +864,27 @@ void StarBASIC::operator delete( void* p )
::operator delete( p );
}
void StarBASIC::implClearDependingVarsOnDelete( StarBASIC* pDeletedBasic )
{
if( this != pDeletedBasic )
{
for( USHORT i = 0; i < pModules->Count(); i++ )
{
SbModule* p = (SbModule*)pModules->Get( i );
p->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
}
}
for( USHORT nObj = 0; nObj < pObjs->Count(); nObj++ )
{
SbxVariable* pVar = pObjs->Get( nObj );
StarBASIC* pBasic = PTR_CAST(StarBASIC,pVar);
if( pBasic && pBasic != pDeletedBasic )
pBasic->implClearDependingVarsOnDelete( pDeletedBasic );
}
}
/**************************************************************************
*
* Creation/Managment of modules
@ -1036,15 +1014,15 @@ struct ClassModuleRunInitItem
{}
};
typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap;
// Derive from has_map type instead of typedef
// to allow forward declaration in sbmod.hxx
class ModuleInitDependencyMap : public
std::hash_map< ::rtl::OUString, ClassModuleRunInitItem,
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > >
{};
static ModuleInitDependencyMap* GpMIDMap = NULL;
void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
void SbModule::implProcessModuleRunInit( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem )
{
ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
rItem.m_bProcessing = true;
//bool bAnyDependencies = true;
@ -1059,8 +1037,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
String& rStr = *it;
// Is required type a class module?
ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr );
if( itFind != rMIDMap.end() )
ModuleInitDependencyMap::iterator itFind = rMap.find( rStr );
if( itFind != rMap.end() )
{
ClassModuleRunInitItem& rParentItem = itFind->second;
if( rParentItem.m_bProcessing )
@ -1071,7 +1049,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
}
if( !rParentItem.m_bRunInitDone )
implProcessModuleRunInit( rParentItem );
implProcessModuleRunInit( rMap, rParentItem );
}
}
}
@ -1085,6 +1063,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
// Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{
::vos::OGuard guard( Application::GetSolarMutex() );
// Init own modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
@ -1099,7 +1079,6 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
// Consider required types to init in right order. Class modules
// that are required by other modules have to be initialized first.
ModuleInitDependencyMap aMIDMap;
GpMIDMap = &aMIDMap;
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
@ -1112,9 +1091,8 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
{
ClassModuleRunInitItem& rItem = it->second;
SbModule::implProcessModuleRunInit( rItem );
SbModule::implProcessModuleRunInit( aMIDMap, rItem );
}
GpMIDMap = NULL;
// Call RunInit on standard modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
@ -1143,7 +1121,7 @@ void StarBASIC::DeInitAllModules( void )
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( pModule->pImage )
if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
pModule->pImage->bInit = false;
}
@ -1849,6 +1827,54 @@ bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::u
return bRes;
}
Reference< frame::XModel > StarBASIC::GetModelFromBasic( SbxObject* pBasic )
{
OSL_PRECOND( pBasic != NULL, "getModelFromBasic: illegal call!" );
if ( !pBasic )
return NULL;
// look for the ThisComponent variable, first in the parent (which
// might be the document's Basic), then in the parent's parent (which might be
// the application Basic)
const ::rtl::OUString sThisComponent( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) );
SbxVariable* pThisComponent = NULL;
SbxObject* pLookup = pBasic->GetParent();
while ( pLookup && !pThisComponent )
{
pThisComponent = pLookup->Find( sThisComponent, SbxCLASS_OBJECT );
pLookup = pLookup->GetParent();
}
if ( !pThisComponent )
{
OSL_TRACE("Failed to get ThisComponent");
// the application Basic, at the latest, should have this variable
return NULL;
}
Any aThisComponentAny( sbxToUnoValue( pThisComponent ) );
Reference< frame::XModel > xModel( aThisComponentAny, UNO_QUERY );
if ( !xModel.is() )
{
// it's no XModel. Okay, ThisComponent nowadays is allowed to be a controller.
Reference< frame::XController > xController( aThisComponentAny, UNO_QUERY );
if ( xController.is() )
xModel = xController->getModel();
}
if ( !xModel.is() )
return NULL;
#if OSL_DEBUG_LEVEL > 0
OSL_TRACE("Have model ThisComponent points to url %s",
::rtl::OUStringToOString( xModel->getURL(),
RTL_TEXTENCODING_ASCII_US ).pData->buffer );
#endif
return xModel;
}
//========================================================================
// #118116 Implementation Collection object

View File

@ -36,15 +36,18 @@
#include <svl/hint.hxx>
#include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/extract.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/processfactory.hxx>
#include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp>
#include <com/sun/star/script/NativeObjectWrapper.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/DeploymentException.hpp>
@ -61,6 +64,7 @@
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/script/XDirectInvocation.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XIdlArray.hpp>
@ -512,6 +516,44 @@ static void implHandleAnyException( const Any& _rCaughtException )
}
}
// NativeObjectWrapper handling
struct ObjectItem
{
SbxObjectRef m_xNativeObj;
ObjectItem( void )
{}
ObjectItem( SbxObject* pNativeObj )
: m_xNativeObj( pNativeObj )
{}
};
static std::vector< ObjectItem > GaNativeObjectWrapperVector;
void clearNativeObjectWrapperVector( void )
{
GaNativeObjectWrapperVector.clear();
}
sal_uInt32 lcl_registerNativeObjectWrapper( SbxObject* pNativeObj )
{
sal_uInt32 nIndex = GaNativeObjectWrapperVector.size();
GaNativeObjectWrapperVector.push_back( ObjectItem( pNativeObj ) );
return nIndex;
}
SbxObject* lcl_getNativeObject( sal_uInt32 nIndex )
{
SbxObjectRef xRetObj;
if( nIndex < GaNativeObjectWrapperVector.size() )
{
ObjectItem& rItem = GaNativeObjectWrapperVector[ nIndex ];
xRetObj = rItem.m_xNativeObj;
}
return xRetObj;
}
// Von Uno nach Sbx wandeln
SbxDataType unoToSbxType( TypeClass eType )
{
@ -698,6 +740,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
if( eTypeClass == TypeClass_STRUCT )
{
ArrayWrapper aWrap;
NativeObjectWrapper aNativeObjectWrapper;
if ( (aValue >>= aWrap) )
{
SbxDimArray* pArray = NULL;
@ -717,6 +760,18 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
pVar->PutEmpty();
break;
}
else if ( (aValue >>= aNativeObjectWrapper) )
{
sal_uInt32 nIndex = 0;
if( (aNativeObjectWrapper.ObjectId >>= nIndex) )
{
SbxObject* pObj = lcl_getNativeObject( nIndex );
pVar->PutObject( pObj );
}
else
pVar->PutEmpty();
break;
}
else
{
SbiInstance* pInst = pINST;
@ -1093,6 +1148,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
return aRetAny;
}
if( !xObj->ISA(SbUnoObject) )
{
// Create NativeObjectWrapper to identify object in case of callbacks
SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject());
if( pObj != NULL )
{
NativeObjectWrapper aNativeObjectWrapper;
sal_uInt32 nIndex = lcl_registerNativeObjectWrapper( pObj );
aNativeObjectWrapper.ObjectId <<= nIndex;
Any aRetAny;
aRetAny <<= aNativeObjectWrapper;
return aRetAny;
}
}
}
}
@ -2222,13 +2291,19 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
else if( bInvocation && mxInvocation.is() )
{
Reference< XDirectInvocation > xDirectInvoke;
if ( pMeth->needsDirectInvocation() )
xDirectInvoke.set( mxInvocation, UNO_QUERY );
Any aRetAny;
if ( xDirectInvoke.is() )
aRetAny = xDirectInvoke->directInvoke( pMeth->GetName(), args );
else
{
Sequence< INT16 > OutParamIndex;
Sequence< Any > OutParam;
Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
// Wert von Uno nach Sbx uebernehmen
unoToSbxValue( pVar, aRetAny );
aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
const INT16* pIndices = OutParamIndex.getConstArray();
UINT32 nLen = OutParamIndex.getLength();
@ -2245,6 +2320,10 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
}
// Wert von Uno nach Sbx uebernehmen
unoToSbxValue( pVar, aRetAny );
}
// #55460, Parameter hier weghauen, da das in unoToSbxValue()
// bei Arrays wegen #54548 nicht mehr gemacht wird
if( pParams )
@ -2271,7 +2350,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ )
, bNeedIntrospection( TRUE )
, bIgnoreNativeCOMObjectMembers( FALSE )
, bNativeCOMObject( FALSE )
{
static Reference< XIntrospection > xIntrospection;
@ -2322,7 +2401,7 @@ SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
// hiding of equally named COM symbols, e.g. XInvocation::getValue
Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
if( xAutomationObject.is() )
bIgnoreNativeCOMObjectMembers = TRUE;
bNativeCOMObject = TRUE;
}
maTmpUnoObj = aUnoObj_;
@ -2446,6 +2525,47 @@ void SbUnoObject::doIntrospection( void )
// #67781 Start einer Liste aller SbUnoMethod-Instanzen
static SbUnoMethod* pFirst = NULL;
void clearUnoMethodsForBasic( StarBASIC* pBasic )
{
SbUnoMethod* pMeth = pFirst;
while( pMeth )
{
SbxObject* pObject = dynamic_cast< SbxObject* >( pMeth->GetParent() );
if ( pObject )
{
StarBASIC* pModBasic = dynamic_cast< StarBASIC* >( pObject->GetParent() );
if ( pModBasic == pBasic )
{
// for now the solution is to remove the method from the list and to clear it,
// but in case the element should be correctly transfered to another StarBASIC,
// we should either set module parent to NULL without clearing it, or even
// set the new StarBASIC as the parent of the module
// pObject->SetParent( NULL );
if( pMeth == pFirst )
pFirst = pMeth->pNext;
else if( pMeth->pPrev )
pMeth->pPrev->pNext = pMeth->pNext;
if( pMeth->pNext )
pMeth->pNext->pPrev = pMeth->pPrev;
pMeth->pPrev = NULL;
pMeth->pNext = NULL;
pMeth->SbxValue::Clear();
pObject->SbxValue::Clear();
// start from the beginning after object clearing, the cycle will end since the method is removed each time
pMeth = pFirst;
}
else
pMeth = pMeth->pNext;
}
else
pMeth = pMeth->pNext;
}
}
void clearUnoMethods( void )
{
SbUnoMethod* pMeth = pFirst;
@ -2462,10 +2582,12 @@ SbUnoMethod::SbUnoMethod
const String& aName_,
SbxDataType eSbxType,
Reference< XIdlMethod > xUnoMethod_,
bool bInvocation
bool bInvocation,
bool bDirect
)
: SbxMethod( aName_, eSbxType )
, mbInvocation( bInvocation )
, mbDirectInvocation( bDirect )
{
m_xUnoMethod = xUnoMethod_;
pParamInfoSeq = NULL;
@ -2566,7 +2688,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( !pRes )
{
::rtl::OUString aUName( rName );
if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers )
if( mxUnoAccess.is() && !bNativeCOMObject )
{
if( mxExactName.is() )
{
@ -2667,6 +2789,17 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
}
else
{
Reference< XDirectInvocation > xDirectInvoke( mxInvocation, UNO_QUERY );
if ( xDirectInvoke.is() && xDirectInvoke->hasMember( aUName ) )
{
SbxVariableRef xMethRef = new SbUnoMethod( aUName, SbxVARIANT, xDummyMethod, true, true );
QuickInsert( (SbxVariable*)xMethRef );
pRes = xMethRef;
}
}
}
catch( RuntimeException& e )
{
@ -2726,11 +2859,11 @@ void SbUnoObject::implCreateAll( void )
// Instrospection besorgen
Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
if( !xAccess.is() || bIgnoreNativeCOMObjectMembers )
if( !xAccess.is() || bNativeCOMObject )
{
if( mxInvocation.is() )
xAccess = mxInvocation->getIntrospection();
else if( bIgnoreNativeCOMObjectMembers )
else if( bNativeCOMObject )
return;
}
if( !xAccess.is() )
@ -4170,14 +4303,26 @@ void RTL_Impl_CreateUnoValue( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
//==========================================================================
typedef WeakImplHelper1< XInvocation > ModuleInvocationProxyHelper;
namespace {
class OMutexBasis
{
protected:
// this mutex is necessary for OInterfaceContainerHelper
::osl::Mutex m_aMutex;
};
} // namespace
class ModuleInvocationProxy : public ModuleInvocationProxyHelper
typedef WeakImplHelper2< XInvocation, XComponent > ModuleInvocationProxyHelper;
class ModuleInvocationProxy : public OMutexBasis,
public ModuleInvocationProxyHelper
{
::rtl::OUString m_aPrefix;
SbxObjectRef m_xScopeObj;
bool m_bProxyIsClassModuleObject;
::cppu::OInterfaceContainerHelper m_aListeners;
public:
ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
~ModuleInvocationProxy()
@ -4197,11 +4342,17 @@ public:
Sequence< sal_Int16 >& rOutParamIndex,
Sequence< Any >& rOutParam )
throw( CannotConvertException, InvocationTargetException );
// XComponent
virtual void SAL_CALL dispose() throw(RuntimeException);
virtual void SAL_CALL addEventListener( const Reference< XEventListener >& xListener ) throw (RuntimeException);
virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) throw (RuntimeException);
};
ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
: m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) )
, m_xScopeObj( xScopeObj )
, m_aListeners( m_aMutex )
{
m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false;
}
@ -4298,13 +4449,27 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
vos::OGuard guard( Application::GetSolarMutex() );
Any aRet;
if( !m_xScopeObj.Is() )
SbxObjectRef xScopeObj = m_xScopeObj;
if( !xScopeObj.Is() )
return aRet;
::rtl::OUString aFunctionName = m_aPrefix;
aFunctionName += rFunction;
SbxVariable* p = m_xScopeObj->Find( aFunctionName, SbxCLASS_METHOD );
sal_Bool bSetRescheduleBack = sal_False;
sal_Bool bOldReschedule = sal_True;
SbiInstance* pInst = pINST;
if( pInst && pInst->IsCompatibility() )
{
bOldReschedule = pInst->IsReschedule();
if ( bOldReschedule )
{
pInst->EnableReschedule( sal_False );
bSetRescheduleBack = sal_True;
}
}
SbxVariable* p = xScopeObj->Find( aFunctionName, SbxCLASS_METHOD );
SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
if( pMeth == NULL )
{
@ -4336,11 +4501,38 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
aRet = sbxToUnoValue( xValue );
pMeth->SetParameters( NULL );
if( bSetRescheduleBack )
pInst->EnableReschedule( bOldReschedule );
// TODO: OutParameter?
return aRet;
}
void SAL_CALL ModuleInvocationProxy::dispose()
throw(RuntimeException)
{
::osl::MutexGuard aGuard( m_aMutex );
EventObject aEvent( (XComponent*)this );
m_aListeners.disposeAndClear( aEvent );
m_xScopeObj = NULL;
}
void SAL_CALL ModuleInvocationProxy::addEventListener( const Reference< XEventListener >& xListener )
throw (RuntimeException)
{
m_aListeners.addInterface( xListener );
}
void SAL_CALL ModuleInvocationProxy::removeEventListener( const Reference< XEventListener >& xListener )
throw (RuntimeException)
{
m_aListeners.removeInterface( xListener );
}
Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
{
@ -4370,6 +4562,97 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
return xRet;
}
typedef std::vector< WeakReference< XComponent > > ComponentRefVector;
struct StarBasicDisposeItem
{
StarBASIC* m_pBasic;
SbxArrayRef m_pRegisteredVariables;
ComponentRefVector m_vComImplementsObjects;
StarBasicDisposeItem( StarBASIC* pBasic )
: m_pBasic( pBasic )
{
m_pRegisteredVariables = new SbxArray();
}
};
typedef std::vector< StarBasicDisposeItem* > DisposeItemVector;
static DisposeItemVector GaDisposeItemVector;
DisposeItemVector::iterator lcl_findItemForBasic( StarBASIC* pBasic )
{
DisposeItemVector::iterator it;
for( it = GaDisposeItemVector.begin() ; it != GaDisposeItemVector.end() ; ++it )
{
StarBasicDisposeItem* pItem = *it;
if( pItem->m_pBasic == pBasic )
return it;
}
return GaDisposeItemVector.end();
}
StarBasicDisposeItem* lcl_getOrCreateItemForBasic( StarBASIC* pBasic )
{
DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic );
StarBasicDisposeItem* pItem = (it != GaDisposeItemVector.end()) ? *it : NULL;
if( pItem == NULL )
{
pItem = new StarBasicDisposeItem( pBasic );
GaDisposeItemVector.push_back( pItem );
}
return pItem;
}
void registerComponentToBeDisposedForBasic
( Reference< XComponent > xComponent, StarBASIC* pBasic )
{
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
pItem->m_vComImplementsObjects.push_back( xComponent );
}
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic )
{
StarBasicDisposeItem* pItem = lcl_getOrCreateItemForBasic( pBasic );
SbxArray* pArray = pItem->m_pRegisteredVariables;
pArray->Put( pVar, pArray->Count() );
}
void disposeComVariablesForBasic( StarBASIC* pBasic )
{
DisposeItemVector::iterator it = lcl_findItemForBasic( pBasic );
if( it != GaDisposeItemVector.end() )
{
StarBasicDisposeItem* pItem = *it;
SbxArray* pArray = pItem->m_pRegisteredVariables;
USHORT nCount = pArray->Count();
for( USHORT i = 0 ; i < nCount ; ++i )
{
SbxVariable* pVar = pArray->Get( i );
pVar->ClearComListener();
}
ComponentRefVector& rv = pItem->m_vComImplementsObjects;
ComponentRefVector::iterator itCRV;
for( itCRV = rv.begin() ; itCRV != rv.end() ; ++itCRV )
{
try
{
Reference< XComponent > xComponent( (*itCRV).get(), UNO_QUERY_THROW );
xComponent->dispose();
}
catch( Exception& )
{}
}
delete pItem;
GaDisposeItemVector.erase( it );
}
}
// Handle module implements mechanism for OLE types
bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject )
{
@ -4423,6 +4706,23 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
if( bSuccess )
{
Reference< XComponent > xComponent( xProxy, UNO_QUERY );
if( xComponent.is() )
{
StarBASIC* pParentBasic = NULL;
SbxObject* pCurObject = this;
do
{
SbxObject* pObjParent = pCurObject->GetParent();
pParentBasic = PTR_CAST( StarBASIC, pObjParent );
pCurObject = pObjParent;
}
while( pParentBasic == NULL && pCurObject != NULL );
OSL_ASSERT( pParentBasic != NULL );
registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
}
o_rRetAny <<= xRet;
break;
}
@ -4432,3 +4732,30 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
return bSuccess;
}
// Due to an incorrect behavior IE returns an object instead of a string
// in some scenarios. Calling toString at the object may correct this.
// Helper function used in sbxvalue.cxx
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal )
{
bool bSuccess = false;
SbUnoObject* pUnoObj = NULL;
if( pObj != NULL && (pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*)pObj)) != NULL )
{
// Only for native COM objects
if( pUnoObj->isNativeCOMObject() )
{
SbxVariableRef pMeth = pObj->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "toString" ) ), SbxCLASS_METHOD );
if ( pMeth.Is() )
{
SbxValues aRes;
pMeth->Get( aRes );
pVal->Put( aRes );
bSuccess = true;
}
}
}
return bSuccess;
}

221
basic/source/classes/sbxmod.cxx Normal file → Executable file
View File

@ -496,22 +496,16 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
return 0L;
}
#if 0
bool UnlockControllerHack( StarBASIC* pBasic )
bool VBAUnlockControllers( StarBASIC* pBasic )
{
bool bRes = false;
if ( pBasic && pBasic->IsDocBasic() )
{
uno::Any aUnoVar;
::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) );
SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) );
if ( pGlobs )
aUnoVar = pGlobs->getUnoAny();
uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY);
if ( xModel.is() )
{
try
SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) );
if ( pGlobs ) try
{
uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
if ( xModel->hasControllersLocked() )
xModel->unlockControllers();
bRes = true;
}
@ -519,10 +513,9 @@ bool UnlockControllerHack( StarBASIC* pBasic )
{
}
}
}
return bRes;
}
#endif
/////////////////////////////////////////////////////////////////////////////
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
@ -1176,6 +1169,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
// beim Programm-Ende freigeben, damit nichts gehalten wird.
ClearUnoObjectsInRTL_Impl( xBasic );
clearNativeObjectWrapperVector();
DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0");
delete pINST, pINST = NULL, bDelInst = FALSE;
@ -1184,6 +1179,14 @@ USHORT SbModule::Run( SbMethod* pMeth )
SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth );
GlobalRunDeInit();
// VBA always ensures screenupdating is enabled after completing
if ( mbVBACompat )
VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) );
#ifdef DBG_TRACE_BASIC
dbg_DeInitTrace();
#endif
}
}
else
@ -1195,12 +1198,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
}
// VBA always ensure screenupdating is enabled after completing
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
#if 0
if ( pBasic && pBasic->IsDocBasic() && !pINST )
UnlockControllerHack( pBasic );
#endif
if( bDelInst )
{
// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
@ -1332,6 +1330,61 @@ void SbModule::ClearPrivateVars()
}
}
void SbModule::implClearIfVarDependsOnDeletedBasic( SbxVariable* pVar, StarBASIC* pDeletedBasic )
{
if( pVar->SbxValue::GetType() != SbxOBJECT || pVar->ISA( SbProcedureProperty ) )
return;
SbxObject* pObj = PTR_CAST(SbxObject,pVar->GetObject());
if( pObj != NULL )
{
SbxObject* p = pObj;
SbModule* pMod = PTR_CAST( SbModule, p );
if( pMod != NULL )
pMod->ClearVarsDependingOnDeletedBasic( pDeletedBasic );
while( (p = p->GetParent()) != NULL )
{
StarBASIC* pBasic = PTR_CAST( StarBASIC, p );
if( pBasic != NULL && pBasic == pDeletedBasic )
{
pVar->SbxValue::Clear();
break;
}
}
}
}
void SbModule::ClearVarsDependingOnDeletedBasic( StarBASIC* pDeletedBasic )
{
(void)pDeletedBasic;
for( USHORT i = 0 ; i < pProps->Count() ; i++ )
{
SbProperty* p = PTR_CAST(SbProperty,pProps->Get( i ) );
if( p )
{
if( p->GetType() & SbxARRAY )
{
SbxArray* pArray = PTR_CAST(SbxArray,p->GetObject());
if( pArray )
{
for( USHORT j = 0 ; j < pArray->Count() ; j++ )
{
SbxVariable* pVar = PTR_CAST(SbxVariable,pArray->Get( j ));
implClearIfVarDependsOnDeletedBasic( pVar, pDeletedBasic );
}
}
}
else
{
implClearIfVarDependsOnDeletedBasic( p, pDeletedBasic );
}
}
}
}
// Zunaechst in dieses Modul, um 358-faehig zu bleiben
// (Branch in sb.cxx vermeiden)
void StarBASIC::ClearAllModuleVars( void )
@ -1341,7 +1394,7 @@ void StarBASIC::ClearAllModuleVars( void )
{
SbModule* pModule = (SbModule*)pModules->Get( nMod );
// Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde
if( pModule->pImage && pModule->pImage->bInit )
if( pModule->pImage && pModule->pImage->bInit && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
pModule->ClearPrivateVars();
}
@ -1739,6 +1792,98 @@ BOOL SbModule::LoadCompleted()
return TRUE;
}
void SbModule::handleProcedureProperties( SfxBroadcaster& rBC, const SfxHint& rHint )
{
bool bDone = false;
const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
if( pHint )
{
SbxVariable* pVar = pHint->GetVar();
SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
if( pProcProperty )
{
bDone = true;
if( pHint->GetId() == SBX_HINT_DATAWANTED )
{
String aProcName;
aProcName.AppendAscii( "Property Get " );
aProcName += pProcProperty->GetName();
SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
if( pMeth )
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
SbxArray* pArg = pVar->GetParameters();
USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
if( nVarParCount > 1 )
{
SbxArrayRef xMethParameters = new SbxArray;
xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
for( USHORT i = 1 ; i < nVarParCount ; ++i )
{
SbxVariable* pPar = pArg->Get( i );
xMethParameters->Put( pPar, i );
}
pMeth->SetParameters( xMethParameters );
pMeth->Get( aVals );
pMeth->SetParameters( NULL );
}
else
{
pMeth->Get( aVals );
}
pVar->Put( aVals );
}
}
else if( pHint->GetId() == SBX_HINT_DATACHANGED )
{
SbxVariable* pMeth = NULL;
bool bSet = pProcProperty->isSet();
if( bSet )
{
pProcProperty->setSet( false );
String aProcName;
aProcName.AppendAscii( "Property Set " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
if( !pMeth ) // Let
{
String aProcName;
aProcName.AppendAscii( "Property Let " );
aProcName += pProcProperty->GetName();
pMeth = Find( aProcName, SbxCLASS_METHOD );
}
if( pMeth )
{
// Setup parameters
SbxArrayRef xArray = new SbxArray;
xArray->Put( pMeth, 0 ); // Method as parameter 0
xArray->Put( pVar, 1 );
pMeth->SetParameters( xArray );
SbxValues aVals;
pMeth->Get( aVals );
pMeth->SetParameters( NULL );
}
}
}
}
if( !bDone )
SbModule::Notify( rBC, rHint );
}
/////////////////////////////////////////////////////////////////////////
// Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen)
SbJScriptModule::SbJScriptModule( const String& rName )
@ -1969,6 +2114,11 @@ SbObjModule::SbObjModule( const String& rName, const com::sun::star::script::Mod
else if ( mInfo.ModuleObject.is() )
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
}
SbObjModule::~SbObjModule()
{
}
void
SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
{
@ -2005,6 +2155,13 @@ SbObjModule::Find( const XubString& rName, SbxClassType t )
return pVar;
}
void SbObjModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType )
{
SbModule::handleProcedureProperties( rBC, rHint );
}
typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
class FormObjEventListenerImpl : public FormObjEventListener_BASE
@ -2192,9 +2349,9 @@ SbUserFormModule::~SbUserFormModule()
{
}
void SbUserFormModule::ResetApiObj()
void SbUserFormModule::ResetApiObj( bool bTriggerTerminateEvent )
{
if ( m_xDialog.is() ) // probably someone close the dialog window
if ( bTriggerTerminateEvent && m_xDialog.is() ) // probably someone close the dialog window
{
triggerTerminateEvent();
}
@ -2379,11 +2536,12 @@ void SbUserFormModule::Unload()
}
//liuchen
void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
void SbUserFormModule::InitObject()
{
try
{
String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
@ -2410,6 +2568,25 @@ void SbUserFormModule::InitObject()
aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) );
uno::Reference< lang::XComponent > xComponent( aArgs[ 1 ], uno::UNO_QUERY_THROW );
// the dialog must be disposed at the end!
if( xComponent.is() )
{
StarBASIC* pParentBasic = NULL;
SbxObject* pCurObject = this;
do
{
SbxObject* pObjParent = pCurObject->GetParent();
pParentBasic = PTR_CAST( StarBASIC, pObjParent );
pCurObject = pObjParent;
}
while( pParentBasic == NULL && pCurObject != NULL );
OSL_ASSERT( pParentBasic != NULL );
registerComponentToBeDisposedForBasic( xComponent, pParentBasic );
}
// remove old listener if it exists
if ( m_DialogListener.get() )
m_DialogListener->removeListener();

View File

@ -375,6 +375,9 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
if( pDef->IsWithEvents() )
nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG;
if( bCompatible && pDef->IsNew() )
nOpnd2 |= SBX_TYPE_DIM_AS_NEW_FLAG;
short nFixedStringLength = pDef->GetFixedStringLength();
if( nFixedStringLength >= 0 )
nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000

View File

@ -578,10 +578,20 @@ SbiExprNode* SbiExpression::Unary()
{
case MINUS:
eTok = NEG;
case NOT:
pParser->Next();
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
break;
case NOT:
if( pParser->IsVBASupportOn() )
{
pNd = Operand();
}
else
{
pParser->Next();
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
}
break;
case PLUS:
pParser->Next();
pNd = Unary();
@ -725,9 +735,26 @@ SbiExprNode* SbiExpression::Comp()
return pNd;
}
SbiExprNode* SbiExpression::VBA_Not()
{
SbiExprNode* pNd = NULL;
SbiToken eTok = pParser->Peek();
if( eTok == NOT )
{
pParser->Next();
pNd = new SbiExprNode( pParser, VBA_Not(), eTok, NULL );
}
else
{
pNd = Comp();
}
return pNd;
}
SbiExprNode* SbiExpression::Like()
{
SbiExprNode* pNd = Comp();
SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
if( m_eMode != EXPRMODE_EMPTY_PAREN )
{
short nCount = 0;

View File

@ -32,6 +32,7 @@
#include "sbcomp.hxx"
#include "image.hxx"
#include "sbtrace.hxx"
#include <basic/sbobjmod.hxx>
//==========================================================================
@ -42,11 +43,145 @@
#include <hash_map>
// Trace Settings
static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt";
static const bool GbIncludePCodes = false;
static const int GnIndentPerCallLevel = 4;
static const int GnIndentForPCode = 2;
// Trace ini file (set NULL to ignore)
static char GpTraceIniFile[] = "d:\\zBasic.Asm\\BasicTrace.ini";
//static char* GpTraceIniFile = NULL;
// Trace Settings, used if no ini file / not found in ini file
static char GpTraceFileNameDefault[] = "d:\\zBasic.Asm\\BasicTrace.txt";
static char* GpTraceFileName = GpTraceFileNameDefault;
// GbTraceOn:
// true = tracing is active, false = tracing is disabled, default = true
// Set to false initially if you want to activate tracing on demand with
// TraceCommand( "TraceOn" ), see below
static bool GbTraceOn = true;
// GbIncludePCodes:
// true = PCodes are written to trace, default = false, correspondents
// with TraceCommand( "PCodeOn" / "PCodeOff" ), see below
static bool GbIncludePCodes = false;
static int GnIndentPerCallLevel = 4;
static int GnIndentForPCode = 2;
/*
With trace enabled the runtime function TraceCommand
can be used to influence the trace functionality
from within the running Basic macro.
Format: TraceCommand( command as String [, param as Variant] )
Supported commands (command is NOT case sensitive):
TraceCommand "TraceOn" sets GbTraceOn = true
TraceCommand "TraceOff" sets GbTraceOn = false
TraceCommand "PCodeOn" sets GbIncludePCodes = true
TraceCommand "PCodeOff" sets GbIncludePCodes = false
TraceCommand "Print", aVal writes aVal into the trace file as
long as it can be converted to string
*/
static void lcl_skipWhites( char*& rpc )
{
while( *rpc == ' ' || *rpc == '\t' )
++rpc;
}
inline void lcl_findNextLine( char*& rpc, char* pe )
{
// Find line end
while( rpc < pe && *rpc != 13 && *rpc != 10 )
++rpc;
// Read all
while( rpc < pe && (*rpc == 13 || *rpc == 10) )
++rpc;
}
inline bool lcl_isAlpha( char c )
{
bool bRet = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
return bRet;
}
static void lcl_ReadIniFile( const char* pIniFileName )
{
const int BUF_SIZE = 1000;
static sal_Char TraceFileNameBuffer[BUF_SIZE];
sal_Char Buffer[BUF_SIZE];
sal_Char VarNameBuffer[BUF_SIZE];
sal_Char ValBuffer[BUF_SIZE];
FILE* pFile = fopen( pIniFileName ,"rb" );
if( pFile == NULL )
return;
size_t nRead = fread( Buffer, 1, BUF_SIZE, pFile );
// Scan
char* pc = Buffer;
char* pe = Buffer + nRead;
while( pc < pe )
{
lcl_skipWhites( pc ); if( pc == pe ) break;
// Read variable
char* pVarStart = pc;
while( pc < pe && lcl_isAlpha( *pc ) )
++pc;
int nVarLen = pc - pVarStart;
if( nVarLen == 0 )
{
lcl_findNextLine( pc, pe );
continue;
}
strncpy( VarNameBuffer, pVarStart, nVarLen );
VarNameBuffer[nVarLen] = '\0';
// Check =
lcl_skipWhites( pc ); if( pc == pe ) break;
if( *pc != '=' )
continue;
++pc;
lcl_skipWhites( pc ); if( pc == pe ) break;
// Read value
char* pValStart = pc;
while( pc < pe && *pc != 13 && *pc != 10 )
++pc;
int nValLen = pc - pValStart;
if( nValLen == 0 )
{
lcl_findNextLine( pc, pe );
continue;
}
strncpy( ValBuffer, pValStart, nValLen );
ValBuffer[nValLen] = '\0';
// Match variables
if( strcmp( VarNameBuffer, "GpTraceFileName") == 0 )
{
strcpy( TraceFileNameBuffer, ValBuffer );
GpTraceFileName = TraceFileNameBuffer;
}
else
if( strcmp( VarNameBuffer, "GbTraceOn") == 0 )
GbTraceOn = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GbIncludePCodes") == 0 )
GbIncludePCodes = (strcmp( ValBuffer, "true" ) == 0);
else
if( strcmp( VarNameBuffer, "GnIndentPerCallLevel") == 0 )
GnIndentPerCallLevel = strtol( ValBuffer, NULL, 10 );
else
if( strcmp( VarNameBuffer, "GnIndentForPCode") == 0 )
GnIndentForPCode = strtol( ValBuffer, NULL, 10 );
}
fclose( pFile );
}
struct TraceTextData
{
@ -122,7 +257,7 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
return aORetStr;
}
String dumpMethodParameters( SbMethod* pMethod )
String lcl_dumpMethodParameters( SbMethod* pMethod )
{
String aStr;
if( pMethod == NULL )
@ -149,9 +284,10 @@ String dumpMethodParameters( SbMethod* pMethod )
aStr += pParam->aName;
}
aStr += '=';
if( pVar->GetType() & SbxARRAY )
SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
else
else if( eType != SbxOBJECT )
aStr += pVar->GetString();
if ( nParam < ( pParams->Count() - 1 ) )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
@ -166,16 +302,36 @@ String dumpMethodParameters( SbMethod* pMethod )
return aStr;
}
// Public functions
static bool GbSavTraceOn = false;
void dbg_InitTrace( void )
{
if( GpTraceIniFile != NULL )
lcl_ReadIniFile( GpTraceIniFile );
FILE* pFile = fopen( GpTraceFileName, "w" );
if( pFile != NULL )
fclose( pFile );
GbSavTraceOn = GbTraceOn;
if( !GbTraceOn )
lcl_lineOut( GpTraceFileName, "### Program started with trace off ###" );
}
void dbg_DeInitTrace( void )
{
GbTraceOn = GbSavTraceOn;
}
static INT32 GnLastCallLvl = 0;
void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
{
if( !GbTraceOn )
return;
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule;
if( pTraceMod->ISA(SbClassModuleObject) )
{
@ -206,14 +362,11 @@ void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
{
const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
char Buffer[200];
sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr );
sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", (int)nPC, pModuleNameStr );
lcl_lineOut( GpTraceFileName, Buffer );
return;
}
//nCallLvl--;
//if( nCallLvl < 0 )
// nCallLvl = 0;
int nIndent = nCallLvl * GnIndentPerCallLevel;
const TraceTextData& rTraceTextData = itInner->second;
@ -234,6 +387,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
{
static const char* pSeparator = "' ================================================================================";
if( !GbTraceOn )
return;
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule;
SbClassModuleObject* pClassModuleObj = NULL;
if( pTraceMod->ISA(SbClassModuleObject) )
@ -281,7 +438,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
aStr.AppendAscii( "]" );
}
if( !bLeave )
aStr += dumpMethodParameters( pMethod );
aStr += lcl_dumpMethodParameters( pMethod );
lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
if( !bLeave )
@ -293,6 +450,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
{
if( !GbTraceOn )
return;
GnLastCallLvl = nCallLvl;
rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
char Buffer[200];
@ -329,6 +490,63 @@ void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
(*pInnerMap)[nPC] = aData;
}
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
{
(void)pBasic;
(void)bWrite;
if ( rPar.Count() < 2 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
String aCommand = rPar.Get(1)->GetString();
if( aCommand.EqualsIgnoreCaseAscii( "TraceOn" ) )
GbTraceOn = true;
else
if( aCommand.EqualsIgnoreCaseAscii( "TraceOff" ) )
GbTraceOn = false;
else
if( aCommand.EqualsIgnoreCaseAscii( "PCodeOn" ) )
GbIncludePCodes = true;
else
if( aCommand.EqualsIgnoreCaseAscii( "PCodeOff" ) )
GbIncludePCodes = false;
else
if( aCommand.EqualsIgnoreCaseAscii( "Print" ) )
{
if ( rPar.Count() < 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
SbxError eOld = SbxBase::GetError();
if( eOld != SbxERR_OK )
SbxBase::ResetError();
String aValStr = rPar.Get(2)->GetString();
SbxError eErr = SbxBase::GetError();
if( eErr != SbxERR_OK )
{
aValStr = String( RTL_CONSTASCII_USTRINGPARAM( "<ERROR converting value to String>" ) );
SbxBase::ResetError();
}
char Buffer[500];
const char* pValStr = OUStringToOString( rtl::OUString( aValStr ), RTL_TEXTENCODING_ASCII_US ).getStr();
sprintf( Buffer, "### TRACE_PRINT: %s ###", pValStr );
int nIndent = GnLastCallLvl * GnIndentPerCallLevel;
lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
if( eOld != SbxERR_OK )
SbxBase::SetError( eOld );
}
}
#endif
@ -431,6 +649,7 @@ BOOL SbModule::Compile()
BOOL bRet = IsCompiled();
if( bRet )
{
if( !this->ISA(SbObjModule) )
pBasic->ClearAllModuleVars();
RemoveVars(); // remove 'this' Modules variables
// clear all method statics

View File

@ -224,6 +224,30 @@ BOOL SbiScanner::NextSym()
for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ )
nCol++;
aSym = aLine.copy( n, nCol - n );
// Special handling for "go to"
if( bCompatible && *pLine && aSym.EqualsIgnoreCaseAscii( "go" ) )
{
const sal_Unicode* pTestLine = pLine;
short nTestCol = nCol;
while( *pTestLine && (( *pTestLine == ' ' ) || ( *pTestLine == '\t' )) )
{
pTestLine++;
nTestCol++;
}
if( *pTestLine && *(pTestLine + 1) )
{
String aTestSym = aLine.copy( nTestCol, 2 );
if( aTestSym.EqualsIgnoreCaseAscii( "to" ) )
{
aSym = String::CreateFromAscii( "goto" );
pLine = pTestLine + 2;
nCol = nTestCol + 2;
}
}
}
// Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt
// (sonst falsche Zeilenfortsetzung)
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )

View File

@ -206,9 +206,10 @@ void SbiSymPool::Add( SbiSymDef* pDef )
SbiSymDef* SbiSymPool::Find( const String& rName ) const
{
for( USHORT i = 0; i < aData.Count(); i++ )
USHORT nCount = aData.Count();
for( USHORT i = 0; i < nCount; i++ )
{
SbiSymDef* p = aData.GetObject( i );
SbiSymDef* p = aData.GetObject( nCount - i - 1 );
if( ( !p->nProcId || ( p->nProcId == nProcId ) )
&& ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
return p;

View File

@ -188,6 +188,7 @@ protected:
SbiExprNode* AddSub();
SbiExprNode* Cat();
SbiExprNode* Like();
SbiExprNode* VBA_Not();
SbiExprNode* Comp();
SbiExprNode* Boolean();
public:

View File

@ -276,6 +276,8 @@ struct RefSaveItem
class SbiRuntime
{
friend void SbRtl_CallByName( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
typedef void( SbiRuntime::*pStep0 )();
typedef void( SbiRuntime::*pStep1 )( UINT32 nOp1 );
typedef void( SbiRuntime::*pStep2 )( UINT32 nOp1, UINT32 nOp2 );
@ -434,7 +436,7 @@ class SbiRuntime
void StepDCREATE_REDIMP(UINT32,UINT32), StepDCREATE_IMPL(UINT32,UINT32);
void StepFIND_CM( UINT32, UINT32 );
void StepFIND_STATIC( UINT32, UINT32 );
void implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 );
void implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 );
public:
void SetVBAEnabled( bool bEnabled );
USHORT GetImageFlag( USHORT n ) const;

View File

@ -28,15 +28,17 @@
#ifndef _SBTRACE_HXX
#define _SBTRACE_HXX
// #define DBG_TRACE_BASIC
//#define DBG_TRACE_BASIC
#ifdef DBG_TRACE_BASIC
void dbg_InitTrace( void );
void dbg_DeInitTrace( void );
void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false );
void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
#endif
#endif

View File

@ -52,7 +52,7 @@ class SbUnoObject: public SbxObject
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactName;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
BOOL bNeedIntrospection;
BOOL bIgnoreNativeCOMObjectMembers;
BOOL bNativeCOMObject;
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
// Hilfs-Methode zum Anlegen der dbg_-Properties
@ -84,17 +84,22 @@ public:
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > getInvocation( void ) { return mxInvocation; }
void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
bool isNativeCOMObject( void )
{ return bNativeCOMObject; }
};
SV_DECL_IMPL_REF(SbUnoObject);
// #67781 Rueckgabewerte der Uno-Methoden loeschen
void clearUnoMethods( void );
void clearUnoMethodsForBasic( StarBASIC* pBasic );
class SbUnoMethod : public SbxMethod
{
friend class SbUnoObject;
friend void clearUnoMethods( void );
friend void clearUnoMethodsForBasic( StarBASIC* pBasic );
::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod;
::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq;
@ -104,12 +109,14 @@ class SbUnoMethod : public SbxMethod
SbUnoMethod* pNext;
bool mbInvocation; // Method is based on invocation
bool mbDirectInvocation; // Method should be used with XDirectInvocation interface
public:
TYPEINFO();
SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
bool bInvocation );
bool bInvocation,
bool bDirect = false );
virtual ~SbUnoMethod();
virtual SbxInfo* GetInfo();
@ -117,6 +124,8 @@ public:
bool isInvocationBased( void )
{ return mbInvocation; }
bool needsDirectInvocation( void )
{ return mbDirectInvocation; }
};
@ -293,6 +302,9 @@ void RTL_Impl_IsUnoStruct( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void RTL_Impl_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void RTL_Impl_GetDefaultContext( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void disposeComVariablesForBasic( StarBASIC* pBasic );
void clearNativeObjectWrapperVector( void );
//========================================================================
// #118116 Collection object

View File

@ -43,6 +43,7 @@ namespace basic
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
{
::rtl::OUString maScriptLanguage;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxCodeNameAccess;
// Methods to distinguish between deffirent library types
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName );

View File

@ -0,0 +1,81 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#include "precompiled_basic.hxx"
#include "comenumwrapper.hxx"
using namespace ::com::sun::star;
::sal_Bool SAL_CALL ComEnumerationWrapper::hasMoreElements()
throw ( uno::RuntimeException )
{
sal_Bool bResult = sal_False;
try
{
if ( m_xInvocation.is() )
{
sal_Int32 nLength = 0;
bResult =
( ( m_xInvocation->getValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "length" ) ) ) >>= nLength )
&& nLength > m_nCurInd );
}
}
catch( uno::Exception& )
{}
return bResult;
}
uno::Any SAL_CALL ComEnumerationWrapper::nextElement()
throw ( container::NoSuchElementException,
lang::WrappedTargetException,
uno::RuntimeException )
{
try
{
if ( m_xInvocation.is() )
{
uno::Sequence< sal_Int16 > aNamedParamIndex;
uno::Sequence< uno::Any > aNamedParam;
uno::Sequence< uno::Any > aArgs( 1 );
aArgs[0] <<= m_nCurInd++;
return m_xInvocation->invoke( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "item" ) ),
aArgs,
aNamedParamIndex,
aNamedParam );
}
}
catch( uno::Exception& )
{}
throw container::NoSuchElementException();
}

View File

@ -0,0 +1,54 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
*
************************************************************************/
#ifndef _COMENUMWRAPPER_HXX
#define _COMENUMWRAPPER_HXX
#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <cppuhelper/implbase1.hxx>
class ComEnumerationWrapper : public ::cppu::WeakImplHelper1< ::com::sun::star::container::XEnumeration >
{
::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > m_xInvocation;
sal_Int32 m_nCurInd;
public:
ComEnumerationWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation >& xInvocation )
: m_xInvocation( xInvocation )
, m_nCurInd( 0 )
{
}
// container::XEnumeration
virtual ::sal_Bool SAL_CALL hasMoreElements() throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Any SAL_CALL nextElement() throw (::com::sun::star::container::NoSuchElementException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
};
#endif // _COMENUMWRAPPER_HXX

View File

@ -41,6 +41,7 @@ ENABLE_EXCEPTIONS = TRUE
SLOFILES= \
$(SLO)$/basrdll.obj \
$(SLO)$/comenumwrapper.obj \
$(SLO)$/inputbox.obj \
$(SLO)$/runtime.obj \
$(SLO)$/step0.obj \

127
basic/source/runtime/methods1.cxx Normal file → Executable file
View File

@ -112,6 +112,126 @@ static Reference< XCalendar > getLocaleCalendar( void )
return xCalendar;
}
RTLFUNC(CallByName)
{
(void)pBasic;
(void)bWrite;
const INT16 vbGet = 2;
const INT16 vbLet = 4;
const INT16 vbMethod = 1;
const INT16 vbSet = 8;
// At least 3 parameter needed plus function itself -> 4
USHORT nParCount = rPar.Count();
if ( nParCount < 4 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
// 1. parameter is object
SbxBase* pObjVar = (SbxObject*)rPar.Get(1)->GetObject();
SbxObject* pObj = NULL;
if( pObjVar )
pObj = PTR_CAST(SbxObject,pObjVar);
if( !pObj && pObjVar && pObjVar->ISA(SbxVariable) )
{
SbxBase* pObjVarObj = ((SbxVariable*)pObjVar)->GetObject();
pObj = PTR_CAST(SbxObject,pObjVarObj);
}
if( !pObj )
{
StarBASIC::Error( SbERR_BAD_PARAMETER );
return;
}
// 2. parameter is ProcedureName
String aNameStr = rPar.Get(2)->GetString();
// 3. parameter is CallType
INT16 nCallType = rPar.Get(3)->GetInteger();
//SbxObject* pFindObj = NULL;
SbxVariable* pFindVar = pObj->Find( aNameStr, SbxCLASS_DONTCARE );
if( pFindVar == NULL )
{
StarBASIC::Error( SbERR_PROC_UNDEFINED );
return;
}
switch( nCallType )
{
case vbGet:
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
pFindVar->Get( aVals );
SbxVariableRef refVar = rPar.Get(0);
refVar->Put( aVals );
}
break;
case vbLet:
case vbSet:
{
if ( nParCount != 5 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return;
}
SbxVariableRef pValVar = rPar.Get(4);
if( nCallType == vbLet )
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
pValVar->Get( aVals );
pFindVar->Put( aVals );
}
else
{
SbxVariableRef rFindVar = pFindVar;
SbiInstance* pInst = pINST;
SbiRuntime* pRT = pInst ? pInst->pRun : NULL;
if( pRT != NULL )
pRT->StepSET_Impl( pValVar, rFindVar, false );
}
}
break;
case vbMethod:
{
SbMethod* pMeth = PTR_CAST(SbMethod,pFindVar);
if( pMeth == NULL )
{
StarBASIC::Error( SbERR_PROC_UNDEFINED );
return;
}
// Setup parameters
SbxArrayRef xArray;
USHORT nMethParamCount = nParCount - 4;
if( nMethParamCount > 0 )
{
xArray = new SbxArray;
for( USHORT i = 0 ; i < nMethParamCount ; i++ )
{
SbxVariable* pPar = rPar.Get( i + 4 );
xArray->Put( pPar, i + 1 );
}
}
// Call method
SbxVariableRef refVar = rPar.Get(0);
if( xArray.Is() )
pMeth->SetParameters( xArray );
pMeth->Call( refVar );
pMeth->SetParameters( NULL );
}
break;
default:
StarBASIC::Error( SbERR_PROC_UNDEFINED );
}
}
RTLFUNC(CBool) // JSM
{
@ -527,6 +647,7 @@ RTLFUNC(DoEvents)
//aTimer.Start();
//while ( aTimer.IsActive() )
// Application::Reschedule();
Application::Reschedule( true );
}
RTLFUNC(GetGUIVersion)
@ -1513,6 +1634,12 @@ RTLFUNC(GetDefaultContext)
RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite );
}
#ifdef DBG_TRACE_BASIC
RTLFUNC(TraceCommand)
{
RTL_Impl_TraceCommand( pBasic, rPar, bWrite );
}
#endif
RTLFUNC(Join)
{

View File

@ -26,6 +26,7 @@
************************************************************************/
#include <basic/sbstar.hxx>
#include "sbtrace.hxx"
#define RTLFUNC( name ) void SbRtl_##name( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite )
#define RTLNAME( name ) &SbRtl_##name
@ -271,6 +272,7 @@ extern RTLFUNC(AboutStarBasic);
extern RTLFUNC(LoadPicture);
extern RTLFUNC(SavePicture);
extern RTLFUNC(CallByName);
extern RTLFUNC(CBool); // JSM
extern RTLFUNC(CByte); // JSM
extern RTLFUNC(CCur); // JSM
@ -345,5 +347,9 @@ extern RTLFUNC(CDec);
extern RTLFUNC(Partition); // Fong
#ifdef DBG_TRACE_BASIC
extern RTLFUNC(TraceCommand);
#endif
extern double Now_Impl();
extern void Wait_Impl( bool bDurationBased, SbxArray& rPar );

View File

@ -45,6 +45,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
#include "sbtrace.hxx"
#include "comenumwrapper.hxx"
using namespace ::com::sun::star;
@ -890,11 +891,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details )
{
if ( _errCode )
{
OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
// Not correct for class module usage, remove for now
//OSL_ENSURE( pInst->pRun == this, "SbiRuntime::Error: can't propagate the error message details!" );
if ( pInst->pRun == this )
{
pInst->Error( _errCode, _details );
OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
//OSL_POSTCOND( nError == _errCode, "SbiRuntime::Error: the instance is expecte to propagate the error code back to me!" );
}
else
{
@ -1176,6 +1178,23 @@ void SbiRuntime::PushForEach()
p->xEnumeration = xEnumerationAccess->createEnumeration();
p->eForType = FOR_EACH_XENUMERATION;
}
else if ( isVBAEnabled() && pUnoObj->isNativeCOMObject() )
{
uno::Reference< script::XInvocation > xInvocation;
if ( ( aAny >>= xInvocation ) && xInvocation.is() )
{
try
{
p->xEnumeration = new ComEnumerationWrapper( xInvocation );
p->eForType = FOR_EACH_XENUMERATION;
}
catch( uno::Exception& )
{}
}
if ( !p->xEnumeration.is() )
bError_ = true;
}
else
{
bError_ = true;

View File

@ -94,6 +94,10 @@ static Methods aMethods[] = {
{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "CallByName", SbxVARIANT, 3 | _FUNCTION, RTLNAME(CallByName),0 },
{ "Object", SbxOBJECT, 0,NULL,0 },
{ "ProcedureName",SbxSTRING, 0,NULL,0 },
{ "CallType", SbxINTEGER, 0,NULL,0 },
{ "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 },
@ -531,6 +535,10 @@ static Methods aMethods[] = {
{ "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 },
{ "String", SbxSTRING, 0,NULL,0 },
{ "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),0 },
#ifdef DBG_TRACE_BASIC
{ "TraceCommand", SbxNULL, 1 | _FUNCTION, RTLNAME(TraceCommand),0 },
{ "Command", SbxSTRING, 0,NULL,0 },
#endif
{ "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 },
{ "String", SbxSTRING, 0,NULL,0 },
{ "True", SbxBOOL, _CPROP, RTLNAME(True),0 },

View File

@ -47,6 +47,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
#include <algorithm>
#include <hash_map>
SbxVariable* getDefaultProp( SbxVariable* pRef );
@ -418,9 +419,53 @@ void SbiRuntime::StepPUT()
}
// VBA Dim As New behavior handling, save init object information
struct DimAsNewRecoverItem
{
String m_aObjClass;
String m_aObjName;
SbxObject* m_pObjParent;
SbModule* m_pClassModule;
DimAsNewRecoverItem( void )
: m_pObjParent( NULL )
, m_pClassModule( NULL )
{}
DimAsNewRecoverItem( const String& rObjClass, const String& rObjName,
SbxObject* pObjParent, SbModule* pClassModule )
: m_aObjClass( rObjClass )
, m_aObjName( rObjName )
, m_pObjParent( pObjParent )
, m_pClassModule( pClassModule )
{}
};
struct SbxVariablePtrHash
{
size_t operator()( SbxVariable* pVar ) const
{ return (size_t)pVar; }
};
typedef std::hash_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash;
static DimAsNewRecoverHash GaDimAsNewRecoverHash;
void removeDimAsNewRecoverItem( SbxVariable* pVar )
{
DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( pVar );
if( it != GaDimAsNewRecoverHash.end() )
GaDimAsNewRecoverHash.erase( it );
}
// Speichern Objektvariable
// Nicht-Objekt-Variable fuehren zu Fehlern
static const char pCollectionStr[] = "Collection";
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{
// #67733 Typen mit Array-Flag sind auch ok
@ -523,6 +568,12 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
}
// Handle Dim As New
BOOL bDimAsNew = bVBAEnabled && refVar->IsSet( SBX_DIM_AS_NEW );
SbxBaseRef xPrevVarObj;
if( bDimAsNew )
xPrevVarObj = refVar->GetObject();
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
@ -541,7 +592,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
refVal->SetDeclareClassName( aDeclareClassName );
refVal->SetComListener( xComListener ); // Hold reference
refVal->SetComListener( xComListener, &rBasic ); // Hold reference
}
*refVar = *refVal;
@ -551,6 +602,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
*refVar = *refVal;
}
if ( bDimAsNew )
{
if( !refVar->ISA(SbxObject) )
{
SbxBase* pValObjBase = refVal->GetObject();
if( pValObjBase == NULL )
{
if( xPrevVarObj.Is() )
{
// Object is overwritten with NULL, instantiate init object
DimAsNewRecoverHash::iterator it = GaDimAsNewRecoverHash.find( refVar );
if( it != GaDimAsNewRecoverHash.end() )
{
const DimAsNewRecoverItem& rItem = it->second;
if( rItem.m_pClassModule != NULL )
{
SbClassModuleObject* pNewObj = new SbClassModuleObject( rItem.m_pClassModule );
pNewObj->SetName( rItem.m_aObjName );
pNewObj->SetParent( rItem.m_pObjParent );
refVar->PutObject( pNewObj );
}
else if( rItem.m_aObjClass.EqualsIgnoreCaseAscii( pCollectionStr ) )
{
BasicCollection* pNewCollection = new BasicCollection( String( RTL_CONSTASCII_USTRINGPARAM(pCollectionStr) ) );
pNewCollection->SetName( rItem.m_aObjName );
pNewCollection->SetParent( rItem.m_pObjParent );
refVar->PutObject( pNewCollection );
}
}
}
}
else
{
// Does old value exist?
bool bFirstInit = !xPrevVarObj.Is();
if( bFirstInit )
{
// Store information to instantiate object later
SbxObject* pValObj = PTR_CAST(SbxObject,pValObjBase);
if( pValObj != NULL )
{
String aObjClass = pValObj->GetClassName();
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pValObjBase);
if( pClassModuleObj != NULL )
{
SbModule* pClassModule = pClassModuleObj->getClassModule();
GaDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), pClassModule );
}
else if( aObjClass.EqualsIgnoreCaseAscii( "Collection" ) )
{
GaDimAsNewRecoverHash[refVar] =
DimAsNewRecoverItem( aObjClass, pValObj->GetName(), pValObj->GetParent(), NULL );
}
}
}
}
}
}
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
// in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY

View File

@ -143,6 +143,9 @@ SbxVariable* SbiRuntime::FindElement
else
pElem = getVBAConstant( aName );
}
if( !pElem )
{
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
// Modulen IMMER ein Ergebnis!
SbUnoClass* pUnoClass = findUnoClass( aName );
@ -153,6 +156,7 @@ SbxVariable* SbiRuntime::FindElement
aRes.pObj = pUnoClass;
pElem->SbxVariable::Put( aRes );
}
}
// #62939 Wenn eine Uno-Klasse gefunden wurde, muss
// das Wrapper-Objekt gehalten werden, da sonst auch
@ -407,6 +411,34 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
}
}
}
else if( bVBAEnabled && p->GetType() == SbxOBJECT && (!p->ISA(SbxMethod) || !p->IsBroadcaster()) )
{
// Check for default method with named parameters
SbxBaseRef pObj = (SbxBase*)p->GetObject();
if( pObj && pObj->ISA(SbUnoObject) )
{
SbUnoObject* pUnoObj = (SbUnoObject*)(SbxBase*)pObj;
Any aAny = pUnoObj->getUnoAny();
if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE )
{
Reference< XInterface > x = *(Reference< XInterface >*)aAny.getValue();
Reference< XDefaultMethod > xDfltMethod( x, UNO_QUERY );
rtl::OUString sDefaultMethod;
if ( xDfltMethod.is() )
sDefaultMethod = xDfltMethod->getDefaultMethodName();
if ( sDefaultMethod.getLength() )
{
SbxVariable* meth = pUnoObj->Find( sDefaultMethod, SbxCLASS_METHOD );
if( meth != NULL )
pInfo = meth->GetInfo();
if( pInfo )
bError_ = false;
}
}
}
}
if( bError_ )
Error( SbERR_NO_NAMED_ARGS );
}
@ -489,7 +521,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pPar->Put( NULL, 0 );
}
// Index-Access bei UnoObjekten beruecksichtigen
else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) )
else if( pElem->GetType() == SbxOBJECT && (!pElem->ISA(SbxMethod) || !pElem->IsBroadcaster()) )
{
pPar = pElem->GetParameters();
if ( pPar )
@ -589,6 +621,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pCol->CollItem( pPar );
}
}
else if( bVBAEnabled ) // !pObj
{
SbxArray* pParam = pElem->GetParameters();
if( pParam != NULL )
Error( SbERR_NO_OBJECT );
}
}
}
@ -1085,12 +1123,24 @@ void SbiRuntime::StepTCREATE( UINT32 nOp1, UINT32 nOp2 )
PushVar( pNew );
}
void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 )
void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 )
{
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
if( bWithEvents )
pVar->SetFlag( SBX_WITH_EVENTS );
bool bDimAsNew = ((nOp2 & SBX_TYPE_DIM_AS_NEW_FLAG) != 0);
if( bDimAsNew )
pVar->SetFlag( SBX_DIM_AS_NEW );
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
if( bFixedString )
{
USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000
String aStr;
aStr.Fill( nCount, 0 );
pStrVar->PutString( aStr );
pVar->PutString( aStr );
}
}
// Einrichten einer lokalen Variablen (+StringID+Typ)
@ -1105,12 +1155,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
SbxVariable* p = new SbxVariable( t );
p->SetName( aName );
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
if( bWithEvents )
p->SetFlag( SBX_WITH_EVENTS );
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
if( bFixedString )
implCreateFixedString( p, nOp2 );
implHandleSbxFlags( p, t, nOp2 );
refLocals->Put( p, refLocals->Count() );
}
}
@ -1137,12 +1182,7 @@ void SbiRuntime::StepPUBLIC_Impl( UINT32 nOp1, UINT32 nOp2, bool bUsedForClassMo
// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
pProp->SetFlag( SBX_NO_MODIFY);
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
if( bWithEvents )
pProp->SetFlag( SBX_WITH_EVENTS );
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
if( bFixedString )
implCreateFixedString( p, nOp2 );
implHandleSbxFlags( pProp, t, nOp2 );
}
}

View File

@ -91,7 +91,7 @@ enum SbxBOOL ImpGetBool( const SbxValues* p )
{
if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_TRUE ) ) )
nRes = SbxTRUE;
else if( p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
else if( !p->pOUString->equalsIgnoreAsciiCase( SbxRes( STRING_FALSE ) ) )
{
// Jetzt kann es noch in eine Zahl konvertierbar sein
BOOL bError = TRUE;

View File

@ -112,6 +112,9 @@ SbxObject::~SbxObject()
CheckParentsOnDelete( this, pProps );
CheckParentsOnDelete( this, pMethods );
CheckParentsOnDelete( this, pObjs );
// avoid handling in ~SbxVariable as SBX_DIM_AS_NEW == SBX_GBLSEARCH
ResetFlag( SBX_DIM_AS_NEW );
}
SbxDataType SbxObject::GetType() const

6
basic/source/sbx/sbxvalue.cxx Normal file → Executable file
View File

@ -436,6 +436,8 @@ SbxValue* SbxValue::TheRealValue() const
}
// #55226 Zusaetzliche Info transportieren
bool handleToStringForCOMObjects( SbxObject* pObj, SbxValue* pVal ); // sbunoobj.cxx
SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
{
SbxValue* p = (SbxValue*) this;
@ -460,10 +462,14 @@ SbxValue* SbxValue::TheRealValue( BOOL bObjInObjError ) const
if( bObjInObjError && !pDflt &&
((SbxValue*) pObj)->aData.eType == SbxOBJECT &&
((SbxValue*) pObj)->aData.pObj == pObj )
{
bool bSuccess = handleToStringForCOMObjects( pObj, p );
if( !bSuccess )
{
SetError( SbxERR_BAD_PROP_VALUE );
p = NULL;
}
}
else if( pDflt )
p = pDflt;
/* ALT:

View File

@ -59,13 +59,17 @@ class SbxVariableImpl
friend class SbxVariable;
String m_aDeclareClassName;
Reference< XInterface > m_xComListener;
StarBASIC* m_pComListenerParentBasic;
SbxVariableImpl( void )
: m_pComListenerParentBasic( NULL )
{}
SbxVariableImpl( const SbxVariableImpl& r )
: m_aDeclareClassName( r.m_aDeclareClassName )
, m_xComListener( r.m_xComListener )
{}
, m_pComListenerParentBasic( r.m_pComListenerParentBasic )
{
}
};
@ -84,12 +88,18 @@ SbxVariable::SbxVariable() : SbxValue()
#endif
}
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic );
SbxVariable::SbxVariable( const SbxVariable& r )
: SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo )
{
mpSbxVariableImpl = NULL;
if( r.mpSbxVariableImpl != NULL )
{
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
if( mpSbxVariableImpl->m_xComListener.is() )
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
}
pCst = NULL;
if( r.CanRead() )
{
@ -126,6 +136,8 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
#endif
}
void removeDimAsNewRecoverItem( SbxVariable* pVar );
SbxVariable::~SbxVariable()
{
#ifdef DBG_UTIL
@ -136,6 +148,8 @@ SbxVariable::~SbxVariable()
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
GetSbxData_Impl()->aVars.Remove( this );
#endif
if( IsSet( SBX_DIM_AS_NEW ))
removeDimAsNewRecoverItem( this );
delete mpSbxVariableImpl;
delete pCst;
}
@ -315,7 +329,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
SbxValue::operator=( r );
delete mpSbxVariableImpl;
if( r.mpSbxVariableImpl != NULL )
{
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
if( mpSbxVariableImpl->m_xComListener.is() )
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
}
else
mpSbxVariableImpl = NULL;
return *this;
@ -396,10 +414,19 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName )
pImpl->m_aDeclareClassName = rDeclareClassName;
}
void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener )
void SbxVariable::SetComListener( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xComListener,
StarBASIC* pParentBasic )
{
SbxVariableImpl* pImpl = getImpl();
pImpl->m_xComListener = xComListener;
pImpl->m_pComListenerParentBasic = pParentBasic;
registerComListenerVariableForBasic( this, pParentBasic );
}
void SbxVariable::ClearComListener( void )
{
SbxVariableImpl* pImpl = getImpl();
pImpl->m_xComListener.clear();
}

View File

@ -27,9 +27,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx"
#include "modsizeexceeded.hxx"
#include "basic/modsizeexceeded.hxx"
#include <framework/interaction.hxx>
#include <comphelper/interaction.hxx>
#include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
using namespace com::sun::star;
@ -44,8 +44,8 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
m_aRequest <<= aReq;
m_xAbort.set( uno::Reference< task::XInteractionAbort >(new framework::ContinuationAbort), uno::UNO_QUERY );
m_xApprove.set( uno::Reference< task::XInteractionApprove >(new framework::ContinuationApprove ), uno::UNO_QUERY );
m_xAbort.set( uno::Reference< task::XInteractionAbort >(new comphelper::OInteractionAbort), uno::UNO_QUERY );
m_xApprove.set( uno::Reference< task::XInteractionApprove >(new comphelper::OInteractionApprove ), uno::UNO_QUERY );
m_lContinuations.realloc( 2 );
m_lContinuations[0] = m_xApprove;
m_lContinuations[1] = m_xAbort;
@ -54,15 +54,15 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
sal_Bool
ModuleSizeExceeded::isAbort() const
{
framework::ContinuationAbort* pBase = static_cast< framework::ContinuationAbort* >( m_xAbort.get() );
return pBase->isSelected();
comphelper::OInteractionAbort* pBase = static_cast< comphelper::OInteractionAbort* >( m_xAbort.get() );
return pBase->wasSelected();
}
sal_Bool
ModuleSizeExceeded::isApprove() const
{
framework::ContinuationApprove* pBase = static_cast< framework::ContinuationApprove* >( m_xApprove.get() );
return pBase->isSelected();
comphelper::OInteractionApprove* pBase = static_cast< comphelper::OInteractionApprove* >( m_xApprove.get() );
return pBase->wasSelected();
}

View File

@ -2815,19 +2815,37 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
{
BasicManager* pBasMgr = getBasicManager();
if( pBasMgr )
/* The member variable mbVBACompat must be set first, the following call
to getBasicManager() may call getVBACompatibilityMode() which returns
this value. */
mbVBACompat = _vbacompatmodeon;
if( BasicManager* pBasMgr = getBasicManager() )
{
// get the standard library
String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
if ( pBasMgr->GetName().Len() )
aLibName = pBasMgr->GetName();
String aLibName = pBasMgr->GetName();
if ( aLibName.Len() == 0 )
aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
StarBASIC* pBasic = pBasMgr->GetLib( aLibName );
if( pBasic )
if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) )
pBasic->SetVBAEnabled( _vbacompatmodeon );
/* If in VBA compatibility mode, force creation of the VBA Globals
object. Each application will create an instance of its own
implementation and store it in its Basic manager. Implementations
will do all necessary additional initialization, such as
registering the global "This***Doc" UNO constant, starting the
document events processor etc.
*/
if( mbVBACompat ) try
{
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
}
catch( Exception& )
{
}
}
mbVBACompat = _vbacompatmodeon;
}
// Methods XServiceInfo

View File

@ -62,7 +62,7 @@
#include <basic/basmgr.hxx>
#include <basic/sbmod.hxx>
#include <basic/basicmanagerrepository.hxx>
#include "modsizeexceeded.hxx"
#include "basic/modsizeexceeded.hxx"
#include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/util/VetoException.hpp>
@ -80,10 +80,9 @@ using namespace com::sun::star::script;
using namespace com::sun::star::xml::sax;
using namespace com::sun::star;
using namespace cppu;
using namespace rtl;
using namespace osl;
using com::sun::star::uno::Reference;
using ::rtl::OUString;
//============================================================================
// Implementation class SfxScriptLibraryContainer
@ -311,24 +310,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
// aMod.aName ignored
if( aMod.aModuleType.getLength() > 0 )
{
if( !getVBACompatibilityMode() )
/* If in VBA compatibility mode, force creation of the VBA Globals
object. Each application will create an instance of its own
implementation and store it in its Basic manager. Implementations
will do all necessary additional initialization, such as
registering the global "This***Doc" UNO constant, starting the
document events processor etc.
*/
if( getVBACompatibilityMode() ) try
{
setVBACompatibilityMode( sal_True );
Any aGlobs;
Sequence< Any > aArgs(1);
Reference<frame::XModel > xModel( mxOwnerDocument );
aArgs[ 0 ] <<= xModel;
BasicManager* pBasicMgr = getBasicManager();
if( pBasicMgr )
{
aGlobs <<= ::comphelper::getProcessServiceFactory()->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.excel.Globals" ) ), aArgs );
pBasicMgr->SetGlobalUNOConstant( "VBAGlobals", aGlobs );
Reference< frame::XModel > xModel( mxOwnerDocument ); // weak-ref -> ref
Reference< XMultiServiceFactory > xFactory( xModel, UNO_QUERY_THROW );
xFactory->createInstance( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAGlobals" ) ) );
}
pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False );
if( pBasicMgr )
pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] );
catch( Exception& )
{
}
script::ModuleInfo aModInfo;
@ -353,25 +349,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
RTL_CONSTASCII_STRINGPARAM("document") ))
{
aModInfo.ModuleType = ModuleType::DOCUMENT;
// #163691# use the same codename access instance for all document modules
if( !mxCodeNameAccess.is() ) try
{
Reference<frame::XModel > xModel( mxOwnerDocument );
Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY);
Reference< container::XNameAccess > xVBACodeNameAccess;
if( xSF.is() )
Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW );
mxCodeNameAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider" ) ) ), UNO_QUERY );
}
catch( Exception& ) {}
if( mxCodeNameAccess.is() )
{
try
{
xVBACodeNameAccess.set( xSF->createInstance(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"ooo.vba.VBAObjectModuleObjectProvider"))),
UNO_QUERY );
}
catch(uno::Exception&) {}
}
if( xVBACodeNameAccess.is() )
{
try
{
aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
aModInfo.ModuleObject.set( mxCodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
}
catch(uno::Exception&)
{

View File

@ -1,4 +1,4 @@
cg configmgr : BOOST:boost comphelper cppu cppuhelper offuh sal salhelper stlport xmlreader NULL
cg configmgr : BOOST:boost LIBXSLT:libxslt comphelper cppu cppuhelper offuh sal salhelper stlport xmlreader NULL
cg configmgr\inc nmake - all cg_inc NULL
cg configmgr\source nmake - all cg_source cg_inc NULL
cg configmgr\qa\unoapi nmake - all cg_qa_unoapi NULL

View File

@ -909,11 +909,8 @@ rtl::OUString Access::getImplementationName() throw (css::uno::RuntimeException)
OSL_ASSERT(thisIs(IS_ANY));
osl::MutexGuard g(lock);
checkLocalizedPropertyAccess();
throw css::uno::RuntimeException(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"configmgr Access has no service implementation name")),
static_cast< cppu::OWeakObject * >(this));
return rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM("org.openoffice-configmgr::Access"));
}
sal_Bool Access::supportsService(rtl::OUString const & ServiceName)
@ -2092,7 +2089,8 @@ css::beans::Property Access::asProperty() {
default:
type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct?
nillable = false;
removable = getParentNode()->kind() == Node::KIND_SET;
rtl::Reference< Node > parent(getParentNode());
removable = parent.is() && parent->kind() == Node::KIND_SET;
break;
}
return css::beans::Property(

View File

@ -282,9 +282,10 @@ css::uno::Any ChildAccess::asValue() {
if (!Components::allLocales(locale)) {
// Find best match using an adaption of RFC 4647 lookup matching
// rules, removing "-" or "_" delimited segments from the end;
// defaults are the empty string locale, the "en-US" locale, the
// first child (if any), or a nil value (even though it may be
// illegal for the given property), in that order:
// defaults are the "en-US" locale, the "en" locale, the empty
// string locale, the first child (if any), or a nil value (even
// though it may be illegal for the given property), in that
// order:
rtl::Reference< ChildAccess > child;
for (;;) {
child = getChild(locale);
@ -295,19 +296,29 @@ css::uno::Any ChildAccess::asValue() {
while (i > 0 && locale[i] != '-' && locale[i] != '_') {
--i;
}
if (i == 0) {
break;
}
locale = locale.copy(0, i);
}
if (!child.is()) {
child = getChild(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en-US")));
if (!child.is()) {
std::vector< rtl::Reference< ChildAccess > > all(
getAllChildren());
child = getChild(
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("en")));
if (!child.is()) {
child = getChild(rtl::OUString());
if (!child.is()) {
std::vector< rtl::Reference< ChildAccess > >
all(getAllChildren());
if (!all.empty()) {
child = all.front();
}
}
}
}
}
return child.is() ? child->asValue() : css::uno::Any();
}
}

View File

@ -214,7 +214,7 @@ void Components::WriteThread::run() {
reference_->clear();
}
void Components::initSingleton(
Components & Components::getSingleton(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
OSL_ASSERT(context.is());
@ -223,10 +223,6 @@ void Components::initSingleton(
static Components theSingleton(context);
singleton = &theSingleton;
}
}
Components & Components::getSingleton() {
OSL_ASSERT(singletonCreated);
if (singleton == 0) {
throw css::uno::RuntimeException(
rtl::OUString(

View File

@ -65,12 +65,10 @@ class RootAccess;
class Components: private boost::noncopyable {
public:
static void initSingleton(
static Components & getSingleton(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const & context);
static Components & getSingleton();
static bool allLocales(rtl::OUString const & locale);
rtl::Reference< Node > resolvePathRepresentation(

View File

@ -55,7 +55,7 @@
#include "cppu/unotype.hxx"
#include "cppuhelper/compbase5.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase2.hxx"
#include "cppuhelper/interfacecontainer.hxx"
#include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
@ -127,7 +127,6 @@ private:
virtual css::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return configuration_provider::getSupportedServiceNames(); }
//TODO: DefaultProvider?
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
rtl::OUString const & aServiceSpecifier)
@ -276,8 +275,7 @@ Service::createInstanceWithArguments(
static_cast< cppu::OWeakObject * >(this));
}
osl::MutexGuard guard(lock);
Components::initSingleton(context_);
Components & components = Components::getSingleton();
Components & components = Components::getSingleton(context_);
rtl::Reference< RootAccess > root(
new RootAccess(components, nodepath, locale, update));
if (root->isValue()) {
@ -388,14 +386,14 @@ void Service::flushModifications() const {
Components * components;
{
osl::MutexGuard guard(lock);
Components::initSingleton(context_);
components = &Components::getSingleton();
components = &Components::getSingleton(context_);
}
components->flushModifications();
}
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
public cppu::WeakImplHelper2<
css::lang::XSingleComponentFactory, css::lang::XServiceInfo >,
private boost::noncopyable
{
public:
@ -414,6 +412,18 @@ private:
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException)
{ return configuration_provider::getImplementationName(); }
virtual sal_Bool SAL_CALL supportsService(rtl::OUString const & ServiceName)
throw (css::uno::RuntimeException)
{ return ServiceName == getSupportedServiceNames()[0]; } //TODO
virtual css::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return configuration_provider::getSupportedServiceNames(); }
};
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(

View File

@ -36,7 +36,6 @@
#include "com/sun/star/lang/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.hpp"
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
#include "com/sun/star/registry/InvalidRegistryException.hpp"
#include "com/sun/star/registry/InvalidValueException.hpp"
#include "com/sun/star/registry/MergeConflictException.hpp"
@ -56,13 +55,11 @@
#include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/util/XFlushable.hpp"
#include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase3.hxx"
#include "cppuhelper/weak.hxx"
#include "osl/diagnose.h"
#include "osl/mutex.hxx"
#include "rtl/unload.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
@ -877,53 +874,12 @@ rtl::OUString RegistryKey::getResolvedName(rtl::OUString const & aKeyName)
return aKeyName;
}
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
private boost::noncopyable
{
public:
Factory() {}
private:
virtual ~Factory() {}
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
};
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{
return createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any >(), Context);
}
css::uno::Reference< css::uno::XInterface >
Factory::createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
if (Arguments.getLength() != 0) {
throw css::uno::Exception(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.ConfigurationRegistry must be"
" instantiated without arguments")),
static_cast< cppu::OWeakObject * >(this));
}
return static_cast< cppu::OWeakObject * >(new Service(Context));
}
return static_cast< cppu::OWeakObject * >(new Service(context));
}
rtl::OUString getImplementationName() {
@ -939,12 +895,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
return css::uno::Sequence< rtl::OUString >(&name, 1);
}
css::uno::Reference< css::lang::XSingleComponentFactory > createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(())
{
return new Factory;
}
} }

View File

@ -30,28 +30,28 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
#include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang {
class XSingleComponentFactory;
} } } }
namespace com { namespace sun { namespace star {
namespace uno {
class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; }
namespace configmgr { namespace configuration_registry {
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
create(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const & context);
rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames();
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(());
} }
#endif

View File

@ -28,24 +28,16 @@
#include "precompiled_configmgr.hxx"
#include "sal/config.h"
#include "boost/noncopyable.hpp"
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "sal/types.h"
#include "rtl/unload.h"
#include "osl/mutex.hxx"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "configurationprovider.hxx"
#include "defaultprovider.hxx"
#include "lock.hxx"
namespace configmgr { namespace default_provider {
@ -54,58 +46,17 @@ namespace {
namespace css = com::sun::star;
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
private boost::noncopyable
{
public:
Factory() {}
private:
virtual ~Factory() {}
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
};
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{
return createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any >(), Context);
}
css::uno::Reference< css::uno::XInterface >
Factory::createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
if (Arguments.getLength() != 0) {
throw css::uno::Exception(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.configuration.DefaultProvider must be"
" instantiated without arguments")),
static_cast< cppu::OWeakObject * >(this));
}
osl::MutexGuard guard(lock);
static css::uno::Reference< css::uno::XInterface > singleton(
configuration_provider::createDefault(Context));
configuration_provider::createDefault(context));
return singleton;
}
}
rtl::OUString getImplementationName() {
return rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
@ -119,13 +70,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
return css::uno::Sequence< rtl::OUString >(&name, 1);
}
css::uno::Reference< css::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(())
{
return new Factory;
}
} }

View File

@ -32,28 +32,28 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
#include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang {
class XSingleComponentFactory;
} } } }
namespace com { namespace sun { namespace star {
namespace uno {
class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; }
namespace configmgr { namespace default_provider {
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
create(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const & context);
rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames();
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(());
} }
#endif

View File

@ -101,8 +101,4 @@ Node::~Node() {}
void Node::clear() {}
rtl::Reference< Node > Node::findMember(rtl::OUString const &) {
return rtl::Reference< Node >();
}
}

View File

@ -31,11 +31,12 @@
#include "sal/config.h"
#include "rtl/ref.hxx"
#include "rtl/ustring.hxx"
#include "salhelper/simplereferenceobject.hxx"
#include "nodemap.hxx"
namespace rtl { class OUString; }
namespace configmgr {
class Node: public salhelper::SimpleReferenceObject {
@ -75,8 +76,6 @@ protected:
virtual void clear();
virtual rtl::Reference< Node > findMember(rtl::OUString const & name);
int layer_;
int finalized_;
};

View File

@ -32,6 +32,7 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implementationentry.hxx"
#include "osl/diagnose.h"
#include "uno/lbnames.h"
@ -58,15 +59,17 @@ static cppu::ImplementationEntry const services[] = {
{ &dummy, &configmgr::configuration_provider::getImplementationName,
&configmgr::configuration_provider::getSupportedServiceNames,
&configmgr::configuration_provider::createFactory, 0, 0 },
{ &dummy, &configmgr::default_provider::getImplementationName,
{ &configmgr::default_provider::create,
&configmgr::default_provider::getImplementationName,
&configmgr::default_provider::getSupportedServiceNames,
&configmgr::default_provider::createFactory, 0, 0 },
{ &dummy, &configmgr::configuration_registry::getImplementationName,
&cppu::createSingleComponentFactory, 0, 0 },
{ &configmgr::configuration_registry::create,
&configmgr::configuration_registry::getImplementationName,
&configmgr::configuration_registry::getSupportedServiceNames,
&configmgr::configuration_registry::createFactory, 0, 0 },
{ &dummy, &configmgr::update::getImplementationName,
&cppu::createSingleComponentFactory, 0, 0 },
{ &configmgr::update::create, &configmgr::update::getImplementationName,
&configmgr::update::getSupportedServiceNames,
&configmgr::update::createFactory, 0, 0 },
&cppu::createSingleComponentFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};

View File

@ -32,20 +32,15 @@
#include "boost/noncopyable.hpp"
#include "com/sun/star/configuration/XUpdate.hpp"
#include "com/sun/star/lang/XSingleComponentFactory.hpp"
#include "com/sun/star/uno/Any.hxx"
#include "com/sun/star/uno/Exception.hpp"
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "osl/mutex.hxx"
#include "rtl/ref.hxx"
#include "rtl/unload.h"
#include "rtl/ustring.h"
#include "rtl/ustring.hxx"
#include "sal/types.h"
@ -76,7 +71,11 @@ class Service:
private boost::noncopyable
{
public:
Service() {}
Service(css::uno::Reference< css::uno::XComponentContext > const context):
context_(context)
{
OSL_ASSERT(context.is());
}
private:
virtual ~Service() {}
@ -97,6 +96,8 @@ private:
css::uno::Sequence< rtl::OUString > const & includedPaths,
css::uno::Sequence< rtl::OUString > const & excludedPaths)
throw (css::uno::RuntimeException);
css::uno::Reference< css::uno::XComponentContext > context_;
};
void Service::insertExtensionXcsFile(
@ -104,7 +105,7 @@ void Service::insertExtensionXcsFile(
throw (css::uno::RuntimeException)
{
osl::MutexGuard g(lock);
Components::getSingleton().insertExtensionXcsFile(shared, fileUri);
Components::getSingleton(context_).insertExtensionXcsFile(shared, fileUri);
}
void Service::insertExtensionXcuFile(
@ -114,10 +115,10 @@ void Service::insertExtensionXcuFile(
Broadcaster bc;
{
osl::MutexGuard g(lock);
Components & components = Components::getSingleton(context_);
Modifications mods;
Components::getSingleton().insertExtensionXcuFile(
shared, fileUri, &mods);
Components::getSingleton().initGlobalBroadcaster(
components.insertExtensionXcuFile(shared, fileUri, &mods);
components.initGlobalBroadcaster(
mods, rtl::Reference< RootAccess >(), &bc);
}
bc.send();
@ -129,9 +130,10 @@ void Service::removeExtensionXcuFile(rtl::OUString const & fileUri)
Broadcaster bc;
{
osl::MutexGuard g(lock);
Components & components = Components::getSingleton(context_);
Modifications mods;
Components::getSingleton().removeExtensionXcuFile(fileUri, &mods);
Components::getSingleton().initGlobalBroadcaster(
components.removeExtensionXcuFile(fileUri, &mods);
components.initGlobalBroadcaster(
mods, rtl::Reference< RootAccess >(), &bc);
}
bc.send();
@ -146,62 +148,22 @@ void Service::insertModificationXcuFile(
Broadcaster bc;
{
osl::MutexGuard g(lock);
Components & components = Components::getSingleton(context_);
Modifications mods;
Components::getSingleton().insertModificationXcuFile(
components.insertModificationXcuFile(
fileUri, seqToSet(includedPaths), seqToSet(excludedPaths), &mods);
Components::getSingleton().initGlobalBroadcaster(
components.initGlobalBroadcaster(
mods, rtl::Reference< RootAccess >(), &bc);
}
bc.send();
}
class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >,
private boost::noncopyable
{
public:
Factory() {}
private:
virtual ~Factory() {}
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL
createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException);
};
css::uno::Reference< css::uno::XInterface > Factory::createInstanceWithContext(
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{
return createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any >(), Context);
}
css::uno::Reference< css::uno::XInterface >
Factory::createInstanceWithArgumentsAndContext(
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const &)
throw (css::uno::Exception, css::uno::RuntimeException)
css::uno::Reference< css::uno::XInterface > create(
css::uno::Reference< css::uno::XComponentContext > const & context)
{
if (Arguments.getLength() != 0) {
throw css::uno::Exception(
rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.comp.configuration.Update must be"
" instantiated without arguments")),
static_cast< cppu::OWeakObject * >(this));
}
return static_cast< cppu::OWeakObject * >(new Service);
}
return static_cast< cppu::OWeakObject * >(new Service(context));
}
rtl::OUString getImplementationName() {
@ -216,12 +178,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
return css::uno::Sequence< rtl::OUString >(&name, 1);
}
css::uno::Reference< css::lang::XSingleComponentFactory > createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
css::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(())
{
return new Factory;
}
} }

View File

@ -32,28 +32,28 @@
#include "com/sun/star/uno/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
#include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang {
class XSingleComponentFactory;
} } } }
namespace com { namespace sun { namespace star {
namespace uno {
class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; }
namespace configmgr { namespace update {
com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL
create(
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
const &);
rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames();
com::sun::star::uno::Reference< com::sun::star::lang::XSingleComponentFactory >
SAL_CALL createFactory(
cppu::ComponentFactoryFunc, rtl::OUString const &,
com::sun::star::uno::Sequence< rtl::OUString > const &, rtl_ModuleCount *)
SAL_THROW(());
} }
#endif

View File

@ -33,7 +33,8 @@
#include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#include <com/sun/star/sdbc/XConnection.hpp>
/** === end UNO includes === **/
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <vector>
#include "connectivity/dbtoolsdllapi.hxx"
@ -111,10 +112,10 @@ namespace dbtools
/** appends one filter component to the statement in our composer
*/
void appendFilterComponent( ::rtl::OUString& /* [inout] */ _rAppendTo, const ::rtl::OUString& _rComponent ) const;
void appendFilterComponent( ::rtl::OUStringBuffer& io_appendTo, const ::rtl::OUString& i_component ) const;
/// checks whether there is only one (or even no) non-empty filter component
bool isThereAtMostOneComponent( ::rtl::OUString& _rOnlyComponent ) const;
bool isThereAtMostOneComponent( ::rtl::OUStringBuffer& o_singleComponent ) const;
/// returns the index of the first filter component which should be considered when building the composed filter
inline sal_Int32 getFirstApplicableFilterIndex() const

View File

@ -231,6 +231,7 @@ namespace connectivity
character_string_type,
other_like_predicate_part_2,
between_predicate_part_2,
cast_spec,
rule_count, // letzter_wert
UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID)
};

View File

@ -1,4 +1,4 @@
cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss NULL
cn connectivity : shell l10n comphelper MOZ:moz SO:moz_prebuilt svl UNIXODBC:unixODBC unoil javaunohelper HSQLDB:hsqldb qadevOOo officecfg NSS:nss LIBXSLT:libxslt NULL
cn connectivity usr1 - all cn_mkout NULL
cn connectivity\inc nmake - all cn_inc NULL
cn connectivity\com\sun\star\sdbcx\comp\hsqldb nmake - all cn_jhsqldbdb cn_hsqldb cn_inc NULL

View File

@ -2,6 +2,7 @@
..\%__SRC%\bin\*.res %_DEST%\bin%_EXT%\*.res
..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
..\%__SRC%\lib\*.jnilib %_DEST%\lib%_EXT%\*.jnilib
..\%__SRC%\slb\connectivity*.* %_DEST%\lib%_EXT%\connectivity*.*
..\%__SRC%\lib\idbt* %_DEST%\lib%_EXT%\idbt*
..\source\cpool\*.xml %_DEST%\xml%_EXT%\*.xml

View File

@ -1768,8 +1768,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
break;
case DataType::DECIMAL:
case DataType::NUMERIC:
aValue = DBTypeConversion::toDate((double)*this);
break;
case DataType::FLOAT:
case DataType::DOUBLE:
case DataType::REAL:
@ -1787,12 +1785,28 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aValue.Year = pDateTime->Year;
}
break;
default:
{
Any aAnyValue = getAny();
aAnyValue >>= aValue;
case DataType::BIT:
case DataType::BOOLEAN:
case DataType::TINYINT:
case DataType::SMALLINT:
case DataType::INTEGER:
case DataType::BIGINT:
aValue = DBTypeConversion::toDate( double( sal_Int64( *this ) ) );
break;
case DataType::BLOB:
case DataType::CLOB:
case DataType::OBJECT:
default:
OSL_ENSURE( false, "ORowSetValue::getDate: cannot retrieve the data!" );
// NO break!
case DataType::BINARY:
case DataType::VARBINARY:
case DataType::LONGVARBINARY:
case DataType::TIME:
aValue = DBTypeConversion::toDate( (double)0 );
break;
}
}
}
return aValue;

View File

@ -585,7 +585,6 @@ bool getDataSourceSetting( const Reference< XInterface >& _xChild, const ::rtl::
try
{
const Reference< XPropertySet> xDataSourceProperties( findDataSource( _xChild ), UNO_QUERY );
OSL_ENSURE( xDataSourceProperties.is(), "getDataSourceSetting: invalid data source object!" );
if ( !xDataSourceProperties.is() )
return false;

View File

@ -35,6 +35,8 @@
#include "TConnection.hxx"
#include <osl/diagnose.h>
#include "connectivity/dbtools.hxx"
#include <tools/diagnose_ex.h>
#include <rtl/ustrbuf.hxx>
//........................................................................
namespace dbtools
@ -92,7 +94,7 @@ namespace dbtools
}
catch( const Exception& )
{
OSL_ENSURE( sal_False, "FilterManager::setFilterComponent: setting the filter failed!" );
DBG_UNHANDLED_EXCEPTION();
}
}
@ -113,41 +115,27 @@ namespace dbtools
}
catch( const Exception& )
{
OSL_ENSURE( sal_False, "FilterManager::setApplyPublicFilter: setting the filter failed!" );
DBG_UNHANDLED_EXCEPTION();
}
}
//--------------------------------------------------------------------
namespace
void FilterManager::appendFilterComponent( ::rtl::OUStringBuffer& io_appendTo, const ::rtl::OUString& i_component ) const
{
void lcl_ensureBracketed( ::rtl::OUString& /* [inout] */ _rExpression )
if ( io_appendTo.getLength() > 0 )
{
OSL_ENSURE( _rExpression.getLength(), "lcl_ensureBracketed: expression is empty!" );
if ( _rExpression.getLength() )
{
if ( ( _rExpression.getStr()[0] != '(' ) || ( _rExpression.getStr()[ _rExpression.getLength() - 1 ] != ')' ) )
{
::rtl::OUString sComposed( RTL_CONSTASCII_USTRINGPARAM( "(" ) );
sComposed += _rExpression;
sComposed += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ) );
_rExpression = sComposed;
io_appendTo.insert( 0, sal_Unicode( '(' ) );
io_appendTo.insert( 1, sal_Unicode( ' ' ) );
io_appendTo.appendAscii( " ) AND " );
}
}
}
}
//--------------------------------------------------------------------
void FilterManager::appendFilterComponent( ::rtl::OUString& /* [inout] */ _rAppendTo, const ::rtl::OUString& _rComponent ) const
{
if ( _rAppendTo.getLength() )
_rAppendTo += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " AND " ) );
::rtl::OUString sComponent( _rComponent );
lcl_ensureBracketed( sComponent );
_rAppendTo += sComponent;
io_appendTo.appendAscii( "( " );
io_appendTo.append( i_component );
io_appendTo.appendAscii( " )" );
}
//--------------------------------------------------------------------
bool FilterManager::isThereAtMostOneComponent( ::rtl::OUString& _rOnlyComponent ) const
bool FilterManager::isThereAtMostOneComponent( ::rtl::OUStringBuffer& o_singleComponent ) const
{
sal_Int32 nOnlyNonEmpty = -1;
sal_Int32 i;
@ -164,14 +152,14 @@ namespace dbtools
}
if ( nOnlyNonEmpty == -1 )
{
_rOnlyComponent = ::rtl::OUString();
o_singleComponent.makeStringAndClear();
return true;
}
if ( i == FC_COMPONENT_COUNT )
{
// we found only one non-empty filter component
_rOnlyComponent = m_aFilterComponents[ nOnlyNonEmpty ];
o_singleComponent = m_aFilterComponents[ nOnlyNonEmpty ];
return true;
}
return false;
@ -180,17 +168,17 @@ namespace dbtools
//--------------------------------------------------------------------
::rtl::OUString FilterManager::getComposedFilter( ) const
{
::rtl::OUString sComposedFilter;
::rtl::OUStringBuffer aComposedFilter;
// if we have only one non-empty component, then there's no need to compose anything
if ( isThereAtMostOneComponent( sComposedFilter ) )
return sComposedFilter;
if ( !isThereAtMostOneComponent( aComposedFilter ) )
{
// append the single components
for ( sal_Int32 i = getFirstApplicableFilterIndex(); i < FC_COMPONENT_COUNT; ++i )
appendFilterComponent( sComposedFilter, m_aFilterComponents[ i ] );
appendFilterComponent( aComposedFilter, m_aFilterComponents[ i ] );
}
return sComposedFilter;
return aComposedFilter.makeStringAndClear();
}
//........................................................................

View File

@ -937,9 +937,13 @@ again:
{
m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
if ( (!m_bShowDeleted && m_aEvaluateRow->isDeleted())
|| (bHasRestriction && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Saetzen
!m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen
if ( ( !m_bShowDeleted
&& m_aEvaluateRow->isDeleted()
)
|| ( bHasRestriction
&& !m_pSQLAnalyzer->evaluateRestriction()
)
)
{ // naechsten Satz auswerten
// aktuelle Zeile loeschen im Keyset
if (m_pEvaluationKeySet)
@ -988,12 +992,14 @@ again:
// Evaluate darf nur gesetzt sein,
// wenn der Keyset weiter aufgebaut werden soll
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount() &&
(m_pFileSet.isValid() || m_pSortIndex) && bEvaluate)
if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
&& !isCount()
&& bEvaluate
)
{
if (m_pSortIndex)
{
OKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow);
OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow );
m_pSortIndex->AddKeyValue(pKeyValue);
}
else if (m_pFileSet.isValid())
@ -1294,8 +1300,8 @@ void OResultSet::sortRows()
::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i)
{
OSL_ENSURE((sal_Int32)m_aRow->get().size() > *aOrderByIter,"Invalid Index");
switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index");
switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
{
case DataType::CHAR:
case DataType::VARCHAR:
@ -1324,7 +1330,7 @@ void OResultSet::sortRows()
OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert");
break;
}
(m_aEvaluateRow->get())[*aOrderByIter]->setBound(sal_True);
(m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True);
}
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
@ -1341,8 +1347,13 @@ void OResultSet::sortRows()
}
else
{
while (ExecuteRow(IResultSetHelper::NEXT,1,TRUE))
while ( ExecuteRow( IResultSetHelper::NEXT, 1, FALSE, TRUE ) )
{
m_aSelectRow->get()[0]->setValue( m_aRow->get()[0]->getValue() );
if ( m_pSQLAnalyzer->hasFunctions() )
m_pSQLAnalyzer->setSelectionEvaluationResult( m_aSelectRow, m_aColMapping );
const sal_Int32 nBookmark = (*m_aRow->get().begin())->getValue();
ExecuteRow( IResultSetHelper::BOOKMARK, nBookmark, TRUE, FALSE );
}
}

View File

@ -451,19 +451,12 @@ void OStatement_Base::setOrderbyColumn( OSQLParseNode* pColumnRef,
return;
// Alles geprueft und wir haben den Namen der Column.
// Die wievielte Column ist das?
try
{
m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName));
}
catch(Exception)
{
::vos::ORef<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns();
::comphelper::UStringMixEqual aCase;
OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase);
if ( aFind == aSelectColumns->get().end() )
throw SQLException();
m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->get().begin()) + 1);
}
// Ascending or Descending?
m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);

View File

@ -103,8 +103,27 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
}
else
{
if ( SQL_ISPUNCTUATION( pColumnRef, "*" )
|| ( SQL_ISRULE( pColumnRef, column_ref )
&& ( pColumnRef->count() == 3 )
&& ( pColumnRef->getChild(0)->getNodeType() == SQL_NODE_NAME )
&& SQL_ISPUNCTUATION( pColumnRef->getChild(1), "." )
&& SQL_ISRULE( pColumnRef->getChild(2), column_val )
&& SQL_ISPUNCTUATION( pColumnRef->getChild(2)->getChild(0), "*" )
)
)
{
// push one element for each column of our table
const Reference< XNameAccess > xColumnNames( m_aCompiler->getOrigColumns() );
const Sequence< ::rtl::OUString > aColumnNames( xColumnNames->getElementNames() );
for ( sal_Int32 j=0; j<aColumnNames.getLength(); ++j )
m_aSelectionEvaluations.push_back( TPredicates() );
}
else
m_aSelectionEvaluations.push_back( TPredicates() );
}
}
}
}
@ -291,11 +310,12 @@ void OSQLAnalyzer::setSelectionEvaluationResult(OValueRefRow& _pRow,const ::std:
{
if ( aIter->second.isValid() )
{
sal_Int32 map = nPos;
// the first column (index 0) is for convenience only. The first real select column is no 1.
if ( (nPos > 0) && (nPos < static_cast<sal_Int32>(_rColumnMapping.size())) )
sal_Int32 map = nPos;
if ( nPos < static_cast< sal_Int32 >( _rColumnMapping.size() ) )
map = _rColumnMapping[nPos];
aIter->second->startSelection((_pRow->get())[map]);
if ( map > 0 )
aIter->second->startSelection( (_pRow->get())[map] );
}
}
}

View File

@ -273,14 +273,32 @@ namespace connectivity
if ( pStream.get() )
{
ByteString sLine;
ByteString sVersionString;
while ( pStream->ReadLine(sLine) )
{
if ( sLine.Equals("version=",0,sizeof("version=")-1) )
if ( sLine.Len() == 0 )
continue;
const ByteString sIniKey = sLine.GetToken( 0, '=' );
const ByteString sValue = sLine.GetToken( 1, '=' );
if ( sIniKey.Equals( "hsqldb.compatible_version" ) )
{
sLine = sLine.GetToken(1,'=');
const sal_Int32 nMajor = sLine.GetToken(0,'.').ToInt32();
const sal_Int32 nMinor = sLine.GetToken(1,'.').ToInt32();
const sal_Int32 nMicro = sLine.GetToken(2,'.').ToInt32();
sVersionString = sValue;
}
else
{
if ( sIniKey.Equals( "version" )
&& ( sVersionString.Len() == 0 )
)
{
sVersionString = sValue;
}
}
}
if ( sVersionString.Len() )
{
const sal_Int32 nMajor = sVersionString.GetToken(0,'.').ToInt32();
const sal_Int32 nMinor = sVersionString.GetToken(1,'.').ToInt32();
const sal_Int32 nMicro = sVersionString.GetToken(2,'.').ToInt32();
if ( nMajor > 1
|| ( nMajor == 1 && nMinor > 8 )
|| ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) )
@ -288,8 +306,6 @@ namespace connectivity
::connectivity::SharedResources aResources;
sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION);
}
break;
}
}
}
} // if ( xStream.is() )

View File

@ -103,6 +103,7 @@ SHL1STDLIBS=\
SHL1DEPN=
SHL1CREATEJNILIB=TRUE
SHL1IMPLIB= i$(HSQLDB_TARGET)
SHL1DEF= $(MISC)$/$(SHL1TARGET).def

View File

@ -51,14 +51,6 @@ using namespace ::com::sun::star::mozilla;
namespace
{
#if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX)
#define APP_REGISTRY_NAME "Application Registry"
#elif defined(XP_WIN) || defined(XP_OS2)
#define APP_REGISTRY_NAME "registry.dat"
#else
#define APP_REGISTRY_NAME "appreg"
#endif
// -------------------------------------------------------------------
static ::rtl::OUString lcl_getUserDataDirectory()
{
@ -73,15 +65,15 @@ namespace
static const char* DefaultProductDir[3][3] =
{
#if defined(XP_WIN)
{ "Mozilla/", NULL, NULL },
{ "Mozilla/SeaMonkey/", NULL, NULL },
{ "Mozilla/Firefox/", NULL, NULL },
{ "Thunderbird/", "Mozilla/Thunderbird/", NULL }
#elif(MACOSX)
{ "../Mozilla/", NULL, NULL },
{ "../Mozilla/SeaMonkey/", NULL, NULL },
{ "Firefox/", NULL, NULL },
{ "../Thunderbird/", NULL, NULL }
#else
{ ".mozilla/", NULL, NULL },
{ ".mozilla/seamonkey/", NULL, NULL },
{ ".mozilla/firefox/", NULL, NULL },
{ ".thunderbird/", ".mozilla-thunderbird/", ".mozilla/thunderbird/" }
#endif
@ -115,7 +107,7 @@ namespace
else
{
::rtl::OUString sProductDirCandidate;
const char* pProfileRegistry = ( _product == MozillaProductType_Mozilla ) ? APP_REGISTRY_NAME : "profiles.ini";
const char* pProfileRegistry = "profiles.ini";
// check all possible candidates
for ( size_t i=0; i<3; ++i )
@ -159,13 +151,3 @@ namespace
return lcl_guessProfileRoot( product );
}
#ifndef MINIMAL_PROFILEDISCOVER
// -----------------------------------------------------------------------
::rtl::OUString getRegistryFileName(MozillaProductType product)
{
if (product == MozillaProductType_Default)
return ::rtl::OUString();
return getRegistryDir(product) + ::rtl::OUString::createFromAscii(APP_REGISTRY_NAME);
}
#endif

View File

@ -38,9 +38,6 @@
#include <rtl/ustring.hxx>
::rtl::OUString getRegistryDir(::com::sun::star::mozilla::MozillaProductType product);
#ifndef MINIMAL_PROFILEDISCOVER
::rtl::OUString getRegistryFileName(::com::sun::star::mozilla::MozillaProductType product);
#endif
#endif

View File

@ -144,11 +144,8 @@ namespace connectivity
sal_Int32 ProfileAccess::LoadProductsInfo()
{
#ifndef MINIMAL_PROFILEDISCOVER
//load mozilla profiles to m_ProductProfileList
LoadMozillaProfiles();
#endif
sal_Int32 count=static_cast<sal_Int32>(m_ProductProfileList[MozillaProductType_Mozilla].mProfileList.size());
//load SeaMonkey 2 profiles to m_ProductProfileList
sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla);
//load thunderbird profiles to m_ProductProfileList
count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird);
@ -158,117 +155,6 @@ namespace connectivity
count += LoadXPToolkitProfiles(MozillaProductType_Firefox);
return count;
}
#ifndef MINIMAL_PROFILEDISCOVER
nsresult ProfileAccess::LoadMozillaProfiles()
{
sal_Int32 index=MozillaProductType_Mozilla;
ProductStruct &m_Product = m_ProductProfileList[index];
nsresult rv = NS_OK;
//step 1 : get mozilla registry file
nsCOMPtr<nsILocalFile> localFile;
::rtl::OUString regDir( getRegistryFileName( MozillaProductType_Mozilla ) );
// PRUnichar != sal_Unicode in mingw
nsAutoString registryDir(reinterpret_cast_mingw_only<const PRUnichar *>(regDir.getStr()));
rv = NS_NewLocalFile(registryDir, PR_TRUE,
getter_AddRefs(localFile));
NS_ENSURE_SUCCESS(rv,rv);
PRBool bExist;
rv = localFile->Exists(&bExist);
NS_ENSURE_SUCCESS(rv,rv);
if (!bExist)
return rv;
nsCOMPtr<nsIRegistry> registry(do_CreateInstance(NS_REGISTRY_CONTRACTID, &rv));
NS_ENSURE_SUCCESS(rv,rv);
//step 2: open mozilla registry file
rv = registry->Open(localFile);
NS_ENSURE_SUCCESS(rv,rv);
nsCOMPtr<nsIEnumerator> enumKeys;
nsRegistryKey profilesTreeKey;
//step 3:Enumerator it
rv = registry->GetKey(nsIRegistry::Common,
// PRUnichar != sal_Unicode in mingw
reinterpret_cast_mingw_only<const PRUnichar *>(szProfileSubtreeString.getStr()),
&profilesTreeKey);
if (NS_FAILED(rv)) return rv;
nsXPIDLString tmpCurrentProfile;
// Get the current profile
rv = registry->GetString(profilesTreeKey,
// PRUnichar != sal_Unicode in mingw
reinterpret_cast_mingw_only<const PRUnichar *>(szCurrentProfileString.getStr()),
getter_Copies(tmpCurrentProfile));
if (tmpCurrentProfile)
{
// PRUnichar != sal_Unicode in mingw
m_Product.setCurrentProfile ( reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, tmpCurrentProfile)));
}
rv = registry->EnumerateSubtrees( profilesTreeKey, getter_AddRefs(enumKeys));
NS_ENSURE_SUCCESS(rv,rv);
rv = enumKeys->First();
NS_ENSURE_SUCCESS(rv,rv);
while (NS_OK != enumKeys->IsDone())
{
nsCOMPtr<nsISupports> base;
rv = enumKeys->CurrentItem( getter_AddRefs(base) );
NS_ENSURE_SUCCESS(rv,rv);
rv = enumKeys->Next();
NS_ENSURE_SUCCESS(rv,rv);
// Get specific interface.
nsCOMPtr <nsIRegistryNode> node;
nsIID nodeIID = NS_IREGISTRYNODE_IID;
rv = base->QueryInterface( nodeIID, getter_AddRefs(node));
if (NS_FAILED(rv)) continue;
// Get node name.
nsXPIDLString profile;
rv = node->GetName(getter_Copies(profile));
if (NS_FAILED(rv)) continue;
nsRegistryKey profKey;
rv = node->GetKey(&profKey);
if (NS_FAILED(rv)) continue;
nsCOMPtr<nsILocalFile> tempLocal;
nsXPIDLString regData;
rv = registry->GetString(profKey,
// PRUnichar != sal_Unicode in mingw
reinterpret_cast_mingw_only<const PRUnichar *>(szDirectoryString.getStr()),
getter_Copies(regData));
if (NS_FAILED(rv)) continue;
#if defined(XP_MAC) || defined(XP_MACOSX) || defined(MACOSX)
rv = NS_NewNativeLocalFile(nsCString(), PR_TRUE, getter_AddRefs(tempLocal));
if (NS_SUCCEEDED(rv))
rv = tempLocal->SetPersistentDescriptor(NS_LossyConvertUCS2toASCII(regData));
#else
rv = NS_NewLocalFile(regData, PR_TRUE, getter_AddRefs(tempLocal));
#endif
//Add found profile to profile lists
if (NS_SUCCEEDED(rv) && tempLocal)
{
// PRUnichar != sal_Unicode in mingw
ProfileStruct* profileItem = new ProfileStruct(MozillaProductType_Mozilla,reinterpret_cast_mingw_only<const sal_Unicode *>(NS_STATIC_CAST(const PRUnichar*, profile)),tempLocal);
m_Product.mProfileList[profileItem->getProfileName()] = profileItem;
}
}
return rv;
}
#endif
//Thunderbird and firefox profiles are saved in profiles.ini
sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product)
{

View File

@ -116,9 +116,6 @@ namespace connectivity
protected:
ProductStruct m_ProductProfileList[4];
sal_Int32 LoadProductsInfo();
#ifndef MINIMAL_PROFILEDISCOVER
nsresult LoadMozillaProfiles();
#endif
sal_Int32 LoadXPToolkitProfiles(MozillaProductType product);
#ifndef MINIMAL_PROFILEDISCOVER
//used by isProfileLocked

View File

@ -62,7 +62,7 @@
<value>com.sun.star.comp.sdbc.MozabDriver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
<value xml:lang="en-US">Mozilla Address Book</value>
<value xml:lang="en-US">SeaMonkey Address Book</value>
</prop>
<node oor:name="Features">
<node oor:name="EscapeDateTime" oor:op="replace">

View File

@ -32,7 +32,7 @@
<value>com.sun.star.comp.sdbc.MozabDriver</value>
</prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string">
<value xml:lang="en-US">Mozilla Address Book</value>
<value xml:lang="en-US">SeaMonkey Address Book</value>
</prop>
<node oor:name="MetaData">
<node oor:name="SupportsBrowsing" oor:op="replace">

View File

@ -109,7 +109,7 @@ namespace connectivity
inline void startSelection(ORowSetValueDecoratorRef& _rVal)
{
return evaluateSelection(m_rCompiler->m_aCodeList,_rVal);
evaluateSelection(m_rCompiler->m_aCodeList,_rVal);
}

View File

@ -1425,7 +1425,8 @@ OSQLParser::OSQLParser(const ::com::sun::star::uno::Reference< ::com::sun::star:
{ OSQLParseNode::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" },
{ OSQLParseNode::character_string_type, "character_string_type" },
{ OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" },
{ OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" }
{ OSQLParseNode::between_predicate_part_2, "between_predicate_part_2" },
{ OSQLParseNode::cast_spec, "cast_spec" }
};
size_t nRuleMapCount = sizeof( aRuleDescriptions ) / sizeof( aRuleDescriptions[0] );
OSL_ENSURE( nRuleMapCount == size_t( OSQLParseNode::rule_count ), "OSQLParser::OSQLParser: added a new rule? Adjust this map!" );
@ -2511,6 +2512,7 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
rString.append(m_aNodeValue);
rString.appendAscii("#");
break;
case SQL_NODE_INTNUM:
case SQL_NODE_APPROXNUM:
{
@ -2523,6 +2525,12 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
rString.append(aTmp);
} break;
case SQL_NODE_PUNCTUATION:
if ( getParent() && SQL_ISRULE(getParent(),cast_spec) && m_aNodeValue.toChar() == '(' ) // no spaces in front of '('
{
rString.append(m_aNodeValue);
break;
}
// fall through
default:
if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' )

View File

@ -1,4 +1,4 @@
dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg offuh NULL
dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg offuh filter LIBXSLT:libxslt NULL
dt desktop usr1 - all dt_mkout NULL
dt desktop\inc nmake - all dt_inc NULL
dt desktop\prj get - all dt_prj NULL
@ -42,3 +42,6 @@ dt desktop\source\registration\com\sun\star\servicetag\resources get - a
dt desktop\source\registration\com\sun\star\servicetag nmake - all sn_svctag NULL
dt desktop\source\registration\com\sun\star\registration nmake - all sn_regjob sn_svctag NULL
dt desktop\qa\deployment_misc nmake - all sn_qa_deployment_misc dt_dp_misc dt_inc NULL
dt desktop\test\deployment\active nmake - all dt_test_deployment_active NULL
dt desktop\test\deployment\boxt nmake - all dt_test_deployment_boxt NULL
dt desktop\test\deployment\passive nmake - all dt_test_deployment_passive NULL

View File

@ -121,6 +121,7 @@
#include <osl/module.h>
#include <osl/file.hxx>
#include <osl/signal.h>
#include <osl/thread.hxx>
#include <rtl/uuid.h>
#include <rtl/uri.hxx>
#include <unotools/pathoptions.hxx>
@ -347,10 +348,8 @@ CommandLineArgs* Desktop::GetCommandLineArgs()
{
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if ( !pArgs )
{
pArgs = new CommandLineArgs;
}
}
return pArgs;
}
@ -1619,25 +1618,6 @@ void Desktop::Main()
}
String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String();
delete pLabelResMgr;
/*
// locale and UI locale in AppSettings are now retrieved from configuration or system directly via SvtSysLocale
// no reason to set while starting
// set UI language and locale
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ set locale settings" );
//LanguageSelection langselect;
OUString aUILocaleString = LanguageSelection::getLanguageString();
Locale aUILocale = LanguageSelection::IsoStringToLocale(aUILocaleString);
LanguageType eLanguage = SvtSysLocale().GetLanguage();
// #i39040#, do not call anything between GetSettings and SetSettings that might have
// a side effect on the settings (like, eg, SvtSysLocaleOptions().GetLocaleLanguageType(),
// which changes the MiscSettings !!! )
AllSettings aSettings( Application::GetSettings() );
aSettings.SetUILocale( aUILocale );
aSettings.SetLanguage( eLanguage );
Application::SetSettings( aSettings );
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} set locale settings" );
*/
// Check for StarOffice/Suite specific extensions runs also with OpenOffice installation sets
OUString aTitleString( aTitle );
@ -1657,12 +1637,9 @@ void Desktop::Main()
#endif
SetDisplayName( aTitle );
// SetSplashScreenProgress(30);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create SvtPathOptions and SvtLanguageOptions" );
pPathOptions.reset( new SvtPathOptions);
// SetSplashScreenProgress(40);
// pLanguageOptions = new SvtLanguageOptions(sal_True);
// SetSplashScreenProgress(45);
SetSplashScreenProgress(40);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" );
// Check special env variable #111015#
@ -1744,6 +1721,7 @@ void Desktop::Main()
}
SetSplashScreenProgress(50);
// Backing Component
sal_Bool bCrashed = sal_False;
sal_Bool bExistsRecoveryData = sal_False;
@ -1773,20 +1751,16 @@ void Desktop::Main()
if ( !bRestartRequested )
{
if (
(pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
if ((!pCmdLineArgs->WantsToLoadDocument() ) &&
(SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
(!bExistsRecoveryData ) &&
(!bExistsSessionData ) &&
(!Application::AnyInput( INPUT_APPEVENT ) )
)
(!Application::AnyInput( INPUT_APPEVENT ) ))
{
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
Reference< XFrame > xDesktopFrame( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
if (xDesktopFrame.is())
{
// SetSplashScreenProgress(60);
Reference< XFrame > xBackingFrame;
Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
@ -1807,9 +1781,7 @@ void Desktop::Main()
lArgs[0] <<= xContainerWindow;
Reference< XController > xBackingComp(
xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
UNO_QUERY);
// SetSplashScreenProgress(80);
xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), UNO_QUERY);
if (xBackingComp.is())
{
Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
@ -1840,16 +1812,6 @@ void Desktop::Main()
FatalError( MakeStartupErrorMessage(e.Message) );
return;
}
/*
catch ( ... )
{
FatalError( MakeStartupErrorMessage(
OUString::createFromAscii(
"Unknown error during startup (Office wrapper service).\nInstallation could be damaged.")));
return;
}
*/
// SetSplashScreenProgress(55);
SvtFontSubstConfig().Apply();
@ -1858,7 +1820,6 @@ void Desktop::Main()
aAppearanceCfg.SetApplicationDefaults( this );
SvtAccessibilityOptions aOptions;
aOptions.SetVCLSettings();
// SetSplashScreenProgress(60);
if ( !bRestartRequested )
{
@ -1892,15 +1853,6 @@ void Desktop::Main()
FatalError( MakeStartupErrorMessage(e.Message) );
return;
}
/*
catch ( ... )
{
FatalError( MakeStartupErrorMessage(
OUString::createFromAscii(
"Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
return;
}
*/
// Post user event to startup first application component window
// We have to send this OpenClients message short before execute() to
@ -2219,12 +2171,7 @@ IMPL_LINK( Desktop, OpenClients_Impl, void*, EMPTYARG )
// CloseStartupScreen();
CloseSplashScreen();
CheckFirstRun( );
// allow ipc interaction
// OfficeIPCThread::SetReady();
EnableOleAutomation();
if (getenv ("OOO_EXIT_POST_STARTUP"))
@ -2721,16 +2668,6 @@ void Desktop::OpenClients()
if ( ! bAllowRecoveryAndSessionManagement )
{
/*
::comphelper::ConfigurationHelper::writeDirectKey(
::comphelper::getProcessServiceFactory(),
::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery"),
::rtl::OUString::createFromAscii("AutoSave"),
::rtl::OUString::createFromAscii("Enabled"),
::com::sun::star::uno::makeAny(sal_False),
::comphelper::ConfigurationHelper::E_STANDARD);
*/
try
{
Reference< XDispatch > xRecovery(

View File

@ -142,15 +142,16 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
UNO_QUERY);
// parse command line arguments
sal_Bool bPrintEvent = sal_False;
sal_Bool bOpenEvent = sal_True;
sal_Bool bViewEvent = sal_False;
sal_Bool bStartEvent = sal_False;
sal_Bool bPrintToEvent = sal_False;
sal_Bool bPrinterName = sal_False;
sal_Bool bForceOpenEvent = sal_False;
sal_Bool bForceNewEvent = sal_False;
sal_Bool bDisplaySpec = sal_False;
bool bOpenEvent(true);
bool bPrintEvent(false);
bool bViewEvent(false);
bool bStartEvent(false);
bool bPrintToEvent(false);
bool bPrinterName(false);
bool bForceOpenEvent(false);
bool bForceNewEvent(false);
bool bDisplaySpec(false);
bool bOpenDoc(false);
m_eArgumentCount = NONE;
@ -169,8 +170,8 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
if (tmp.getLength() > 0)
aArg = tmp;
}
String aArgStr = aArg;
String aArgStr = aArg;
if ( aArg.getLength() > 0 )
{
m_eArgumentCount = m_eArgumentCount == NONE ? ONE : MANY;
@ -182,98 +183,98 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
if ( aArgStr.EqualsIgnoreCaseAscii( "-n" ))
{
// force new documents based on the following documents
bForceNewEvent = sal_True;
bOpenEvent = sal_False;
bForceOpenEvent = sal_False;
bPrintToEvent = sal_False;
bPrintEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bForceNewEvent = true;
bOpenEvent = false;
bForceOpenEvent = false;
bPrintToEvent = false;
bPrintEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-o" ))
{
// force open documents regards if they are templates or not
bForceOpenEvent = sal_True;
bOpenEvent = sal_False;
bForceNewEvent = sal_False;
bPrintToEvent = sal_False;
bPrintEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
// force open documents regardless if they are templates or not
bForceOpenEvent = true;
bOpenEvent = false;
bForceNewEvent = false;
bPrintToEvent = false;
bPrintEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-pt" ))
{
// Print to special printer
bPrintToEvent = sal_True;
bPrinterName = sal_True;
bPrintEvent = sal_False;
bOpenEvent = sal_False;
bForceNewEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bForceOpenEvent = sal_False;
bPrintToEvent = true;
bPrinterName = true;
bPrintEvent = false;
bOpenEvent = false;
bForceNewEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
bForceOpenEvent = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-p" ))
{
// Print to default printer
bPrintEvent = sal_True;
bPrintToEvent = sal_False;
bOpenEvent = sal_False;
bForceNewEvent = sal_False;
bForceOpenEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bPrintEvent = true;
bPrintToEvent = false;
bOpenEvent = false;
bForceNewEvent = false;
bForceOpenEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" ))
{
// open in viewmode
bOpenEvent = sal_False;
bPrintEvent = sal_False;
bPrintToEvent = sal_False;
bForceNewEvent = sal_False;
bForceOpenEvent = sal_False;
bViewEvent = sal_True;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bOpenEvent = false;
bPrintEvent = false;
bPrintToEvent = false;
bForceNewEvent = false;
bForceOpenEvent = false;
bViewEvent = true;
bStartEvent = false;
bDisplaySpec = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-show" ))
{
// open in viewmode
bOpenEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_True;
bPrintEvent = sal_False;
bPrintToEvent = sal_False;
bForceNewEvent = sal_False;
bForceOpenEvent = sal_False;
bDisplaySpec = sal_False;
bOpenEvent = false;
bViewEvent = false;
bStartEvent = true;
bPrintEvent = false;
bPrintToEvent = false;
bForceNewEvent = false;
bForceOpenEvent = false;
bDisplaySpec = false;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-display" ))
{
// set display
bOpenEvent = sal_False;
bPrintEvent = sal_False;
bForceOpenEvent = sal_False;
bPrintToEvent = sal_False;
bForceNewEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_True;
bOpenEvent = false;
bPrintEvent = false;
bForceOpenEvent = false;
bPrintToEvent = false;
bForceNewEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = true;
}
else if ( aArgStr.EqualsIgnoreCaseAscii( "-language" ))
{
bOpenEvent = sal_False;
bPrintEvent = sal_False;
bForceOpenEvent = sal_False;
bPrintToEvent = sal_False;
bForceNewEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bOpenEvent = false;
bPrintEvent = false;
bForceOpenEvent = false;
bPrintToEvent = false;
bForceNewEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
}
#ifdef MACOSX
@ -285,14 +286,14 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL )
{
// finder argument from MacOSX
bOpenEvent = sal_False;
bPrintEvent = sal_False;
bForceOpenEvent = sal_False;
bPrintToEvent = sal_False;
bForceNewEvent = sal_False;
bViewEvent = sal_False;
bStartEvent = sal_False;
bDisplaySpec = sal_False;
bOpenEvent = false;
bPrintEvent = false;
bForceOpenEvent = false;
bPrintToEvent = false;
bForceNewEvent = false;
bViewEvent = false;
bStartEvent = false;
bDisplaySpec = false;
}
#endif
}
@ -308,29 +309,54 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
{
// handle this argument as a filename
if ( bOpenEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_OPENLIST, aArgStr );
bOpenDoc = true;
}
else if ( bViewEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_VIEWLIST, aArgStr );
bOpenDoc = true;
}
else if ( bStartEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_STARTLIST, aArgStr );
bOpenDoc = true;
}
else if ( bPrintEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTLIST, aArgStr );
bOpenDoc = true;
}
else if ( bPrintToEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_PRINTTOLIST, aArgStr );
bOpenDoc = true;
}
else if ( bForceNewEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_FORCENEWLIST, aArgStr );
bOpenDoc = true;
}
else if ( bForceOpenEvent )
{
AddStringListParam_Impl( CMD_STRINGPARAM_FORCEOPENLIST, aArgStr );
else if ( bDisplaySpec ){
bOpenDoc = true;
}
else if ( bDisplaySpec )
{
AddStringListParam_Impl( CMD_STRINGPARAM_DISPLAY, aArgStr );
bDisplaySpec = sal_False; // only one display, not a lsit
bOpenEvent = sal_True; // set back to standard
bDisplaySpec = false; // only one display, not a lsit
bOpenEvent = true; // set back to standard
}
}
}
}
}
}
if ( bOpenDoc )
m_bDocumentArgs = true;
}
void CommandLineArgs::AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam )
@ -473,7 +499,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
SetBoolParam_Impl( CMD_BOOLPARAM_HELPMATH, sal_True );
return sal_True;
}
#ifdef MACOSX
#ifdef MACOSX
/* #i84053# ignore -psn on Mac
Platform dependent #ifdef here is ugly, however this is currently
the only platform dependent parameter. Should more appear
@ -484,7 +510,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
SetBoolParam_Impl( CMD_BOOLPARAM_PSN, sal_True );
return sal_True;
}
#endif
#endif
else if ( aArgStr.Copy(0, 8).EqualsIgnoreCaseAscii( "-accept=" ))
{
AddStringListParam_Impl( CMD_STRINGPARAM_ACCEPT, aArgStr.Copy( 8 ) );
@ -506,11 +532,8 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
if ( aArgStr.Len() > 8 )
{
rtl::OUString aUserDir = aArgStr;
AddStringListParam_Impl(
CMD_STRINGPARAM_USERDIR,
::rtl::Uri::decode( aUserDir.copy( 8 ),
rtl_UriDecodeWithCharset,
RTL_TEXTENCODING_UTF8 ) );
AddStringListParam_Impl( CMD_STRINGPARAM_USERDIR,
::rtl::Uri::decode( aUserDir.copy( 8 ), rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ) );
}
return sal_True;
}
@ -534,6 +557,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WRITER );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_WRITER, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-calc" )) == sal_True )
@ -541,6 +565,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_CALC );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_CALC, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-draw" )) == sal_True )
@ -548,6 +573,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_DRAW );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_DRAW, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-impress" )) == sal_True )
@ -555,6 +581,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_IMPRESS );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_IMPRESS, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-base" )) == sal_True )
@ -562,6 +589,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_BASE );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_BASE, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-global" )) == sal_True )
@ -569,6 +597,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_GLOBAL );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_GLOBAL, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-math" )) == sal_True )
@ -576,6 +605,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_MATH );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_MATH, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-web" )) == sal_True )
@ -583,6 +613,7 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString&
sal_Bool bAlreadySet = CheckGroupMembers( CMD_GRPID_MODULE, CMD_BOOLPARAM_WEB );
if ( !bAlreadySet )
SetBoolParam_Impl( CMD_BOOLPARAM_WEB, sal_True );
m_bDocumentArgs = true;
return sal_True;
}
@ -605,12 +636,12 @@ sal_Bool CommandLineArgs::CheckGroupMembers( GroupParamId nGroupId, BoolParam nE
void CommandLineArgs::ResetParamValues()
{
int i;
for ( i = 0; i < CMD_BOOLPARAM_COUNT; i++ )
m_aBoolParams[i] = sal_False;
for ( i = 0; i < CMD_STRINGPARAM_COUNT; i++ )
m_aStrSetParams[i] = sal_False;
m_eArgumentCount = NONE;
m_bDocumentArgs = false;
}
void CommandLineArgs::SetBoolParam( BoolParam eParam, sal_Bool bNewValue )
@ -897,4 +928,10 @@ sal_Bool CommandLineArgs::IsEmptyOrAcceptOnly() const
( ( m_eArgumentCount == ONE ) && m_aBoolParams[ CMD_BOOLPARAM_PSN ] );
}
sal_Bool CommandLineArgs::WantsToLoadDocument() const
{
osl::MutexGuard aMutexGuard( m_aMutex );
return m_bDocumentArgs;
}
} // namespace desktop

View File

@ -101,7 +101,8 @@ class CommandLineArgs
CMD_GRPID_COUNT
};
struct Supplier {
struct Supplier
{
// Thrown from constructors and next:
class Exception {
public:
@ -155,6 +156,7 @@ class CommandLineArgs
sal_Bool IsMath() const;
sal_Bool IsWeb() const;
sal_Bool HasModuleParam() const;
sal_Bool WantsToLoadDocument() const;
// Access to string parameters
sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const;
@ -201,6 +203,7 @@ class CommandLineArgs
rtl::OUString m_aStrParams[ CMD_STRINGPARAM_COUNT ]; // Stores string parameters
sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline
Count m_eArgumentCount; // Number of Args
bool m_bDocumentArgs; // A document creation/open/load arg is used
mutable ::osl::Mutex m_aMutex;
// static definition for groups where only one member can be true

View File

@ -106,7 +106,7 @@
#define RID_DLG_UPDATE_LINE 8
#define RID_DLG_UPDATE_HELP 9
#define RID_DLG_UPDATE_OK 10
#define RID_DLG_UPDATE_CANCEL 11
#define RID_DLG_UPDATE_CLOSE 11
#define RID_DLG_UPDATE_NORMALALERT 12
#define RID_DLG_UPDATE_HIGHCONTRASTALERT 13
#define RID_DLG_UPDATE_ERROR 14
@ -127,6 +127,11 @@
#define RID_DLG_UPDATE_RELEASENOTES_LINK 29
#define RID_DLG_UPDATE_NOUPDATE 30
#define RID_DLG_UPDATE_VERSION 31
#define RID_DLG_UPDATE_IGNORE 32
#define RID_DLG_UPDATE_ENABLE 33
#define RID_DLG_UPDATE_IGNORE_ALL 34
#define RID_DLG_UPDATE_IGNORED_UPDATE 35
#define RID_DLG_UPDATEINSTALL (RID_DEPLOYMENT_GUI_START + 20)
@ -163,6 +168,7 @@
#define RID_STR_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95)
#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96)
#define RID_STR_ERROR_MISSING_LICENSE (RID_DEPLOYMENT_GUI_START+97)
#define RID_STR_SHOW_LICENSE_CMD (RID_DEPLOYMENT_GUI_START+98)
#define WARNINGBOX_CONCURRENTINSTANCE (RID_DEPLOYMENT_GUI_START+100)
@ -172,6 +178,7 @@
#define RID_WARNINGBOX_REMOVE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+104)
#define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105)
#define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106)
#define RID_DLG_SHOW_LICENSE (RID_DEPLOYMENT_GUI_START+107)
#define RID_DLG_LICENSE RID_DEPLOYMENT_LICENSE_START

View File

@ -119,6 +119,11 @@ String RID_STR_ERROR_MISSING_LICENSE
Text [ en-US ] = "This extension is disabled because you haven't accepted the license yet.\n";
};
String RID_STR_SHOW_LICENSE_CMD
{
Text [ en-US ] = "Show license";
};
// Dialog layout
// ---------------------------------------------------
// row 1 | multi line edit
@ -293,6 +298,35 @@ ModalDialog RID_DLG_LICENSE
};
ModalDialog RID_DLG_SHOW_LICENSE
{
Text [ en-US ] = "Extension Software License Agreement";
Size = MAP_APPFONT( 300, 200 );
OutputSize = TRUE;
SVLook = TRUE;
Moveable = TRUE;
Closeable = TRUE;
Sizeable = TRUE;
MultiLineEdit ML_LICENSE
{
Pos = MAP_APPFONT( 5, 5 );
Size = MAP_APPFONT( 300 - 10, 200 - 15 - RSC_CD_PUSHBUTTON_HEIGHT );
Border = TRUE;
VScroll = TRUE;
ReadOnly = TRUE;
};
OKButton RID_EM_BTN_CLOSE
{
TabStop = TRUE;
DefButton = TRUE;
Text [ en-US ] = "Close";
Pos = MAP_APPFONT( (300-RSC_CD_PUSHBUTTON_WIDTH)/2, 200 - 5 - RSC_CD_PUSHBUTTON_HEIGHT );
Size = MAP_APPFONT( RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT );
};
};
WarningBox RID_WARNINGBOX_INSTALL_EXTENSION {

72
desktop/source/deployment/gui/dp_gui_dialog2.cxx Normal file → Executable file
View File

@ -39,8 +39,10 @@
#include "dp_gui_theextmgr.hxx"
#include "dp_gui_extensioncmdqueue.hxx"
#include "dp_misc.h"
#include "dp_ucb.h"
#include "dp_update.hxx"
#include "dp_identifier.hxx"
#include "dp_descriptioninfoset.hxx"
#include "vcl/ctrl.hxx"
#include "vcl/menu.hxx"
@ -118,7 +120,8 @@ enum MENU_COMMAND
CMD_REMOVE = 1,
CMD_ENABLE,
CMD_DISABLE,
CMD_UPDATE
CMD_UPDATE,
CMD_SHOW_LICENSE
};
class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
@ -224,13 +227,10 @@ const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const
// -----------------------------------------------------------------------
void ExtBoxWithBtns_Impl::RecalcAll()
{
ExtensionBox_Impl::RecalcAll();
const sal_Int32 nActive = getSelIndex();
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{
SetButtonPos( GetEntryRect( nActive ) );
SetButtonStatus( GetEntryData( nActive) );
}
else
@ -239,6 +239,11 @@ void ExtBoxWithBtns_Impl::RecalcAll()
m_pEnableBtn->Hide();
m_pRemoveBtn->Hide();
}
ExtensionBox_Impl::RecalcAll();
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
SetButtonPos( GetEntryRect( nActive ) );
}
@ -363,14 +368,15 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse )
// -----------------------------------------------------------------------
MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
{
if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) )
{
if ( ! GetEntryData( nPos )->m_bLocked )
{
if ( nPos >= (long) getItemCount() )
return CMD_NONE;
PopupMenu aPopup;
aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) );
if ( ! GetEntryData( nPos )->m_bLocked )
{
if ( GetEntryData( nPos )->m_bUser )
{
if ( GetEntryData( nPos )->m_eState == REGISTERED )
@ -378,13 +384,13 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
}
aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
}
if ( GetEntryData( nPos )->m_sLicenseText.Len() )
aPopup.InsertItem( CMD_SHOW_LICENSE, DialogHelper::getResourceString( RID_STR_SHOW_LICENSE_CMD ) );
return (MENU_COMMAND) aPopup.Execute( this, rPos );
}
}
return CMD_NONE;
}
//------------------------------------------------------------------------------
@ -409,6 +415,12 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
break;
case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
break;
case CMD_SHOW_LICENSE:
{
ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage );
aLicenseDlg.Execute();
break;
}
}
}
else if ( rMEvt.IsLeft() )
@ -1742,6 +1754,42 @@ void UpdateRequiredDialog::disableAllEntries()
m_aCloseBtn.SetText( m_sCloseText );
}
//------------------------------------------------------------------------------
// ShowLicenseDialog
//------------------------------------------------------------------------------
ShowLicenseDialog::ShowLicenseDialog( Window * pParent,
const uno::Reference< deployment::XPackage > &xPackage ) :
ModalDialog( pParent, DialogHelper::getResId( RID_DLG_SHOW_LICENSE ) ),
m_aLicenseText( this, DialogHelper::getResId( ML_LICENSE ) ),
m_aCloseBtn( this, DialogHelper::getResId( RID_EM_BTN_CLOSE ) )
{
FreeResource();
OUString aText = xPackage->getLicenseText();
m_aLicenseText.SetText( aText );
}
//------------------------------------------------------------------------------
ShowLicenseDialog::~ShowLicenseDialog()
{}
//------------------------------------------------------------------------------
void ShowLicenseDialog::Resize()
{
Size aTotalSize( GetOutputSizePixel() );
Size aTextSize( aTotalSize.Width() - RSC_SP_DLG_INNERBORDER_LEFT - RSC_SP_DLG_INNERBORDER_RIGHT,
aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_TOP - 2*RSC_SP_DLG_INNERBORDER_BOTTOM
- m_aCloseBtn.GetSizePixel().Height() );
m_aLicenseText.SetPosSizePixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ),
aTextSize );
Point aBtnPos( (aTotalSize.Width() - m_aCloseBtn.GetSizePixel().Width())/2,
aTotalSize.Height() - RSC_SP_DLG_INNERBORDER_BOTTOM
- m_aCloseBtn.GetSizePixel().Height() );
m_aCloseBtn.SetPosPixel( aBtnPos );
}
//=================================================================================
// UpdateRequiredDialogService
//=================================================================================

15
desktop/source/deployment/gui/dp_gui_dialog2.hxx Executable file → Normal file
View File

@ -35,6 +35,7 @@
#include "svtools/fixedhyper.hxx"
#include "svtools/prgsbar.hxx"
#include "svtools/svmedit.hxx"
#include "osl/conditn.hxx"
#include "osl/mutex.hxx"
@ -245,6 +246,20 @@ public:
bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const;
};
//==============================================================================
class ShowLicenseDialog : public ModalDialog
{
MultiLineEdit m_aLicenseText;
OKButton m_aCloseBtn;
public:
ShowLicenseDialog( Window * pParent,
const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
virtual ~ShowLicenseDialog();
virtual void Resize();
};
//==============================================================================
class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog >
{

View File

@ -71,9 +71,12 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
m_pPublisher( NULL ),
m_xPackage( xPackage )
{
try
{
m_sTitle = xPackage->getDisplayName();
m_sVersion = xPackage->getVersion();
m_sDescription = xPackage->getDescription();
m_sLicenseText = xPackage->getLicenseText();
beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
m_sPublisher = aInfo.First;
@ -94,6 +97,9 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
else if ( eState == NOT_REGISTERED )
checkDependencies();
}
catch (deployment::ExtensionRemovedException &) {}
catch (uno::RuntimeException &) {}
}
//------------------------------------------------------------------------------
@ -963,6 +969,11 @@ long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
bool bLocked = m_pManager->isReadOnly( xPackage );
TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) );
// Don't add empty entries
if ( ! pEntry->m_sTitle.Len() )
return 0;
xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
::osl::ClearableMutexGuard guard(m_entriesMutex);

View File

@ -81,6 +81,7 @@ struct Entry_Impl
String m_sPublisher;
String m_sPublisherURL;
String m_sErrorText;
String m_sLicenseText;
Image m_aIcon;
Image m_aIconHC;
svt::FixedHyperlink *m_pPublisher;

5
desktop/source/deployment/gui/dp_gui_updatedata.hxx Normal file → Executable file
View File

@ -28,6 +28,7 @@
#define INCLUDED_DP_GUI_UPDATEDATA_HXX
#include "sal/config.h"
#include "tools/solar.h"
#include "rtl/ustring.hxx"
#include "com/sun/star/uno/Reference.hxx"
@ -80,6 +81,10 @@ struct UpdateData
//are to be ignored.
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
aUpdateSource;
// ID to find this entry in the update listbox
USHORT m_nID;
bool m_bIgnored;
};
}

829
desktop/source/deployment/gui/dp_gui_updatedialog.cxx Normal file → Executable file

File diff suppressed because it is too large Load Diff

47
desktop/source/deployment/gui/dp_gui_updatedialog.hxx Normal file → Executable file
View File

@ -112,8 +112,7 @@ private:
struct DisabledUpdate;
struct SpecificError;
union IndexUnion;
friend union IndexUnion;
struct IgnoredUpdate;
struct Index;
friend struct Index;
class Thread;
@ -135,40 +134,36 @@ private:
void operator =(UpdateDialog::CheckListBox &); // not defined
virtual void MouseButtonDown(MouseEvent const & event);
virtual void MouseButtonUp(MouseEvent const & event);
virtual void KeyInput(KeyEvent const & event);
void handlePopupMenu( const Point &rPos );
rtl::OUString m_ignoreUpdate;
rtl::OUString m_ignoreAllUpdates;
rtl::OUString m_enableUpdate;
UpdateDialog & m_dialog;
};
friend class CheckListBox;
void insertItem(
rtl::OUString const & name, USHORT position,
std::auto_ptr< UpdateDialog::Index const > index,
SvLBoxButtonKind kind);
USHORT insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll );
void addAdditional(
rtl::OUString const & name, USHORT position,
std::auto_ptr< UpdateDialog::Index const > index,
SvLBoxButtonKind kind);
void addEnabledUpdate(
rtl::OUString const & name, dp_gui::UpdateData const & data);
void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data);
#if 0
void addGeneralError(rtl::OUString const & message);
#endif
void addSpecificError(UpdateDialog::SpecificError const & data);
void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data );
void addDisabledUpdate( UpdateDialog::DisabledUpdate & data );
void addSpecificError( UpdateDialog::SpecificError & data );
void checkingDone();
void enableOk();
void getIgnoredUpdates();
void storeIgnoredUpdates();
void initDescription();
void clearDescription();
bool showDescription(::com::sun::star::uno::Reference<
@ -183,7 +178,7 @@ private:
DECL_LINK(selectionHandler, void *);
DECL_LINK(allHandler, void *);
DECL_LINK(okHandler, void *);
DECL_LINK(cancelHandler, void *);
DECL_LINK(closeHandler, void *);
DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *);
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
@ -202,7 +197,7 @@ private:
FixedLine m_line;
HelpButton m_help;
PushButton m_ok;
CancelButton m_cancel;
PushButton m_close;
rtl::OUString m_error;
rtl::OUString m_none;
rtl::OUString m_noInstallable;
@ -214,10 +209,12 @@ private:
rtl::OUString m_noDependencyCurVer;
rtl::OUString m_browserbased;
rtl::OUString m_version;
rtl::OUString m_ignoredUpdate;
std::vector< dp_gui::UpdateData > m_enabledUpdates;
std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
std::vector< rtl::OUString > m_generalErrors;
std::vector< UpdateDialog::SpecificError > m_specificErrors;
std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
std::vector< Index* > m_ListboxEntries;
std::vector< dp_gui::UpdateData > & m_updateData;
rtl::Reference< UpdateDialog::Thread > m_thread;
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
@ -226,6 +223,8 @@ private:
Size m_aFirstLineSize;
long m_nFirstLineDelta;
long m_nOneLineMissing;
USHORT m_nLastID;
bool m_bModified;
};
}

20
desktop/source/deployment/gui/dp_gui_updatedialog.src Normal file → Executable file
View File

@ -199,7 +199,7 @@ ModalDialog RID_DLG_UPDATE {
Text[en-US] = "~Install";
DefButton = TRUE;
};
CancelButton RID_DLG_UPDATE_CANCEL {
PushButton RID_DLG_UPDATE_CLOSE {
Pos = MAP_APPFONT(
RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH,
(RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT +
@ -208,6 +208,7 @@ ModalDialog RID_DLG_UPDATE {
RSC_SP_CTRL_DESC_Y + LOCAL_LIST_HEIGHT2 + RSC_SP_FLGR_SPACE_Y +
RSC_CD_FIXEDLINE_HEIGHT + RSC_SP_FLGR_SPACE_Y));
Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT);
Text[en-US] = "Close";
};
Image RID_DLG_UPDATE_NORMALALERT {
@ -227,7 +228,7 @@ ModalDialog RID_DLG_UPDATE {
Text[en-US] = "No new updates are available.";
};
String RID_DLG_UPDATE_NOINSTALLABLE {
Text[en-US] = "No installable updates are available. To see all updates, mark the check box 'Show all updates'.";
Text[en-US] = "No installable updates are available. To see ignored or disabled updates, mark the check box 'Show all updates'.";
};
String RID_DLG_UPDATE_FAILURE {
Text[en-US] = "An error occurred:";
@ -236,7 +237,7 @@ ModalDialog RID_DLG_UPDATE {
Text[en-US] = "Unknown error.";
};
String RID_DLG_UPDATE_NODESCRIPTION {
Text[en-US] = "No descriptions available for this extension.";
Text[en-US] = "No more details are available for this update.";
};
String RID_DLG_UPDATE_NOINSTALL {
Text[en-US] = "The extension cannot be updated because:";
@ -250,10 +251,21 @@ ModalDialog RID_DLG_UPDATE {
String RID_DLG_UPDATE_BROWSERBASED {
Text[en-US] = "browser based update";
};
String RID_DLG_UPDATE_VERSION {
Text[en-US] = "Version";
};
String RID_DLG_UPDATE_IGNORE {
Text[en-US] = "Ignore this Update";
};
String RID_DLG_UPDATE_IGNORE_ALL {
Text[en-US] = "Ignore all Updates";
};
String RID_DLG_UPDATE_ENABLE {
Text[en-US] = "Enable Updates";
};
String RID_DLG_UPDATE_IGNORED_UPDATE {
Text[en-US] = "This update will be ignored.\n";
};
};
WarningBox RID_WARNINGBOX_UPDATE_SHARED_EXTENSION

2
desktop/source/deployment/misc/dp_misc.src Normal file → Executable file
View File

@ -32,7 +32,7 @@ String RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN {
};
String RID_DEPLYOMENT_DEPENDENCIES_MIN {
Text[en-US] = "Extensions requires at least OpenOffice.org %VERSION";
Text[en-US] = "Extension requires at least OpenOffice.org %VERSION";
};
String RID_DEPLYOMENT_DEPENDENCIES_MAX {

File diff suppressed because it is too large Load Diff

View File

@ -33,6 +33,7 @@
#define RID_STR_DYN_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+10)
#define RID_STR_JAVA_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+11)
#define RID_STR_PYTHON_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+12)
#define RID_STR_COMPONENTS (RID_DEPLOYMENT_COMPONENT_START+13)
#define RID_STR_RDB_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+20)
#define RID_STR_JAVA_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+21)

View File

@ -42,6 +42,11 @@ String RID_STR_PYTHON_COMPONENT
Text [ en-US ] = "UNO Python Component";
};
String RID_STR_COMPONENTS
{
Text [ en-US ] = "UNO Components";
};
String RID_STR_RDB_TYPELIB
{
Text [ en-US ] = "UNO RDB Type Library";

9
desktop/source/deployment/registry/dp_backend.cxx Normal file → Executable file
View File

@ -519,6 +519,15 @@ OUString Package::getDescription() throw (
return OUString();
}
//______________________________________________________________________________
OUString Package::getLicenseText() throw (
deployment::ExtensionRemovedException,RuntimeException)
{
if (m_bRemoved)
throw deployment::ExtensionRemovedException();
return OUString();
}
//______________________________________________________________________________
Sequence<OUString> Package::getUpdateInformationURLs() throw (
deployment::ExtensionRemovedException, RuntimeException)

Some files were not shown because too many files have changed in this diff Show More