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 usr1 - all av_mkout NULL
av avmedia\prj get - all av_prj NULL av avmedia\prj get - all av_prj NULL
av avmedia\inc get - all av_inv NULL av avmedia\inc get - all av_inv NULL

View File

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

View File

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

View File

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

View File

@ -106,6 +106,7 @@ enum SbxDataType {
}; };
const UINT32 SBX_TYPE_WITH_EVENTS_FLAG = 0x10000; 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 const UINT32 SBX_FIXED_LEN_STRING_FLAG = 0x10000; // same value as above as no conflict possible
#endif #endif
@ -317,6 +318,8 @@ enum SbxError { // Ergebnis einer Rechenoperation/Konversion
#define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call) #define SBX_REFERENCE 0x4000 // Parameter is Reference (DLL-call)
#define SBX_NO_MODIFY 0x8000 // SetModified is suppressed #define SBX_NO_MODIFY 0x8000 // SetModified is suppressed
#define SBX_WITH_EVENTS 0x0080 // Same value as unused SBX_HIDDEN #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: // Broadcaster-IDs:
#define SBX_HINT_DYING SFX_HINT_DYING #define SBX_HINT_DYING SFX_HINT_DYING

View File

@ -439,6 +439,7 @@ SV_DECL_REF(SbxInfo)
class SfxBroadcaster; class SfxBroadcaster;
class SbxVariableImpl; class SbxVariableImpl;
class StarBASIC;
class SbxVariable : public SbxValue class SbxVariable : public SbxValue
{ {
@ -499,7 +500,9 @@ public:
const String& GetDeclareClassName( void ); const String& GetDeclareClassName( void );
void SetDeclareClassName( const String& ); 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 ); 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 usr1 - all sb_mkout NULL
sb basic\inc nmake - all sb_inc NULL sb basic\inc nmake - all sb_inc NULL
sb basic\source\app nmake - all sb_app sb_class 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 ..\%__SRC%\lib\libsample.a %_DEST%\lib%_EXT%\libsample.a
mkdir: %_DEST%\inc%_EXT%\basic mkdir: %_DEST%\inc%_EXT%\basic
..\inc\testtool.hrc %_DEST%\inc%_EXT%\basic\testtool.hrc ..\inc\basic\*.hxx %_DEST%\inc%_EXT%\basic\*.hxx
..\inc\ttmsg.hrc %_DEST%\inc%_EXT%\basic\ttmsg.hrc ..\inc\basic\*.hrc %_DEST%\inc%_EXT%\basic\*.hrc
..\inc\basic\ttglobal.hrc %_DEST%\inc%_EXT%\basic\ttglobal.hrc ..\inc\basic\*.h %_DEST%\inc%_EXT%\basic\*.h
..\inc\svtmsg.hrc %_DEST%\inc%_EXT%\basic\svtmsg.hrc
..\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 ..\inc\modsizeexceeded.hxx %_DEST%\inc%_EXT%\basic\modsizeexceeded.hxx
..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component ..\%__SRC%\misc\sb.component %_DEST%\xml%_EXT%\sb.component

View File

@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License. * 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 // Hier sind die Messages aus dem Verzeichnis /basic/source/app enhalten

View File

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

View File

@ -88,54 +88,6 @@ using namespace ::cppu;
using namespace ::osl; 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 ) void SFURL_firing_impl( const ScriptEvent& aScriptEvent, Any* pRet, const Reference< frame::XModel >& xModel )
{ {
OSL_TRACE("SFURL_firing_impl() processing script url %s", 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; bool bDocDialog = false;
StarBASIC* pFoundBasic = NULL; StarBASIC* pFoundBasic = NULL;
OSL_TRACE("About to try get a hold of ThisComponent"); 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 ); aDlgLibAny = implFindDialogLibForDialogBasic( aAnyISP, pINST->GetBasic(), pFoundBasic );
// If we found the dialog then it belongs to the Search basic // If we found the dialog then it belongs to the Search basic
if ( !pFoundBasic ) if ( !pFoundBasic )

View File

@ -71,6 +71,7 @@ TYPEINIT1(StarBASIC,SbxObject)
#define RTLNAME "@SBRTL" #define RTLNAME "@SBRTL"
// i#i68894# // i#i68894#
using namespace ::com::sun::star;
using com::sun::star::uno::Reference; using com::sun::star::uno::Reference;
using com::sun::star::uno::Any; using com::sun::star::uno::Any;
using com::sun::star::uno::UNO_QUERY; using com::sun::star::uno::UNO_QUERY;
@ -346,7 +347,18 @@ SbxObject* SbFormFactory::CreateObject( const String& rClassName )
{ {
if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) ) if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) )
{ {
pFormModule->Load(); 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(); return pFormModule->CreateInstance();
} }
} }
@ -564,7 +576,6 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
if( pObj != NULL ) if( pObj != NULL )
{ {
String aObjClass = pObj->GetClassName(); String aObjClass = pObj->GetClassName();
(void)aObjClass;
SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase); SbClassModuleObject* pClassModuleObj = PTR_CAST(SbClassModuleObject,pObjBase);
if( pClassModuleObj != NULL ) if( pClassModuleObj != NULL )
@ -611,93 +622,7 @@ SbClassModuleObject::~SbClassModuleObject()
void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType ) const SfxHint& rHint, const TypeId& rHintType )
{ {
bool bDone = false; handleProcedureProperties( rBC, rHint );
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 );
} }
SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t ) SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
@ -809,6 +734,9 @@ SbModule* SbClassFactory::FindClass( const String& rClassName )
return pMod; return pMod;
} }
typedef std::vector< StarBASIC* > DocBasicVector;
static DocBasicVector GaDocBasics;
StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic ) StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
: SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic ) : SbxObject( String( RTL_CONSTASCII_USTRINGPARAM("StarBASIC") ) ), bDocBasic( bIsDocBasic )
{ {
@ -822,8 +750,6 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
{ {
pSBFAC = new SbiFactory; pSBFAC = new SbiFactory;
AddFactory( pSBFAC ); AddFactory( pSBFAC );
pUNOFAC = new SbUnoFactory;
AddFactory( pUNOFAC );
pTYPEFAC = new SbTypeFactory; pTYPEFAC = new SbTypeFactory;
AddFactory( pTYPEFAC ); AddFactory( pTYPEFAC );
pCLASSFAC = new SbClassFactory; pCLASSFAC = new SbClassFactory;
@ -832,12 +758,17 @@ StarBASIC::StarBASIC( StarBASIC* p, BOOL bIsDocBasic )
AddFactory( pOLEFAC ); AddFactory( pOLEFAC );
pFORMFAC = new SbFormFactory; pFORMFAC = new SbFormFactory;
AddFactory( pFORMFAC ); AddFactory( pFORMFAC );
pUNOFAC = new SbUnoFactory;
AddFactory( pUNOFAC );
} }
pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this ); pRtl = new SbiStdObject( String( RTL_CONSTASCII_USTRINGPARAM(RTLNAME) ), this );
// Search via StarBasic is always global // Search via StarBasic is always global
SetFlag( SBX_GBLSEARCH ); SetFlag( SBX_GBLSEARCH );
pVBAGlobals = NULL; pVBAGlobals = NULL;
bQuit = FALSE; bQuit = FALSE;
if( bDocBasic )
GaDocBasics.push_back( this );
} }
// #51727 Override SetModified so that the modified state // #51727 Override SetModified so that the modified state
@ -877,6 +808,29 @@ StarBASIC::~StarBASIC()
} }
#endif #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 // #100326 Set Parent NULL in registered listeners
if( xUnoListeners.Is() ) if( xUnoListeners.Is() )
@ -889,6 +843,9 @@ StarBASIC::~StarBASIC()
} }
xUnoListeners = NULL; xUnoListeners = NULL;
} }
clearUnoMethodsForBasic( this );
disposeComVariablesForBasic( this );
} }
// Override new() operator, so that everyone can create a new instance // Override new() operator, so that everyone can create a new instance
@ -907,6 +864,27 @@ void StarBASIC::operator delete( void* p )
::operator delete( 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 * Creation/Managment of modules
@ -1036,15 +1014,15 @@ struct ClassModuleRunInitItem
{} {}
}; };
typedef std::hash_map< ::rtl::OUString, ClassModuleRunInitItem, // Derive from has_map type instead of typedef
::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInitDependencyMap; // 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( ModuleInitDependencyMap& rMap, ClassModuleRunInitItem& rItem )
void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
{ {
ModuleInitDependencyMap& rMIDMap = *GpMIDMap;
rItem.m_bProcessing = true; rItem.m_bProcessing = true;
//bool bAnyDependencies = true; //bool bAnyDependencies = true;
@ -1059,8 +1037,8 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
String& rStr = *it; String& rStr = *it;
// Is required type a class module? // Is required type a class module?
ModuleInitDependencyMap::iterator itFind = rMIDMap.find( rStr ); ModuleInitDependencyMap::iterator itFind = rMap.find( rStr );
if( itFind != rMIDMap.end() ) if( itFind != rMap.end() )
{ {
ClassModuleRunInitItem& rParentItem = itFind->second; ClassModuleRunInitItem& rParentItem = itFind->second;
if( rParentItem.m_bProcessing ) if( rParentItem.m_bProcessing )
@ -1071,7 +1049,7 @@ void SbModule::implProcessModuleRunInit( ClassModuleRunInitItem& rItem )
} }
if( !rParentItem.m_bRunInitDone ) 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) // Run Init-Code of all modules (including inserted libraries)
void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit ) void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
{ {
::vos::OGuard guard( Application::GetSolarMutex() );
// Init own modules // Init own modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) 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 // Consider required types to init in right order. Class modules
// that are required by other modules have to be initialized first. // that are required by other modules have to be initialized first.
ModuleInitDependencyMap aMIDMap; ModuleInitDependencyMap aMIDMap;
GpMIDMap = &aMIDMap;
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{ {
SbModule* pModule = (SbModule*)pModules->Get( nMod ); SbModule* pModule = (SbModule*)pModules->Get( nMod );
@ -1112,9 +1091,8 @@ void StarBASIC::InitAllModules( StarBASIC* pBasicNotToInit )
for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it ) for( it = aMIDMap.begin() ; it != aMIDMap.end(); ++it )
{ {
ClassModuleRunInitItem& rItem = it->second; ClassModuleRunInitItem& rItem = it->second;
SbModule::implProcessModuleRunInit( rItem ); SbModule::implProcessModuleRunInit( aMIDMap, rItem );
} }
GpMIDMap = NULL;
// Call RunInit on standard modules // Call RunInit on standard modules
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
@ -1143,7 +1121,7 @@ void StarBASIC::DeInitAllModules( void )
for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ ) for ( USHORT nMod = 0; nMod < pModules->Count(); nMod++ )
{ {
SbModule* pModule = (SbModule*)pModules->Get( nMod ); SbModule* pModule = (SbModule*)pModules->Get( nMod );
if( pModule->pImage ) if( pModule->pImage && !pModule->isProxyModule() && !pModule->ISA(SbObjModule) )
pModule->pImage->bInit = false; pModule->pImage->bInit = false;
} }
@ -1849,6 +1827,54 @@ bool StarBASIC::GetUNOConstant( const sal_Char* _pAsciiName, ::com::sun::star::u
return bRes; 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 // #118116 Implementation Collection object

View File

@ -36,15 +36,18 @@
#include <svl/hint.hxx> #include <svl/hint.hxx>
#include <cppuhelper/implbase1.hxx> #include <cppuhelper/implbase1.hxx>
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/exc_hlp.hxx> #include <cppuhelper/exc_hlp.hxx>
#include <cppuhelper/typeprovider.hxx> #include <cppuhelper/typeprovider.hxx>
#include <cppuhelper/extract.hxx> #include <cppuhelper/extract.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <rtl/ustrbuf.hxx> #include <rtl/ustrbuf.hxx>
#include <rtl/strbuf.hxx> #include <rtl/strbuf.hxx>
#include <com/sun/star/script/ArrayWrapper.hpp> #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/XComponentContext.hpp>
#include <com/sun/star/uno/DeploymentException.hpp> #include <com/sun/star/uno/DeploymentException.hpp>
@ -61,6 +64,7 @@
#include <com/sun/star/script/XInvocationAdapterFactory.hpp> #include <com/sun/star/script/XInvocationAdapterFactory.hpp>
#include <com/sun/star/script/XTypeConverter.hpp> #include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/XDefaultProperty.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/XNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp> #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XIdlArray.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 // Von Uno nach Sbx wandeln
SbxDataType unoToSbxType( TypeClass eType ) SbxDataType unoToSbxType( TypeClass eType )
{ {
@ -698,6 +740,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
if( eTypeClass == TypeClass_STRUCT ) if( eTypeClass == TypeClass_STRUCT )
{ {
ArrayWrapper aWrap; ArrayWrapper aWrap;
NativeObjectWrapper aNativeObjectWrapper;
if ( (aValue >>= aWrap) ) if ( (aValue >>= aWrap) )
{ {
SbxDimArray* pArray = NULL; SbxDimArray* pArray = NULL;
@ -717,6 +760,18 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
pVar->PutEmpty(); pVar->PutEmpty();
break; 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 else
{ {
SbiInstance* pInst = pINST; SbiInstance* pInst = pINST;
@ -1093,6 +1148,20 @@ Any sbxToUnoValueImpl( SbxVariable* pVar, bool bBlockConversionToSmallestType =
if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) ) if( pClassModule->createCOMWrapperForIface( aRetAny, pClassModuleObj ) )
return aRetAny; 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;
}
}
} }
} }
@ -2223,26 +2292,36 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
} }
else if( bInvocation && mxInvocation.is() ) else if( bInvocation && mxInvocation.is() )
{ {
Sequence< INT16 > OutParamIndex; Reference< XDirectInvocation > xDirectInvoke;
Sequence< Any > OutParam; if ( pMeth->needsDirectInvocation() )
Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam ); xDirectInvoke.set( mxInvocation, UNO_QUERY );
Any aRetAny;
if ( xDirectInvoke.is() )
aRetAny = xDirectInvoke->directInvoke( pMeth->GetName(), args );
else
{
Sequence< INT16 > OutParamIndex;
Sequence< Any > OutParam;
aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
const INT16* pIndices = OutParamIndex.getConstArray();
UINT32 nLen = OutParamIndex.getLength();
if( nLen )
{
const Any* pNewValues = OutParam.getConstArray();
for( UINT32 j = 0 ; j < nLen ; j++ )
{
INT16 iTarget = pIndices[ j ];
if( iTarget >= (INT16)nParamCount )
break;
unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
}
}
}
// Wert von Uno nach Sbx uebernehmen // Wert von Uno nach Sbx uebernehmen
unoToSbxValue( pVar, aRetAny ); unoToSbxValue( pVar, aRetAny );
const INT16* pIndices = OutParamIndex.getConstArray();
UINT32 nLen = OutParamIndex.getLength();
if( nLen )
{
const Any* pNewValues = OutParam.getConstArray();
for( UINT32 j = 0 ; j < nLen ; j++ )
{
INT16 iTarget = pIndices[ j ];
if( iTarget >= (INT16)nParamCount )
break;
unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
}
}
} }
// #55460, Parameter hier weghauen, da das in unoToSbxValue() // #55460, Parameter hier weghauen, da das in unoToSbxValue()
@ -2271,7 +2350,7 @@ Reference< XInvocation > createDynamicInvocationFor( const Any& aAny );
SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ ) SbUnoObject::SbUnoObject( const String& aName_, const Any& aUnoObj_ )
: SbxObject( aName_ ) : SbxObject( aName_ )
, bNeedIntrospection( TRUE ) , bNeedIntrospection( TRUE )
, bIgnoreNativeCOMObjectMembers( FALSE ) , bNativeCOMObject( FALSE )
{ {
static Reference< XIntrospection > xIntrospection; 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 // hiding of equally named COM symbols, e.g. XInvocation::getValue
Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY ); Reference< oleautomation::XAutomationObject > xAutomationObject( aUnoObj_, UNO_QUERY );
if( xAutomationObject.is() ) if( xAutomationObject.is() )
bIgnoreNativeCOMObjectMembers = TRUE; bNativeCOMObject = TRUE;
} }
maTmpUnoObj = aUnoObj_; maTmpUnoObj = aUnoObj_;
@ -2446,6 +2525,47 @@ void SbUnoObject::doIntrospection( void )
// #67781 Start einer Liste aller SbUnoMethod-Instanzen // #67781 Start einer Liste aller SbUnoMethod-Instanzen
static SbUnoMethod* pFirst = NULL; 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 ) void clearUnoMethods( void )
{ {
SbUnoMethod* pMeth = pFirst; SbUnoMethod* pMeth = pFirst;
@ -2462,10 +2582,12 @@ SbUnoMethod::SbUnoMethod
const String& aName_, const String& aName_,
SbxDataType eSbxType, SbxDataType eSbxType,
Reference< XIdlMethod > xUnoMethod_, Reference< XIdlMethod > xUnoMethod_,
bool bInvocation bool bInvocation,
bool bDirect
) )
: SbxMethod( aName_, eSbxType ) : SbxMethod( aName_, eSbxType )
, mbInvocation( bInvocation ) , mbInvocation( bInvocation )
, mbDirectInvocation( bDirect )
{ {
m_xUnoMethod = xUnoMethod_; m_xUnoMethod = xUnoMethod_;
pParamInfoSeq = NULL; pParamInfoSeq = NULL;
@ -2566,7 +2688,7 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
if( !pRes ) if( !pRes )
{ {
::rtl::OUString aUName( rName ); ::rtl::OUString aUName( rName );
if( mxUnoAccess.is() && !bIgnoreNativeCOMObjectMembers ) if( mxUnoAccess.is() && !bNativeCOMObject )
{ {
if( mxExactName.is() ) if( mxExactName.is() )
{ {
@ -2667,6 +2789,17 @@ SbxVariable* SbUnoObject::Find( const String& rName, SbxClassType t )
QuickInsert( (SbxVariable*)xMethRef ); QuickInsert( (SbxVariable*)xMethRef );
pRes = 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 ) catch( RuntimeException& e )
{ {
@ -2726,11 +2859,11 @@ void SbUnoObject::implCreateAll( void )
// Instrospection besorgen // Instrospection besorgen
Reference< XIntrospectionAccess > xAccess = mxUnoAccess; Reference< XIntrospectionAccess > xAccess = mxUnoAccess;
if( !xAccess.is() || bIgnoreNativeCOMObjectMembers ) if( !xAccess.is() || bNativeCOMObject )
{ {
if( mxInvocation.is() ) if( mxInvocation.is() )
xAccess = mxInvocation->getIntrospection(); xAccess = mxInvocation->getIntrospection();
else if( bIgnoreNativeCOMObjectMembers ) else if( bNativeCOMObject )
return; return;
} }
if( !xAccess.is() ) 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; ::rtl::OUString m_aPrefix;
SbxObjectRef m_xScopeObj; SbxObjectRef m_xScopeObj;
bool m_bProxyIsClassModuleObject; bool m_bProxyIsClassModuleObject;
::cppu::OInterfaceContainerHelper m_aListeners;
public: public:
ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ); ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
~ModuleInvocationProxy() ~ModuleInvocationProxy()
@ -4197,11 +4342,17 @@ public:
Sequence< sal_Int16 >& rOutParamIndex, Sequence< sal_Int16 >& rOutParamIndex,
Sequence< Any >& rOutParam ) Sequence< Any >& rOutParam )
throw( CannotConvertException, InvocationTargetException ); 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 ) ModuleInvocationProxy::ModuleInvocationProxy( const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
: m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) ) : m_aPrefix( aPrefix + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("_") ) )
, m_xScopeObj( xScopeObj ) , m_xScopeObj( xScopeObj )
, m_aListeners( m_aMutex )
{ {
m_bProxyIsClassModuleObject = xScopeObj.Is() ? xScopeObj->ISA(SbClassModuleObject) : false; 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() ); vos::OGuard guard( Application::GetSolarMutex() );
Any aRet; Any aRet;
if( !m_xScopeObj.Is() ) SbxObjectRef xScopeObj = m_xScopeObj;
if( !xScopeObj.Is() )
return aRet; return aRet;
::rtl::OUString aFunctionName = m_aPrefix; ::rtl::OUString aFunctionName = m_aPrefix;
aFunctionName += rFunction; 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; SbMethod* pMeth = p != NULL ? PTR_CAST(SbMethod,p) : NULL;
if( pMeth == NULL ) if( pMeth == NULL )
{ {
@ -4336,11 +4501,38 @@ Any SAL_CALL ModuleInvocationProxy::invoke( const ::rtl::OUString& rFunction,
aRet = sbxToUnoValue( xValue ); aRet = sbxToUnoValue( xValue );
pMeth->SetParameters( NULL ); pMeth->SetParameters( NULL );
if( bSetRescheduleBack )
pInst->EnableReschedule( bOldReschedule );
// TODO: OutParameter? // TODO: OutParameter?
return aRet; 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, Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::OUString& aVBAType,
const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj ) const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj )
{ {
@ -4370,6 +4562,97 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
return xRet; 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 // Handle module implements mechanism for OLE types
bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject ) bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject )
{ {
@ -4423,6 +4706,23 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
if( bSuccess ) 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; o_rRetAny <<= xRet;
break; break;
} }
@ -4432,3 +4732,30 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
return bSuccess; 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;
}

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

@ -496,33 +496,26 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
return 0L; return 0L;
} }
#if 0 bool VBAUnlockControllers( StarBASIC* pBasic )
bool UnlockControllerHack( StarBASIC* pBasic )
{ {
bool bRes = false; bool bRes = false;
if ( pBasic && pBasic->IsDocBasic() ) if ( pBasic && pBasic->IsDocBasic() )
{ {
uno::Any aUnoVar; SbUnoObject* pGlobs = dynamic_cast< SbUnoObject* >( pBasic->Find( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ThisComponent" ) ), SbxCLASS_DONTCARE ) );
::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) ); if ( pGlobs ) try
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 uno::Reference< frame::XModel > xModel( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
{ if ( xModel->hasControllersLocked() )
xModel->unlockControllers(); xModel->unlockControllers();
bRes = true; bRes = true;
} }
catch( uno::Exception& ) catch( uno::Exception& )
{ {
}
} }
} }
return bRes; return bRes;
} }
#endif
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen // 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. // beim Programm-Ende freigeben, damit nichts gehalten wird.
ClearUnoObjectsInRTL_Impl( xBasic ); ClearUnoObjectsInRTL_Impl( xBasic );
clearNativeObjectWrapperVector();
DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0"); DBG_ASSERT(pINST->nCallLvl==0,"BASIC-Call-Level > 0");
delete pINST, pINST = NULL, bDelInst = FALSE; delete pINST, pINST = NULL, bDelInst = FALSE;
@ -1184,6 +1179,14 @@ USHORT SbModule::Run( SbMethod* pMeth )
SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth ); SendHint( GetParent(), SBX_HINT_BASICSTOP, pMeth );
GlobalRunDeInit(); GlobalRunDeInit();
// VBA always ensures screenupdating is enabled after completing
if ( mbVBACompat )
VBAUnlockControllers( PTR_CAST( StarBASIC, GetParent() ) );
#ifdef DBG_TRACE_BASIC
dbg_DeInitTrace();
#endif
} }
} }
else else
@ -1195,12 +1198,7 @@ USHORT SbModule::Run( SbMethod* pMeth )
StarBASIC::FatalError( SbERR_STACK_OVERFLOW ); StarBASIC::FatalError( SbERR_STACK_OVERFLOW );
} }
// VBA always ensure screenupdating is enabled after completing
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent()); StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
#if 0
if ( pBasic && pBasic->IsDocBasic() && !pINST )
UnlockControllerHack( pBasic );
#endif
if( bDelInst ) if( bDelInst )
{ {
// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden, // #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 // Zunaechst in dieses Modul, um 358-faehig zu bleiben
// (Branch in sb.cxx vermeiden) // (Branch in sb.cxx vermeiden)
void StarBASIC::ClearAllModuleVars( void ) void StarBASIC::ClearAllModuleVars( void )
@ -1341,7 +1394,7 @@ void StarBASIC::ClearAllModuleVars( void )
{ {
SbModule* pModule = (SbModule*)pModules->Get( nMod ); SbModule* pModule = (SbModule*)pModules->Get( nMod );
// Nur initialisieren, wenn der Startcode schon ausgefuehrt wurde // 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(); pModule->ClearPrivateVars();
} }
@ -1739,6 +1792,98 @@ BOOL SbModule::LoadCompleted()
return TRUE; 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) // Implementation SbJScriptModule (Basic-Modul fuer JavaScript-Sourcen)
SbJScriptModule::SbJScriptModule( const String& rName ) 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() ) else if ( mInfo.ModuleObject.is() )
SetUnoObject( uno::makeAny( mInfo.ModuleObject ) ); SetUnoObject( uno::makeAny( mInfo.ModuleObject ) );
} }
SbObjModule::~SbObjModule()
{
}
void void
SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException ) SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException )
{ {
@ -2005,6 +2155,13 @@ SbObjModule::Find( const XubString& rName, SbxClassType t )
return pVar; 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; typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
class FormObjEventListenerImpl : public 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(); triggerTerminateEvent();
} }
@ -2379,11 +2536,12 @@ void SbUserFormModule::Unload()
} }
//liuchen //liuchen
void registerComponentToBeDisposedForBasic( Reference< XComponent > xComponent, StarBASIC* pBasic );
void SbUserFormModule::InitObject() void SbUserFormModule::InitObject()
{ {
try try
{ {
String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) ); String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE ); SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs ) if ( m_xModel.is() && pGlobs )
@ -2410,6 +2568,25 @@ void SbUserFormModule::InitObject()
aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() ); aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
pDocObject = new SbUnoObject( GetName(), uno::makeAny( xVBAFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.msforms.UserForm")), aArgs ) ) ); 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 ); 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 // remove old listener if it exists
if ( m_DialogListener.get() ) if ( m_DialogListener.get() )
m_DialogListener->removeListener(); m_DialogListener->removeListener();

View File

@ -375,6 +375,9 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
if( pDef->IsWithEvents() ) if( pDef->IsWithEvents() )
nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG; nOpnd2 |= SBX_TYPE_WITH_EVENTS_FLAG;
if( bCompatible && pDef->IsNew() )
nOpnd2 |= SBX_TYPE_DIM_AS_NEW_FLAG;
short nFixedStringLength = pDef->GetFixedStringLength(); short nFixedStringLength = pDef->GetFixedStringLength();
if( nFixedStringLength >= 0 ) if( nFixedStringLength >= 0 )
nOpnd2 |= (SBX_FIXED_LEN_STRING_FLAG + (UINT32(nFixedStringLength) << 17)); // len = all bits above 0x10000 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: case MINUS:
eTok = NEG; eTok = NEG;
case NOT:
pParser->Next(); pParser->Next();
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL ); pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
break; break;
case NOT:
if( pParser->IsVBASupportOn() )
{
pNd = Operand();
}
else
{
pParser->Next();
pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
}
break;
case PLUS: case PLUS:
pParser->Next(); pParser->Next();
pNd = Unary(); pNd = Unary();
@ -725,9 +735,26 @@ SbiExprNode* SbiExpression::Comp()
return pNd; 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* SbiExpression::Like()
{ {
SbiExprNode* pNd = Comp(); SbiExprNode* pNd = pParser->IsVBASupportOn() ? VBA_Not() : Comp();
if( m_eMode != EXPRMODE_EMPTY_PAREN ) if( m_eMode != EXPRMODE_EMPTY_PAREN )
{ {
short nCount = 0; short nCount = 0;

View File

@ -32,6 +32,7 @@
#include "sbcomp.hxx" #include "sbcomp.hxx"
#include "image.hxx" #include "image.hxx"
#include "sbtrace.hxx" #include "sbtrace.hxx"
#include <basic/sbobjmod.hxx>
//========================================================================== //==========================================================================
@ -42,11 +43,145 @@
#include <hash_map> #include <hash_map>
// Trace Settings // Trace ini file (set NULL to ignore)
static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt"; static char GpTraceIniFile[] = "d:\\zBasic.Asm\\BasicTrace.ini";
static const bool GbIncludePCodes = false; //static char* GpTraceIniFile = NULL;
static const int GnIndentPerCallLevel = 4;
static const int GnIndentForPCode = 2;
// 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 struct TraceTextData
{ {
@ -122,7 +257,7 @@ static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
return aORetStr; return aORetStr;
} }
String dumpMethodParameters( SbMethod* pMethod ) String lcl_dumpMethodParameters( SbMethod* pMethod )
{ {
String aStr; String aStr;
if( pMethod == NULL ) if( pMethod == NULL )
@ -149,9 +284,10 @@ String dumpMethodParameters( SbMethod* pMethod )
aStr += pParam->aName; aStr += pParam->aName;
} }
aStr += '='; aStr += '=';
if( pVar->GetType() & SbxARRAY ) SbxDataType eType = pVar->GetType();
if( eType & SbxARRAY )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) ); aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
else else if( eType != SbxOBJECT )
aStr += pVar->GetString(); aStr += pVar->GetString();
if ( nParam < ( pParams->Count() - 1 ) ) if ( nParam < ( pParams->Count() - 1 ) )
aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) ); aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
@ -166,16 +302,36 @@ String dumpMethodParameters( SbMethod* pMethod )
return aStr; return aStr;
} }
// Public functions // Public functions
static bool GbSavTraceOn = false;
void dbg_InitTrace( void ) void dbg_InitTrace( void )
{ {
if( GpTraceIniFile != NULL )
lcl_ReadIniFile( GpTraceIniFile );
FILE* pFile = fopen( GpTraceFileName, "w" ); FILE* pFile = fopen( GpTraceFileName, "w" );
if( pFile != NULL ) if( pFile != NULL )
fclose( pFile ); 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 ) void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
{ {
if( !GbTraceOn )
return;
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule; SbModule* pTraceMod = pModule;
if( pTraceMod->ISA(SbClassModuleObject) ) 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(); const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
char Buffer[200]; 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 ); lcl_lineOut( GpTraceFileName, Buffer );
return; return;
} }
//nCallLvl--;
//if( nCallLvl < 0 )
// nCallLvl = 0;
int nIndent = nCallLvl * GnIndentPerCallLevel; int nIndent = nCallLvl * GnIndentPerCallLevel;
const TraceTextData& rTraceTextData = itInner->second; const TraceTextData& rTraceTextData = itInner->second;
@ -234,6 +387,10 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
{ {
static const char* pSeparator = "' ================================================================================"; static const char* pSeparator = "' ================================================================================";
if( !GbTraceOn )
return;
GnLastCallLvl = nCallLvl;
SbModule* pTraceMod = pModule; SbModule* pTraceMod = pModule;
SbClassModuleObject* pClassModuleObj = NULL; SbClassModuleObject* pClassModuleObj = NULL;
if( pTraceMod->ISA(SbClassModuleObject) ) if( pTraceMod->ISA(SbClassModuleObject) )
@ -281,7 +438,7 @@ void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl,
aStr.AppendAscii( "]" ); aStr.AppendAscii( "]" );
} }
if( !bLeave ) if( !bLeave )
aStr += dumpMethodParameters( pMethod ); aStr += lcl_dumpMethodParameters( pMethod );
lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) ); lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
if( !bLeave ) 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 ) 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 ); rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
char Buffer[200]; char Buffer[200];
@ -329,6 +490,63 @@ void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
(*pInnerMap)[nPC] = aData; (*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 #endif
@ -431,7 +649,8 @@ BOOL SbModule::Compile()
BOOL bRet = IsCompiled(); BOOL bRet = IsCompiled();
if( bRet ) if( bRet )
{ {
pBasic->ClearAllModuleVars(); if( !this->ISA(SbObjModule) )
pBasic->ClearAllModuleVars();
RemoveVars(); // remove 'this' Modules variables RemoveVars(); // remove 'this' Modules variables
// clear all method statics // clear all method statics
for( USHORT i = 0; i < pMethods->Count(); i++ ) for( USHORT i = 0; i < pMethods->Count(); i++ )

View File

@ -224,6 +224,30 @@ BOOL SbiScanner::NextSym()
for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ ) for ( ; (BasicSimpleCharClass::isAlphaNumeric( *pLine, bCompatible ) || ( *pLine == '_' ) ); pLine++ )
nCol++; nCol++;
aSym = aLine.copy( n, nCol - n ); 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 // Abschliessendes '_' durch Space ersetzen, wenn Zeilenende folgt
// (sonst falsche Zeilenfortsetzung) // (sonst falsche Zeilenfortsetzung)
if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' ) if( !bUsedForHilite && !*pLine && *(pLine-1) == '_' )

View File

@ -206,9 +206,10 @@ void SbiSymPool::Add( SbiSymDef* pDef )
SbiSymDef* SbiSymPool::Find( const String& rName ) const 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 ) ) if( ( !p->nProcId || ( p->nProcId == nProcId ) )
&& ( p->aName.EqualsIgnoreCaseAscii( rName ) ) ) && ( p->aName.EqualsIgnoreCaseAscii( rName ) ) )
return p; return p;

View File

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

View File

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

View File

@ -28,15 +28,17 @@
#ifndef _SBTRACE_HXX #ifndef _SBTRACE_HXX
#define _SBTRACE_HXX #define _SBTRACE_HXX
// #define DBG_TRACE_BASIC //#define DBG_TRACE_BASIC
#ifdef DBG_TRACE_BASIC #ifdef DBG_TRACE_BASIC
void dbg_InitTrace( void ); void dbg_InitTrace( void );
void dbg_DeInitTrace( void );
void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl ); void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false ); 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_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC, void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
const String& aTraceStr_STMNT, const String& aTraceStr_PCode ); const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
void RTL_Impl_TraceCommand( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
#endif #endif
#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 > mxExactName;
::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation; ::com::sun::star::uno::Reference< ::com::sun::star::beans::XExactName > mxExactNameInvocation;
BOOL bNeedIntrospection; BOOL bNeedIntrospection;
BOOL bIgnoreNativeCOMObjectMembers; BOOL bNativeCOMObject;
::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection! ::com::sun::star::uno::Any maTmpUnoObj; // Only to save obj for doIntrospection!
// Hilfs-Methode zum Anlegen der dbg_-Properties // 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; } ::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& ); void SFX_NOTIFY( SfxBroadcaster&, const TypeId&, const SfxHint& rHint, const TypeId& );
bool isNativeCOMObject( void )
{ return bNativeCOMObject; }
}; };
SV_DECL_IMPL_REF(SbUnoObject); SV_DECL_IMPL_REF(SbUnoObject);
// #67781 Rueckgabewerte der Uno-Methoden loeschen // #67781 Rueckgabewerte der Uno-Methoden loeschen
void clearUnoMethods( void ); void clearUnoMethods( void );
void clearUnoMethodsForBasic( StarBASIC* pBasic );
class SbUnoMethod : public SbxMethod class SbUnoMethod : public SbxMethod
{ {
friend class SbUnoObject; friend class SbUnoObject;
friend void clearUnoMethods( void ); 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::Reference< ::com::sun::star::reflection::XIdlMethod > m_xUnoMethod;
::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq; ::com::sun::star::uno::Sequence< ::com::sun::star::reflection::ParamInfo >* pParamInfoSeq;
@ -103,13 +108,15 @@ class SbUnoMethod : public SbxMethod
SbUnoMethod* pPrev; SbUnoMethod* pPrev;
SbUnoMethod* pNext; SbUnoMethod* pNext;
bool mbInvocation; // Method is based on invocation bool mbInvocation; // Method is based on invocation
bool mbDirectInvocation; // Method should be used with XDirectInvocation interface
public: public:
TYPEINFO(); TYPEINFO();
SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_, 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 ~SbUnoMethod();
virtual SbxInfo* GetInfo(); virtual SbxInfo* GetInfo();
@ -117,6 +124,8 @@ public:
bool isInvocationBased( void ) bool isInvocationBased( void )
{ return mbInvocation; } { 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_EqualUnoObjects( StarBASIC* pBasic, SbxArray& rPar, BOOL bWrite );
void RTL_Impl_GetDefaultContext( 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 // #118116 Collection object

View File

@ -43,6 +43,7 @@ namespace basic
class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword class SfxScriptLibraryContainer : public SfxLibraryContainer, public OldBasicPassword
{ {
::rtl::OUString maScriptLanguage; ::rtl::OUString maScriptLanguage;
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > mxCodeNameAccess;
// Methods to distinguish between deffirent library types // Methods to distinguish between deffirent library types
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ); 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= \ SLOFILES= \
$(SLO)$/basrdll.obj \ $(SLO)$/basrdll.obj \
$(SLO)$/comenumwrapper.obj \
$(SLO)$/inputbox.obj \ $(SLO)$/inputbox.obj \
$(SLO)$/runtime.obj \ $(SLO)$/runtime.obj \
$(SLO)$/step0.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; 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 RTLFUNC(CBool) // JSM
{ {
@ -527,6 +647,7 @@ RTLFUNC(DoEvents)
//aTimer.Start(); //aTimer.Start();
//while ( aTimer.IsActive() ) //while ( aTimer.IsActive() )
// Application::Reschedule(); // Application::Reschedule();
Application::Reschedule( true );
} }
RTLFUNC(GetGUIVersion) RTLFUNC(GetGUIVersion)
@ -1513,6 +1634,12 @@ RTLFUNC(GetDefaultContext)
RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite ); RTL_Impl_GetDefaultContext( pBasic, rPar, bWrite );
} }
#ifdef DBG_TRACE_BASIC
RTLFUNC(TraceCommand)
{
RTL_Impl_TraceCommand( pBasic, rPar, bWrite );
}
#endif
RTLFUNC(Join) RTLFUNC(Join)
{ {

View File

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

View File

@ -45,6 +45,7 @@
#include "sbunoobj.hxx" #include "sbunoobj.hxx"
#include "errobject.hxx" #include "errobject.hxx"
#include "sbtrace.hxx" #include "sbtrace.hxx"
#include "comenumwrapper.hxx"
using namespace ::com::sun::star; using namespace ::com::sun::star;
@ -890,11 +891,12 @@ void SbiRuntime::Error( SbError _errCode, const String& _details )
{ {
if ( _errCode ) 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 ) if ( pInst->pRun == this )
{ {
pInst->Error( _errCode, _details ); 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 else
{ {
@ -1176,6 +1178,23 @@ void SbiRuntime::PushForEach()
p->xEnumeration = xEnumerationAccess->createEnumeration(); p->xEnumeration = xEnumerationAccess->createEnumeration();
p->eForType = FOR_EACH_XENUMERATION; 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 else
{ {
bError_ = true; bError_ = true;

View File

@ -94,6 +94,10 @@ static Methods aMethods[] = {
{ "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 }, { "Blue", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Blue),0 },
{ "RGB-Value", SbxLONG, 0,NULL,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 }, { "CBool", SbxBOOL, 1 | _FUNCTION, RTLNAME(CBool),0 },
{ "expression", SbxVARIANT, 0,NULL,0 }, { "expression", SbxVARIANT, 0,NULL,0 },
{ "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 }, { "CByte", SbxBYTE, 1 | _FUNCTION, RTLNAME(CByte),0 },
@ -531,6 +535,10 @@ static Methods aMethods[] = {
{ "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 }, { "TimeValue", SbxDATE, 1 | _FUNCTION, RTLNAME(TimeValue),0 },
{ "String", SbxSTRING, 0,NULL,0 }, { "String", SbxSTRING, 0,NULL,0 },
{ "TOGGLE", SbxINTEGER, _CPROP, RTLNAME(TOGGLE),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 }, { "Trim", SbxSTRING, 1 | _FUNCTION, RTLNAME(Trim),0 },
{ "String", SbxSTRING, 0,NULL,0 }, { "String", SbxSTRING, 0,NULL,0 },
{ "True", SbxBOOL, _CPROP, RTLNAME(True),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 ); const ::rtl::OUString& aPrefix, SbxObjectRef xScopeObj );
#include <algorithm> #include <algorithm>
#include <hash_map>
SbxVariable* getDefaultProp( SbxVariable* pRef ); 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 // Speichern Objektvariable
// Nicht-Objekt-Variable fuehren zu Fehlern // Nicht-Objekt-Variable fuehren zu Fehlern
static const char pCollectionStr[] = "Collection";
void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp ) void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, bool bHandleDefaultProp )
{ {
// #67733 Typen mit Array-Flag sind auch ok // #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 // Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS ); BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents ) if ( bWithEvents )
@ -541,7 +592,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj ); xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
refVal->SetDeclareClassName( aDeclareClassName ); refVal->SetDeclareClassName( aDeclareClassName );
refVal->SetComListener( xComListener ); // Hold reference refVal->SetComListener( xComListener, &rBasic ); // Hold reference
} }
*refVar = *refVal; *refVar = *refVal;
@ -551,6 +602,68 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
*refVar = *refVal; *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) // 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 // 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 // default property may infact be void so the type will also be SbxEMPTY

View File

@ -143,15 +143,19 @@ SbxVariable* SbiRuntime::FindElement
else else
pElem = getVBAConstant( aName ); pElem = getVBAConstant( aName );
} }
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
// Modulen IMMER ein Ergebnis! if( !pElem )
SbUnoClass* pUnoClass = findUnoClass( aName );
if( pUnoClass )
{ {
pElem = new SbxVariable( t ); // #72382 VORSICHT! Liefert jetzt wegen unbekannten
SbxValues aRes( SbxOBJECT ); // Modulen IMMER ein Ergebnis!
aRes.pObj = pUnoClass; SbUnoClass* pUnoClass = findUnoClass( aName );
pElem->SbxVariable::Put( aRes ); if( pUnoClass )
{
pElem = new SbxVariable( t );
SbxValues aRes( SbxOBJECT );
aRes.pObj = pUnoClass;
pElem->SbxVariable::Put( aRes );
}
} }
// #62939 Wenn eine Uno-Klasse gefunden wurde, muss // #62939 Wenn eine Uno-Klasse gefunden wurde, muss
@ -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_ ) if( bError_ )
Error( SbERR_NO_NAMED_ARGS ); Error( SbERR_NO_NAMED_ARGS );
} }
@ -489,7 +521,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pPar->Put( NULL, 0 ); pPar->Put( NULL, 0 );
} }
// Index-Access bei UnoObjekten beruecksichtigen // 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(); pPar = pElem->GetParameters();
if ( pPar ) if ( pPar )
@ -589,6 +621,12 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pCol->CollItem( pPar ); 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 ); PushVar( pNew );
} }
void SbiRuntime::implCreateFixedString( SbxVariable* pStrVar, UINT32 nOp2 ) void SbiRuntime::implHandleSbxFlags( SbxVariable* pVar, SbxDataType t, UINT32 nOp2 )
{ {
USHORT nCount = static_cast<USHORT>( nOp2 >> 17 ); // len = all bits above 0x10000 bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0);
String aStr; if( bWithEvents )
aStr.Fill( nCount, 0 ); pVar->SetFlag( SBX_WITH_EVENTS );
pStrVar->PutString( aStr );
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 );
pVar->PutString( aStr );
}
} }
// Einrichten einer lokalen Variablen (+StringID+Typ) // Einrichten einer lokalen Variablen (+StringID+Typ)
@ -1105,12 +1155,7 @@ void SbiRuntime::StepLOCAL( UINT32 nOp1, UINT32 nOp2 )
SbxDataType t = (SbxDataType)(nOp2 & 0xffff); SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
SbxVariable* p = new SbxVariable( t ); SbxVariable* p = new SbxVariable( t );
p->SetName( aName ); p->SetName( aName );
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); implHandleSbxFlags( p, t, nOp2 );
if( bWithEvents )
p->SetFlag( SBX_WITH_EVENTS );
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
if( bFixedString )
implCreateFixedString( p, nOp2 );
refLocals->Put( p, refLocals->Count() ); 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' // AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
pProp->SetFlag( SBX_NO_MODIFY); pProp->SetFlag( SBX_NO_MODIFY);
bool bWithEvents = ((t & 0xff) == SbxOBJECT && (nOp2 & SBX_TYPE_WITH_EVENTS_FLAG) != 0); implHandleSbxFlags( pProp, t, nOp2 );
if( bWithEvents )
pProp->SetFlag( SBX_WITH_EVENTS );
bool bFixedString = ((t & 0xff) == SbxSTRING && (nOp2 & SBX_FIXED_LEN_STRING_FLAG) != 0);
if( bFixedString )
implCreateFixedString( p, nOp2 );
} }
} }

View File

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

View File

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

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

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

View File

@ -59,13 +59,17 @@ class SbxVariableImpl
friend class SbxVariable; friend class SbxVariable;
String m_aDeclareClassName; String m_aDeclareClassName;
Reference< XInterface > m_xComListener; Reference< XInterface > m_xComListener;
StarBASIC* m_pComListenerParentBasic;
SbxVariableImpl( void ) SbxVariableImpl( void )
: m_pComListenerParentBasic( NULL )
{} {}
SbxVariableImpl( const SbxVariableImpl& r ) SbxVariableImpl( const SbxVariableImpl& r )
: m_aDeclareClassName( r.m_aDeclareClassName ) : m_aDeclareClassName( r.m_aDeclareClassName )
, m_xComListener( r.m_xComListener ) , m_xComListener( r.m_xComListener )
{} , m_pComListenerParentBasic( r.m_pComListenerParentBasic )
{
}
}; };
@ -84,12 +88,18 @@ SbxVariable::SbxVariable() : SbxValue()
#endif #endif
} }
void registerComListenerVariableForBasic( SbxVariable* pVar, StarBASIC* pBasic );
SbxVariable::SbxVariable( const SbxVariable& r ) SbxVariable::SbxVariable( const SbxVariable& r )
: SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo ) : SvRefBase( r ), SbxValue( r ), mpPar( r.mpPar ), pInfo( r.pInfo )
{ {
mpSbxVariableImpl = NULL; mpSbxVariableImpl = NULL;
if( r.mpSbxVariableImpl != NULL ) if( r.mpSbxVariableImpl != NULL )
{
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
if( mpSbxVariableImpl->m_xComListener.is() )
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
}
pCst = NULL; pCst = NULL;
if( r.CanRead() ) if( r.CanRead() )
{ {
@ -126,6 +136,8 @@ SbxVariable::SbxVariable( SbxDataType t, void* p ) : SbxValue( t, p )
#endif #endif
} }
void removeDimAsNewRecoverItem( SbxVariable* pVar );
SbxVariable::~SbxVariable() SbxVariable::~SbxVariable()
{ {
#ifdef DBG_UTIL #ifdef DBG_UTIL
@ -136,6 +148,8 @@ SbxVariable::~SbxVariable()
maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 ); maName.AssignAscii( aCellsStr, sizeof( aCellsStr )-1 );
GetSbxData_Impl()->aVars.Remove( this ); GetSbxData_Impl()->aVars.Remove( this );
#endif #endif
if( IsSet( SBX_DIM_AS_NEW ))
removeDimAsNewRecoverItem( this );
delete mpSbxVariableImpl; delete mpSbxVariableImpl;
delete pCst; delete pCst;
} }
@ -315,7 +329,11 @@ SbxVariable& SbxVariable::operator=( const SbxVariable& r )
SbxValue::operator=( r ); SbxValue::operator=( r );
delete mpSbxVariableImpl; delete mpSbxVariableImpl;
if( r.mpSbxVariableImpl != NULL ) if( r.mpSbxVariableImpl != NULL )
{
mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl ); mpSbxVariableImpl = new SbxVariableImpl( *r.mpSbxVariableImpl );
if( mpSbxVariableImpl->m_xComListener.is() )
registerComListenerVariableForBasic( this, mpSbxVariableImpl->m_pComListenerParentBasic );
}
else else
mpSbxVariableImpl = NULL; mpSbxVariableImpl = NULL;
return *this; return *this;
@ -396,10 +414,19 @@ void SbxVariable::SetDeclareClassName( const String& rDeclareClassName )
pImpl->m_aDeclareClassName = 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(); SbxVariableImpl* pImpl = getImpl();
pImpl->m_xComListener = xComListener; 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 // MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_basic.hxx" #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> #include <com/sun/star/script/ModuleSizeExceededRequest.hpp>
using namespace com::sun::star; using namespace com::sun::star;
@ -44,8 +44,8 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
m_aRequest <<= aReq; m_aRequest <<= aReq;
m_xAbort.set( uno::Reference< task::XInteractionAbort >(new framework::ContinuationAbort), uno::UNO_QUERY ); m_xAbort.set( uno::Reference< task::XInteractionAbort >(new comphelper::OInteractionAbort), uno::UNO_QUERY );
m_xApprove.set( uno::Reference< task::XInteractionApprove >(new framework::ContinuationApprove ), uno::UNO_QUERY ); m_xApprove.set( uno::Reference< task::XInteractionApprove >(new comphelper::OInteractionApprove ), uno::UNO_QUERY );
m_lContinuations.realloc( 2 ); m_lContinuations.realloc( 2 );
m_lContinuations[0] = m_xApprove; m_lContinuations[0] = m_xApprove;
m_lContinuations[1] = m_xAbort; m_lContinuations[1] = m_xAbort;
@ -54,15 +54,15 @@ ModuleSizeExceeded::ModuleSizeExceeded( const uno::Sequence< ::rtl::OUString >&
sal_Bool sal_Bool
ModuleSizeExceeded::isAbort() const ModuleSizeExceeded::isAbort() const
{ {
framework::ContinuationAbort* pBase = static_cast< framework::ContinuationAbort* >( m_xAbort.get() ); comphelper::OInteractionAbort* pBase = static_cast< comphelper::OInteractionAbort* >( m_xAbort.get() );
return pBase->isSelected(); return pBase->wasSelected();
} }
sal_Bool sal_Bool
ModuleSizeExceeded::isApprove() const ModuleSizeExceeded::isApprove() const
{ {
framework::ContinuationApprove* pBase = static_cast< framework::ContinuationApprove* >( m_xApprove.get() ); comphelper::OInteractionApprove* pBase = static_cast< comphelper::OInteractionApprove* >( m_xApprove.get() );
return pBase->isSelected(); 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) void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
{ {
BasicManager* pBasMgr = getBasicManager(); /* The member variable mbVBACompat must be set first, the following call
if( pBasMgr ) to getBasicManager() may call getVBACompatibilityMode() which returns
this value. */
mbVBACompat = _vbacompatmodeon;
if( BasicManager* pBasMgr = getBasicManager() )
{ {
// get the standard library // get the standard library
String aLibName( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) ); String aLibName = pBasMgr->GetName();
if ( pBasMgr->GetName().Len() ) if ( aLibName.Len() == 0 )
aLibName = pBasMgr->GetName(); aLibName = String( RTL_CONSTASCII_USTRINGPARAM( "Standard" ) );
StarBASIC* pBasic = pBasMgr->GetLib( aLibName ); if( StarBASIC* pBasic = pBasMgr->GetLib( aLibName ) )
if( pBasic )
pBasic->SetVBAEnabled( _vbacompatmodeon ); 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 // Methods XServiceInfo

View File

@ -62,7 +62,7 @@
#include <basic/basmgr.hxx> #include <basic/basmgr.hxx>
#include <basic/sbmod.hxx> #include <basic/sbmod.hxx>
#include <basic/basicmanagerrepository.hxx> #include <basic/basicmanagerrepository.hxx>
#include "modsizeexceeded.hxx" #include "basic/modsizeexceeded.hxx"
#include <xmlscript/xmlmod_imexp.hxx> #include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <com/sun/star/util/VetoException.hpp> #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::xml::sax;
using namespace com::sun::star; using namespace com::sun::star;
using namespace cppu; using namespace cppu;
using namespace rtl;
using namespace osl; using namespace osl;
using com::sun::star::uno::Reference; using ::rtl::OUString;
//============================================================================ //============================================================================
// Implementation class SfxScriptLibraryContainer // Implementation class SfxScriptLibraryContainer
@ -311,24 +310,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
// aMod.aName ignored // aMod.aName ignored
if( aMod.aModuleType.getLength() > 0 ) 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
{
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& )
{ {
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 );
}
pBasicMgr = BasicManagerRepository::getApplicationBasicManager( sal_False );
if( pBasicMgr )
pBasicMgr->SetGlobalUNOConstant( "ThisExcelDoc", aArgs[0] );
} }
script::ModuleInfo aModInfo; script::ModuleInfo aModInfo;
@ -353,25 +349,21 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
RTL_CONSTASCII_STRINGPARAM("document") )) RTL_CONSTASCII_STRINGPARAM("document") ))
{ {
aModInfo.ModuleType = ModuleType::DOCUMENT; aModInfo.ModuleType = ModuleType::DOCUMENT;
Reference<frame::XModel > xModel( mxOwnerDocument );
Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY); // #163691# use the same codename access instance for all document modules
Reference< container::XNameAccess > xVBACodeNameAccess; if( !mxCodeNameAccess.is() ) try
if( xSF.is() )
{ {
try Reference<frame::XModel > xModel( mxOwnerDocument );
{ Reference< XMultiServiceFactory> xSF( xModel, UNO_QUERY_THROW );
xVBACodeNameAccess.set( xSF->createInstance( mxCodeNameAccess.set( xSF->createInstance( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAObjectModuleObjectProvider" ) ) ), UNO_QUERY );
rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
"ooo.vba.VBAObjectModuleObjectProvider"))),
UNO_QUERY );
}
catch(uno::Exception&) {}
} }
if( xVBACodeNameAccess.is() ) catch( Exception& ) {}
if( mxCodeNameAccess.is() )
{ {
try try
{ {
aModInfo.ModuleObject.set( xVBACodeNameAccess->getByName( aElementName), uno::UNO_QUERY ); aModInfo.ModuleObject.set( mxCodeNameAccess->getByName( aElementName), uno::UNO_QUERY );
} }
catch(uno::Exception&) 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\inc nmake - all cg_inc NULL
cg configmgr\source nmake - all cg_source cg_inc NULL cg configmgr\source nmake - all cg_source cg_inc NULL
cg configmgr\qa\unoapi nmake - all cg_qa_unoapi 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_ASSERT(thisIs(IS_ANY));
osl::MutexGuard g(lock); osl::MutexGuard g(lock);
checkLocalizedPropertyAccess(); checkLocalizedPropertyAccess();
throw css::uno::RuntimeException( return rtl::OUString(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("org.openoffice-configmgr::Access"));
RTL_CONSTASCII_USTRINGPARAM(
"configmgr Access has no service implementation name")),
static_cast< cppu::OWeakObject * >(this));
} }
sal_Bool Access::supportsService(rtl::OUString const & ServiceName) sal_Bool Access::supportsService(rtl::OUString const & ServiceName)
@ -2092,7 +2089,8 @@ css::beans::Property Access::asProperty() {
default: default:
type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct? type = cppu::UnoType< css::uno::XInterface >::get(); //TODO: correct?
nillable = false; nillable = false;
removable = getParentNode()->kind() == Node::KIND_SET; rtl::Reference< Node > parent(getParentNode());
removable = parent.is() && parent->kind() == Node::KIND_SET;
break; break;
} }
return css::beans::Property( return css::beans::Property(

View File

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

View File

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

View File

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

View File

@ -55,7 +55,7 @@
#include "cppu/unotype.hxx" #include "cppu/unotype.hxx"
#include "cppuhelper/compbase5.hxx" #include "cppuhelper/compbase5.hxx"
#include "cppuhelper/factory.hxx" #include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase2.hxx"
#include "cppuhelper/interfacecontainer.hxx" #include "cppuhelper/interfacecontainer.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h" #include "osl/diagnose.h"
@ -127,7 +127,6 @@ private:
virtual css::uno::Sequence< rtl::OUString > SAL_CALL virtual css::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames() throw (css::uno::RuntimeException) getSupportedServiceNames() throw (css::uno::RuntimeException)
{ return configuration_provider::getSupportedServiceNames(); } { return configuration_provider::getSupportedServiceNames(); }
//TODO: DefaultProvider?
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance(
rtl::OUString const & aServiceSpecifier) rtl::OUString const & aServiceSpecifier)
@ -276,8 +275,7 @@ Service::createInstanceWithArguments(
static_cast< cppu::OWeakObject * >(this)); static_cast< cppu::OWeakObject * >(this));
} }
osl::MutexGuard guard(lock); osl::MutexGuard guard(lock);
Components::initSingleton(context_); Components & components = Components::getSingleton(context_);
Components & components = Components::getSingleton();
rtl::Reference< RootAccess > root( rtl::Reference< RootAccess > root(
new RootAccess(components, nodepath, locale, update)); new RootAccess(components, nodepath, locale, update));
if (root->isValue()) { if (root->isValue()) {
@ -388,14 +386,14 @@ void Service::flushModifications() const {
Components * components; Components * components;
{ {
osl::MutexGuard guard(lock); osl::MutexGuard guard(lock);
Components::initSingleton(context_); components = &Components::getSingleton(context_);
components = &Components::getSingleton();
} }
components->flushModifications(); components->flushModifications();
} }
class Factory: class Factory:
public cppu::WeakImplHelper1< css::lang::XSingleComponentFactory >, public cppu::WeakImplHelper2<
css::lang::XSingleComponentFactory, css::lang::XServiceInfo >,
private boost::noncopyable private boost::noncopyable
{ {
public: public:
@ -414,6 +412,18 @@ private:
css::uno::Sequence< css::uno::Any > const & Arguments, css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context) css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException); 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( 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/XMultiComponentFactory.hpp"
#include "com/sun/star/lang/XMultiServiceFactory.hpp" #include "com/sun/star/lang/XMultiServiceFactory.hpp"
#include "com/sun/star/lang/XServiceInfo.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/InvalidRegistryException.hpp"
#include "com/sun/star/registry/InvalidValueException.hpp" #include "com/sun/star/registry/InvalidValueException.hpp"
#include "com/sun/star/registry/MergeConflictException.hpp" #include "com/sun/star/registry/MergeConflictException.hpp"
@ -56,13 +55,11 @@
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "com/sun/star/util/XFlushable.hpp" #include "com/sun/star/util/XFlushable.hpp"
#include "cppu/unotype.hxx" #include "cppu/unotype.hxx"
#include "cppuhelper/factory.hxx"
#include "cppuhelper/implbase1.hxx" #include "cppuhelper/implbase1.hxx"
#include "cppuhelper/implbase3.hxx" #include "cppuhelper/implbase3.hxx"
#include "cppuhelper/weak.hxx" #include "cppuhelper/weak.hxx"
#include "osl/diagnose.h" #include "osl/diagnose.h"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
#include "rtl/unload.h"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "sal/types.h" #include "sal/types.h"
@ -877,53 +874,12 @@ rtl::OUString RegistryKey::getResolvedName(rtl::OUString const & aKeyName)
return 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 > css::uno::Reference< css::uno::XInterface > create(
Factory::createInstanceWithArgumentsAndContext( css::uno::Reference< css::uno::XComponentContext > const & context)
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{ {
if (Arguments.getLength() != 0) { return static_cast< cppu::OWeakObject * >(new Service(context));
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));
}
} }
rtl::OUString getImplementationName() { rtl::OUString getImplementationName() {
@ -939,12 +895,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
return css::uno::Sequence< rtl::OUString >(&name, 1); 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/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
#include "sal/types.h" #include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang { namespace com { namespace sun { namespace star {
class XSingleComponentFactory; namespace uno {
} } } } class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; } namespace rtl { class OUString; }
namespace configmgr { namespace configuration_registry { 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(); rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames(); 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 #endif

View File

@ -28,24 +28,16 @@
#include "precompiled_configmgr.hxx" #include "precompiled_configmgr.hxx"
#include "sal/config.h" #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/Reference.hxx"
#include "com/sun/star/uno/RuntimeException.hpp"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "com/sun/star/uno/XComponentContext.hpp" #include "com/sun/star/uno/XComponentContext.hpp"
#include "com/sun/star/uno/XInterface.hpp" #include "com/sun/star/uno/XInterface.hpp"
#include "cppuhelper/factory.hxx" #include "osl/mutex.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/weak.hxx"
#include "sal/types.h"
#include "rtl/unload.h"
#include "rtl/ustring.h" #include "rtl/ustring.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "configurationprovider.hxx" #include "configurationprovider.hxx"
#include "defaultprovider.hxx"
#include "lock.hxx" #include "lock.hxx"
namespace configmgr { namespace default_provider { namespace configmgr { namespace default_provider {
@ -54,58 +46,17 @@ namespace {
namespace css = com::sun::star; 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 > css::uno::Reference< css::uno::XInterface > create(
Factory::createInstanceWithArgumentsAndContext( css::uno::Reference< css::uno::XComponentContext > const & context)
css::uno::Sequence< css::uno::Any > const & Arguments,
css::uno::Reference< css::uno::XComponentContext > const & Context)
throw (css::uno::Exception, css::uno::RuntimeException)
{ {
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); osl::MutexGuard guard(lock);
static css::uno::Reference< css::uno::XInterface > singleton( static css::uno::Reference< css::uno::XInterface > singleton(
configuration_provider::createDefault(Context)); configuration_provider::createDefault(context));
return singleton; return singleton;
} }
}
rtl::OUString getImplementationName() { rtl::OUString getImplementationName() {
return rtl::OUString( return rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( RTL_CONSTASCII_USTRINGPARAM(
@ -119,13 +70,4 @@ css::uno::Sequence< rtl::OUString > getSupportedServiceNames() {
return css::uno::Sequence< rtl::OUString >(&name, 1); 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/Reference.hxx"
#include "com/sun/star/uno/Sequence.hxx" #include "com/sun/star/uno/Sequence.hxx"
#include "cppuhelper/factory.hxx"
#include "rtl/unload.h"
#include "sal/types.h" #include "sal/types.h"
namespace com { namespace sun { namespace star { namespace lang { namespace com { namespace sun { namespace star {
class XSingleComponentFactory; namespace uno {
} } } } class XComponentContext;
class XInterface;
}
} } }
namespace rtl { class OUString; } namespace rtl { class OUString; }
namespace configmgr { namespace default_provider { 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(); rtl::OUString SAL_CALL getImplementationName();
com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL
getSupportedServiceNames(); 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 #endif

View File

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

View File

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

View File

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

View File

@ -33,7 +33,8 @@
#include <com/sun/star/sdb/XSQLQueryComposer.hpp> #include <com/sun/star/sdb/XSQLQueryComposer.hpp>
#include <com/sun/star/sdbc/XConnection.hpp> #include <com/sun/star/sdbc/XConnection.hpp>
/** === end UNO includes === **/ /** === end UNO includes === **/
#include <rtl/ustring.hxx>
#include <rtl/ustrbuf.hxx>
#include <vector> #include <vector>
#include "connectivity/dbtoolsdllapi.hxx" #include "connectivity/dbtoolsdllapi.hxx"
@ -111,10 +112,10 @@ namespace dbtools
/** appends one filter component to the statement in our composer /** 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 /// 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 /// returns the index of the first filter component which should be considered when building the composed filter
inline sal_Int32 getFirstApplicableFilterIndex() const inline sal_Int32 getFirstApplicableFilterIndex() const

View File

@ -231,6 +231,7 @@ namespace connectivity
character_string_type, character_string_type,
other_like_predicate_part_2, other_like_predicate_part_2,
between_predicate_part_2, between_predicate_part_2,
cast_spec,
rule_count, // letzter_wert rule_count, // letzter_wert
UNKNOWN_RULE // ID indicating that a node is no rule with a matching Rule-enum value (see getKnownRuleID) 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 usr1 - all cn_mkout NULL
cn connectivity\inc nmake - all cn_inc 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 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%\bin\*.res %_DEST%\bin%_EXT%\*.res
..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so ..\%__SRC%\lib\lib*.so %_DEST%\lib%_EXT%\lib*.so
..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib ..\%__SRC%\lib\*.dylib %_DEST%\lib%_EXT%\*.dylib
..\%__SRC%\lib\*.jnilib %_DEST%\lib%_EXT%\*.jnilib
..\%__SRC%\slb\connectivity*.* %_DEST%\lib%_EXT%\connectivity*.* ..\%__SRC%\slb\connectivity*.* %_DEST%\lib%_EXT%\connectivity*.*
..\%__SRC%\lib\idbt* %_DEST%\lib%_EXT%\idbt* ..\%__SRC%\lib\idbt* %_DEST%\lib%_EXT%\idbt*
..\source\cpool\*.xml %_DEST%\xml%_EXT%\*.xml ..\source\cpool\*.xml %_DEST%\xml%_EXT%\*.xml

View File

@ -1753,7 +1753,7 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
} }
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
::com::sun::star::util::Date ORowSetValue::getDate() const ::com::sun::star::util::Date ORowSetValue::getDate() const
{ {
RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" ); RTL_LOGFILE_CONTEXT_AUTHOR( aLogger, "dbtools", "Ocke.Janssen@sun.com", "ORowSetValue::getDate" );
::com::sun::star::util::Date aValue; ::com::sun::star::util::Date aValue;
@ -1768,8 +1768,6 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
break; break;
case DataType::DECIMAL: case DataType::DECIMAL:
case DataType::NUMERIC: case DataType::NUMERIC:
aValue = DBTypeConversion::toDate((double)*this);
break;
case DataType::FLOAT: case DataType::FLOAT:
case DataType::DOUBLE: case DataType::DOUBLE:
case DataType::REAL: case DataType::REAL:
@ -1787,12 +1785,28 @@ Sequence<sal_Int8> ORowSetValue::getSequence() const
aValue.Year = pDateTime->Year; aValue.Year = pDateTime->Year;
} }
break; break;
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: default:
{ OSL_ENSURE( false, "ORowSetValue::getDate: cannot retrieve the data!" );
Any aAnyValue = getAny(); // NO break!
aAnyValue >>= aValue;
break; case DataType::BINARY:
} case DataType::VARBINARY:
case DataType::LONGVARBINARY:
case DataType::TIME:
aValue = DBTypeConversion::toDate( (double)0 );
break;
} }
} }
return aValue; return aValue;

View File

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

View File

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

View File

@ -937,9 +937,13 @@ again:
{ {
m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction); m_pTable->fetchRow(m_aEvaluateRow, rTableCols, sal_True,bRetrieveData || bHasRestriction);
if ( (!m_bShowDeleted && m_aEvaluateRow->isDeleted()) if ( ( !m_bShowDeleted
|| (bHasRestriction && //!bShowDeleted && m_aEvaluateRow->isDeleted() ||// keine Anzeige von geloeschten Saetzen && m_aEvaluateRow->isDeleted()
!m_pSQLAnalyzer->evaluateRestriction())) // Auswerten der Bedingungen )
|| ( bHasRestriction
&& !m_pSQLAnalyzer->evaluateRestriction()
)
)
{ // naechsten Satz auswerten { // naechsten Satz auswerten
// aktuelle Zeile loeschen im Keyset // aktuelle Zeile loeschen im Keyset
if (m_pEvaluationKeySet) if (m_pEvaluationKeySet)
@ -988,12 +992,14 @@ again:
// Evaluate darf nur gesetzt sein, // Evaluate darf nur gesetzt sein,
// wenn der Keyset weiter aufgebaut werden soll // wenn der Keyset weiter aufgebaut werden soll
if (m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT && !isCount() && if ( ( m_aSQLIterator.getStatementType() == SQL_STATEMENT_SELECT )
(m_pFileSet.isValid() || m_pSortIndex) && bEvaluate) && !isCount()
&& bEvaluate
)
{ {
if (m_pSortIndex) if (m_pSortIndex)
{ {
OKeyValue* pKeyValue = GetOrderbyKeyValue(m_aEvaluateRow); OKeyValue* pKeyValue = GetOrderbyKeyValue( m_aSelectRow );
m_pSortIndex->AddKeyValue(pKeyValue); m_pSortIndex->AddKeyValue(pKeyValue);
} }
else if (m_pFileSet.isValid()) else if (m_pFileSet.isValid())
@ -1294,8 +1300,8 @@ void OResultSet::sortRows()
::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin(); ::std::vector<sal_Int32>::iterator aOrderByIter = m_aOrderbyColumnNumber.begin();
for (::std::vector<sal_Int16>::size_type i=0;aOrderByIter != m_aOrderbyColumnNumber.end(); ++aOrderByIter,++i) 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"); OSL_ENSURE((sal_Int32)m_aSelectRow->get().size() > *aOrderByIter,"Invalid Index");
switch ((*(m_aRow->get().begin()+*aOrderByIter))->getValue().getTypeKind()) switch ((*(m_aSelectRow->get().begin()+*aOrderByIter))->getValue().getTypeKind())
{ {
case DataType::CHAR: case DataType::CHAR:
case DataType::VARCHAR: case DataType::VARCHAR:
@ -1324,7 +1330,7 @@ void OResultSet::sortRows()
OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert"); OSL_ASSERT("OFILECursor::Execute: Datentyp nicht implementiert");
break; break;
} }
(m_aEvaluateRow->get())[*aOrderByIter]->setBound(sal_True); (m_aSelectRow->get())[*aOrderByIter]->setBound(sal_True);
} }
m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending); m_pSortIndex = new OSortIndex(eKeyType,m_aOrderbyAscending);
@ -1341,8 +1347,13 @@ void OResultSet::sortRows()
} }
else 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; return;
// Alles geprueft und wir haben den Namen der Column. // Alles geprueft und wir haben den Namen der Column.
// Die wievielte Column ist das? // Die wievielte Column ist das?
try ::vos::ORef<OSQLColumns> aSelectColumns = m_aSQLIterator.getSelectColumns();
{ ::comphelper::UStringMixEqual aCase;
m_aOrderbyColumnNumber.push_back(xColLocate->findColumn(aColumnName)); OSQLColumns::Vector::const_iterator aFind = ::connectivity::find(aSelectColumns->get().begin(),aSelectColumns->get().end(),aColumnName,aCase);
} if ( aFind == aSelectColumns->get().end() )
catch(Exception) throw SQLException();
{ m_aOrderbyColumnNumber.push_back((aFind - aSelectColumns->get().begin()) + 1);
::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? // Ascending or Descending?
m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC); m_aOrderbyAscending.push_back((SQL_ISTOKEN(pAscendingDescending,DESC)) ? SQL_DESC : SQL_ASC);

View File

@ -103,7 +103,26 @@ void OSQLAnalyzer::start(OSQLParseNode* pSQLParseNode)
m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL); m_pConnection->throwGenericSQLException(STR_QUERY_COMPLEX_COUNT,NULL);
} }
else else
m_aSelectionEvaluations.push_back( TPredicates() ); {
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() ) 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. // 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]; map = _rColumnMapping[nPos];
aIter->second->startSelection((_pRow->get())[map]); if ( map > 0 )
aIter->second->startSelection( (_pRow->get())[map] );
} }
} }
} }

View File

@ -273,22 +273,38 @@ namespace connectivity
if ( pStream.get() ) if ( pStream.get() )
{ {
ByteString sLine; ByteString sLine;
ByteString sVersionString;
while ( pStream->ReadLine(sLine) ) 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,'='); sVersionString = sValue;
const sal_Int32 nMajor = sLine.GetToken(0,'.').ToInt32(); }
const sal_Int32 nMinor = sLine.GetToken(1,'.').ToInt32(); else
const sal_Int32 nMicro = sLine.GetToken(2,'.').ToInt32(); {
if ( nMajor > 1 if ( sIniKey.Equals( "version" )
|| ( nMajor == 1 && nMinor > 8 ) && ( sVersionString.Len() == 0 )
|| ( nMajor == 1 && nMinor == 8 && nMicro > 0 ) ) )
{ {
::connectivity::SharedResources aResources; sVersionString = sValue;
sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION);
} }
break; }
}
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 ) )
{
::connectivity::SharedResources aResources;
sMessage = aResources.getResourceString(STR_ERROR_NEW_VERSION);
} }
} }
} }

View File

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

View File

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

View File

@ -144,11 +144,8 @@ namespace connectivity
sal_Int32 ProfileAccess::LoadProductsInfo() sal_Int32 ProfileAccess::LoadProductsInfo()
{ {
#ifndef MINIMAL_PROFILEDISCOVER //load SeaMonkey 2 profiles to m_ProductProfileList
//load mozilla profiles to m_ProductProfileList sal_Int32 count = LoadXPToolkitProfiles(MozillaProductType_Mozilla);
LoadMozillaProfiles();
#endif
sal_Int32 count=static_cast<sal_Int32>(m_ProductProfileList[MozillaProductType_Mozilla].mProfileList.size());
//load thunderbird profiles to m_ProductProfileList //load thunderbird profiles to m_ProductProfileList
count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird); count += LoadXPToolkitProfiles(MozillaProductType_Thunderbird);
@ -158,117 +155,6 @@ namespace connectivity
count += LoadXPToolkitProfiles(MozillaProductType_Firefox); count += LoadXPToolkitProfiles(MozillaProductType_Firefox);
return count; 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 //Thunderbird and firefox profiles are saved in profiles.ini
sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product) sal_Int32 ProfileAccess::LoadXPToolkitProfiles(MozillaProductType product)
{ {

View File

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

View File

@ -62,7 +62,7 @@
<value>com.sun.star.comp.sdbc.MozabDriver</value> <value>com.sun.star.comp.sdbc.MozabDriver</value>
</prop> </prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> <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> </prop>
<node oor:name="Features"> <node oor:name="Features">
<node oor:name="EscapeDateTime" oor:op="replace"> <node oor:name="EscapeDateTime" oor:op="replace">

View File

@ -32,7 +32,7 @@
<value>com.sun.star.comp.sdbc.MozabDriver</value> <value>com.sun.star.comp.sdbc.MozabDriver</value>
</prop> </prop>
<prop oor:name="DriverTypeDisplayName" oor:type="xs:string"> <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> </prop>
<node oor:name="MetaData"> <node oor:name="MetaData">
<node oor:name="SupportsBrowsing" oor:op="replace"> <node oor:name="SupportsBrowsing" oor:op="replace">

View File

@ -109,7 +109,7 @@ namespace connectivity
inline void startSelection(ORowSetValueDecoratorRef& _rVal) 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::parenthesized_boolean_value_expression, "parenthesized_boolean_value_expression" },
{ OSQLParseNode::character_string_type, "character_string_type" }, { OSQLParseNode::character_string_type, "character_string_type" },
{ OSQLParseNode::other_like_predicate_part_2, "other_like_predicate_part_2" }, { 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] ); 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!" ); 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.append(m_aNodeValue);
rString.appendAscii("#"); rString.appendAscii("#");
break; break;
case SQL_NODE_INTNUM: case SQL_NODE_INTNUM:
case SQL_NODE_APPROXNUM: case SQL_NODE_APPROXNUM:
{ {
@ -2523,6 +2525,12 @@ void OSQLParseNode::parseLeaf(::rtl::OUStringBuffer& rString, const SQLParseNode
rString.append(aTmp); rString.append(aTmp);
} break; } 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 // fall through
default: default:
if (rString.getLength() && m_aNodeValue.toChar() != '.' && m_aNodeValue.toChar() != ':' ) 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 usr1 - all dt_mkout NULL
dt desktop\inc nmake - all dt_inc NULL dt desktop\inc nmake - all dt_inc NULL
dt desktop\prj get - all dt_prj 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\servicetag nmake - all sn_svctag NULL
dt desktop\source\registration\com\sun\star\registration nmake - all sn_regjob 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\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/module.h>
#include <osl/file.hxx> #include <osl/file.hxx>
#include <osl/signal.h> #include <osl/signal.h>
#include <osl/thread.hxx>
#include <rtl/uuid.h> #include <rtl/uuid.h>
#include <rtl/uri.hxx> #include <rtl/uri.hxx>
#include <unotools/pathoptions.hxx> #include <unotools/pathoptions.hxx>
@ -347,10 +348,8 @@ CommandLineArgs* Desktop::GetCommandLineArgs()
{ {
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if ( !pArgs ) if ( !pArgs )
{
pArgs = new CommandLineArgs; pArgs = new CommandLineArgs;
} }
}
return pArgs; return pArgs;
} }
@ -1552,7 +1551,7 @@ void Desktop::Main()
Reference< ::com::sun::star::task::XRestartManager > xRestartManager; Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
sal_Bool bRestartRequested( sal_False ); sal_Bool bRestartRequested( sal_False );
sal_Bool bUseSystemFileDialog(sal_True); sal_Bool bUseSystemFileDialog(sal_True);
int nAcquireCount( 0 ); int nAcquireCount( 0 );
Reference < css::document::XEventListener > xGlobalBroadcaster; Reference < css::document::XEventListener > xGlobalBroadcaster;
try try
{ {
@ -1619,25 +1618,6 @@ void Desktop::Main()
} }
String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String(); String aTitle = pLabelResMgr ? String( ResId( RID_APPTITLE, *pLabelResMgr ) ) : String();
delete pLabelResMgr; 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 // Check for StarOffice/Suite specific extensions runs also with OpenOffice installation sets
OUString aTitleString( aTitle ); OUString aTitleString( aTitle );
@ -1657,12 +1637,9 @@ void Desktop::Main()
#endif #endif
SetDisplayName( aTitle ); SetDisplayName( aTitle );
// SetSplashScreenProgress(30);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create SvtPathOptions and SvtLanguageOptions" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create SvtPathOptions and SvtLanguageOptions" );
pPathOptions.reset( new SvtPathOptions); pPathOptions.reset( new SvtPathOptions);
// SetSplashScreenProgress(40); SetSplashScreenProgress(40);
// pLanguageOptions = new SvtLanguageOptions(sal_True);
// SetSplashScreenProgress(45);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create SvtPathOptions and SvtLanguageOptions" );
// Check special env variable #111015# // Check special env variable #111015#
@ -1744,6 +1721,7 @@ void Desktop::Main()
} }
SetSplashScreenProgress(50); SetSplashScreenProgress(50);
// Backing Component // Backing Component
sal_Bool bCrashed = sal_False; sal_Bool bCrashed = sal_False;
sal_Bool bExistsRecoveryData = sal_False; sal_Bool bExistsRecoveryData = sal_False;
@ -1773,43 +1751,37 @@ void Desktop::Main()
if ( !bRestartRequested ) if ( !bRestartRequested )
{ {
if ( if ((!pCmdLineArgs->WantsToLoadDocument() ) &&
(pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
(SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) && (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
(!bExistsRecoveryData ) && (!bExistsRecoveryData ) &&
(!bExistsSessionData ) && (!bExistsSessionData ) &&
(!Application::AnyInput( INPUT_APPEVENT ) ) (!Application::AnyInput( INPUT_APPEVENT ) ))
)
{ {
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" ); RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
Reference< XFrame > xDesktopFrame( xSMgr->createInstance( Reference< XFrame > xDesktopFrame( xSMgr->createInstance( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY ); if (xDesktopFrame.is())
if (xDesktopFrame.is()) {
{ Reference< XFrame > xBackingFrame;
// SetSplashScreenProgress(60); Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
Reference< XFrame > xBackingFrame;
Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0); xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
if (xBackingFrame.is()) if (xBackingFrame.is())
xContainerWindow = xBackingFrame->getContainerWindow(); xContainerWindow = xBackingFrame->getContainerWindow();
if (xContainerWindow.is()) if (xContainerWindow.is())
{ {
// set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank" // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
// frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior, // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
// otherwise documents loaded into this frame will later on miss functionality depending on the style. // otherwise documents loaded into this frame will later on miss functionality depending on the style.
Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow ); Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" ); OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT ); pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
SetSplashScreenProgress(75); SetSplashScreenProgress(75);
Sequence< Any > lArgs(1); Sequence< Any > lArgs(1);
lArgs[0] <<= xContainerWindow; lArgs[0] <<= xContainerWindow;
Reference< XController > xBackingComp( Reference< XController > xBackingComp(
xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs), UNO_QUERY);
UNO_QUERY);
// SetSplashScreenProgress(80);
if (xBackingComp.is()) if (xBackingComp.is())
{ {
Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY); Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
@ -1840,16 +1812,6 @@ void Desktop::Main()
FatalError( MakeStartupErrorMessage(e.Message) ); FatalError( MakeStartupErrorMessage(e.Message) );
return; return;
} }
/*
catch ( ... )
{
FatalError( MakeStartupErrorMessage(
OUString::createFromAscii(
"Unknown error during startup (Office wrapper service).\nInstallation could be damaged.")));
return;
}
*/
// SetSplashScreenProgress(55);
SvtFontSubstConfig().Apply(); SvtFontSubstConfig().Apply();
@ -1858,7 +1820,6 @@ void Desktop::Main()
aAppearanceCfg.SetApplicationDefaults( this ); aAppearanceCfg.SetApplicationDefaults( this );
SvtAccessibilityOptions aOptions; SvtAccessibilityOptions aOptions;
aOptions.SetVCLSettings(); aOptions.SetVCLSettings();
// SetSplashScreenProgress(60);
if ( !bRestartRequested ) if ( !bRestartRequested )
{ {
@ -1892,15 +1853,6 @@ void Desktop::Main()
FatalError( MakeStartupErrorMessage(e.Message) ); FatalError( MakeStartupErrorMessage(e.Message) );
return; 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 // Post user event to startup first application component window
// We have to send this OpenClients message short before execute() to // We have to send this OpenClients message short before execute() to
@ -2219,12 +2171,7 @@ IMPL_LINK( Desktop, OpenClients_Impl, void*, EMPTYARG )
// CloseStartupScreen(); // CloseStartupScreen();
CloseSplashScreen(); CloseSplashScreen();
CheckFirstRun( ); CheckFirstRun( );
// allow ipc interaction
// OfficeIPCThread::SetReady();
EnableOleAutomation(); EnableOleAutomation();
if (getenv ("OOO_EXIT_POST_STARTUP")) if (getenv ("OOO_EXIT_POST_STARTUP"))
@ -2721,16 +2668,6 @@ void Desktop::OpenClients()
if ( ! bAllowRecoveryAndSessionManagement ) 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 try
{ {
Reference< XDispatch > xRecovery( Reference< XDispatch > xRecovery(

View File

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

View File

@ -38,7 +38,7 @@ namespace desktop
class CommandLineArgs class CommandLineArgs
{ {
public: public:
enum BoolParam // must be zero based! enum BoolParam // must be zero based!
{ {
CMD_BOOLPARAM_MINIMIZED, CMD_BOOLPARAM_MINIMIZED,
CMD_BOOLPARAM_INVISIBLE, CMD_BOOLPARAM_INVISIBLE,
@ -71,7 +71,7 @@ class CommandLineArgs
CMD_BOOLPARAM_HELPIMPRESS, CMD_BOOLPARAM_HELPIMPRESS,
CMD_BOOLPARAM_HELPBASE, CMD_BOOLPARAM_HELPBASE,
CMD_BOOLPARAM_PSN, CMD_BOOLPARAM_PSN,
CMD_BOOLPARAM_COUNT // must be last element! CMD_BOOLPARAM_COUNT // must be last element!
}; };
enum StringParam // must be zero based! enum StringParam // must be zero based!
@ -92,7 +92,7 @@ class CommandLineArgs
CMD_STRINGPARAM_PRINTERNAME, CMD_STRINGPARAM_PRINTERNAME,
CMD_STRINGPARAM_DISPLAY, CMD_STRINGPARAM_DISPLAY,
CMD_STRINGPARAM_LANGUAGE, CMD_STRINGPARAM_LANGUAGE,
CMD_STRINGPARAM_COUNT // must be last element! CMD_STRINGPARAM_COUNT // must be last element!
}; };
enum GroupParamId enum GroupParamId
@ -101,7 +101,8 @@ class CommandLineArgs
CMD_GRPID_COUNT CMD_GRPID_COUNT
}; };
struct Supplier { struct Supplier
{
// Thrown from constructors and next: // Thrown from constructors and next:
class Exception { class Exception {
public: public:
@ -122,86 +123,88 @@ class CommandLineArgs
boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; } boost::optional< rtl::OUString > getCwdUrl() const { return m_cwdUrl; }
// generic methods to access parameter // generic methods to access parameter
void SetBoolParam( BoolParam eParam, sal_Bool bNewValue ); void SetBoolParam( BoolParam eParam, sal_Bool bNewValue );
// Access to bool parameters // Access to bool parameters
sal_Bool IsMinimized() const; sal_Bool IsMinimized() const;
sal_Bool IsInvisible() const; sal_Bool IsInvisible() const;
sal_Bool IsNoRestore() const; sal_Bool IsNoRestore() const;
sal_Bool IsNoDefault() const; sal_Bool IsNoDefault() const;
sal_Bool IsBean() const; sal_Bool IsBean() const;
sal_Bool IsServer() const; sal_Bool IsServer() const;
sal_Bool IsHeadless() const; sal_Bool IsHeadless() const;
sal_Bool IsQuickstart() const; sal_Bool IsQuickstart() const;
sal_Bool IsNoQuickstart() const; sal_Bool IsNoQuickstart() const;
sal_Bool IsTerminateAfterInit() const; sal_Bool IsTerminateAfterInit() const;
sal_Bool IsNoFirstStartWizard() const; sal_Bool IsNoFirstStartWizard() const;
sal_Bool IsNoLogo() const; sal_Bool IsNoLogo() const;
sal_Bool IsNoLockcheck() const; sal_Bool IsNoLockcheck() const;
sal_Bool IsHelp() const; sal_Bool IsHelp() const;
sal_Bool IsHelpWriter() const; sal_Bool IsHelpWriter() const;
sal_Bool IsHelpCalc() const; sal_Bool IsHelpCalc() const;
sal_Bool IsHelpDraw() const; sal_Bool IsHelpDraw() const;
sal_Bool IsHelpImpress() const; sal_Bool IsHelpImpress() const;
sal_Bool IsHelpBase() const; sal_Bool IsHelpBase() const;
sal_Bool IsHelpMath() const; sal_Bool IsHelpMath() const;
sal_Bool IsHelpBasic() const; sal_Bool IsHelpBasic() const;
sal_Bool IsWriter() const; sal_Bool IsWriter() const;
sal_Bool IsCalc() const; sal_Bool IsCalc() const;
sal_Bool IsDraw() const; sal_Bool IsDraw() const;
sal_Bool IsImpress() const; sal_Bool IsImpress() const;
sal_Bool IsBase() const; sal_Bool IsBase() const;
sal_Bool IsGlobal() const; sal_Bool IsGlobal() const;
sal_Bool IsMath() const; sal_Bool IsMath() const;
sal_Bool IsWeb() const; sal_Bool IsWeb() const;
sal_Bool HasModuleParam() const; sal_Bool HasModuleParam() const;
sal_Bool WantsToLoadDocument() const;
// Access to string parameters // Access to string parameters
sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const; sal_Bool GetPortalConnectString( ::rtl::OUString& rPara) const;
sal_Bool GetAcceptString( ::rtl::OUString& rPara) const; sal_Bool GetAcceptString( ::rtl::OUString& rPara) const;
sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const; sal_Bool GetUnAcceptString( ::rtl::OUString& rPara) const;
sal_Bool GetOpenList( ::rtl::OUString& rPara) const; sal_Bool GetOpenList( ::rtl::OUString& rPara) const;
sal_Bool GetViewList( ::rtl::OUString& rPara) const; sal_Bool GetViewList( ::rtl::OUString& rPara) const;
sal_Bool GetStartList( ::rtl::OUString& rPara) const; sal_Bool GetStartList( ::rtl::OUString& rPara) const;
sal_Bool GetForceOpenList( ::rtl::OUString& rPara) const; sal_Bool GetForceOpenList( ::rtl::OUString& rPara) const;
sal_Bool GetForceNewList( ::rtl::OUString& rPara) const; sal_Bool GetForceNewList( ::rtl::OUString& rPara) const;
sal_Bool GetPrintList( ::rtl::OUString& rPara) const; sal_Bool GetPrintList( ::rtl::OUString& rPara) const;
sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const;
sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const;
sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; sal_Bool GetLanguage( ::rtl::OUString& rPara ) const;
// Special analyzed states (does not match directly to a command line parameter!) // Special analyzed states (does not match directly to a command line parameter!)
sal_Bool IsPrinting() const; sal_Bool IsPrinting() const;
sal_Bool IsEmpty() const; sal_Bool IsEmpty() const;
sal_Bool IsEmptyOrAcceptOnly() const; sal_Bool IsEmptyOrAcceptOnly() const;
private: private:
enum Count { NONE, ONE, MANY }; enum Count { NONE, ONE, MANY };
struct GroupDefinition struct GroupDefinition
{ {
sal_Int32 nCount; sal_Int32 nCount;
BoolParam* pGroupMembers; BoolParam* pGroupMembers;
}; };
// no copy and operator= // no copy and operator=
CommandLineArgs( const CommandLineArgs& ); CommandLineArgs( const CommandLineArgs& );
CommandLineArgs operator=( const CommandLineArgs& ); CommandLineArgs operator=( const CommandLineArgs& );
sal_Bool InterpretCommandLineParameter( const ::rtl::OUString& ); sal_Bool InterpretCommandLineParameter( const ::rtl::OUString& );
void ParseCommandLine_Impl( Supplier& supplier ); void ParseCommandLine_Impl( Supplier& supplier );
void ResetParamValues(); void ResetParamValues();
sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const; sal_Bool CheckGroupMembers( GroupParamId nGroup, BoolParam nExcludeMember ) const;
void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam ); void AddStringListParam_Impl( StringParam eParam, const rtl::OUString& aParam );
void SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue ); void SetBoolParam_Impl( BoolParam eParam, sal_Bool bValue );
boost::optional< rtl::OUString > m_cwdUrl; boost::optional< rtl::OUString > m_cwdUrl;
sal_Bool m_aBoolParams[ CMD_BOOLPARAM_COUNT ]; // Stores boolean parameters sal_Bool m_aBoolParams[ CMD_BOOLPARAM_COUNT ]; // Stores boolean parameters
rtl::OUString m_aStrParams[ CMD_STRINGPARAM_COUNT ]; // Stores string parameters 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 sal_Bool m_aStrSetParams[ CMD_STRINGPARAM_COUNT ]; // Stores if string parameters are provided on cmdline
Count m_eArgumentCount; // Number of Args Count m_eArgumentCount; // Number of Args
mutable ::osl::Mutex m_aMutex; 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 // static definition for groups where only one member can be true
static GroupDefinition m_pGroupDefinitions[ CMD_GRPID_COUNT ]; static GroupDefinition m_pGroupDefinitions[ CMD_GRPID_COUNT ];

View File

@ -106,7 +106,7 @@
#define RID_DLG_UPDATE_LINE 8 #define RID_DLG_UPDATE_LINE 8
#define RID_DLG_UPDATE_HELP 9 #define RID_DLG_UPDATE_HELP 9
#define RID_DLG_UPDATE_OK 10 #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_NORMALALERT 12
#define RID_DLG_UPDATE_HIGHCONTRASTALERT 13 #define RID_DLG_UPDATE_HIGHCONTRASTALERT 13
#define RID_DLG_UPDATE_ERROR 14 #define RID_DLG_UPDATE_ERROR 14
@ -127,6 +127,11 @@
#define RID_DLG_UPDATE_RELEASENOTES_LINK 29 #define RID_DLG_UPDATE_RELEASENOTES_LINK 29
#define RID_DLG_UPDATE_NOUPDATE 30 #define RID_DLG_UPDATE_NOUPDATE 30
#define RID_DLG_UPDATE_VERSION 31 #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) #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_NO_ADMIN_PRIVILEGE (RID_DEPLOYMENT_GUI_START+95)
#define RID_STR_ERROR_MISSING_DEPENDENCIES (RID_DEPLOYMENT_GUI_START+96) #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_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) #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_REMOVE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+104)
#define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105) #define RID_WARNINGBOX_ENABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+105)
#define RID_WARNINGBOX_DISABLE_SHARED_EXTENSION (RID_DEPLOYMENT_GUI_START+106) #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 #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"; 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 // Dialog layout
// --------------------------------------------------- // ---------------------------------------------------
// row 1 | multi line edit // 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 { WarningBox RID_WARNINGBOX_INSTALL_EXTENSION {

92
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_theextmgr.hxx"
#include "dp_gui_extensioncmdqueue.hxx" #include "dp_gui_extensioncmdqueue.hxx"
#include "dp_misc.h" #include "dp_misc.h"
#include "dp_ucb.h"
#include "dp_update.hxx" #include "dp_update.hxx"
#include "dp_identifier.hxx" #include "dp_identifier.hxx"
#include "dp_descriptioninfoset.hxx"
#include "vcl/ctrl.hxx" #include "vcl/ctrl.hxx"
#include "vcl/menu.hxx" #include "vcl/menu.hxx"
@ -118,7 +120,8 @@ enum MENU_COMMAND
CMD_REMOVE = 1, CMD_REMOVE = 1,
CMD_ENABLE, CMD_ENABLE,
CMD_DISABLE, CMD_DISABLE,
CMD_UPDATE CMD_UPDATE,
CMD_SHOW_LICENSE
}; };
class ExtBoxWithBtns_Impl : public ExtensionBox_Impl class ExtBoxWithBtns_Impl : public ExtensionBox_Impl
@ -224,13 +227,10 @@ const Size ExtBoxWithBtns_Impl::GetMinOutputSizePixel() const
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
void ExtBoxWithBtns_Impl::RecalcAll() void ExtBoxWithBtns_Impl::RecalcAll()
{ {
ExtensionBox_Impl::RecalcAll();
const sal_Int32 nActive = getSelIndex(); const sal_Int32 nActive = getSelIndex();
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND ) if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
{ {
SetButtonPos( GetEntryRect( nActive ) );
SetButtonStatus( GetEntryData( nActive) ); SetButtonStatus( GetEntryData( nActive) );
} }
else else
@ -239,6 +239,11 @@ void ExtBoxWithBtns_Impl::RecalcAll()
m_pEnableBtn->Hide(); m_pEnableBtn->Hide();
m_pRemoveBtn->Hide(); m_pRemoveBtn->Hide();
} }
ExtensionBox_Impl::RecalcAll();
if ( nActive != EXTENSION_LISTBOX_ENTRY_NOTFOUND )
SetButtonPos( GetEntryRect( nActive ) );
} }
@ -363,28 +368,29 @@ bool ExtBoxWithBtns_Impl::HandleTabKey( bool bReverse )
// ----------------------------------------------------------------------- // -----------------------------------------------------------------------
MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos ) MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long nPos )
{ {
if ( ( nPos >= 0 ) && ( nPos < (long) getItemCount() ) ) 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_bLocked ) if ( GetEntryData( nPos )->m_bUser )
{ {
PopupMenu aPopup; if ( GetEntryData( nPos )->m_eState == REGISTERED )
aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
aPopup.InsertItem( CMD_UPDATE, DialogHelper::getResourceString( RID_CTX_ITEM_CHECK_UPDATE ) ); else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
if ( GetEntryData( nPos )->m_bUser )
{
if ( GetEntryData( nPos )->m_eState == REGISTERED )
aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
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 ) );
return (MENU_COMMAND) aPopup.Execute( this, rPos );
} }
aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
} }
return CMD_NONE;
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 );
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -409,6 +415,12 @@ void ExtBoxWithBtns_Impl::MouseButtonDown( const MouseEvent& rMEvt )
break; break;
case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage ); case CMD_REMOVE: m_pParent->removePackage( GetEntryData( nPos )->m_xPackage );
break; break;
case CMD_SHOW_LICENSE:
{
ShowLicenseDialog aLicenseDlg( m_pParent, GetEntryData( nPos )->m_xPackage );
aLicenseDlg.Execute();
break;
}
} }
} }
else if ( rMEvt.IsLeft() ) else if ( rMEvt.IsLeft() )
@ -1742,6 +1754,42 @@ void UpdateRequiredDialog::disableAllEntries()
m_aCloseBtn.SetText( m_sCloseText ); 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 // 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/fixedhyper.hxx"
#include "svtools/prgsbar.hxx" #include "svtools/prgsbar.hxx"
#include "svtools/svmedit.hxx"
#include "osl/conditn.hxx" #include "osl/conditn.hxx"
#include "osl/mutex.hxx" #include "osl/mutex.hxx"
@ -245,6 +246,20 @@ public:
bool installExtensionWarn( const ::rtl::OUString &rExtensionURL ) const; 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 > class UpdateRequiredDialogService : public ::cppu::WeakImplHelper1< ::com::sun::star::ui::dialogs::XExecutableDialog >
{ {

View File

@ -71,29 +71,35 @@ Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
m_pPublisher( NULL ), m_pPublisher( NULL ),
m_xPackage( xPackage ) m_xPackage( xPackage )
{ {
m_sTitle = xPackage->getDisplayName(); try
m_sVersion = xPackage->getVersion(); {
m_sDescription = xPackage->getDescription(); m_sTitle = xPackage->getDisplayName();
m_sVersion = xPackage->getVersion();
m_sDescription = xPackage->getDescription();
m_sLicenseText = xPackage->getLicenseText();
beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
m_sPublisher = aInfo.First; m_sPublisher = aInfo.First;
m_sPublisherURL = aInfo.Second; m_sPublisherURL = aInfo.Second;
// get the icons for the package if there are any // get the icons for the package if there are any
uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
if ( xGraphic.is() ) if ( xGraphic.is() )
m_aIcon = Image( xGraphic ); m_aIcon = Image( xGraphic );
xGraphic = xPackage->getIcon( true ); xGraphic = xPackage->getIcon( true );
if ( xGraphic.is() ) if ( xGraphic.is() )
m_aIconHC = Image( xGraphic ); m_aIconHC = Image( xGraphic );
else else
m_aIconHC = m_aIcon; m_aIconHC = m_aIcon;
if ( eState == AMBIGUOUS ) if ( eState == AMBIGUOUS )
m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
else if ( eState == NOT_REGISTERED ) else if ( eState == NOT_REGISTERED )
checkDependencies(); 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 ); bool bLocked = m_pManager->isReadOnly( xPackage );
TEntry_Impl pEntry( new Entry_Impl( xPackage, eState, bLocked ) ); 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 ) ); xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
::osl::ClearableMutexGuard guard(m_entriesMutex); ::osl::ClearableMutexGuard guard(m_entriesMutex);

View File

@ -81,6 +81,7 @@ struct Entry_Impl
String m_sPublisher; String m_sPublisher;
String m_sPublisherURL; String m_sPublisherURL;
String m_sErrorText; String m_sErrorText;
String m_sLicenseText;
Image m_aIcon; Image m_aIcon;
Image m_aIconHC; Image m_aIconHC;
svt::FixedHyperlink *m_pPublisher; 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 #define INCLUDED_DP_GUI_UPDATEDATA_HXX
#include "sal/config.h" #include "sal/config.h"
#include "tools/solar.h"
#include "rtl/ustring.hxx" #include "rtl/ustring.hxx"
#include "com/sun/star/uno/Reference.hxx" #include "com/sun/star/uno/Reference.hxx"
@ -80,6 +81,10 @@ struct UpdateData
//are to be ignored. //are to be ignored.
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage >
aUpdateSource; aUpdateSource;
// ID to find this entry in the update listbox
USHORT m_nID;
bool m_bIgnored;
}; };
} }

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

File diff suppressed because it is too large Load Diff

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

@ -112,8 +112,7 @@ private:
struct DisabledUpdate; struct DisabledUpdate;
struct SpecificError; struct SpecificError;
union IndexUnion; struct IgnoredUpdate;
friend union IndexUnion;
struct Index; struct Index;
friend struct Index; friend struct Index;
class Thread; class Thread;
@ -135,40 +134,36 @@ private:
void operator =(UpdateDialog::CheckListBox &); // not defined void operator =(UpdateDialog::CheckListBox &); // not defined
virtual void MouseButtonDown(MouseEvent const & event); virtual void MouseButtonDown(MouseEvent const & event);
virtual void MouseButtonUp(MouseEvent const & event); virtual void MouseButtonUp(MouseEvent const & event);
virtual void KeyInput(KeyEvent 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; UpdateDialog & m_dialog;
}; };
friend class CheckListBox; friend class CheckListBox;
void insertItem( USHORT insertItem( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
rtl::OUString const & name, USHORT position, void addAdditional( UpdateDialog::Index *pIndex, SvLBoxButtonKind kind );
std::auto_ptr< UpdateDialog::Index const > index, bool isIgnoredUpdate( UpdateDialog::Index *pIndex );
SvLBoxButtonKind kind); void setIgnoredUpdate( UpdateDialog::Index *pIndex, bool bIgnore, bool bIgnoreAll );
void addAdditional( void addEnabledUpdate( rtl::OUString const & name, dp_gui::UpdateData & data );
rtl::OUString const & name, USHORT position, void addDisabledUpdate( UpdateDialog::DisabledUpdate & data );
std::auto_ptr< UpdateDialog::Index const > index, void addSpecificError( UpdateDialog::SpecificError & data );
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 checkingDone(); void checkingDone();
void enableOk(); void enableOk();
void getIgnoredUpdates();
void storeIgnoredUpdates();
void initDescription(); void initDescription();
void clearDescription(); void clearDescription();
bool showDescription(::com::sun::star::uno::Reference< bool showDescription(::com::sun::star::uno::Reference<
@ -183,7 +178,7 @@ private:
DECL_LINK(selectionHandler, void *); DECL_LINK(selectionHandler, void *);
DECL_LINK(allHandler, void *); DECL_LINK(allHandler, void *);
DECL_LINK(okHandler, void *); DECL_LINK(okHandler, void *);
DECL_LINK(cancelHandler, void *); DECL_LINK(closeHandler, void *);
DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *); DECL_LINK(hyperlink_clicked, svt::FixedHyperlink *);
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
@ -202,7 +197,7 @@ private:
FixedLine m_line; FixedLine m_line;
HelpButton m_help; HelpButton m_help;
PushButton m_ok; PushButton m_ok;
CancelButton m_cancel; PushButton m_close;
rtl::OUString m_error; rtl::OUString m_error;
rtl::OUString m_none; rtl::OUString m_none;
rtl::OUString m_noInstallable; rtl::OUString m_noInstallable;
@ -214,18 +209,22 @@ private:
rtl::OUString m_noDependencyCurVer; rtl::OUString m_noDependencyCurVer;
rtl::OUString m_browserbased; rtl::OUString m_browserbased;
rtl::OUString m_version; rtl::OUString m_version;
rtl::OUString m_ignoredUpdate;
std::vector< dp_gui::UpdateData > m_enabledUpdates; std::vector< dp_gui::UpdateData > m_enabledUpdates;
std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates; std::vector< UpdateDialog::DisabledUpdate > m_disabledUpdates;
std::vector< rtl::OUString > m_generalErrors;
std::vector< UpdateDialog::SpecificError > m_specificErrors; std::vector< UpdateDialog::SpecificError > m_specificErrors;
std::vector< UpdateDialog::IgnoredUpdate* > m_ignoredUpdates;
std::vector< Index* > m_ListboxEntries;
std::vector< dp_gui::UpdateData > & m_updateData; std::vector< dp_gui::UpdateData > & m_updateData;
rtl::Reference< UpdateDialog::Thread > m_thread; rtl::Reference< UpdateDialog::Thread > m_thread;
::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager; ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XExtensionManager > m_xExtensionManager;
Point m_aFirstLinePos; Point m_aFirstLinePos;
Size m_aFirstLineSize; Size m_aFirstLineSize;
long m_nFirstLineDelta; long m_nFirstLineDelta;
long m_nOneLineMissing; 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"; Text[en-US] = "~Install";
DefButton = TRUE; DefButton = TRUE;
}; };
CancelButton RID_DLG_UPDATE_CANCEL { PushButton RID_DLG_UPDATE_CLOSE {
Pos = MAP_APPFONT( Pos = MAP_APPFONT(
RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH, RSC_SP_DLG_INNERBORDER_LEFT + LOCAL_WIDTH - RSC_CD_PUSHBUTTON_WIDTH,
(RSC_SP_DLG_INNERBORDER_TOP + RSC_CD_FIXEDTEXT_HEIGHT + (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_SP_CTRL_DESC_Y + LOCAL_LIST_HEIGHT2 + RSC_SP_FLGR_SPACE_Y +
RSC_CD_FIXEDLINE_HEIGHT + 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); Size = MAP_APPFONT(RSC_CD_PUSHBUTTON_WIDTH, RSC_CD_PUSHBUTTON_HEIGHT);
Text[en-US] = "Close";
}; };
Image RID_DLG_UPDATE_NORMALALERT { Image RID_DLG_UPDATE_NORMALALERT {
@ -227,7 +228,7 @@ ModalDialog RID_DLG_UPDATE {
Text[en-US] = "No new updates are available."; Text[en-US] = "No new updates are available.";
}; };
String RID_DLG_UPDATE_NOINSTALLABLE { 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 { String RID_DLG_UPDATE_FAILURE {
Text[en-US] = "An error occurred:"; Text[en-US] = "An error occurred:";
@ -236,7 +237,7 @@ ModalDialog RID_DLG_UPDATE {
Text[en-US] = "Unknown error."; Text[en-US] = "Unknown error.";
}; };
String RID_DLG_UPDATE_NODESCRIPTION { 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 { String RID_DLG_UPDATE_NOINSTALL {
Text[en-US] = "The extension cannot be updated because:"; Text[en-US] = "The extension cannot be updated because:";
@ -250,10 +251,21 @@ ModalDialog RID_DLG_UPDATE {
String RID_DLG_UPDATE_BROWSERBASED { String RID_DLG_UPDATE_BROWSERBASED {
Text[en-US] = "browser based update"; Text[en-US] = "browser based update";
}; };
String RID_DLG_UPDATE_VERSION { String RID_DLG_UPDATE_VERSION {
Text[en-US] = "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 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 { 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 { 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_DYN_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+10)
#define RID_STR_JAVA_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+11) #define RID_STR_JAVA_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+11)
#define RID_STR_PYTHON_COMPONENT (RID_DEPLOYMENT_COMPONENT_START+12) #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_RDB_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+20)
#define RID_STR_JAVA_TYPELIB (RID_DEPLOYMENT_COMPONENT_START+21) #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"; Text [ en-US ] = "UNO Python Component";
}; };
String RID_STR_COMPONENTS
{
Text [ en-US ] = "UNO Components";
};
String RID_STR_RDB_TYPELIB String RID_STR_RDB_TYPELIB
{ {
Text [ en-US ] = "UNO RDB Type Library"; 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(); return OUString();
} }
//______________________________________________________________________________
OUString Package::getLicenseText() throw (
deployment::ExtensionRemovedException,RuntimeException)
{
if (m_bRemoved)
throw deployment::ExtensionRemovedException();
return OUString();
}
//______________________________________________________________________________ //______________________________________________________________________________
Sequence<OUString> Package::getUpdateInformationURLs() throw ( Sequence<OUString> Package::getUpdateInformationURLs() throw (
deployment::ExtensionRemovedException, RuntimeException) deployment::ExtensionRemovedException, RuntimeException)

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