summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basic/inc/basic/sbmod.hxx7
-rw-r--r--basic/inc/basic/sbobjmod.hxx12
-rw-r--r--basic/source/basmgr/basmgr.cxx12
-rw-r--r--basic/source/classes/disas.cxx34
-rwxr-xr-xbasic/source/classes/sb.cxx48
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx2
-rw-r--r--basic/source/classes/sbxmod.cxx582
-rw-r--r--basic/source/comp/exprtree.cxx9
-rwxr-xr-x[-rw-r--r--]basic/source/comp/sbcomp.cxx312
-rw-r--r--basic/source/inc/namecont.hxx10
-rwxr-xr-xbasic/source/inc/sbtrace.hxx42
-rw-r--r--basic/source/inc/scriptcont.hxx4
-rw-r--r--basic/source/runtime/methods.cxx3
-rw-r--r--basic/source/runtime/props.cxx7
-rw-r--r--basic/source/runtime/rtlproto.hxx1
-rwxr-xr-xbasic/source/runtime/runtime.cxx19
-rw-r--r--basic/source/runtime/stdobj.cxx1
-rw-r--r--basic/source/runtime/step0.cxx37
-rwxr-xr-x[-rw-r--r--]basic/source/runtime/step2.cxx48
-rw-r--r--basic/source/uno/namecont.cxx8
-rw-r--r--basic/source/uno/scriptcont.cxx10
-rw-r--r--configmgr/source/rootaccess.cxx5
-rw-r--r--desktop/source/app/app.cxx587
-rw-r--r--[-rwxr-xr-x]desktop/source/deployment/gui/dp_gui_dialog2.cxx12
-rw-r--r--desktop/source/deployment/manager/dp_extensionmanager.cxx8
-rw-r--r--desktop/source/deployment/manager/dp_properties.cxx2
-rw-r--r--desktop/source/deployment/manager/dp_properties.hxx5
-rw-r--r--desktop/source/deployment/misc/dp_misc.cxx5
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configuration.cxx62
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/dp_registry.cxx7
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/help/dp_helpbackenddb.hxx5
-rw-r--r--desktop/source/deployment/registry/package/dp_package.cxx22
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx5
-rw-r--r--desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx5
-rw-r--r--[-rwxr-xr-x]desktop/source/migration/services/cexportsoo3.cxx5
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.cxx7
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.hxx7
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_app.cxx33
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_misc.cxx105
-rw-r--r--desktop/source/pkgchk/unopkg/unopkg_shared.h6
-rwxr-xr-xediteng/source/editeng/impedit4.cxx19
-rw-r--r--formula/inc/formula/errorcodes.hxx8
-rw-r--r--framework/source/accelerators/acceleratorconfiguration.cxx31
-rwxr-xr-x[-rw-r--r--]officecfg/registry/data/org/openoffice/Office/Math.xcu5
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu10
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Math.xcs23
-rwxr-xr-xofficecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs2
-rw-r--r--oovbaapi/ooo/vba/XApplicationBase.idl17
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/makefile.mk2
-rw-r--r--oovbaapi/ooo/vba/makefile.mk5
-rw-r--r--oovbaapi/ooo/vba/word/makefile.mk2
-rw-r--r--oovbaapi/prj/d.lst2
-rw-r--r--[-rwxr-xr-x]sfx2/inc/sfx2/objsh.hxx4
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/securitypage.cxx30
-rw-r--r--[-rwxr-xr-x]sfx2/source/dialog/securitypage.src0
-rw-r--r--sfx2/source/doc/objserv.cxx9
-rw-r--r--sfx2/source/doc/objstor.cxx7
-rw-r--r--[-rwxr-xr-x]sfx2/source/doc/objxtor.cxx7
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx6
-rw-r--r--sfx2/source/view/viewfrm.cxx9
-rw-r--r--sfx2/source/view/viewprn.cxx8
-rwxr-xr-xsvx/inc/svx/dialogs.hrc4
-rw-r--r--svx/source/tbxctrls/makefile.mk1
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.cxx6
-rw-r--r--svx/source/tbxctrls/tbunosearchcontrollers.src33
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx21
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx3
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx4
-rwxr-xr-xvbahelper/inc/vbahelper/vbaeventshelperbase.hxx162
-rw-r--r--vbahelper/inc/vbahelper/vbaglobalbase.hxx6
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbahelperinterface.hxx30
-rw-r--r--vbahelper/prj/d.lst1
-rw-r--r--vbahelper/source/msforms/vbacontrols.cxx33
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx4
-rw-r--r--vbahelper/source/vbahelper/makefile.mk2
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx111
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx53
-rwxr-xr-xvbahelper/source/vbahelper/vbaeventshelperbase.cxx218
-rw-r--r--vbahelper/source/vbahelper/vbaglobalbase.cxx59
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx22
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx3
-rw-r--r--xmloff/source/core/xmltoken.cxx3
90 files changed, 2526 insertions, 588 deletions
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index 7f401ef69f..15afc1f40f 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -28,10 +28,12 @@
#ifndef _SB_SBMOD_HXX
#define _SB_SBMOD_HXX
+#include <com/sun/star/script/XInvocation.hpp>
#include <basic/sbdef.hxx>
#include <basic/sbxobj.hxx>
#include <basic/sbxdef.hxx>
#include <rtl/ustring.hxx>
+#include <vector>
class SbMethod;
class SbProperty;
@@ -55,8 +57,10 @@ class SbModule : public SbxObject
friend class SbClassModuleObject;
SbModuleImpl* mpSbModuleImpl; // Impl data
+ std::vector< String > mModuleVariableNames;
protected:
+ com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
::rtl::OUString aOUSource;
String aComment;
SbiImage* pImage; // the Image
@@ -131,6 +135,9 @@ public:
INT32 GetModuleType() { return mnType; }
void SetModuleType( INT32 nType ) { mnType = nType; }
bool GetIsProxyModule() { return bIsProxyModule; }
+ void AddVarName( const String& aName );
+ void RemoveVars();
+ ::com::sun::star::uno::Reference< ::com::sun::star::script::XInvocation > GetUnoModule();
bool createCOMWrapperForIface( ::com::sun::star::uno::Any& o_rRetAny, SbClassModuleObject* pProxyClassModuleObject );
};
diff --git a/basic/inc/basic/sbobjmod.hxx b/basic/inc/basic/sbobjmod.hxx
index 3d638a475f..9ff46d1931 100644
--- a/basic/inc/basic/sbobjmod.hxx
+++ b/basic/inc/basic/sbobjmod.hxx
@@ -36,6 +36,7 @@
#ifndef _SB_OBJMOD_HXX
#define _SB_OBJMOD_HXX
+#include <rtl/ref.hxx>
#include <basic/sbmod.hxx>
#include <basic/sbstar.hxx>
#include <com/sun/star/script/ModuleInfo.hpp>
@@ -60,10 +61,12 @@ public:
void SetUnoObject( const com::sun::star::uno::Any& aObj )throw ( com::sun::star::uno::RuntimeException ) ;
};
+class FormObjEventListenerImpl;
+
class SbUserFormModule : public SbObjModule
{
com::sun::star::script::ModuleInfo m_mInfo;
- css::uno::Reference<css::lang::XEventListener> m_DialogListener;
+ ::rtl::Reference< FormObjEventListenerImpl > m_DialogListener;
css::uno::Reference<css::awt::XDialog> m_xDialog;
css::uno::Reference<css::frame::XModel> m_xModel;
String sFormName;
@@ -76,16 +79,19 @@ class SbUserFormModule : public SbObjModule
public:
TYPEINFO();
SbUserFormModule( const String& rName, const com::sun::star::script::ModuleInfo& mInfo, bool bIsVBACompat );
+ virtual ~SbUserFormModule();
virtual SbxVariable* Find( const XubString& rName, SbxClassType t );
void ResetApiObj();
void Unload();
- void load();
+ void Load();
void triggerMethod( const String& );
void triggerMethod( const String&, css::uno::Sequence< css::uno::Any >& );
void triggerActivateEvent();
- void triggerDeActivateEvent();
+ void triggerDeactivateEvent();
void triggerInitializeEvent();
void triggerTerminateEvent();
+ void triggerLayoutEvent();
+ void triggerResizeEvent();
class SbUserFormModuleInstance* CreateInstance();
};
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 247a833b3e..b2e0f58c05 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -67,8 +67,8 @@
#include <com/sun/star/script/XStarBasicLibraryInfo.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/ModuleInfo.hpp>
-#include <com/sun/star/script/XVBAModuleInfo.hpp>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <cppuhelper/implbase1.hxx>
@@ -240,7 +240,7 @@ void BasMgrContainerListenerImpl::addLibraryModulesImpl( BasicManager* pMgr,
Any aElement = xLibNameAccess->getByName( aModuleName );
::rtl::OUString aMod;
aElement >>= aMod;
- Reference< XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
+ Reference< vba::XVBAModuleInfo > xVBAModuleInfo( xLibNameAccess, UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aModuleName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aModuleName );
@@ -285,9 +285,9 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
StarBASIC* pLib = mpMgr->GetLib( aName );
if ( pLib )
{
- Reference<XVBACompat> xVBACompat( xScriptCont, UNO_QUERY );
+ Reference< vba::XVBACompatibility > xVBACompat( xScriptCont, UNO_QUERY );
if ( xVBACompat.is() )
- pLib->SetVBAEnabled( xVBACompat->getVBACompatModeOn() );
+ pLib->SetVBAEnabled( xVBACompat->getVBACompatibilityMode() );
}
}
else
@@ -302,7 +302,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementInserted( const ContainerEvent
{
::rtl::OUString aMod;
Event.Element >>= aMod;
- Reference< XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
+ Reference< vba::XVBAModuleInfo > xVBAModuleInfo( Event.Source, UNO_QUERY );
if ( xVBAModuleInfo.is() && xVBAModuleInfo->hasModuleInfo( aName ) )
{
ModuleInfo mInfo = xVBAModuleInfo->getModuleInfo( aName );
diff --git a/basic/source/classes/disas.cxx b/basic/source/classes/disas.cxx
index 82f3c08d61..f6402a8f45 100644
--- a/basic/source/classes/disas.cxx
+++ b/basic/source/classes/disas.cxx
@@ -35,6 +35,7 @@
#include "sb.hxx"
#include "iosys.hxx"
#include "disas.hxx"
+#include "sbtrace.hxx"
static const char* pOp1[] = {
@@ -153,6 +154,7 @@ static const char* pOp3[] = {
"DCREATE_REDIMP", // Change dimensions of a user defined Object-Array (+StringId+StringId)
"FIND_CM", // Search inside a class module (CM) to enable global search in time
"PUBLIC_P", // Module global Variable (persisted between calls)(+StringID+Typ)
+ "FIND_STATIC", // local static var lookup (+StringID+Typ)
};
static const char** pOps[3] = { pOp1, pOp2, pOp3 };
@@ -220,6 +222,7 @@ static const Func pOperand3[] = {
&SbiDisas::Str2Op, // Redimensionate User defined Object-Array (+StringId+StringId)
&SbiDisas::VarOp, // FIND_CM
&SbiDisas::VarDefOp, // PUBLIC_P
+ &SbiDisas::VarOp, // FIND_STATIC
};
// TODO: Why as method? Isn't a simple define sufficient?
@@ -359,6 +362,11 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.Erase();
if( !Fetch() )
return FALSE;
+
+#ifdef DBG_TRACE_BASIC
+ String aTraceStr_STMNT;
+#endif
+
// New line?
if( eOp == _STMNT && nOp1 != nLine )
{
@@ -391,8 +399,13 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.AppendAscii( "; " );
rText += s;
rText.AppendAscii( _crlf() );
+
+#ifdef DBG_TRACE_BASIC
+ aTraceStr_STMNT = s;
+#endif
}
}
+
// Label?
const char* p = "";
if( cLabels[ nPC >> 3 ] & ( 1 << ( nPC & 7 ) ) )
@@ -430,20 +443,29 @@ BOOL SbiDisas::DisasLine( String& rText )
rText.AppendAscii( _crlf() );
}
snprintf( cBuf, sizeof(cBuf), pMask[ nParts ], nPC, (USHORT) eOp, nOp1, nOp2 );
- rText.AppendAscii( cBuf );
+
+ String aPCodeStr;
+ aPCodeStr.AppendAscii( cBuf );
int n = eOp;
if( eOp >= SbOP2_START )
n -= SbOP2_START;
else if( eOp >= SbOP1_START )
n -= SbOP1_START;
- rText += '\t';
- rText.AppendAscii( pOps[ nParts-1 ][ n ] );
- rText += '\t';
+ aPCodeStr += '\t';
+ aPCodeStr.AppendAscii( pOps[ nParts-1 ][ n ] );
+ aPCodeStr += '\t';
switch( nParts )
{
- case 2: (this->*( pOperand2[ n ] ) )( rText ); break;
- case 3: (this->*( pOperand3[ n ] ) )( rText ); break;
+ case 2: (this->*( pOperand2[ n ] ) )( aPCodeStr ); break;
+ case 3: (this->*( pOperand3[ n ] ) )( aPCodeStr ); break;
}
+
+ rText += aPCodeStr;
+
+#ifdef DBG_TRACE_BASIC
+ dbg_RegisterTraceTextForPC( pMod, nPC, aTraceStr_STMNT, aPCodeStr );
+#endif
+
return TRUE;
}
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 9be441e011..df5bd58e90 100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -339,27 +339,18 @@ SbxBase* SbFormFactory::Create( UINT16, UINT32 )
SbxObject* SbFormFactory::CreateObject( const String& rClassName )
{
- static String aLoadMethodName( RTL_CONSTASCII_USTRINGPARAM("load") );
-
- SbxObject* pRet = NULL;
- SbModule* pMod = pMOD;
- if( pMod )
+ if( SbModule* pMod = pMOD )
{
- SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT );
- if( pVar )
+ if( SbxVariable* pVar = pMod->Find( rClassName, SbxCLASS_OBJECT ) )
{
- SbxBase* pObj = pVar->GetObject();
- SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pObj );
-
- if( pFormModule != NULL )
+ if( SbUserFormModule* pFormModule = PTR_CAST( SbUserFormModule, pVar->GetObject() ) )
{
- pFormModule->load();
- SbUserFormModuleInstance* pFormInstance = pFormModule->CreateInstance();
- pRet = pFormInstance;
+ pFormModule->Load();
+ return pFormModule->CreateInstance();
}
}
}
- return pRet;
+ return 0;
}
@@ -569,11 +560,13 @@ SbClassModuleObject::SbClassModuleObject( SbModule* pClassModule )
}
}
SetModuleType( ModuleType::CLASS );
+ mbVBACompat = pClassModule->mbVBACompat;
}
SbClassModuleObject::~SbClassModuleObject()
{
- triggerTerminateEvent();
+ if( StarBASIC::IsRunning() )
+ triggerTerminateEvent();
// Must be deleted by base class dtor because this data
// is not owned by the SbClassModuleObject object
@@ -606,7 +599,28 @@ void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType
{
SbxValues aVals;
aVals.eType = SbxVARIANT;
- pMeth->Get( aVals );
+
+ 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 );
}
}
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index 291aaa4f7d..1a9e046aa1 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -911,7 +911,7 @@ Type getUnoTypeForSbxBaseType( SbxDataType eType )
case SbxVARIANT: aRetType = ::getCppuType( (Any*)0 ); break;
//case SbxDATAOBJECT: break;
case SbxCHAR: aRetType = ::getCppuType( (sal_Unicode*)0 ); break;
- case SbxBYTE: aRetType = ::getCppuType( (sal_Int16*)0 ); break;
+ case SbxBYTE: aRetType = ::getCppuType( (sal_Int8*)0 ); break;
case SbxUSHORT: aRetType = ::getCppuType( (sal_uInt16*)0 ); break;
case SbxULONG: aRetType = ::getCppuType( (sal_uInt32*)0 ); break;
//case SbxLONG64: break;
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 79ab2071c3..834d7316a2 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -45,6 +45,7 @@
#include "runtime.hxx"
#include "token.hxx"
#include "sbunoobj.hxx"
+#include "sbtrace.hxx"
//#include <basic/hilight.hxx>
@@ -53,9 +54,10 @@
#include <basic/basrdll.hxx>
#include <vos/mutex.hxx>
#include <basic/sbobjmod.hxx>
+#include <cppuhelper/implbase2.hxx>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using namespace com::sun::star;
@@ -76,15 +78,362 @@ using namespace com::sun::star;
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <comphelper/processfactory.hxx>
#include <vcl/svapp.hxx>
+#include <map>
+#include <com/sun/star/reflection/XProxyFactory.hpp>
+#include <cppuhelper/implbase1.hxx>
+#include <basic/sbobjmod.hxx>
+#include <com/sun/star/uno/XAggregation.hpp>
+#include <map>
+#include <com/sun/star/script/XInvocation.hpp>
+
using namespace ::com::sun::star;
+using namespace com::sun::star::lang;
+using namespace com::sun::star::reflection;
+using namespace com::sun::star::beans;
+using namespace com::sun::star::script;
+
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/awt/XDialogProvider.hpp>
#include <com/sun/star/awt/XTopWindow.hpp>
+#include <com/sun/star/awt/XWindow.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <cppuhelper/implbase1.hxx>
#include <comphelper/anytostring.hxx>
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+typedef ::cppu::WeakImplHelper1< XInvocation > DocObjectWrapper_BASE;
+typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
+::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
+void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
+
+class DocObjectWrapper : public DocObjectWrapper_BASE
+{
+ Reference< XAggregation > m_xAggProxy;
+ Reference< XInvocation > m_xAggInv;
+ Reference< XTypeProvider > m_xAggregateTypeProv;
+ Sequence< Type > m_Types;
+ SbModule* m_pMod;
+ SbMethodRef getMethod( const rtl::OUString& aName ) throw (RuntimeException);
+ SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
+ String mName; // for debugging
+
+public:
+ DocObjectWrapper( SbModule* pMod );
+ virtual ~DocObjectWrapper();
+
+ virtual void SAL_CALL acquire() throw();
+ virtual void SAL_CALL release() throw();
+
+ virtual Sequence< sal_Int8 > SAL_CALL getImplementationId() throw (RuntimeException)
+ {
+ if( !m_xAggregateTypeProv.is() )
+ throw RuntimeException();
+ return m_xAggregateTypeProv->getImplementationId();
+ }
+
+ virtual Reference< XIntrospectionAccess > SAL_CALL getIntrospection( ) throw (RuntimeException);
+
+ virtual Any SAL_CALL invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual void SAL_CALL setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException);
+ virtual Any SAL_CALL getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
+ virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
+ virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
+
+ virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
+};
+
+DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pVar->GetName() )
+{
+ SbObjModule* pMod = PTR_CAST(SbObjModule,pVar);
+ if ( pMod )
+ {
+ if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
+ {
+ Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
+ // Use proxy factory service to create aggregatable proxy.
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pMod->GetObject() );
+ Reference< XInterface > xIf;
+ if ( pUnoObj )
+ {
+ Any aObj = pUnoObj->getUnoAny();
+ aObj >>= xIf;
+ if ( xIf.is() )
+ {
+ m_xAggregateTypeProv.set( xIf, UNO_QUERY );
+ m_xAggInv.set( xIf, UNO_QUERY );
+ }
+ }
+ if ( xIf.is() )
+ {
+ try
+ {
+ Reference< XMultiComponentFactory > xMFac( xFactory, UNO_QUERY_THROW );
+ Reference< XPropertySet> xPSMPropertySet( xMFac, UNO_QUERY_THROW );
+ Reference< XComponentContext > xCtx;
+ xPSMPropertySet->getPropertyValue(
+ String( RTL_CONSTASCII_USTRINGPARAM("DefaultContext") ) ) >>= xCtx;
+ Reference< XProxyFactory > xProxyFac( xMFac->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.reflection.ProxyFactory" ) ), xCtx ), UNO_QUERY_THROW );
+ m_xAggProxy = xProxyFac->createProxy( xIf );
+ }
+ catch( Exception& )
+ {
+ OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
+ }
+ }
+
+ if ( m_xAggProxy.is() )
+ {
+ osl_incrementInterlockedCount( &m_refCount );
+
+ /* i35609 - Fix crash on Solaris. The setDelegator call needs
+ to be in its own block to ensure that all temporary Reference
+ instances that are acquired during the call are released
+ before m_refCount is decremented again */
+ {
+ m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
+ }
+
+ osl_decrementInterlockedCount( &m_refCount );
+ }
+ }
+ }
+}
+
+void SAL_CALL
+DocObjectWrapper::acquire() throw ()
+{
+ osl_incrementInterlockedCount( &m_refCount );
+ OSL_TRACE("DocObjectWrapper::acquire(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+}
+void SAL_CALL
+DocObjectWrapper::release() throw ()
+{
+ if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
+ {
+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+ delete this;
+ }
+ else
+ OSL_TRACE("DocObjectWrapper::release(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
+}
+
+DocObjectWrapper::~DocObjectWrapper()
+{
+}
+
+Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
+ throw ( RuntimeException )
+{
+ if ( m_Types.getLength() == 0 )
+ {
+ Sequence< Type > sTypes;
+ if ( m_xAggregateTypeProv.is() )
+ sTypes = m_xAggregateTypeProv->getTypes();
+ m_Types.realloc( sTypes.getLength() + 1 );
+ Type* pPtr = m_Types.getArray();
+ for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
+ {
+ if ( i == 0 )
+ *pPtr = XInvocation::static_type( NULL );
+ else
+ *pPtr = sTypes[ i - 1 ];
+ }
+ }
+ return m_Types;
+}
+
+Reference< XIntrospectionAccess > SAL_CALL
+DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
+{
+ return NULL;
+}
+
+Any SAL_CALL
+DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
+ return m_xAggInv->invoke( aFunctionName, aParams, aOutParamIndex, aOutParam );
+ SbMethodRef pMethod = getMethod( aFunctionName );
+ if ( !pMethod )
+ throw RuntimeException();
+ // check number of parameters
+ sal_Int32 nParamsCount = aParams.getLength();
+ SbxInfo* pInfo = pMethod->GetInfo();
+ if ( pInfo )
+ {
+ sal_Int32 nSbxOptional = 0;
+ USHORT n = 1;
+ for ( const SbxParamInfo* pParamInfo = pInfo->GetParam( n ); pParamInfo; pParamInfo = pInfo->GetParam( ++n ) )
+ {
+ if ( ( pParamInfo->nFlags & SBX_OPTIONAL ) != 0 )
+ ++nSbxOptional;
+ else
+ nSbxOptional = 0;
+ }
+ sal_Int32 nSbxCount = n - 1;
+ if ( nParamsCount < nSbxCount - nSbxOptional )
+ {
+ throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "wrong number of parameters!" ) ), Reference< XInterface >() );
+ }
+ }
+ // set parameters
+ SbxArrayRef xSbxParams;
+ if ( nParamsCount > 0 )
+ {
+ xSbxParams = new SbxArray;
+ const Any* pParams = aParams.getConstArray();
+ for ( sal_Int32 i = 0; i < nParamsCount; ++i )
+ {
+ SbxVariableRef xSbxVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( static_cast< SbxVariable* >( xSbxVar ), pParams[i] );
+ xSbxParams->Put( xSbxVar, static_cast< USHORT >( i ) + 1 );
+
+ // Enable passing by ref
+ if ( xSbxVar->GetType() != SbxVARIANT )
+ xSbxVar->SetFlag( SBX_FIXED );
+ }
+ }
+ if ( xSbxParams.Is() )
+ pMethod->SetParameters( xSbxParams );
+
+ // call method
+ SbxVariableRef xReturn = new SbxVariable;
+ ErrCode nErr = SbxERR_OK;
+
+ nErr = pMethod->Call( xReturn );
+ Any aReturn;
+ // get output parameters
+ if ( xSbxParams.Is() )
+ {
+ SbxInfo* pInfo_ = pMethod->GetInfo();
+ if ( pInfo_ )
+ {
+ OutParamMap aOutParamMap;
+ for ( USHORT n = 1, nCount = xSbxParams->Count(); n < nCount; ++n )
+ {
+ const SbxParamInfo* pParamInfo = pInfo_->GetParam( n );
+ if ( pParamInfo && ( pParamInfo->eType & SbxBYREF ) != 0 )
+ {
+ SbxVariable* pVar = xSbxParams->Get( n );
+ if ( pVar )
+ {
+ SbxVariableRef xVar = pVar;
+ aOutParamMap.insert( OutParamMap::value_type( n - 1, sbxToUnoValue( xVar ) ) );
+ }
+ }
+ }
+ sal_Int32 nOutParamCount = aOutParamMap.size();
+ aOutParamIndex.realloc( nOutParamCount );
+ aOutParam.realloc( nOutParamCount );
+ sal_Int16* pOutParamIndex = aOutParamIndex.getArray();
+ Any* pOutParam = aOutParam.getArray();
+ for ( OutParamMap::iterator aIt = aOutParamMap.begin(); aIt != aOutParamMap.end(); ++aIt, ++pOutParamIndex, ++pOutParam )
+ {
+ *pOutParamIndex = aIt->first;
+ *pOutParam = aIt->second;
+ }
+ }
+ }
+
+ // get return value
+ aReturn = sbxToUnoValue( xReturn );
+
+ pMethod->SetParameters( NULL );
+
+ return aReturn;
+}
+
+void SAL_CALL
+DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
+ return m_xAggInv->setValue( aPropertyName, aValue );
+
+ SbPropertyRef pProperty = getProperty( aPropertyName );
+ if ( !pProperty.Is() )
+ throw UnknownPropertyException();
+ unoToSbxValue( (SbxVariable*) pProperty, aValue );
+}
+
+Any SAL_CALL
+DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
+ return m_xAggInv->getValue( aPropertyName );
+
+ SbPropertyRef pProperty = getProperty( aPropertyName );
+ if ( !pProperty.Is() )
+ throw UnknownPropertyException();
+
+ SbxVariable* pProp = ( SbxVariable* ) pProperty;
+ if ( pProp->GetType() == SbxEMPTY )
+ pProperty->Broadcast( SBX_HINT_DATAWANTED );
+
+ Any aRet = sbxToUnoValue( pProp );
+ return aRet;
+}
+
+::sal_Bool SAL_CALL
+DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
+{
+ if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
+ return sal_True;
+ return getMethod( aName ).Is();
+}
+
+::sal_Bool SAL_CALL
+DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
+{
+ sal_Bool bRes = sal_False;
+ if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
+ bRes = sal_True;
+ else bRes = getProperty( aName ).Is();
+ return bRes;
+}
+
+Any SAL_CALL DocObjectWrapper::queryInterface( const Type& aType )
+ throw ( RuntimeException )
+{
+ Any aRet = DocObjectWrapper_BASE::queryInterface( aType );
+ if ( aRet.hasValue() )
+ return aRet;
+ else if ( m_xAggProxy.is() )
+ aRet = m_xAggProxy->queryAggregation( aType );
+ return aRet;
+}
+
+SbMethodRef DocObjectWrapper::getMethod( const rtl::OUString& aName ) throw (RuntimeException)
+{
+ SbMethodRef pMethod = NULL;
+ if ( m_pMod )
+ {
+ USHORT nSaveFlgs = m_pMod->GetFlags();
+ // Limit search to this module
+ m_pMod->ResetFlag( SBX_GBLSEARCH );
+ pMethod = (SbMethod*) m_pMod->SbModule::Find( aName, SbxCLASS_METHOD );
+ m_pMod->SetFlags( nSaveFlgs );
+ }
+
+ return pMethod;
+}
+
+SbPropertyRef DocObjectWrapper::getProperty( const rtl::OUString& aName ) throw (RuntimeException)
+{
+ SbPropertyRef pProperty = NULL;
+ if ( m_pMod )
+ {
+ USHORT nSaveFlgs = m_pMod->GetFlags();
+ // Limit search to this module.
+ m_pMod->ResetFlag( SBX_GBLSEARCH );
+ pProperty = (SbProperty*)m_pMod->SbModule::Find( aName, SbxCLASS_PROPERTY );
+ m_pMod->SetFlag( nSaveFlgs );
+ }
+
+ return pProperty;
+}
TYPEINIT1(SbModule,SbxObject)
TYPEINIT1(SbMethod,SbxMethod)
@@ -112,9 +461,9 @@ bool getDefaultVBAMode( StarBASIC* pb )
uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
if ( xProp.is() )
{
- uno::Reference< script::XVBACompat > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
+ uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
if ( xVBAMode.is() )
- bResult = ( xVBAMode->getVBACompatModeOn() == sal_True );
+ bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
}
}
}
@@ -199,12 +548,24 @@ SbModule::SbModule( const String& rName, BOOL bVBACompat )
SbModule::~SbModule()
{
+ OSL_TRACE("Module named %s is destructing", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
if( pImage )
delete pImage;
if( pBreaks )
delete pBreaks;
if( pClassData )
delete pClassData;
+ mxWrapper = NULL;
+}
+
+uno::Reference< script::XInvocation >
+SbModule::GetUnoModule()
+{
+ if ( !mxWrapper.is() )
+ mxWrapper = new DocObjectWrapper( this );
+
+ OSL_TRACE("Module named %s returning wrapper mxWrapper (0x%x)", rtl::OUStringToOString( GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mxWrapper.get() );
+ return mxWrapper;
}
BOOL SbModule::IsCompiled() const
@@ -684,6 +1045,9 @@ USHORT SbModule::Run( SbMethod* pMeth )
StarBASICRef xBasic;
if( bDelInst )
{
+#ifdef DBG_TRACE_BASIC
+ dbg_InitTrace();
+#endif
// #32779: Basic waehrend der Ausfuehrung festhalten
xBasic = (StarBASIC*) GetParent();
@@ -762,18 +1126,28 @@ USHORT SbModule::Run( SbMethod* pMeth )
SbModule* pOldMod = pMOD;
pMOD = this;
SbiRuntime* pRt = new SbiRuntime( this, pMeth, pMeth->nStart );
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl );
+#endif
+
pRt->pNext = pINST->pRun;
if( pRt->pNext )
pRt->pNext->block();
pINST->pRun = pRt;
if ( mbVBACompat )
- {
+ {
pINST->EnableCompatibility( TRUE );
- }
+ }
while( pRt->Step() ) {}
if( pRt->pNext )
pRt->pNext->unblock();
+#ifdef DBG_TRACE_BASIC
+ bool bLeave = true;
+ dbg_traceNotifyCall( this, pMeth, pINST->nCallLvl, bLeave );
+#endif
+
// #63710 Durch ein anderes Thread-Handling bei Events kann es passieren,
// dass show-Aufruf an einem Dialog zurueckkehrt (durch schliessen des
// Dialogs per UI), BEVOR ein per Event ausgeloester weitergehender Call,
@@ -867,9 +1241,20 @@ void SbModule::RunInit()
pMOD = this;
// Der Init-Code beginnt immer hier
SbiRuntime* pRt = new SbiRuntime( this, NULL, 0 );
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyCall( this, NULL, 0 );
+#endif
+
pRt->pNext = pINST->pRun;
pINST->pRun = pRt;
while( pRt->Step() ) {}
+
+#ifdef DBG_TRACE_BASIC
+ bool bLeave = true;
+ dbg_traceNotifyCall( this, NULL, 0, bLeave );
+#endif
+
pINST->pRun = pRt->pNext;
delete pRt;
pMOD = pOldMod;
@@ -884,6 +1269,33 @@ void SbModule::RunInit()
}
// Mit private/dim deklarierte Variablen loeschen
+
+void SbModule::AddVarName( const String& aName )
+{
+ // see if the name is added allready
+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ {
+ if ( aName == *it )
+ return;
+ }
+ mModuleVariableNames.push_back( aName );
+}
+
+void SbModule::RemoveVars()
+{
+ std::vector< String >::iterator it_end = mModuleVariableNames.end();
+ for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
+ {
+ // We don't want a Find being called in a derived class ( e.g.
+ // SbUserform because it could trigger say an initialise event
+ // which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
+ SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
+ if( p.Is() )
+ Remove (p);
+ }
+}
+
void SbModule::ClearPrivateVars()
{
for( USHORT i = 0 ; i < pProps->Count() ; i++ )
@@ -1600,9 +2012,9 @@ SbObjModule::Find( const XubString& rName, SbxClassType t )
return pVar;
}
-typedef ::cppu::WeakImplHelper1< awt::XTopWindowListener > EventListener_BASE;
+typedef ::cppu::WeakImplHelper2< awt::XTopWindowListener, awt::XWindowListener > FormObjEventListener_BASE;
-class FormObjEventListenerImpl : public EventListener_BASE
+class FormObjEventListenerImpl : public FormObjEventListener_BASE
{
SbUserFormModule* mpUserForm;
uno::Reference< lang::XComponent > mxComponent;
@@ -1612,39 +2024,57 @@ class FormObjEventListenerImpl : public EventListener_BASE
sal_Bool mbShowing;
FormObjEventListenerImpl(); // not defined
FormObjEventListenerImpl(const FormObjEventListenerImpl&); // not defined
+
public:
- FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) : mpUserForm( pUserForm ), mxComponent( xComponent) , mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
+ FormObjEventListenerImpl( SbUserFormModule* pUserForm, const uno::Reference< lang::XComponent >& xComponent ) :
+ mpUserForm( pUserForm ), mxComponent( xComponent) ,
+ mbDisposed( false ), mbOpened( sal_False ), mbActivated( sal_False ), mbShowing( sal_False )
{
if ( mxComponent.is() )
{
- uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
- OSL_TRACE("*********** Registering the listener");
- xList->addTopWindowListener( this );
+ OSL_TRACE("*********** Registering the listeners");
+ try
+ {
+ uno::Reference< awt::XTopWindow >( mxComponent, uno::UNO_QUERY_THROW )->addTopWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
+ try
+ {
+ uno::Reference< awt::XWindow >( mxComponent, uno::UNO_QUERY_THROW )->addWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
}
}
- ~FormObjEventListenerImpl()
+ virtual ~FormObjEventListenerImpl()
{
removeListener();
}
- sal_Bool isShowing() { return mbShowing; }
+
+ sal_Bool isShowing() const { return mbShowing; }
+
void removeListener()
{
- try
+ if ( mxComponent.is() && !mbDisposed )
{
- if ( mxComponent.is() && !mbDisposed )
+ OSL_TRACE("*********** Removing the listeners");
+ try
{
- uno::Reference< awt::XTopWindow > xList( mxComponent, uno::UNO_QUERY_THROW );;
- OSL_TRACE("*********** Removing the listener");
- xList->removeTopWindowListener( this );
- mxComponent = NULL;
+ uno::Reference< awt::XTopWindow >( mxComponent, uno::UNO_QUERY_THROW )->removeTopWindowListener( this );
}
+ catch( uno::Exception& ) {}
+ try
+ {
+ uno::Reference< awt::XWindow >( mxComponent, uno::UNO_QUERY_THROW )->removeWindowListener( this );
+ }
+ catch( uno::Exception& ) {}
}
- catch( uno::Exception& ) {}
- }
+ mxComponent.clear();
+ }
+
virtual void SAL_CALL windowOpened( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
+ if ( mpUserForm )
{
mbOpened = sal_True;
mbShowing = sal_True;
@@ -1691,12 +2121,23 @@ public:
}
//liuchen 2009-7-21
- virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) { mbOpened = sal_False; mbShowing = sal_False; }
- virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException) {}
- virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException){}
+ virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ mbOpened = sal_False;
+ mbShowing = sal_False;
+ }
+
+ virtual void SAL_CALL windowMinimized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL windowNormalized( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
virtual void SAL_CALL windowActivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
+ if ( mpUserForm )
{
mbActivated = sal_True;
if ( mbOpened )
@@ -1709,18 +2150,38 @@ public:
virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
- if ( mpUserForm )
- mpUserForm->triggerDeActivateEvent();
+ if ( mpUserForm )
+ mpUserForm->triggerDeactivateEvent();
}
+ virtual void SAL_CALL windowResized( const awt::WindowEvent& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ {
+ mpUserForm->triggerResizeEvent();
+ mpUserForm->triggerLayoutEvent();
+ }
+ }
- virtual void SAL_CALL disposing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+ virtual void SAL_CALL windowMoved( const awt::WindowEvent& /*e*/ ) throw (uno::RuntimeException)
+ {
+ if ( mpUserForm )
+ mpUserForm->triggerLayoutEvent();
+ }
+
+ virtual void SAL_CALL windowShown( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL windowHidden( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ {
+ }
+
+ virtual void SAL_CALL disposing( const lang::EventObject& /*Source*/ ) throw (uno::RuntimeException)
{
OSL_TRACE("** Userform/Dialog disposing");
mbDisposed = true;
- uno::Any aSource;
- aSource <<= Source;
- mxComponent = NULL;
+ mxComponent.clear();
if ( mpUserForm )
mpUserForm->ResetApiObj();
}
@@ -1734,6 +2195,10 @@ SbUserFormModule::SbUserFormModule( const String& rName, const com::sun::star::s
m_xModel.set( mInfo.ModuleObject, uno::UNO_QUERY_THROW );
}
+SbUserFormModule::~SbUserFormModule()
+{
+}
+
void SbUserFormModule::ResetApiObj()
{
if ( m_xDialog.is() ) // probably someone close the dialog window
@@ -1796,23 +2261,22 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
void SbUserFormModule::triggerActivateEvent( void )
{
- OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
- triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_activate") ) );
- OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
+ OSL_TRACE("**** entering SbUserFormModule::triggerActivate");
+ triggerMethod( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm_Activate") ) );
+ OSL_TRACE("**** leaving SbUserFormModule::triggerActivate");
}
-void SbUserFormModule::triggerDeActivateEvent( void )
+void SbUserFormModule::triggerDeactivateEvent( void )
{
- OSL_TRACE("**** SbUserFormModule::triggerDeActivate");
- triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_DeActivate") ) );
+ OSL_TRACE("**** SbUserFormModule::triggerDeactivate");
+ triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_Deactivate") ) );
}
void SbUserFormModule::triggerInitializeEvent( void )
-
{
if ( mbInit )
return;
- OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
+ OSL_TRACE("**** SbUserFormModule::triggerInitializeEvent");
static String aInitMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Initialize") );
triggerMethod( aInitMethodName );
mbInit = true;
@@ -1820,12 +2284,24 @@ void SbUserFormModule::triggerInitializeEvent( void )
void SbUserFormModule::triggerTerminateEvent( void )
{
- OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
+ OSL_TRACE("**** SbUserFormModule::triggerTerminateEvent");
static String aTermMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Terminate") );
triggerMethod( aTermMethodName );
mbInit=false;
}
+void SbUserFormModule::triggerLayoutEvent( void )
+{
+ static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Layout") );
+ triggerMethod( aMethodName );
+}
+
+void SbUserFormModule::triggerResizeEvent( void )
+{
+ static String aMethodName( RTL_CONSTASCII_USTRINGPARAM("Userform_Resize") );
+ triggerMethod( aMethodName );
+}
+
SbUserFormModuleInstance* SbUserFormModule::CreateInstance()
{
SbUserFormModuleInstance* pInstance = new SbUserFormModuleInstance( this, GetName(), m_mInfo, IsVBACompat() );
@@ -1853,7 +2329,7 @@ SbxVariable* SbUserFormModuleInstance::Find( const XubString& rName, SbxClassTyp
}
-void SbUserFormModule::load()
+void SbUserFormModule::Load()
{
OSL_TRACE("** load() ");
// forces a load
@@ -1891,21 +2367,20 @@ void SbUserFormModule::Unload()
if( pMeth )
{
OSL_TRACE("Attempting too run the UnloadObjectMethod");
- m_xDialog = NULL; //release ref to the uno object
+ m_xDialog.clear(); //release ref to the uno object
SbxValues aVals;
- FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
bool bWaitForDispose = true; // assume dialog is showing
- if ( pFormListener )
+ if ( m_DialogListener.get() )
{
- bWaitForDispose = pFormListener->isShowing();
+ bWaitForDispose = m_DialogListener->isShowing();
OSL_TRACE("Showing %d", bWaitForDispose );
}
pMeth->Get( aVals);
- if ( !bWaitForDispose )
- {
- // we've either already got a dispose or we'er never going to get one
+ if ( !bWaitForDispose )
+ {
+ // we've either already got a dispose or we'er never going to get one
ResetApiObj();
- } // else wait for dispose
+ } // else wait for dispose
OSL_TRACE("UnloadObject completed ( we hope )");
}
}
@@ -1943,13 +2418,12 @@ void SbUserFormModule::InitObject()
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 );
// remove old listener if it exists
- FormObjEventListenerImpl* pFormListener = dynamic_cast< FormObjEventListenerImpl* >( m_DialogListener.get() );
- if ( pFormListener )
- pFormListener->removeListener();
+ if ( m_DialogListener.get() )
+ m_DialogListener->removeListener();
m_DialogListener = new FormObjEventListenerImpl( this, xComponent );
triggerInitializeEvent();
- }
+ }
}
catch( uno::Exception& )
{
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 604ac61745..389b9e49c2 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -1009,13 +1009,8 @@ SbiParameters::SbiParameters( SbiParser* p, BOOL bStandaloneExpression, BOOL bPa
else
pExpr = new SbiExpression( pParser );
- if( bByVal )
- {
- if( !pExpr->IsLvalue() )
- pParser->Error( SbERR_LVALUE_EXPECTED );
- else
- pExpr->SetByVal();
- }
+ if( bByVal && pExpr->IsLvalue() )
+ pExpr->SetByVal();
//pExpr = bConst ? new SbiConstExpression( pParser )
// : new SbiExpression( pParser );
diff --git a/basic/source/comp/sbcomp.cxx b/basic/source/comp/sbcomp.cxx
index c91624de5e..b1769343bb 100644..100755
--- a/basic/source/comp/sbcomp.cxx
+++ b/basic/source/comp/sbcomp.cxx
@@ -22,7 +22,7 @@
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
- *
+ *
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
@@ -31,10 +31,310 @@
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
#include "image.hxx"
+#include "sbtrace.hxx"
+
+
+//==========================================================================
+// Tracing, for debugging only
+
+// To activate tracing enable in sbtrace.hxx
+#ifdef DBG_TRACE_BASIC
+
+#include <hash_map>
+
+// Trace Settings
+static const char* GpTraceFileName = "d:\\zBasic.Asm\\BasicTrace.txt";
+static const bool GbIncludePCodes = false;
+static const int GnIndentPerCallLevel = 4;
+static const int GnIndentForPCode = 2;
+
+struct TraceTextData
+{
+ rtl::OString m_aTraceStr_STMNT;
+ rtl::OString m_aTraceStr_PCode;
+};
+typedef std::hash_map< sal_Int32, TraceTextData > PCToTextDataMap;
+typedef std::hash_map< ::rtl::OUString, PCToTextDataMap*, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleTraceMap;
+
+ModuleTraceMap GaModuleTraceMap;
+ModuleTraceMap& rModuleTraceMap = GaModuleTraceMap;
+
+static void lcl_PrepareTraceForModule( SbModule* pModule )
+{
+ String aModuleName = pModule->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ if( it != rModuleTraceMap.end() )
+ {
+ PCToTextDataMap* pInnerMap = it->second;
+ delete pInnerMap;
+ rModuleTraceMap.erase( it );
+ }
+
+ String aDisassemblyStr;
+ pModule->Disassemble( aDisassemblyStr );
+}
+
+static void lcl_lineOut( const char* pFileName, const char* pStr, const char* pPreStr = NULL )
+{
+ const char* pPrintFirst = (pPreStr != NULL) ? pPreStr : "";
+ FILE* pFile = fopen( pFileName, "a+" );
+ if( pFile != NULL )
+ {
+ fprintf( pFile, "%s%s\n", pPrintFirst, pStr );
+ fclose( pFile );
+ }
+}
+
+const char* lcl_getSpaces( int nSpaceCount )
+{
+ static sal_Char Spaces[] = " "
+ " "
+ " ";
+ static int nAvailableSpaceCount = strlen( Spaces );
+ static sal_Char* pSpacesEnd = Spaces + nAvailableSpaceCount;
+
+ if( nSpaceCount > nAvailableSpaceCount )
+ nSpaceCount = nAvailableSpaceCount;
+
+ return pSpacesEnd - nSpaceCount;
+}
+
+static rtl::OString lcl_toOStringSkipLeadingWhites( const String& aStr )
+{
+ static sal_Char Buffer[1000];
+
+ rtl::OString aOStr = OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US );
+ const sal_Char* pStr = aOStr.getStr();
+ // Skip whitespace
+ sal_Char c = *pStr;
+ while( c == ' ' || c == '\t' )
+ {
+ pStr++;
+ c = *pStr;
+ }
+
+ int nLen = strlen( pStr );
+ strncpy( Buffer, pStr, nLen );
+ Buffer[nLen] = 0;
+
+ rtl::OString aORetStr( Buffer );
+ return aORetStr;
+}
+
+String dumpMethodParameters( SbMethod* pMethod )
+{
+ String aStr;
+ if( pMethod == NULL )
+ return aStr;
+
+ SbxError eOld = SbxBase::GetError();
+
+ SbxArray* pParams = pMethod->GetParameters();
+ SbxInfo* pInfo = pMethod->GetInfo();
+ if ( pParams )
+ {
+ aStr += '(';
+ // 0 is sub itself
+ for ( USHORT nParam = 1; nParam < pParams->Count(); nParam++ )
+ {
+ SbxVariable* pVar = pParams->Get( nParam );
+ DBG_ASSERT( pVar, "Parameter?!" );
+ if ( pVar->GetName().Len() )
+ aStr += pVar->GetName();
+ else if ( pInfo )
+ {
+ const SbxParamInfo* pParam = pInfo->GetParam( nParam );
+ if ( pParam )
+ aStr += pParam->aName;
+ }
+ aStr += '=';
+ if( pVar->GetType() & SbxARRAY )
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( "..." ) );
+ else
+ aStr += pVar->GetString();
+ if ( nParam < ( pParams->Count() - 1 ) )
+ aStr += String( RTL_CONSTASCII_USTRINGPARAM( ", " ) );
+ }
+ aStr += ')';
+ }
+
+ SbxBase::ResetError();
+ if( eOld != SbxERR_OK )
+ SbxBase::SetError( eOld );
+
+ return aStr;
+}
+
+// Public functions
+void dbg_InitTrace( void )
+{
+ FILE* pFile = fopen( GpTraceFileName, "w" );
+ if( pFile != NULL )
+ fclose( pFile );
+}
+
+void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl )
+{
+ SbModule* pTraceMod = pModule;
+ if( pTraceMod->ISA(SbClassModuleObject) )
+ {
+ SbClassModuleObject* pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
+ pTraceMod = pClassModuleObj->getClassModule();
+ }
+
+ String aModuleName = pTraceMod->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ if( it == rModuleTraceMap.end() )
+ {
+ const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
+ char Buffer[200];
+ sprintf( Buffer, "TRACE ERROR: Unknown module \"%s\"", pModuleNameStr );
+ lcl_lineOut( GpTraceFileName, Buffer );
+ return;
+ }
+ PCToTextDataMap* pInnerMap = it->second;
+ if( pInnerMap == NULL )
+ {
+ lcl_lineOut( GpTraceFileName, "TRACE INTERNAL ERROR: No inner map" );
+ return;
+ }
+
+ PCToTextDataMap::iterator itInner = pInnerMap->find( nPC );
+ if( itInner == pInnerMap->end() )
+ {
+ const char* pModuleNameStr = OUStringToOString( rtl::OUString( aModuleName ), RTL_TEXTENCODING_ASCII_US ).getStr();
+ char Buffer[200];
+ sprintf( Buffer, "TRACE ERROR: No info for PC = %d in module \"%s\"", nPC, pModuleNameStr );
+ lcl_lineOut( GpTraceFileName, Buffer );
+ return;
+ }
+
+ //nCallLvl--;
+ //if( nCallLvl < 0 )
+ // nCallLvl = 0;
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+
+ const TraceTextData& rTraceTextData = itInner->second;
+ const rtl::OString& rStr_STMNT = rTraceTextData.m_aTraceStr_STMNT;
+ if( rStr_STMNT.getLength() )
+ lcl_lineOut( GpTraceFileName, rStr_STMNT.getStr(), lcl_getSpaces( nIndent ) );
+
+ if( !GbIncludePCodes )
+ return;
+
+ nIndent += GnIndentForPCode;
+ const rtl::OString& rStr_PCode = rTraceTextData.m_aTraceStr_PCode;
+ if( rStr_PCode.getLength() )
+ lcl_lineOut( GpTraceFileName, rStr_PCode.getStr(), lcl_getSpaces( nIndent ) );
+}
+
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave )
+{
+ static const char* pSeparator = "' ================================================================================";
+
+ SbModule* pTraceMod = pModule;
+ SbClassModuleObject* pClassModuleObj = NULL;
+ if( pTraceMod->ISA(SbClassModuleObject) )
+ {
+ pClassModuleObj = (SbClassModuleObject*)(SbxBase*)pTraceMod;
+ pTraceMod = pClassModuleObj->getClassModule();
+ }
+
+ if( nCallLvl > 0 )
+ nCallLvl--;
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ if( !bLeave )
+ {
+ lcl_lineOut( GpTraceFileName, "" );
+ lcl_lineOut( GpTraceFileName, pSeparator, lcl_getSpaces( nIndent ) );
+ }
+
+ String aStr;
+ if( bLeave )
+ {
+ lcl_lineOut( GpTraceFileName, "}", lcl_getSpaces( nIndent ) );
+ aStr.AppendAscii( "' Leaving " );
+ }
+ else
+ {
+ aStr.AppendAscii( "Entering " );
+ }
+ String aModuleName = pModule->GetName();
+ aStr += aModuleName;
+ if( pMethod != NULL )
+ {
+ aStr.AppendAscii( "::" );
+ String aMethodName = pMethod->GetName();
+ aStr += aMethodName;
+ }
+ else
+ {
+ aStr.AppendAscii( "/RunInit" );
+ }
+
+ if( pClassModuleObj != NULL )
+ {
+ aStr.AppendAscii( "[this=" );
+ aStr += pClassModuleObj->GetName();
+ aStr.AppendAscii( "]" );
+ }
+ if( !bLeave )
+ aStr += dumpMethodParameters( pMethod );
+
+ lcl_lineOut( GpTraceFileName, OUStringToOString( rtl::OUString( aStr ), RTL_TEXTENCODING_ASCII_US ).getStr(), lcl_getSpaces( nIndent ) );
+ if( !bLeave )
+ lcl_lineOut( GpTraceFileName, "{", lcl_getSpaces( nIndent ) );
+
+ if( bLeave )
+ lcl_lineOut( GpTraceFileName, "" );
+}
+
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl )
+{
+ rtl::OString aOTraceErrMsg = OUStringToOString( rtl::OUString( aTraceErrMsg ), RTL_TEXTENCODING_ASCII_US );
+
+ char Buffer[200];
+ const char* pHandledStr = bTraceErrHandled ? " / HANDLED" : "";
+ sprintf( Buffer, "*** ERROR%s, Id = %d, Msg = \"%s\" ***", pHandledStr, (int)nTraceErr, aOTraceErrMsg.getStr() );
+ int nIndent = nCallLvl * GnIndentPerCallLevel;
+ lcl_lineOut( GpTraceFileName, Buffer, lcl_getSpaces( nIndent ) );
+}
+
+void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
+ const String& aTraceStr_STMNT, const String& aTraceStr_PCode )
+{
+ String aModuleName = pModule->GetName();
+ ModuleTraceMap::iterator it = rModuleTraceMap.find( aModuleName );
+ PCToTextDataMap* pInnerMap;
+ if( it == rModuleTraceMap.end() )
+ {
+ pInnerMap = new PCToTextDataMap();
+ rModuleTraceMap[ aModuleName ] = pInnerMap;
+ }
+ else
+ {
+ pInnerMap = it->second;
+ }
+
+ TraceTextData aData;
+
+ rtl::OString aOTraceStr_STMNT = lcl_toOStringSkipLeadingWhites( aTraceStr_STMNT );
+ aData.m_aTraceStr_STMNT = aOTraceStr_STMNT;
+
+ rtl::OString aOTraceStr_PCode = lcl_toOStringSkipLeadingWhites( aTraceStr_PCode );
+ aData.m_aTraceStr_PCode = aOTraceStr_PCode;
+
+ (*pInnerMap)[nPC] = aData;
+}
+
+#endif
+
+
+//==========================================================================
// For debugging only
-// #define DBG_SAVE_DISASSEMBLY
+//#define DBG_SAVE_DISASSEMBLY
#ifdef DBG_SAVE_DISASSEMBLY
static bool dbg_bDisassemble = true;
@@ -67,7 +367,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
( OUString::createFromAscii( "com.sun.star.ucb.SimpleFileAccess" ) ), UNO_QUERY );
if( xSFI.is() )
{
- String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/BasicAsm_") );
+ String aFile( RTL_CONSTASCII_USTRINGPARAM("file:///d:/zBasic.Asm/Asm_") );
StarBASIC* pBasic = (StarBASIC*)pModule->GetParent();
if( pBasic )
{
@@ -99,6 +399,7 @@ void dbg_SaveDisassembly( SbModule* pModule )
}
#endif
+
// Diese Routine ist hier definiert, damit der Compiler als eigenes Segment
// geladen werden kann.
@@ -131,6 +432,7 @@ BOOL SbModule::Compile()
if( bRet )
{
pBasic->ClearAllModuleVars();
+ RemoveVars(); // remove 'this' Modules variables
// clear all method statics
for( USHORT i = 0; i < pMethods->Count(); i++ )
{
@@ -154,6 +456,10 @@ BOOL SbModule::Compile()
dbg_SaveDisassembly( this );
#endif
+#ifdef DBG_TRACE_BASIC
+ lcl_PrepareTraceForModule( this );
+#endif
+
return bRet;
}
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 6db0b96933..72cdcee2da 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -60,7 +60,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase8.hxx>
#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/script/XVBACompat.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
class BasicManager;
@@ -74,7 +74,7 @@ typedef ::cppu::WeakComponentImplHelper8<
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
- ::com::sun::star::script::XVBACompat,
+ ::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
typedef ::cppu::WeakImplHelper2< ::com::sun::star::container::XNameContainer,
@@ -507,9 +507,9 @@ public:
throw (::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException) = 0;
- // Methods XVBACompat
- virtual ::sal_Bool SAL_CALL getVBACompatModeOn() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
+ // Methods XVBACompatibility
+ virtual ::sal_Bool SAL_CALL getVBACompatibilityMode() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (::com::sun::star::uno::RuntimeException);
};
class LibraryContainerMethodGuard
diff --git a/basic/source/inc/sbtrace.hxx b/basic/source/inc/sbtrace.hxx
new file mode 100755
index 0000000000..6d24325c94
--- /dev/null
+++ b/basic/source/inc/sbtrace.hxx
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * 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 _SBTRACE_HXX
+#define _SBTRACE_HXX
+
+// #define DBG_TRACE_BASIC
+
+#ifdef DBG_TRACE_BASIC
+void dbg_InitTrace( void );
+void dbg_traceStep( SbModule* pModule, UINT32 nPC, INT32 nCallLvl );
+void dbg_traceNotifyCall( SbModule* pModule, SbMethod* pMethod, INT32 nCallLvl, bool bLeave = false );
+void dbg_traceNotifyError( SbError nTraceErr, const String& aTraceErrMsg, bool bTraceErrHandled, INT32 nCallLvl );
+void dbg_RegisterTraceTextForPC( SbModule* pModule, UINT32 nPC,
+ const String& aTraceStr_STMNT, const String& aTraceStr_PCode );
+#endif
+
+#endif
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 2c71183918..71ad535600 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -30,7 +30,7 @@
#include "namecont.hxx"
#include <basic/basmgr.hxx>
-#include <com/sun/star/script/XVBAModuleInfo.hpp>
+#include <com/sun/star/script/vba/XVBAModuleInfo.hpp>
#include <comphelper/uno3.hxx>
class BasicManager;
@@ -141,7 +141,7 @@ public:
//============================================================================
typedef std::hash_map< ::rtl::OUString, ::com::sun::star::script::ModuleInfo, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > ModuleInfoMap;
-typedef ::cppu::ImplHelper1 < ::com::sun::star::script::XVBAModuleInfo
+typedef ::cppu::ImplHelper1 < ::com::sun::star::script::vba::XVBAModuleInfo
> SfxScriptLibrary_BASE;
class SfxScriptLibrary : public SfxLibrary
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 41e7df439c..cafa0ee444 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4134,8 +4134,7 @@ RTLFUNC(Load)
{
if( pObj->IsA( TYPE( SbUserFormModule ) ) )
{
- SbUserFormModule* pFormModule = ( SbUserFormModule* )pObj;
- pFormModule->load();
+ ((SbUserFormModule*)pObj)->Load();
}
else if( pObj->IsA( TYPE( SbxObject ) ) )
{
diff --git a/basic/source/runtime/props.cxx b/basic/source/runtime/props.cxx
index 5a215bb40d..c7e81cf162 100644
--- a/basic/source/runtime/props.cxx
+++ b/basic/source/runtime/props.cxx
@@ -76,6 +76,13 @@ RTLFUNC(False)
rPar.Get(0)->PutBool( FALSE );
}
+RTLFUNC(Empty)
+{
+ (void)pBasic;
+ (void)bWrite;
+ (void)rPar;
+}
+
RTLFUNC(Nothing)
{
(void)pBasic;
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index 13485d7bb2..e3b2a05395 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -38,6 +38,7 @@ extern RTLFUNC(Date);
extern RTLFUNC(Err);
extern RTLFUNC(Erl);
extern RTLFUNC(False);
+extern RTLFUNC(Empty);
extern RTLFUNC(Nothing);
extern RTLFUNC(Null);
extern RTLFUNC(True);
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index b27495099a..a8eff4d55d 100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -44,6 +44,7 @@
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include "sbunoobj.hxx"
#include "errobject.hxx"
+#include "sbtrace.hxx"
using namespace ::com::sun::star;
@@ -720,6 +721,12 @@ BOOL SbiRuntime::Step()
if( pInst->IsReschedule() && bStaticGlobalEnableReschedule )
Application::Reschedule();
}
+
+#ifdef DBG_TRACE_BASIC
+ UINT32 nPC = ( pCode - (const BYTE* )pImg->GetCode() );
+ dbg_traceStep( pMod, nPC, pINST->nCallLvl );
+#endif
+
SbiOpcode eOp = (SbiOpcode ) ( *pCode++ );
UINT32 nOp1, nOp2;
if( eOp <= SbOP0_END )
@@ -756,6 +763,11 @@ BOOL SbiRuntime::Step()
// (insbesondere nicht nach Compiler-Fehlern zur Laufzeit)
if( nError && bRun )
{
+#ifdef DBG_TRACE_BASIC
+ SbError nTraceErr = nError;
+ String aTraceErrMsg = GetSbData()->aErrMsg;
+ bool bTraceErrHandled = true;
+#endif
SbError err = nError;
ClearExprStack();
nError = 0;
@@ -836,12 +848,19 @@ BOOL SbiRuntime::Step()
// Kein Error-Hdl gefunden -> altes Vorgehen
else
{
+#ifdef DBG_TRACE_BASIC
+ bTraceErrHandled = false;
+#endif
pInst->Abort();
}
// ALT: Nur
// pInst->Abort();
}
+
+#ifdef DBG_TRACE_BASIC
+ dbg_traceNotifyError( nTraceErr, aTraceErrMsg, bTraceErrHandled, pINST->nCallLvl );
+#endif
}
}
return bRun;
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index a4a7f7f68b..d621a12f0f 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -221,6 +221,7 @@ static Methods aMethods[] = {
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
+{ "Empty", SbxVARIANT, _CPROP, RTLNAME(Empty),0 },
{ "EqualUnoObjects",SbxBOOL, 2 | _FUNCTION, RTLNAME(EqualUnoObjects),0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 2c576e07f6..112c88bd3b 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -312,9 +312,21 @@ void SbiRuntime::StepIS()
{
SbxVariableRef refVar1 = PopVar();
SbxVariableRef refVar2 = PopVar();
- BOOL bRes = BOOL(
- refVar1->GetType() == SbxOBJECT
- && refVar2->GetType() == SbxOBJECT );
+
+ SbxDataType eType1 = refVar1->GetType();
+ SbxDataType eType2 = refVar2->GetType();
+ if ( eType1 == SbxEMPTY )
+ {
+ refVar1->Broadcast( SBX_HINT_DATAWANTED );
+ eType1 = refVar1->GetType();
+ }
+ if ( eType2 == SbxEMPTY )
+ {
+ refVar2->Broadcast( SBX_HINT_DATAWANTED );
+ eType2 = refVar2->GetType();
+ }
+
+ BOOL bRes = BOOL( eType1 == SbxOBJECT && eType2 == SbxOBJECT );
if ( bVBAEnabled && !bRes )
Error( SbERR_INVALID_USAGE_OBJECT );
bRes = ( bRes && refVar1->GetObject() == refVar2->GetObject() );
@@ -520,9 +532,10 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
- Reference< XInterface > xComListener;
- if( bWithEvents )
+ if ( bWithEvents )
{
+ Reference< XInterface > xComListener;
+
SbxBase* pObj = refVal->GetObject();
SbUnoObject* pUnoObj = (pObj != NULL) ? PTR_CAST(SbUnoObject,pObj) : NULL;
if( pUnoObj != NULL )
@@ -533,13 +546,17 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
::rtl::OUString aPrefix = refVar->GetName();
SbxObjectRef xScopeObj = refVar->GetParent();
xComListener = createComListener( aControlAny, aVBAType, aPrefix, xScopeObj );
- }
- }
- *refVar = *refVal;
+ refVal->SetDeclareClassName( aDeclareClassName );
+ refVal->SetComListener( xComListener ); // Hold reference
+ }
- if( bWithEvents )
- refVar->SetComListener( xComListener ); // Hold reference
+ *refVar = *refVal;
+ }
+ else
+ {
+ *refVar = *refVal;
+ }
// 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
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 48a0a0da99..995c425c0e 100644..100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -261,10 +261,12 @@ SbxVariable* SbiRuntime::FindElement
if( bSet )
pElem->SetType( t2 );
pElem = pNew;
- }
+ }
// Index-Access bei UnoObjekten beruecksichtigen
- /*
- else if( pElem->ISA(SbUnoProperty) )
+ // definitely we want this for VBA where properties are often
+ // collections ( which need index access ), but lets only do
+ // this if we actually have params following
+ else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
{
// pElem auf eine Ref zuweisen, um ggf. eine Temp-Var zu loeschen
SbxVariableRef refTemp = pElem;
@@ -274,7 +276,6 @@ SbxVariable* SbiRuntime::FindElement
pElem->SetParameters( NULL ); // sonst bleibt Ref auf sich selbst
pElem = pNew;
}
- */
}
return CheckArray( pElem );
}
@@ -377,7 +378,8 @@ void SbiRuntime::SetupArgs( SbxVariable* p, UINT32 nOp1 )
bool bError_ = true;
SbUnoMethod* pUnoMethod = PTR_CAST(SbUnoMethod,p);
- if( pUnoMethod )
+ SbUnoProperty* pUnoProperty = PTR_CAST(SbUnoProperty,p);
+ if( pUnoMethod || pUnoProperty )
{
SbUnoObject* pParentUnoObj = PTR_CAST( SbUnoObject,p->GetParent() );
if( pParentUnoObj )
@@ -677,7 +679,18 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
while( iLoop >= nParamCount )
{
p = new SbxVariable();
- p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
+
+ if( SbiRuntime::isVBAEnabled() &&
+ (t == SbxOBJECT || t == SbxSTRING) )
+ {
+ if( t == SbxOBJECT )
+ p->PutObject( NULL );
+ else
+ p->PutString( String() );
+ }
+ else
+ p->PutErr( 448 ); // Wie in VB: Error-Code 448 (SbERR_NAMED_NOT_FOUND)
+
refParams->Put( p, iLoop );
iLoop--;
}
@@ -1157,15 +1170,26 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
StepPUBLIC_Impl( nOp1, nOp2, true );
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
- SbxDataType t = (SbxDataType)(SbxDataType)(nOp2 & 0xffff);;
- BOOL bFlag = rBasic.IsSet( SBX_NO_MODIFY );
+ SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
+
+ // Store module scope variables at module scope
+ // in non vba mode these are stored at the library level :/
+ // not sure if this really should not be enabled for ALL basic
+ SbxObject* pStorage = &rBasic;
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ pStorage = pMod;
+ pMod->AddVarName( aName );
+ }
+
+ BOOL bFlag = pStorage->IsSet( SBX_NO_MODIFY );
rBasic.SetFlag( SBX_NO_MODIFY );
- SbxVariableRef p = rBasic.Find( aName, SbxCLASS_PROPERTY );
+ SbxVariableRef p = pStorage->Find( aName, SbxCLASS_PROPERTY );
if( p.Is() )
- rBasic.Remove (p);
- p = rBasic.Make( aName, SbxCLASS_PROPERTY, t );
+ pStorage->Remove (p);
+ p = pStorage->Make( aName, SbxCLASS_PROPERTY, t );
if( !bFlag )
- rBasic.ResetFlag( SBX_NO_MODIFY );
+ pStorage->ResetFlag( SBX_NO_MODIFY );
if( p )
{
p->SetFlag( SBX_DONTSTORE );
diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx
index b641323507..2eb7a4e77e 100644
--- a/basic/source/uno/namecont.cxx
+++ b/basic/source/uno/namecont.cxx
@@ -2793,8 +2793,7 @@ OUString SfxLibraryContainer::expand_url( const OUString& url )
}
}
-
-//XLibraryContainer3
+//XLibraryContainer3
OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString& Name )
throw (IllegalArgumentException, NoSuchElementException, RuntimeException)
{
@@ -2808,12 +2807,13 @@ OUString SAL_CALL SfxLibraryContainer::getOriginalLibraryLinkURL( const OUString
}
-::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatModeOn() throw (RuntimeException)
+// XVBACompatibility
+::sal_Bool SAL_CALL SfxLibraryContainer::getVBACompatibilityMode() throw (RuntimeException)
{
return mbVBACompat;
}
-void SAL_CALL SfxLibraryContainer::setVBACompatModeOn( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
+void SAL_CALL SfxLibraryContainer::setVBACompatibilityMode( ::sal_Bool _vbacompatmodeon ) throw (RuntimeException)
{
BasicManager* pBasMgr = getBasicManager();
if( pBasMgr )
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index 2bc4787a65..e10d1110f1 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -216,8 +216,7 @@ void SAL_CALL SfxScriptLibraryContainer::writeLibraryElement
Any aElement = xLib->getByName( aElementName );
aElement >>= aMod.aCode;
- Reference < script::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY );
-
+ Reference< script::vba::XVBAModuleInfo > xModInfo( xLib, UNO_QUERY );
if( xModInfo.is() && xModInfo->hasModuleInfo( aElementName ) )
{
script::ModuleInfo aModInfo = xModInfo->getModuleInfo( aElementName );
@@ -312,9 +311,9 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
// aMod.aName ignored
if( aMod.aModuleType.getLength() > 0 )
{
- if( !getVBACompatModeOn() )
+ if( !getVBACompatibilityMode() )
{
- setVBACompatModeOn( sal_True );
+ setVBACompatibilityMode( sal_True );
Any aGlobs;
Sequence< Any > aArgs(1);
@@ -381,8 +380,7 @@ Any SAL_CALL SfxScriptLibraryContainer::importLibraryElement
}
}
- Reference< script::XVBAModuleInfo > xVBAModuleInfo( xLib,
- UNO_QUERY );
+ Reference< script::vba::XVBAModuleInfo > xVBAModuleInfo( xLib, UNO_QUERY );
if( xVBAModuleInfo.is() )
{
if( xVBAModuleInfo->hasModuleInfo( aElementName ) )
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index 95a346d720..f5d0bb1372 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -96,11 +96,12 @@ void RootAccess::initBroadcaster(
for (ChangesListeners::iterator i(changesListeners_.begin());
i != changesListeners_.end(); ++i)
{
+ cppu::OWeakObject* pSource = static_cast< cppu::OWeakObject * >(this);
+ css::uno::Reference< css::uno::XInterface > xBase( pSource, css::uno::UNO_QUERY );
broadcaster->addChangesNotification(
*i,
css::util::ChangesEvent(
- static_cast< cppu::OWeakObject * >(this),
- css::uno::makeAny(pathRepresentation_), set));
+ pSource, makeAny( xBase ), set));
}
}
}
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index b5406fc127..399d3aa64b 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -28,6 +28,9 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_desktop.hxx"
+#include <cstdlib>
+#include <vector>
+
#include <memory>
#include <unistd.h>
#include "app.hxx"
@@ -119,6 +122,7 @@
#include <osl/file.hxx>
#include <osl/signal.h>
#include <rtl/uuid.h>
+#include <rtl/uri.hxx>
#include <unotools/pathoptions.hxx>
#include <svl/languageoptions.hxx>
#include <unotools/internaloptions.hxx>
@@ -155,6 +159,11 @@
#include "langselect.hxx"
+#if defined MACOSX
+#include <errno.h>
+#include <sys/wait.h>
+#endif
+
#define DEFINE_CONST_UNICODE(CONSTASCII) UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
#define U2S(STRING) ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
@@ -460,6 +469,194 @@ void ReplaceStringHookProc( UniString& rStr )
}
}
+static const char pLastSyncFileName[] = "lastsynchronized";
+static const sal_Int32 nStrLenLastSync = 16;
+
+static bool needsSynchronization(
+ ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL )
+{
+ bool bNeedsSync( false );
+
+ ::osl::DirectoryItem itemUserFile;
+ ::osl::File::RC err1 =
+ ::osl::DirectoryItem::get(userSynchronizedURL, itemUserFile);
+
+ //If it does not exist, then there is nothing to be done
+ if (err1 == ::osl::File::E_NOENT)
+ {
+ return true;
+ }
+ else if (err1 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access lastsynchronized in user layer");
+ return true; //sync just in case
+ }
+
+ //If last synchronized does not exist in base layer, then do nothing
+ ::osl::DirectoryItem itemBaseFile;
+ ::osl::File::RC err2 = ::osl::DirectoryItem::get(baseSynchronizedURL, itemBaseFile);
+ if (err2 == ::osl::File::E_NOENT)
+ {
+ return true;
+
+ }
+ else if (err2 != ::osl::File::E_None)
+ {
+ OSL_ENSURE(0, "Cannot access file lastsynchronized in base layer");
+ return true; //sync just in case
+ }
+
+ //compare the modification time of the extension folder and the last
+ //modified file
+ ::osl::FileStatus statUser(FileStatusMask_ModifyTime);
+ ::osl::FileStatus statBase(FileStatusMask_ModifyTime);
+ if (itemUserFile.getFileStatus(statUser) == ::osl::File::E_None)
+ {
+ if (itemBaseFile.getFileStatus(statBase) == ::osl::File::E_None)
+ {
+ TimeValue timeUser = statUser.getModifyTime();
+ TimeValue timeBase = statBase.getModifyTime();
+
+ if (timeUser.Seconds < timeBase.Seconds)
+ bNeedsSync = true;
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ bNeedsSync = true;
+ }
+
+ return bNeedsSync;
+}
+
+static ::rtl::OUString getBrandSharePreregBundledPathURL()
+{
+ ::rtl::OUString url(
+ RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled"));
+
+ ::rtl::Bootstrap::expandMacros(url);
+ return url;
+}
+
+static ::rtl::OUString getUserBundledExtPathURL()
+{
+ ::rtl::OUString folder( RTL_CONSTASCII_USTRINGPARAM( "$BUNDLED_EXTENSIONS_USER" ));
+ ::rtl::Bootstrap::expandMacros(folder);
+
+ return folder;
+}
+
+static ::rtl::OUString getLastSyncFileURLFromBrandInstallation()
+{
+ ::rtl::OUString aURL = getBrandSharePreregBundledPathURL();
+ ::sal_Int32 nLastIndex = aURL.lastIndexOf('/');
+
+ ::rtl::OUStringBuffer aTmp( aURL );
+
+ if ( nLastIndex != aURL.getLength()-1 )
+ aTmp.appendAscii( "/" );
+ aTmp.appendAscii( pLastSyncFileName );
+
+ return aTmp.makeStringAndClear();
+}
+
+static ::rtl::OUString getLastSyncFileURLFromUserInstallation()
+{
+ ::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
+ ::sal_Int32 nLastIndex = aUserBundledPathURL.lastIndexOf('/');
+
+ ::rtl::OUStringBuffer aTmp( aUserBundledPathURL );
+
+ if ( nLastIndex != aUserBundledPathURL.getLength()-1 )
+ aTmp.appendAscii( "/" );
+ aTmp.appendAscii( pLastSyncFileName );
+
+ return aTmp.makeStringAndClear();
+}
+
+static osl::FileBase::RC copy_bundled_recursive(
+ const rtl::OUString& srcUnqPath,
+ const rtl::OUString& dstUnqPath,
+ sal_Int32 TypeToCopy )
+throw()
+{
+ osl::FileBase::RC err = osl::FileBase::E_None;
+
+ if( TypeToCopy == -1 ) // Document
+ {
+ err = osl::File::copy( srcUnqPath,dstUnqPath );
+ }
+ else if( TypeToCopy == +1 ) // Folder
+ {
+ osl::Directory aDir( srcUnqPath );
+ aDir.open();
+
+ err = osl::Directory::create( dstUnqPath );
+ osl::FileBase::RC next = err;
+ if( err == osl::FileBase::E_None ||
+ err == osl::FileBase::E_EXIST )
+ {
+ err = osl::FileBase::E_None;
+ sal_Int32 n_Mask = FileStatusMask_FileURL | FileStatusMask_FileName | FileStatusMask_Type;
+
+ osl::DirectoryItem aDirItem;
+
+ while( err == osl::FileBase::E_None && ( next = aDir.getNextItem( aDirItem ) ) == osl::FileBase::E_None )
+ {
+ sal_Bool IsDoc = false;
+ sal_Bool bFilter = false;
+ osl::FileStatus aFileStatus( n_Mask );
+ aDirItem.getFileStatus( aFileStatus );
+ if( aFileStatus.isValid( FileStatusMask_Type ) )
+ IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
+
+ // Getting the information for the next recursive copy
+ sal_Int32 newTypeToCopy = IsDoc ? -1 : +1;
+
+ rtl::OUString newSrcUnqPath;
+ if( aFileStatus.isValid( FileStatusMask_FileURL ) )
+ newSrcUnqPath = aFileStatus.getFileURL();
+
+ rtl::OUString newDstUnqPath = dstUnqPath;
+ rtl::OUString tit;
+ if( aFileStatus.isValid( FileStatusMask_FileName ) )
+ {
+ ::rtl::OUString aFileName = aFileStatus.getFileName();
+ tit = rtl::Uri::encode( aFileName,
+ rtl_UriCharClassPchar,
+ rtl_UriEncodeIgnoreEscapes,
+ RTL_TEXTENCODING_UTF8 );
+
+ // Special treatment for "lastsychronized" file. Must not be
+ // copied from the bundled folder!
+ if ( IsDoc && aFileName.equalsAscii( pLastSyncFileName ))
+ bFilter = true;
+ }
+
+ if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 )
+ newDstUnqPath += rtl::OUString::createFromAscii( "/" );
+
+ newDstUnqPath += tit;
+
+ if (( newSrcUnqPath != dstUnqPath ) && !bFilter )
+ err = copy_bundled_recursive( newSrcUnqPath,newDstUnqPath, newTypeToCopy );
+ }
+
+ if( err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
+ err = next;
+ }
+ aDir.close();
+ }
+
+ return err;
+}
+
Desktop::Desktop()
: m_bServicesRegistered( false )
, m_aBootstrapError( BE_OK )
@@ -477,6 +674,24 @@ void Desktop::Init()
RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" );
SetBootstrapStatus(BS_OK);
+ // Check for lastsynchronized file for bundled extensions in the user directory
+ // and test if synchronzation is necessary!
+ {
+ ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation();
+ ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation();
+
+ if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL ))
+ {
+ rtl::OUString aUserPath = getUserBundledExtPathURL();
+ rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL();
+
+ // copy bundled folder to the user directory
+ osl::FileBase::RC rc = osl::Directory::createPath(aUserPath);
+ (void) rc;
+ copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
+ }
+ }
+
// create service factory...
Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
if( rSMgr.is() )
@@ -1117,28 +1332,79 @@ sal_Bool Desktop::SaveTasks()
sal_False);
}
-#ifdef MACOSX
-static void DoRestart()
-{
- oslProcess process;
- oslProcessError error;
- OUString sExecutableFile;
-
- osl_getExecutableFile( &sExecutableFile.pData );
-
- error = osl_executeProcess(
- sExecutableFile.pData,
- NULL,
- 0,
- 0,
- NULL,
- NULL,
- NULL,
- 0,
- &process
- );
-}
+namespace {
+
+void restartOnMac(bool passArguments) {
+#if defined MACOSX
+ OfficeIPCThread::DisableOfficeIPCThread();
+ rtl::OUString execUrl;
+ OSL_VERIFY(osl_getExecutableFile(&execUrl.pData) == osl_Process_E_None);
+ rtl::OUString execPath;
+ rtl::OString execPath8;
+ if ((osl::FileBase::getSystemPathFromFileURL(execUrl, execPath)
+ != osl::FileBase::E_None) ||
+ !execPath.convertToString(
+ &execPath8, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ std::abort();
+ }
+ std::vector< rtl::OString > args;
+ args.push_back(execPath8);
+ bool wait = false;
+ if (passArguments) {
+ sal_uInt32 n = osl_getCommandArgCount();
+ for (sal_uInt32 i = 0; i < n; ++i) {
+ rtl::OUString arg;
+ OSL_VERIFY(osl_getCommandArg(i, &arg.pData) == osl_Process_E_None);
+ if (arg.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("-accept="))) {
+ wait = true;
+ }
+ rtl::OString arg8;
+ if (!arg.convertToString(
+ &arg8, osl_getThreadTextEncoding(),
+ (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+ RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+ {
+ std::abort();
+ }
+ args.push_back(arg8);
+ }
+ }
+ std::vector< char const * > argPtrs;
+ for (std::vector< rtl::OString >::iterator i(args.begin()); i != args.end();
+ ++i)
+ {
+ argPtrs.push_back(i->getStr());
+ }
+ argPtrs.push_back(0);
+ execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+ if (errno == ENOTSUP) { // happens when multithreaded on OS X < 10.6
+ pid_t pid = fork();
+ if (pid == 0) {
+ execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+ } else if (pid > 0) {
+ // Two simultaneously running soffice processes lead to two dock
+ // icons, so avoid waiting here unless it must be assumed that the
+ // process invoking soffice itself wants to wait for soffice to
+ // finish:
+ if (!wait) {
+ return;
+ }
+ int stat;
+ if (waitpid(pid, &stat, 0) == pid && WIFEXITED(stat)) {
+ _exit(WEXITSTATUS(stat));
+ }
+ }
+ }
+ std::abort();
+#else
+ (void) passArguments; // avoid warnings
#endif
+}
+
+}
USHORT Desktop::Exception(USHORT nError)
{
@@ -1209,9 +1475,7 @@ USHORT Desktop::Exception(USHORT nError)
OfficeIPCThread::DisableOfficeIPCThread();
if( pSignalHandler )
DELETEZ( pSignalHandler );
-#ifdef MACOSX
- DoRestart();
-#endif
+ restartOnMac(false);
_exit( ExitHelper::E_CRASH_WITH_RESTART );
}
else
@@ -1294,6 +1558,9 @@ void Desktop::Main()
std::auto_ptr<SvtLanguageOptions> pLanguageOptions;
std::auto_ptr<SvtPathOptions> pPathOptions;
+ sal_Bool bRestartRequested( sal_False );
+ sal_Bool bUseSystemFileDialog(sal_True);
+ int nAcquireCount( 0 );
Reference < css::document::XEventListener > xGlobalBroadcaster;
try
{
@@ -1423,6 +1690,13 @@ void Desktop::Main()
( xSMgr->createInstance(
DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
+ /* ensure existance of a default window that messages can be dispatched to
+ This is for the benefit of testtool which uses PostUserEvent extensively
+ and else can deadlock while creating this window from another tread while
+ the main thread is not yet in the event loop.
+ */
+ Application::GetDefaultDevice();
+
// initialize test-tool library (if available)
RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ tools::InitTestToolLib" );
tools::InitTestToolLib();
@@ -1487,58 +1761,80 @@ void Desktop::Main()
impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
- if (
- (pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
- (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
- (!bExistsRecoveryData ) &&
- (!bExistsSessionData ) &&
- (!Application::AnyInput( INPUT_APPEVENT ) )
- )
+ Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
{
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
- Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
- if (xDesktopFrame.is())
+ ::comphelper::ComponentContext aContext( xSMgr );
+ xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+ }
+
+ // check whether the shutdown is caused by restart
+ bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+ if ( pCmdLineArgs->IsHeadless() )
+ {
+ // Ensure that we use not the system file dialogs as
+ // headless mode relies on Application::EnableHeadlessMode()
+ // which does only work for VCL dialogs!!
+ SvtMiscOptions aMiscOptions;
+ bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
+ aMiscOptions.SetUseSystemFileDialog( sal_False );
+ }
+
+ if ( !bRestartRequested )
+ {
+ if (
+ (pCmdLineArgs->IsEmptyOrAcceptOnly() ) &&
+ (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
+ (!bExistsRecoveryData ) &&
+ (!bExistsSessionData ) &&
+ (!Application::AnyInput( INPUT_APPEVENT ) )
+ )
{
-// SetSplashScreenProgress(60);
- Reference< XFrame > xBackingFrame;
- Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
-
- xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
- if (xBackingFrame.is())
- xContainerWindow = xBackingFrame->getContainerWindow();
- if (xContainerWindow.is())
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
+ Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+ if (xDesktopFrame.is())
{
- // 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,
- // otherwise documents loaded into this frame will later on miss functionality depending on the style.
- Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
- OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
- pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
-
- SetSplashScreenProgress(75);
- Sequence< Any > lArgs(1);
- lArgs[0] <<= xContainerWindow;
-
- Reference< XController > xBackingComp(
- xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
- UNO_QUERY);
-// SetSplashScreenProgress(80);
- if (xBackingComp.is())
+ // SetSplashScreenProgress(60);
+ Reference< XFrame > xBackingFrame;
+ Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+ xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
+ if (xBackingFrame.is())
+ xContainerWindow = xBackingFrame->getContainerWindow();
+ if (xContainerWindow.is())
{
- Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
- // Attention: You MUST(!) call setComponent() before you call attachFrame().
- // Because the backing component set the property "IsBackingMode" of the frame
- // to true inside attachFrame(). But setComponent() reset this state everytimes ...
- xBackingFrame->setComponent(xBackingWin, xBackingComp);
- SetSplashScreenProgress(100);
- xBackingComp->attachFrame(xBackingFrame);
- CloseSplashScreen();
- xContainerWindow->setVisible(sal_True);
+ // 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,
+ // otherwise documents loaded into this frame will later on miss functionality depending on the style.
+ Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+ OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
+ pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
+
+ SetSplashScreenProgress(75);
+ Sequence< Any > lArgs(1);
+ lArgs[0] <<= xContainerWindow;
+
+ Reference< XController > xBackingComp(
+ xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
+ UNO_QUERY);
+ // SetSplashScreenProgress(80);
+ if (xBackingComp.is())
+ {
+ Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
+ // Attention: You MUST(!) call setComponent() before you call attachFrame().
+ // Because the backing component set the property "IsBackingMode" of the frame
+ // to true inside attachFrame(). But setComponent() reset this state everytimes ...
+ xBackingFrame->setComponent(xBackingWin, xBackingComp);
+ SetSplashScreenProgress(100);
+ xBackingComp->attachFrame(xBackingFrame);
+ CloseSplashScreen();
+ xContainerWindow->setVisible(sal_True);
+ }
}
}
+ RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
}
- RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
}
}
catch ( com::sun::star::lang::WrappedTargetException& wte )
@@ -1573,108 +1869,83 @@ void Desktop::Main()
aOptions.SetVCLSettings();
// SetSplashScreenProgress(60);
- Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
-
- sal_Bool bTerminateRequested = sal_False;
-
- // Preload function depends on an initialized sfx application!
- SetSplashScreenProgress(75);
-
- sal_Bool bUseSystemFileDialog(sal_True);
- if ( pCmdLineArgs->IsHeadless() )
+ if ( !bRestartRequested )
{
- // Ensure that we use not the system file dialogs as
- // headless mode relies on Application::EnableHeadlessMode()
- // which does only work for VCL dialogs!!
- SvtMiscOptions aMiscOptions;
- bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
- aMiscOptions.SetUseSystemFileDialog( sal_False );
- }
+ Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
- // use system window dialogs
- Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
+ sal_Bool bTerminateRequested = sal_False;
-// SetSplashScreenProgress(80);
+ // Preload function depends on an initialized sfx application!
+ SetSplashScreenProgress(75);
- if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
- !pCmdLineArgs->IsNoQuickstart() )
- InitializeQuickstartMode( xSMgr );
+ // use system window dialogs
+ Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
- RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
- try
- {
- Reference< XDesktop > xDesktop( xSMgr->createInstance(
- OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
- if ( xDesktop.is() )
- xDesktop->addTerminateListener( new OfficeIPCThreadController );
- SetSplashScreenProgress(100);
- }
- catch ( com::sun::star::uno::Exception& e )
- {
- FatalError( MakeStartupErrorMessage(e.Message) );
- return;
- }
- /*
- catch ( ... )
- {
- FatalError( MakeStartupErrorMessage(
- OUString::createFromAscii(
- "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
- return;
- }
- */
+ // SetSplashScreenProgress(80);
- // Release solar mutex just before we wait for our client to connect
- int nAcquireCount = 0;
- ::vos::IMutex& rMutex = Application::GetSolarMutex();
- if ( rMutex.tryToAcquire() )
- nAcquireCount = Application::ReleaseSolarMutex() - 1;
+ if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
+ !pCmdLineArgs->IsNoQuickstart() )
+ InitializeQuickstartMode( xSMgr );
- // Post user event to startup first application component window
- // We have to send this OpenClients message short before execute() to
- // minimize the risk that this message overtakes type detection contruction!!
- Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
+ RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
+ try
+ {
+ Reference< XDesktop > xDesktop( xSMgr->createInstance(
+ OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+ if ( xDesktop.is() )
+ xDesktop->addTerminateListener( new OfficeIPCThreadController );
+ SetSplashScreenProgress(100);
+ }
+ catch ( com::sun::star::uno::Exception& e )
+ {
+ FatalError( MakeStartupErrorMessage(e.Message) );
+ return;
+ }
+ /*
+ catch ( ... )
+ {
+ FatalError( MakeStartupErrorMessage(
+ OUString::createFromAscii(
+ "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
+ return;
+ }
+ */
- // Post event to enable acceptors
- Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
+ // Post user event to startup first application component window
+ // We have to send this OpenClients message short before execute() to
+ // minimize the risk that this message overtakes type detection contruction!!
+ Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
- // The configuration error handler currently is only for startup
- aConfigErrHandler.deactivate();
+ // Post event to enable acceptors
+ Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
- // Acquire solar mutex just before we enter our message loop
- if ( nAcquireCount )
- Application::AcquireSolarMutex( nAcquireCount );
+ // The configuration error handler currently is only for startup
+ aConfigErrHandler.deactivate();
- // call Application::Execute to process messages in vcl message loop
- RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
+ // call Application::Execute to process messages in vcl message loop
+ RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
- Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
- try
- {
- // The JavaContext contains an interaction handler which is used when
- // the creation of a Java Virtual Machine fails
- com::sun::star::uno::ContextLayer layer2(
- new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
+ try
+ {
+ // The JavaContext contains an interaction handler which is used when
+ // the creation of a Java Virtual Machine fails
+ com::sun::star::uno::ContextLayer layer2(
+ new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
- ::comphelper::ComponentContext aContext( xSMgr );
- xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
- if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) )
Execute();
+ }
+ catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
+ {
+ OfficeIPCThread::SetDowning();
+ FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
+ }
+ catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
+ {
+ OfficeIPCThread::SetDowning();
+ FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
+ }
}
- catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
- {
- OfficeIPCThread::SetDowning();
- FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
- }
- catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
- {
- OfficeIPCThread::SetDowning();
- FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
- }
-
- // check whether the shutdown is caused by restart
- sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
-
+
if (xGlobalBroadcaster.is())
{
css::document::EventObject aEvent;
@@ -1709,9 +1980,7 @@ void Desktop::Main()
RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" );
if ( bRestartRequested )
{
-#ifdef MACOSX
- DoRestart();
-#endif
+ restartOnMac(true);
// wouldn't the solution be more clean if SalMain returns the exit code to the system?
_exit( ExitHelper::E_NORMAL_RESTART );
}
diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
index ed5db4cb11..9f5d400e68 100755..100644
--- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx
+++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx
@@ -372,11 +372,13 @@ MENU_COMMAND ExtBoxWithBtns_Impl::ShowPopupMenu( const Point & rPos, const long
if ( ! GetEntryData( nPos )->m_bLocked )
{
- 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 ) );
-
+ 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 ) );
}
diff --git a/desktop/source/deployment/manager/dp_extensionmanager.cxx b/desktop/source/deployment/manager/dp_extensionmanager.cxx
index 3cf6e48595..ab0baa78e3 100644
--- a/desktop/source/deployment/manager/dp_extensionmanager.cxx
+++ b/desktop/source/deployment/manager/dp_extensionmanager.cxx
@@ -1136,6 +1136,14 @@ sal_Bool ExtensionManager::synchronize(
bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv);
progressBundled.update(OUSTR("\n\n"));
+ //Always determine the active extension. This is necessary for the
+ //first-start optimization. The setup creates the registration data for the
+ //bundled extensions (brand_layer/share/prereg/bundled), which is copied to the user
+ //installation (user_installation/extension/bundled) when a user starts OOo
+ //for the first time after running setup. All bundled extensions are registered
+ //at that moment. However, extensions with the same identifier can be in the
+ //shared or user repository, in which case the respective bundled extensions must
+ //be revoked.
try
{
const uno::Sequence<uno::Sequence<Reference<deploy::XPackage> > >
diff --git a/desktop/source/deployment/manager/dp_properties.cxx b/desktop/source/deployment/manager/dp_properties.cxx
index 65f3d14c75..317ad3da78 100644
--- a/desktop/source/deployment/manager/dp_properties.cxx
+++ b/desktop/source/deployment/manager/dp_properties.cxx
@@ -2,7 +2,7 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
diff --git a/desktop/source/deployment/manager/dp_properties.hxx b/desktop/source/deployment/manager/dp_properties.hxx
index f135ff9977..45a0583d54 100644
--- a/desktop/source/deployment/manager/dp_properties.hxx
+++ b/desktop/source/deployment/manager/dp_properties.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_manager.h,v $
- * $Revision: 1.17 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx
index 689e8cfd0d..c988e6494b 100644
--- a/desktop/source/deployment/misc/dp_misc.cxx
+++ b/desktop/source/deployment/misc/dp_misc.cxx
@@ -589,6 +589,11 @@ void TRACE(::rtl::OString const & sText)
void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
{
+ OUString sDisable;
+ ::rtl::Bootstrap::get( OUSTR( "DISABLE_EXTENSION_SYNCHRONIZATION" ), sDisable, OUString() );
+ if (sDisable.getLength() > 0)
+ return;
+
Reference<deployment::XExtensionManager> xExtensionManager;
//synchronize shared before bundled otherewise there are
//more revoke and registration calls.
diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
index c50e6bdf42..a2f81e19ce 100644
--- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx
@@ -359,16 +359,11 @@ void BackendImpl::configmgrini_verify_init(
do {
OUString token( line.getToken( 0, ' ', index ).trim() );
if (token.getLength() > 0) {
- // cleanup, check if existing:
- if (create_ucb_content(
- 0, expandUnoRcTerm(token), xCmdEnv,
- false /* no throw */ )) {
- //The file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the configmgrini.
- //After running XExtensionManager::synchronize, the configmgrini is
- //cleaned up
- m_xcs_files.push_back( token );
- }
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
+ m_xcs_files.push_back( token );
}
}
while (index >= 0);
@@ -378,31 +373,15 @@ void BackendImpl::configmgrini_verify_init(
sal_Int32 index = sizeof ("DATA=") - 1;
do {
OUString token( line.getToken( 0, ' ', index ).trim() );
- if (token.getLength() > 0) {
+ if (token.getLength() > 0)
+ {
if (token[ 0 ] == '?')
token = token.copy( 1 );
- // cleanup, check if existing:
- if (create_ucb_content(
- 0, expandUnoRcTerm(token),
- xCmdEnv, false /* no throw */ )) {
- //The file may not exist anymore if a shared or bundled
- //extension was removed, but it can still be in the configmgrini.
- //After running XExtensionManager::synchronize, the configmgrini is
- //cleaned up
- m_xcu_files.push_back( token );
- }
- else
- {
- //Check if it was removed. Only when the file contained %origin, so that
- //a new file was writen in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
- //See also ConfigurationBackendDb.iniEntry
- ::std::list<OUString> iniEntries = getAllIniEntries();
- if (::std::find(iniEntries.begin(), iniEntries.end(), token)
- != iniEntries.end())
- m_xcu_files.push_back( token );
- else
- OSL_ENSURE(0, "Extension manager: Invalid configmgr.ini entry.");
- }
+ //The file may not exist anymore if a shared or bundled
+ //extension was removed, but it can still be in the configmgrini.
+ //After running XExtensionManager::synchronize, the configmgrini is
+ //cleaned up
+ m_xcu_files.push_back( token );
}
}
while (index >= 0);
@@ -502,6 +481,8 @@ bool BackendImpl::removeFromConfigmgrIni(
{
//in case the xcu contained %origin% then the configmr.ini contains the
//url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
+ //However, m_url (getURL()) contains the URL for the file in the actual
+ //extension installatation.
::boost::optional<ConfigurationBackendDb::Data> data = readDataFromDb(url_);
if (data)
i = std::find(rSet.begin(), rSet.end(), data->iniEntry);
@@ -757,10 +738,17 @@ void BackendImpl::PackageImpl::processPackage_(
}
that->m_registeredPackages->erase(i->first);
}
- ::ucbhelper::Content(
- makeURL( that->getCachePath(), OUSTR("registry") ),
- xCmdEnv ).executeCommand(
- OUSTR("delete"), Any( true /* delete physically */ ) );
+ try
+ {
+ ::ucbhelper::Content(
+ makeURL( that->getCachePath(), OUSTR("registry") ),
+ xCmdEnv ).executeCommand(
+ OUSTR("delete"), Any( true /* delete physically */ ) );
+ }
+ catch(Exception&)
+ {
+ OSL_ASSERT(0);
+ }
}
that->deleteDataFromDb(getURL());
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
index 8665ef16a2..3dc4528972 100644
--- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
index 8e685660ca..6d6d3a2d0b 100644
--- a/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
+++ b/desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx
index 643553ad92..92c0a912db 100644
--- a/desktop/source/deployment/registry/dp_registry.cxx
+++ b/desktop/source/deployment/registry/dp_registry.cxx
@@ -129,7 +129,9 @@ public:
virtual Reference<deployment::XPackage> SAL_CALL bindPackage(
OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (deployment::DeploymentException, CommandFailedException,
+ throw (deployment::DeploymentException,
+ deployment::InvalidRemovedParameterException,
+ CommandFailedException,
lang::IllegalArgumentException, RuntimeException);
virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL
getSupportedPackageTypes() throw (RuntimeException);
@@ -461,7 +463,8 @@ void PackageRegistryImpl::update() throw (RuntimeException)
Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
OUString const & url, OUString const & mediaType_, sal_Bool bRemoved,
OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
- throw (deployment::DeploymentException, CommandFailedException,
+ throw (deployment::DeploymentException, deployment::InvalidRemovedParameterException,
+ CommandFailedException,
lang::IllegalArgumentException, RuntimeException)
{
check();
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
index 90f0384067..67ffc0f719 100644
--- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
index 29f8f89dd6..ddb3a29447 100644
--- a/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
+++ b/desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
index cadddf82ec..c6a4fe91cb 100644
--- a/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
index a0468767fe..4fe99bd93b 100644
--- a/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
+++ b/desktop/source/deployment/registry/help/dp_helpbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx
index 649f85c8db..6209aad0d0 100644
--- a/desktop/source/deployment/registry/package/dp_package.cxx
+++ b/desktop/source/deployment/registry/package/dp_package.cxx
@@ -866,14 +866,10 @@ void BackendImpl::PackageImpl::processPackage_(
try {
xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv );
}
- catch (RuntimeException &) {
- throw;
- }
- catch (ucb::CommandAbortedException &) {
- throw;
- }
- catch (Exception &) {
- // CommandFailedException, DeploymentException:
+ catch (Exception &)
+ {
+ //We even try a rollback if the user cancelled the action (CommandAbortedException)
+ //in order to prevent invalid database entries.
Any exc( ::cppu::getCaughtException() );
// try to handle exception, notify:
bool approve = false, abort = false;
@@ -904,14 +900,8 @@ void BackendImpl::PackageImpl::processPackage_(
bundle[ pos ]->revokePackage(
xSubAbortChannel, xCmdEnv );
}
- catch (RuntimeException &) {
- throw;
- }
- catch (ucb::CommandAbortedException &) {
- throw;
- }
- catch (Exception &) {
- // bundle rollback error:
+ catch (Exception &)
+ {
OSL_ENSURE( 0, ::rtl::OUStringToOString(
::comphelper::anyToString(
::cppu::getCaughtException() ),
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
index d8e47eecb4..6e732ccd58 100644
--- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
index 6b6d4d364c..e09e721b27 100644
--- a/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
+++ b/desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx
index b33d78966f..2ac1a0bcbc 100755..100644
--- a/desktop/source/migration/services/cexportsoo3.cxx
+++ b/desktop/source/migration/services/cexportsoo3.cxx
@@ -2,13 +2,10 @@
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: cexports.cxx,v $
- * $Revision: 1.9 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index 578dda0c1b..a481857f91 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -1,14 +1,11 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: extensionmigration.cxx,v $
- * $Revision: 1.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx
index 124bc1b250..721a1bd704 100644
--- a/desktop/source/migration/services/oo3extensionmigration.hxx
+++ b/desktop/source/migration/services/oo3extensionmigration.hxx
@@ -1,14 +1,11 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
*
- * $RCSfile: extensionmigration.hxx,v $
- * $Revision: 1.2 $
- *
* This file is part of OpenOffice.org.
*
* OpenOffice.org is free software: you can redistribute it and/or modify
diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
index 4b7b112e53..278a07b8c8 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx
@@ -39,6 +39,7 @@
#include "osl/thread.h"
#include "osl/process.h"
#include "osl/conditn.hxx"
+#include "osl/file.hxx"
#include "cppuhelper/implbase1.hxx"
#include "cppuhelper/exc_hlp.hxx"
#include "comphelper/anytostring.hxx"
@@ -377,6 +378,29 @@ extern "C" int unopkg_main()
if (e != osl_File_E_None && e != osl_File_E_NOENT)
throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0);
}
+ else if (subCommand.equals(OUSTR("sync")))
+ {
+ //sync is private!!!! Only for bundled extensions!!!
+ //For performance reasons unopkg sync is called during the setup and
+ //creates the registration data for the repository of the bundled
+ //extensions. It is then copied to the user installation during
+ //startup of OOo (userdata/extensions/bundled). The registration
+ //data is in the brand installation and must be removed when
+ //uninstalling OOo. We do this here, before UNO is
+ //bootstrapped. Otherwies files could be locked by this process.
+
+ //If there is no folder left in
+ //$BRAND_BASE_DIR/share/extensions
+ //then we can delete the registration data at
+ //$BUNDLED_EXTENSIONS_USER
+ if (hasNoFolder(OUSTR("$BRAND_BASE_DIR/share/extensions")))
+ {
+ removeFolder(OUSTR("$BUNDLED_EXTENSIONS_USER"));
+ //return otherwise we create the registration data again
+ return 0;
+ }
+
+ }
xComponentContext = getUNO(
disposeGuard, option_verbose, option_shared, subcmd_gui,
@@ -587,6 +611,15 @@ extern "C" int unopkg_main()
xDialog->startExecuteModal(xListener);
dialogEnded.wait();
}
+ else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("sync")))
+ {
+ //This sub command may be removed later and is only there to have a
+ //possibility to start extension synching without any output.
+ //This is just here so we do not get an error, because of an unknown
+ //sub-command. We do synching before
+ //the sub-commands are processed.
+
+ }
else
{
dp_misc::writeConsoleError(
diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
index 5ecf18d651..ec4bab433a 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
+++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx
@@ -528,5 +528,110 @@ Reference<XComponentContext> getUNO(
return xComponentContext;
}
+//Determines if a folder does not contains a folder.
+//Return false may also mean that the status could not be determined
+//because some error occurred.
+bool hasNoFolder(OUString const & folderUrl)
+{
+ bool ret = false;
+ OUString url = folderUrl;
+ ::rtl::Bootstrap::expandMacros(url);
+ ::osl::Directory dir(url);
+ osl::File::RC rc = dir.open();
+ if (rc == osl::File::E_None)
+ {
+ bool bFolderExist = false;
+ osl::DirectoryItem i;
+ osl::File::RC rcNext = osl::File::E_None;
+ while ( (rcNext = dir.getNextItem(i)) == osl::File::E_None)
+ {
+ osl::FileStatus stat(FileStatusMask_Type);
+ if (i.getFileStatus(stat) == osl::File::E_None)
+ {
+ if (stat.getFileType() == osl::FileStatus::Directory)
+ {
+ bFolderExist = true;
+ break;
+ }
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ break;
+ }
+ i = osl::DirectoryItem();
+ }
+
+ if (rcNext == osl::File::E_NOENT ||
+ rcNext == osl::File::E_None)
+ {
+ if (!bFolderExist)
+ ret = true;
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ }
+
+ dir.close();
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ }
+ return ret;
}
+void removeFolder(OUString const & folderUrl)
+{
+ OUString url = folderUrl;
+ ::rtl::Bootstrap::expandMacros(url);
+ ::osl::Directory dir(url);
+ ::osl::File::RC rc = dir.open();
+ if (rc == osl::File::E_None)
+ {
+ ::osl::DirectoryItem i;
+ ::osl::File::RC rcNext = ::osl::File::E_None;
+ while ( (rcNext = dir.getNextItem(i)) == ::osl::File::E_None)
+ {
+ ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileURL);
+ if (i.getFileStatus(stat) == ::osl::File::E_None)
+ {
+ ::osl::FileStatus::Type t = stat.getFileType();
+ if (t == ::osl::FileStatus::Directory)
+ {
+ //remove folder
+ removeFolder(stat.getFileURL());
+ }
+ else if (t == ::osl::FileStatus::Regular)
+ {
+ //remove file
+ ::osl::File::remove(stat.getFileURL());
+ }
+ else
+ {
+ OSL_ASSERT(0);
+ }
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+ break;
+ }
+ i = ::osl::DirectoryItem();
+ }
+ dir.close();
+ ::osl::Directory::remove(url);
+ }
+ else
+ {
+ dp_misc::writeConsole(
+ OUSTR("unopkg: Error while removing ") + url + OUSTR("\n"));
+ }
+}
+
+}
diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h
index 8898e42d27..5af217ef41 100644
--- a/desktop/source/pkgchk/unopkg/unopkg_shared.h
+++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h
@@ -178,5 +178,11 @@ css::uno::Reference<css::uno::XComponentContext> getUNO(
DisposeGuard & disposeGuard, bool verbose, bool shared, bool bGui,
css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
+bool hasNoFolder(::rtl::OUString const & folderUrl);
+
+void removeFolder(::rtl::OUString const & folderUrl);
+
}
+
+
diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx
index 6fc80acf06..9b09b563be 100755
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -1458,7 +1458,11 @@ Reference< XSpellChecker1 > ImpEditEngine::GetSpeller()
SpellInfo * ImpEditEngine::CreateSpellInfo( const EditSelection &rSel, bool bMultipleDocs )
{
- pSpellInfo = new SpellInfo;
+ if (!pSpellInfo)
+ pSpellInfo = new SpellInfo;
+ else
+ *pSpellInfo = SpellInfo(); // reset to default values
+
pSpellInfo->bMultipleDoc = bMultipleDocs;
EditSelection aSentenceSel( SelectSentence( rSel ) );
// pSpellInfo->aSpellStart = CreateEPaM( aSentenceSel.Min() );
@@ -2023,7 +2027,6 @@ bool ImpEditEngine::SpellSentence(EditView& rEditView,
#else
bool bRet = false;
EditSelection aCurSel( rEditView.pImpEditView->GetEditSelection() );
- //the pSpellInfo has to be created on demand
if(!pSpellInfo)
pSpellInfo = CreateSpellInfo( aCurSel, true );
pSpellInfo->aCurSentenceStart = aCurSel.Min();
@@ -2191,8 +2194,12 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
{
#ifdef SVX_LIGHT
#else
+ // Note: rNewPortions.size() == 0 is valid and happens when the whole
+ // sentence got removed in the dialog
+
DBG_ASSERT(pSpellInfo, "pSpellInfo not initialized");
- if(pSpellInfo)
+ if (pSpellInfo &&
+ pSpellInfo->aLastSpellPortions.size() > 0) // no portions -> no text to be changed
{
// get current paragraph length to calculate later on how the sentence length changed,
// in order to place the cursor at the end of the sentence again
@@ -2202,6 +2209,10 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
UndoActionStart( EDITUNDO_INSERT );
if(pSpellInfo->aLastSpellPortions.size() == rNewPortions.size())
{
+ DBG_ASSERT( rNewPortions.size() > 0, "rNewPortions should not be empty here" );
+ DBG_ASSERT( pSpellInfo->aLastSpellPortions.size() == pSpellInfo->aLastSpellContentSelections.size(),
+ "aLastSpellPortions and aLastSpellContentSelections size mismatch" );
+
//the simple case: the same number of elements on both sides
//each changed element has to be applied to the corresponding source element
svx::SpellPortions::const_iterator aCurrentNewPortion = rNewPortions.end();
@@ -2252,6 +2263,8 @@ void ImpEditEngine::ApplyChangedSentence(EditView& rEditView,
}
else
{
+ DBG_ASSERT( pSpellInfo->aLastSpellContentSelections.size() > 0, "aLastSpellContentSelections should not be empty here" );
+
//select the complete sentence
SpellContentSelections::const_iterator aCurrentEndPosition = pSpellInfo->aLastSpellContentSelections.end();
--aCurrentEndPosition;
diff --git a/formula/inc/formula/errorcodes.hxx b/formula/inc/formula/errorcodes.hxx
index f9b04e012f..1593f710b4 100644
--- a/formula/inc/formula/errorcodes.hxx
+++ b/formula/inc/formula/errorcodes.hxx
@@ -64,7 +64,8 @@ const USHORT errInterpOverflow = 527;
// Not displayed, temporary for TrackFormulas,
// Cell depends on another cell that has errCircularReference
const USHORT errTrackFromCircRef = 528;
-// Interpreter internal: existing cell has no value but value queried
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// set as mnStringNoValueError no error is generated but 0 returned.
const USHORT errCellNoValue = 529;
// Interpreter: needed AddIn not found
const USHORT errNoAddin = 530;
@@ -74,6 +75,11 @@ const USHORT errNoMacro = 531;
const USHORT errDivisionByZero = 532; // #DIV/0!
// Compiler: a non-simple (str,err,val) value was put in an array
const USHORT errNestedArray = 533;
+// ScInterpreter internal: no numeric value but numeric queried. If this is
+// temporarily (!) set as mnStringNoValueError, the error is generated and can
+// be used to distinguish that condition from all other (inherited) errors. Do
+// not use for anything else! Never push or inherit the error otherwise!
+const USHORT errNotNumericString = 534;
// Interpreter: NA() not available condition, not a real error
const USHORT NOTAVAILABLE = 0x7fff;
diff --git a/framework/source/accelerators/acceleratorconfiguration.cxx b/framework/source/accelerators/acceleratorconfiguration.cxx
index a865516b94..34c799f6d3 100644
--- a/framework/source/accelerators/acceleratorconfiguration.cxx
+++ b/framework/source/accelerators/acceleratorconfiguration.cxx
@@ -96,6 +96,8 @@
#include <svtools/acceleratorexecute.hxx>
+#include <stdio.h>
+
//_______________________________________________
// const
@@ -1248,7 +1250,6 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
const sal_Int32 c = aEvent.Changes.getLength();
sal_Int32 i = 0;
-
for (i=0; i<c; ++i)
{
const css::util::ElementChange& aChange = aEvent.Changes[i];
@@ -1264,27 +1265,25 @@ void SAL_CALL XCUBasedAcceleratorConfiguration::changesOccurred(const css::util:
aChange.Accessor >>= sOrgPath;
sPath = sOrgPath;
- ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
-
- ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
-
+ ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+
if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
{
::rtl::OUString sModule;
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- if ( sKey.getLength() )
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
}
else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
{
- ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
- ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule + ::rtl::OUString::createFromAscii("']");
- sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
- sKey = ::utl::extractFirstFromConfigurationPath(sPath);
- if ( sKey.getLength() )
+ ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+ sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+
+ if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
+ {
reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+ }
}
}
}
@@ -1385,8 +1384,8 @@ void XCUBasedAcceleratorConfiguration::impl_ts_load( sal_Bool bPreferred, const
aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
else if (sToken[k].equalsAscii("MOD2"))
aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
- else if (sToken[k].equalsAscii("MOD3"))
- aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
+ else if (sToken[k].equalsAscii("MOD3"))
+ aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
else
{
bValid = sal_False;
diff --git a/officecfg/registry/data/org/openoffice/Office/Math.xcu b/officecfg/registry/data/org/openoffice/Office/Math.xcu
index 3acc948129..b040267907 100644..100755
--- a/officecfg/registry/data/org/openoffice/Office/Math.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/Math.xcu
@@ -48,6 +48,8 @@
<value>0</value>
</prop>
</node>
+
+ <!-- only used for symbols with the 'Greek' symbol set name -->
<node oor:name="Id2" oor:op="replace">
<prop oor:name="Name">
<value>OpenSymbol</value>
@@ -65,10 +67,11 @@
<value>0</value>
</prop>
<prop oor:name="Italic">
- <value>2</value>
+ <value>0</value>
</prop>
</node>
</node>
+
<node oor:name="SymbolList">
<node oor:name="alpha" oor:op="replace">
<prop oor:name="Char">
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 33e5109405..5c72d94843 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="UTF-8"?>
+<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE oor:component-data SYSTEM "../../../../../component-update.dtd">
<oor:component-data oor:name="CalcCommands" oor:package="org.openoffice.Office.UI" xmlns:oor="http://openoffice.org/2001/registry" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<node oor:name="UserInterface">
@@ -160,6 +160,14 @@
<value xml:lang="en-US">~Select...</value>
</prop>
</node>
+ <node oor:name=".uno:TableEvents" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="en-US">Sheet ~Events...</value>
+ </prop>
+ <prop oor:name="ContextLabel" oor:type="xs:string">
+ <value xml:lang="en-US">~Events...</value>
+ </prop>
+ </node>
<node oor:name=".uno:DataPilotFilter" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">DataPilot Filter</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Math.xcs b/officecfg/registry/schema/org/openoffice/Office/Math.xcs
index caa8726b7c..31f6e00a23 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Math.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Math.xcs
@@ -402,7 +402,28 @@
</info>
<value>false</value>
</prop>
- <prop oor:name="ScaleNormalBracket" oor:type="xs:boolean">
+ <prop oor:name="GreekCharStyle" oor:type="xs:short">
+ <!-- UIHints: n/a yet -->
+ <info>
+ <author>TL</author>
+ <desc>Specifies the default layout for symbols from the 'Greek' symbol set.</desc>
+ <label>Greek character style</label>
+ </info>
+ <constraints>
+ <minInclusive oor:value="0">
+ <info>
+ <desc>Specifies the minimum value allowed</desc>
+ </info>
+ </minInclusive>
+ <maxInclusive oor:value="2">
+ <info>
+ <desc>Specifies the maximum value allowed</desc>
+ </info>
+ </maxInclusive>
+ </constraints>
+ <value>0</value>
+ </prop>
+ <prop oor:name="ScaleNormalBracket" oor:type="xs:boolean">
<!-- OldPath: Math/StandardFormat -->
<!-- OldLocation: Soffice.cfg -->
<!-- UIHints: Format - Spacing - Category - Brackets - Scale all brackets -->
diff --git a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
index 7b0b221f15..7ff9146472 100755
--- a/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/OOoImprovement/Settings.xcs
@@ -15,7 +15,7 @@
OpenOffice.org Improvement Program. If this is zero the user will get asked.
</desc>
</info>
- <value>2</value>
+ <value>1</value>
</prop>
<prop oor:name="InvitationAccepted" oor:type="xs:boolean">
<info>
diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl
index 6157d38079..2a9830568d 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -24,21 +24,15 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#ifndef __ooo_vba_XApplicationBase_idl__
#define __ooo_vba_XApplicationBase_idl__
-#ifndef __com_sun_star_uno_XInterface_idl__
-#include <com/sun/star/uno/XInterface.idl>
-#endif
-
-#ifndef __ooo_vba_XHelperInterface_idl__
#include <ooo/vba/XHelperInterface.idl>
-#endif
-
-module ooo { module vba {
-//=============================================================================
+module ooo { module vba {
+//=============================================================================
interface XApplicationBase
{
@@ -47,8 +41,9 @@ interface XApplicationBase
[attribute] boolean ScreenUpdating;
[attribute] boolean DisplayStatusBar;
[attribute] boolean Interactive;
+ [attribute] boolean Visible;
+
[attribute, readonly] string Version;
- //mbn
[attribute, readonly] any VBE;
[attribute, readonly] any VBProjects;
@@ -61,6 +56,8 @@ interface XApplicationBase
void Undo();
};
+//=============================================================================
+
}; };
#endif
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index e7b9aee618..ac1f4c4ee0 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -64,6 +64,7 @@ interface XApplication
[attribute] any CutCopyMode;
[attribute] any StatusBar;
[attribute] long Cursor;
+ [attribute] boolean EnableEvents;
void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index f59c9eb345..07e9f23d4b 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -114,6 +114,7 @@ interface XWorksheet
XRange Rows([in] any aIndex);
XRange Columns([in] any aIndex);
any Hyperlinks( [in] any aIndex );
+ any Names( [in] any Index );
any Evaluate( [in] string Name);
diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk
index 12dcf025e4..2515880867 100644
--- a/oovbaapi/ooo/vba/excel/makefile.mk
+++ b/oovbaapi/ooo/vba/excel/makefile.mk
@@ -29,7 +29,7 @@ PRJ=..$/..$/..
PRJNAME=oovapi
TARGET=excel
-PACKAGE=ooo$/vba$/Excel
+PACKAGE=ooo$/vba$/excel
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index 75f6465bf4..4f6d378cfe 100644
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -61,9 +61,8 @@ IDLFILES=\
XFontBase.idl\
XDialogsBase.idl\
XDialogBase.idl\
- XPageSetupBase.idl \
- XVBAAppService.idl\
- XVBADocService.idl\
+ XPageSetupBase.idl
+
# ------------------------------------------------------------------
.ENDIF
.INCLUDE : target.mk
diff --git a/oovbaapi/ooo/vba/word/makefile.mk b/oovbaapi/ooo/vba/word/makefile.mk
index e3a19e6784..543e99f7c5 100644
--- a/oovbaapi/ooo/vba/word/makefile.mk
+++ b/oovbaapi/ooo/vba/word/makefile.mk
@@ -29,7 +29,7 @@ PRJ=..$/..$/..
PRJNAME=oovapi
TARGET=word
-PACKAGE=ooo$/vba$/Word
+PACKAGE=ooo$/vba$/word
# --- Settings -----------------------------------------------------
.INCLUDE : $(PRJ)$/util$/makefile.pmk
diff --git a/oovbaapi/prj/d.lst b/oovbaapi/prj/d.lst
index ac5924e2d6..86e801a15d 100644
--- a/oovbaapi/prj/d.lst
+++ b/oovbaapi/prj/d.lst
@@ -8,7 +8,7 @@ mkdir: %COMMON_DEST%\idl%_EXT%\ooo\vba\word
..\%__SRC%\ucr\oovbaapi.db %_DEST%\bin%_EXT%\oovbaapi.rdb
-..\ooo\vba\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\
+..\ooo\vba\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba
..\ooo\vba\constants\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\constants
..\ooo\vba\excel\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\excel
..\ooo\vba\msforms\*.idl %COMMON_DEST%\idl%_EXT%\ooo\vba\msforms
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index f2e6fb5c50..8e4dde2872 100755..100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -293,6 +293,7 @@ public:
sal_Bool IsReadOnlyUI() const;
void SetNoName();
sal_Bool IsInModalMode() const;
+ sal_Bool IsInPrepareClose() const;
//<!--Added by PengYunQuan for Validity Cell Range Picker
virtual sal_Bool AcceptStateUpdate() const;
//-->Added by PengYunQuan for Validity Cell Range Picker
@@ -346,6 +347,9 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
virtual void UpdateLinks();
+ // called for a few slots like SID_SAVE[AS]DOC, SID_PRINTDOC[DIRECT], derived classes may abort the action
+ virtual sal_Bool QuerySlotExecutable( USHORT nSlotId );
+
sal_Bool SaveChildren(BOOL bObjectsOnly=FALSE);
sal_Bool SaveAsChildren( SfxMedium &rMedium );
sal_Bool SwitchChildrenPersistance(
diff --git a/sfx2/source/dialog/securitypage.cxx b/sfx2/source/dialog/securitypage.cxx
index 5577170c90..4f9b41a0dd 100755..100644
--- a/sfx2/source/dialog/securitypage.cxx
+++ b/sfx2/source/dialog/securitypage.cxx
@@ -245,6 +245,36 @@ SfxSecurityPage_Impl::SfxSecurityPage_Impl( SfxSecurityPage &rTabPage, const Sfx
m_aRecordChangesCB.SetStyle( m_aRecordChangesCB.GetStyle() | WB_EARLYTOGGLE );
m_aRecordChangesCB.SetToggleHdl( LINK( this, SfxSecurityPage_Impl, RecordChangesCBToggleHdl ) );
m_aChangeProtectionPB.SetClickHdl( LINK( this, SfxSecurityPage_Impl, ChangeProtectionPBHdl ) );
+
+
+ // #i112277: for the time being (OOO 3.3) the following options should not
+ // be available. In the long run however it is planned to implement the yet
+ // missing functionality. Thus now we hide them and move the remaining ones up.
+ m_aNewPasswordToOpenFL.Hide();
+ m_aNewPasswordToOpenFT.Hide();
+ m_aNewPasswordToOpenED.Hide();
+ m_aConfirmPasswordToOpenFT.Hide();
+ m_aConfirmPasswordToOpenED.Hide();
+ m_aNewPasswordInfoFT.Hide();
+ m_aNewPasswordToModifyFL.Hide();
+ m_aNewPasswordToModifyFT.Hide();
+ m_aNewPasswordToModifyED.Hide();
+ m_aConfirmPasswordToModifyFT.Hide();
+ m_aConfirmPasswordToModifyED.Hide();
+ const long nDelta = m_aOptionsFL.GetPosPixel().Y() - m_aNewPasswordToOpenFL.GetPosPixel().Y();
+ Point aPos;
+ aPos = m_aOptionsFL.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aOptionsFL.SetPosPixel( aPos );
+ aPos = m_aOpenReadonlyCB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aOpenReadonlyCB.SetPosPixel( aPos );
+ aPos = m_aRecordChangesCB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aRecordChangesCB.SetPosPixel( aPos );
+ aPos = m_aChangeProtectionPB.GetPosPixel();
+ aPos.Y() -= nDelta;
+ m_aChangeProtectionPB.SetPosPixel( aPos );
}
diff --git a/sfx2/source/dialog/securitypage.src b/sfx2/source/dialog/securitypage.src
index 4818068990..4818068990 100755..100644
--- a/sfx2/source/dialog/securitypage.src
+++ b/sfx2/source/dialog/securitypage.src
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 795f5a20ca..28b6f22735 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -489,6 +489,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_SAVEASDOC:
case SID_SAVEDOC:
{
+ // derived class may decide to abort this
+ if( !QuerySlotExecutable( nId ) )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) );
+ return;
+ }
+
//!! detaillierte Auswertung eines Fehlercodes
SfxObjectShellRef xLock( this );
@@ -895,7 +902,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
rReq.Done();
}
-//--------------------------------------------------------------------
+//-------------------------------------------------------------------------
void SfxObjectShell::GetState_Impl(SfxItemSet &rSet)
{
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 8d0fea6811..ac048a24e2 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -195,6 +195,13 @@ sal_Bool SfxObjectShell::SaveAs( SfxMedium& rMedium )
//-------------------------------------------------------------------------
+sal_Bool SfxObjectShell::QuerySlotExecutable( USHORT /*nSlotId*/ )
+{
+ return sal_True;
+}
+
+//-------------------------------------------------------------------------
+
sal_Bool GetPasswd_Impl( const SfxItemSet* pSet, ::rtl::OUString& rPasswd )
{
const SfxPoolItem* pItem = NULL;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index 11268aeab5..a9a75831e2 100755..100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -526,6 +526,13 @@ SfxObjectShell* SfxObjectShell::Current()
return pFrame ? pFrame->GetObjectShell() : 0;
}
+//-------------------------------------------------------------------------
+
+sal_Bool SfxObjectShell::IsInPrepareClose() const
+{
+ return pImp->bInPrepareClose;
+}
+
//------------------------------------------------------------------------
struct BoolEnv_Impl
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index 2486f4e9fb..8122e61147 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -977,6 +977,8 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
aArgs.remove( "BreakMacroSignature" );
aArgs.remove( "Stream" );
aArgs.remove( "InputStream" );
+ aArgs.remove( "URL" );
+ aArgs.remove( "Frame" );
// TODO/LATER: all the parameters that are accepted by ItemSet of the DocShell must be removed here
@@ -988,6 +990,10 @@ sal_Bool SAL_CALL SfxBaseModel::attachResource( const ::rtl::OUString&
SfxAllItemSet aSet( pObjectShell->GetPool() );
TransformParameters( SID_OPENDOC, rArgs, aSet );
+ // the arguments are not allowed to reach the medium
+ aSet.ClearItem( SID_FILE_NAME );
+ aSet.ClearItem( SID_FILLFRAME );
+
pMedium->GetItemSet()->Put( aSet );
SFX_ITEMSET_ARG( &aSet, pItem, SfxStringItem, SID_FILTER_NAME, sal_False );
if ( pItem )
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 21d10471fc..a8edc018ce 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -813,6 +813,13 @@ void SfxViewFrame::ExecReload_Impl( SfxRequest& rReq )
xNewObj->SetModifyPasswordEntered( sal_False );
xNewObj->SetReadOnly();
}
+ else if ( rReq.GetSlot() == SID_EDITDOC && bForEdit && !xNewObj->IsReadOnlyMedium() )
+ {
+ // the filter might request setting of the document to readonly state
+ // but in case of SID_EDITDOC it should not happen if the document
+ // can be opened for editing
+ xNewObj->SetReadOnlyUI( sal_False );
+ }
if ( xNewObj->IsDocShared() )
{
@@ -2144,6 +2151,8 @@ SfxViewShell* SfxViewFrame::LoadViewIntoFrame_Impl( const SfxObjectShell& i_rDoc
aTransformLoadArgs.remove( "Hidden" );
::rtl::OUString sURL( RTL_CONSTASCII_USTRINGPARAM( "private:object" ) );
+ if ( !sURL.getLength() )
+ sURL = i_rDoc.GetFactory().GetFactoryURL();
Reference< XComponentLoader > xLoader( i_rFrame, UNO_QUERY_THROW );
xLoader->loadComponentFromURL( sURL, ::rtl::OUString::createFromAscii( "_self" ), 0,
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index f6854f0f36..43c9c8bf20 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -700,6 +700,14 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
case SID_PRINTDOCDIRECT:
{
SfxObjectShell* pDoc = GetObjectShell();
+
+ // derived class may decide to abort this
+ if( !pDoc->QuerySlotExecutable( nId ) )
+ {
+ rReq.SetReturnValue( SfxBoolItem( 0, FALSE ) );
+ return;
+ }
+
bool bDetectHidden = ( !bSilent && pDoc );
if ( bDetectHidden && pDoc->QueryHiddenInformation( WhenPrinting, NULL ) != RET_YES )
break;
diff --git a/svx/inc/svx/dialogs.hrc b/svx/inc/svx/dialogs.hrc
index eb304d09f3..26cd56c2ef 100755
--- a/svx/inc/svx/dialogs.hrc
+++ b/svx/inc/svx/dialogs.hrc
@@ -956,7 +956,9 @@
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_6 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 6)//?
#define RID_SVXSTR_OUTLINENUM_DESCRIPTION_7 (RID_SVXSTR_OUTLINENUM_DESCRIPTIONS + 7)//?
-#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1190)
+#define RID_SVXSTR_FINDBAR_FIND (RID_SVX_START + 1190)
+
+#define RID_SVXSTR_NEXTFREE (RID_SVX_START + 1191)
// ----------------------------------------------------------------------------
// if we have _a_lot_ time, we should group the resource ids by type, instead
diff --git a/svx/source/tbxctrls/makefile.mk b/svx/source/tbxctrls/makefile.mk
index 73a178d975..a9ea745f3c 100644
--- a/svx/source/tbxctrls/makefile.mk
+++ b/svx/source/tbxctrls/makefile.mk
@@ -74,6 +74,7 @@ SRC1FILES = \
lboxctrl.src \
linectrl.src \
tbcontrl.src \
+ tbunosearchcontrollers.src \
tbxdraw.src \
grafctrl.src
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 25c0576e64..5000f7e240 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -29,6 +29,8 @@
#include "precompiled_svx.hxx"
#include "tbunosearchcontrollers.hxx"
+#include <svx/dialogs.hrc>
+#include <svx/dialmgr.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
@@ -91,7 +93,7 @@ FindTextFieldControl::~FindTextFieldControl()
void FindTextFieldControl::InitControls_Impl()
{
- SetText( String( ::rtl::OUString::createFromAscii("Find") ) );
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
EnableAutocomplete(TRUE, TRUE);
@@ -174,7 +176,7 @@ long FindTextFieldControl::PreNotify( NotifyEvent& rNEvt )
case EVENT_LOSEFOCUS:
if ( GetText().Len() == 0 )
{
- SetText( String( ::rtl::OUString::createFromAscii("Find") ) );
+ SetText( SVX_RESSTR( RID_SVXSTR_FINDBAR_FIND ) );
SetControlForeground(GetSettings().GetStyleSettings().GetDisableColor());
m_bToClearTextField = sal_True;
}
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.src b/svx/source/tbxctrls/tbunosearchcontrollers.src
new file mode 100644
index 0000000000..ff1565e2d2
--- /dev/null
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.src
@@ -0,0 +1,33 @@
+/*************************************************************************
+ *
+ * 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 <svx/dialogs.hrc>
+
+String RID_SVXSTR_FINDBAR_FIND
+{
+ Text [ en-US ] = "Find" ;
+};
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index afbd896b2b..4ba494f83b 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -53,18 +53,21 @@ public:
virtual void SAL_CALL setScreenUpdating(sal_Bool bUpdate) throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getDisplayStatusBar() throw (css::uno::RuntimeException);
virtual void SAL_CALL setDisplayStatusBar(sal_Bool bDisplayStatusBar) throw (css::uno::RuntimeException);
- virtual ::sal_Bool SAL_CALL getInteractive() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setInteractive( ::sal_Bool bInteractive ) throw (::com::sun::star::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getInteractive() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setInteractive( ::sal_Bool bInteractive ) throw (css::uno::RuntimeException);
+ virtual ::sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( ::sal_Bool bVisible ) throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL CommandBars( const css::uno::Any& aIndex ) throw (css::uno::RuntimeException);
virtual ::rtl::OUString SAL_CALL getVersion() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
+ virtual css::uno::Any SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
+
virtual void SAL_CALL Run( const ::rtl::OUString& MacroName, const css::uno::Any& varg1, const css::uno::Any& varg2, const css::uno::Any& varg3, const css::uno::Any& varg4, const css::uno::Any& varg5, const css::uno::Any& varg6, const css::uno::Any& varg7, const css::uno::Any& varg8, const css::uno::Any& varg9, const css::uno::Any& varg10, const css::uno::Any& varg11, const css::uno::Any& varg12, const css::uno::Any& varg13, const css::uno::Any& varg14, const css::uno::Any& varg15, const css::uno::Any& varg16, const css::uno::Any& varg17, const css::uno::Any& varg18, const css::uno::Any& varg19, const css::uno::Any& varg20, const css::uno::Any& varg21, const css::uno::Any& varg22, const css::uno::Any& varg23, const css::uno::Any& varg24, const css::uno::Any& varg25, const css::uno::Any& varg26, const css::uno::Any& varg27, const css::uno::Any& varg28, const css::uno::Any& varg29, const css::uno::Any& varg30 ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL OnTime( const ::com::sun::star::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const ::com::sun::star::uno::Any& aLatestTime, const ::com::sun::star::uno::Any& aSchedule ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL OnTime( const css::uno::Any& aEarliestTime, const ::rtl::OUString& aFunction, const css::uno::Any& aLatestTime, const css::uno::Any& aSchedule ) throw (css::uno::RuntimeException);
virtual float SAL_CALL CentimetersToPoints( float _Centimeters ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Undo( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL Quit( ) throw (::com::sun::star::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL getVBE() throw (css::uno::RuntimeException);
- virtual css::uno::Any SAL_CALL SAL_CALL getVBProjects() throw (css::uno::RuntimeException);
-
+ virtual void SAL_CALL Undo() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Quit() throw (css::uno::RuntimeException);
+
// XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
index 20b220c1f5..27ffa25eeb 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -133,11 +133,12 @@ protected:
class VBAHELPER_DLLPUBLIC EnumerationHelperImpl : public EnumerationHelper_BASE
{
protected:
+ css::uno::WeakReference< ov::XHelperInterface > m_xParent;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
css::uno::Reference< css::container::XEnumeration > m_xEnumeration;
public:
- EnumerationHelperImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
+ EnumerationHelperImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XEnumeration >& xEnumeration ) throw ( css::uno::RuntimeException ) : m_xParent( xParent ), m_xContext( xContext ), m_xEnumeration( xEnumeration ) { }
virtual ::sal_Bool SAL_CALL hasMoreElements( ) throw (css::uno::RuntimeException) { return m_xEnumeration->hasMoreElements(); }
};
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index 29335304db..b68eb06815 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -52,9 +52,7 @@ public:
virtual ::rtl::OUString SAL_CALL getFullName() throw (css::uno::RuntimeException);
virtual sal_Bool SAL_CALL getSaved() throw (css::uno::RuntimeException);
virtual void SAL_CALL setSaved( sal_Bool bSave ) throw (css::uno::RuntimeException);
-
- virtual css::uno::Any SAL_CALL getVBProject() throw (css::uno::RuntimeException); // Michhael E. Bohn
-
+ virtual css::uno::Any SAL_CALL getVBProject() throw (css::uno::RuntimeException);
// Methods
virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
diff --git a/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
new file mode 100755
index 0000000000..b0dd184c1a
--- /dev/null
+++ b/vbahelper/inc/vbahelper/vbaeventshelperbase.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * 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 VBAHELPER_VBAEVENTSHELPERBASE_HXX
+#define VBAHELPER_VBAEVENTSHELPERBASE_HXX
+
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/script/vba/XVBAEventProcessor.hpp>
+#include <cppuhelper/implbase2.hxx>
+#include <map>
+#include <deque>
+#include "vbahelper/vbahelper.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace uno { class XComponentContext; }
+} } }
+
+// ============================================================================
+
+typedef ::cppu::WeakImplHelper2< css::script::vba::XVBAEventProcessor, css::lang::XEventListener > VbaEventsHelperBase_BASE;
+
+class VBAHELPER_DLLPUBLIC VbaEventsHelperBase : public VbaEventsHelperBase_BASE
+{
+public:
+ VbaEventsHelperBase(
+ const css::uno::Sequence< css::uno::Any >& rArgs,
+ const css::uno::Reference< css::uno::XComponentContext >& xContext );
+ virtual ~VbaEventsHelperBase();
+
+ // XVBAEventProcessor
+ virtual sal_Bool SAL_CALL hasVbaEventHandler( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::uno::RuntimeException);
+ virtual void SAL_CALL processVbaEvent( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException, css::script::provider::ScriptFrameworkErrorException, css::util::VetoException, css::uno::RuntimeException);
+
+ // XEventListener
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aSource ) throw (css::uno::RuntimeException);
+
+protected:
+ // ------------------------------------------------------------------------
+
+ enum EventHandlerType { EVENTHANDLER_GLOBAL, EVENTHANDLER_DOCUMENT };
+ struct EventHandlerInfo
+ {
+ sal_Int32 mnEventId;
+ ::rtl::OUString maMacroName;
+ EventHandlerType meType;
+ sal_Int32 mnCancelIndex;
+ css::uno::Any maUserData;
+ };
+
+ /** Registers a supported event handler.
+
+ @param nEventId Event identifier from com.sun.star.script.vba.EventIdentifier.
+ @param pcMacroName Name of the associated VBA event handler macro.
+ @param eType Document event or global event.
+ @param nCancelIndex 0-based index of Cancel parameter, or -1.
+ @param rUserData User data for free usage in derived implementations. */
+ void registerEventHandler(
+ sal_Int32 nEventId,
+ const sal_Char* pcMacroName,
+ EventHandlerType eType = EVENTHANDLER_DOCUMENT,
+ sal_Int32 nCancelIndex = -1,
+ const css::uno::Any& rUserData = css::uno::Any() );
+
+ /** Throws, if the passed sequence does not contain a value at the specified index. */
+ static inline void checkArgument( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( rArgs.getLength() <= nIndex ) throw css::lang::IllegalArgumentException(); }
+
+ /** Throws, if the passed sequence does not contain a value of a specific at the specified index. */
+ template< typename Type >
+ static inline void checkArgumentType( const css::uno::Sequence< css::uno::Any >& rArgs, sal_Int32 nIndex ) throw (css::lang::IllegalArgumentException)
+ { if( (rArgs.getLength() <= nIndex) || !rArgs[ nIndex ].has< Type >() ) throw css::lang::IllegalArgumentException(); }
+
+ // ------------------------------------------------------------------------
+
+ struct EventQueueEntry
+ {
+ sal_Int32 mnEventId;
+ css::uno::Sequence< css::uno::Any > maArgs;
+ inline /*implicit*/ EventQueueEntry( sal_Int32 nEventId ) : mnEventId( nEventId ) {}
+ inline EventQueueEntry( sal_Int32 nEventId, const css::uno::Sequence< css::uno::Any >& rArgs ) : mnEventId( nEventId ), maArgs( rArgs ) {}
+ };
+ typedef ::std::deque< EventQueueEntry > EventQueue;
+
+ /** Derived classes return whether event processing is enabled. Throws if
+ the instance is in an invalid state. */
+ virtual bool implEventsEnabled() throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes do additional prpeparations and return whether the
+ event handler has to be called. */
+ virtual bool implPrepareEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the argument list for the specified VBA event handler. */
+ virtual css::uno::Sequence< css::uno::Any > implBuildArgumentList(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) throw (css::lang::IllegalArgumentException) = 0;
+
+ /** Derived classes may do additional postprocessing. Called even if the
+ event handler does not exist, or if an error occured during execution. */
+ virtual void implPostProcessEvent(
+ EventQueue& rEventQueue,
+ const EventHandlerInfo& rInfo,
+ bool bSuccess,
+ bool bCancel ) throw (css::uno::RuntimeException) = 0;
+
+ /** Derived classes have to return the name of the Basic document module. */
+ virtual ::rtl::OUString implGetDocumentModuleName(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException) = 0;
+
+private:
+ /** Returns the event handler info struct for the specified event, or throws. */
+ const EventHandlerInfo& getEventHandlerInfo( sal_Int32 nEventId ) const throw (css::lang::IllegalArgumentException);
+
+ /** Searches the event handler in the document and returns its full script path. */
+ ::rtl::OUString getEventHandlerPath(
+ const EventHandlerInfo& rInfo,
+ const css::uno::Sequence< css::uno::Any >& rArgs ) const throw (css::lang::IllegalArgumentException);
+
+ /** Removes this instance from all broadcasters. */
+ void stopListening();
+
+protected:
+ css::uno::Reference< css::frame::XModel > mxModel;
+ SfxObjectShell* mpShell;
+
+private:
+ typedef ::std::map< sal_Int32, EventHandlerInfo > EventHandlerMap;
+
+ EventHandlerMap maEvents;
+ bool mbDisposed;
+};
+
+// ============================================================================
+
+#endif
diff --git a/vbahelper/inc/vbahelper/vbaglobalbase.hxx b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
index d2d0399c11..1394a7c749 100644
--- a/vbahelper/inc/vbahelper/vbaglobalbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaglobalbase.hxx
@@ -32,16 +32,16 @@
typedef InheritedHelperInterfaceImpl1< ov::XGlobalsBase > Globals_BASE;
class VBAHELPER_DLLPUBLIC VbaGlobalsBase : public Globals_BASE
-
{
protected:
-
+ rtl::OUString msDocCtxName;
+
bool hasServiceName( const rtl::OUString& serviceName );
void init( const css::uno::Sequence< css::beans::PropertyValue >& aInitArgs );
public:
VbaGlobalsBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName );
- virtual ~VbaGlobalsBase(){};
+ virtual ~VbaGlobalsBase();
// XMultiServiceFactory
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (css::uno::Exception, css::uno::RuntimeException);
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) throw (css::uno::Exception, css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index 024b0d3aa8..538360899e 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -63,6 +63,7 @@ namespace ooo
throw css::lang::IllegalArgumentException();
return aSomething;
}
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell );
VBAHELPER_DLLPUBLIC SfxObjectShell* getSfxObjShell( const css::uno::Reference< css::frame::XModel >& xModel ) throw ( css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbahelperinterface.hxx b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
index 45fb518572..315d28d093 100644
--- a/vbahelper/inc/vbahelper/vbahelperinterface.hxx
+++ b/vbahelper/inc/vbahelper/vbahelperinterface.hxx
@@ -28,6 +28,8 @@
#define OOVBAAPI_VBA_HELPERINTERFACE_HXX
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <ooo/vba/XHelperInterface.hpp>
#include <vbahelper/vbahelper.hxx>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -68,6 +70,7 @@ protected:
css::uno::Reference< css::uno::XComponentContext > mxContext;
public:
InheritedHelperInterfaceImpl() {}
+ InheritedHelperInterfaceImpl( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxContext( xContext ) {}
InheritedHelperInterfaceImpl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : mxParent( xParent ), mxContext( xContext ) {}
virtual rtl::OUString& getServiceImplName() = 0;
virtual css::uno::Sequence<rtl::OUString> getServiceNames() = 0;
@@ -86,7 +89,6 @@ public:
return xNameAccess->getByName( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Application" ) ) );
}
-
// XServiceInfo Methods
virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (css::uno::RuntimeException) { return getServiceImplName(); }
virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (css::uno::RuntimeException)
@@ -101,19 +103,39 @@ public:
}
virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (css::uno::RuntimeException)
{
- css::uno::Sequence< rtl::OUString > aNames = getServiceNames();;
+ css::uno::Sequence< rtl::OUString > aNames = getServiceNames();
return aNames;
}
};
template< typename Ifc1 >
class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl1 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
+public:
+ InheritedHelperInterfaceImpl1< Ifc1 >() {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl1< Ifc1 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+template< typename Ifc1, typename Ifc2 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl2 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > >
{
-typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper1< Ifc1 > > Base;
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper2< Ifc1, Ifc2 > > Base;
public:
- InheritedHelperInterfaceImpl1< Ifc1 > ( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >() {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl2< Ifc1, Ifc2 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
+};
+template< typename Ifc1, typename Ifc2, typename Ifc3 >
+class VBAHELPER_DLLPUBLIC InheritedHelperInterfaceImpl3 : public InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > >
+{
+ typedef InheritedHelperInterfaceImpl< ::cppu::WeakImplHelper3< Ifc1, Ifc2, Ifc3 > > Base;
+public:
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >() {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xContext ) {}
+ InheritedHelperInterfaceImpl3< Ifc1, Ifc2, Ifc3 >( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : Base( xParent, xContext ) {}
};
// ============================================================================
diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst
index d683e97c8b..2d20ab1f98 100644
--- a/vbahelper/prj/d.lst
+++ b/vbahelper/prj/d.lst
@@ -26,3 +26,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
..\inc\vbahelper\vbatextframe.hxx %_DEST%\inc%_EXT%\vbahelper\vbatextframe.hxx
..\inc\vbahelper\vbashaperange.hxx %_DEST%\inc%_EXT%\vbahelper\vbashaperange.hxx
..\inc\vbahelper\vbapagesetupbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbapagesetupbase.hxx
+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx
index a273bb1952..78c8b25885 100644
--- a/vbahelper/source/msforms/vbacontrols.cxx
+++ b/vbahelper/source/msforms/vbacontrols.cxx
@@ -74,12 +74,20 @@ private:
public:
ControlArrayWrapper( const uno::Reference< awt::XControl >& xDialog )
{
- mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
- uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
-
- msNames.realloc( sXControls.getLength() );
- for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
- SetArrayElementTo( sXControls[ i ], i );
+ try
+ {
+ mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
+ uno::Sequence< uno::Reference< awt::XControl > > sXControls = mxDialog->getControls();
+
+ msNames.realloc( sXControls.getLength() );
+ for ( sal_Int32 i = 0; i < sXControls.getLength(); ++i )
+ SetArrayElementTo( sXControls[ i ], i );
+ }
+ catch( uno::Exception& )
+ {
+ // accept the case when the dialog already does not exist
+ // in this case the wrapper should work in dummy mode
+ }
}
static rtl::OUString getControlName( const uno::Reference< awt::XControl >& xCtrl )
@@ -186,7 +194,7 @@ ScVbaControls::ScVbaControls( const uno::Reference< XHelperInterface >& xParent,
const css::uno::Reference< awt::XControl >& xDialog )
: ControlsImpl_BASE( xParent, xContext, lcl_controlsWrapper( xDialog ) )
{
- mxDialog.set( xDialog, uno::UNO_QUERY_THROW );
+ mxDialog.set( xDialog, uno::UNO_QUERY );
}
uno::Reference< container::XEnumeration >
@@ -349,13 +357,16 @@ void SAL_CALL ScVbaControls::Remove( const uno::Any& StringKeyOrIndex )
}
catch( uno::RuntimeException& )
{
- throw;
+ // the exceptions are not rethrown, impossibility to find or remove the control is currently not reported
+ // since in most cases it means just that the controls is already not there, the VBA seems to do it in the same way
+
+ // throw;
}
catch( uno::Exception& e )
{
- throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
- uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ // throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not create AXControl!" ) ),
+ // uno::Reference< uno::XInterface >(),
+ // uno::makeAny( e ) );
}
}
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index 2c04ea6759..12422bc559 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -185,7 +185,9 @@ ScVbaUserForm::hasMethod( const ::rtl::OUString& /*aName*/ ) throw (uno::Runtime
uno::Any SAL_CALL
ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException)
{
- uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW );
+ // if the dialog already closed we should do nothing, but the VBA will call methods of the Controls objects
+ // thus we have to provide a dummy object in this case
+ uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY );
uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl ) );
if ( index.hasValue() )
return uno::makeAny( xControls->Item( index, uno::Any() ) );
diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk
index 47ad44b3d0..22ed40a3ad 100644
--- a/vbahelper/source/vbahelper/makefile.mk
+++ b/vbahelper/source/vbahelper/makefile.mk
@@ -65,6 +65,8 @@ SLOFILES=\
$(SLO)$/vbashaperange.obj \
$(SLO)$/vbatextframe.obj \
$(SLO)$/vbapagesetupbase.obj \
+ $(SLO)$/vbaeventshelperbase.obj
+
# --- Targets -------------------------------------------------------
.INCLUDE : target.mk
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 13aa451a31..57e303893e 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -24,39 +24,37 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
+
#include "vbahelper/vbaapplicationbase.hxx"
+
#include <com/sun/star/container/XIndexAccess.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp> //Michael E. Bohn
-#include <com/sun/star/lang/XMultiComponentFactory.hpp> //Michael E. Bohn
-#include <com/sun/star/lang/XComponent.hpp> //Michael E. Bohn
-#include <com/sun/star/container/XEnumeration.hpp> //Michael E. Bohn
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
#include <com/sun/star/frame/XLayoutManager.hpp>
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/document/XDocumentInfoSupplier.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
-#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
-#include <ooo/vba/XVBAAppService.hpp> //Michael E. Bohn
+#include <com/sun/star/document/XEmbeddedScripts.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
-
-#include "vbacommandbars.hxx"
+#include <hash_map>
#include <filter/msfilter/msvbahelper.hxx>
#include <tools/datetime.hxx>
-// start basic includes
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
#include <basic/sbuno.hxx>
#include <basic/sbmeth.hxx>
#include <basic/sbmod.hxx>
-// end basic includes
-#include <hash_map>
+#include "vbacommandbars.hxx"
-using namespace com::sun::star;
-using namespace ooo::vba;
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
#define OFFICEVERSION "11.0"
@@ -162,6 +160,9 @@ typedef ::std::hash_map< VbaTimerInfo, VbaTimer*, VbaTimerInfoHash, ::std::equal
struct VbaApplicationBase_Impl
{
VbaTimerHashMap m_aTimerHash;
+ sal_Bool mbVisible;
+
+ inline VbaApplicationBase_Impl() : mbVisible( sal_True ) {}
virtual ~VbaApplicationBase_Impl()
{
@@ -185,7 +186,6 @@ VbaApplicationBase::VbaApplicationBase( const uno::Reference< uno::XComponentCon
VbaApplicationBase::~VbaApplicationBase()
{
- m_pImpl = 0;
delete m_pImpl;
}
@@ -268,6 +268,16 @@ void SAL_CALL VbaApplicationBase::setInteractive( ::sal_Bool bInteractive )
xWindow->setEnable( bInteractive );
}
+sal_Bool SAL_CALL VbaApplicationBase::getVisible() throw (uno::RuntimeException)
+{
+ return m_pImpl->mbVisible; // dummy implementation
+}
+
+void SAL_CALL VbaApplicationBase::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
+{
+ m_pImpl->mbVisible = bVisible; // dummy implementation
+}
+
uno::Any SAL_CALL
VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeException)
{
@@ -407,63 +417,50 @@ float SAL_CALL VbaApplicationBase::CentimetersToPoints( float _Centimeters ) thr
return ( _Centimeters * rate );
}
-// inserted by Michael E. Bohn
uno::Any SAL_CALL VbaApplicationBase::getVBE() throw (uno::RuntimeException)
{
- uno::Any aAny;
- uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
- try
- {
- uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAAppService" )),mxContext);
- uno::Reference < ::ooo::vba::XVBAAppService > xVBAAppService (xInterface, ::uno::UNO_QUERY_THROW );
- if (xVBAAppService.is()){
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- return xVBAAppService->getVBE( this, mxContext, xModel);
- }
-
- }catch(uno::Exception* e)
- {
- }
- return aAny;
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= getCurrentDocument();
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBE = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBE" ) ), aArgs, mxContext );
+ return uno::Any( xVBE );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
uno::Any SAL_CALL
VbaApplicationBase::getVBProjects() throw (uno::RuntimeException)
{
- uno::Any aAny;
- uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
- try
- {
- uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAAppService" )),mxContext);
- uno::Reference < ::ooo::vba::XVBAAppService > xVBAAppService (xInterface, ::uno::UNO_QUERY_THROW );
- if (xVBAAppService.is()){
- uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XEmbeddedScripts > xEnbeddedScripts ( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< script::XStorageBasedLibraryContainer > xMacroStorageBasedLibraryContainer = xEnbeddedScripts->getBasicLibraries();
- uno::Reference< script::XStorageBasedLibraryContainer > xDialogStorageBasedLibraryContainer = xEnbeddedScripts->getDialogLibraries();
- uno::Reference< script::XLibraryContainer > xMacroLibraryContainer ( xMacroStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
- uno::Reference< script::XLibraryContainer > xDialogLibraryContainer( xDialogStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
- return xVBAAppService->getVBProjects(this, mxContext, xModel, xMacroLibraryContainer, xDialogLibraryContainer);
- }
-
- }catch(uno::Exception* e)
- {
- }
- return aAny;
-
-
-
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= getCurrentDocument();
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProjects" ) ), aArgs, mxContext );
+ return uno::Any( xVBProjects );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
-
-
-
-rtl::OUString&
+rtl::OUString&
VbaApplicationBase::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaApplicationBase") );
return sImplName;
}
+
uno::Sequence<rtl::OUString>
VbaApplicationBase::getServiceNames()
{
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 2f21943d63..0eba699a07 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -24,9 +24,9 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-#include <vbahelper/vbadocumentbase.hxx>
-#include <vbahelper/helperdecl.hxx>
-#include <comphelper/unwrapargs.hxx>
+
+#include "vbahelper/vbadocumentbase.hxx"
+#include "vbahelper/helperdecl.hxx"
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/util/XProtectable.hpp>
@@ -35,8 +35,8 @@
#include <com/sun/star/frame/XFrame.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
#include <com/sun/star/beans/XPropertySet.hpp>
-#include <ooo/vba/XVBADocService.hpp>
+#include <comphelper/unwrapargs.hxx>
#include <tools/urlobj.hxx>
#include <osl/file.hxx>
@@ -206,41 +206,26 @@ VbaDocumentBase::Activate() throw (uno::RuntimeException)
xFrame->activate();
}
-// ---- Michael E.Bohn Start-----
-
uno::Any SAL_CALL
VbaDocumentBase::getVBProject() throw (uno::RuntimeException)
-
{
- uno::Any aAny;
- uno::Reference< ::lang::XMultiComponentFactory > xServiceManager = mxContext->getServiceManager();
- try
- {
- uno::Reference < ::uno::XInterface > xInterface = xServiceManager->createInstanceWithContext( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBADocService" )),mxContext);
- uno::Reference < ::ooo::vba::XVBADocService > xVBADocService (xInterface, ::uno::UNO_QUERY_THROW );
- if (xVBADocService.is()){
- uno::Reference< frame::XModel > xModel( getModel(), uno::UNO_QUERY_THROW );
- uno::Reference< document::XEmbeddedScripts > xEnbeddedScripts ( xModel, uno::UNO_QUERY_THROW );
- uno::Reference< script::XStorageBasedLibraryContainer > xMacroStorageBasedLibraryContainer = xEnbeddedScripts->getBasicLibraries();
- uno::Reference< script::XStorageBasedLibraryContainer > xDialogStorageBasedLibraryContainer = xEnbeddedScripts->getDialogLibraries();
- uno::Reference< script::XLibraryContainer > xMacroLibraryContainer ( xMacroStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
- uno::Reference< script::XLibraryContainer > xDialogLibraryContainer( xDialogStorageBasedLibraryContainer, uno::UNO_QUERY_THROW );
-
- return xVBADocService->getVBProject( this, mxContext, xModel, xMacroLibraryContainer, xDialogLibraryContainer );
- }
-
- }catch(uno::Exception* e)
- {
- }
- return aAny;
-
+ try // return empty object on error
+ {
+ uno::Sequence< uno::Any > aArgs( 2 );
+ aArgs[ 0 ] <<= uno::Reference< XHelperInterface >( this );
+ aArgs[ 1 ] <<= mxModel;
+ uno::Reference< lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XInterface > xVBProjects = xServiceManager->createInstanceWithArgumentsAndContext(
+ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBProject" ) ), aArgs, mxContext );
+ return uno::Any( xVBProjects );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ return uno::Any();
}
-
-// ---- Michael E.Bohn End -----
-
-
-rtl::OUString&
+rtl::OUString&
VbaDocumentBase::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("VbaDocumentBase") );
diff --git a/vbahelper/source/vbahelper/vbaeventshelperbase.cxx b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
new file mode 100755
index 0000000000..ee6eccbdd6
--- /dev/null
+++ b/vbahelper/source/vbahelper/vbaeventshelperbase.cxx
@@ -0,0 +1,218 @@
+/*************************************************************************
+ *
+ * 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 "vbahelper/vbaeventshelperbase.hxx"
+#include <filter/msfilter/msvbahelper.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::ooo::vba;
+
+// ============================================================================
+
+VbaEventsHelperBase::VbaEventsHelperBase( const uno::Sequence< uno::Any >& rArgs, const uno::Reference< uno::XComponentContext >& /*xContext*/ ) :
+ mpShell( 0 ),
+ mbDisposed( false )
+{
+ try
+ {
+ mxModel = getXSomethingFromArgs< frame::XModel >( rArgs, 0, false );
+ mpShell = getSfxObjShell( mxModel );
+
+ // add dispose listener
+ uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY_THROW );
+ xComponent->addEventListener( this );
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+VbaEventsHelperBase::~VbaEventsHelperBase()
+{
+ stopListening();
+}
+
+sal_Bool SAL_CALL VbaEventsHelperBase::hasVbaEventHandler( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+ throw (lang::IllegalArgumentException, uno::RuntimeException)
+{
+ // getEventHandlerInfo() throws, if unknown event dentifier has been passed
+ const EventHandlerInfo& rInfo = getEventHandlerInfo( nEventId );
+ // getEventHandlerPath() searches for the macro in the document
+ return getEventHandlerPath( rInfo, rArgs ).getLength() > 0;
+}
+
+void SAL_CALL VbaEventsHelperBase::processVbaEvent( sal_Int32 nEventId, const uno::Sequence< uno::Any >& rArgs )
+ throw (lang::IllegalArgumentException, script::provider::ScriptFrameworkErrorException, util::VetoException, uno::RuntimeException)
+{
+ /* Derived classes may add new event identifiers to be processed while
+ processing the original event. All unprocessed events are collected in
+ a queue. First element in the queue is the next event to be processed. */
+ EventQueue aEventQueue;
+ aEventQueue.push_back( EventQueueEntry( nEventId, rArgs ) );
+
+ /* bEnabled will track if event processing is enabled. Every event handler
+ may disable handling of other events. */
+ bool bEnabled = true;
+
+ /* bCancel will contain the current Cancel value. It is possible that
+ multiple events will try to modify the Cancel value. Every event
+ handler receives the Cancel value of the previous event handler. */
+ bool bCancel = false;
+
+ /* bSuccess will change to true if at least one event handler has been
+ executed successfully. */
+ bool bSuccess = false;
+
+ /* Loop as long as there are more events to be processed, and as event
+ handling is still enabled. Derived classes may add new events to be
+ processed in the virtual implPrepareEvent() function. */
+ while( bEnabled && !aEventQueue.empty() )
+ {
+ /* Check that all class members are available, and that we are not
+ disposed (this may have happened at any time during execution of
+ the last event handler). */
+ if( mbDisposed || !mxModel.is() || !mpShell )
+ throw uno::RuntimeException();
+
+ // get info for next event
+ const EventHandlerInfo& rInfo = getEventHandlerInfo( aEventQueue.front().mnEventId );
+ uno::Sequence< uno::Any > aEventArgs = aEventQueue.front().maArgs;
+ aEventQueue.pop_front();
+
+ // let derived classes decide whether event processing is still enabled
+ bEnabled = implEventsEnabled();
+ // let derived classes prepare the event, they may add new events for next iteration
+ if( bEnabled && implPrepareEvent( aEventQueue, rInfo, aEventArgs ) )
+ {
+ // search the event handler macro in the document
+ ::rtl::OUString aMacroPath = getEventHandlerPath( rInfo, aEventArgs );
+ bool bEventSuccess = false;
+ if( aMacroPath.getLength() > 0 )
+ {
+ // build the argument list
+ uno::Sequence< uno::Any > aVbaArgs = implBuildArgumentList( rInfo, aEventArgs );
+ // insert current cancel value
+ if( rInfo.mnCancelIndex >= 0 )
+ {
+ if( rInfo.mnCancelIndex >= aVbaArgs.getLength() )
+ throw lang::IllegalArgumentException();
+ aVbaArgs[ rInfo.mnCancelIndex ] <<= bCancel;
+ }
+ // execute the event handler
+ uno::Any aRet, aCaller;
+ bEventSuccess = executeMacro( mpShell, aMacroPath, aVbaArgs, aRet, aCaller );
+ // extract new cancel value
+ if( rInfo.mnCancelIndex >= 0 )
+ {
+ if( rInfo.mnCancelIndex >= aVbaArgs.getLength() )
+ throw lang::IllegalArgumentException();
+ // cancel value may be boolean or any integer type, Any(bool) does not extract to sal_Int32
+ bool bNewCancel = false;
+ sal_Int32 nNewCancel = 0;
+ if( aVbaArgs[ rInfo.mnCancelIndex ] >>= bNewCancel )
+ bCancel = bNewCancel;
+ else if( aVbaArgs[ rInfo.mnCancelIndex ] >>= nNewCancel )
+ bCancel = nNewCancel != 0;
+ }
+ }
+ // post processing (also, if event handler does not exist, or on error
+ implPostProcessEvent( aEventQueue, rInfo, bEventSuccess, bCancel );
+ // global success, if at least one event handler succeeded
+ bSuccess |= bEventSuccess;
+ }
+ }
+
+ // if event handlers want to cancel the event, do so regardless of any errors
+ if( bCancel )
+ throw util::VetoException();
+
+ // if no event handler finished successfully, throw
+ if( !bSuccess )
+ throw script::provider::ScriptFrameworkErrorException();
+}
+
+void SAL_CALL VbaEventsHelperBase::disposing( const lang::EventObject& /*aSource*/ ) throw (uno::RuntimeException)
+{
+ OSL_TRACE( "VbaEventsHelperBase::disposing" );
+ stopListening();
+ mbDisposed = true;
+}
+
+// protected ------------------------------------------------------------------
+
+void VbaEventsHelperBase::registerEventHandler( sal_Int32 nEventId,
+ const sal_Char* pcMacroName, EventHandlerType eType, sal_Int32 nCancelIndex, const uno::Any& rUserData )
+{
+ EventHandlerInfo& rInfo = maEvents[ nEventId ];
+ rInfo.mnEventId = nEventId;
+ rInfo.maMacroName = ::rtl::OUString::createFromAscii( pcMacroName );
+ rInfo.meType = eType;
+ rInfo.mnCancelIndex = nCancelIndex;
+ rInfo.maUserData = rUserData;
+}
+
+// private --------------------------------------------------------------------
+
+const VbaEventsHelperBase::EventHandlerInfo& VbaEventsHelperBase::getEventHandlerInfo(
+ sal_Int32 nEventId ) const throw (lang::IllegalArgumentException)
+{
+ EventHandlerMap::const_iterator aIt = maEvents.find( nEventId );
+ if( aIt == maEvents.end() )
+ throw lang::IllegalArgumentException();
+ return aIt->second;
+}
+
+::rtl::OUString VbaEventsHelperBase::getEventHandlerPath( const EventHandlerInfo& rInfo,
+ const uno::Sequence< uno::Any >& rArgs ) const throw (lang::IllegalArgumentException)
+{
+ ::rtl::OUString aMacroName;
+ switch( rInfo.meType )
+ {
+ case EVENTHANDLER_GLOBAL:
+ aMacroName = rInfo.maMacroName;
+ break;
+ case EVENTHANDLER_DOCUMENT:
+ aMacroName = ::rtl::OUStringBuffer( implGetDocumentModuleName( rInfo, rArgs ) ).
+ append( sal_Unicode( '.' ) ).append( rInfo.maMacroName ).makeStringAndClear();
+ break;
+ }
+ return resolveVBAMacro( mpShell, aMacroName ).ResolvedMacro();
+}
+
+void VbaEventsHelperBase::stopListening()
+{
+ if( !mbDisposed ) try
+ {
+ uno::Reference< lang::XComponent > xComponent( mxModel, uno::UNO_QUERY_THROW );
+ xComponent->removeEventListener( this );
+ }
+ catch( uno::Exception& )
+ {
+ }
+}
+
+// ============================================================================
diff --git a/vbahelper/source/vbahelper/vbaglobalbase.cxx b/vbahelper/source/vbahelper/vbaglobalbase.cxx
index adb0738a13..0388d145f2 100644
--- a/vbahelper/source/vbahelper/vbaglobalbase.cxx
+++ b/vbahelper/source/vbahelper/vbaglobalbase.cxx
@@ -35,22 +35,50 @@ using namespace ooo::vba;
rtl::OUString sApplication( RTL_CONSTASCII_USTRINGPARAM("Application") );
+// special key to return the Application
+rtl::OUString sAppService( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.Application") );
+
VbaGlobalsBase::VbaGlobalsBase(
const uno::Reference< ov::XHelperInterface >& xParent,
-const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
-: Globals_BASE( xParent, xContext )
+const uno::Reference< uno::XComponentContext >& xContext, const rtl::OUString& sDocCtxName )
+: Globals_BASE( xParent, xContext ), msDocCtxName( sDocCtxName )
{
// overwrite context with custom one ( that contains the application )
+ // wrap the service manager as we don't want the disposing context to tear down the 'normal' ServiceManager ( or at least thats what the code appears like it wants to do )
+ uno::Any aSrvMgr;
+ if ( xContext.is() && xContext->getServiceManager().is() )
+ {
+ aSrvMgr = uno::makeAny( xContext->getServiceManager()->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.stoc.OServiceManagerWrapper") ), xContext ) );
+ }
+
::cppu::ContextEntry_Init aHandlerContextInfo[] =
{
::cppu::ContextEntry_Init( sApplication, uno::Any() ),
::cppu::ContextEntry_Init( sDocCtxName, uno::Any() ),
+ ::cppu::ContextEntry_Init( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("/singletons/com.sun.star.lang.theServiceManager" ) ), aSrvMgr )
};
-
- mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), xContext );
-
+ // don't pass a delegate, this seems to introduce yet another cyclic dependency ( and
+ // some strange behavior
+ mxContext = ::cppu::createComponentContext( aHandlerContextInfo, sizeof( aHandlerContextInfo ) / sizeof( aHandlerContextInfo[0] ), NULL );
}
+VbaGlobalsBase::~VbaGlobalsBase()
+{
+ try
+ {
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ if ( xNameContainer.is() )
+ {
+ // release document reference ( we don't wan't the component context trying to dispose that )
+ xNameContainer->removeByName( msDocCtxName );
+ // release application reference, as it is holding onto the context
+ xNameContainer->removeByName( sApplication );
+ }
+ }
+ catch ( const uno::Exception& )
+ {
+ }
+}
void
VbaGlobalsBase::init( const uno::Sequence< beans::PropertyValue >& aInitArgs )
@@ -74,19 +102,30 @@ uno::Reference< uno::XInterface > SAL_CALL
VbaGlobalsBase::createInstance( const ::rtl::OUString& aServiceSpecifier ) throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xReturn;
-
- if ( hasServiceName( aServiceSpecifier ) )
+ if ( aServiceSpecifier.equals( sAppService ) )
+ {
+ // try to extract the Application from the context
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ xNameContainer->getByName( sApplication ) >>= xReturn;
+ }
+ else if ( hasServiceName( aServiceSpecifier ) )
xReturn = mxContext->getServiceManager()->createInstanceWithContext( aServiceSpecifier, mxContext );
return xReturn;
}
uno::Reference< uno::XInterface > SAL_CALL
-VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& ServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
+VbaGlobalsBase::createInstanceWithArguments( const ::rtl::OUString& aServiceSpecifier, const uno::Sequence< uno::Any >& Arguments ) throw (uno::Exception, uno::RuntimeException)
{
uno::Reference< uno::XInterface > xReturn;
- if ( hasServiceName( ServiceSpecifier ) )
- xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( ServiceSpecifier, Arguments, mxContext );
+ if ( aServiceSpecifier.equals( sAppService ) )
+ {
+ // try to extract the Application from the context
+ uno::Reference< container::XNameContainer > xNameContainer( mxContext, uno::UNO_QUERY );
+ xNameContainer->getByName( sApplication ) >>= xReturn;
+ }
+ else if ( hasServiceName( aServiceSpecifier ) )
+ xReturn = mxContext->getServiceManager()->createInstanceWithArgumentsAndContext( aServiceSpecifier, Arguments, mxContext );
return xReturn;
}
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 8654e6cb6a..86d8e478cd 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -1403,7 +1403,27 @@ void UserFormGeometryHelper::setHeight( double nHeight )
double points = double( static_cast<double>(_hmm) / factor);
return points;
}
-
+
+ uno::Reference< uno::XInterface > getUnoDocModule( const String& aModName, SfxObjectShell* pShell )
+ {
+ uno::Reference< uno::XInterface > xIf;
+ if ( pShell )
+ {
+ rtl::OUString sProj( RTL_CONSTASCII_USTRINGPARAM("Standard") );
+ BasicManager* pBasMgr = pShell->GetBasicManager();
+ if ( pBasMgr && pBasMgr->GetName().Len() )
+ sProj = pShell->GetBasicManager()->GetName();
+ StarBASIC* pBasic = pShell->GetBasicManager()->GetLib( sProj );
+ if ( pBasic )
+ {
+ SbModule* pMod = pBasic->FindModule( aModName );
+ if ( pMod )
+ xIf = pMod->GetUnoModule();
+ }
+ }
+ return xIf;
+ }
+
SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
SfxObjectShell* pFoundShell = NULL;
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 6adeb410bc..13c8e9848d 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -3107,6 +3107,9 @@ namespace xmloff { namespace token {
XML_N_CHART_EXT,
XML_COORDINATE_REGION,
+ XML_DIAGONAL_BL_TR_WIDTHS,
+ XML_DIAGONAL_TL_BR_WIDTHS,
+
XML_TOKEN_END
};
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7dc3bc32f4..fd878dda3e 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -3107,6 +3107,9 @@ namespace xmloff { namespace token {
TOKEN( "http://openoffice.org/2010/chart", XML_N_CHART_EXT ),
TOKEN( "coordinate-region", XML_COORDINATE_REGION ),
+ TOKEN( "diagonal-bl-tr-widths", XML_DIAGONAL_BL_TR_WIDTHS ),
+ TOKEN( "diagonal-tl-br-widths", XML_DIAGONAL_TL_BR_WIDTHS ),
+
#if OSL_DEBUG_LEVEL > 0
{ 0, NULL, NULL, XML_TOKEN_END }
#else