summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-06 10:16:27 +0100
committerNoel Power <noel.power@novell.com>2010-10-06 10:16:27 +0100
commit0b21b8b146fc4b982c7c9bbb866b9ff18a29332a (patch)
tree9b36a1dee6f92703604bcc86564568eefe711c22
parent8d4d17664c9c6207fa35458075559d1fbfbfa2a5 (diff)
initial commit for vba blob ( not including container_control stuff )
-rw-r--r--basic/inc/basic/basmgr.hxx2
-rw-r--r--basic/inc/basic/sbmeth.hxx3
-rw-r--r--basic/inc/basic/sbmod.hxx3
-rw-r--r--basic/inc/basic/sbuno.hxx1
-rw-r--r--basic/source/basmgr/basmgr.cxx19
-rw-r--r--basic/source/classes/image.cxx2
-rwxr-xr-xbasic/source/classes/sb.cxx89
-rwxr-xr-xbasic/source/classes/sbunoobj.cxx292
-rw-r--r--basic/source/classes/sbxmod.cxx165
-rw-r--r--basic/source/comp/codegen.cxx4
-rw-r--r--basic/source/comp/dim.cxx27
-rw-r--r--basic/source/comp/exprtree.cxx16
-rw-r--r--basic/source/comp/parser.cxx15
-rw-r--r--basic/source/comp/token.cxx1
-rw-r--r--basic/source/inc/dlgcont.hxx4
-rw-r--r--basic/source/inc/namecont.hxx5
-rw-r--r--basic/source/inc/parser.hxx1
-rw-r--r--basic/source/inc/runtime.hxx4
-rw-r--r--basic/source/inc/sbunoobj.hxx21
-rw-r--r--basic/source/inc/scriptcont.hxx4
-rw-r--r--basic/source/inc/token.hxx2
-rw-r--r--basic/source/runtime/methods.cxx166
-rw-r--r--basic/source/runtime/methods1.cxx551
-rw-r--r--basic/source/runtime/rtlproto.hxx14
-rwxr-xr-xbasic/source/runtime/runtime.cxx32
-rw-r--r--basic/source/runtime/stdobj.cxx123
-rw-r--r--basic/source/runtime/step0.cxx99
-rw-r--r--basic/source/runtime/step1.cxx13
-rwxr-xr-xbasic/source/runtime/step2.cxx8
-rw-r--r--basic/source/sbx/sbxvalue.cxx13
-rw-r--r--basic/source/uno/dlgcont.cxx10
-rw-r--r--basic/source/uno/scriptcont.cxx15
-rw-r--r--formula/inc/formula/FormulaCompiler.hxx2
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx86
-rw-r--r--officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu6
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Calc.xcs2
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Writer.xcs19
-rw-r--r--oovbaapi/genconstidl/api-to-idl.pl3
-rw-r--r--oovbaapi/ooo/vba/XApplicationBase.idl2
-rw-r--r--oovbaapi/ooo/vba/XDialogBase.idl2
-rw-r--r--oovbaapi/ooo/vba/XDocumentBase.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl25
-rw-r--r--oovbaapi/ooo/vba/excel/XGlobals.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XName.idl12
-rw-r--r--oovbaapi/ooo/vba/excel/XPageSetup.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XPivotCache.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XRange.idl13
-rw-r--r--oovbaapi/ooo/vba/excel/XWorkbook.idl4
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl5
-rw-r--r--oovbaapi/ooo/vba/excel/makefile.mk8
-rw-r--r--oovbaapi/ooo/vba/makefile.mk6
-rw-r--r--oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl12
-rw-r--r--oovbaapi/ooo/vba/msforms/XComboBox.idl1
-rw-r--r--oovbaapi/ooo/vba/msforms/XControl.idl1
-rw-r--r--oovbaapi/ooo/vba/msforms/XLabel.idl1
-rw-r--r--oovbaapi/ooo/vba/msforms/XListBox.idl2
-rw-r--r--oovbaapi/ooo/vba/msforms/XShape.idl1
-rw-r--r--oovbaapi/ooo/vba/msforms/XShapeRange.idl2
-rw-r--r--oovbaapi/ooo/vba/msforms/makefile.mk3
-rw-r--r--oovbaapi/ooo/vba/word/XApplication.idl1
-rw-r--r--oovbaapi/ooo/vba/word/XDocument.idl13
-rw-r--r--oovbaapi/ooo/vba/word/XField.idl2
-rw-r--r--oovbaapi/ooo/vba/word/XGlobals.idl1
-rw-r--r--oovbaapi/ooo/vba/word/XParagraph.idl1
-rw-r--r--oovbaapi/ooo/vba/word/XRange.idl8
-rw-r--r--oovbaapi/ooo/vba/word/XReplacement.idl2
-rw-r--r--oovbaapi/ooo/vba/word/XSection.idl4
-rw-r--r--oovbaapi/ooo/vba/word/XSelection.idl16
-rw-r--r--oovbaapi/ooo/vba/word/XStyle.idl15
-rw-r--r--oovbaapi/ooo/vba/word/XTable.idl2
-rw-r--r--oovbaapi/ooo/vba/word/XTemplate.idl1
-rw-r--r--oovbaapi/ooo/vba/word/XWindow.idl1
-rw-r--r--oovbaapi/ooo/vba/word/makefile.mk25
-rw-r--r--scripting/source/basprov/basprov.cxx37
-rw-r--r--scripting/source/basprov/basscript.cxx72
-rw-r--r--scripting/source/basprov/basscript.hxx29
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx22
-rw-r--r--scripting/source/dlgprov/dlgevtatt.hxx2
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx22
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx4
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx285
-rw-r--r--scripting/source/vbaevents/makefile.mk1
-rw-r--r--sfx2/inc/sfx2/objsh.hxx7
-rwxr-xr-xsfx2/inc/sfx2/sfx.hrc6
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx1
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/source/appl/app.cxx2
-rwxr-xr-xsfx2/source/appl/appuno.cxx20
-rw-r--r--sfx2/source/control/unoctitm.cxx13
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx84
-rw-r--r--sfx2/source/doc/docinf.cxx24
-rw-r--r--sfx2/source/doc/docmacromode.cxx56
-rwxr-xr-xsfx2/source/doc/objmisc.cxx19
-rw-r--r--sfx2/source/doc/objuno.cxx37
-rw-r--r--sfx2/source/doc/objxtor.cxx38
-rwxr-xr-xsfx2/source/doc/oleprops.hxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx32
-rw-r--r--sfx2/source/inc/SfxDocumentMetaData.hxx11
-rw-r--r--sfx2/source/view/viewprn.cxx8
-rw-r--r--svx/source/form/fmscriptingenv.cxx20
-rw-r--r--svx/source/form/makefile.mk4
-rw-r--r--vbahelper/inc/vbahelper/vbaaccesshelper.hxx4
-rw-r--r--vbahelper/inc/vbahelper/vbaapplicationbase.hxx2
-rw-r--r--vbahelper/inc/vbahelper/vbacollectionimpl.hxx17
-rw-r--r--vbahelper/inc/vbahelper/vbadialogbase.hxx2
-rw-r--r--vbahelper/inc/vbahelper/vbadocumentbase.hxx2
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx27
-rw-r--r--vbahelper/inc/vbahelper/vbashape.hxx1
-rw-r--r--vbahelper/inc/vbahelper/vbashaperange.hxx3
-rw-r--r--vbahelper/prj/d.lst1
-rw-r--r--vbahelper/source/msforms/makefile.mk7
-rw-r--r--vbahelper/source/msforms/vbacheckbox.cxx4
-rw-r--r--vbahelper/source/msforms/vbacheckbox.hxx4
-rw-r--r--vbahelper/source/msforms/vbacombobox.cxx42
-rw-r--r--vbahelper/source/msforms/vbacontrol.cxx105
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx13
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx24
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx6
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx12
-rw-r--r--vbahelper/source/msforms/vbalabel.hxx2
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx18
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx4
-rw-r--r--vbahelper/source/msforms/vbalistcontrolhelper.cxx86
-rw-r--r--vbahelper/source/msforms/vbamultipage.cxx4
-rw-r--r--vbahelper/source/msforms/vbaradiobutton.cxx12
-rw-r--r--vbahelper/source/msforms/vbatextbox.cxx16
-rw-r--r--vbahelper/source/msforms/vbatogglebutton.cxx21
-rw-r--r--vbahelper/source/msforms/vbauserform.cxx23
-rw-r--r--vbahelper/source/msforms/vbauserform.hxx3
-rw-r--r--vbahelper/source/vbahelper/makefile.mk5
-rw-r--r--vbahelper/source/vbahelper/vbaapplicationbase.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbadialogbase.cxx28
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx31
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx11
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx70
-rw-r--r--vbahelper/source/vbahelper/vbapictureformat.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbashape.cxx123
-rw-r--r--vbahelper/source/vbahelper/vbashaperange.cxx31
-rw-r--r--vbahelper/source/vbahelper/vbashapes.cxx2
-rw-r--r--vbahelper/util/makefile.mk1
-rw-r--r--xmloff/inc/xmlnmspe.hxx1
-rw-r--r--xmloff/inc/xmloff/shapeexport.hxx5
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx4
-rw-r--r--xmloff/source/core/xmlexp.cxx1
-rw-r--r--xmloff/source/core/xmlimp.cxx4
-rw-r--r--xmloff/source/core/xmltoken.cxx3
-rw-r--r--xmloff/source/draw/eventimp.cxx46
-rw-r--r--xmloff/source/draw/shapeexport.cxx5
-rw-r--r--xmloff/source/draw/shapeexport2.cxx48
-rw-r--r--xmloff/source/draw/ximpshap.cxx17
-rw-r--r--xmloff/source/forms/elementexport.cxx35
-rw-r--r--xmloff/source/forms/formattributes.cxx8
-rw-r--r--xmloff/source/forms/formattributes.hxx1
-rw-r--r--xmloff/source/forms/layerimport.cxx2
-rw-r--r--xmloff/source/forms/strings.hxx1
-rw-r--r--xmlscript/inc/xmlscript/xmldlg_imexp.hxx18
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx14
-rw-r--r--xmlscript/source/xmldlg_imexp/imp_share.hxx54
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx11
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx191
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx29
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx418
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx34
-rw-r--r--xmlscript/util/makefile.mk1
164 files changed, 3900 insertions, 735 deletions
diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx
index 89dca9198b8e..8135d6ede38a 100644
--- a/basic/inc/basic/basmgr.hxx
+++ b/basic/inc/basic/basmgr.hxx
@@ -236,7 +236,7 @@ public:
takes the names of modules whose size exceeds the legacy limit
*/
bool LegacyPsswdBinaryLimitExceeded( ::com::sun::star::uno::Sequence< rtl::OUString >& _out_rModuleNames );
-
+ bool HasExeCode( const String& );
private:
BOOL IsReference( USHORT nLib );
diff --git a/basic/inc/basic/sbmeth.hxx b/basic/inc/basic/sbmeth.hxx
index ebfcd22d19af..63ff4aaf5e0b 100644
--- a/basic/inc/basic/sbmeth.hxx
+++ b/basic/inc/basic/sbmeth.hxx
@@ -46,6 +46,7 @@ class SbMethod : public SbxMethod
friend class SbIfaceMapperMethod;
SbMethodImpl* mpSbMethodImpl; // Impl data
+ SbxVariable* mCaller; // caller
SbModule* pMod;
USHORT nDebugFlags;
USHORT nLine1, nLine2;
@@ -72,7 +73,7 @@ public:
void GetLineRange( USHORT&, USHORT& );
// Interface to execute a method from the applications
- virtual ErrCode Call( SbxValue* pRet = NULL );
+ virtual ErrCode Call( SbxValue* pRet = NULL, SbxVariable* pCaller = NULL );
virtual void Broadcast( ULONG nHintId );
};
diff --git a/basic/inc/basic/sbmod.hxx b/basic/inc/basic/sbmod.hxx
index abb482f7bfe5..2f6d049e24d8 100644
--- a/basic/inc/basic/sbmod.hxx
+++ b/basic/inc/basic/sbmod.hxx
@@ -59,6 +59,8 @@ class SbModule : public SbxObject
SbModuleImpl* mpSbModuleImpl; // Impl data
std::vector< String > mModuleVariableNames;
+ SbModule();
+ SbModule(const SbModule&);
protected:
com::sun::star::uno::Reference< com::sun::star::script::XInvocation > mxWrapper;
@@ -132,6 +134,7 @@ public:
BOOL LoadBinaryData( SvStream& );
BOOL ExceedsLegacyModuleSize();
void fixUpMethodStart( bool bCvtToLegacy, SbiImage* pImg = NULL ) const;
+ bool HasExeCode();
BOOL IsVBACompat() const;
void SetVBACompat( BOOL bCompat );
INT32 GetModuleType() { return mnType; }
diff --git a/basic/inc/basic/sbuno.hxx b/basic/inc/basic/sbuno.hxx
index d816d424313b..cc29e3eb4734 100644
--- a/basic/inc/basic/sbuno.hxx
+++ b/basic/inc/basic/sbuno.hxx
@@ -38,6 +38,7 @@ SbxObjectRef GetSbUnoObject( const String& aName, const com::sun::star::uno::Any
// Force creation of all properties for debugging
void createAllObjectProperties( SbxObject* pObj );
+void SetSbUnoObjectDfltPropName( SbxObject* pObj );
::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index 84763468e64c..a297600ceaea 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1139,6 +1139,25 @@ void BasicManager::LegacyDeleteBasicManager( BasicManager*& _rpManager )
_rpManager = NULL;
}
+
+bool BasicManager::HasExeCode( const String& sLib )
+{
+ StarBASIC* pLib = GetLib(sLib);
+ if ( pLib )
+ {
+ SbxArray* pMods = pLib->GetModules();
+ USHORT nMods = pMods ? pMods->Count() : 0;
+ for( USHORT i = 0; i < nMods; i++ )
+ {
+ SbModule* p = (SbModule*) pMods->Get( i );
+ if ( p )
+ if ( p->HasExeCode() )
+ return true;
+ }
+ }
+ return false;
+}
+
void BasicManager::Init()
{
DBG_CHKTHIS( BasicManager, 0 );
diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx
index 79f49eb8724a..e1baf4e6760e 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -433,7 +433,7 @@ void SbiImage::AddString( const String& r )
memcpy( p, pStrings, nStringSize * sizeof( sal_Unicode ) );
delete[] pStrings;
pStrings = p;
- nStringSize = sal::static_int_cast< UINT16 >(nNewLen);
+ nStringSize = sal::static_int_cast< UINT32 >(nNewLen);
}
else
bError = TRUE;
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 056c2ea38c4c..b1b53610370a 100755
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -611,93 +611,7 @@ SbClassModuleObject::~SbClassModuleObject()
void SbClassModuleObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
const SfxHint& rHint, const TypeId& rHintType )
{
- bool bDone = false;
-
- const SbxHint* pHint = PTR_CAST(SbxHint,&rHint);
- if( pHint )
- {
- SbxVariable* pVar = pHint->GetVar();
- SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
- if( pProcProperty )
- {
- bDone = true;
-
- if( pHint->GetId() == SBX_HINT_DATAWANTED )
- {
- String aProcName;
- aProcName.AppendAscii( "Property Get " );
- aProcName += pProcProperty->GetName();
-
- SbxVariable* pMeth = Find( aProcName, SbxCLASS_METHOD );
- if( pMeth )
- {
- SbxValues aVals;
- aVals.eType = SbxVARIANT;
-
- SbxArray* pArg = pVar->GetParameters();
- USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
- if( nVarParCount > 1 )
- {
- SbxArrayRef xMethParameters = new SbxArray;
- xMethParameters->Put( pMeth, 0 ); // Method as parameter 0
- for( USHORT i = 1 ; i < nVarParCount ; ++i )
- {
- SbxVariable* pPar = pArg->Get( i );
- xMethParameters->Put( pPar, i );
- }
-
- pMeth->SetParameters( xMethParameters );
- pMeth->Get( aVals );
- pMeth->SetParameters( NULL );
- }
- else
- {
- pMeth->Get( aVals );
- }
-
- pVar->Put( aVals );
- }
- }
- else if( pHint->GetId() == SBX_HINT_DATACHANGED )
- {
- SbxVariable* pMeth = NULL;
-
- bool bSet = pProcProperty->isSet();
- if( bSet )
- {
- pProcProperty->setSet( false );
-
- String aProcName;
- aProcName.AppendAscii( "Property Set " );
- aProcName += pProcProperty->GetName();
- pMeth = Find( aProcName, SbxCLASS_METHOD );
- }
- if( !pMeth ) // Let
- {
- String aProcName;
- aProcName.AppendAscii( "Property Let " );
- aProcName += pProcProperty->GetName();
- pMeth = Find( aProcName, SbxCLASS_METHOD );
- }
-
- if( pMeth )
- {
- // Setup parameters
- SbxArrayRef xArray = new SbxArray;
- xArray->Put( pMeth, 0 ); // Method as parameter 0
- xArray->Put( pVar, 1 );
- pMeth->SetParameters( xArray );
-
- SbxValues aVals;
- pMeth->Get( aVals );
- pMeth->SetParameters( NULL );
- }
- }
- }
- }
-
- if( !bDone )
- SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
+ SbModule::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
}
SbxVariable* SbClassModuleObject::Find( const XubString& rName, SbxClassType t )
@@ -1217,7 +1131,6 @@ SbxVariable* StarBASIC::Find( const String& rName, SbxClassType t )
INT32 nType = p->GetModuleType();
if ( nType == ModuleType::DOCUMENT || nType == ModuleType::FORM )
continue;
-
// otherwise check if the element is available
// unset GBLSEARCH-Flag (due to Rekursion)
USHORT nGblFlag = p->GetFlags() & SBX_GBLSEARCH;
diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx
index c9123b06341b..5d84dfddf7be 100755
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -61,6 +61,7 @@
#include <com/sun/star/script/XInvocationAdapterFactory.hpp>
#include <com/sun/star/script/XTypeConverter.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
+#include <com/sun/star/script/XDefaultMethod.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XIdlArray.hpp>
@@ -72,7 +73,7 @@
#include <com/sun/star/bridge/oleautomation/Decimal.hpp>
#include <com/sun/star/bridge/oleautomation/Currency.hpp>
#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
-
+#include <com/sun/star/script/XAutomationInvocation.hpp>
using com::sun::star::uno::Reference;
using namespace com::sun::star::uno;
@@ -158,6 +159,21 @@ SbxVariable* getDefaultProp( SbxVariable* pRef )
return pDefaultProp;
}
+void SetSbUnoObjectDfltPropName( SbxObject* pObj )
+{
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxObject*) pObj);
+ if ( pUnoObj )
+ {
+ String sDfltPropName;
+
+ if ( SbUnoObject::getDefaultPropName( pUnoObj, sDfltPropName ) )
+ {
+ OSL_TRACE("SetSbUnoObjectDfltPropName setting dflt prop for %s", rtl::OUStringToOString( pObj->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() );
+ pUnoObj->SetDfltProperty( sDfltPropName );
+ }
+ }
+}
+
Reference< XComponentContext > getComponentContext_Impl( void )
{
static Reference< XComponentContext > xContext;
@@ -459,6 +475,32 @@ void implHandleWrappedTargetException( const Any& _rWrappedTargetException )
SbError nError( ERRCODE_BASIC_EXCEPTION );
::rtl::OUStringBuffer aMessageBuf;
+ // Add for VBA, to get the correct error code and message.
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ if ( aExamine >>= aBasicError )
+ {
+ if ( aBasicError.ErrorCode != 0 )
+ {
+ nError = StarBASIC::GetSfxFromVBError( (USHORT) aBasicError.ErrorCode );
+ if ( nError == 0 )
+ {
+ nError = (SbError) aBasicError.ErrorCode;
+ }
+ aMessageBuf.append( aBasicError.ErrorMessageArgument );
+ aExamine.clear();
+ }
+ }
+
+ IndexOutOfBoundsException aIdxOutBndsExp;
+ if ( aExamine >>= aIdxOutBndsExp )
+ {
+ nError = SbERR_OUT_OF_RANGE;
+ aExamine.clear();
+ }
+ }
+ // End add
+
// strip any other WrappedTargetException instances, but this time preserve the error messages.
WrappedTargetException aWrapped;
sal_Int32 nLevel = 0;
@@ -1508,6 +1550,103 @@ Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, Property* pUnoProperty
return aRetVal;
}
+void processAutomationParams( SbxArray* pParams, Sequence< Any >& args, bool bOLEAutomation, UINT32 nParamCount )
+{
+ AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
+ if( bOLEAutomation )
+ pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
+
+ args.realloc( nParamCount );
+ Any* pAnyArgs = args.getArray();
+ bool bBlockConversionToSmallestType = pINST->IsCompatibility();
+ UINT32 i = 0;
+ if( pArgNamesArray )
+ {
+ Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
+ ::rtl::OUString* pNames = rNameSeq.getArray();
+ Any aValAny;
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ USHORT iSbx = (USHORT)(i+1);
+
+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+ aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
+ bBlockConversionToSmallestType );
+
+ ::rtl::OUString aParamName = pNames[iSbx];
+ if( aParamName.getLength() )
+ {
+ oleautomation::NamedArgument aNamedArgument;
+ aNamedArgument.Name = aParamName;
+ aNamedArgument.Value = aValAny;
+ pAnyArgs[i] <<= aNamedArgument;
+ }
+ else
+ {
+ pAnyArgs[i] = aValAny;
+ }
+ }
+ }
+ else
+ {
+ for( i = 0 ; i < nParamCount ; i++ )
+ {
+ // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
+ pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
+ bBlockConversionToSmallestType );
+ }
+ }
+
+}
+enum INVOKETYPE
+{
+ GetProp = 0,
+ SetProp,
+ Func
+};
+Any invokeAutomationMethod( const String& Name, Sequence< Any >& args, SbxArray* pParams, UINT32 nParamCount, Reference< XInvocation >& rxInvocation, INVOKETYPE invokeType = Func )
+{
+ Sequence< INT16 > OutParamIndex;
+ Sequence< Any > OutParam;
+
+ Any aRetAny;
+ switch( invokeType )
+ {
+ case Func:
+ aRetAny = rxInvocation->invoke( Name, args, OutParamIndex, OutParam );
+ break;
+ case GetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY );
+ aRetAny = xAutoInv->invokeGetProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ case SetProp:
+ {
+ Reference< XAutomationInvocation > xAutoInv( rxInvocation, UNO_QUERY_THROW );
+ aRetAny = xAutoInv->invokePutProperty( Name, args, OutParamIndex, OutParam );
+ break;
+ }
+ default:
+ break; // should introduce an error here
+
+ }
+ const INT16* pIndices = OutParamIndex.getConstArray();
+ UINT32 nLen = OutParamIndex.getLength();
+ if( nLen )
+ {
+ const Any* pNewValues = OutParam.getConstArray();
+ for( UINT32 j = 0 ; j < nLen ; j++ )
+ {
+ INT16 iTarget = pIndices[ j ];
+ if( iTarget >= (INT16)nParamCount )
+ break;
+ unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
+ }
+ }
+ return aRetAny;
+}
+
// Dbg-Hilfsmethode zum Auslesen der in einem Object implementierten Interfaces
String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
{
@@ -2014,11 +2153,26 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // Wert holen
- Any aRetAny = mxInvocation->getValue( pProp->GetName() );
+ UINT32 nParamCount = pParams ? ((UINT32)pParams->Count() - 1) : 0;
+ sal_Bool bCanBeConsideredAMethod = mxInvocation->hasMethod( pProp->GetName() );
+ Any aRetAny;
+ if ( bCanBeConsideredAMethod && nParamCount )
+ {
+ // Automation properties have methods, so.. we need to invoke this through
+ // XInvocation
+ Sequence<Any> args;
+ processAutomationParams( pParams, args, true, nParamCount );
+ aRetAny = invokeAutomationMethod( pProp->GetName(), args, pParams, nParamCount, mxInvocation, GetProp );
+ }
+ else
+ // Wert holen
+ aRetAny = mxInvocation->getValue( pProp->GetName() );
// Wert von Uno nach Sbx uebernehmen
unoToSbxValue( pVar, aRetAny );
+ if( pParams && bCanBeConsideredAMethod )
+ pVar->SetParameters( NULL );
+
}
catch( const Exception& )
{
@@ -2143,52 +2297,7 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
else if( bInvocation && pParams && mxInvocation.is() )
{
bool bOLEAutomation = true;
- // TODO: bOLEAutomation = xOLEAutomation.is()
-
- AutomationNamedArgsSbxArray* pArgNamesArray = NULL;
- if( bOLEAutomation )
- pArgNamesArray = PTR_CAST(AutomationNamedArgsSbxArray,pParams);
-
- args.realloc( nParamCount );
- Any* pAnyArgs = args.getArray();
- bool bBlockConversionToSmallestType = pINST->IsCompatibility();
- if( pArgNamesArray )
- {
- Sequence< ::rtl::OUString >& rNameSeq = pArgNamesArray->getNames();
- ::rtl::OUString* pNames = rNameSeq.getArray();
-
- Any aValAny;
- for( i = 0 ; i < nParamCount ; i++ )
- {
- USHORT iSbx = (USHORT)(i+1);
-
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- aValAny = sbxToUnoValueImpl( pParams->Get( iSbx ),
- bBlockConversionToSmallestType );
-
- ::rtl::OUString aParamName = pNames[iSbx];
- if( aParamName.getLength() )
- {
- oleautomation::NamedArgument aNamedArgument;
- aNamedArgument.Name = aParamName;
- aNamedArgument.Value = aValAny;
- pAnyArgs[i] <<= aNamedArgument;
- }
- else
- {
- pAnyArgs[i] = aValAny;
- }
- }
- }
- else
- {
- for( i = 0 ; i < nParamCount ; i++ )
- {
- // ACHTUNG: Bei den Sbx-Parametern den Offset nicht vergessen!
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
- bBlockConversionToSmallestType );
- }
- }
+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
}
// Methode callen
@@ -2223,26 +2332,8 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else if( bInvocation && mxInvocation.is() )
{
- Sequence< INT16 > OutParamIndex;
- Sequence< Any > OutParam;
- Any aRetAny = mxInvocation->invoke( pMeth->GetName(), args, OutParamIndex, OutParam );
-
- // Wert von Uno nach Sbx uebernehmen
+ Any aRetAny = invokeAutomationMethod( pMeth->GetName(), args, pParams, nParamCount, mxInvocation );
unoToSbxValue( pVar, aRetAny );
-
- const INT16* pIndices = OutParamIndex.getConstArray();
- UINT32 nLen = OutParamIndex.getLength();
- if( nLen )
- {
- const Any* pNewValues = OutParam.getConstArray();
- for( UINT32 j = 0 ; j < nLen ; j++ )
- {
- INT16 iTarget = pIndices[ j ];
- if( iTarget >= (INT16)nParamCount )
- break;
- unoToSbxValue( (SbxVariable*)pParams->Get( (USHORT)(j+1) ), pNewValues[ j ] );
- }
- }
}
// #55460, Parameter hier weghauen, da das in unoToSbxValue()
@@ -3180,11 +3271,16 @@ getTypeDescriptorEnumeration( const ::rtl::OUString& sSearchRoot,
typedef std::hash_map< ::rtl::OUString, Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
-SbxVariable* getVBAConstant( const String& rName )
+VBAConstantHelper&
+VBAConstantHelper::instance()
+{
+ static VBAConstantHelper aHelper;
+ return aHelper;
+}
+
+void
+VBAConstantHelper::init()
{
- SbxVariable* pConst = NULL;
- static VBAConstantsHash aConstCache;
- static bool isInited = false;
if ( !isInited )
{
Sequence< TypeClass > types(1);
@@ -3192,39 +3288,77 @@ SbxVariable* getVBAConstant( const String& rName )
Reference< XTypeDescriptionEnumeration > xEnum = getTypeDescriptorEnumeration( defaultNameSpace, types, TypeDescriptionSearchDepth_INFINITE );
if ( !xEnum.is() )
- return NULL;
+ return; //NULL;
while ( xEnum->hasMoreElements() )
{
Reference< XConstantsTypeDescription > xConstants( xEnum->nextElement(), UNO_QUERY );
if ( xConstants.is() )
{
+ // store constant group name
+ ::rtl::OUString sFullName = xConstants->getName();
+ sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
+ ::rtl::OUString sLeafName( sFullName );
+ if ( indexLastDot > -1 )
+ sLeafName = sFullName.copy( indexLastDot + 1);
+ aConstCache.push_back( sLeafName ); // assume constant group names are unique
Sequence< Reference< XConstantTypeDescription > > aConsts = xConstants->getConstants();
Reference< XConstantTypeDescription >* pSrc = aConsts.getArray();
sal_Int32 nLen = aConsts.getLength();
for ( sal_Int32 index =0; index<nLen; ++pSrc, ++index )
{
+ // store constant member name
Reference< XConstantTypeDescription >& rXConst =
*pSrc;
- ::rtl::OUString sFullName = rXConst->getName();
- sal_Int32 indexLastDot = sFullName.lastIndexOf('.');
- ::rtl::OUString sLeafName;
+ sFullName = rXConst->getName();
+ indexLastDot = sFullName.lastIndexOf('.');
+ sLeafName = sFullName;
if ( indexLastDot > -1 )
sLeafName = sFullName.copy( indexLastDot + 1);
- aConstCache[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
+ aConstHash[ sLeafName.toAsciiLowerCase() ] = rXConst->getConstantValue();
}
}
}
isInited = true;
}
+}
+
+bool
+VBAConstantHelper::isVBAConstantType( const String& rName )
+{
+ init();
+ bool bConstant = false;
+ ::rtl::OUString sKey( rName );
+ VBAConstantsVector::const_iterator it = aConstCache.begin();
+
+ for( ; it != aConstCache.end(); it++ )
+ {
+ if( sKey.equalsIgnoreAsciiCase( *it ) )
+ {
+ bConstant = true;
+ break;
+ }
+ }
+ return bConstant;
+}
+
+SbxVariable*
+VBAConstantHelper::getVBAConstant( const String& rName )
+{
+ SbxVariable* pConst = NULL;
+ init();
+
::rtl::OUString sKey( rName );
- VBAConstantsHash::const_iterator it = aConstCache.find( sKey.toAsciiLowerCase() );
- if ( it != aConstCache.end() )
+
+ VBAConstantsHash::const_iterator it = aConstHash.find( sKey.toAsciiLowerCase() );
+
+ if ( it != aConstHash.end() )
{
pConst = new SbxVariable( SbxVARIANT );
pConst->SetName( rName );
unoToSbxValue( pConst, it->second );
}
+
return pConst;
}
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 8b1069bbeab3..e2d80e1e89fc 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -58,6 +58,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/script/ModuleType.hpp>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+#include <com/sun/star/document/XVbaMethodParameter.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
using namespace com::sun::star;
@@ -500,7 +501,6 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
return 0L;
}
-#if 0
bool UnlockControllerHack( StarBASIC* pBasic )
{
bool bRes = false;
@@ -526,7 +526,7 @@ bool UnlockControllerHack( StarBASIC* pBasic )
}
return bRes;
}
-#endif
+
/////////////////////////////////////////////////////////////////////////////
// Ein BASIC-Modul hat EXTSEARCH gesetzt, damit die im Modul enthaltenen
@@ -795,6 +795,82 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxVariable* pVar = pHint->GetVar();
SbProperty* pProp = PTR_CAST(SbProperty,pVar);
SbMethod* pMeth = PTR_CAST(SbMethod,pVar);
+ SbProcedureProperty* pProcProperty = PTR_CAST( SbProcedureProperty, pVar );
+ if( pProcProperty )
+ {
+
+ if( pHint->GetId() == SBX_HINT_DATAWANTED )
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Get " );
+ aProcName += pProcProperty->GetName();
+
+ SbxVariable* pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ if( pMethVar )
+ {
+ SbxValues aVals;
+ aVals.eType = SbxVARIANT;
+
+ SbxArray* pArg = pVar->GetParameters();
+ USHORT nVarParCount = (pArg != NULL) ? pArg->Count() : 0;
+ if( nVarParCount > 1 )
+ {
+ SbxArrayRef xMethParameters = new SbxArray;
+ xMethParameters->Put( pMethVar, 0 ); // Method as parameter 0
+ for( USHORT i = 1 ; i < nVarParCount ; ++i )
+ {
+ SbxVariable* pPar = pArg->Get( i );
+ xMethParameters->Put( pPar, i );
+ }
+
+ pMethVar->SetParameters( xMethParameters );
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ else
+ {
+ pMethVar->Get( aVals );
+ }
+
+ pVar->Put( aVals );
+ }
+ }
+ else if( pHint->GetId() == SBX_HINT_DATACHANGED )
+ {
+ SbxVariable* pMethVar = NULL;
+
+ bool bSet = pProcProperty->isSet();
+ if( bSet )
+ {
+ pProcProperty->setSet( false );
+
+ String aProcName;
+ aProcName.AppendAscii( "Property Set " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+ if( !pMethVar ) // Let
+ {
+ String aProcName;
+ aProcName.AppendAscii( "Property Let " );
+ aProcName += pProcProperty->GetName();
+ pMethVar = Find( aProcName, SbxCLASS_METHOD );
+ }
+
+ if( pMethVar )
+ {
+ // Setup parameters
+ SbxArrayRef xArray = new SbxArray;
+ xArray->Put( pMethVar, 0 ); // Method as parameter 0
+ xArray->Put( pVar, 1 );
+ pMethVar->SetParameters( xArray );
+
+ SbxValues aVals;
+ pMethVar->Get( aVals );
+ pMethVar->SetParameters( NULL );
+ }
+ }
+ }
if( pProp )
{
if( pProp->GetModule() != this )
@@ -849,6 +925,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
+ aTok.SetCompatible( IsVBACompat() );
while( !aTok.IsEof() )
{
SbiToken eEndTok = NIL;
@@ -1036,12 +1113,14 @@ void SbModule::SetVBACompat( BOOL bCompat )
// Ausfuehren eines BASIC-Unterprogramms
USHORT SbModule::Run( SbMethod* pMeth )
{
+ OSL_TRACE("About to run %s, vba compatmode is %d", rtl::OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr(), mbVBACompat );
static USHORT nMaxCallLevel = 0;
static String aMSOMacroRuntimeLibName = String::CreateFromAscii( "Launcher" );
static String aMSOMacroRuntimeAppSymbol = String::CreateFromAscii( "Application" );
USHORT nRes = 0;
BOOL bDelInst = BOOL( pINST == NULL );
+ bool bQuit = false;
StarBASICRef xBasic;
if( bDelInst )
{
@@ -1174,6 +1253,15 @@ USHORT SbModule::Run( SbMethod* pMeth )
delete pRt;
pMOD = pOldMod;
+ if ( pINST->nCallLvl == 0 && IsVBACompat() )
+ {
+ // VBA always ensure screenupdating is enabled after completing
+ StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
+ if ( pBasic && pBasic->IsDocBasic() )
+ {
+ UnlockControllerHack( pBasic );
+ }
+ }
if( bDelInst )
{
// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
@@ -1201,10 +1289,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
// VBA always ensure screenupdating is enabled after completing
StarBASIC* pBasic = PTR_CAST(StarBASIC,GetParent());
-#if 0
if ( pBasic && pBasic->IsDocBasic() && !pINST )
UnlockControllerHack( pBasic );
-#endif
if( bDelInst )
{
// #57841 Uno-Objekte, die in RTL-Funktionen gehalten werden,
@@ -1215,6 +1301,8 @@ USHORT SbModule::Run( SbMethod* pMeth )
pINST = NULL;
}
if ( pBasic && pBasic->IsDocBasic() && pBasic->IsQuitApplication() && !pINST )
+ bQuit = true;
+ if ( bQuit )
{
Application::PostUserEvent( LINK( &AsyncQuitHandler::instance(), AsyncQuitHandler, OnAsyncQuit ), NULL );
}
@@ -1676,6 +1764,48 @@ BOOL SbModule::ExceedsLegacyModuleSize()
return false;
}
+class ErrorHdlResetter
+{
+ Link mErrHandler;
+ bool mbError;
+ public:
+ ErrorHdlResetter() : mbError( false )
+ {
+ // save error handler
+ mErrHandler = StarBASIC::GetGlobalErrorHdl();
+ // set new error handler
+ StarBASIC::SetGlobalErrorHdl( LINK( this, ErrorHdlResetter, BasicErrorHdl ) );
+ }
+ ~ErrorHdlResetter()
+ {
+ // restore error handler
+ StarBASIC::SetGlobalErrorHdl(mErrHandler);
+ }
+ DECL_LINK( BasicErrorHdl, StarBASIC * );
+ bool HasError() { return mbError; }
+};
+IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/)
+{
+ mbError = true;
+ return 0;
+}
+
+bool SbModule::HasExeCode()
+{
+
+ ErrorHdlResetter aGblErrHdl;
+ // And empty Image always has the Global Chain set up
+ static const unsigned char pEmptyImage[] = { 0x45, 0x0 , 0x0, 0x0, 0x0 };
+ // lets be stricter for the moment than VBA
+
+ bool bRes = false;
+ if ( !IsCompiled() )
+ Compile();
+ if ( pImage && !( pImage->GetCodeSize() == 5 && ( memcmp( pImage->GetCode(), pEmptyImage, pImage->GetCodeSize() ) == 0 ) )
+ || aGblErrHdl.HasError() )
+ bRes = true;
+ return bRes;
+}
// Store only image, no source
BOOL SbModule::StoreBinaryData( SvStream& rStrm )
@@ -1725,7 +1855,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
return bRet;
}
-
BOOL SbModule::LoadCompleted()
{
SbxArray* p = GetMethods();
@@ -1793,6 +1922,7 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
nLine1 =
nLine2 = 0;
refStatics = new SbxArray;
+ mCaller = 0;
// AB: 2.7.1996: HACK wegen 'Referenz kann nicht gesichert werden'
SetFlag( SBX_NO_MODIFY );
}
@@ -1807,6 +1937,7 @@ SbMethod::SbMethod( const SbMethod& r )
nLine1 = r.nLine1;
nLine2 = r.nLine2;
refStatics = r.refStatics;
+ mCaller = r.mCaller;
SetFlag( SBX_NO_MODIFY );
}
@@ -1875,8 +2006,13 @@ SbxInfo* SbMethod::GetInfo()
// Schnittstelle zum Ausfuehren einer Methode aus den Applikationen
// #34191# Mit speziellem RefCounting, damit das Basic nicht durch CloseDocument()
// abgeschossen werden kann. Rueckgabewert wird als String geliefert.
-ErrCode SbMethod::Call( SbxValue* pRet )
+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
{
+ if ( pCaller )
+ {
+ OSL_TRACE("SbMethod::Call Have been passed a caller 0x%x", pCaller );
+ mCaller = pCaller;
+ }
// RefCount vom Modul hochzaehlen
SbModule* pMod_ = (SbModule*)GetParent();
pMod_->AddRef();
@@ -1904,7 +2040,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
// Objekte freigeben
pMod_->ReleaseRef();
pBasic->ReleaseRef();
-
+ mCaller = 0;
return nErr;
}
@@ -2087,9 +2223,8 @@ public:
}
//liuchen 2009-7-21, support Excel VBA Form_QueryClose event
- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
{
-#if IN_THE_FUTURE
uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
if ( xDialog.is() )
{
@@ -2117,7 +2252,6 @@ public:
}
mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
-#endif
}
//liuchen 2009-7-21
@@ -2214,14 +2348,13 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun )
Sequence< Any > aArguments;
triggerMethod( aMethodToRun, aArguments );
}
-void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& /*aArguments*/)
+void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any >& aArguments)
{
OSL_TRACE("*** trigger %s ***", rtl::OUStringToOString( aMethodToRun, RTL_TEXTENCODING_UTF8 ).getStr() );
// Search method
SbxVariable* pMeth = SbObjModule::Find( aMethodToRun, SbxCLASS_METHOD );
if( pMeth )
{
-#if IN_THE_FUTURE
//liuchen 2009-7-21, support Excel VBA UserForm_QueryClose event with parameters
if ( aArguments.getLength() > 0 ) // Setup parameters
{
@@ -2251,7 +2384,6 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
}
else
//liuchen 2009-7-21
-#endif
{
SbxValues aVals;
pMeth->Get( aVals );
@@ -2353,7 +2485,10 @@ void SbUserFormModule::Unload()
triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ), aParams);
aParams[0] >>= nCancel;
- if (nCancel == 1)
+ // basic boolean ( and what the user might use ) can be ambiguous ( e.g. basic true = -1 )
+ // test agains 0 ( false ) and assume anything else is true
+ // ( Note: ) this used to work ( something changes somewhere )
+ if (nCancel != 0)
{
return;
}
@@ -2414,7 +2549,7 @@ void SbUserFormModule::InitObject()
aArgs[ 0 ] = uno::Any();
aArgs[ 1 ] <<= m_xDialog;
aArgs[ 2 ] <<= m_xModel;
- aArgs[ 3 ] <<= rtl::OUString( GetParent()->GetName() );
+ aArgs[ 3 ] <<= sProjectName;
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
diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx
index 93fb18baf86e..8bec885c8846 100644
--- a/basic/source/comp/codegen.cxx
+++ b/basic/source/comp/codegen.cxx
@@ -163,8 +163,6 @@ void SbiCodeGen::Save()
rMod.bIsProxyModule = false;
}
- if( pParser->bText )
- p->SetFlag( SBIMG_COMPARETEXT );
// GlobalCode-Flag
if( pParser->HasGlobalCode() )
p->SetFlag( SBIMG_INITCODE );
@@ -244,6 +242,8 @@ void SbiCodeGen::Save()
if( nPass == 1 )
aPropName = aPropName.Copy( aIfaceName.Len() + 1 );
SbProcedureProperty* pProcedureProperty = NULL;
+ OSL_TRACE("*** getProcedureProperty for thing %s",
+ rtl::OUStringToOString( aPropName,RTL_TEXTENCODING_UTF8 ).getStr() );
pProcedureProperty = rMod.GetProcedureProperty( aPropName, ePropType );
}
if( nPass == 1 )
diff --git a/basic/source/comp/dim.cxx b/basic/source/comp/dim.cxx
index 59d77e3f3757..6e746b4d7fbe 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -29,6 +29,8 @@
#include "precompiled_basic.hxx"
#include <basic/sbx.hxx>
#include "sbcomp.hxx"
+#include "sbunoobj.hxx"
+
SbxObject* cloneTypeObjectImpl( const SbxObject& rTypeObj );
@@ -153,7 +155,7 @@ void SbiParser::TypeDecl( SbiSymDef& rDef, BOOL bAsNewAlreadyParsed )
}
}
}
- else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) )
+ else if( rEnumArray->Find( aCompleteName, SbxCLASS_OBJECT ) || ( IsVBASupportOn() && VBAConstantHelper::instance().isVBAConstantType( aCompleteName ) ) )
{
eType = SbxLONG;
break;
@@ -426,7 +428,10 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
aExpr.Gen();
SbiOpcode eOp_ = pDef->IsNew() ? _CREATE : _TCREATE;
aGen.Gen( eOp_, pDef->GetId(), pDef->GetTypeId() );
- aGen.Gen( _SET );
+ if ( bVBASupportOn )
+ aGen.Gen( _VBASET );
+ else
+ aGen.Gen( _SET );
}
}
else
@@ -1043,6 +1048,24 @@ void SbiParser::DefDeclare( BOOL bPrivate )
}
}
+void SbiParser::Attribute()
+{
+ // TODO: Need to implement the method as an attributed object.
+ while( Next() != EQ )
+ {
+ String aSym( GetSym() );
+ if( Next() != DOT)
+ break;
+ }
+
+ if( eCurTok != EQ )
+ Error( SbERR_SYNTAX );
+ else
+ SbiExpression aValue( this );
+
+ // Don't generate any code - just discard it.
+}
+
// Aufruf einer SUB oder FUNCTION
void SbiParser::Call()
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index 7a4ea5965558..04d8236d7669 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -373,8 +373,12 @@ SbiExprNode* SbiExpression::Term( const KeywordSymbolInfo* pKeywordSymbolInfo )
// Typ SbxOBJECT sein
if( pDef->GetType() != SbxOBJECT && pDef->GetType() != SbxVARIANT )
{
- pParser->Error( SbERR_BAD_DECLARATION, aSym );
- bError = TRUE;
+ // defer error until runtime if in vba mode
+ if ( !pParser->IsVBASupportOn() )
+ {
+ pParser->Error( SbERR_BAD_DECLARATION, aSym );
+ bError = TRUE;
+ }
}
if( !bError )
pNd->aVar.pNext = ObjTerm( *pDef );
@@ -580,7 +584,11 @@ SbiExprNode* SbiExpression::Unary()
eTok = NEG;
case NOT:
pParser->Next();
- pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
+ // process something like "Do While Not "foo"="" "
+ if( pParser->IsVBASupportOn() )
+ pNd = new SbiExprNode( pParser, Like(), eTok, NULL );
+ else
+ pNd = new SbiExprNode( pParser, Unary(), eTok, NULL );
break;
case PLUS:
pParser->Next();
@@ -736,7 +744,7 @@ SbiExprNode* SbiExpression::Like()
pNd = new SbiExprNode( pParser, pNd, eTok, Comp() ), nCount++;
}
// Mehrere Operatoren hintereinander gehen nicht
- if( nCount > 1 )
+ if( nCount > 1 && !pParser->IsVBASupportOn() )
{
pParser->Error( SbERR_SYNTAX );
bError = TRUE;
diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx
index 3d7178ae7688..433bf28663e3 100644
--- a/basic/source/comp/parser.cxx
+++ b/basic/source/comp/parser.cxx
@@ -49,6 +49,7 @@ struct SbiStatement {
#define N FALSE
static SbiStatement StmntTable [] = {
+{ ATTRIBUTE, &SbiParser::Attribute, Y, Y, }, // ATTRIBUTE
{ CALL, &SbiParser::Call, N, Y, }, // CALL
{ CLOSE, &SbiParser::Close, N, Y, }, // CLOSE
{ _CONST_, &SbiParser::Dim, Y, Y, }, // CONST
@@ -387,6 +388,18 @@ BOOL SbiParser::Parse()
Next(); return TRUE;
}
+ // In vba it's possible to do Error.foobar ( even if it results in
+ // a runtime error
+ if ( eCurTok == _ERROR_ && IsVBASupportOn() ) // we probably need to define a subset of keywords where this madness applies e.g. if ( IsVBASupportOn() && SymbolCanBeRedined( eCurTok ) )
+ {
+ SbiTokenizer tokens( *(SbiTokenizer*)this );
+ tokens.Next();
+ if ( tokens.Peek() == DOT )
+ {
+ eCurTok = SYMBOL;
+ ePush = eCurTok;
+ }
+ }
// Kommt ein Symbol, ist es entweder eine Variable( LET )
// oder eine SUB-Prozedur( CALL ohne Klammern )
// DOT fuer Zuweisungen im WITH-Block: .A=5
@@ -795,7 +808,7 @@ void SbiParser::Option()
bClassModule = TRUE;
aGen.GetModule().SetModuleType( com::sun::star::script::ModuleType::CLASS );
break;
- case VBASUPPORT:
+ case VBASUPPORT: // Option VBASupport used to override the module mode ( in fact this must reset the mode
if( Next() == NUMBER )
{
if ( nVal == 1 || nVal == 0 )
diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx
index 8cb3126f03f1..76eab0dc1ec5 100644
--- a/basic/source/comp/token.cxx
+++ b/basic/source/comp/token.cxx
@@ -58,6 +58,7 @@ static TokenTable aTokTable_Basic [] = { // Token-Tabelle:
{ ANY, "Any" },
{ APPEND, "Append" },
{ AS, "As" },
+ { ATTRIBUTE,"Attribute" },
{ BASE, "Base" },
{ BINARY, "Binary" },
{ TBOOLEAN, "Boolean" },
diff --git a/basic/source/inc/dlgcont.hxx b/basic/source/inc/dlgcont.hxx
index 2c927a8286f4..3aef2c5b067c 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -96,7 +96,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);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Service
static ::com::sun::star::uno::Sequence< ::rtl::OUString > getSupportedServiceNames_static();
static ::rtl::OUString getImplementationName_static();
diff --git a/basic/source/inc/namecont.hxx b/basic/source/inc/namecont.hxx
index 7fd6eb06f607..a2903caf6536 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -35,6 +35,7 @@
#include <com/sun/star/script/XStorageBasedLibraryContainer.hpp>
#include <com/sun/star/script/XLibraryContainerPassword.hpp>
#include <com/sun/star/script/XLibraryContainerExport.hpp>
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
#include <com/sun/star/script/XLibraryContainer3.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/container/XContainer.hpp>
@@ -59,6 +60,7 @@
#include <cppuhelper/implbase2.hxx>
#include <cppuhelper/compbase8.hxx>
+#include <cppuhelper/compbase9.hxx>
#include <cppuhelper/interfacecontainer.hxx>
#include <com/sun/star/script/vba/XVBACompatibility.hpp>
@@ -67,13 +69,14 @@ class BasicManager;
namespace basic
{
-typedef ::cppu::WeakComponentImplHelper8<
+typedef ::cppu::WeakComponentImplHelper9<
::com::sun::star::lang::XInitialization,
::com::sun::star::script::XStorageBasedLibraryContainer,
::com::sun::star::script::XLibraryContainerPassword,
::com::sun::star::script::XLibraryContainerExport,
::com::sun::star::script::XLibraryContainer3,
::com::sun::star::container::XContainer,
+ ::com::sun::star::script::XLibraryQueryExecutable,
::com::sun::star::script::vba::XVBACompatibility,
::com::sun::star::lang::XServiceInfo > LibraryContainerHelper;
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index 733a65db7f61..1e99f9421b82 100644
--- a/basic/source/inc/parser.hxx
+++ b/basic/source/inc/parser.hxx
@@ -107,6 +107,7 @@ public:
void BadSyntax(); // Falsches SbiToken
void NoIf(); // ELSE/ELSE IF ohne IF
void Assign(); // LET
+ void Attribute(); // Attribute
void Call(); // CALL
void Close(); // CLOSE
void Declare(); // DECLARE
diff --git a/basic/source/inc/runtime.hxx b/basic/source/inc/runtime.hxx
index 6ca69209a752..fc2bc0b37053 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -203,7 +203,6 @@ class SbiInstance
BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
-
public:
SbiRuntime* pRun; // Call-Stack
SbiInstance* pNext; // Instanzen-Chain
@@ -292,7 +291,9 @@ class SbiRuntime
SbxArrayRef refExprStk; // expression stack
SbxArrayRef refCaseStk; // CASE expression stack
SbxArrayRef refRedimpArray; // Array saved to use for REDIM PRESERVE
+ SbxVariableRef refRedim; // Array saved to use for REDIM
SbxVariableRef xDummyVar; // Ersatz fuer nicht gefundene Variablen
+ SbxVariable* mpExtCaller; // Caller ( external - e.g. button name, shape, range object etc. - only in vba mode )
SbiArgvStack* pArgvStk; // ARGV-Stack
SbiGosubStack* pGosubStk; // GOSUB stack
SbiForStack* pForStk; // FOR/NEXT-Stack
@@ -462,6 +463,7 @@ public:
SbMethod* GetCaller();
SbxArray* GetLocals();
SbxArray* GetParams();
+ SbxVariable* GetExternalCaller(){ return mpExtCaller; }
SbxBase* FindElementExtern( const String& rName );
static bool isVBAEnabled();
diff --git a/basic/source/inc/sbunoobj.hxx b/basic/source/inc/sbunoobj.hxx
index 78afa9783ca8..fc61484d4dbe 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -43,6 +43,7 @@
#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
#include <rtl/ustring.hxx>
+#include <hash_map>
class SbUnoObject: public SbxObject
{
@@ -321,6 +322,26 @@ public:
virtual void Clear();
};
+typedef std::hash_map< ::rtl::OUString, ::com::sun::star::uno::Any, ::rtl::OUStringHash, ::std::equal_to< ::rtl::OUString > > VBAConstantsHash;
+
+typedef std::vector< rtl::OUString > VBAConstantsVector;
+
+class VBAConstantHelper
+{
+private:
+
+ VBAConstantsVector aConstCache;
+ VBAConstantsHash aConstHash;
+ bool isInited;
+ VBAConstantHelper():isInited( false ) {}
+ VBAConstantHelper(const VBAConstantHelper&);
+ void init();
+public:
+ static VBAConstantHelper& instance();
+ SbxVariable* getVBAConstant( const String& rName );
+ bool isVBAConstantType( const String& rName );
+};
+
#endif
diff --git a/basic/source/inc/scriptcont.hxx b/basic/source/inc/scriptcont.hxx
index 091fbc24cdbe..2310a3d633ec 100644
--- a/basic/source/inc/scriptcont.hxx
+++ b/basic/source/inc/scriptcont.hxx
@@ -122,7 +122,9 @@ public:
throw (::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
-
+ // XLibraryQueryExecutable
+ virtual sal_Bool SAL_CALL HasExecutableCode(const rtl::OUString&)
+ throw (::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
virtual ::rtl::OUString SAL_CALL getImplementationName( )
throw (::com::sun::star::uno::RuntimeException);
diff --git a/basic/source/inc/token.hxx b/basic/source/inc/token.hxx
index 930f68910b78..294e0ff863c5 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -72,7 +72,7 @@ enum SbiToken {
IF, _IN_, INPUT,
LET, LINE, LINEINPUT, LOCAL, LOOP, LPRINT, LSET,
NAME, NEW, NEXT,
- ON, OPEN, OPTION, IMPLEMENTS,
+ ON, OPEN, OPTION, ATTRIBUTE, IMPLEMENTS,
PRINT, PRIVATE, PROPERTY, PUBLIC,
REDIM, REM, RESUME, RETURN, RSET,
SELECT, SET, SHARED, STATIC, STEP, STOP, SUB,
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index 1a60a5d79a45..6d305d0ba51c 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -48,6 +48,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <tools/wldcrd.hxx>
#include <i18npool/lang.h>
+#include <rtl/string.hxx>
#include "runtime.hxx"
#include "sbunoobj.hxx"
@@ -75,13 +76,16 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/io/XStream.hpp>
#include <com/sun/star/io/XSeekable.hpp>
-
+#include <com/sun/star/script/XErrorQuery.hpp>
+#include <ooo/vba/XHelperInterface.hpp>
+#include <com/sun/star/bridge/oleautomation/XAutomationObject.hpp>
using namespace comphelper;
using namespace osl;
using namespace com::sun::star::uno;
using namespace com::sun::star::lang;
using namespace com::sun::star::ucb;
using namespace com::sun::star::io;
+using namespace com::sun::star::script;
#endif /* _USE_UNO */
@@ -103,6 +107,8 @@ using namespace com::sun::star::io;
#include <stdlib.h>
#include <ctype.h>
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
#if defined (WIN) || defined (WNT) || defined (OS2)
#include <direct.h> // _getdcwd get current work directory, _chdrive
#endif
@@ -121,6 +127,9 @@ using namespace com::sun::star::io;
#include <io.h>
#endif
+
+#include <basic/sbobjmod.hxx>
+
#include <basic/sbobjmod.hxx>
static void FilterWhiteSpace( String& rStr )
@@ -706,6 +715,36 @@ RTLFUNC(MkDir) // JSM
{
try
{
+ if ( SbiRuntime::isVBAEnabled() )
+ {
+ // If aPath is the folder name, not a path, then create the folder under current directory.
+ INetURLObject aTryPathURL( aPath );
+ ::rtl::OUString sPathURL = aTryPathURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( !sPathURL.getLength() )
+ {
+ File::getFileURLFromSystemPath( aPath, sPathURL );
+ }
+ INetURLObject aPathURL( sPathURL );
+ if ( !aPathURL.GetPath().getLength() )
+ {
+ ::rtl::OUString sCurDirURL;
+ SbxArrayRef pPar = new SbxArray;
+ SbxVariableRef pVar = new SbxVariable();
+ pPar->Put( pVar, 0 );
+ SbRtl_CurDir( pBasic, *pPar, FALSE );
+ String aCurPath = pPar->Get(0)->GetString();
+
+ File::getFileURLFromSystemPath( aCurPath, sCurDirURL );
+ INetURLObject aDirURL( sCurDirURL );
+ aDirURL.Append( aPath );
+ ::rtl::OUString aTmpPath = aDirURL.GetMainURL( INetURLObject::NO_DECODE );
+ if ( aTmpPath.getLength() > 0 )
+ {
+ aPath = aTmpPath;
+ }
+ }
+ }
+
xSFI->createFolder( getFullPath( aPath ) );
}
catch( Exception & )
@@ -940,6 +979,26 @@ RTLFUNC(Hex)
}
}
+RTLFUNC(FuncCaller)
+{
+ (void)pBasic;
+ (void)bWrite;
+ if ( SbiRuntime::isVBAEnabled() && pINST && pINST->pRun )
+ {
+ if ( pINST->pRun->GetExternalCaller() )
+ *rPar.Get(0) = *pINST->pRun->GetExternalCaller();
+ else
+ {
+ SbxVariableRef pVar = new SbxVariable(SbxVARIANT);
+ *rPar.Get(0) = *pVar;
+ }
+ }
+ else
+ {
+ StarBASIC::Error( SbERR_NOT_IMPLEMENTED );
+ }
+
+}
// InStr( [start],string,string,[compare] )
RTLFUNC(InStr)
@@ -2411,7 +2470,18 @@ RTLFUNC(IsEmpty)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ {
+ SbxVariable* pVar = NULL;
+ if( SbiRuntime::isVBAEnabled() )
+ pVar = getDefaultProp( rPar.Get(1) );
+ if ( pVar )
+ {
+ pVar->Broadcast( SBX_HINT_DATAWANTED );
+ rPar.Get( 0 )->PutBool( pVar->IsEmpty() );
+ }
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsEmpty() );
+ }
}
RTLFUNC(IsError)
@@ -2422,7 +2492,22 @@ RTLFUNC(IsError)
if ( rPar.Count() < 2 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
else
- rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ {
+ SbxVariable* pVar =rPar.Get( 1 );
+ SbUnoObject* pObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ Reference< XErrorQuery > xError;
+ if ( pObj )
+ xError.set( pObj->getUnoAny(), UNO_QUERY );
+ if ( xError.is() )
+ rPar.Get( 0 )->PutBool( xError->hasError() );
+ else
+ rPar.Get( 0 )->PutBool( rPar.Get(1)->IsErr() );
+ }
}
RTLFUNC(IsNull)
@@ -3542,6 +3627,13 @@ RTLFUNC(Shell)
NAMESPACE_VOS(OArgumentList) aArgList( pArgumentList, nParamCount );
bSucc = pApp->execute( eOptions, aArgList ) == NAMESPACE_VOS(OProcess)::E_None;
}
+ long nResult = 0;
+ NAMESPACE_VOS(OProcess)::TProcessInfo aInfo;
+ // We should return the identifier of the executing process when is running VBA, because method Shell(...) returns it in Excel.
+ if ( bSucc && SbiRuntime::isVBAEnabled() && pApp->getInfo( NAMESPACE_VOS(OProcess)::TData_Identifier, &aInfo ) == NAMESPACE_VOS(OProcess)::E_None )
+ {
+ nResult = aInfo.Ident;
+ }
/*
if( nParamCount == 0 )
@@ -3556,7 +3648,7 @@ RTLFUNC(Shell)
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
- rPar.Get(0)->PutLong( 0 );
+ rPar.Get(0)->PutLong( nResult );
}
}
@@ -3627,6 +3719,65 @@ String getBasicTypeName( SbxDataType eType )
return aRetStr;
}
+String getObjectTypeName( SbxVariable* pVar )
+{
+ rtl::OUString sRet( RTL_CONSTASCII_USTRINGPARAM("Object") );
+ if ( pVar )
+ {
+ SbxBase* pObj = pVar->GetObject();
+ if( !pObj )
+ sRet = String( RTL_CONSTASCII_USTRINGPARAM("Nothing") );
+ else
+ {
+ SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,pVar );
+ if ( !pUnoObj )
+ {
+ if ( SbxBase* pBaseObj = pVar->GetObject() )
+ pUnoObj = PTR_CAST(SbUnoObject, pBaseObj );
+ }
+ if ( pUnoObj )
+ {
+ Any aObj = pUnoObj->getUnoAny();
+ // For upstreaming unless we start to build oovbaapi by default
+ // we need to get detect the vba-ness of the object in some
+ // other way
+ // note: Automation objects do not support XServiceInfo
+ Reference< XServiceInfo > xServInfo( aObj, UNO_QUERY );
+ if ( xServInfo.is() )
+ {
+ // is this a VBA object ?
+ Reference< ooo::vba::XHelperInterface > xVBA( aObj, UNO_QUERY );
+ Sequence< rtl::OUString > sServices = xServInfo->getSupportedServiceNames();
+ if ( sServices.getLength() )
+ sRet = sServices[ 0 ];
+ }
+ else
+ {
+ Reference< com::sun::star::bridge::oleautomation::XAutomationObject > xAutoMation( aObj, UNO_QUERY );
+ if ( xAutoMation.is() )
+ {
+ Reference< XInvocation > xInv( aObj, UNO_QUERY );
+ if ( xInv.is() )
+ {
+ try
+ {
+ xInv->getValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("$GetTypeName") ) ) >>= sRet;
+ }
+ catch( Exception& )
+ {
+ }
+ }
+ }
+ }
+ sal_Int32 nDot = sRet.lastIndexOf( '.' );
+ if ( nDot != -1 && nDot < sRet.getLength() )
+ sRet = sRet.copy( nDot + 1 );
+ }
+ }
+ }
+ return sRet;
+}
+
RTLFUNC(TypeName)
{
(void)pBasic;
@@ -3638,7 +3789,12 @@ RTLFUNC(TypeName)
{
SbxDataType eType = rPar.Get(1)->GetType();
BOOL bIsArray = ( ( eType & SbxARRAY ) != 0 );
- String aRetStr = getBasicTypeName( eType );
+
+ String aRetStr;
+ if ( SbiRuntime::isVBAEnabled() && eType == SbxOBJECT )
+ aRetStr = getObjectTypeName( rPar.Get(1) );
+ else
+ aRetStr = getBasicTypeName( eType );
if( bIsArray )
aRetStr.AppendAscii( "()" );
rPar.Get(0)->PutString( aRetStr );
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 62e9c388f5c5..033e7b1bd247 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -78,11 +78,15 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/i18n/XCalendar.hpp>
+#include <com/sun/star/sheet/XFunctionAccess.hpp>
using namespace comphelper;
+using namespace com::sun::star::sheet;
using namespace com::sun::star::uno;
using namespace com::sun::star::i18n;
+void unoToSbxValue( SbxVariable* pVar, const Any& aValue );
+Any sbxToUnoValue( SbxVariable* pVar, const Type& rType, com::sun::star::beans::Property* pUnoProperty = NULL );
static Reference< XCalendar > getLocaleCalendar( void )
{
@@ -528,6 +532,10 @@ RTLFUNC(DoEvents)
(void)pBasic;
(void)bWrite;
(void)rPar;
+// don't undstand what upstream are up to
+// we already process application events etc. in between
+// basic runtime pcode ( on a timed basis )
+#if 0
// Dummy implementation as the following code leads
// to performance problems for unknown reasons
//Timer aTimer;
@@ -535,6 +543,9 @@ RTLFUNC(DoEvents)
//aTimer.Start();
//while ( aTimer.IsActive() )
// Application::Reschedule();
+#endif
+ // always return 0
+ rPar.Get(0)->PutInteger( 0 );
}
RTLFUNC(GetGUIVersion)
@@ -2518,6 +2529,546 @@ RTLFUNC(Round)
rPar.Get(0)->PutDouble( dRes );
}
+void CallFunctionAccessFunction( const Sequence< Any >& aArgs, const rtl::OUString& sFuncName, SbxVariable* pRet )
+{
+ static Reference< XFunctionAccess > xFunc;
+ Any aRes;
+ try
+ {
+ if ( !xFunc.is() )
+ {
+ Reference< XMultiServiceFactory > xFactory( getProcessServiceFactory() );
+ if( xFactory.is() )
+ {
+ xFunc.set( xFactory->createInstance(::rtl::OUString::createFromAscii( "com.sun.star.sheet.FunctionAccess")), UNO_QUERY_THROW);
+ }
+ }
+ Any aRet = xFunc->callFunction( sFuncName, aArgs );
+
+ unoToSbxValue( pRet, aRet );
+
+ }
+ catch( Exception& )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ }
+}
+
+RTLFUNC(SYD)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 4 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+ aParams[ 3 ] <<= makeAny( rPar.Get(4)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SYD") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(SLN)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SLN") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Pmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Pmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetDouble();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(PV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= makeAny( rPar.Get(1)->GetDouble() );
+ Any aValues = sbxToUnoValue( rPar.Get(2),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 1 ] <<= aValues;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(NPer)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double pmt = rPar.Get(2)->GetDouble();
+ double pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NPer") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(MIRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+ // retrieve non-optional params
+
+ Sequence< Any > aParams( 3 );
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= makeAny( rPar.Get(2)->GetDouble() );
+ aParams[ 2 ] <<= makeAny( rPar.Get(3)->GetDouble() );
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("MIRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IRR)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 1 || nArgCount > 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+ Any aValues = sbxToUnoValue( rPar.Get(1),
+ getCppuType( (Sequence<double>*)0 ) );
+
+ // convert for calc functions
+ Sequence< Sequence< double > > sValues(1);
+ aValues >>= sValues[ 0 ];
+ aValues <<= sValues;
+
+ // set default values for Optional args
+ double guess = 0.1;
+ // guess
+ if ( nArgCount >= 2 )
+ {
+ if( rPar.Get(2)->GetType() != SbxEMPTY )
+ guess = rPar.Get(2)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 2 );
+ aParams[ 0 ] <<= aValues;
+ aParams[ 1 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IRR") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(IPmt)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double per = rPar.Get(2)->GetInteger();
+ double nper = rPar.Get(3)->GetDouble();
+ double pv = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+
+ // fv
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ fv = rPar.Get(5)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= per;
+ aParams[ 2 ] <<= nper;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= fv;
+ aParams[ 5 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IPmt") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(FV)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double rate = rPar.Get(1)->GetDouble();
+ double nper = rPar.Get(2)->GetDouble();
+ double pmt = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double pv = 0;
+ double type = 0;
+
+ // pv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ pv = rPar.Get(4)->GetDouble();
+ }
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= rate;
+ aParams[ 1 ] <<= nper;
+ aParams[ 2 ] <<= pmt;
+ aParams[ 3 ] <<= pv;
+ aParams[ 4 ] <<= type;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FV") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(DDB)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 4 || nArgCount > 5 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double cost = rPar.Get(1)->GetDouble();
+ double salvage = rPar.Get(2)->GetDouble();
+ double life = rPar.Get(3)->GetDouble();
+ double period = rPar.Get(4)->GetDouble();
+
+ // set default values for Optional args
+ double factor = 2;
+
+ // factor
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ factor = rPar.Get(5)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 5 );
+ aParams[ 0 ] <<= cost;
+ aParams[ 1 ] <<= salvage;
+ aParams[ 2 ] <<= life;
+ aParams[ 3 ] <<= period;
+ aParams[ 4 ] <<= factor;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DDB") ), rPar.Get( 0 ) );
+}
+
+RTLFUNC(Rate)
+{
+ (void)pBasic;
+ (void)bWrite;
+
+ ULONG nArgCount = rPar.Count()-1;
+
+ if ( nArgCount < 3 || nArgCount > 6 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+ // retrieve non-optional params
+
+ double nper = 0;
+ double pmt = 0;
+ double pv = 0;
+
+ nper = rPar.Get(1)->GetDouble();
+ pmt = rPar.Get(2)->GetDouble();
+ pv = rPar.Get(3)->GetDouble();
+
+ // set default values for Optional args
+ double fv = 0;
+ double type = 0;
+ double guess = 0.1;
+
+ // fv
+ if ( nArgCount >= 4 )
+ {
+ if( rPar.Get(4)->GetType() != SbxEMPTY )
+ fv = rPar.Get(4)->GetDouble();
+ }
+
+ // type
+ if ( nArgCount >= 5 )
+ {
+ if( rPar.Get(5)->GetType() != SbxEMPTY )
+ type = rPar.Get(5)->GetDouble();
+ }
+
+ // guess
+ if ( nArgCount >= 6 )
+ {
+ if( rPar.Get(6)->GetType() != SbxEMPTY )
+ type = rPar.Get(6)->GetDouble();
+ }
+
+ Sequence< Any > aParams( 6 );
+ aParams[ 0 ] <<= nper;
+ aParams[ 1 ] <<= pmt;
+ aParams[ 2 ] <<= pv;
+ aParams[ 3 ] <<= fv;
+ aParams[ 4 ] <<= type;
+ aParams[ 5 ] <<= guess;
+
+ CallFunctionAccessFunction( aParams, rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Rate") ), rPar.Get( 0 ) );
+}
+
RTLFUNC(StrReverse)
{
(void)pBasic;
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index 5437654f69a0..bfcb8633e90b 100644
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -165,29 +165,41 @@ extern RTLFUNC(Kill); // JSM
extern RTLFUNC(MkDir); // JSM
extern RTLFUNC(RmDir); // JSM
extern RTLFUNC(SendKeys); // JSM
+extern RTLFUNC(DDB);
extern RTLFUNC(DimArray);
extern RTLFUNC(Dir);
extern RTLFUNC(DoEvents);
extern RTLFUNC(Exp);
extern RTLFUNC(FileLen);
extern RTLFUNC(Fix);
+extern RTLFUNC(FV);
extern RTLFUNC(Hex);
extern RTLFUNC(Input);
extern RTLFUNC(InStr);
extern RTLFUNC(InStrRev);
extern RTLFUNC(Int);
+extern RTLFUNC(IPmt);
+extern RTLFUNC(IRR);
extern RTLFUNC(Join);
extern RTLFUNC(LCase);
extern RTLFUNC(Left);
extern RTLFUNC(Log);
extern RTLFUNC(LTrim);
extern RTLFUNC(Mid);
+extern RTLFUNC(MIRR);
+extern RTLFUNC(NPer);
+extern RTLFUNC(NPV);
extern RTLFUNC(Oct);
+extern RTLFUNC(Pmt);
+extern RTLFUNC(PPmt);
+extern RTLFUNC(PV);
+extern RTLFUNC(Rate);
extern RTLFUNC(Replace);
extern RTLFUNC(Right);
extern RTLFUNC(RTrim);
extern RTLFUNC(RTL);
extern RTLFUNC(Sgn);
+extern RTLFUNC(SLN);
extern RTLFUNC(Space);
extern RTLFUNC(Split);
extern RTLFUNC(Sqr);
@@ -195,6 +207,7 @@ extern RTLFUNC(Str);
extern RTLFUNC(StrComp);
extern RTLFUNC(String);
extern RTLFUNC(StrReverse);
+extern RTLFUNC(SYD);
extern RTLFUNC(Tan);
extern RTLFUNC(UCase);
extern RTLFUNC(Val);
@@ -297,6 +310,7 @@ extern RTLFUNC(Switch);
extern RTLFUNC(Wait);
//i#64882# add new WaitUntil
extern RTLFUNC(WaitUntil);
+extern RTLFUNC(FuncCaller);
extern RTLFUNC(GetGUIVersion);
extern RTLFUNC(Choose);
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx
index 1bb6fb82e113..c30f64af2fe3 100755
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -46,6 +46,8 @@
#include "errobject.hxx"
#include "sbtrace.hxx"
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
using namespace ::com::sun::star;
bool SbiRuntime::isVBAEnabled()
@@ -544,7 +546,7 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
: rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
{
nFlags = pe ? pe->GetDebugFlags() : 0;
pIosys = pInst->pIosys;
@@ -601,6 +603,13 @@ SbiRuntime::~SbiRuntime()
void SbiRuntime::SetVBAEnabled(bool bEnabled )
{
bVBAEnabled = bEnabled;
+ if ( bVBAEnabled )
+ {
+ if ( pMeth )
+ mpExtCaller = pMeth->mCaller;
+ }
+ else
+ mpExtCaller = 0;
}
// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
@@ -1029,7 +1038,25 @@ SbxVariable* SbiRuntime::GetTOS( short n )
void SbiRuntime::TOSMakeTemp()
{
SbxVariable* p = refExprStk->Get( nExprLvl - 1 );
- if( p->GetRefCount() != 1 )
+ if ( p->GetType() == SbxEMPTY )
+ p->Broadcast( SBX_HINT_DATAWANTED );
+
+ SbxVariable* pDflt = NULL;
+ if ( bVBAEnabled && ( p->GetType() == SbxOBJECT || p->GetType() == SbxVARIANT ) && ( pDflt = getDefaultProp( p ) ) )
+ {
+ pDflt->Broadcast( SBX_HINT_DATAWANTED );
+ // replacing new p on stack causes object pointed by
+ // pDft->pParent to be deleted, when p2->Compute() is
+ // called below pParent is accessed ( but its deleted )
+ // so set it to NULL now
+ pDflt->SetParent( NULL );
+ p = new SbxVariable( *pDflt );
+ p->SetFlag( SBX_READWRITE );
+ refExprStk->Put( p, nExprLvl - 1 );
+// return;
+ }
+
+ else if( p->GetRefCount() != 1 )
{
SbxVariable* pNew = new SbxVariable( *p );
pNew->SetFlag( SBX_READWRITE );
@@ -1038,7 +1065,6 @@ void SbiRuntime::TOSMakeTemp()
}
// Der GOSUB-Stack nimmt Returnadressen fuer GOSUBs auf
-
void SbiRuntime::PushGosub( const BYTE* pc )
{
if( ++nGosubLvl > MAXRECURSION )
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 4455901bfeba..1e127486b432 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -33,7 +33,7 @@
#include <basic/sbstdobj.hxx>
#include "rtlproto.hxx"
#include "sbintern.hxx"
-
+#include <hash_map>
// Das nArgs-Feld eines Tabelleneintrags ist wie folgt verschluesselt:
// Zur Zeit wird davon ausgegangen, dass Properties keine Parameter
// benoetigen!
@@ -69,6 +69,45 @@ struct Methods {
USHORT nHash; // Hashcode
};
+struct StringHashCode
+{
+ size_t operator()( const String& rStr ) const
+ {
+ return rtl_ustr_hashCode_WithLength( rStr.GetBuffer(), rStr.Len() );
+ }
+};
+
+class VBABlacklist
+{
+friend class VBABlackListQuery;
+ std::hash_map< String, bool, StringHashCode > mBlackList;
+ VBABlacklist()
+ {
+ const char* list[] = { "Red" };
+ sal_Int32 nSize = sizeof( list ) / sizeof( list[ 0 ] );
+ for ( sal_Int32 index = 0; index < nSize; ++index )
+ {
+ mBlackList[ String::CreateFromAscii( list[ index ] ).ToLowerAscii() ] = true;
+ }
+ }
+public:
+ bool isBlackListed( const String& sName )
+ {
+ String sNameLower( sName );
+ sNameLower.ToLowerAscii();
+ return ( mBlackList.find( sNameLower ) != mBlackList.end() );
+ }
+};
+
+class VBABlackListQuery
+{
+public:
+ static bool isBlackListed( const String& sName )
+ {
+ static VBABlacklist blackList;
+ return blackList.isBlackListed( sName );
+ }
+};
static Methods aMethods[] = {
{ "AboutStarBasic", SbxNULL, 1 | _FUNCTION, RTLNAME(AboutStarBasic),0 },
@@ -171,7 +210,12 @@ static Methods aMethods[] = {
{ "expression", SbxVARIANT, 0,NULL,0 },
{ "CVErr", SbxVARIANT, 1 | _FUNCTION, RTLNAME(CVErr),0 },
{ "expression", SbxVARIANT, 0,NULL,0 },
-
+{ "DDB", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(DDB),0 },
+ { "Cost", SbxDOUBLE, 0, NULL,0 },
+ { "Salvage", SbxDOUBLE, 0, NULL,0 },
+ { "Life", SbxDOUBLE, 0, NULL,0 },
+ { "Period", SbxDOUBLE, 0, NULL,0 },
+ { "Factor", SbxVARIANT, _OPT, NULL,0 },
{ "Date", SbxDATE, _LFUNCTION,RTLNAME(Date),0 },
{ "DateAdd", SbxDATE, 3 | _FUNCTION, RTLNAME(DateAdd),0 },
{ "Interval", SbxSTRING, 0,NULL,0 },
@@ -216,7 +260,7 @@ static Methods aMethods[] = {
{ "Dir", SbxSTRING, 2 | _FUNCTION, RTLNAME(Dir),0 },
{ "FileSpec", SbxSTRING, _OPT, NULL,0 },
{ "attrmask", SbxINTEGER, _OPT, NULL,0 },
-{ "DoEvents", SbxEMPTY, _FUNCTION, RTLNAME(DoEvents),0 },
+{ "DoEvents", SbxINTEGER, _FUNCTION, RTLNAME(DoEvents),0 },
{ "DumpAllObjects", SbxEMPTY, 2 | _SUB, RTLNAME(DumpAllObjects),0 },
{ "FileSpec", SbxSTRING, 0,NULL,0 },
{ "DumpAll", SbxINTEGER, _OPT, NULL,0 },
@@ -271,6 +315,12 @@ static Methods aMethods[] = {
{ "FreeLibrary", SbxNULL, 1 | _FUNCTION, RTLNAME(FreeLibrary),0 },
{ "Modulename", SbxSTRING, 0,NULL,0 },
+{ "FV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(FV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
{ "Get", SbxNULL, 3 | _FUNCTION, RTLNAME(Get),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
@@ -331,6 +381,16 @@ static Methods aMethods[] = {
{ "Compare", SbxINTEGER, _OPT, NULL,0 },
{ "Int", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Int),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
+{ "IPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(IPmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Per", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+{ "IRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(IRR),0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "IsArray", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsArray),0 },
{ "Variant", SbxVARIANT, 0,NULL,0 },
{ "IsDate", SbxBOOL, 1 | _FUNCTION, RTLNAME(IsDate),0 },
@@ -401,6 +461,10 @@ static Methods aMethods[] = {
{ "Length", SbxLONG, _OPT, NULL,0 },
{ "Minute", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Minute),0 },
{ "Date", SbxDATE, 0,NULL,0 },
+{ "MIRR", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(MIRR),0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
+ { "FinanceRate", SbxDOUBLE, 0, NULL,0 },
+ { "ReinvestRate", SbxDOUBLE, 0, NULL,0 },
{ "MkDir", SbxNULL, 1 | _FUNCTION, RTLNAME(MkDir),0 },
{ "pathname", SbxSTRING, 0,NULL,0 },
{ "Month", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Month),0 },
@@ -417,6 +481,15 @@ static Methods aMethods[] = {
{ "Nothing", SbxOBJECT, _CPROP, RTLNAME(Nothing),0 },
{ "Now", SbxDATE, _FUNCTION, RTLNAME(Now),0 },
+{ "NPer", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(NPer),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+{ "NPV", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(NPV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "ValueArray", SbxARRAY, 0, NULL,0 },
{ "Null", SbxNULL, _CPROP, RTLNAME(Null),0 },
{ "Oct", SbxSTRING, 1 | _FUNCTION, RTLNAME(Oct),0 },
@@ -428,16 +501,46 @@ static Methods aMethods[] = {
{ "stop", SbxLONG, 0,NULL,0 },
{ "interval", SbxLONG, 0,NULL,0 },
{ "Pi", SbxDOUBLE, _CPROP, RTLNAME(PI),0 },
+
+{ "Pmt", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(Pmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
+{ "PPmt", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(PPmt),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "Per", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
{ "Put", SbxNULL, 3 | _FUNCTION, RTLNAME(Put),0 },
{ "filenumber", SbxINTEGER, 0,NULL,0 },
{ "recordnumber", SbxLONG, 0,NULL,0 },
{ "variablename", SbxVARIANT, 0,NULL,0 },
+{ "PV", SbxDOUBLE, 5 | _FUNCTION | _COMPTMASK, RTLNAME(PV),0 },
+ { "Rate", SbxDOUBLE, 0, NULL,0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+
{ "QBColor", SbxLONG, 1 | _FUNCTION, RTLNAME(QBColor),0 },
{ "number", SbxINTEGER, 0,NULL,0 },
{ "Randomize", SbxNULL, 1 | _FUNCTION, RTLNAME(Randomize),0 },
{ "Number", SbxDOUBLE, _OPT, NULL,0 },
+{ "Rate", SbxDOUBLE, 6 | _FUNCTION | _COMPTMASK, RTLNAME(Rate),0 },
+ { "NPer", SbxDOUBLE, 0, NULL,0 },
+ { "Pmt", SbxDOUBLE, 0, NULL,0 },
+ { "PV", SbxDOUBLE, 0, NULL,0 },
+ { "FV", SbxVARIANT, _OPT, NULL,0 },
+ { "Due", SbxVARIANT, _OPT, NULL,0 },
+ { "Guess", SbxVARIANT, _OPT, NULL,0 },
{ "Red", SbxINTEGER, 1 | _FUNCTION, RTLNAME(Red),0 },
{ "RGB-Value", SbxLONG, 0,NULL,0 },
{ "Reset", SbxNULL, 0 | _FUNCTION, RTLNAME(Reset),0 },
@@ -491,6 +594,15 @@ static Methods aMethods[] = {
{ "WindowStyle", SbxINTEGER, _OPT, NULL,0 },
{ "Sin", SbxDOUBLE, 1 | _FUNCTION, RTLNAME(Sin),0 },
{ "number", SbxDOUBLE, 0,NULL,0 },
+{ "SLN", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SLN),0 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Double", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+{ "SYD", SbxDOUBLE, 2 | _FUNCTION | _COMPTMASK, RTLNAME(SYD),0 },
+ { "Cost", SbxDOUBLE, 0,NULL,0 },
+ { "Salvage", SbxDOUBLE, 0,NULL,0 },
+ { "Life", SbxDOUBLE, 0,NULL,0 },
+ { "Period", SbxDOUBLE, 0,NULL,0 },
{ "Space", SbxSTRING, 1 | _FUNCTION, RTLNAME(Space),0 },
{ "string", SbxLONG, 0,NULL,0 },
{ "Spc", SbxSTRING, 1 | _FUNCTION, RTLNAME(Spc),0 },
@@ -605,6 +717,7 @@ static Methods aMethods[] = {
{ "Wait", SbxNULL, 1 | _FUNCTION, RTLNAME(Wait),0 },
{ "Milliseconds", SbxLONG, 0,NULL,0 },
+{ "FuncCaller", SbxVARIANT, _FUNCTION, RTLNAME(FuncCaller),0 },
//#i64882#
{ "WaitUntil", SbxNULL, 1 | _FUNCTION, RTLNAME(WaitUntil),0 },
{ "Date", SbxDOUBLE, 0,NULL,0 },
@@ -683,13 +796,15 @@ SbxVariable* SbiStdObject::Find( const String& rName, SbxClassType t )
&& ( p->nHash == nHash_ )
&& ( rName.EqualsIgnoreCaseAscii( p->pName ) ) )
{
+ SbiInstance* pInst = pINST;
bFound = TRUE;
if( p->nArgs & _COMPTMASK )
{
- SbiInstance* pInst = pINST;
if( !pInst || !pInst->IsCompatibility() )
bFound = FALSE;
}
+ if ( pInst && pInst->IsCompatibility() && VBABlackListQuery::isBlackListed( rName ) )
+ bFound = FALSE;
break;
}
nIndex += ( p->nArgs & _ARGSMASK ) + 1;
diff --git a/basic/source/runtime/step0.cxx b/basic/source/runtime/step0.cxx
index 06a8bb19af00..e184d8928f3f 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -48,6 +48,11 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
#include <algorithm>
+// for a patch forward declaring these methods below makes sense
+// but, #FIXME lets really just move the methods to the top
+void lcl_clearImpl( SbxVariableRef& refVar, SbxDataType& eType );
+void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled );
+
SbxVariable* getDefaultProp( SbxVariable* pRef );
void SbiRuntime::StepNOP()
@@ -59,34 +64,6 @@ void SbiRuntime::StepArith( SbxOperator eOp )
TOSMakeTemp();
SbxVariable* p2 = GetTOS();
-
- // This could & should be moved to the MakeTempTOS() method in runtime.cxx
- // In the code which this is cut'npaste from there is a check for a ref
- // count != 1 based on which the copy of the SbxVariable is done.
- // see orig code in MakeTempTOS ( and I'm not sure what the significance,
- // of that is )
- // here we alway seem to have a refcount of 1. Also it seems that
- // MakeTempTOS is called for other operation, so I hold off for now
- // until I have a better idea
- if ( bVBAEnabled
- && ( p2->GetType() == SbxOBJECT || p2->GetType() == SbxVARIANT )
- )
- {
- SbxVariable* pDflt = getDefaultProp( p2 );
- if ( pDflt )
- {
- pDflt->Broadcast( SBX_HINT_DATAWANTED );
- // replacing new p2 on stack causes object pointed by
- // pDft->pParent to be deleted, when p2->Compute() is
- // called below pParent is accessed ( but its deleted )
- // so set it to NULL now
- pDflt->SetParent( NULL );
- p2 = new SbxVariable( *pDflt );
- p2->SetFlag( SBX_READWRITE );
- refExprStk->Put( p2, nExprLvl - 1 );
- }
- }
-
p2->ResetFlag( SBX_FIXED );
p2->Compute( eOp, *p1 );
@@ -109,19 +86,24 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
// values ( and type ) set as appropriate
SbxDataType p1Type = p1->GetType();
SbxDataType p2Type = p2->GetType();
+ if ( p1Type == SbxEMPTY )
+ {
+ p1->Broadcast( SBX_HINT_DATAWANTED );
+ p1Type = p1->GetType();
+ }
+ if ( p2Type == SbxEMPTY )
+ {
+ p2->Broadcast( SBX_HINT_DATAWANTED );
+ p2Type = p2->GetType();
+ }
if ( p1Type == p2Type )
{
- if ( p1Type == SbxEMPTY )
- {
- p1->Broadcast( SBX_HINT_DATAWANTED );
- p2->Broadcast( SBX_HINT_DATAWANTED );
- }
// if both sides are an object and have default props
// then we need to use the default props
// we don't need to worry if only one side ( lhs, rhs ) is an
// object ( object side will get coerced to correct type in
// Compare )
- else if ( p1Type == SbxOBJECT )
+ if ( p1Type == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( p1 );
if ( pDflt )
@@ -141,8 +123,21 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
#ifndef WIN
static SbxVariable* pTRUE = NULL;
static SbxVariable* pFALSE = NULL;
-
- if( p2->Compare( eOp, *p1 ) )
+ static SbxVariable* pNULL = NULL;
+ // why do this on non-windows ?
+ // why do this at all ?
+ // I dumbly follow the pattern :-/
+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
+ {
+ if( !pNULL )
+ {
+ pNULL = new SbxVariable;
+ pNULL->PutNull();
+ pNULL->AddRef();
+ }
+ PushVar( pNULL );
+ }
+ else if( p2->Compare( eOp, *p1 ) )
{
if( !pTRUE )
{
@@ -163,9 +158,14 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
PushVar( pFALSE );
}
#else
- BOOL bRes = p2->Compare( eOp, *p1 );
SbxVariable* pRes = new SbxVariable;
- pRes->PutBool( bRes );
+ if ( bVBAEnabled && ( p1->IsNull() || p2->IsNull() ) )
+ pRes->PutNull();
+ else
+ {
+ BOOL bRes = p2->Compare( eOp, *p1 );
+ pRes->PutBool( bRes );
+ }
PushVar( pRes );
#endif
}
@@ -679,6 +679,17 @@ void SbiRuntime::StepDIM()
// #56204 DIM-Funktionalitaet in Hilfsmethode auslagern (step0.cxx)
void SbiRuntime::DimImpl( SbxVariableRef refVar )
{
+ // If refDim then this DIM statement is terminating a ReDIM and
+ // previous StepERASE_CLEAR for an array, the following actions have
+ // been delayed from ( StepERASE_CLEAR ) 'till here
+ if ( refRedim )
+ {
+ if ( !refRedimpArray ) // only erase the array not ReDim Preserve
+ lcl_eraseImpl( refVar, bVBAEnabled );
+ SbxDataType eType = refVar->GetType();
+ lcl_clearImpl( refVar, eType );
+ refRedim = NULL;
+ }
SbxArray* pDims = refVar->GetParameters();
// Muss eine gerade Anzahl Argumente haben
// Man denke daran, dass Arg[0] nicht zaehlt!
@@ -844,6 +855,7 @@ void SbiRuntime::StepREDIMP()
void SbiRuntime::StepREDIMP_ERASE()
{
SbxVariableRef refVar = PopVar();
+ refRedim = refVar;
SbxDataType eType = refVar->GetType();
if( eType & SbxARRAY )
{
@@ -854,12 +866,6 @@ void SbiRuntime::StepREDIMP_ERASE()
refRedimpArray = pDimArray;
}
- // As in ERASE
- USHORT nSavFlags = refVar->GetFlags();
- refVar->ResetFlag( SBX_FIXED );
- refVar->SetType( SbxDataType(eType & 0x0FFF) );
- refVar->SetFlags( nSavFlags );
- refVar->Clear();
}
else
if( refVar->IsFixed() )
@@ -932,10 +938,7 @@ void SbiRuntime::StepERASE()
void SbiRuntime::StepERASE_CLEAR()
{
- SbxVariableRef refVar = PopVar();
- lcl_eraseImpl( refVar, bVBAEnabled );
- SbxDataType eType = refVar->GetType();
- lcl_clearImpl( refVar, eType );
+ refRedim = PopVar();
}
void SbiRuntime::StepARRAYACCESS()
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index e23ef864218e..ec440a33f16c 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -93,6 +93,15 @@ void SbiRuntime::StepARGN( UINT32 nOp1 )
{
String aAlias( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxVariableRef pVal = PopVar();
+ if( bVBAEnabled && ( pVal->ISA(SbxMethod) || pVal->ISA(SbUnoProperty) || pVal->ISA(SbProcedureProperty) ) )
+ {
+ // named variables ( that are Any especially properties ) can be empty at this point and need a broadcast
+ if ( pVal->GetType() == SbxEMPTY )
+ pVal->Broadcast( SBX_HINT_DATAWANTED );
+ // Methoden und Properties evaluieren!
+ SbxVariable* pRes = new SbxVariable( *pVal );
+ pVal = pRes;
+ }
refArgv->Put( pVal, nArgc );
refArgv->PutAlias( aAlias, nArgc++ );
}
@@ -182,7 +191,9 @@ void SbiRuntime::StepJUMPT( UINT32 nOp1 )
void SbiRuntime::StepJUMPF( UINT32 nOp1 )
{
SbxVariableRef p = PopVar();
- if( !p->GetBool() )
+ // In a test e.g. If Null then
+ // will evaluate Null will act as if False
+ if( ( bVBAEnabled && p->IsNull() ) || !p->GetBool() )
StepJUMP( nOp1 );
}
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 587b0ae7a590..347d2646754f 100755
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -141,7 +141,7 @@ SbxVariable* SbiRuntime::FindElement
if ( pElem )
bSetName = false; // don't overwrite uno name
else
- pElem = getVBAConstant( aName );
+ pElem = VBAConstantHelper::instance().getVBAConstant( aName );
}
// #72382 VORSICHT! Liefert jetzt wegen unbekannten
// Modulen IMMER ein Ergebnis!
@@ -457,7 +457,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
{
// Falls wir ein Array haben, wollen wir bitte das Array-Element!
SbxArray* pPar;
- if( pElem->GetType() & SbxARRAY )
+ if( ( pElem->GetType() & SbxARRAY ) && (SbxVariable*)refRedim != pElem )
{
SbxBase* pElemObj = pElem->GetObject();
SbxDimArray* pDimArray = PTR_CAST(SbxDimArray,pElemObj);
@@ -489,7 +489,7 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem )
pPar->Put( NULL, 0 );
}
// Index-Access bei UnoObjekten beruecksichtigen
- else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) )
+ else if( pElem->GetType() == SbxOBJECT && !pElem->ISA(SbxMethod) && ( !bVBAEnabled || ( bVBAEnabled && !pElem->ISA(SbxProperty) ) ) )
{
pPar = pElem->GetParameters();
if ( pPar )
@@ -733,6 +733,8 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
SaveRef( q );
*q = *p;
p = q;
+ if ( i )
+ refParams->Put( p, i );
}
SetupArgs( p, nOp1 );
PushVar( CheckArray( p ) );
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index d8f047059ef0..047d6c07a8ab 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1146,8 +1146,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
SbxValues aL, aR;
bool bDecimal = false;
- if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING ) ||
- ( eThisType != SbxSTRING && eOpType == SbxSTRING ) ) &&
+ if( bVBAInterop && ( ( eThisType == SbxSTRING && eOpType != SbxSTRING && eOpType != SbxEMPTY ) ||
+ ( eThisType != SbxSTRING && eThisType != SbxEMPTY && eOpType == SbxSTRING ) ) &&
( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS ) )
{
goto Lbl_OpIsDouble;
@@ -1194,6 +1194,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
aL.eType = aR.eType = GetType();
// else if( GetType() == SbxDouble || GetType() == SbxSingle )
// aL.eType = aR.eType = SbxLONG64;
+ else if ( bVBAInterop && eOpType == SbxBOOL )
+ aL.eType = aR.eType = SbxBOOL;
else
aL.eType = aR.eType = SbxLONG;
}
@@ -1280,7 +1282,12 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
break;
case SbxNOT:
if( aL.eType != SbxLONG && aL.eType != SbxULONG )
- aL.nLong64 = ~aL.nLong64;
+ {
+ if ( aL.eType != SbxBOOL )
+ aL.nLong64 = ~aL.nLong64;
+ else
+ aL.nLong = ~aL.nLong;
+ }
else
aL.nLong = ~aL.nLong;
break;
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index 004b61fbf198..ed8db5c9e1e8 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -322,7 +322,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
try {
// start parsing
- xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext ) );
+ xParser->setDocumentHandler( ::xmlscript::importDialogModel( xDialogModel, xContext, mxOwnerDocument ) );
xParser->parseStream( source );
}
catch( Exception& )
@@ -336,7 +336,7 @@ Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
// Create InputStream, TODO: Implement own InputStreamProvider
// to avoid creating the DialogModel here!
- Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext );
+ Reference< XInputStreamProvider > xISP = ::xmlscript::exportDialogModel( xDialogModel, xContext, mxOwnerDocument );
aRetAny <<= xISP;
return aRetAny;
}
@@ -484,7 +484,11 @@ void SfxDialogLibraryContainer::onNewRootStorage()
}
}
-
+sal_Bool SAL_CALL
+SfxDialogLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+{
+ return sal_False; // dialog library has no executable code
+}
//============================================================================
// Service
diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx
index f7091d1c1a0b..06c6710edd3f 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -66,7 +66,8 @@
#include <xmlscript/xmlmod_imexp.hxx>
#include <cppuhelper/factory.hxx>
#include <com/sun/star/util/VetoException.hpp>
-
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
+#include <cppuhelper/implbase1.hxx>
namespace basic
{
@@ -137,7 +138,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
return pImplLib->mbPasswordProtected;
}
-
// Ctor for service
SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
:maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
@@ -1165,6 +1165,17 @@ void SfxScriptLibraryContainer::onNewRootStorage()
{
}
+sal_Bool SAL_CALL
+SfxScriptLibraryContainer:: HasExecutableCode( const ::rtl::OUString& Library ) throw (uno::RuntimeException)
+{
+ BasicManager* pBasicMgr = getBasicManager();
+ OSL_ENSURE( pBasicMgr, "we need a basicmanager, really we do" );
+ if ( pBasicMgr )
+ return pBasicMgr->HasExeCode( Library ); // need to change this to take name
+ // default to it has code if we can't decide
+ return sal_True;
+}
+
//============================================================================
// Service
void createRegistryInfo_SfxScriptLibraryContainer()
diff --git a/formula/inc/formula/FormulaCompiler.hxx b/formula/inc/formula/FormulaCompiler.hxx
index 4da7318807a2..7a76c10fb6d6 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -219,6 +219,8 @@ public:
void SetCompileForFAP( BOOL bVal )
{ bCompileForFAP = bVal; bIgnoreErrors = bVal; }
+ static bool IsOpCodeVolatile( OpCode eOp );
+
static BOOL DeQuote( String& rStr );
static const String& GetNativeSymbol( OpCode eOp );
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 2a2832d59f0d..99bb1de6b776 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -741,6 +741,30 @@ OpCode FormulaCompiler::GetEnglishOpCode( const String& rName ) const
return bFound ? (*iLook).second : OpCode(ocNone);
}
+bool FormulaCompiler::IsOpCodeVolatile( OpCode eOp )
+{
+ switch (eOp)
+ {
+ // no parameters:
+ case ocRandom:
+ case ocGetActDate:
+ case ocGetActTime:
+ // one parameter:
+ case ocFormula:
+ case ocInfo:
+ // more than one parameters:
+ // ocIndirect/ocIndirectXL otherwise would have to do
+ // StopListening and StartListening on a reference for every
+ // interpreted value.
+ case ocIndirect:
+ case ocIndirectXL:
+ // ocOffset results in indirect references.
+ case ocOffset:
+ return true;
+ }
+ return false;
+}
+
// Remove quotes, escaped quotes are unescaped.
BOOL FormulaCompiler::DeQuote( String& rStr )
{
@@ -957,44 +981,32 @@ void FormulaCompiler::Factor()
{
if( nNumFmt == NUMBERFORMAT_UNDEFINED )
nNumFmt = lcl_GetRetFormat( eOp );
- // Functions that have to be always recalculated
- switch( eOp )
+
+ if ( IsOpCodeVolatile(eOp) )
+ pArr->SetRecalcModeAlways();
+ else
{
- // no parameters:
- case ocRandom:
- case ocGetActDate:
- case ocGetActTime:
- // one parameter:
- case ocFormula:
- case ocInfo:
- // more than one parameters:
- // ocIndirect/ocIndirectXL otherwise would have to do
- // StopListening and StartListening on a reference for every
- // interpreted value.
- case ocIndirect:
- case ocIndirectXL:
- // ocOffset results in indirect references.
- case ocOffset:
- pArr->SetRecalcModeAlways();
- break;
- // Functions recalculated on every document load.
- // Don't use SetRecalcModeOnLoad() which would override
- // ModeAlways.
- case ocConvert :
- pArr->AddRecalcMode( RECALCMODE_ONLOAD );
- break;
- // If the referred cell is moved the value changes.
- case ocColumn :
- case ocRow :
- // ocCell needs recalc on move for some possible type values.
- case ocCell :
- pArr->SetRecalcModeOnRefMove();
- break;
- case ocHyperLink :
- pArr->SetHyperLink(TRUE);
- break;
- default:
- ; // nothing
+ switch( eOp )
+ {
+ // Functions recalculated on every document load.
+ // Don't use SetRecalcModeOnLoad() which would override
+ // ModeAlways.
+ case ocConvert :
+ pArr->AddRecalcMode( RECALCMODE_ONLOAD );
+ break;
+ // If the referred cell is moved the value changes.
+ case ocColumn :
+ case ocRow :
+ // ocCell needs recalc on move for some possible type values.
+ case ocCell :
+ pArr->SetRecalcModeOnRefMove();
+ break;
+ case ocHyperLink :
+ pArr->SetHyperLink(TRUE);
+ break;
+ default:
+ ; // nothing
+ }
}
if (SC_OPCODE_START_NO_PAR <= eOp && eOp < SC_OPCODE_STOP_NO_PAR)
{
diff --git a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
index 5629a4fe34ed..f9c997001644 100644
--- a/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
+++ b/officecfg/registry/data/org/openoffice/Office/UI/CalcCommands.xcu
@@ -1205,6 +1205,12 @@
<value xml:lang="en-US">~Remove Filter</value>
</prop>
</node>
+ <node oor:name=".uno:DataForm" oor:op="replace">
+ <prop oor:name="Label" oor:type="xs:string">
+ <value xml:lang="de">D~atenForm...</value>
+ <value xml:lang="en-US">D~ataForm...</value>
+ </prop>
+ </node>
<node oor:name=".uno:DataSubTotals" oor:op="replace">
<prop oor:name="Label" oor:type="xs:string">
<value xml:lang="en-US">Sub~totals...</value>
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index 2db99d25807c..97a3cd25415a 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1394,7 +1394,7 @@
<desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
<label>Executable code</label>
</info>
- <value>false</value>
+ <value>true</value>
</prop>
<prop oor:name="Save" oor:type="xs:boolean">
<!-- OldPath: Filter/MS_Office/Basic/Excel -->
diff --git a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
index 9abada415fbd..de76f804c6b8 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -746,6 +746,17 @@
</group>
</templates>
<component>
+ <group oor:name="GlobalTemplateList">
+ <info>
+ <desc>Contains the most recently opened documents.</desc>
+ </info>
+ <prop oor:name="Paths" oor:type="oor:string-list">
+ <info>
+ <desc>Lists the file global templates loaded when importing writer documents.</desc>
+ </info>
+ <value oor:separator=";"></value>
+ </prop>
+ </group>
<group oor:name="MailMergeWizard">
<info>
<desc>Settings of the mail merge wizard.</desc>
@@ -6021,6 +6032,14 @@
</info>
<value>true</value>
</prop>
+ <prop oor:name="Executable" oor:type="xs:boolean">
+ <info>
+ <author>pflin</author>
+ <desc>Indicates whether VBA macros are imported without comments to be executable.</desc>
+ <label>Executable code</label>
+ </info>
+ <value>true</value>
+ </prop>
<prop oor:name="Save" oor:type="xs:boolean">
<!-- OldPath: Filter/MS_Office/Basic/Word -->
<!-- OldLocation: soffice.cfg -->
diff --git a/oovbaapi/genconstidl/api-to-idl.pl b/oovbaapi/genconstidl/api-to-idl.pl
index 4959e979f89e..d04cca73de95 100644
--- a/oovbaapi/genconstidl/api-to-idl.pl
+++ b/oovbaapi/genconstidl/api-to-idl.pl
@@ -125,6 +125,9 @@ sub generate_idls($) {
foreach $module ( keys %result ) {
foreach $type ( keys %{$result{$module}} ) {
my $fname = $path . "/" . $type . ".idl";
+ if ( uc($module) eq "ADODB" || uc($module) eq "DAO" ) {
+ $fname = $path . "/" . uc($module) . "_" . $type . ".idl";
+ }
open( IDL, ">$fname" ) || die "Cannot write $fname.";
if( $module eq "vba" ) {
diff --git a/oovbaapi/ooo/vba/XApplicationBase.idl b/oovbaapi/ooo/vba/XApplicationBase.idl
index d9d32e02f2ce..21fe6988d037 100644
--- a/oovbaapi/ooo/vba/XApplicationBase.idl
+++ b/oovbaapi/ooo/vba/XApplicationBase.idl
@@ -50,7 +50,7 @@ interface XApplicationBase
void Quit();
any CommandBars( [in] any aIndex );
- void Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
+ any Run([in] string MacroName, [in] /*Optional*/ any varg1, [in] /*Optional*/ any varg2, [in] /*Optional*/ any varg3, [in] /*Optional*/ any varg4, [in] /*Optional*/ any varg5, [in] /*Optional*/ any varg6, [in] /*Optional*/ any varg7, [in] /*Optional*/ any varg8, [in] /*Optional*/ any varg9, [in] /*Optional*/ any varg10, [in] /*Optional*/ any varg11, [in] /*Optional*/ any varg12, [in] /*Optional*/ any varg13, [in] /*Optional*/ any varg14, [in] /*Optional*/ any varg15, [in] /*Optional*/ any varg16, [in] /*Optional*/ any varg17, [in] /*Optional*/ any varg18, [in] /*Optional*/ any varg19, [in] /*Optional*/ any varg20, [in] /*Optional*/ any varg21, [in] /*Optional*/ any varg22, [in] /*Optional*/ any varg23, [in] /*Optional*/ any varg24, [in] /*Optional*/ any varg25, [in] /*Optional*/ any varg26, [in] /*Optional*/ any varg27, [in] /*Optional*/ any varg28, [in] /*Optional*/ any varg29, [in] /*Optional*/ any varg30);
void OnTime( [in] any aEarliestTime, [in] string aFunction, [in] any aLatestTime, [in] any aSchedule );
float CentimetersToPoints([in] float Centimeters );
void Undo();
diff --git a/oovbaapi/ooo/vba/XDialogBase.idl b/oovbaapi/ooo/vba/XDialogBase.idl
index fd89edb16237..7e1cbb9a250d 100644
--- a/oovbaapi/ooo/vba/XDialogBase.idl
+++ b/oovbaapi/ooo/vba/XDialogBase.idl
@@ -46,7 +46,7 @@ interface XDialogBase
{
interface ::ooo::vba::XHelperInterface;
- void Show();
+ boolean Show();
};
}; };
diff --git a/oovbaapi/ooo/vba/XDocumentBase.idl b/oovbaapi/ooo/vba/XDocumentBase.idl
index a4ee8b4366c6..6eb81a78ba22 100644
--- a/oovbaapi/ooo/vba/XDocumentBase.idl
+++ b/oovbaapi/ooo/vba/XDocumentBase.idl
@@ -53,7 +53,6 @@ interface XDocumentBase
void Close([in] any SaveChanges, [in] any FileName, [in] any RouteWorkBook);
void Save();
void Activate();
- void Protect( [in] any Password );
void Unprotect( [in] any Password );
};
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index 6f513ae64577..f3c02aed9ffa 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -32,6 +32,14 @@
#include <ooo/vba/XHelperInterface.idl>
#include <ooo/vba/XAssistant.idl>
+#ifndef __ooo_vba_excel_XFileDialog_idl__
+#include <ooo/vba/XFileDialog.idl>
+#endif
+
+#ifndef __ooo_vba_XFileSearch_idl__
+#include <ooo/vba/XFileSearch.idl>
+#endif
+
module ooo { module vba { module excel {
interface XRange;
@@ -41,6 +49,8 @@ interface XWorksheets;
interface XWorksheetFunction;
interface XWindow;
interface XWorksheet;
+interface XFileDialog;
+interface XFileSearch;
interface XApplication
{
@@ -56,8 +66,10 @@ interface XApplication
[attribute, readonly] XWindow ActiveWindow;
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] ooo::vba::XAssistant Assistant;
+ [attribute, readonly] ooo::vba::XFileSearch FileSearch; //liuchen 2009-8-18, add the support of VBA Application.FileSearch
[attribute] long Calculation;
[attribute, readonly] XWorkbook ThisWorkbook;
+ [attribute, readonly] ooo::vba::XFileDialog FileDialog;
[attribute, readonly] string Name;
[attribute] boolean DisplayAlerts;
[attribute] boolean DisplayFormulaBar;
@@ -65,11 +77,16 @@ interface XApplication
[attribute] any StatusBar;
[attribute] long Cursor;
[attribute] boolean EnableEvents;
+ [attribute] boolean Visible;
+ [attribute] boolean Iteration; //liuchen 2009-11-25
+ [attribute] long EnableCancelKey; //liuchen 2009-11-26
void setDefaultFilePath([in] string DefaultFilePath) raises(com::sun::star::script::BasicErrorException);
string getDefaultFilePath() raises(com::sun::star::script::BasicErrorException);
+ any GetOpenFilename([in] /*Optional*/ any FileFilter, [in] /*Optional*/ any FilterIndex, [in] /*Optional*/ any Title, [in] /*Optional*/ any ButtonText, [in] /*Optional*/ any MultiSelect); //minz, 2009-07-08
+
string LibraryPath() raises(com::sun::star::script::BasicErrorException);
string TemplatesPath() raises(com::sun::star::script::BasicErrorException);
string PathSeparator() raises(com::sun::star::script::BasicErrorException);
@@ -91,8 +108,14 @@ interface XApplication
XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
raises(com::sun::star::script::BasicErrorException);
void Volatile([in] any Volatile);
- void DoEvents();
any Caller( [in] any aIndex );
+ any MenuBars( [in] any aIndex );
+ any International([in] long Index); //liuchen 2009-11-26
+ any GetSaveAsFilename( [in] any InitialFilename, [in] any FileFilter, [in] any FilterIndex, [in] any Title,[in] any ButtonText);
+ void Undo(); //2009-10-11 limingl
+ double InchesToPoints([in] double Inches);
+ void setSheetsInNewWorkbook( [in] long SheetsInNewWorkbook ) raises(com::sun::star::script::BasicErrorException);
+ long getSheetsInNewWorkbook();
};
}; }; };
diff --git a/oovbaapi/ooo/vba/excel/XGlobals.idl b/oovbaapi/ooo/vba/excel/XGlobals.idl
index d79196b00927..a002f4b6ae27 100644
--- a/oovbaapi/ooo/vba/excel/XGlobals.idl
+++ b/oovbaapi/ooo/vba/excel/XGlobals.idl
@@ -80,6 +80,7 @@ XRange Intersect([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3,
any Names( [in] any Index );
XRange Union([in] XRange Arg1, [in] XRange Arg2, [in] /*Optional*/ any Arg3, [in] /*Optional*/ any Arg4, [in] /*Optional*/ any Arg5, [in] /*Optional*/ any Arg6, [in] /*Optional*/ any Arg7, [in] /*Optional*/ any Arg8, [in] /*Optional*/ any Arg9, [in] /*Optional*/ any Arg10, [in] /*Optional*/ any Arg11, [in] /*Optional*/ any Arg12, [in] /*Optional*/ any Arg13, [in] /*Optional*/ any Arg14, [in] /*Optional*/ any Arg15, [in] /*Optional*/ any Arg16, [in] /*Optional*/ any Arg17, [in] /*Optional*/ any Arg18, [in] /*Optional*/ any Arg19, [in] /*Optional*/ any Arg20, [in] /*Optional*/ any Arg21, [in] /*Optional*/ any Arg22, [in] /*Optional*/ any Arg23, [in] /*Optional*/ any Arg24, [in] /*Optional*/ any Arg25, [in] /*Optional*/ any Arg26, [in] /*Optional*/ any Arg27, [in] /*Optional*/ any Arg28, [in] /*Optional*/ any Arg29, [in] /*Optional*/ any Arg30)
raises(com::sun::star::script::BasicErrorException);
+ any MenuBars( [in] any aIndex );
};
diff --git a/oovbaapi/ooo/vba/excel/XName.idl b/oovbaapi/ooo/vba/excel/XName.idl
index 554848803d92..3d23a45289c9 100644
--- a/oovbaapi/ooo/vba/excel/XName.idl
+++ b/oovbaapi/ooo/vba/excel/XName.idl
@@ -50,12 +50,12 @@ interface XName
[attribute] string Name;
[attribute] string NameLocal;
[attribute] boolean Visible;
- [attribute, readonly] string Value;
- [attribute, readonly] string RefersTo;
- [attribute, readonly] string RefersToLocal;
- [attribute, readonly] string RefersToR1C1;
- [attribute, readonly] string RefersToR1C1Local;
- [attribute, readonly] XRange RefersToRange;
+ [attribute] string Value;
+ [attribute, readonly] string RefersTo;
+ [attribute, readonly] string RefersToLocal;
+ [attribute, readonly] string RefersToR1C1;
+ [attribute, readonly] string RefersToR1C1Local;
+ [attribute, readonly] XRange RefersToRange;
void Delete( );
};
diff --git a/oovbaapi/ooo/vba/excel/XPageSetup.idl b/oovbaapi/ooo/vba/excel/XPageSetup.idl
index 3308e4b29b2b..4b526feecc5b 100644
--- a/oovbaapi/ooo/vba/excel/XPageSetup.idl
+++ b/oovbaapi/ooo/vba/excel/XPageSetup.idl
@@ -65,6 +65,7 @@ interface XPageSetup : com::sun::star::uno::XInterface
[attribute] boolean CenterVertically;
[attribute] boolean CenterHorizontally;
[attribute] boolean PrintHeadings;
+ [attribute] long PaperSize; //liuchen 2009-12-11
};
diff --git a/oovbaapi/ooo/vba/excel/XPivotCache.idl b/oovbaapi/ooo/vba/excel/XPivotCache.idl
index 52dd679e4d05..937ecf9a138e 100644
--- a/oovbaapi/ooo/vba/excel/XPivotCache.idl
+++ b/oovbaapi/ooo/vba/excel/XPivotCache.idl
@@ -45,6 +45,7 @@ interface XPivotCache
{
interface ::ooo::vba::XHelperInterface;
+ [attribute] long MissingItemsLimit;
void Refresh();
};
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index 3820911f2c96..4e01a5227062 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -42,6 +42,9 @@
#ifndef __com_sun_star_script_XDefaultMethod_idl__
#include <com/sun/star/script/XDefaultMethod.idl>
#endif
+#ifndef __com_sun_star_script_XErrorQuery_idl__
+#include <com/sun/star/script/XErrorQuery.idl>
+#endif
#ifndef __ooo_vba_XCollection_idl__
#include <ooo/vba/XCollection.idl>
#endif
@@ -69,14 +72,18 @@ interface XBorders;
interface XValidation;
interface XWorksheet;
+interface XPivotTable;
+interface XQueryTable;
interface XRange
{
interface com::sun::star::container::XEnumerationAccess;
interface com::sun::star::script::XDefaultMethod;
interface com::sun::star::script::XDefaultProperty;
+ interface com::sun::star::script::XErrorQuery;
interface ::ooo::vba::excel::XFormat;
//interface ::ooo::vba::XHelperInterface;
+ [attribute, readonly] any Name;
[attribute] any Value;
[attribute] any Formula;
[attribute] any FormulaArray;
@@ -102,6 +109,7 @@ interface XRange
[attribute] any Style;
[attribute] any AddIndent;
[attribute] any ShowDetail;
+ [attribute, readonly] XQueryTable QueryTable;
XComment AddComment( [in] any Text );
void Clear();
@@ -166,6 +174,11 @@ interface XRange
void Subtotal( [in] long GroupBy, [in] long Function, [in] /*Optional*/ sequence<long> TotalList, [in] /*Optional*/ any Replace, [in] /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
any Hyperlinks( [in] any aIndex );
+ long CopyFromRecordset([in] any Data, [in] any MaxRows , [in] any MaxColumns) raises ( com::sun::star::script::BasicErrorException );
+ XPivotTable PivotTable();
+ void TextToColumns([in] any Destination, [in] any DataType, [in] any TextQualifier, [in] any ConsecutiveDelimiter, [in] any Tab, [in] any Semicolon, [in] any Comma,
+ [in] any Space, [in] any Other, [in] any OtherChar, [in] any FieldInfo, [in] any DecimalSeparator, [in] any ThousandsSeparator, [in] any TrailingMinusNumbers );
+ any AdvancedFilter([in] long Action, [in] any CriteriaRange, [in] any CopyToRange, [in] any Unique) raises ( com::sun::star::script::BasicErrorException );
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/excel/XWorkbook.idl b/oovbaapi/ooo/vba/excel/XWorkbook.idl
index 0c42c6526035..ad9d02a445b4 100644
--- a/oovbaapi/ooo/vba/excel/XWorkbook.idl
+++ b/oovbaapi/ooo/vba/excel/XWorkbook.idl
@@ -50,6 +50,7 @@ interface XWorkbook : com::sun::star::uno::XInterface
[attribute, readonly] boolean ProtectStructure;
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] string CodeName;
+ [attribute, readonly] long FileFormat;
[attribute] boolean PrecisionAsDisplayed;
any Worksheets([in] any sheet);
@@ -60,8 +61,9 @@ interface XWorkbook : com::sun::star::uno::XInterface
void Activate();
any Names( [in] any Index );
any Colors([in] any Index) raises (com::sun::star::script::BasicErrorException);
- long FileFormat() raises (com::sun::star::script::BasicErrorException);
void SaveCopyAs( [in] string Filename );
+ void Protect( [in] any Password );
+ void SaveAs([in] string FileName, [in]any FileFormat, [in]any CreateBackup);
};
}; }; };
diff --git a/oovbaapi/ooo/vba/excel/XWorksheet.idl b/oovbaapi/ooo/vba/excel/XWorksheet.idl
index 3eb8337798d6..8b0aee057563 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -39,6 +39,7 @@
#include <com/sun/star/script/XInvocation.idl>
#endif
+
#ifndef __com_sun_star_container_XNamed_idl__
#include <com/sun/star/container/XNamed.idl>
#endif
@@ -60,7 +61,7 @@ interface XWorksheet
interface ::com::sun::star::script::XInvocation;
interface ::com::sun::star::container::XNamed;
- [attribute] boolean Visible;
+ [attribute] long Visible;
[attribute, readonly] long StandardHeight;
[attribute, readonly] long StandardWidth;
[attribute, readonly] boolean ProtectionMode;
@@ -77,7 +78,7 @@ interface XWorksheet
void Activate();
void Calculate( );
- void Select();
+ void Select([in] any Replace); //liuchen 2009-9-2, add the input parameter to support expand selection
void Move([in] any Before,[in] any After );
void Copy([in] any Before,[in] any After );
void Paste([in] any Destination,[in] any Link);
diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk
index 251588086701..1143311764da 100644
--- a/oovbaapi/ooo/vba/excel/makefile.mk
+++ b/oovbaapi/ooo/vba/excel/makefile.mk
@@ -102,7 +102,13 @@ IDLFILES= XGlobals.idl\
XVPageBreak.idl \
XVPageBreaks.idl \
TextFrame.idl \
-
+ XMenuBar.idl \
+ XMenuBars.idl \
+ XMenu.idl \
+ XMenus.idl \
+ XMenuItem.idl \
+ XMenuItems.idl \
+ XQueryTable.idl
# ------------------------------------------------------------------
diff --git a/oovbaapi/ooo/vba/makefile.mk b/oovbaapi/ooo/vba/makefile.mk
index 4f6d378cfe3f..ef77f773080d 100644
--- a/oovbaapi/ooo/vba/makefile.mk
+++ b/oovbaapi/ooo/vba/makefile.mk
@@ -61,7 +61,11 @@ IDLFILES=\
XFontBase.idl\
XDialogsBase.idl\
XDialogBase.idl\
- XPageSetupBase.idl
+ XPageSetupBase.idl \
+ XFileSearch.idl\
+ XFoundFiles.idl\
+ XFileDialog.idl \
+ XFileDialogSelectedItems.idl
# ------------------------------------------------------------------
.ENDIF
diff --git a/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
index 2eff91346e9d..c2ca0877ff96 100644
--- a/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
+++ b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
@@ -26,26 +26,14 @@
************************************************************************/
module msforms
{
- struct ReturnBoolean
- {
- boolean Value;
- };
-
struct ReturnEffect
{
//fmDropEffect Value;
short Value;
};
- struct ReturnInteger
- {
- long Value;
- };
-
struct ReturnSingle
{
float Value;
};
-
-
};
diff --git a/oovbaapi/ooo/vba/msforms/XComboBox.idl b/oovbaapi/ooo/vba/msforms/XComboBox.idl
index 5f2b66431eb8..d3285c7d78b0 100644
--- a/oovbaapi/ooo/vba/msforms/XComboBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XComboBox.idl
@@ -47,6 +47,7 @@ interface XComboBox: ::com::sun::star::uno::XInterface
void AddItem( [in] any pvargItem, [in] any pvargIndex );
void removeItem( [in] any index );
void Clear();
+ any List( [in] any pvargIndex, [in] any pvarColumn );
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl
index 97ca9d152716..3de8db1eb06c 100644
--- a/oovbaapi/ooo/vba/msforms/XControl.idl
+++ b/oovbaapi/ooo/vba/msforms/XControl.idl
@@ -63,6 +63,7 @@ interface XControl
[attribute] string Name;
[attribute] string ControlTipText;
[attribute] string Tag;
+ [attribute] long ForeColor;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XLabel.idl b/oovbaapi/ooo/vba/msforms/XLabel.idl
index d757af5074d8..476ac859b7aa 100644
--- a/oovbaapi/ooo/vba/msforms/XLabel.idl
+++ b/oovbaapi/ooo/vba/msforms/XLabel.idl
@@ -39,6 +39,7 @@ interface XLabel: com::sun::star::uno::XInterface
{
[attribute] string Caption;
[attribute] any Value;
+ [attribute] string Accelerator;
};
//=============================================================================
diff --git a/oovbaapi/ooo/vba/msforms/XListBox.idl b/oovbaapi/ooo/vba/msforms/XListBox.idl
index bdc0c6bfc660..48465f279a59 100644
--- a/oovbaapi/ooo/vba/msforms/XListBox.idl
+++ b/oovbaapi/ooo/vba/msforms/XListBox.idl
@@ -40,7 +40,7 @@ interface XListBox: com::sun::star::uno::XInterface
{
[attribute] any Value;
[attribute] string Text;
- [attribute] boolean MultiSelect;
+ [attribute] long MultiSelect; //liuchen 2009-7-31 MultiSelect property in Excel VBA is type long
[attribute] any ListIndex;
[attribute, readonly ] long ListCount;
void AddItem( [in] any pvargItem, [in] any pvargIndex );
diff --git a/oovbaapi/ooo/vba/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl
index 3dc7c4a071af..b31dab7a1d91 100644
--- a/oovbaapi/ooo/vba/msforms/XShape.idl
+++ b/oovbaapi/ooo/vba/msforms/XShape.idl
@@ -75,6 +75,7 @@ interface XShape : ooo::vba::XHelperInterface
void ScaleHeight( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
void ScaleWidth( [in] double Factor, [in] boolean RelativeToOriginalSize, [in] long Scale );
any ShapeRange( [in] any index ); // only here for convience
+ void Copy();
};
}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/XShapeRange.idl b/oovbaapi/ooo/vba/msforms/XShapeRange.idl
index 0cbc5f0b6d8a..0e5e2b5a039d 100644
--- a/oovbaapi/ooo/vba/msforms/XShapeRange.idl
+++ b/oovbaapi/ooo/vba/msforms/XShapeRange.idl
@@ -47,6 +47,7 @@ interface XShapeRange
{
interface ooo::vba::XCollection;
+ [attribute] string Name;
[attribute] double Height;
[attribute] double Width;
[attribute] double Left;
@@ -65,6 +66,7 @@ interface XShapeRange
void IncrementRotation( [in] double Increment );
void IncrementLeft( [in] double Increment );
void IncrementTop( [in] double Increment );
+ void ZOrder( [in] long ZOrderCmd );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/msforms/makefile.mk b/oovbaapi/ooo/vba/msforms/makefile.mk
index 56ac4caf87cb..79313a95a6d6 100644
--- a/oovbaapi/ooo/vba/msforms/makefile.mk
+++ b/oovbaapi/ooo/vba/msforms/makefile.mk
@@ -44,6 +44,7 @@ IDLFILES=\
XLabel.idl \
XTextBox.idl \
XRadioButton.idl \
+ XCheckBox.idl \
XShape.idl \
XShapes.idl \
XLineFormat.idl \
@@ -62,6 +63,8 @@ IDLFILES=\
XSpinButton.idl \
XImage.idl \
XControls.idl \
+ XReturnBoolean.idl \
+ XReturnInteger.idl \
XTextFrame.idl \
# ------------------------------------------------------------------
diff --git a/oovbaapi/ooo/vba/word/XApplication.idl b/oovbaapi/ooo/vba/word/XApplication.idl
index 228401c986e6..267bf3bbdb05 100644
--- a/oovbaapi/ooo/vba/word/XApplication.idl
+++ b/oovbaapi/ooo/vba/word/XApplication.idl
@@ -57,6 +57,7 @@ interface XApplication : com::sun::star::uno::XInterface
any Documents( [in] any aIndex );
any Addins( [in] any aIndex );
any Dialogs( [in] any aIndex );
+ any ListGalleries( [in] any aIndex );
float CentimetersToPoints([in] float Centimeters );
};
diff --git a/oovbaapi/ooo/vba/word/XDocument.idl b/oovbaapi/ooo/vba/word/XDocument.idl
index 0f124e2701d1..57a7165525ba 100644
--- a/oovbaapi/ooo/vba/word/XDocument.idl
+++ b/oovbaapi/ooo/vba/word/XDocument.idl
@@ -49,6 +49,11 @@ interface XDocument : com::sun::star::script::XInvocation
{
[attribute, readonly] XRange Content;
[attribute] any AttachedTemplate;
+ [attribute] long ProtectionType;
+ [attribute] boolean UpdateStylesOnOpen;
+ [attribute] boolean AutoHyphenation;
+ [attribute] long HyphenationZone;
+ [attribute] long ConsecutiveHyphensLimit;
XRange Range( [in] any Start, [in] any End );
any BuiltInDocumentProperties( [in] any index );
@@ -63,6 +68,14 @@ interface XDocument : com::sun::star::script::XInvocation
any Sections([in] any Index);
void Activate();
any PageSetup();
+ any TablesOfContents([in] any Index);
+ any FormFields([in] any Index);
+ void Protect( [in] long Type, [in] any NOReset, [in] any Password, [in] any UseIRM, [in] any EnforceStyleLock );
+ void PrintOut([in] any Background, [in] any Append, [in] any Range, [in] any OutputFileName, [in] any From, [in] any To, [in] any Item, [in] any Copies, [in] any Pages, [in] any PageType, [in] any PrintToFile, [in] any Collate, [in] any FileName, [in] any ActivePrinterMacGX, [in] any ManualDuplexPrint, [in] any PrintZoomColumn, [in] any PrintZoomRow, [in] any PrintZoomPaperWidth, [in] any PrintZoomPaperHeight);
+ void PrintPreview();
+ void ClosePrintPreview();
+ any Revisions( [in] any index );
+ any Frames( [in] any index );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XField.idl b/oovbaapi/ooo/vba/word/XField.idl
index 9109079e59cd..4f8738c9891e 100644
--- a/oovbaapi/ooo/vba/word/XField.idl
+++ b/oovbaapi/ooo/vba/word/XField.idl
@@ -36,6 +36,8 @@ module ooo { module vba { module word {
interface XField
{
interface ::ooo::vba::XHelperInterface;
+
+ boolean Update();
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl
index 4d92ca378b05..2ccbaf2dfd40 100644
--- a/oovbaapi/ooo/vba/word/XGlobals.idl
+++ b/oovbaapi/ooo/vba/word/XGlobals.idl
@@ -49,6 +49,7 @@ interface XGlobals : com::sun::star::uno::XInterface
any Documents( [in] any aIndex );
any Addins( [in] any aIndex );
any Dialogs( [in] any aIndex );
+ any ListGalleries( [in] any aIndex );
float CentimetersToPoints([in] float Centimeters );
};
diff --git a/oovbaapi/ooo/vba/word/XParagraph.idl b/oovbaapi/ooo/vba/word/XParagraph.idl
index 6c59b9d39530..370578e8aaf8 100644
--- a/oovbaapi/ooo/vba/word/XParagraph.idl
+++ b/oovbaapi/ooo/vba/word/XParagraph.idl
@@ -43,6 +43,7 @@ interface XParagraph
interface ooo::vba::XHelperInterface;
[attribute, readonly] XRange Range;
+ [attribute] any Style;
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XRange.idl b/oovbaapi/ooo/vba/word/XRange.idl
index b7d53e7c8174..9f013631c6f8 100644
--- a/oovbaapi/ooo/vba/word/XRange.idl
+++ b/oovbaapi/ooo/vba/word/XRange.idl
@@ -45,13 +45,14 @@ module ooo { module vba { module word {
interface XParagraphFormat;
interface XStyle;
interface XFont;
+interface XListFormat;
interface XRange
{
interface ooo::vba::XHelperInterface;
[attribute] string Text;
[attribute] XParagraphFormat ParagraphFormat;
- [attribute] XStyle Style;
+ [attribute] any Style;
[attribute,readonly] ::com::sun::star::text::XTextRange XTextRange;
// Of course Font is NOT readonly, #FIXME #TODO
// readonly though will force an error attempting to write
@@ -59,6 +60,7 @@ interface XRange
[attribute] long LanguageID;
[attribute] long Start;
[attribute] long End;
+ [attribute, readonly] XListFormat ListFormat;
void InsertBreak( [in] any Type );
void Select();
@@ -66,6 +68,10 @@ interface XRange
void InsertParagraphBefore();
void InsertParagraphAfter();
any PageSetup();
+ boolean InRange( [in] XRange Range );
+ any Revisions( [in] any index );
+ any Sections( [in] any index );
+ any Fields( [in] any index );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XReplacement.idl b/oovbaapi/ooo/vba/word/XReplacement.idl
index 6fff3b049f23..8e249118cba8 100644
--- a/oovbaapi/ooo/vba/word/XReplacement.idl
+++ b/oovbaapi/ooo/vba/word/XReplacement.idl
@@ -42,6 +42,8 @@ interface XReplacement
interface ooo::vba::XHelperInterface;
[attribute] string Text;
+
+ void ClearFormatting();
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XSection.idl b/oovbaapi/ooo/vba/word/XSection.idl
index c84f70f830bf..9d1dc7b2044e 100644
--- a/oovbaapi/ooo/vba/word/XSection.idl
+++ b/oovbaapi/ooo/vba/word/XSection.idl
@@ -43,8 +43,8 @@ interface XSection
[attribute] boolean ProtectedForForms;
- any Headers();
- any Footers();
+ any Headers( [in] any aIndex );
+ any Footers( [in] any aIndex );
any PageSetup();
};
diff --git a/oovbaapi/ooo/vba/word/XSelection.idl b/oovbaapi/ooo/vba/word/XSelection.idl
index daea47bcc625..91b43bb25390 100644
--- a/oovbaapi/ooo/vba/word/XSelection.idl
+++ b/oovbaapi/ooo/vba/word/XSelection.idl
@@ -52,7 +52,7 @@ interface XSelection
[attribute, readonly] XRange Range;
[attribute] XParagraphFormat ParagraphFormat;
[attribute, readonly] XFind Find;
- [attribute] XStyle Style;
+ [attribute] any Style;
[attribute, readonly] XFont Font;
[attribute, readonly] XHeaderFooter HeaderFooter;
[attribute] long LanguageID;
@@ -68,6 +68,7 @@ interface XSelection
void MoveRight( [in] any Unit, [in] any Count, [in] any Extend );
void MoveLeft( [in] any Unit, [in] any Count, [in] any Extend );
void MoveDown( [in] any Unit, [in] any Count, [in] any Extend );
+ void MoveUp( [in] any Unit, [in] any Count, [in] any Extend );
void TypeParagraph();
void InsertParagraph();
void InsertParagraphBefore();
@@ -77,6 +78,19 @@ interface XSelection
any Information( [in] long Type );
void InsertBreak( [in] any Type );
any ShapeRange();
+ void SelectColumn();
+ void SelectRow();
+ any Rows( [in] any aIndex );
+ any Columns( [in] any aIndex );
+ any Cells( [in] any aIndex );
+ void Copy();
+ void CopyAsPicture();
+ void Paste();
+ void Collapse([in] any Direction);
+ void WholeStory();
+ boolean InRange( [in] XRange Range );
+ void SplitTable();
+ any Paragraphs( [in] any aIndex );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XStyle.idl b/oovbaapi/ooo/vba/word/XStyle.idl
index 5d341e366dd1..c6ee248b5437 100644
--- a/oovbaapi/ooo/vba/word/XStyle.idl
+++ b/oovbaapi/ooo/vba/word/XStyle.idl
@@ -35,17 +35,32 @@
#include <ooo/vba/XHelperInterface.idl>
#endif
+#ifndef __com_sun_star_script_XDefaultProperty_idl__
+#include <com/sun/star/script/XDefaultProperty.idl>
+#endif
+
module ooo { module vba { module word {
interface XFont;
+interface XListTemplate;
+interface XParagraphFormat;
interface XStyle
{
interface ooo::vba::XHelperInterface;
+ interface com::sun::star::script::XDefaultProperty;
[attribute] string Name;
[attribute] long LanguageID;
[attribute, readonly] long Type;
[attribute, readonly] XFont Font;
+ [attribute] string NameLocal;
+ [attribute, readonly] XParagraphFormat ParagraphFormat;
+ [attribute] boolean AutomaticallyUpdate;
+ [attribute] any BaseStyle;
+ [attribute] any NextParagraphStyle;
+ [attribute, readonly] long ListLevelNumber;
+
+ void LinkToListTemplate( [in] XListTemplate ListTemplate, [in] any ListLevelNumber );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XTable.idl b/oovbaapi/ooo/vba/word/XTable.idl
index ab985cbb6599..1d21c4db50c3 100644
--- a/oovbaapi/ooo/vba/word/XTable.idl
+++ b/oovbaapi/ooo/vba/word/XTable.idl
@@ -70,6 +70,8 @@ interface XTable
*/
any Borders( [in] any aIndex );
+ any Rows([in] any aIndex );
+ any Columns([in] any aIndex );
};
}; }; };
diff --git a/oovbaapi/ooo/vba/word/XTemplate.idl b/oovbaapi/ooo/vba/word/XTemplate.idl
index b0fda20e45a1..7bb291fc4eca 100644
--- a/oovbaapi/ooo/vba/word/XTemplate.idl
+++ b/oovbaapi/ooo/vba/word/XTemplate.idl
@@ -42,6 +42,7 @@ interface XTemplate
interface ooo::vba::XHelperInterface;
[attribute, readonly] string Name;
+ [attribute, readonly] string Path;
any AutoTextEntries( [in] any aIndex );
};
diff --git a/oovbaapi/ooo/vba/word/XWindow.idl b/oovbaapi/ooo/vba/word/XWindow.idl
index e8dfdbdcc653..282e756ef99b 100644
--- a/oovbaapi/ooo/vba/word/XWindow.idl
+++ b/oovbaapi/ooo/vba/word/XWindow.idl
@@ -44,6 +44,7 @@ module ooo { module vba { module word {
interface XWindow : com::sun::star::uno::XInterface
{
[attribute] any View;
+ [attribute] any WindowState;
void Activate();
void Close([in] any SaveChanges, [in] any RouteDocument);
any Panes( [in] any aIndex ); // this is a fake api for it seems not support in Write
diff --git a/oovbaapi/ooo/vba/word/makefile.mk b/oovbaapi/ooo/vba/word/makefile.mk
index 543e99f7c538..04b36d1d274e 100644
--- a/oovbaapi/ooo/vba/word/makefile.mk
+++ b/oovbaapi/ooo/vba/word/makefile.mk
@@ -79,6 +79,31 @@ IDLFILES= XGlobals.idl\
XPageSetup.idl \
XSection.idl \
XSections.idl \
+ XRow.idl \
+ XRows.idl \
+ XColumn.idl \
+ XColumns.idl \
+ XCell.idl \
+ XCells.idl \
+ XTabStop.idl \
+ XTabStops.idl \
+ XTableOfContents.idl \
+ XTablesOfContents.idl \
+ XListFormat.idl \
+ XListGalleries.idl \
+ XListGallery.idl \
+ XListTemplate.idl \
+ XListTemplates.idl \
+ XListLevel.idl \
+ XListLevels.idl \
+ XFormField.idl \
+ XFormFields.idl \
+ XRevision.idl \
+ XRevisions.idl \
+ XFrame.idl \
+ XFrames.idl \
+ XCheckBox.idl \
+ XHeadersFooters.idl \
# ------------------------------------------------------------------
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index 69cc6f40cd3d..67dc30be676f 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -371,7 +371,33 @@ namespace basprov
::rtl::OUString::createFromAscii( "location" ) );
sal_Int32 nIndex = 0;
- ::rtl::OUString aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
+ // In some strange circumstances the Library name can have an
+ // apparantly illegal '.' in it ( in imported VBA )
+
+ BasicManager* pBasicMgr = NULL;
+ if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
+ {
+ pBasicMgr = m_pDocBasicManager;
+ }
+ else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
+ {
+ pBasicMgr = m_pAppBasicManager;
+ }
+ rtl::OUString sProjectName;
+ if ( pBasicMgr )
+ sProjectName = pBasicMgr->GetName();
+
+ ::rtl::OUString aLibrary;
+ if ( sProjectName.getLength() && aDescription.match( sProjectName ) )
+ {
+ OSL_TRACE("LibraryName %s is part of the url %s",
+ rtl::OUStringToOString( sProjectName, RTL_TEXTENCODING_UTF8 ).getStr(),
+ rtl::OUStringToOString( aDescription, RTL_TEXTENCODING_UTF8 ).getStr() );
+ aLibrary = sProjectName;
+ nIndex = sProjectName.getLength() + 1;
+ }
+ else
+ aLibrary = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
::rtl::OUString aModule;
if ( nIndex != -1 )
aModule = aDescription.getToken( 0, (sal_Unicode)'.', nIndex );
@@ -381,15 +407,6 @@ namespace basprov
if ( aLibrary.getLength() != 0 && aModule.getLength() != 0 && aMethod.getLength() != 0 && aLocation.getLength() != 0 )
{
- BasicManager* pBasicMgr = NULL;
- if ( aLocation.equals( ::rtl::OUString::createFromAscii("document") ) )
- {
- pBasicMgr = m_pDocBasicManager;
- }
- else if ( aLocation.equals( ::rtl::OUString::createFromAscii("application") ) )
- {
- pBasicMgr = m_pAppBasicManager;
- }
if ( pBasicMgr )
{
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx
index c6de155e3ed0..ca0b22d6c2c1 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -36,7 +36,10 @@
#include <basic/sbmeth.hxx>
#include <basic/basmgr.hxx>
#include <com/sun/star/script/provider/ScriptFrameworkErrorType.hpp>
-
+#include "bcholder.hxx"
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <map>
@@ -45,6 +48,7 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::script;
using namespace ::com::sun::star::document;
+using namespace ::com::sun::star::beans;
extern ::com::sun::star::uno::Any sbxToUnoValue( SbxVariable* pVar );
extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any& aValue );
@@ -54,6 +58,10 @@ extern void unoToSbxValue( SbxVariable* pVar, const ::com::sun::star::uno::Any&
namespace basprov
{
//.........................................................................
+#define BASSCRIPT_PROPERTY_ID_CALLER 1
+#define BASSCRIPT_PROPERTY_CALLER ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Caller" ) )
+
+#define BASSCRIPT_DEFAULT_ATTRIBS() PropertyAttribute::BOUND | PropertyAttribute::TRANSIENT
typedef ::std::map< sal_Int16, Any, ::std::less< sal_Int16 > > OutParamMap;
@@ -64,22 +72,28 @@ namespace basprov
// -----------------------------------------------------------------------------
BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod )
- :m_xMethod( xMethod )
+ : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
+ ,OPropertyContainer( GetBroadcastHelper() )
+ ,m_xMethod( xMethod )
,m_funcName( funcName )
,m_documentBasicManager( NULL )
,m_xDocumentScriptContext()
{
+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
}
// -----------------------------------------------------------------------------
BasicScriptImpl::BasicScriptImpl( const ::rtl::OUString& funcName, SbMethodRef xMethod,
- BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext )
- :m_xMethod( xMethod )
+ BasicManager& documentBasicManager, const Reference< XScriptInvocationContext >& documentScriptContext ) : ::scripting_helper::OBroadcastHelperHolder( m_aMutex )
+ ,OPropertyContainer( GetBroadcastHelper() )
+ ,m_xMethod( xMethod )
,m_funcName( funcName )
,m_documentBasicManager( &documentBasicManager )
,m_xDocumentScriptContext( documentScriptContext )
{
+ //
+ registerProperty( BASSCRIPT_PROPERTY_CALLER, BASSCRIPT_PROPERTY_ID_CALLER, BASSCRIPT_DEFAULT_ATTRIBS(), &m_caller, ::getCppuType( &m_caller ) );
}
// -----------------------------------------------------------------------------
@@ -88,6 +102,48 @@ namespace basprov
}
// -----------------------------------------------------------------------------
+ // XInterface
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XINTERFACE2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
+
+ // -----------------------------------------------------------------------------
+ // XTypeProvider
+ // -----------------------------------------------------------------------------
+
+ IMPLEMENT_FORWARD_XTYPEPROVIDER2( BasicScriptImpl, BasicScriptImpl_BASE, OPropertyContainer )
+
+ // -----------------------------------------------------------------------------
+ // OPropertySetHelper
+ // -----------------------------------------------------------------------------
+
+ ::cppu::IPropertyArrayHelper& BasicScriptImpl::getInfoHelper( )
+ {
+ return *getArrayHelper();
+ }
+
+ // -----------------------------------------------------------------------------
+ // OPropertyArrayUsageHelper
+ // -----------------------------------------------------------------------------
+
+ ::cppu::IPropertyArrayHelper* BasicScriptImpl::createArrayHelper( ) const
+ {
+ Sequence< Property > aProps;
+ describeProperties( aProps );
+ return new ::cppu::OPropertyArrayHelper( aProps );
+ }
+
+ // -----------------------------------------------------------------------------
+ // XPropertySet
+ // -----------------------------------------------------------------------------
+
+ Reference< XPropertySetInfo > BasicScriptImpl::getPropertySetInfo( ) throw (RuntimeException)
+ {
+ Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
+ return xInfo;
+ }
+
+ // -----------------------------------------------------------------------------
// XScript
// -----------------------------------------------------------------------------
@@ -166,8 +222,14 @@ namespace basprov
if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
aOldThisComponent = m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", makeAny( m_xDocumentScriptContext ) );
+ if ( m_caller.getLength() && m_caller[ 0 ].hasValue() )
+ {
+ SbxVariableRef xCallerVar = new SbxVariable( SbxVARIANT );
+ unoToSbxValue( static_cast< SbxVariable* >( xCallerVar ), m_caller[ 0 ] );
+ nErr = m_xMethod->Call( xReturn, xCallerVar );
+ }
+ else
nErr = m_xMethod->Call( xReturn );
-
if ( m_documentBasicManager && m_xDocumentScriptContext.is() )
m_documentBasicManager->SetGlobalUNOConstant( "ThisComponent", aOldThisComponent );
}
diff --git a/scripting/source/basprov/basscript.hxx b/scripting/source/basprov/basscript.hxx
index 4a3d6f1ab61d..177ceeacdea8 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -28,12 +28,14 @@
#ifndef SCRIPTING_BASSCRIPT_HXX
#define SCRIPTING_BASSCRIPT_HXX
+#include "bcholder.hxx"
#include <com/sun/star/script/provider/XScript.hpp>
#include <com/sun/star/document/XScriptInvocationContext.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <comphelper/proparrhlp.hxx>
+#include <comphelper/propertycontainer.hxx>
#include <basic/sbmeth.hxx>
-
class BasicManager;
//.........................................................................
@@ -49,7 +51,11 @@ namespace basprov
::com::sun::star::script::provider::XScript > BasicScriptImpl_BASE;
- class BasicScriptImpl : public BasicScriptImpl_BASE
+ class BasicScriptImpl : public BasicScriptImpl_BASE,
+ public ::scripting_helper::OMutexHolder,
+ public ::scripting_helper::OBroadcastHelperHolder,
+ public ::comphelper::OPropertyContainer,
+ public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
{
private:
SbMethodRef m_xMethod;
@@ -57,6 +63,16 @@ namespace basprov
BasicManager* m_documentBasicManager;
::com::sun::star::uno::Reference< ::com::sun::star::document::XScriptInvocationContext >
m_xDocumentScriptContext;
+ // hack, OPropertyContainer doesn't allow you to define a property of unknown
+ // type ( I guess because an Any can't contain an Any... I've always wondered why?
+ // as its not unusual to do that in corba )
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_caller;
+ protected:
+ // OPropertySetHelper
+ virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( );
+
+ // OPropertyArrayUsageHelper
+ virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
public:
BasicScriptImpl(
@@ -71,6 +87,12 @@ namespace basprov
);
virtual ~BasicScriptImpl();
+ // XInterface
+ DECLARE_XINTERFACE()
+
+ // XTypeProvider
+ DECLARE_XTYPEPROVIDER()
+
// XScript
virtual ::com::sun::star::uno::Any SAL_CALL invoke(
const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aParams,
@@ -80,6 +102,9 @@ namespace basprov
::com::sun::star::script::provider::ScriptFrameworkErrorException,
::com::sun::star::reflection::InvocationTargetException,
::com::sun::star::uno::RuntimeException );
+ // XPropertySet
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( )
+ throw (::com::sun::star::uno::RuntimeException);
};
//.........................................................................
diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx
index 6c3694ea237d..79b1ab43d667 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -108,13 +108,14 @@ namespace dlgprov
{
protected:
rtl::OUString msDialogCodeName;
+ rtl::OUString msDialogLibName;
Reference< script::XScriptListener > mxListener;
virtual void firing_impl( const script::ScriptEvent& aScriptEvent, uno::Any* pRet );
public:
- DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel );
+ DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName );
};
- DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel ) : DialogScriptListenerImpl( rxContext )
+ DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const rtl::OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName )
{
Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
Sequence< Any > args(1);
@@ -145,7 +146,7 @@ namespace dlgprov
if ( aScriptEvent.ScriptType.equals( rtl::OUString::createFromAscii("VBAInterop") ) && mxListener.is() )
{
ScriptEvent aScriptEventCopy( aScriptEvent );
- aScriptEventCopy.ScriptCode = msDialogCodeName;
+ aScriptEventCopy.ScriptCode = msDialogLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( msDialogCodeName );
try
{
mxListener->firing( aScriptEventCopy );
@@ -163,7 +164,7 @@ namespace dlgprov
// DialogEventsAttacherImpl
// =============================================================================
- DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener )
+ DialogEventsAttacherImpl::DialogEventsAttacherImpl( const Reference< XComponentContext >& rxContext, const Reference< frame::XModel >& rxModel, const Reference< awt::XControl >& rxControl, const Reference< XInterface >& rxHandler, const Reference< beans::XIntrospectionAccess >& rxIntrospect, bool bProviderMode, const Reference< script::XScriptListener >& rxRTLListener, const rtl::OUString& sDialogLibName )
:mbUseFakeVBAEvents( false ), m_xContext( rxContext )
{
// key listeners by protocol when ScriptType = 'Script'
@@ -186,11 +187,11 @@ namespace dlgprov
{
pFoundShell = reinterpret_cast<SfxObjectShell*>( xObjShellTunnel->getSomething(SfxObjectShell::getUnoTunnelId()));
if ( pFoundShell )
- mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell );
+ mbUseFakeVBAEvents = ooo::vba::isAlienExcelDoc( *pFoundShell ) || ooo::vba::isAlienWordDoc( *pFoundShell ) ;
}
}
if ( mbUseFakeVBAEvents )
- listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel );
+ listernersForTypes[ rtl::OUString::createFromAscii("VBAInterop") ] = new DialogVBAScriptListenerImpl( rxContext, rxControl, rxModel, sDialogLibName );
}
// -----------------------------------------------------------------------------
@@ -217,6 +218,7 @@ namespace dlgprov
Reference< ooo::vba::XVBAToOOEventDescGen > xVBAToOOEvtDesc( xSMgr->createInstanceWithContext( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.VBAToOOEventDesc" ) ), m_xContext ), UNO_QUERY );
if ( xVBAToOOEvtDesc.is() )
xEventsSupplier.set( xVBAToOOEvtDesc->getEventSupplier( xControl, sControlName ), UNO_QUERY );
+
}
return xEventsSupplier;
}
@@ -409,7 +411,7 @@ namespace dlgprov
void DialogAllListenerImpl::firing( const AllEventObject& Event ) throw ( RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ //::osl::MutexGuard aGuard( getMutex() );
firing_impl( Event, NULL );
}
@@ -419,7 +421,7 @@ namespace dlgprov
Any DialogAllListenerImpl::approveFiring( const AllEventObject& Event )
throw ( reflection::InvocationTargetException, RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ //::osl::MutexGuard aGuard( getMutex() );
Any aReturn;
firing_impl( Event, &aReturn );
@@ -655,7 +657,7 @@ namespace dlgprov
void DialogScriptListenerImpl::firing( const ScriptEvent& aScriptEvent ) throw ( RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ //::osl::MutexGuard aGuard( getMutex() );
firing_impl( aScriptEvent, NULL );
}
@@ -665,7 +667,7 @@ namespace dlgprov
Any DialogScriptListenerImpl::approveFiring( const ScriptEvent& aScriptEvent )
throw ( reflection::InvocationTargetException, RuntimeException )
{
- ::osl::MutexGuard aGuard( getMutex() );
+ //::osl::MutexGuard aGuard( getMutex() );
Any aReturn;
firing_impl( aScriptEvent, &aReturn );
diff --git a/scripting/source/dlgprov/dlgevtatt.hxx b/scripting/source/dlgprov/dlgevtatt.hxx
index 85b0bfcd087d..9ce55a170ae3 100644
--- a/scripting/source/dlgprov/dlgevtatt.hxx
+++ b/scripting/source/dlgprov/dlgevtatt.hxx
@@ -78,7 +78,7 @@ namespace dlgprov
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& xIntrospect,
bool bProviderMode,
- const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::script::XScriptListener >& xRTLListener ,const rtl::OUString& sDialogLibName );
virtual ~DialogEventsAttacherImpl();
// XScriptEventsAttacher
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 0fc0778c71d9..a87263af75d0 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -189,7 +189,15 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Reference< beans::XPropertySet > xDlgPropSet( xDialogModel, UNO_QUERY );
xDlgPropSet->setPropertyValue( aDlgSrcUrlPropName, aDialogSourceURL );
- ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext );
+ // #TODO we really need to detect the source of the Dialog, is it
+ // located in the document or not. m_xModel need not be the location of
+ // the dialog. E.g. if the dialog was created from basic ( then we just
+ // can't tell where its from )
+ // If we are happy to always substitute the form model for the awt
+ // one then maybe the presence of a document model is enough to trigger
+ // swapping out the models ( or perhaps we only want to do this
+ // for vba mode ) there are a number of feasible and valid possibilities
+ ::xmlscript::importDialogModel( xInput, xDialogModel, m_xContext, m_xModel );
// Set resource property
if( xStringResourceManager.is() )
{
@@ -403,6 +411,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
if ( xISP.is() )
xInput = xISP->createInputStream();
+ msDialogLibName = sLibName;
}
// import dialog model
@@ -520,7 +529,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
const Reference< XControl >& rxControl,
const Reference< XInterface >& rxHandler,
const Reference< XIntrospectionAccess >& rxIntrospectionAccess,
- bool bDialogProviderMode )
+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName )
{
if ( rxControl.is() )
{
@@ -544,7 +553,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
+ bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ), msDialogLibName );
Any aHelper;
xScriptEventsAttacher->attachEvents( aObjects, Reference< XScriptListener >(), aHelper );
@@ -649,7 +658,10 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
aArguments[0] >>= m_xModel;
m_BasicInfo.reset( new BasicRTLParams() );
m_BasicInfo->mxInput.set( aArguments[ 1 ], UNO_QUERY_THROW );
- m_BasicInfo->mxDlgLib.set( aArguments[ 2 ], UNO_QUERY_THROW );
+ // allow null mxDlgLib, a document dialog instantiated from
+ // from application basic is unable to provide ( or find ) it's
+ // Library
+ aArguments[ 2 ] >>= m_BasicInfo->mxDlgLib;
// leave the possibility to optionally allow the old dialog creation
// to use the new XScriptListener ( which converts the old style macro
// to a SF url )
@@ -733,7 +745,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
{
//xDialog = Reference< XDialog >( xCtrl, UNO_QUERY );
Reference< XIntrospectionAccess > xIntrospectionAccess = inspectHandler( xHandler );
- attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode );
+ attachControlEvents( xCtrl, xHandler, xIntrospectionAccess, bDialogProviderMode, msDialogLibName );
}
}
diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx
index bc15831d2ff1..c1e77b917388 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -81,7 +81,7 @@ namespace dlgprov
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
-
+ rtl::OUString msDialogLibName;
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModel( const ::rtl::OUString& sURL );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
@@ -91,7 +91,7 @@ namespace dlgprov
void attachControlEvents( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl >& rxControlContainer,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler,
const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess >& rxIntrospectionAccess,
- bool bDialogProviderMode );
+ bool bDialogProviderMode, const rtl::OUString& );
::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& rxHandler );
// helper methods
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 838d89d49c89..631fa6901c67 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -46,12 +46,17 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/XCloseListener.hpp>
+#include <com/sun/star/util/XCloseBroadcaster.hpp>
+
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/script/XLibraryContainer.hpp>
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/script/provider/XScriptProviderSupplier.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/XControl.hpp>
@@ -62,8 +67,9 @@
#include <com/sun/star/awt/XTextComponent.hpp> //liuchen 2009-6-5
#include <com/sun/star/awt/XComboBox.hpp> //liuchen 2009-6-18
#include <com/sun/star/awt/XRadioButton.hpp> //liuchen 2009-7-30
+#include <com/sun/star/awt/XListBox.hpp>
-#include <msforms/ReturnInteger.hpp>
+#include "vbamsformreturntypes.hxx"
#include <sfx2/objsh.hxx>
#include <basic/sbstar.hxx>
@@ -71,6 +77,7 @@
#include <basic/sbmeth.hxx>
#include <basic/sbmod.hxx>
#include <basic/sbx.hxx>
+#include <filter/msfilter/msvbahelper.hxx>
@@ -82,12 +89,21 @@
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
#include <com/sun/star/script/XScriptListener.hpp>
#include <cppuhelper/implbase1.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <cppuhelper/implbase2.hxx>
#include <comphelper/evtmethodhelper.hxx>
#include <set>
#include <list>
#include <hash_map>
+#define ASYNC 0
+
+// primitive support for asynchronous handling of
+// events from controls ( all event will be processed asynchronously
+// in the application thread )
+#if ASYNC
+#include <vcl/svapp.hxx>
+#endif
using namespace ::com::sun::star;
using namespace ::com::sun::star::script;
@@ -189,6 +205,14 @@ bool isMouseEventOk( awt::MouseEvent& evt, const Sequence< Any >& params )
return true;
}
+bool isFocusEventOk( awt::FocusEvent& evt, const Sequence< Any >& params )
+{
+ if ( !( params.getLength() > 0 ) ||
+ !( params[ 0 ] >>= evt ) )
+ return false;
+ return true;
+}
+
Sequence< Any > ooMouseEvtToVBADblClick( const Sequence< Any >& params )
{
Sequence< Any > translatedParams;
@@ -232,9 +256,14 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
translatedParams.realloc(1);
- msforms::ReturnInteger keyCode;
- keyCode.Value = evt.KeyCode;
- translatedParams[0] <<= keyCode;
+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
+ //So the newly defined VbaReturnIntege class is used here to support default value.
+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
+ pKeyCode->Value = evt.KeyChar;
+ ::uno::Reference< msforms::XReturnInteger > xInteger =
+ static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
+ translatedParams[0] <<= xInteger;
return translatedParams;
}
@@ -248,16 +277,38 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
translatedParams.realloc(2);
- msforms::ReturnInteger keyCode;
- sal_Int8 shift = sal::static_int_cast<sal_Int8>( evt.Modifiers );
+ //The VBA events such as ComboBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger) may cause an error because
+ //the original input parameter data structure -- msforms::ReturnInteger -- is a struct, it cannot support default value.
+ //So the newly defined VbaReturnIntege class is used here to support default value.
+ VbaReturnInteger* pKeyCode = new VbaReturnInteger();
+ sal_Int8 shift = evt.Modifiers;
- // #TODO check whether values from OOO conform to values generated from vba
- keyCode.Value = evt.KeyCode;
- translatedParams[0] <<= keyCode;
+ pKeyCode->Value = evt.KeyChar;
+ ::uno::Reference< msforms::XReturnInteger > xInteger = static_cast< ::uno::Reference< msforms::XReturnInteger > > (pKeyCode);
+ translatedParams[0] <<= xInteger;
translatedParams[1] <<= shift;
return translatedParams;
}
+Sequence< Any > ooFocusLostToVBAExit( const Sequence< Any >& params )
+{
+ Sequence< Any > translatedParams;
+ awt::FocusEvent evt;
+
+ if ( !isFocusEventOk( evt, params ) )
+ return Sequence< Any >();
+
+ translatedParams.realloc(1);
+
+ VbaReturnBoolean* pCancel = new VbaReturnBoolean();
+
+ ::uno::Reference< msforms::XReturnBoolean > xBoolean=
+ static_cast< ::uno::Reference< msforms::XReturnBoolean > > (pCancel);
+ translatedParams[0] <<= xBoolean;
+ return translatedParams;
+}
+
+
typedef Sequence< Any > (*Translator)(const Sequence< Any >&);
//liuchen 2009-6-23
@@ -287,6 +338,7 @@ bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of contr
bool ApproveType(const ScriptEvent& evt, void* pPara); //certain types of controls should execute the event, those types are given by pPara
bool DenyType(const ScriptEvent& evt, void* pPara); //certain types of controls should not execute the event, those types are given by pPara
bool DenyMouseDrag(const ScriptEvent& evt, void* pPara); //used for VBA MouseMove event when "Shift" key is pressed
+bool DenyKeys(const ScriptEvent& evt, void* pPara); //For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
struct TypeList
{
@@ -294,28 +346,30 @@ struct TypeList
int nListLength;
};
-Type typeXFixedText = GET_TYPE(awt::XFixedText)
-Type typeXTextComponent = GET_TYPE(awt::XTextComponent)
-Type typeXComboBox = GET_TYPE(awt::XComboBox)
-Type typeXRadioButton = GET_TYPE(awt::XRadioButton)
+Type typeXFixedText = GET_TYPE(awt::XFixedText);
+Type typeXTextComponent = GET_TYPE(awt::XTextComponent);
+Type typeXComboBox = GET_TYPE(awt::XComboBox);
+Type typeXRadioButton = GET_TYPE(awt::XRadioButton);
+Type typeXListBox = GET_TYPE(awt::XListBox);
TypeList fixedTextList = {&typeXFixedText, 1};
TypeList textCompList = {&typeXTextComponent, 1};
TypeList radioButtonList = {&typeXRadioButton, 1};
TypeList comboBoxList = {&typeXComboBox, 1};
+TypeList listBoxList = {&typeXListBox, 1};
//this array stores the OO event to VBA event translation info
static TranslatePropMap aTranslatePropMap_Impl[] =
{
+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
// actionPerformed ooo event
{ MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
- { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Change"), NULL, DenyType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event is not the same as OptionalButton_Click event
-
+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
// itemStateChanged ooo event
{ MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&comboBoxList) } }, //liuchen, add to support VBA ComboBox_Click event
- { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Change"), NULL, ApproveType, (void*)(&radioButtonList) } }, //liuchen 2009-7-30, OptionalButton_Change event should be triggered when the button state is changed
+ { MAP_CHAR_LEN("itemStateChanged"), { MAP_CHAR_LEN("_Click"), NULL, ApproveType, (void*)(&listBoxList) } },
// changed ooo event
{ MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
@@ -324,7 +378,7 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
// focusLost ooo event
{ MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_LostFocus"), NULL, ApproveAll, NULL } },
- { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), NULL, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
+ { MAP_CHAR_LEN("focusLost"), { MAP_CHAR_LEN("_Exit"), ooFocusLostToVBAExit, ApproveType, (void*)(&textCompList) } }, //liuchen, add to support VBA TextBox_Exit event
// adjustmentValueChanged ooo event
{ MAP_CHAR_LEN("adjustmentValueChanged"), { MAP_CHAR_LEN("_Scroll"), NULL, ApproveAll, NULL } },
@@ -349,8 +403,8 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
{ MAP_CHAR_LEN("mouseDragged"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, DenyMouseDrag, NULL } }, //liuchen, add to support VBA MouseMove event when the "Shift" key is pressed
// keyPressed ooo event
- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } },
- { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyPressed, ApproveAll, NULL } }
+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyDown"), ooKeyPressedToVBAKeyUpDown, ApproveAll, NULL } },
+ { MAP_CHAR_LEN("keyPressed"), { MAP_CHAR_LEN("_KeyPress"), ooKeyPressedToVBAKeyUpDown, DenyKeys, NULL } }
};
EventInfoHash& getEventTransInfo()
@@ -632,7 +686,7 @@ private:
Reference< container::XNameContainer > m_xNameContainer;
};
-typedef ::cppu::WeakImplHelper2< XScriptListener, lang::XInitialization > EventListener_BASE;
+typedef ::cppu::WeakImplHelper3< XScriptListener, util::XCloseListener, lang::XInitialization > EventListener_BASE;
#define EVENTLSTNR_PROPERTY_ID_MODEL 1
#define EVENTLSTNR_PROPERTY_MODEL ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) )
@@ -653,6 +707,9 @@ public:
// XScriptListener
virtual void SAL_CALL firing(const ScriptEvent& evt) throw(RuntimeException);
virtual Any SAL_CALL approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException);
+ // XCloseListener
+ virtual void SAL_CALL queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException);
+ virtual void SAL_CALL notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException);
// XPropertySet
virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
// XInitialization
@@ -664,6 +721,25 @@ public:
DECLARE_XTYPEPROVIDER()
virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) throw(::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
+ if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
+ {
+ uno::Reference< frame::XModel > xModel( rValue, uno::UNO_QUERY );
+ if( xModel != m_xModel)
+ {
+ // Remove the listener from the old XCloseBroadcaster.
+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
+ if (xCloseBroadcaster.is())
+ {
+ xCloseBroadcaster->removeCloseListener( this );
+ }
+ // Add the listener into the new XCloseBroadcaster.
+ xCloseBroadcaster = uno::Reference< util::XCloseBroadcaster >( xModel, uno::UNO_QUERY );
+ if (xCloseBroadcaster.is())
+ {
+ xCloseBroadcaster->addCloseListener( this );
+ }
+ }
+ }
OPropertyContainer::setFastPropertyValue( nHandle, rValue );
if ( nHandle == EVENTLSTNR_PROPERTY_ID_MODEL )
setShellFromModel();
@@ -677,17 +753,21 @@ protected:
virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
private:
+#if ASYNC
+ DECL_LINK( OnAsyncScriptEvent, ScriptEvent* );
+#endif
void setShellFromModel();
void firing_Impl( const ScriptEvent& evt, Any *pSyncRet=NULL ) throw( RuntimeException );
Reference< XComponentContext > m_xContext;
Reference< frame::XModel > m_xModel;
SfxObjectShell* mpShell;
+ sal_Bool m_bDocClosed;
};
EventListener::EventListener( const Reference< XComponentContext >& rxContext ) :
-OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), mpShell( 0 )
+OPropertyContainer(GetBroadcastHelper()), m_xContext( rxContext ), m_bDocClosed(sal_False), mpShell( 0 )
{
registerProperty( EVENTLSTNR_PROPERTY_MODEL, EVENTLSTNR_PROPERTY_ID_MODEL,
beans::PropertyAttribute::TRANSIENT, &m_xModel, ::getCppuType( &m_xModel ) );
@@ -722,9 +802,39 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
void SAL_CALL
EventListener::firing(const ScriptEvent& evt) throw(RuntimeException)
{
+#if ASYNC
+ // needs some logic to check if the event handler is oneway or not
+ // if not oneway then firing_Impl otherwise... as below
+ acquire();
+ Application::PostUserEvent( LINK( this, EventListener, OnAsyncScriptEvent ), new ScriptEvent( evt ) );
+#else
firing_Impl( evt );
+#endif
}
+#if ASYNC
+IMPL_LINK( EventListener, OnAsyncScriptEvent, ScriptEvent*, _pEvent )
+{
+ if ( !_pEvent )
+ return 1L;
+
+ {
+ // #FIXME if we enable ASYNC we probably need something like
+ // below
+ //::osl::ClearableMutexGuard aGuard( m_aMutex );
+
+ //if ( !impl_isDisposed_nothrow() )
+ // impl_doFireScriptEvent_nothrow( aGuard, *_pEvent, NULL );
+ firing_Impl( *_pEvent, NULL );
+ }
+
+ delete _pEvent;
+ // we acquired ourself immediately before posting the event
+ release();
+ return 0L;
+ }
+#endif
+
Any SAL_CALL
EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::InvocationTargetException, RuntimeException)
{
@@ -733,6 +843,24 @@ EventListener::approveFiring(const ScriptEvent& evt) throw(reflection::Invocatio
return ret;
}
+// XCloseListener
+void SAL_CALL
+EventListener::queryClosing( const lang::EventObject& Source, ::sal_Bool GetsOwnership ) throw (util::CloseVetoException, uno::RuntimeException)
+{
+ //Nothing to do
+}
+
+void SAL_CALL
+EventListener::notifyClosing( const lang::EventObject& Source ) throw (uno::RuntimeException)
+{
+ m_bDocClosed = sal_True;
+ uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xModel, uno::UNO_QUERY );
+ if (xCloseBroadcaster.is())
+ {
+ xCloseBroadcaster->removeCloseListener( this );
+ }
+}
+
// XInitialization
void SAL_CALL
EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
@@ -835,13 +963,28 @@ bool DenyMouseDrag(const ScriptEvent& evt, void* )
}
}
+//For some keys, press them will cause Symphony keyPressed event, but will not cause any events in Excel, so deny these key events
+bool DenyKeys(const ScriptEvent& evt, void* /*pPara*/)
+{
+ awt::KeyEvent aEvent;
+ evt.Arguments[ 0 ] >>= aEvent;
+ if (aEvent.KeyChar == 0 || aEvent.KeyChar == 8)
+ {
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+}
+
//liuchen 2009-6-23
// EventListener
void
-EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(RuntimeException)
+EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) throw(RuntimeException)
{
OSL_TRACE("EventListener::firing_Impl( FAKE VBA_EVENTS )");
static const ::rtl::OUString vbaInterOp =
@@ -852,18 +995,46 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
return;
lang::EventObject aEvent;
evt.Arguments[ 0 ] >>= aEvent;
+ OSL_TRACE("evt.MethodName is %s", rtl::OUStringToOString( evt.MethodName, RTL_TEXTENCODING_UTF8 ).getStr() );
OSL_TRACE("Argument[0] is %s", rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[0] ), RTL_TEXTENCODING_UTF8 ).getStr() );
OSL_TRACE("Getting Control");
- uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY_THROW );
- OSL_TRACE("Getting properties");
- uno::Reference< beans::XPropertySet > xProps( xControl->getModel(), uno::UNO_QUERY_THROW );
-
rtl::OUString sName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("UserForm") );
OSL_TRACE("Getting Name");
uno::Reference< awt::XDialog > xDlg( aEvent.Source, uno::UNO_QUERY );
if ( !xDlg.is() )
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
+ {
+ OSL_TRACE("Getting Control");
+ // evt.Source is
+ // a) Dialog
+ // b) xShapeControl ( from api (sheet control) )
+ // c) eventmanager ( I guess )
+ // d) vba control ( from api also )
+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, uno::UNO_QUERY );
+ uno::Reference< awt::XControl > xControl( aEvent.Source, uno::UNO_QUERY );
+ if ( xCntrlShape.is() )
+ {
+ // for sheet controls ( that fire from the api ) we don't
+ // have the real control ( thats only available from the view )
+ // api code creates just a control instance that is transferred
+ // via aEvent.Arguments[ 0 ] that control though has no
+ // info like name etc.
+ uno::Reference< drawing::XControlShape > xCntrlShape( evt.Source, UNO_QUERY_THROW );
+ OSL_TRACE("Got control shape");
+ uno::Reference< container::XNamed > xName( xCntrlShape->getControl(), uno::UNO_QUERY_THROW );
+ OSL_TRACE("Got xnamed ");
+ sName = xName->getName();
+ }
+ else
+ {
+ // Userform control ( fired from the api or from event manager )
+ uno::Reference< beans::XPropertySet > xProps;
+ OSL_TRACE("Getting properties");
+ xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sName;
+ }
+
+ }
//dumpEvent( evt );
EventInfoHash& infos = getEventTransInfo();
EventInfoHash::const_iterator eventInfo_it = infos.find( evt.MethodName );
@@ -885,20 +1056,49 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
std::list< TranslateInfo >::const_iterator txInfo =
eventInfo_it->second.begin();
std::list< TranslateInfo >::const_iterator txInfo_end = eventInfo_it->second.end();
- rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Standard.").concat( evt.ScriptCode ).concat( rtl::OUString::createFromAscii(".") );
StarBASIC* pBasic = mpShell->GetBasic();
- SbModule* pModule = pBasic->FindModule( evt.ScriptCode );
- for ( ; pModule && txInfo != txInfo_end; ++txInfo )
+ BasicManager* pBasicManager = mpShell->GetBasicManager();
+ rtl::OUString sProject;
+ rtl::OUString sScriptCode( evt.ScriptCode );
+ // dialogs pass their own library, presence of Dot determines that
+ if ( sScriptCode.indexOf( '.' ) == -1 )
+ {
+ //'Project' is a better default but I want to force failures
+ //rtl::OUString sMacroLoc = rtl::OUString::createFromAscii("Project");
+ sProject = rtl::OUString::createFromAscii("Standard");
+
+ if ( pBasicManager->GetName().Len() > 0 )
+ sProject = pBasicManager->GetName();
+ }
+ else
+ {
+ sal_Int32 nIndex = sScriptCode.indexOf( '.' );
+ sProject = sScriptCode.copy( 0, nIndex );
+ sScriptCode = sScriptCode.copy( nIndex + 1 );
+ }
+ rtl::OUString sMacroLoc = sProject;
+ sMacroLoc = sMacroLoc.concat( rtl::OUString::createFromAscii(".") );
+ sMacroLoc = sMacroLoc.concat( sScriptCode ).concat( rtl::OUString::createFromAscii(".") );
+
+ OSL_TRACE("sMacroLoc is %s", rtl::OUStringToOString( sMacroLoc, RTL_TEXTENCODING_UTF8 ).getStr() );
+ for ( ; txInfo != txInfo_end; ++txInfo )
{
+ // If the document is closed, we should not execute macro.
+ if (m_bDocClosed)
+ {
+ break;
+ }
+
+ rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
// see if we have a match for the handlerextension
// where ScriptCode is methodname_handlerextension
- rtl::OUString sTemp = sName.concat( (*txInfo).sVBAName );
+ rtl::OUString sToResolve = sMacroLoc.concat( sTemp );
OSL_TRACE("*** trying to invoke %s ",
- rtl::OUStringToOString( sTemp, RTL_TEXTENCODING_UTF8 ).getStr() );
- SbMethod* pMeth = static_cast< SbMethod* >( pModule->Find( sTemp, SbxCLASS_METHOD ) );
- if ( pMeth )
+ rtl::OUStringToOString( sToResolve, RTL_TEXTENCODING_UTF8 ).getStr() );
+ ooo::vba::VBAMacroResolvedInfo aMacroResolvedInfo = ooo::vba::resolveVBAMacro( mpShell, sToResolve );
+ if ( aMacroResolvedInfo.IsResolved() )
{
//liuchen 2009-6-8
if (! txInfo->ApproveRule(evt, txInfo->pPara) )
@@ -916,24 +1116,21 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
{
// call basic event handlers for event
- static rtl::OUString part1 = rtl::OUString::createFromAscii( "vnd.sun.star.script:");
- static rtl::OUString part2 = rtl::OUString::createFromAscii("?language=Basic&location=document");
-
// create script url
- rtl::OUString url = part1 + sMacroLoc + sTemp + part2;
+ rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
- OSL_TRACE("script url = %s",
+ OSL_TRACE("resolved script = %s",
rtl::OUStringToOString( url,
RTL_TEXTENCODING_UTF8 ).getStr() );
- Sequence< sal_Int16 > aOutArgsIndex;
- Sequence< Any > aOutArgs;
try
{
- if ( mpShell )
+ uno::Any aDummyCaller = uno::makeAny( rtl::OUString::createFromAscii("Error") );
+ if ( pRet )
+ ooo::vba::executeMacro( mpShell, url, aArguments, *pRet, aDummyCaller );
+ else
{
uno::Any aRet;
- mpShell->CallXScript( url,
- aArguments, aRet, aOutArgsIndex, aOutArgs, false );
+ ooo::vba::executeMacro( mpShell, url, aArguments, aRet, aDummyCaller );
}
}
catch ( uno::Exception& e )
diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk
index 1946c61d1e0b..a36789805a9e 100644
--- a/scripting/source/vbaevents/makefile.mk
+++ b/scripting/source/vbaevents/makefile.mk
@@ -69,6 +69,7 @@ SHL1STDLIBS= \
$(BASICLIB) \
$(COMPHELPERLIB) \
$(SFXLIB) \
+ $(MSFILTERLIB) \
$(CPPULIB) \
$(TOOLSLIB) \
$(SALLIB)
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index 9473ac126bd7..8d3639e00e6a 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -404,8 +404,8 @@ public:
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
- bool bRaiseError = true
- );
+ bool bRaiseError = true,
+ const ::com::sun::star::uno::Any* aCaller = 0 );
static ErrCode CallXScript(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
@@ -414,7 +414,8 @@ public:
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam,
- bool bRaiseError = true
+ bool bRaiseError = true,
+ const ::com::sun::star::uno::Any* aCaller = 0
);
/** adjusts the internal macro mode, according to the current security settings
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index 5daac0b91ae2..9dc9ac94e354 100755
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -399,8 +399,10 @@
#define MID_DOCINFO_ENCRYPTED 0x2c
#define MID_DOCINFO_STATISTIC 0x33
#define MID_DOCINFO_CHARLOCALE 0x34
-
-#define MID_LAST_USED_PROPID MID_DOCINFO_CHARLOCALE
+#define MID_CATEGORY 0x35
+#define MID_COMPANY 0x36
+#define MID_MANAGER 0x37
+#define MID_LAST_USED_PROPID MID_MANAGER
// Config-Ids -----------------------------------------------------------
diff --git a/sfx2/inc/sfx2/sfxbasemodel.hxx b/sfx2/inc/sfx2/sfxbasemodel.hxx
index 578dd1fd33bb..5039f2deb3f4 100644
--- a/sfx2/inc/sfx2/sfxbasemodel.hxx
+++ b/sfx2/inc/sfx2/sfxbasemodel.hxx
@@ -1505,6 +1505,7 @@ protected:
/* returns true if the document signatures are valid, otherwise false */
sal_Bool hasValidSignatures() const;
+ void setDocumentProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::document::XDocumentProperties >& );
//________________________________________________________________________________________________________
// private methods
//________________________________________________________________________________________________________
diff --git a/sfx2/inc/sfx2/sfxsids.hrc b/sfx2/inc/sfx2/sfxsids.hrc
index 901717c63169..43a4b021efa5 100644
--- a/sfx2/inc/sfx2/sfxsids.hrc
+++ b/sfx2/inc/sfx2/sfxsids.hrc
@@ -75,6 +75,7 @@
#define SID_VERSION_VISIBLE (SID_SFX_START + 313)
#define SID_PASTE_UNFORMATTED (SID_SFX_START + 314)
+#define SID_DIALOG_RETURN (SID_SFX_START + 318)
#define SID_PRINTER_NOTFOUND_WARN (SID_SFX_START + 320)
#define SID_PRINTER_USETHREAD (SID_SFX_START + 321)
#define SID_PRINTER_NAME (SID_SFX_START + 322)
diff --git a/sfx2/source/appl/app.cxx b/sfx2/source/appl/app.cxx
index 6e13894feb49..2a1f66bca3b9 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -749,7 +749,7 @@ IMPL_LINK( SfxApplication, GlobalBasicErrorHdl_Impl, StarBASIC*, pStarBasic )
basicide_handle_basic_error pSymbol = (basicide_handle_basic_error) osl_getFunctionSymbol( handleMod, aSymbol.pData );
// call basicide_handle_basic_error in basctl
- long nRet = pSymbol( pStarBasic );
+ long nRet = pSymbol ? pSymbol( pStarBasic ) : 0;
return nRet;
}
diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx
index 6f9d3b258745..67f20835b16d 100755
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -2281,6 +2281,16 @@ SFX2_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo(
xNewKey = xKey->createKey( aTempStr );
xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.document.DocumentProperties") );
+
+ // writer compatable document properties
+ aImpl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/"));
+ aImpl += comp_CompatWriterDocProps::_getImplementationName();
+
+ aTempStr = aImpl;
+ aTempStr += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("/UNO/SERVICES"));
+ xNewKey = xKey->createKey( aTempStr );
+ xNewKey->createKey( ::rtl::OUString::createFromAscii("com.sun.star.writer.DocumentProperties") );
+
return sal_True;
}
@@ -2340,6 +2350,16 @@ SFX2_DLLPUBLIC void* SAL_CALL component_getFactory(
::comp_SfxDocumentMetaData::_getImplementationName(),
::comp_SfxDocumentMetaData::_getSupportedServiceNames());
}
+ if ( ::comp_CompatWriterDocProps::_getImplementationName().equals(
+ ::rtl::OUString::createFromAscii( pImplementationName ) ) )
+ {
+ xFactory = ::cppu::createSingleComponentFactory(
+ ::comp_CompatWriterDocProps::_create,
+ ::comp_CompatWriterDocProps::_getImplementationName(),
+ ::comp_CompatWriterDocProps::_getSupportedServiceNames());
+ }
+
+ // Factory is valid - service was found.
// Factory is valid - service was found.
if ( xFactory.is() )
diff --git a/sfx2/source/control/unoctitm.cxx b/sfx2/source/control/unoctitm.cxx
index e53f1766b7b9..6b4dac5cdb18 100644
--- a/sfx2/source/control/unoctitm.cxx
+++ b/sfx2/source/control/unoctitm.cxx
@@ -702,6 +702,7 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
// Filter arguments which shouldn't be part of the sequence property value
sal_Bool bTemp = sal_Bool();
sal_uInt16 nModifier(0);
+ sal_Bool bVBARequest = sal_False;
std::vector< ::com::sun::star::beans::PropertyValue > aAddArgs;
for( sal_Int32 n=0; n<nCount; n++ )
{
@@ -718,6 +719,10 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
}
else if( rProp.Name.equalsAsciiL("KeyModifier",11))
rProp.Value >>= nModifier;
+ else if( rProp.Name.equalsAsciiL("VBADialogResultRequest",22) )
+ {
+ rProp.Value >>= bVBARequest;
+ }
else
aAddArgs.push_back( aArgs[n] );
}
@@ -801,6 +806,14 @@ void SAL_CALL SfxDispatchController_Impl::dispatch( const ::com::sun::star::util
pItem = aReq.GetReturnValue();
bSuccess = aReq.IsDone() || pItem != NULL;
bFailure = aReq.IsCancelled();
+ if ( bVBARequest )
+ {
+ SFX_REQUEST_ARG( aReq, pItem, SfxBoolItem, SID_DIALOG_RETURN, FALSE );
+ if ( pItem )
+ {
+ bSuccess = pItem->GetValue();
+ }
+ }
}
}
#ifdef DBG_UTIL
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 14474dd2904d..0b7944064482 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -87,6 +87,10 @@
#include <cstring>
#include <limits>
+
+#include <cppuhelper/implbase1.hxx>
+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
+
/**
* This file contains the implementation of the service
* com.sun.star.document.DocumentProperties.
@@ -292,12 +296,12 @@ public:
const css::uno::Sequence< css::beans::StringPair >& i_rNamespaces)
throw (css::uno::RuntimeException, css::xml::sax::SAXException);
-private:
+protected:
SfxDocumentMetaData(SfxDocumentMetaData &); // not defined
SfxDocumentMetaData& operator =(SfxDocumentMetaData &); // not defined
virtual ~SfxDocumentMetaData() {}
-
+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new SfxDocumentMetaData( context ); };
const css::uno::Reference< css::uno::XComponentContext > m_xContext;
/// for notification
@@ -372,6 +376,54 @@ private:
void createUserDefined();
};
+typedef ::cppu::ImplInheritanceHelper1< SfxDocumentMetaData, css::document::XCompatWriterDocProperties > CompatWriterDocPropsImpl_BASE;
+
+class CompatWriterDocPropsImpl : public CompatWriterDocPropsImpl_BASE
+{
+ rtl::OUString msManager;
+ rtl::OUString msCategory;
+ rtl::OUString msCompany;
+protected:
+ virtual SfxDocumentMetaData* createMe( css::uno::Reference< css::uno::XComponentContext > const & context ) { return new CompatWriterDocPropsImpl( context ); };
+public:
+ CompatWriterDocPropsImpl( css::uno::Reference< css::uno::XComponentContext > const & context) : CompatWriterDocPropsImpl_BASE( context ) {}
+// XCompatWriterDocPropsImpl
+ virtual ::rtl::OUString SAL_CALL getManager() throw (::com::sun::star::uno::RuntimeException) { return msManager; }
+ virtual void SAL_CALL setManager( const ::rtl::OUString& _manager ) throw (::com::sun::star::uno::RuntimeException) { msManager = _manager; }
+ virtual ::rtl::OUString SAL_CALL getCategory() throw (::com::sun::star::uno::RuntimeException){ return msCategory; }
+ virtual void SAL_CALL setCategory( const ::rtl::OUString& _category ) throw (::com::sun::star::uno::RuntimeException){ msCategory = _category; }
+ virtual ::rtl::OUString SAL_CALL getCompany() throw (::com::sun::star::uno::RuntimeException){ return msCompany; }
+ virtual void SAL_CALL setCompany( const ::rtl::OUString& _company ) throw (::com::sun::star::uno::RuntimeException){ msCompany = _company; }
+
+// XServiceInfo
+ virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return comp_CompatWriterDocProps::_getImplementationName();
+ }
+
+ virtual ::sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ css::uno::Sequence< rtl::OUString > sServiceNames= getSupportedServiceNames();
+ sal_Int32 nLen = sServiceNames.getLength();
+ rtl::OUString* pIt = sServiceNames.getArray();
+ rtl::OUString* pEnd = ( pIt + nLen );
+ sal_Bool bRes = sal_False;
+ for ( ; pIt != pEnd; ++pIt )
+ {
+ if ( pIt->equals( ServiceName ) )
+ {
+ bRes = sal_True;
+ break;
+ }
+ }
+ return bRes;
+ }
+
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw (::com::sun::star::uno::RuntimeException)
+ {
+ return comp_CompatWriterDocProps::_getSupportedServiceNames();
+ }
+};
////////////////////////////////////////////////////////////////////////////
bool operator== (const css::util::DateTime &i_rLeft,
@@ -2156,7 +2208,7 @@ SfxDocumentMetaData::createClone()
::osl::MutexGuard g(m_aMutex);
checkInit();
- SfxDocumentMetaData *pNew = new SfxDocumentMetaData(m_xContext);
+ SfxDocumentMetaData *pNew = createMe(m_xContext);
// NB: do not copy the modification listeners, only DOM
css::uno::Reference<css::xml::dom::XDocument> xDoc = createDOM();
@@ -2334,6 +2386,32 @@ void SfxDocumentMetaData::createUserDefined()
// component helper namespace
+namespace comp_CompatWriterDocProps {
+
+ ::rtl::OUString SAL_CALL _getImplementationName() {
+ return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
+ "CompatWriterDocPropsImpl"));
+}
+
+ css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
+ {
+ static css::uno::Sequence< rtl::OUString > aServiceNames;
+ if ( aServiceNames.getLength() == 0 )
+ {
+ aServiceNames.realloc( 1 );
+ aServiceNames[ 0 ] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.writer.DocumentProperties" ) );
+ }
+ return aServiceNames;
+ }
+ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
+ const css::uno::Reference< css::uno::XComponentContext > & context)
+ SAL_THROW((css::uno::Exception))
+ {
+ return static_cast< ::cppu::OWeakObject * >
+ (new CompatWriterDocPropsImpl(context));
+ }
+
+}
namespace comp_SfxDocumentMetaData {
::rtl::OUString SAL_CALL _getImplementationName() {
diff --git a/sfx2/source/doc/docinf.cxx b/sfx2/source/doc/docinf.cxx
index d0f6678d8641..3c7db55d2e6a 100644
--- a/sfx2/source/doc/docinf.cxx
+++ b/sfx2/source/doc/docinf.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyContainer.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
#include <com/sun/star/uno/Exception.hpp>
#include <rtl/ustring.hxx>
@@ -43,7 +44,6 @@
#include <vcl/gdimtf.hxx>
#include "oleprops.hxx"
-
// ============================================================================
// stream names
@@ -172,6 +172,28 @@ sal_uInt32 SFX2_DLLPUBLIC LoadOlePropertySet(
}
}
+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( i_xDocProps, uno::UNO_QUERY );
+ if ( xWriterProps.is() )
+ {
+ SfxOleSectionRef xBuiltin = aDocSet.GetSection( SECTION_BUILTIN );
+ if ( xBuiltin.get() )
+ {
+ try
+ {
+ String aStrValue;
+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_MANAGER ) )
+ xWriterProps->setManager( aStrValue );
+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_CATEGORY ) )
+ xWriterProps->setCategory( aStrValue );
+ if ( xBuiltin->GetStringValue( aStrValue, PROPID_COMPANY ) )
+ xWriterProps->setCompany( aStrValue );
+ }
+ catch ( uno::Exception& )
+ {
+ }
+ }
+ }
+
// return code
return (nGlobError != ERRCODE_NONE) ? nGlobError : nDocError;
}
diff --git a/sfx2/source/doc/docmacromode.cxx b/sfx2/source/doc/docmacromode.cxx
index 249ebbaf02ab..e542377c477e 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -38,6 +38,8 @@
#include <com/sun/star/task/DocumentMacroConfirmationRequest.hpp>
#include <com/sun/star/task/InteractionClassification.hpp>
#include <com/sun/star/security/XDocumentDigitalSignatures.hpp>
+#include <com/sun/star/script/XLibraryQueryExecutable.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
/** === end UNO includes === **/
#include <comphelper/componentcontext.hxx>
@@ -73,8 +75,11 @@ namespace sfx2
using ::com::sun::star::document::XEmbeddedScripts;
using ::com::sun::star::uno::UNO_SET_THROW;
using ::com::sun::star::script::XLibraryContainer;
+ using ::com::sun::star::script::XLibraryQueryExecutable;
+ using ::com::sun::star::script::vba::XVBACompatibility;
using ::com::sun::star::container::XNameAccess;
using ::com::sun::star::uno::UNO_QUERY_THROW;
+ using ::com::sun::star::uno::UNO_QUERY;
/** === end UNO using === **/
namespace MacroExecMode = ::com::sun::star::document::MacroExecMode;
@@ -336,6 +341,8 @@ namespace sfx2
if ( xScripts.is() )
xContainer.set( xScripts->getBasicLibraries(), UNO_QUERY_THROW );
+ Reference< XVBACompatibility > xDocVBAMode( xContainer, UNO_QUERY );
+ sal_Bool bIsVBAMode = ( xDocVBAMode.is() && xDocVBAMode->getVBACompatibilityMode() );
if ( xContainer.is() )
{
// a library container exists; check if it's empty
@@ -350,23 +357,46 @@ namespace sfx2
Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
if ( aElements.getLength() )
{
- if ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) )
+ // old check, if more than 1 library or the first library isn't the expected 'Standard'
+ // trigger the security 'nag' dialog
+ if ( !bIsVBAMode && ( aElements.getLength() > 1 || !aElements[0].equals( aStdLibName ) ) )
bHasMacroLib = sal_True;
else
{
- // usually a "Standard" library is always present (design)
- // for this reason we must check if it's empty
- //
- // Note: Since #i73229#, this is not true anymore. There's no default
- // "Standard" lib anymore. Wouldn't it be time to get completely
- // rid of the "Standard" thingie - this shouldn't be necessary
- // anymore, should it?
- // 2007-01-25 / frank.schoenheit@sun.com
- Reference < XNameAccess > xLib;
- Any aAny = xContainer->getByName( aStdLibName );
- aAny >>= xLib;
+ // other wise just check all libraries for executeable code
+ Reference< XLibraryQueryExecutable > xLib( xContainer, UNO_QUERY );
if ( xLib.is() )
- bHasMacroLib = xLib->hasElements();
+ {
+ Sequence< ::rtl::OUString > aElements = xContainer->getElementNames();
+ sal_Int32 nElementCount = aElements.getLength();
+ const ::rtl::OUString* pElementName = aElements.getConstArray();
+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
+ {
+ bHasMacroLib = xLib->HasExecutableCode( pElementName[index] );
+ if ( bHasMacroLib )
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ if ( bIsVBAMode && !bHasMacroLib && xScripts.is() )
+ {
+ Reference< XLibraryContainer > xDlgContainer( xScripts->getDialogLibraries(), UNO_QUERY );
+ if ( xDlgContainer.is() && xDlgContainer->hasElements() )
+ {
+ Sequence< ::rtl::OUString > aElements = xDlgContainer->getElementNames();
+ sal_Int32 nElementCount = aElements.getLength();
+ const ::rtl::OUString* pElementName = aElements.getConstArray();
+ for ( sal_Int32 index = 0; index < nElementCount; index++ )
+ {
+ Reference< XNameAccess > xNameAccess;
+ xDlgContainer->getByName( pElementName[index] ) >>= xNameAccess;
+ if ( xNameAccess.is() && xNameAccess->hasElements() )
+ {
+ bHasMacroLib = sal_True;
+ break;
}
}
}
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index e386b2382acf..8437c1426f5b 100755
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1710,7 +1710,7 @@ namespace
}
ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptContext, const ::rtl::OUString& _rScriptURL,
- const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError )
+ const Sequence< Any >& aParams, Any& aRet, Sequence< sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
{
OSL_TRACE( "in CallXScript" );
ErrCode nErr = ERRCODE_NONE;
@@ -1741,7 +1741,16 @@ ErrCode SfxObjectShell::CallXScript( const Reference< XInterface >& _rxScriptCon
// obtain the script, and execute it
Reference< provider::XScript > xScript( xScriptProvider->getScript( _rScriptURL ), UNO_QUERY_THROW );
-
+ if ( pCaller && pCaller->hasValue() )
+ {
+ Reference< beans::XPropertySet > xProps( xScript, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ Sequence< uno::Any > aArgs( 1 );
+ aArgs[ 0 ] = *pCaller;
+ xProps->setPropertyValue( rtl::OUString::createFromAscii("Caller"), uno::makeAny( aArgs ) );
+ }
+ }
aRet = xScript->invoke( aParams, aOutParamIndex, aOutParam );
}
catch ( const uno::Exception& )
@@ -1774,10 +1783,10 @@ ErrCode SfxObjectShell::CallXScript( const String& rScriptURL,
aParams,
::com::sun::star::uno::Any& aRet,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam
- , bool bRaiseError )
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >&
+ aOutParam, bool bRaiseError, const ::com::sun::star::uno::Any* pCaller )
{
- return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError );
+ return CallXScript( GetModel(), rScriptURL, aParams, aRet, aOutParamIndex, aOutParam, bRaiseError, pCaller );
}
//-------------------------------------------------------------------------
diff --git a/sfx2/source/doc/objuno.cxx b/sfx2/source/doc/objuno.cxx
index 466f8dd43104..cb4f9f35fb77 100644
--- a/sfx2/source/doc/objuno.cxx
+++ b/sfx2/source/doc/objuno.cxx
@@ -45,6 +45,7 @@
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
+#include <com/sun/star/document/XCompatWriterDocProperties.hpp>
#include <unotools/configmgr.hxx>
#include <tools/inetdef.hxx>
@@ -104,6 +105,9 @@ const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
{ "AutoloadEnabled" , 15, MID_DOCINFO_AUTOLOADENABLED, &::getBooleanCppuType(), PROPERTY_UNBOUND, 0 },
{ "AutoloadSecs" , 12, MID_DOCINFO_AUTOLOADSECS, &::getCppuType((const sal_Int32*)0), PROPERTY_UNBOUND, 0 },
{ "AutoloadURL" , 11, MID_DOCINFO_AUTOLOADURL, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
+ { "Category" , 8 , MID_CATEGORY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
+ { "Company" , 7 , MID_COMPANY, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
+ { "Manager" , 7 , MID_MANAGER, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "CreationDate" , 12, WID_DATE_CREATED, &::getCppuType((const ::com::sun::star::util::DateTime*)0),PROPERTY_MAYBEVOID, 0 },
{ "DefaultTarget" , 13, MID_DOCINFO_DEFAULTTARGET, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
{ "Description" , 11, MID_DOCINFO_DESCRIPTION, &::getCppuType((const ::rtl::OUString*)0), PROPERTY_UNBOUND, 0 },
@@ -807,6 +811,22 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
_pImp->m_xDocProps->setDefaultTarget(sTemp);
break;
// case WID_CONTENT_TYPE : // this is readonly!
+ case MID_CATEGORY:
+ case MID_MANAGER:
+ case MID_COMPANY:
+ {
+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
+ if ( xWriterProps.is() )
+ {
+ if ( nHandle == MID_CATEGORY )
+ xWriterProps->setCategory( sTemp );
+ else if ( nHandle == MID_MANAGER )
+ xWriterProps->setManager( sTemp );
+ else
+ xWriterProps->setCompany( sTemp );
+ break;
+ }
+ }
default:
break;
}
@@ -1024,6 +1044,23 @@ void SAL_CALL SfxDocumentInfoObject::setFastPropertyValue(sal_Int32 nHandle, co
case MID_DOCINFO_CHARLOCALE:
aValue <<= _pImp->m_xDocProps->getLanguage();
break;
+ case MID_CATEGORY:
+ case MID_MANAGER:
+ case MID_COMPANY:
+ {
+ uno::Reference< document::XCompatWriterDocProperties > xWriterProps( _pImp->m_xDocProps, uno::UNO_QUERY );
+ if ( xWriterProps.is() )
+ {
+ if ( nHandle == MID_CATEGORY )
+ aValue <<= xWriterProps->getCategory();
+ else if ( nHandle == MID_MANAGER )
+ aValue <<= xWriterProps->getManager();
+ else
+ aValue <<= xWriterProps->getCompany();
+ break;
+ }
+ }
+
default:
aValue <<= ::rtl::OUString();
break;
diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx
index b7567b89f02f..dc8be0c0e764 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -134,6 +134,40 @@ DBG_NAME(SfxObjectShell)
static WeakReference< XInterface > s_xCurrentComponent;
+void lcl_UpdateAppBasicDocVars( const Reference< XInterface >& _rxComponent, bool bClear = false )
+{
+ BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
+ if ( pAppMgr )
+ {
+ uno::Reference< beans::XPropertySet > xProps( _rxComponent, uno::UNO_QUERY );
+ if ( xProps.is() )
+ {
+ try
+ {
+ // ThisVBADocObj contains a PropertyValue
+ // Name is ( the name of the VBA global to insert )
+ // Value is the Object to insert.
+ // ( note: at the moment the Value is actually the model so
+ // it strictly is not necessary, however we do intend to store
+ // not the model in basic but a custom object, so we keep this
+ // level of indirection for future proofing )
+ beans::PropertyValue aProp;
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ThisVBADocObj") ) ) >>= aProp;
+ rtl::OString sTmp( rtl::OUStringToOString( aProp.Name, RTL_TEXTENCODING_UTF8 ) );
+ const char* pAscii = sTmp.getStr();
+ if ( bClear )
+ pAppMgr->SetGlobalUNOConstant( pAscii, uno::makeAny( uno::Reference< uno::XInterface >() ) );
+ else
+ pAppMgr->SetGlobalUNOConstant( pAscii, aProp.Value );
+
+ }
+ catch( uno::Exception& e )
+ {
+ }
+ }
+ }
+}
+
//=========================================================================
@@ -168,6 +202,7 @@ void SAL_CALL SfxModelListener_Impl::disposing( const com::sun::star::lang::Even
::vos::OGuard aSolarGuard( Application::GetSolarMutex() );
if ( SfxObjectShell::GetCurrentComponent() == _rEvent.Source )
{
+ lcl_UpdateAppBasicDocVars( SfxObjectShell::GetCurrentComponent(), true );
// remove ThisComponent reference from AppBasic
SfxObjectShell::SetCurrentComponent( Reference< XInterface >() );
}
@@ -919,7 +954,10 @@ void SfxObjectShell::SetCurrentComponent( const Reference< XInterface >& _rxComp
BasicManager* pAppMgr = SFX_APP()->GetBasicManager();
s_xCurrentComponent = _rxComponent;
if ( pAppMgr )
+ {
+ lcl_UpdateAppBasicDocVars( _rxComponent );
pAppMgr->SetGlobalUNOConstant( "ThisComponent", makeAny( _rxComponent ) );
+ }
#if OSL_DEBUG_LEVEL > 0
const char* pComponentImplName = _rxComponent.get() ? typeid( *_rxComponent.get() ).name() : "void";
diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx
index 5bd586576ac8..b56aa6a563f9 100755
--- a/sfx2/source/doc/oleprops.hxx
+++ b/sfx2/source/doc/oleprops.hxx
@@ -80,6 +80,10 @@ const sal_Int32 PROPID_CREATED = 12;
const sal_Int32 PROPID_LASTSAVED = 13;
const sal_Int32 PROPID_THUMBNAIL = 17;
+// some Builtin properties
+const sal_Int32 PROPID_CATEGORY = 0x2;
+const sal_Int32 PROPID_COMPANY = 0xf;
+const sal_Int32 PROPID_MANAGER = 0xe;
// predefined codepages
const sal_uInt16 CODEPAGE_UNKNOWN = 0;
const sal_uInt16 CODEPAGE_UNICODE = 1200;
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index fe4ffa50f67d..8a0d81bc2fc5 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -883,7 +883,15 @@ uno::Reference< document::XDocumentInfo > SAL_CALL SfxBaseModel::getDocumentInfo
return m_pData->m_xDocumentInfo;
}
-
+void
+SfxBaseModel::setDocumentProperties( const uno::Reference< document::XDocumentProperties >& rxNewDocProps )
+{
+ // object already disposed?
+ ::vos::OGuard aGuard( Application::GetSolarMutex() );
+ if ( impl_isDisposed() )
+ throw lang::DisposedException();
+ m_pData->m_xDocumentProperties.set(rxNewDocProps, uno::UNO_QUERY_THROW);
+}
// document::XDocumentPropertiesSupplier:
uno::Reference< document::XDocumentProperties > SAL_CALL
SfxBaseModel::getDocumentProperties()
@@ -3552,15 +3560,23 @@ void SAL_CALL SfxBaseModel::switchToStorage( const uno::Reference< XSTORAGE >& x
throw IOEXCEPTION(); // TODO:
// the persistence should be switched only if the storage is different
- if ( xStorage != m_pData->m_pObjectShell->GetStorage()
- && !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
+ if ( xStorage != m_pData->m_pObjectShell->GetStorage() )
{
- sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
- throw task::ErrorCodeIOException( ::rtl::OUString(),
- uno::Reference< uno::XInterface >(),
- nError ? nError : ERRCODE_IO_GENERAL );
+ if ( !m_pData->m_pObjectShell->SwitchPersistance( xStorage ) )
+ {
+ sal_uInt32 nError = m_pData->m_pObjectShell->GetErrorCode();
+ throw task::ErrorCodeIOException( ::rtl::OUString(),
+ uno::Reference< uno::XInterface >(),
+ nError ? nError : ERRCODE_IO_GENERAL );
+ }
+ else
+ {
+ // UICfgMgr has a reference to the old storage, update it
+ uno::Reference< ui::XUIConfigurationStorage > xUICfgMgrStorage( getUIConfigurationManager(), uno::UNO_QUERY );
+ if ( xUICfgMgrStorage.is() )
+ xUICfgMgrStorage->setStorage( xStorage );
+ }
}
-
m_pData->m_pObjectShell->Get_Impl()->bOwnsStorage = FALSE;
}
diff --git a/sfx2/source/inc/SfxDocumentMetaData.hxx b/sfx2/source/inc/SfxDocumentMetaData.hxx
index ec573cf007a7..a8e81bf42d28 100644
--- a/sfx2/source/inc/SfxDocumentMetaData.hxx
+++ b/sfx2/source/inc/SfxDocumentMetaData.hxx
@@ -45,5 +45,16 @@ css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
} // closing component helper namespace
+namespace comp_CompatWriterDocProps {
+
+namespace css = ::com::sun::star;
+
+// component and service helper functions:
+::rtl::OUString SAL_CALL _getImplementationName();
+css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames();
+css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
+ css::uno::Reference< css::uno::XComponentContext > const & context );
+
+}
#endif
diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx
index 4ed0173be8e1..10b8e0ada945 100644
--- a/sfx2/source/view/viewprn.cxx
+++ b/sfx2/source/view/viewprn.cxx
@@ -874,6 +874,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
aReq.AppendItem( SfxStringItem( SID_PRINTER_NAME, pDlgPrinter->GetName() ) );
aReq.Done();
}
+ if ( nId == SID_SETUPPRINTER )
+ {
+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, TRUE ) );
+ }
// take the changes made in the dialog
pPrinter = SetPrinter_Impl( pDlgPrinter );
@@ -894,6 +898,10 @@ void SfxViewShell::ExecPrint_Impl( SfxRequest &rReq )
rReq.Ignore();
if ( SID_PRINTDOC == nId )
rReq.SetReturnValue(SfxBoolItem(0,FALSE));
+ if ( nId == SID_SETUPPRINTER )
+ {
+ rReq.AppendItem( SfxBoolItem( SID_DIALOG_RETURN, FALSE ) );
+ }
}
}
}
diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx
index 154999333296..362dfb82bf7f 100644
--- a/svx/source/form/fmscriptingenv.cxx
+++ b/svx/source/form/fmscriptingenv.cxx
@@ -36,6 +36,8 @@
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
+#include <com/sun/star/awt/XControl.hpp>
/** === end UNO includes === **/
#include <tools/diagnose_ex.h>
#include <cppuhelper/implbase1.hxx>
@@ -71,6 +73,9 @@ namespace svxform
using ::com::sun::star::uno::Exception;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::XInterface;
+ using ::com::sun::star::lang::EventObject;
+ using ::com::sun::star::awt::XControl;
+ using ::com::sun::star::beans::XPropertySet;
/** === end UNO using === **/
class FormScriptingEnvironment;
@@ -413,8 +418,19 @@ namespace svxform
{
Sequence< sal_Int16 > aOutArgsIndex;
Sequence< Any > aOutArgs;
-
- m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs );
+ EventObject aEvent;
+ Any aCaller;
+ if ( ( _rArguments.getLength() > 0 ) && ( _rArguments[ 0 ] >>= aEvent ) )
+ {
+ try
+ {
+ Reference< XControl > xControl( aEvent.Source, UNO_QUERY_THROW );
+ Reference< XPropertySet > xProps( xControl->getModel(), UNO_QUERY_THROW );
+ aCaller = xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Name") ) );
+ }
+ catch( Exception& ) {}
+ }
+ m_rObjectShell.CallXScript( m_sScriptCode, _rArguments, _rSynchronousResult, aOutArgsIndex, aOutArgs, true, aCaller.hasValue() ? &aCaller : 0 );
}
//................................................................
diff --git a/svx/source/form/makefile.mk b/svx/source/form/makefile.mk
index d6dc1bd65357..276df211d941 100644
--- a/svx/source/form/makefile.mk
+++ b/svx/source/form/makefile.mk
@@ -41,6 +41,10 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
.IF "$(ENABLE_VBA)"=="YES"
+ CDEFS+=-DENABLE_VBA
+.ENDIF
+
+.IF "$(ENABLE_VBA)"=="YES"
CDEFS+=-DENABLE_VBA
.ENDIF
diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
index 79bb44ce30a4..ebac18a090d0 100644
--- a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
+++ b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
@@ -71,7 +71,9 @@ namespace ooo
return bRes;
}
VBAHELPER_DLLPUBLIC inline bool isAlienExcelDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-excel" ); }
- VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+ //VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/vnd.ms-word" ); }
+ // word seems to return an erroneous mime type :-/ "application/msword" not consistent with the excel one
+ VBAHELPER_DLLPUBLIC inline bool isAlienWordDoc( SfxObjectShell& rDocShell ) { return isAlienDoc( rDocShell, "application/msword" ); }
} // openoffice
} // org
diff --git a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
index 6902bc7b5042..8fcc2cfa7170 100644
--- a/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
+++ b/vbahelper/inc/vbahelper/vbaapplicationbase.hxx
@@ -62,7 +62,7 @@ public:
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 css::uno::Any 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 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 (css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
index 5bd58b44adaf..8a2d3c6b8ecf 100644
--- a/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
+++ b/vbahelper/inc/vbahelper/vbacollectionimpl.hxx
@@ -243,12 +243,25 @@ typedef InheritedHelperInterfaceImpl< Ifc1 > BaseColBase;
protected:
css::uno::Reference< css::container::XIndexAccess > m_xIndexAccess;
css::uno::Reference< css::container::XNameAccess > m_xNameAccess;
+ sal_Bool mbIgnoreCase;
virtual css::uno::Any getItemByStringIndex( const rtl::OUString& sIndex ) throw (css::uno::RuntimeException)
{
if ( !m_xNameAccess.is() )
throw css::uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ScVbaCollectionBase string index access not supported by this object") ), css::uno::Reference< css::uno::XInterface >() );
+ if( mbIgnoreCase )
+ {
+ css::uno::Sequence< rtl::OUString > sElementNames = m_xNameAccess->getElementNames();
+ for( sal_Int32 i = 0; i < sElementNames.getLength(); i++ )
+ {
+ rtl::OUString aName = sElementNames[i];
+ if( aName.equalsIgnoreAsciiCase( sIndex ) )
+ {
+ return createCollectionObject( m_xNameAccess->getByName( aName ) );
+ }
+ }
+ }
return createCollectionObject( m_xNameAccess->getByName( sIndex ) );
}
@@ -275,7 +288,7 @@ protected:
}
public:
- ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ){ m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
+ ScVbaCollectionBase( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) : BaseColBase( xParent, xContext ), m_xIndexAccess( xIndexAccess ), mbIgnoreCase( bIgnoreCase ) { m_xNameAccess.set(m_xIndexAccess, css::uno::UNO_QUERY); }
//XCollection
virtual ::sal_Int32 SAL_CALL getCount() throw (css::uno::RuntimeException)
{
@@ -340,7 +353,7 @@ class VBAHELPER_DLLPUBLIC CollTestImplHelper : public ScVbaCollectionBase< ::cp
typedef ScVbaCollectionBase< ::cppu::WeakImplHelper1< Ifc > > ImplBase1;
public:
- CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess ) {}
+ CollTestImplHelper( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess >& xIndexAccess, sal_Bool bIgnoreCase = sal_False ) throw( css::uno::RuntimeException ) : ImplBase1( xParent, xContext, xIndexAccess, bIgnoreCase ) {}
};
diff --git a/vbahelper/inc/vbahelper/vbadialogbase.hxx b/vbahelper/inc/vbahelper/vbadialogbase.hxx
index 79c3fa551073..56e1da9115d0 100644
--- a/vbahelper/inc/vbahelper/vbadialogbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadialogbase.hxx
@@ -44,7 +44,7 @@ public:
virtual ~VbaDialogBase() {}
// Methods
- virtual void SAL_CALL Show() throw (css::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL Show() throw (css::uno::RuntimeException);
virtual rtl::OUString mapIndexToName( sal_Int32 nIndex ) = 0;
};
diff --git a/vbahelper/inc/vbahelper/vbadocumentbase.hxx b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
index 2588b7da1720..3526c928e993 100644
--- a/vbahelper/inc/vbahelper/vbadocumentbase.hxx
+++ b/vbahelper/inc/vbahelper/vbadocumentbase.hxx
@@ -58,7 +58,7 @@ public:
virtual void SAL_CALL Close( const css::uno::Any &bSaveChanges,
const css::uno::Any &aFileName,
const css::uno::Any &bRouteWorkbook ) throw (css::uno::RuntimeException);
- virtual void SAL_CALL Protect( const css::uno::Any & aPassword ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL Protect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Unprotect( const css::uno::Any &aPassword ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Save() throw (css::uno::RuntimeException);
virtual void SAL_CALL Activate() throw (css::uno::RuntimeException);
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index ccabb9114f2d..7d2c6a76a0ff 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -35,6 +35,10 @@
#include <com/sun/star/lang/IllegalArgumentException.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/frame/XDispatchResultListener.hpp>
+#include <com/sun/star/frame/DispatchResultEvent.hpp>
+#include <com/sun/star/frame/DispatchResultState.hpp>
+#include <com/sun/star/lang/EventObject.hpp>
#include <com/sun/star/awt/XUnitConversion.hpp>
#include <basic/basmgr.hxx>
#include <basic/sberrors.hxx>
@@ -77,7 +81,7 @@ namespace ooo
VBAHELPER_DLLPUBLIC css::uno::Reference< css::script::XTypeConverter > getTypeConverter( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl );
- VBAHELPER_DLLPUBLIC void dispatchRequests( const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString& aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps );
+ VBAHELPER_DLLPUBLIC void dispatchRequests (const css::uno::Reference< css::frame::XModel>& xModel, const rtl::OUString & aUrl, const css::uno::Sequence< css::beans::PropertyValue >& sProps, const css::uno::Reference< css::frame::XDispatchResultListener >& rListener = css::uno::Reference< css::frame::XDispatchResultListener >(), const sal_Bool bSilent = sal_True );
VBAHELPER_DLLPUBLIC void dispatchExecute(SfxViewShell* pView, USHORT nSlot, SfxCallMode nCall = SFX_CALLMODE_SYNCHRON );
VBAHELPER_DLLPUBLIC sal_Int32 OORGBToXLRGB( sal_Int32 );
VBAHELPER_DLLPUBLIC sal_Int32 XLRGBToOORGB( sal_Int32 );
@@ -107,8 +111,10 @@ namespace ooo
VBAHELPER_DLLPUBLIC sal_Int32 getPointerStyle( const css::uno::Reference< css::frame::XModel >& );
VBAHELPER_DLLPUBLIC void setCursorHelper( const css::uno::Reference< css::frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite );
VBAHELPER_DLLPUBLIC void setDefaultPropByIntrospection( const css::uno::Any& aObj, const css::uno::Any& aValue ) throw ( css::uno::RuntimeException );
+ VBAHELPER_DLLPUBLIC css::uno::Any getDefaultPropByIntrospection( const css::uno::Any& aObj ) throw ( css::uno::RuntimeException );
VBAHELPER_DLLPUBLIC css::uno::Any getPropertyValue( const css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName );
VBAHELPER_DLLPUBLIC sal_Bool setPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
+ VBAHELPER_DLLPUBLIC void setOrAppendPropertyValue( css::uno::Sequence< css::beans::PropertyValue >& aProp, const rtl::OUString& aName, const css::uno::Any& aValue );
class VBAHELPER_DLLPUBLIC Millimeter
{
@@ -232,6 +238,25 @@ public:
static void exception( css::uno::Exception& ex ) throw( css::script::BasicErrorException );
};
+
+class VBAHELPER_DLLPUBLIC VBADispatchListener : public cppu::WeakImplHelper1< css::frame::XDispatchResultListener >
+{
+private:
+ css::uno::Any m_Result;
+ sal_Bool m_State;
+
+public:
+ VBADispatchListener();
+ ~VBADispatchListener();
+
+ css::uno::Any getResult() { return m_Result; }
+ sal_Bool getState() { return m_State; }
+
+ // XDispatchResultListener
+ virtual void SAL_CALL dispatchFinished( const css::frame::DispatchResultEvent& aEvent ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL disposing( const css::lang::EventObject& aEvent ) throw ( css::uno::RuntimeException );
+};
+
} // openoffice
} // org
diff --git a/vbahelper/inc/vbahelper/vbashape.hxx b/vbahelper/inc/vbahelper/vbashape.hxx
index 87c640db203a..ef8934bca869 100644
--- a/vbahelper/inc/vbahelper/vbashape.hxx
+++ b/vbahelper/inc/vbahelper/vbashape.hxx
@@ -109,6 +109,7 @@ public:
// Replace??
virtual void SAL_CALL Select( const css::uno::Any& Replace ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL ShapeRange( const css::uno::Any& index ) throw ( css::uno::RuntimeException );
+ virtual void SAL_CALL Copy( ) throw (css::uno::RuntimeException);
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& rEventObject ) throw( css::uno::RuntimeException );
};
diff --git a/vbahelper/inc/vbahelper/vbashaperange.hxx b/vbahelper/inc/vbahelper/vbashaperange.hxx
index a4cc35958ef2..15455f49af46 100644
--- a/vbahelper/inc/vbahelper/vbashaperange.hxx
+++ b/vbahelper/inc/vbahelper/vbashaperange.hxx
@@ -56,6 +56,8 @@ public:
virtual void SAL_CALL IncrementRotation( double Increment ) throw (css::uno::RuntimeException);
virtual void SAL_CALL IncrementLeft( double Increment ) throw (css::uno::RuntimeException) ;
virtual void SAL_CALL IncrementTop( double Increment ) throw (css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getName() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setName( const rtl::OUString& _name ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getHeight() throw (css::uno::RuntimeException);
virtual void SAL_CALL setHeight( double _height ) throw (css::uno::RuntimeException);
virtual double SAL_CALL getWidth() throw (css::uno::RuntimeException);
@@ -76,6 +78,7 @@ public:
virtual void SAL_CALL setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL SAL_CALL TextFrame( ) throw (css::uno::RuntimeException);
virtual css::uno::Any SAL_CALL SAL_CALL WrapFormat( ) throw (css::uno::RuntimeException);
+ virtual void SAL_CALL ZOrder( sal_Int32 ZOrderCmd ) throw (css::uno::RuntimeException);
//XEnumerationAccess
virtual css::uno::Type SAL_CALL getElementType() throw (css::uno::RuntimeException);
virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
diff --git a/vbahelper/prj/d.lst b/vbahelper/prj/d.lst
index 2d20ab1f982d..92b01be83912 100644
--- a/vbahelper/prj/d.lst
+++ b/vbahelper/prj/d.lst
@@ -27,3 +27,4 @@ mkdir: %_DEST%\inc%_EXT%\basic
..\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
+..\inc\vbahelper\vbaeventshelperbase.hxx %_DEST%\inc%_EXT%\vbahelper\vbaeventshelperbase.hxx
diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk
index 5fce64649dcb..30ce22139ce4 100644
--- a/vbahelper/source/msforms/makefile.mk
+++ b/vbahelper/source/msforms/makefile.mk
@@ -34,13 +34,10 @@ VISIBILITY_HIDDEN=TRUE
# --- Settings -----------------------------------------------------
-.IF "$(ENABLE_VBA)" == "NO"
-dummy:
- @echo "Nothing to build"
-.ENDIF
-
.INCLUDE : settings.mk
+CDEFS+=-DVBA_OOBUILD_HACK
+
SLOFILES=\
$(SLO)$/vbacontrol.obj \
$(SLO)$/vbacontrols.obj \
diff --git a/vbahelper/source/msforms/vbacheckbox.cxx b/vbahelper/source/msforms/vbacheckbox.cxx
index e9ea64f772b6..8bebdaf4b819 100644
--- a/vbahelper/source/msforms/vbacheckbox.cxx
+++ b/vbahelper/source/msforms/vbacheckbox.cxx
@@ -70,6 +70,8 @@ void SAL_CALL
ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeException)
{
sal_Int16 nValue = 0;
+ sal_Int16 nOldValue = 0;
+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
sal_Bool bValue = false;
if( _value >>= nValue )
{
@@ -82,6 +84,8 @@ ScVbaCheckbox::setValue( const uno::Any& _value ) throw (css::uno::RuntimeExcept
nValue = 1;
}
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
+ if ( nValue != nOldValue )
+ fireClickEvent();
}
rtl::OUString&
ScVbaCheckbox::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbacheckbox.hxx b/vbahelper/source/msforms/vbacheckbox.hxx
index 34d0828e0c66..3559ec144758 100644
--- a/vbahelper/source/msforms/vbacheckbox.hxx
+++ b/vbahelper/source/msforms/vbacheckbox.hxx
@@ -27,12 +27,12 @@
#ifndef SC_VBA_CHECKBOX_HXX
#define SC_VBA_CHECKBOX_HXX
#include <cppuhelper/implbase2.hxx>
-#include <ooo/vba/msforms/XRadioButton.hpp>
+#include <ooo/vba/msforms/XCheckBox.hpp>
#include "vbacontrol.hxx"
#include <vbahelper/vbahelper.hxx>
-typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XRadioButton, css::script::XDefaultProperty > CheckBoxImpl_BASE;
+typedef cppu::ImplInheritanceHelper2< ScVbaControl, ov::msforms::XCheckBox, css::script::XDefaultProperty > CheckBoxImpl_BASE;
class ScVbaCheckbox : public CheckBoxImpl_BASE
{
diff --git a/vbahelper/source/msforms/vbacombobox.cxx b/vbahelper/source/msforms/vbacombobox.cxx
index 0b5f1af30bb7..76ea475fe003 100644
--- a/vbahelper/source/msforms/vbacombobox.cxx
+++ b/vbahelper/source/msforms/vbacombobox.cxx
@@ -26,6 +26,9 @@
************************************************************************/
#include "vbacombobox.hxx"
#include <vector>
+#include <filter/msfilter/msvbahelper.hxx>
+#include <basic/sbstar.hxx>
+#include <basic/sbmod.hxx>
using namespace com::sun::star;
using namespace ooo::vba;
@@ -63,12 +66,18 @@ ScVbaComboBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeExcepti
sal_Int16 nIndex = 0;
if( _value >>= nIndex )
{
+ sal_Int32 nOldIndex = -1;
+ getListIndex() >>= nOldIndex;
uno::Sequence< rtl::OUString > sItems;
m_xProps->getPropertyValue( ITEMS ) >>= sItems;
if( ( nIndex >= 0 ) && ( sItems.getLength() > nIndex ) )
{
rtl::OUString sText = sItems[ nIndex ];
m_xProps->setPropertyValue( TEXT, uno::makeAny( sText ) );
+
+ // fire the _Change event
+ if( nOldIndex != nIndex )
+ fireClickEvent();
}
}
}
@@ -103,7 +112,38 @@ ScVbaComboBox::getListIndex() throw (uno::RuntimeException)
void SAL_CALL
ScVbaComboBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
- m_xProps->setPropertyValue( sSourceName, _value );
+ rtl::OUString sOldValue, sNewValue;
+ getValue() >>= sOldValue;
+
+ uno::Any aConverted = _value;
+ uno::Reference< script::XTypeConverter > xConverter = getTypeConverter( mxContext );
+ try
+ {
+ aConverted = xConverter.is() ? xConverter->convertTo( _value, getCppuType( static_cast< const rtl::OUString* >(0) ) ) : aConverted;
+ }
+ catch( const uno::Exception& /*ex*/ )
+ {
+ throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Invalid value" ) ), uno::Reference< uno::XInterface >() );
+ }
+
+ m_xProps->setPropertyValue( sSourceName, aConverted );
+
+ aConverted >>= sNewValue;
+ if ( sNewValue != sOldValue )
+ {
+ // If the new value is in current list, we should fire click event, otherwise fire the change event.
+ sal_Int32 nListIndex = -1;
+ getListIndex() >>= nListIndex;
+ sal_Bool bIsInList = ( nListIndex >= 0 );
+ if ( bIsInList )
+ {
+ fireClickEvent();
+ }
+ else
+ {
+ fireChangeEvent();
+ }
+ }
}
// see Value
diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx
index 82b68bbd5be7..2290e476c85d 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -28,6 +28,7 @@
#include <com/sun/star/awt/XControlModel.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XWindow2.hpp>
+#include <com/sun/star/awt/XActionListener.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/drawing/XControlShape.hpp>
@@ -39,6 +40,9 @@
#include <com/sun/star/form/binding/XListEntrySink.hpp>
#include <com/sun/star/table/CellAddress.hpp>
#include <com/sun/star/table/CellRangeAddress.hpp>
+#include <com/sun/star/script/XScriptListener.hpp>
+#include <com/sun/star/document/XCodeNameQuery.hpp>
+#include <com/sun/star/form/XChangeListener.hpp>
#include <ooo/vba/XControlProvider.hpp>
#ifdef VBA_OOBUILD_HACK
#include <svtools/bindablecontrolhelper.hxx>
@@ -127,7 +131,7 @@ ScVbaControlListener::disposing( const lang::EventObject& ) throw( uno::RuntimeE
//ScVbaControl
-ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), m_xControl( xControl ), m_xModel( xModel )
+ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< ::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, AbstractGeometryAttributes* pGeomHelper ) : ControlImpl_BASE( xParent, xContext ), bIsDialog(false), m_xControl( xControl ), m_xModel( xModel )
{
//add listener
m_xEventListener.set( new ScVbaControlListener( this ) );
@@ -139,9 +143,18 @@ ScVbaControl::ScVbaControl( const uno::Reference< XHelperInterface >& xParent, c
uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
uno::Reference< awt::XControl> xUserFormControl( m_xControl, uno::UNO_QUERY ) ;
if ( xControlShape.is() ) // form control
+ {
m_xProps.set( xControlShape->getControl(), uno::UNO_QUERY_THROW );
+ rtl::OUString sDefaultControl;
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DefaultControl") ) ) >>= sDefaultControl;
+ uno::Reference< lang::XMultiComponentFactory > xMFac( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ m_xEmptyFormControl.set( xMFac->createInstanceWithContext( sDefaultControl, mxContext ), uno::UNO_QUERY_THROW );
+ }
else if ( xUserFormControl.is() ) // userform control
+ {
m_xProps.set( xUserFormControl->getModel(), uno::UNO_QUERY_THROW );
+ bIsDialog = true;
+ }
}
ScVbaControl::~ScVbaControl()
@@ -398,6 +411,85 @@ void SAL_CALL ScVbaControl::setTag( const ::rtl::OUString& aTag )
m_aControlTag = aTag;
}
+::sal_Int32 SAL_CALL ScVbaControl::getForeColor() throw (::com::sun::star::uno::RuntimeException)
+{
+ sal_Int32 nForeColor = -1;
+ m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ) ) >>= nForeColor;
+ return OORGBToXLRGB( nForeColor );
+}
+
+void SAL_CALL ScVbaControl::setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException)
+{
+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TextColor" ) ), uno::makeAny( XLRGBToOORGB( _forecolor ) ) );
+}
+
+void ScVbaControl::fireEvent( script::ScriptEvent& evt )
+{
+ uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ooo.vba.EventListener" ) ), mxContext ), uno::UNO_QUERY_THROW );
+
+ uno::Reference< beans::XPropertySet > xProps( xScriptListener, uno::UNO_QUERY_THROW );
+ xProps->setPropertyValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Model" ) ), uno::makeAny( m_xModel ) );
+
+ // handling for sheet control
+ uno::Reference< msforms::XControl > xThisControl( this );
+ try
+ {
+ evt.Arguments.realloc( 1 );
+ lang::EventObject aEvt;
+
+ uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY ) ;
+ uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY ) ;
+
+ if ( xControlShape.is() )
+ {
+ evt.Source = xControlShape;
+ aEvt.Source = m_xEmptyFormControl;
+ // Set up proper scriptcode
+ uno::Reference< lang::XMultiServiceFactory > xDocFac( m_xModel, uno::UNO_QUERY_THROW );
+ uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( rtl::OUString::createFromAscii( "ooo.vba.VBACodeNameProvider" ) ), uno::UNO_QUERY_THROW );
+ uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW );
+ evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf );
+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
+ xScriptListener->firing( evt );
+ }
+ else
+ {
+ if ( xControl.is() ) // normal control ( from dialog/userform )
+ {
+ // #FIXME We should probably store a reference to the
+ // parent dialog/userform here ( other wise the name of
+ // dialog could be changed and we won't be aware of it.
+ // ( OTOH this is probably an unlikely scenario )
+ evt.Source = xThisControl;
+ aEvt.Source = xControl;
+ evt.ScriptCode = m_sLibraryAndCodeName;
+ evt.Arguments[ 0 ] = uno::makeAny( aEvt );
+ xScriptListener->firing( evt );
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ }
+}
+void ScVbaControl::fireChangeEvent()
+{
+ script::ScriptEvent evt;
+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
+ evt.ListenerType = form::XChangeListener::static_type(0);
+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("changed") );
+ fireEvent( evt );
+}
+
+void ScVbaControl::fireClickEvent()
+{
+ script::ScriptEvent evt;
+ evt.ScriptType = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VBAInterop") );
+ evt.ListenerType = awt::XActionListener::static_type(0);
+ evt.MethodName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("actionPerformed") );
+ fireEvent( evt );
+}
//ScVbaControlFactory
@@ -423,16 +515,25 @@ ScVbaControl* ScVbaControlFactory::createControl(const uno::Reference< drawing::
const static rtl::OUString sClassId( RTL_CONSTASCII_USTRINGPARAM("ClassId") );
xProps->getPropertyValue( sClassId ) >>= nClassId;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
+ sal_Bool bToggle = sal_False; //liuchen 2009-8-11,
switch( nClassId )
{
case form::FormComponentType::COMBOBOX:
return new ScVbaComboBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::COMMANDBUTTON:
- return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ //liuchen 2009-8-11
+ xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Toggle") ) ) >>= bToggle;
+ if ( bToggle )
+ return new ScVbaToggleButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ else
+ return new ScVbaButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ //liuchen 2009-8-11
case form::FormComponentType::FIXEDTEXT:
return new ScVbaLabel( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::TEXTFIELD:
return new ScVbaTextBox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
+ case form::FormComponentType::CHECKBOX:
+ return new ScVbaCheckbox( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::RADIOBUTTON:
return new ScVbaRadioButton( xVbaParent, m_xContext, xControlShape, m_xModel, new ConcreteXShapeGeometryAttributes( m_xContext, uno::Reference< drawing::XShape >( xControlShape, uno::UNO_QUERY_THROW ) ) );
case form::FormComponentType::LISTBOX:
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index 992fbd94a8c5..364f4baa1f20 100644
--- a/vbahelper/source/msforms/vbacontrol.hxx
+++ b/vbahelper/source/msforms/vbacontrol.hxx
@@ -34,6 +34,7 @@
#include <com/sun/star/drawing/XControlShape.hpp>
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XWindowPeer.hpp>
+#include <com/sun/star/script/ScriptEvent.hpp>
#include <ooo/vba/msforms/XControl.hpp>
#include <vbahelper/vbahelper.hxx>
@@ -47,17 +48,23 @@ class ScVbaControl : public ControlImpl_BASE
{
private:
com::sun::star::uno::Reference< com::sun::star::lang::XEventListener > m_xEventListener;
+ com::sun::star::uno::Reference< com::sun::star::awt::XControl > m_xEmptyFormControl;
protected:
// awt control has nothing similar to Tag property of Mso controls,
// whether it is necessary is another question
::rtl::OUString m_aControlTag;
+ bool bIsDialog;
+ rtl::OUString m_sLibraryAndCodeName;
std::auto_ptr< ov::AbstractGeometryAttributes > mpGeometryHelper;
css::uno::Reference< css::beans::XPropertySet > m_xProps;
css::uno::Reference< css::uno::XInterface > m_xControl;
css::uno::Reference< css::frame::XModel > m_xModel;
virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException);
+ void fireChangeEvent();
+ void fireClickEvent();
+ void fireEvent( css::script::ScriptEvent& evt );
public:
ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext,
const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper );
@@ -65,6 +72,10 @@ public:
// This class will own the helper, so make sure it is allocated from
// the heap
void setGeometryHelper( ov::AbstractGeometryAttributes* pHelper );
+ // sets the name of the associated library ( used for UserForm controls )
+ void setLibraryAndCodeName( const rtl::OUString& sLibCodeName ) { m_sLibraryAndCodeName = sLibCodeName; }
+ rtl::OUString getLibraryAndCodeName() { return m_sLibraryAndCodeName; }
+
// XControl
virtual sal_Bool SAL_CALL getEnabled() throw (css::uno::RuntimeException);
virtual void SAL_CALL setEnabled( sal_Bool _enabled ) throw (css::uno::RuntimeException);
@@ -94,6 +105,8 @@ public:
virtual void SAL_CALL setTag( const ::rtl::OUString& aTag ) throw (css::uno::RuntimeException);
//remove resouce because ooo.vba.excel.XControl is a wrapper of com.sun.star.drawing.XControlShape
virtual void removeResouce() throw( css::uno::RuntimeException );
+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbaframe.cxx b/vbahelper/source/msforms/vbaframe.cxx
index c470ee0097e4..4e15918853a7 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -64,6 +64,30 @@ ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
_value >>= sCaption;
setCaption( sCaption );
}
+//liuchen 2009-7-6
+::sal_Int32 SAL_CALL ScVbaFrame::getForeColor() throw (::com::sun::star::uno::RuntimeException)
+{
+ return 0;
+}
+
+void SAL_CALL ScVbaFrame::setForeColor( ::sal_Int32 /*_forecolor*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ return;
+}
+//liuchen 2009-7-6 end
+
+rtl::OUString SAL_CALL
+ScVbaFrame::getAccelerator() throw (css::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+ return rtl::OUString();
+}
+
+void SAL_CALL
+ScVbaFrame::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+}
rtl::OUString&
ScVbaFrame::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index 567e58b57272..c92c007f06f6 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -43,6 +43,12 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ //liuchen 2009-7-6
+ virtual ::sal_Int32 SAL_CALL getForeColor() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setForeColor( ::sal_Int32 _forecolor ) throw (::com::sun::star::uno::RuntimeException);
+ //liuchen 2009-7-6 end
+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbalabel.cxx b/vbahelper/source/msforms/vbalabel.cxx
index 9bf7a7e001bf..16256bf4829d 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -64,6 +64,18 @@ ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::Run
setCaption( sCaption );
}
+rtl::OUString SAL_CALL
+ScVbaLabel::getAccelerator() throw (css::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+ return rtl::OUString();
+}
+
+void SAL_CALL
+ScVbaLabel::setAccelerator( const rtl::OUString& /*_accelerator*/ ) throw (::com::sun::star::uno::RuntimeException)
+{
+ //FIXME: seems not support?
+}
rtl::OUString&
ScVbaLabel::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index af3bc074c54d..ffa1d7e11ca1 100644
--- a/vbahelper/source/msforms/vbalabel.hxx
+++ b/vbahelper/source/msforms/vbalabel.hxx
@@ -44,6 +44,8 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getCaption() throw (css::uno::RuntimeException);
virtual void SAL_CALL setCaption( const rtl::OUString& _caption ) throw (css::uno::RuntimeException);
+ virtual rtl::OUString SAL_CALL getAccelerator() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setAccelerator( const rtl::OUString& _accelerator ) throw (css::uno::RuntimeException);
//XHelperInterface
virtual rtl::OUString& getServiceImplName();
virtual css::uno::Sequence<rtl::OUString> getServiceNames();
diff --git a/vbahelper/source/msforms/vbalistbox.cxx b/vbahelper/source/msforms/vbalistbox.cxx
index 17f8c8341588..8d61cf511408 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -108,9 +108,13 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
"Attribute use invalid." ), uno::Reference< uno::XInterface >() );
uno::Sequence< sal_Int16 > nSelectedIndices(1);
+ uno::Sequence< sal_Int16 > nOldSelectedIndices;
+ m_xProps->getPropertyValue( SELECTEDITEMS ) >>= nOldSelectedIndices;
nSelectedIndices[ 0 ] = nValue;
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
- m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) );
+ if ( nSelectedIndices != nOldSelectedIndices )
+ fireClickEvent();
+ //m_xProps->setPropertyValue( TEXT, uno::makeAny( sValue ) ); //liuchen 2009-8-12 solve the problem that ListBox.Text and ListBox.Value cannot be set
}
::rtl::OUString SAL_CALL
@@ -127,20 +131,22 @@ ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeExcepti
setValue( uno::makeAny( _text ) ); // seems the same
}
-sal_Bool SAL_CALL
+sal_Int32 SAL_CALL
ScVbaListBox::getMultiSelect() throw (css::uno::RuntimeException)
{
sal_Bool bMultiSelect = sal_False;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ) ) >>= bMultiSelect;
- return bMultiSelect;
+ return bMultiSelect ? 1 : 0 ;
}
void SAL_CALL
-ScVbaListBox::setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException)
+ScVbaListBox::setMultiSelect( sal_Int32 _multiselect ) throw (css::uno::RuntimeException)
{
- m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( _multiselect ) );
+ sal_Bool bMultiSelect = _multiselect == 1 ? 1 : 0;
+ m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MultiSelection" ) ), uno::makeAny( bMultiSelect ) );
}
+
css::uno::Any SAL_CALL
ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
{
@@ -205,6 +211,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
}
nList.realloc( nLength - 1 );
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
+ fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
return;
}
@@ -223,6 +230,7 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
nList[0] = nIndex;
}
//m_xProps->setPropertyValue( sSourceName, uno::makeAny( nList ) );
+ fireClickEvent();
m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nList ) );
}
}
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index 3d0797e2b7b2..fc58e64dc9fd 100644
--- a/vbahelper/source/msforms/vbalistbox.hxx
+++ b/vbahelper/source/msforms/vbalistbox.hxx
@@ -58,8 +58,8 @@ public:
virtual void SAL_CALL setValue( const css::uno::Any& _value ) throw (css::uno::RuntimeException);
virtual rtl::OUString SAL_CALL getText() throw (css::uno::RuntimeException);
virtual void SAL_CALL setText( const ::rtl::OUString& _text ) throw (css::uno::RuntimeException);
- virtual sal_Bool SAL_CALL getMultiSelect() throw (css::uno::RuntimeException);
- virtual void SAL_CALL setMultiSelect( sal_Bool _multiselect ) throw (css::uno::RuntimeException);
+ virtual ::sal_Int32 SAL_CALL getMultiSelect() throw (css::uno::RuntimeException); //liuchen 2009-7-31
+ virtual void SAL_CALL setMultiSelect( ::sal_Int32 _multiselect ) throw (css::uno::RuntimeException); //liuchen 2009-7-31
virtual css::uno::Any SAL_CALL Selected( ::sal_Int32 index ) throw (css::uno::RuntimeException);
// Methods
diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
index 76763b42039e..16e143bd2e49 100644
--- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx
+++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
@@ -1,11 +1,69 @@
#include <vbalistcontrolhelper.hxx>
#include <vector>
+#include <vbahelper/vbapropvalue.hxx>
using namespace com::sun::star;
using namespace ooo::vba;
const static rtl::OUString ITEMS( RTL_CONSTASCII_USTRINGPARAM("StringItemList") );
+class ListPropListener : public PropListener
+{
+private:
+ uno::Reference< beans::XPropertySet > m_xProps;
+ uno::Any m_pvargIndex;
+ uno::Any m_pvarColumn;
+
+public:
+ ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn );
+ virtual void setValueEvent( const css::uno::Any& value );
+ virtual css::uno::Any getValueEvent();
+};
+
+ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn )
+{
+}
+
+void ListPropListener::setValueEvent( const uno::Any& value )
+{
+ if( m_pvargIndex.hasValue() || m_pvarColumn.hasValue() )
+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
+ "Bad argument" ), uno::Reference< uno::XInterface >() );
+
+ m_xProps->setPropertyValue( ITEMS, value );
+}
+
+uno::Any ListPropListener::getValueEvent()
+{
+ uno::Sequence< rtl::OUString > sList;
+ m_xProps->getPropertyValue( ITEMS ) >>= sList;
+ sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
+ uno::Any aRet;
+ if ( m_pvargIndex.hasValue() )
+ {
+ sal_Int16 nIndex = -1;
+ m_pvargIndex >>= nIndex;
+ if( nIndex < 0 || nIndex >= nLength )
+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
+ "Bad row Index" ), uno::Reference< uno::XInterface >() );
+ aRet <<= sList[ nIndex ];
+ }
+ else if ( m_pvarColumn.hasValue() ) // pvarColumn on its own would be bad
+ throw uno::RuntimeException( rtl::OUString::createFromAscii(
+ "Bad column Index" ), uno::Reference< uno::XInterface >() );
+ else // List() ( e.g. no args )
+ {
+ uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
+ for ( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ sReturnArray[ i ].realloc( 10 );
+ sReturnArray[ i ][ 0 ] = sList[ i ];
+ }
+ aRet = uno::makeAny( sReturnArray );
+ }
+ return aRet;
+}
+
void SAL_CALL
ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
{
@@ -116,31 +174,5 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
uno::Any SAL_CALL
ListControlHelper::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
- uno::Sequence< rtl::OUString > sList;
- m_xProps->getPropertyValue( ITEMS ) >>= sList;
- sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
- uno::Any aRet;
- if ( pvargIndex.hasValue() )
- {
- sal_Int16 nIndex = -1;
- pvargIndex >>= nIndex;
- if( nIndex < 0 || nIndex >= nLength )
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Bad row Index" ), uno::Reference< uno::XInterface >() );
- aRet <<= sList[ nIndex ];
- }
- else if ( pvarColumn.hasValue() ) // pvarColumn on its own would be bad
- throw uno::RuntimeException( rtl::OUString::createFromAscii(
- "Bad column Index" ), uno::Reference< uno::XInterface >() );
- else // List() ( e.g. no args )
- {
- uno::Sequence< uno::Sequence< rtl::OUString > > sReturnArray( nLength );
- for ( sal_Int32 i = 0; i < nLength; ++i )
- {
- sReturnArray[ i ].realloc( 10 );
- sReturnArray[ i ][ 0 ] = sList[ i ];
- }
- aRet = uno::makeAny( sReturnArray );
- }
- return aRet;
+ return uno::makeAny( uno::Reference< XPropValue > ( new ScVbaPropValue( new ListPropListener( m_xProps, pvargIndex, pvarColumn ) ) ) );
}
diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx
index b6587c9b2367..1ba7c4f5fbac 100644
--- a/vbahelper/source/msforms/vbamultipage.cxx
+++ b/vbahelper/source/msforms/vbamultipage.cxx
@@ -88,8 +88,12 @@ void SAL_CALL
ScVbaMultiPage::setValue( const sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException)
{
// track change in dialog ( dialog value is 1 based, 0 is a special value )
+ sal_Int32 nVal = _value; // will be _value + 1 when cws container_controls is integrated
+ sal_Int32 nOldVal = getValue();
m_xProps->setPropertyValue( SVALUE, uno::makeAny( _value ) );
mxDialogProps->setPropertyValue( SSTEP, uno::makeAny( _value + 1) );
+ if ( nVal != nOldVal )
+ fireChangeEvent();
}
diff --git a/vbahelper/source/msforms/vbaradiobutton.cxx b/vbahelper/source/msforms/vbaradiobutton.cxx
index 94d12c5823ba..5364a3fd428d 100644
--- a/vbahelper/source/msforms/vbaradiobutton.cxx
+++ b/vbahelper/source/msforms/vbaradiobutton.cxx
@@ -70,6 +70,9 @@ void SAL_CALL
ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nValue = 0;
+ sal_Int16 nOldValue = 0;
+ m_xProps->getPropertyValue( STATE ) >>= nOldValue;
+
sal_Bool bValue = sal_False;
if( _value >>= nValue )
{
@@ -82,6 +85,15 @@ ScVbaRadioButton::setValue( const uno::Any& _value ) throw (uno::RuntimeExceptio
nValue = 1;
}
m_xProps->setPropertyValue( STATE, uno::makeAny( nValue ) );
+ if ( nValue != nOldValue )
+ {
+ fireChangeEvent();
+ // In Excel, only when the radio button is checked, the click event is fired.
+ if ( nValue != 0 )
+ {
+ fireClickEvent();
+ }
+ }
}
rtl::OUString&
diff --git a/vbahelper/source/msforms/vbatextbox.cxx b/vbahelper/source/msforms/vbatextbox.cxx
index 2d83d41d77c3..f97b7761ba73 100644
--- a/vbahelper/source/msforms/vbatextbox.cxx
+++ b/vbahelper/source/msforms/vbatextbox.cxx
@@ -67,13 +67,20 @@ ScVbaTextBox::getText() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setText( const rtl::OUString& _text ) throw (css::uno::RuntimeException)
{
+ rtl::OUString sOldText = getText();
+
if ( !mbDialog )
{
- uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
- xTextRange->setString( _text );
-}
+ uno::Reference< text::XTextRange > xTextRange( m_xProps, uno::UNO_QUERY_THROW );
+ xTextRange->setString( _text );
+ }
else
m_xProps->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ), uno::makeAny( _text ) );
+
+ if ( _text != sOldText )
+ {
+ fireChangeEvent();
+ }
}
sal_Int32 SAL_CALL
@@ -90,7 +97,8 @@ ScVbaTextBox::getMaxLength() throw (css::uno::RuntimeException)
void SAL_CALL
ScVbaTextBox::setMaxLength( sal_Int32 _maxlength ) throw (css::uno::RuntimeException)
{
- uno::Any aValue( _maxlength );
+ sal_Int16 _maxlength16 = static_cast<sal_Int16> (_maxlength); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
+ uno::Any aValue( _maxlength16 ); //liuchen 2009-7-24, resolve the problem that MaxLength cannot be set correctly
m_xProps->setPropertyValue
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "MaxTextLen" ) ), aValue);
}
diff --git a/vbahelper/source/msforms/vbatogglebutton.cxx b/vbahelper/source/msforms/vbatogglebutton.cxx
index 071651ff8a36..efd8f2be458a 100644
--- a/vbahelper/source/msforms/vbatogglebutton.cxx
+++ b/vbahelper/source/msforms/vbatogglebutton.cxx
@@ -68,16 +68,33 @@ ScVbaToggleButton::getValue() throw (uno::RuntimeException)
return uno::makeAny( nState ? sal_Int16( -1 ) : sal_Int16( 0 ) );
}
+//liuchen 2009-7-23, resolve the defect that ToggleButton.Value cannot be set correctly
void SAL_CALL
ScVbaToggleButton::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int16 nState = 0;
- _value >>= nState;
+ if (_value.getValueTypeClass() == uno::TypeClass_BOOLEAN)
+ {
+ sal_Bool bValue;
+ _value >>= bValue;
+ nState = static_cast< sal_Int16 >(bValue);
+ }
+ else if (_value.getValueTypeClass() == uno::TypeClass_BYTE)
+ {
+ sal_Int8 nValue;
+ _value >>= nValue;
+ nState = ( nValue == 1) ? 1 : 0;
+ }
+ else
+ {
+ _value >>= nState;
OSL_TRACE( "nState - %d", nState );
- nState = ( nState == -1 ) ? 1 : 0;
+ nState = ( nState == -1 ) ? 1 : 0;
OSL_TRACE( "nState - %d", nState );
+ }
m_xProps->setPropertyValue( STATE, uno::makeAny( nState ) );
}
+//liuchen 2009-7-23
rtl::OUString&
ScVbaToggleButton::getServiceImplName()
diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx
index a1333e0a655b..a329f57c8ca8 100644
--- a/vbahelper/source/msforms/vbauserform.cxx
+++ b/vbahelper/source/msforms/vbauserform.cxx
@@ -28,6 +28,7 @@
#include "vbauserform.hxx"
#include <com/sun/star/awt/XControl.hpp>
#include <com/sun/star/awt/XControlContainer.hpp>
+#include <com/sun/star/awt/XWindow2.hpp>
#include <com/sun/star/beans/PropertyConcept.hpp>
#include <basic/sbx.hxx>
#include <basic/sbstar.hxx>
@@ -53,6 +54,8 @@ ScVbaUserForm::ScVbaUserForm( uno::Sequence< uno::Any > const& aArgs, uno::Refer
uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW );
m_xProps.set( xControl->getModel(), uno::UNO_QUERY_THROW );
setGeometryHelper( new UserFormGeometryHelper( xContext, xControl ) );
+ if ( aArgs.getLength() >= 4 )
+ aArgs[ 3 ] >>= m_sLibName;
}
ScVbaUserForm::~ScVbaUserForm()
@@ -104,6 +107,24 @@ ScVbaUserForm::Hide( ) throw (uno::RuntimeException)
m_xDialog->endExecute();
}
+sal_Bool SAL_CALL ScVbaUserForm::getVisible() throw (uno::RuntimeException)
+{
+ uno::Reference< awt::XWindow2 > xWindow2( getWindowPeer(), uno::UNO_QUERY_THROW );
+ return xWindow2->isVisible();
+}
+
+void SAL_CALL ScVbaUserForm::setVisible( sal_Bool bVisible ) throw (uno::RuntimeException)
+{
+ if ( bVisible )
+ {
+ Show();
+ }
+ else
+ {
+ Hide();
+ }
+}
+
void SAL_CALL
ScVbaUserForm::RePaint( ) throw (uno::RuntimeException)
{
@@ -184,6 +205,8 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un
uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() );
pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) );
+ if ( m_sLibName.getLength() )
+ pControl->setLibraryAndCodeName( m_sLibName.concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ).concat( getName() ) );
aResult = uno::makeAny( xVBAControl );
}
diff --git a/vbahelper/source/msforms/vbauserform.hxx b/vbahelper/source/msforms/vbauserform.hxx
index 71e8b4f62aa9..c5d934c7688e 100644
--- a/vbahelper/source/msforms/vbauserform.hxx
+++ b/vbahelper/source/msforms/vbauserform.hxx
@@ -43,10 +43,13 @@ class ScVbaUserForm : public ScVbaUserForm_BASE
private:
css::uno::Reference< css::awt::XDialog > m_xDialog;
bool mbDispose;
+ rtl::OUString m_sLibName;
protected:
public:
ScVbaUserForm( css::uno::Sequence< css::uno::Any > const& aArgs, css::uno::Reference< css::uno::XComponentContext >const& xContext ) throw ( css::lang::IllegalArgumentException );
virtual ~ScVbaUserForm();
+ virtual sal_Bool SAL_CALL getVisible() throw (css::uno::RuntimeException);
+ virtual void SAL_CALL setVisible( sal_Bool _visible ) throw (css::uno::RuntimeException);
// XUserForm
virtual void SAL_CALL RePaint( ) throw (css::uno::RuntimeException);
virtual void SAL_CALL Show( ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/makefile.mk b/vbahelper/source/vbahelper/makefile.mk
index 22ed40a3adfa..31fefa8430b1 100644
--- a/vbahelper/source/vbahelper/makefile.mk
+++ b/vbahelper/source/vbahelper/makefile.mk
@@ -33,11 +33,6 @@ ENABLE_EXCEPTIONS := TRUE
VISIBILITY_HIDDEN=TRUE
# --- Settings -----------------------------------------------------
-.IF "$(ENABLE_VBA)" == "NO"
-dummy:
- @echo "Nothing to build"
-.ENDIF
-
.INCLUDE : settings.mk
SLOFILES=\
diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
index 326c150edade..a8b04df6f493 100644
--- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx
+++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx
@@ -200,6 +200,8 @@ void SAL_CALL
VbaApplicationBase::setScreenUpdating(sal_Bool bUpdate) throw (uno::RuntimeException)
{
uno::Reference< frame::XModel > xModel( getCurrentDocument(), uno::UNO_QUERY_THROW );
+ if( bUpdate != xModel->hasControllersLocked() )
+ return;
if (bUpdate)
xModel->unlockControllers();
else
@@ -293,7 +295,7 @@ VbaApplicationBase::getVersion() throw (uno::RuntimeException)
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(OFFICEVERSION));
}
-void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
+uno::Any SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const uno::Any& varg1, const uno::Any& varg2, const uno::Any& varg3, const uno::Any& varg4, const uno::Any& varg5, const uno::Any& varg6, const uno::Any& varg7, const uno::Any& varg8, const uno::Any& varg9, const uno::Any& varg10, const uno::Any& varg11, const uno::Any& varg12, const uno::Any& varg13, const uno::Any& varg14, const uno::Any& varg15, const uno::Any& varg16, const uno::Any& varg17, const uno::Any& varg18, const uno::Any& varg19, const uno::Any& varg20, const uno::Any& varg21, const uno::Any& varg22, const uno::Any& varg23, const uno::Any& varg24, const uno::Any& varg25, const uno::Any& varg26, const uno::Any& varg27, const uno::Any& varg28, const uno::Any& varg29, const uno::Any& varg30 ) throw (uno::RuntimeException)
{
::rtl::OUString sSeparator = ::rtl::OUString::createFromAscii("/");
::rtl::OUString sMacroSeparator = ::rtl::OUString::createFromAscii("!");
@@ -342,7 +344,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
}
- VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name );
+ // search the global tempalte
+ VBAMacroResolvedInfo aMacroInfo = resolveVBAMacro( getSfxObjShell( aMacroDocumentModel ), sMacro_only_Name, sal_True );
if( aMacroInfo.IsResolved() )
{
// handle the arguments
@@ -370,6 +373,8 @@ void SAL_CALL VbaApplicationBase::Run( const ::rtl::OUString& MacroName, const u
uno::Any aRet;
uno::Any aDummyCaller;
executeMacro( aMacroInfo.MacroDocContext(), aMacroInfo.ResolvedMacro(), aArgs, aRet, aDummyCaller );
+
+ return aRet;
}
else
{
diff --git a/vbahelper/source/vbahelper/vbadialogbase.cxx b/vbahelper/source/vbahelper/vbadialogbase.cxx
index e093e32c7443..d39fb273c7db 100644
--- a/vbahelper/source/vbahelper/vbadialogbase.cxx
+++ b/vbahelper/source/vbahelper/vbadialogbase.cxx
@@ -30,11 +30,10 @@
using namespace ::ooo::vba;
using namespace ::com::sun::star;
-// fails silently
-void
-VbaDialogBase::Show() throw(uno::RuntimeException)
+sal_Bool SAL_CALL VbaDialogBase::Show() throw ( uno::RuntimeException )
{
rtl::OUString aURL;
+ sal_Bool bSuccess = sal_False;
if ( m_xModel.is() )
{
aURL = mapIndexToName( mnIndex );
@@ -42,7 +41,26 @@ VbaDialogBase::Show() throw(uno::RuntimeException)
throw uno::RuntimeException(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " Unable to open the specified dialog " ) ),
uno::Reference< XInterface > () );
- dispatchRequests( m_xModel, aURL );
+
+ uno::Sequence< beans::PropertyValue > dispatchProps(0);
+ if ( aURL.equalsAscii(".uno:PrinterSetup") )
+ {
+ dispatchProps.realloc(1);
+ dispatchProps[0].Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "VBADialogResultRequest" ) );
+ dispatchProps[0].Value <<= (sal_Bool) sal_True;
+ }
+
+ VBADispatchListener *pNotificationListener = new VBADispatchListener();
+ uno::Reference< frame::XDispatchResultListener > rListener = pNotificationListener;
+ dispatchRequests( m_xModel, aURL, dispatchProps, rListener, sal_False );
+
+ bSuccess = pNotificationListener->getState();
+ uno::Any aResult = pNotificationListener->getResult();
+ if ( bSuccess )
+ {
+ if ( aResult.getValueTypeClass() == uno::TypeClass_BOOLEAN )
+ aResult >>= bSuccess;
+ }
}
+ return bSuccess;
}
-
diff --git a/vbahelper/source/vbahelper/vbadocumentbase.cxx b/vbahelper/source/vbahelper/vbadocumentbase.cxx
index 65f7f4bcfbeb..b4a7a12872f6 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -33,6 +33,7 @@
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/document/XEmbeddedScripts.hpp> //Michael E. Bohn
#include <com/sun/star/beans/XPropertySet.hpp>
@@ -68,13 +69,8 @@ VbaDocumentBase::getName() throw (uno::RuntimeException)
}
else
{
- const static rtl::OUString sTitle( RTL_CONSTASCII_USTRINGPARAM("Title" ) );
- // process "UntitledX - $(PRODUCTNAME)"
- uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xProps( xFrame, uno::UNO_QUERY_THROW );
- xProps->getPropertyValue(sTitle ) >>= sName;
- sal_Int32 pos = 0;
- sName = sName.getToken(0,' ',pos);
+ uno::Reference< frame::XTitle > xTitle( getModel(), uno::UNO_QUERY_THROW );
+ sName = xTitle->getTitle();
}
return sName;
}
@@ -130,12 +126,20 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
uno::Reference< util::XCloseable > xCloseable( getModel(), uno::UNO_QUERY );
if( xCloseable.is() )
+ {
// use close(boolean DeliverOwnership)
// The boolean parameter DeliverOwnership tells objects vetoing the close process that they may
// assume ownership if they object the closure by throwing a CloseVetoException
// Here we give up ownership. To be on the safe side, catch possible veto exception anyway.
- xCloseable->close(sal_True);
+ try{
+ xCloseable->close(sal_True);
+ }
+ catch( util::CloseVetoException )
+ {
+ //close is cancelled, nothing to do
+ }
+ }
// If close is not supported by this model - try to dispose it.
// But if the model disagree with a reset request for the modify state
// we shouldn't do so. Otherwhise some strange things can happen.
@@ -143,7 +147,16 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
{
uno::Reference< lang::XComponent > xDisposable ( getModel(), uno::UNO_QUERY );
if ( xDisposable.is() )
- xDisposable->dispose();
+ {
+ // To be on the safe side, catch possible veto exception anyway.
+ try
+ {
+ xDisposable->dispose();
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
}
}
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index 2d4175b90939..194651e957fb 100644
--- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
@@ -34,6 +34,7 @@
#include <com/sun/star/lang/XComponent.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XFrame.hpp>
+#include <com/sun/star/frame/XTitle.hpp>
#include <com/sun/star/frame/FrameSearchFlag.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#include <com/sun/star/frame/XStorable.hpp>
@@ -49,6 +50,7 @@
#include <sfx2/objsh.hxx>
#include <tools/urlobj.hxx>
#include <vbahelper/vbahelper.hxx>
+#include <vbahelper/vbadocumentbase.hxx>
#include <hash_map>
#include <osl/file.hxx>
@@ -143,8 +145,13 @@ public:
{
uno::Reference< frame::XModel > xModel( xServiceInfo, uno::UNO_QUERY_THROW ); // that the spreadsheetdocument is a xmodel is a given
m_documents.push_back( xModel );
- INetURLObject aURL( xModel->getURL() );
- namesToIndices[ aURL.GetLastName() ] = nIndex++;
+ rtl::OUString sName;
+ uno::Reference< ::ooo::vba::XDocumentBase > xVbaDocument = new VbaDocumentBase( uno::Reference< XHelperInterface >(), xContext, xModel );
+ if ( xVbaDocument.is() )
+ {
+ sName = xVbaDocument->getName();
+ }
+ namesToIndices[ sName ] = nIndex++;
}
}
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 14f4e3ff1363..9ba6e3fbafe0 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -32,6 +32,7 @@
#include <com/sun/star/frame/XDesktop.hpp>
#include <com/sun/star/frame/XController.hpp>
#include <com/sun/star/frame/XModel2.hpp>
+#include <com/sun/star/frame/XNotifyingDispatch.hpp>
#include <com/sun/star/script/XDefaultProperty.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/lang/XMultiComponentFactory.hpp>
@@ -311,7 +312,7 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
}
void
-dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUString& aUrl, const uno::Sequence< beans::PropertyValue >& sProps )
+dispatchRequests (const uno::Reference< frame::XModel>& xModel, const rtl::OUString & aUrl, const uno::Sequence< beans::PropertyValue >& sProps, const uno::Reference< frame::XDispatchResultListener >& rListener, const sal_Bool bSilent )
{
util::URL url;
url.Complete = aUrl;
@@ -343,6 +344,7 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
}
uno::Reference<frame::XDispatch> xDispatcher = xDispatchProvider->queryDispatch(url,emptyString,0);
+ uno::Reference< frame::XNotifyingDispatch > xNotifyingDispatcher( xDispatcher, uno::UNO_QUERY );
uno::Sequence<beans::PropertyValue> dispatchProps(1);
@@ -358,11 +360,20 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
*pDest = *pSrc;
}
- (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
- (*pDest).Value <<= (sal_Bool)sal_True;
+ if ( bSilent )
+ {
+ (*pDest).Name = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Silent" ));
+ (*pDest).Value <<= (sal_Bool)sal_True;
+ }
- if (xDispatcher.is())
+ if ( !rListener.is() && xDispatcher.is() )
+ {
xDispatcher->dispatch( url, dispatchProps );
+ }
+ else if ( rListener.is() && xNotifyingDispatcher.is() )
+ {
+ xNotifyingDispatcher->dispatchWithNotification( url, dispatchProps, rListener );
+ }
}
void
@@ -959,6 +970,23 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue
throw uno::RuntimeException();
}
+uno::Any getDefaultPropByIntrospection( const uno::Any& aObj ) throw ( uno::RuntimeException )
+{
+ uno::Any aValue;
+ uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
+ uno::Reference< script::XDefaultProperty > xDefaultProperty( aObj, uno::UNO_QUERY_THROW );
+ uno::Reference< beans::XPropertySet > xPropSet;
+
+ if ( xUnoAccess.is() )
+ xPropSet.set( xUnoAccess->queryAdapter( ::getCppuType( (const uno::Reference< beans::XPropertySet > *)0 ) ), uno::UNO_QUERY );
+
+ if ( xPropSet.is() )
+ aValue = xPropSet->getPropertyValue( xDefaultProperty->getDefaultPropertyName() );
+ else
+ throw uno::RuntimeException();
+ return aValue;
+}
+
uno::Any getPropertyValue( const uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName )
{
uno::Any result;
@@ -986,6 +1014,18 @@ sal_Bool setPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const r
return sal_False;
}
+void setOrAppendPropertyValue( uno::Sequence< beans::PropertyValue >& aProp, const rtl::OUString& aName, const uno::Any& aValue )
+{
+ if( setPropertyValue( aProp, aName, aValue ) )
+ return;
+
+ // append the property
+ sal_Int32 nLength = aProp.getLength();
+ aProp.realloc( nLength + 1 );
+ aProp[ nLength ].Name = aName;
+ aProp[ nLength ].Value = aValue;
+}
+
// ====UserFormGeomentryHelper====
//---------------------------------------------
UserFormGeometryHelper::UserFormGeometryHelper( const uno::Reference< uno::XComponentContext >& /*xContext*/, const uno::Reference< awt::XControl >& xControl )
@@ -1448,6 +1488,28 @@ void UserFormGeometryHelper::setHeight( double nHeight )
return xIf;
}
+ // Listener for XNotifyingDispatch
+ VBADispatchListener::VBADispatchListener() : m_State( sal_False )
+ {
+ }
+
+ // Listener for XNotifyingDispatch
+ VBADispatchListener::~VBADispatchListener()
+ {
+ }
+
+ // Listener for XNotifyingDispatch
+ void SAL_CALL VBADispatchListener::dispatchFinished( const frame::DispatchResultEvent& aEvent ) throw ( uno::RuntimeException )
+ {
+ m_Result = aEvent.Result;
+ m_State = ( aEvent.State == frame::DispatchResultState::SUCCESS ) ? sal_True : sal_False;
+ }
+
+ // Listener for XNotifyingDispatch
+ void SAL_CALL VBADispatchListener::disposing( const lang::EventObject& /*aEvent*/ ) throw( uno::RuntimeException )
+ {
+ }
+
SfxObjectShell* getSfxObjShell( const uno::Reference< frame::XModel >& xModel ) throw (uno::RuntimeException)
{
SfxObjectShell* pFoundShell = NULL;
diff --git a/vbahelper/source/vbahelper/vbapictureformat.cxx b/vbahelper/source/vbahelper/vbapictureformat.cxx
index 7ebbb62d1125..5c0eeffac958 100644
--- a/vbahelper/source/vbahelper/vbapictureformat.cxx
+++ b/vbahelper/source/vbahelper/vbapictureformat.cxx
@@ -112,13 +112,14 @@ ScVbaPictureFormat::IncrementContrast( double increment ) throw (uno::RuntimeExc
{
double nContrast = getContrast();
nContrast += increment;
- if( increment < 0 )
+ //VBA, minz@cn.ibm.com.
+ if( nContrast < 0 )
{
- increment = 0.0;
+ nContrast = 0.0;
}
- if( increment > 1 )
+ if( nContrast > 1 )
{
- increment = 1.0;
+ nContrast = 1.0;
}
setContrast( nContrast );
}
diff --git a/vbahelper/source/vbahelper/vbashape.cxx b/vbahelper/source/vbahelper/vbashape.cxx
index 485ebee3ea8d..2073642251cf 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -35,6 +35,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/text/TextContentAnchorType.hpp>
+#include <com/sun/star/text/RelOrientation.hpp>
#include <ooo/vba/word/WdRelativeHorizontalPosition.hpp>
#include <ooo/vba/word/WdRelativeVerticalPosition.hpp>
@@ -219,25 +220,66 @@ ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
double SAL_CALL
ScVbaShape::getLeft() throw (uno::RuntimeException)
{
- return m_pShapeHelper->getLeft();
+ double left = 0;
+ try
+ {
+ left = m_pShapeHelper->getLeft();
+ }
+ catch( uno::Exception& )
+ {
+ // fail to get position by using XShape::getPosition()
+ sal_Int32 nLeft = 0;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientPosition") ) ) >>= nLeft;
+ left = Millimeter::getInPoints( nLeft );
+ }
+ return left;
}
void SAL_CALL
ScVbaShape::setLeft( double _left ) throw (uno::RuntimeException)
{
- m_pShapeHelper->setLeft( _left );
+ try
+ {
+ m_pShapeHelper->setLeft( _left );
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nLeft = 0;
+ nLeft = Millimeter::getInHundredthsOfOneMillimeter( _left );
+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "HoriOrientPosition" ), uno::makeAny( nLeft ) );
+ }
}
double SAL_CALL
ScVbaShape::getTop() throw (uno::RuntimeException)
{
- return m_pShapeHelper->getTop();
+ double top = 0;
+ try
+ {
+ top = m_pShapeHelper->getTop();
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nTop = 0;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientPosition") ) ) >>= nTop;
+ top = Millimeter::getInPoints( nTop );
+ }
+ return top;
}
void SAL_CALL
ScVbaShape::setTop( double _top ) throw (uno::RuntimeException)
{
- return m_pShapeHelper->setTop( _top );
+ try
+ {
+ m_pShapeHelper->setTop( _top );
+ }
+ catch( uno::Exception& )
+ {
+ sal_Int32 nTop = 0;
+ nTop = Millimeter::getInHundredthsOfOneMillimeter( _top );
+ m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "VertOrientPosition" ), uno::makeAny( nTop ) );
+ }
}
sal_Bool SAL_CALL
@@ -474,6 +516,17 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
return uno::makeAny( xShapeRange );
}
+void SAL_CALL ScVbaShape::Copy() throw (uno::RuntimeException)
+{
+ if ( m_xModel.is() )
+ {
+ Select( uno::Any() );
+ // Copy this Shape.
+ rtl::OUString sUrl = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(".uno:Copy") );
+ dispatchRequests( m_xModel, sUrl );
+ }
+}
+
sal_Bool SAL_CALL
ScVbaShape::getLockAspectRatio() throw (uno::RuntimeException)
{
@@ -504,35 +557,34 @@ sal_Int32 SAL_CALL
ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
{
sal_Int32 nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
- switch( eType )
+ switch( nType )
{
- case text::TextContentAnchorType_AT_PARAGRAPH:
+ case text::RelOrientation::FRAME:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn;
break;
}
- case text::TextContentAnchorType_AT_PAGE:
+ case text::RelOrientation::PAGE_FRAME:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage;
break;
}
- case text::TextContentAnchorType_AT_CHARACTER:
+ case text::RelOrientation::CHAR:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter;
break;
}
- case text::TextContentAnchorType_AT_FRAME:
- case text::TextContentAnchorType_AS_CHARACTER:
+ case text::RelOrientation::PAGE_PRINT_AREA:
{
nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
break;
}
default:
{
- nRelativeHorizontalPosition = word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin;
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeHorizontalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
}
}
return nRelativeHorizontalPosition;
@@ -541,23 +593,27 @@ ScVbaShape::getRelativeHorizontalPosition() throw (uno::RuntimeException)
void SAL_CALL
ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalposition ) throw (uno::RuntimeException)
{
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
switch( _relativehorizontalposition )
{
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionCharacter:
{
- eType = text::TextContentAnchorType_AT_CHARACTER;
+ nType = text::RelOrientation::CHAR;
break;
}
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionColumn:
+ {
+ nType = text::RelOrientation::PAGE_FRAME;
+ break;
+ }
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionMargin:
{
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
break;
}
case word::WdRelativeHorizontalPosition::wdRelativeHorizontalPositionPage:
{
- eType = text::TextContentAnchorType_AT_PAGE;
+ nType = text::RelOrientation::PAGE_FRAME;
break;
}
default:
@@ -565,42 +621,41 @@ ScVbaShape::setRelativeHorizontalPosition( ::sal_Int32 _relativehorizontalpositi
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
}
}
- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ), uno::makeAny( nType ) );
}
sal_Int32 SAL_CALL
ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
{
sal_Int32 nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
- m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ) ) >>= eType;
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
- switch( eType )
+ switch( nType )
{
- case text::TextContentAnchorType_AT_PARAGRAPH:
+ case text::RelOrientation::FRAME:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph;
break;
}
- case text::TextContentAnchorType_AT_PAGE:
+ case text::RelOrientation::PAGE_FRAME:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage;
break;
}
- case text::TextContentAnchorType_AT_CHARACTER:
+ case text::RelOrientation::TEXT_LINE:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine;
break;
}
- case text::TextContentAnchorType_AT_FRAME:
- case text::TextContentAnchorType_AS_CHARACTER:
+ case text::RelOrientation::PAGE_PRINT_AREA:
{
nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
break;
}
default:
{
- nRelativeVerticalPosition = word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin;
+ throw uno::RuntimeException( rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( "Shape::RelativeVerticalPosition: not implemented" ) ), uno::Reference< uno::XInterface >() );
}
}
return nRelativeVerticalPosition;
@@ -609,23 +664,27 @@ ScVbaShape::getRelativeVerticalPosition() throw (uno::RuntimeException)
void SAL_CALL
ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition ) throw (uno::RuntimeException)
{
- text::TextContentAnchorType eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
switch( _relativeverticalposition )
{
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionLine:
{
- eType = text::TextContentAnchorType_AT_CHARACTER;
+ nType = text::RelOrientation::TEXT_LINE;
break;
}
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionParagraph:
+ {
+ nType = text::RelOrientation::FRAME;
+ break;
+ }
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionMargin:
{
- eType = text::TextContentAnchorType_AT_PARAGRAPH;
+ nType = text::RelOrientation::PAGE_PRINT_AREA;
break;
}
case word::WdRelativeVerticalPosition::wdRelativeVerticalPositionPage:
{
- eType = text::TextContentAnchorType_AT_PAGE;
+ nType = text::RelOrientation::PAGE_FRAME;
break;
}
default:
@@ -633,7 +692,7 @@ ScVbaShape::setRelativeVerticalPosition( ::sal_Int32 _relativeverticalposition )
DebugHelper::exception(SbERR_BAD_ARGUMENT, rtl::OUString());
}
}
- m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("AnchorType") ), uno::makeAny( eType ) );
+ m_xPropertySet->setPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ), uno::makeAny( nType ) );
}
uno::Any SAL_CALL
diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx
index 3020cfa47eca..d8dd753f24eb 100644
--- a/vbahelper/source/vbahelper/vbashaperange.cxx
+++ b/vbahelper/source/vbahelper/vbashaperange.cxx
@@ -125,6 +125,27 @@ ScVbaShapeRange::IncrementTop( double Increment ) throw (uno::RuntimeException)
}
}
+rtl::OUString SAL_CALL ScVbaShapeRange::getName() throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ return xShape->getName( );
+ }
+ throw uno::RuntimeException();
+}
+
+void SAL_CALL ScVbaShapeRange::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ xShape->setName( _name );
+ }
+}
+
double SAL_CALL ScVbaShapeRange::getHeight() throw (uno::RuntimeException)
{
sal_Int32 nLen = getCount();
@@ -337,6 +358,16 @@ uno::Any SAL_CALL ScVbaShapeRange::WrapFormat( ) throw (css::uno::RuntimeExcept
throw uno::RuntimeException();
}
+void SAL_CALL ScVbaShapeRange::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
+{
+ sal_Int32 nLen = getCount();
+ for ( sal_Int32 index = 1; index <= nLen; ++index )
+ {
+ uno::Reference< msforms::XShape > xShape( Item( uno::makeAny( index ), uno::Any() ), uno::UNO_QUERY_THROW );
+ xShape->ZOrder( ZOrderCmd );
+ }
+}
+
uno::Type SAL_CALL
ScVbaShapeRange::getElementType() throw (uno::RuntimeException)
{
diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx
index 37952ee3d3a3..f3abf739635a 100644
--- a/vbahelper/source/vbahelper/vbashapes.cxx
+++ b/vbahelper/source/vbahelper/vbashapes.cxx
@@ -86,7 +86,7 @@ void ScVbaShapes::initBaseCollection()
m_xNameAccess.set( xShapes, uno::UNO_QUERY );
}
-ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes ), m_nNewShapeCount(0), m_xModel( xModel )
+ScVbaShapes::ScVbaShapes( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::container::XIndexAccess > xShapes, const uno::Reference< frame::XModel>& xModel ): ScVbaShapes_BASE( xParent, xContext, xShapes, sal_True ), m_nNewShapeCount(0), m_xModel( xModel )
{
m_xShapes.set( xShapes, uno::UNO_QUERY_THROW );
m_xDrawPage.set( xShapes, uno::UNO_QUERY_THROW );
diff --git a/vbahelper/util/makefile.mk b/vbahelper/util/makefile.mk
index dda4be0cbc81..33c49003d989 100644
--- a/vbahelper/util/makefile.mk
+++ b/vbahelper/util/makefile.mk
@@ -95,6 +95,7 @@ SHL2STDLIBS= \
$(VCLLIB) \
$(TKLIB) \
$(BASICLIB) \
+ $(SVXMSFILTERLIB) \
SHL2DEPN=$(SHL1TARGETN)
SHL2LIBS=$(SLB)$/$(TARGET_MSFORMS).lib
diff --git a/xmloff/inc/xmlnmspe.hxx b/xmloff/inc/xmlnmspe.hxx
index 7b7b7e131ec7..48a4d9f0cb06 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -104,6 +104,7 @@ XML_OLD_NAMESPACE( META, 6U )
// experimental namespaces
XML_NAMESPACE( FIELD, 100U )
+XML_NAMESPACE( FORMX, 101U ) // form interop extensions
#endif // _XMLOFF_XMLNMSPE_HXX
diff --git a/xmloff/inc/xmloff/shapeexport.hxx b/xmloff/inc/xmloff/shapeexport.hxx
index e583a208fd83..184ce69c9188 100644
--- a/xmloff/inc/xmloff/shapeexport.hxx
+++ b/xmloff/inc/xmloff/shapeexport.hxx
@@ -199,11 +199,6 @@ private:
const rtl::OUString msStartShape;
const rtl::OUString msEndShape;
const rtl::OUString msOnClick;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- const rtl::OUString msOnAction;
- const rtl::OUString msAction;
- const rtl::OUString msURL;
-#endif
const rtl::OUString msEventType;
const rtl::OUString msPresentation;
const rtl::OUString msMacroName;
diff --git a/xmloff/inc/xmloff/xmltoken.hxx b/xmloff/inc/xmloff/xmltoken.hxx
index 1c0b88f5d691..9e2559d9904b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -145,6 +145,10 @@ namespace xmloff { namespace token {
XML_NP_OFFICE_EXT,
XML_N_OFFICE_EXT,
+ // jonp: 2008-09-24 Excel Interop
+ XML_NP_FORMX,
+ XML_N_FORMX,
+
XML_NP_TABLE_EXT,
XML_N_TABLE_EXT,
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index b1ba8520c1db..99dfe94425a0 100644
--- a/xmloff/source/core/xmlexp.cxx
+++ b/xmloff/source/core/xmlexp.cxx
@@ -409,6 +409,7 @@ void SvXMLExport::_InitCtor()
mpNamespaceMap->Add( GetXMLToken(XML_NP_XSD), GetXMLToken(XML_N_XSD), XML_NAMESPACE_XSD );
mpNamespaceMap->Add( GetXMLToken(XML_NP_XSI), GetXMLToken(XML_N_XSI), XML_NAMESPACE_XSI );
mpNamespaceMap->Add( GetXMLToken(XML_NP_FIELD), GetXMLToken(XML_N_FIELD), XML_NAMESPACE_FIELD );
+ mpNamespaceMap->Add( GetXMLToken(XML_NP_FORMX), GetXMLToken(XML_N_FORMX), XML_NAMESPACE_FORMX );
}
// RDFa: needed for content and header/footer styles
if( (getExportFlags() & (EXPORT_STYLES|EXPORT_AUTOSTYLES|EXPORT_MASTERSTYLES|EXPORT_CONTENT) ) != 0 )
diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx
index c791fe4077d4..ee6de7d706c2 100644
--- a/xmloff/source/core/xmlimp.cxx
+++ b/xmloff/source/core/xmlimp.cxx
@@ -115,6 +115,7 @@ sal_Char __READONLY_DATA sXML_np__script[] = "_script";
sal_Char __READONLY_DATA sXML_np__config[] = "_config";
sal_Char __READONLY_DATA sXML_np__db[] = "_db";
sal_Char __READONLY_DATA sXML_np__xforms[] = "_xforms";
+sal_Char __READONLY_DATA sXML_np__formx[] = "_formx";
sal_Char __READONLY_DATA sXML_np__xsd[] = "_xsd";
sal_Char __READONLY_DATA sXML_np__xsi[] = "_xsi";
sal_Char __READONLY_DATA sXML_np__field[] = "_field";
@@ -309,6 +310,9 @@ void SvXMLImport::_InitCtor()
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xforms) ),
GetXMLToken(XML_N_XFORMS_1_0),
XML_NAMESPACE_XFORMS );
+ mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__formx) ),
+ GetXMLToken( XML_N_FORMX ),
+ XML_NAMESPACE_FORMX );
mpNamespaceMap->Add( OUString( RTL_CONSTASCII_USTRINGPARAM ( sXML_np__xsd) ),
GetXMLToken(XML_N_XSD),
XML_NAMESPACE_XSD );
diff --git a/xmloff/source/core/xmltoken.cxx b/xmloff/source/core/xmltoken.cxx
index 7538003a86fb..2c6ccb7b58e5 100644
--- a/xmloff/source/core/xmltoken.cxx
+++ b/xmloff/source/core/xmltoken.cxx
@@ -153,6 +153,9 @@ namespace xmloff { namespace token {
TOKEN( "officeooo", XML_NP_OFFICE_EXT ),
TOKEN( "http://openoffice.org/2009/office", XML_N_OFFICE_EXT ),
+ // jonp: 2008-09-24 Excel Interop
+ TOKEN( "formx", XML_NP_FORMX ),
+ TOKEN( "urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0", XML_N_FORMX ),
TOKEN( "tableooo", XML_NP_TABLE_EXT ),
TOKEN( "http://openoffice.org/2009/table", XML_N_TABLE_EXT ),
diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx
index ad559bc0bf45..3a346d070af9 100644
--- a/xmloff/source/draw/eventimp.cxx
+++ b/xmloff/source/draw/eventimp.cxx
@@ -101,9 +101,6 @@ public:
sal_Bool mbValid;
sal_Bool mbScript;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- sal_Bool mbActionEvent;
-#endif
ClickAction meClickAction;
XMLEffect meEffect;
XMLEffectDirection meDirection;
@@ -115,9 +112,6 @@ public:
OUString msMacroName;
OUString msBookmark;
OUString msLanguage;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- OUString msHyperURL;
-#endif
};
///////////////////////////////////////////////////////////////////////
@@ -176,18 +170,11 @@ TYPEINIT1( SdXMLEventContext, SvXMLImportContext );
SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XShape >& rxShape )
: SvXMLImportContext(rImp, nPrfx, rLocalName),
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- mxShape( rxShape ), mbScript( sal_False ), mbActionEvent( sal_False ), meClickAction( ClickAction_NONE ),
-#else
mxShape( rxShape ), mbScript( sal_False ), meClickAction( ClickAction_NONE ),
-#endif
meEffect( EK_none ), meDirection( ED_none ), mnStartScale( 100 ),
meSpeed( AnimationSpeed_MEDIUM ), mnVerb(0), mbPlayFull( sal_False )
{
static const OUString sXMLClickName( RTL_CONSTASCII_USTRINGPARAM( "click" ) );
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- static const OUString sXMLActionName( RTL_CONSTASCII_USTRINGPARAM( "action" ) );
-#endif
if( nPrfx == XML_NAMESPACE_PRESENTATION && IsXMLToken( rLocalName, XML_EVENT_LISTENER ) )
{
@@ -258,12 +245,7 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
sEventName = sValue;
sal_uInt16 nScriptPrefix =
GetImport().GetNamespaceMap().GetKeyByAttrName( sValue, &sEventName );
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- mbValid = XML_NAMESPACE_DOM == nScriptPrefix && ( sEventName == sXMLClickName || sEventName == sXMLActionName );
- mbActionEvent = mbValid && (sEventName == sXMLActionName);
-#else
mbValid = XML_NAMESPACE_DOM == nScriptPrefix && sEventName == sXMLClickName;
-#endif
}
else if( IsXMLToken( aAttrLocalName, XML_LANGUAGE ) )
{
@@ -292,12 +274,6 @@ SdXMLEventContext::SdXMLEventContext( SvXMLImport& rImp, sal_uInt16 nPrfx, cons
{
msMacroName = sValue;
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if ( mbActionEvent )
- {
- msHyperURL = sValue;
- }
-#endif
else
{
const rtl::OUString &rTmp =
@@ -343,26 +319,6 @@ void SdXMLEventContext::EndElement()
OUString sAPIEventName;
uno::Sequence< beans::PropertyValue > aProperties;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- if( mbActionEvent )
- {
- sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnAction" ) );
- aProperties.realloc( 2 );
- beans::PropertyValue* pProperty = aProperties.getArray();
-
- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
- pProperty->Handle = -1;
- pProperty->Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "Action" ) );
- pProperty->State = beans::PropertyState_DIRECT_VALUE;
- ++pProperty;
- pProperty->Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- pProperty->Handle = -1;
- pProperty->Value <<= msHyperURL;
- pProperty->State = beans::PropertyState_DIRECT_VALUE;
- }
- else
-#endif
- {
sAPIEventName = OUString( RTL_CONSTASCII_USTRINGPARAM( "OnClick" ) );
if( mbScript )
@@ -547,8 +503,6 @@ void SdXMLEventContext::EndElement()
break;
}
}
- }
-
xEvents->replaceByName( sAPIEventName, uno::Any( aProperties ) );
} while(0);
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index d3dd99967ae9..099a396b11b9 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -90,11 +90,6 @@ XMLShapeExport::XMLShapeExport(SvXMLExport& rExp,
msStartShape( RTL_CONSTASCII_USTRINGPARAM("StartShape") ),
msEndShape( RTL_CONSTASCII_USTRINGPARAM("EndShape") ),
msOnClick( RTL_CONSTASCII_USTRINGPARAM("OnClick") ),
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- msOnAction( RTL_CONSTASCII_USTRINGPARAM("OnAction") ),
- msAction( RTL_CONSTASCII_USTRINGPARAM("Action") ),
- msURL( RTL_CONSTASCII_USTRINGPARAM("URL") ),
-#endif
msEventType( RTL_CONSTASCII_USTRINGPARAM("EventType") ),
msPresentation( RTL_CONSTASCII_USTRINGPARAM("Presentation") ),
msMacroName( RTL_CONSTASCII_USTRINGPARAM("MacroName") ),
diff --git a/xmloff/source/draw/shapeexport2.cxx b/xmloff/source/draw/shapeexport2.cxx
index d13b5e24e2db..e2df5ac126e4 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -293,9 +293,6 @@ const sal_Int32 FOUND_CLICKEVENTTYPE = 0x00000080;
const sal_Int32 FOUND_MACRO = 0x00000100;
const sal_Int32 FOUND_LIBRARY = 0x00000200;
const sal_Int32 FOUND_ACTIONEVENTTYPE = 0x00000400;
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
-const sal_Int32 FOUND_URL = 0x00000800;
-#endif
} // namespace
@@ -385,33 +382,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
}
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- // extract properties from "OnAction" event -------------------------------
-
- OUString aActionEventType;
- OUString aHyperURL;
-
- uno::Sequence< beans::PropertyValue > aActionProperties;
- if( xEvents->hasByName( msOnAction ) && (xEvents->getByName( msOnAction ) >>= aActionProperties) )
- {
- const beans::PropertyValue* pProperty = aActionProperties.getConstArray();
- const beans::PropertyValue* pPropertyEnd = pProperty + aActionProperties.getLength();
- for( ; pProperty != pPropertyEnd; ++pProperty )
- {
- if( ( ( nFound & FOUND_ACTIONEVENTTYPE ) == 0 ) && pProperty->Name == msEventType )
- {
- if( pProperty->Value >>= aActionEventType )
- nFound |= FOUND_ACTIONEVENTTYPE;
- }
- else if( ( ( nFound & FOUND_URL ) == 0 ) && ( pProperty->Name == msURL ) )
- {
- if( pProperty->Value >>= aHyperURL )
- nFound |= FOUND_URL;
- }
- }
- }
-#endif
-
// create the XML elements
if( aClickEventType == msPresentation )
@@ -563,15 +533,9 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
}
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- else if( aClickEventType == msScript || aActionEventType == msAction )
- {
- if( nFound & ( FOUND_MACRO | FOUND_URL ) )
-#else
else if( aClickEventType == msScript )
{
if( nFound & FOUND_MACRO )
-#endif
{
SvXMLElementExport aEventsElemt(mrExport, XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, sal_True, sal_True);
if ( nFound & FOUND_MACRO )
@@ -586,18 +550,6 @@ void XMLShapeExport::ImpExportEvents( const uno::Reference< drawing::XShape >& x
SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_SCRIPT, XML_EVENT_LISTENER, sal_True, sal_True);
}
-#ifdef ISSUE66550_HLINK_FOR_SHAPES
- if ( nFound & FOUND_URL )
- {
- OUString aEventQName(
- mrExport.GetNamespaceMap().GetQNameByKey(
- XML_NAMESPACE_DOM, OUString( RTL_CONSTASCII_USTRINGPARAM( "action" ) ) ) );
- mrExport.AddAttribute( XML_NAMESPACE_SCRIPT, XML_EVENT_NAME, aEventQName );
- mrExport.AddAttribute( XML_NAMESPACE_XLINK, XML_HREF, aHyperURL );
-
- SvXMLElementExport aEventElemt(mrExport, XML_NAMESPACE_PRESENTATION, XML_EVENT_LISTENER, sal_True, sal_True);
- }
-#endif
}
}
}
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index b073e1e28d40..19ad2e9acc32 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -374,9 +374,15 @@ void SdXMLShapeContext::EndElement()
if( msHyperlink.getLength() != 0 ) try
{
+ uno::Reference< beans::XPropertySet > xProp( mxShape, uno::UNO_QUERY );
+
+ rtl::OUString sLink( RTL_CONSTASCII_USTRINGPARAM( "Hyperlink" ) );
+ if ( xProp.is() && xProp->getPropertySetInfo()->hasPropertyByName( sLink ) )
+ xProp->setPropertyValue( sLink, uno::Any( msHyperlink ) );
+ Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY_THROW );
+ Reference< XNameReplace > xEvents( xEventsSupplier->getEvents(), UNO_QUERY_THROW );
const OUString sBookmark( RTL_CONSTASCII_USTRINGPARAM( "Bookmark" ) );
- Reference< XEventsSupplier > xEventsSupplier( mxShape, UNO_QUERY );
if( xEventsSupplier.is() )
{
const OUString sEventType( RTL_CONSTASCII_USTRINGPARAM( "EventType" ) );
@@ -3306,9 +3312,16 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
if( !mxImplContext.Is() )
{
- pContext = GetImport().GetShapeImport()->CreateFrameChildContext(
+
+ SvXMLShapeContext* pShapeContext= GetImport().GetShapeImport()->CreateFrameChildContext(
GetImport(), nPrefix, rLocalName, xAttrList, mxShapes, mxAttrList );
+ pContext = pShapeContext;
+
+ // propagate the hyperlink to child context
+ if ( msHyperlink.getLength() > 0 )
+ pShapeContext->setHyperlink( msHyperlink );
+
mxImplContext = pContext;
mbSupportsReplacement = IsXMLToken( rLocalName, XML_OBJECT ) ||
IsXMLToken( rLocalName, XML_OBJECT_OLE );
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index 115b06c4c2ad..39a52251efe2 100644
--- a/xmloff/source/forms/elementexport.cxx
+++ b/xmloff/source/forms/elementexport.cxx
@@ -1107,6 +1107,39 @@ namespace xmloff
}
// ----------------------------------
+ // the string properties
+ {
+ static sal_Int32 nStringPropertyAttributeIds[] =
+ { // attribute flags
+ SCA_GROUP_NAME
+ };
+ static const ::rtl::OUString* pStringPropertyNames[] =
+ { // property names
+ &PROPERTY_GROUP_NAME
+ };
+
+ sal_Int32 nIdCount = sizeof( nStringPropertyAttributeIds ) / sizeof( nStringPropertyAttributeIds[0] );
+ #if OSL_DEBUG_LEVEL > 0
+ sal_Int32 nNameCount = sizeof( pStringPropertyNames ) / sizeof( pStringPropertyNames[0] );
+ OSL_ENSURE( ( nIdCount == nNameCount ),
+ "OControlExport::exportSpecialAttributes: somebody tampered with the maps (2)!" );
+ #endif
+ for ( i = 0; i < nIdCount; ++i )
+ if ( nStringPropertyAttributeIds[i] & m_nIncludeSpecial )
+ {
+ exportStringPropertyAttribute(
+ OAttributeMetaData::getSpecialAttributeNamespace( nStringPropertyAttributeIds[i] ),
+ OAttributeMetaData::getSpecialAttributeName( nStringPropertyAttributeIds[i] ),
+ *( pStringPropertyNames[i] )
+ );
+ #if OSL_DEBUG_LEVEL > 0
+ // reset the bit for later checking
+ m_nIncludeSpecial = m_nIncludeSpecial & ~nStringPropertyAttributeIds[i];
+ #endif
+ }
+ }
+
+ // ----------------------------------
if ((SCA_MIN_VALUE | SCA_MAX_VALUE) & m_nIncludeSpecial)
{
// need to export the min value and the max value as attributes
@@ -1564,6 +1597,8 @@ namespace xmloff
}
if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_IMAGE_POSITION ) )
m_nIncludeSpecial |= SCA_IMAGE_POSITION;
+ if ( m_xPropertyInfo->hasPropertyByName( PROPERTY_GROUP_NAME ) )
+ m_nIncludeSpecial |= SCA_GROUP_NAME;
m_nIncludeDatabase = DA_DATA_FIELD | DA_INPUT_REQUIRED;
m_nIncludeEvents = EA_CONTROL_EVENTS | EA_ON_CHANGE;
break;
diff --git a/xmloff/source/forms/formattributes.cxx b/xmloff/source/forms/formattributes.cxx
index 0e2ef69ab9f8..fa51ffa9cfa2 100644
--- a/xmloff/source/forms/formattributes.cxx
+++ b/xmloff/source/forms/formattributes.cxx
@@ -192,6 +192,7 @@ namespace xmloff
case SCA_MAX_VALUE: return "max-value";
case SCA_MIN_VALUE: return "min-value";
case SCA_VALIDATION: return "validation";
+ case SCA_GROUP_NAME: return "group-name";
case SCA_MULTI_LINE: return "multi-line";
case SCA_AUTOMATIC_COMPLETION: return "auto-complete";
case SCA_MULTIPLE: return "multiple";
@@ -212,9 +213,12 @@ namespace xmloff
}
//---------------------------------------------------------------------
- sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 /*_nId*/)
+ sal_uInt16 OAttributeMetaData::getSpecialAttributeNamespace(sal_Int32 _nId)
{
- // nothing special here
+ switch( _nId )
+ {
+ case SCA_GROUP_NAME: return XML_NAMESPACE_FORMX;
+ }
return XML_NAMESPACE_FORM;
}
diff --git a/xmloff/source/forms/formattributes.hxx b/xmloff/source/forms/formattributes.hxx
index 121476a9b21c..e8a5dfc170c9 100644
--- a/xmloff/source/forms/formattributes.hxx
+++ b/xmloff/source/forms/formattributes.hxx
@@ -123,6 +123,7 @@ namespace xmloff
#define SCA_MAX_VALUE 0x00000002
#define SCA_MIN_VALUE 0x00000004
#define SCA_VALIDATION 0x00000008
+ #define SCA_GROUP_NAME 0x00000010
#define SCA_MULTI_LINE 0x00000020
#define SCA_AUTOMATIC_COMPLETION 0x00000080
#define SCA_MULTIPLE 0x00000100
diff --git a/xmloff/source/forms/layerimport.cxx b/xmloff/source/forms/layerimport.cxx
index 77d60f83ee49..8cc8f7012be2 100644
--- a/xmloff/source/forms/layerimport.cxx
+++ b/xmloff/source/forms/layerimport.cxx
@@ -95,6 +95,8 @@ OFormLayerXMLImport_Impl::OFormLayerXMLImport_Impl(SvXMLImport& _rImporter)
m_aAttributeMetaData.addStringProperty(
OAttributeMetaData::getCommonControlAttributeName(CCA_NAME), PROPERTY_NAME);
m_aAttributeMetaData.addStringProperty(
+ OAttributeMetaData::getSpecialAttributeName(SCA_GROUP_NAME), PROPERTY_GROUP_NAME);
+ m_aAttributeMetaData.addStringProperty(
OAttributeMetaData::getCommonControlAttributeName(CCA_IMAGE_DATA), PROPERTY_IMAGEURL);
m_aAttributeMetaData.addStringProperty(
OAttributeMetaData::getCommonControlAttributeName(CCA_LABEL), PROPERTY_LABEL);
diff --git a/xmloff/source/forms/strings.hxx b/xmloff/source/forms/strings.hxx
index 66a5f76786fe..92d82bc89832 100644
--- a/xmloff/source/forms/strings.hxx
+++ b/xmloff/source/forms/strings.hxx
@@ -205,6 +205,7 @@ namespace xmloff
XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_POSITION, "ImagePosition");
XMLFORM_CONSTASCII_STRING( PROPERTY_IMAGE_ALIGN, "ImageAlign");
XMLFORM_CONSTASCII_STRING( PROPERTY_SCALE_IMAGE, "ScaleImage");
+ XMLFORM_CONSTASCII_STRING( PROPERTY_GROUP_NAME, "GroupName");
XMLFORM_CONSTASCII_STRING( PROPERTY_BOUND_CELL, "BoundCell");
XMLFORM_CONSTASCII_STRING( PROPERTY_LIST_CELL_RANGE, "CellRange");
diff --git a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
index fca73bc0144a..2e1654adb1b1 100644
--- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
+++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
@@ -27,6 +27,8 @@
#ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
#define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
+#include <com/sun/star/frame/XModel.hpp>
+
#ifndef _COM_SUN_STAR_CONTAINER_XNAMECONTAINER_HXX_
#include <com/sun/star/container/XNameContainer.hpp>
#endif
@@ -51,7 +53,9 @@ void SAL_CALL exportDialogModel(
::com::sun::star::uno::Reference<
::com::sun::star::xml::sax::XExtendedDocumentHandler > const & xOut,
::com::sun::star::uno::Reference<
- ::com::sun::star::container::XNameContainer > const & xDialogModel )
+ ::com::sun::star::container::XNameContainer > const & xDialogModel,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (::com::sun::star::uno::Exception) );
//==============================================================================
@@ -60,7 +64,9 @@ SAL_CALL importDialogModel(
::com::sun::star::uno::Reference<
::com::sun::star::container::XNameContainer > const & xDialogModel,
::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > const & xContext )
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (::com::sun::star::uno::Exception) );
// additional functions for convenience
@@ -71,7 +77,9 @@ SAL_CALL exportDialogModel(
::com::sun::star::uno::Reference<
::com::sun::star::container::XNameContainer > const & xDialogModel,
::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > const & xContext )
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (::com::sun::star::uno::Exception) );
//==============================================================================
@@ -81,7 +89,9 @@ void SAL_CALL importDialogModel(
::com::sun::star::uno::Reference<
::com::sun::star::container::XNameContainer > const & xDialogModel,
::com::sun::star::uno::Reference<
- ::com::sun::star::uno::XComponentContext > const & xContext )
+ ::com::sun::star::uno::XComponentContext > const & xContext,
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (::com::sun::star::uno::Exception) );
}
diff --git a/xmlscript/source/xmldlg_imexp/exp_share.hxx b/xmlscript/source/xmldlg_imexp/exp_share.hxx
index a53d02393ae6..f96186448ea4 100644
--- a/xmlscript/source/xmldlg_imexp/exp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/exp_share.hxx
@@ -171,15 +171,17 @@ public:
//
void readDialogModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
+ void readMultiPageModel( StyleBag * all_styles )
+ SAL_THROW( (css::uno::Exception) );
void readButtonModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readEditModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
void readCheckBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readRadioButtonModel( StyleBag * all_styles )
+ void readRadioButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (css::uno::Exception) );
- void readComboBoxModel( StyleBag * all_styles )
+ void readComboBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (css::uno::Exception) );
void readCurrencyFieldModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
@@ -193,9 +195,9 @@ public:
SAL_THROW( (css::uno::Exception) );
void readGroupBoxModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readImageControlModel( StyleBag * all_styles )
+ void readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (css::uno::Exception) );
- void readListBoxModel( StyleBag * all_styles )
+ void readListBoxModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (css::uno::Exception) );
void readNumericFieldModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
@@ -209,7 +211,9 @@ public:
SAL_THROW( (css::uno::Exception) );
void readProgressBarModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
- void readScrollBarModel( StyleBag * all_styles )
+ void readScrollBarModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
+ SAL_THROW( (css::uno::Exception) );
+ void readSpinButtonModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (css::uno::Exception) );
void readFixedHyperLinkModel( StyleBag * all_styles )
SAL_THROW( (css::uno::Exception) );
diff --git a/xmlscript/source/xmldlg_imexp/imp_share.hxx b/xmlscript/source/xmldlg_imexp/imp_share.hxx
index 29966392e7a5..a13a205a7bf7 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -42,6 +42,7 @@
#include <com/sun/star/awt/FontEmphasisMark.hpp>
#include <com/sun/star/awt/FontRelief.hpp>
#include <com/sun/star/xml/input/XRoot.hpp>
+#include <com/sun/star/script/XLibraryContainer.hpp>
#include <vector>
@@ -128,6 +129,8 @@ struct DialogImport
css::uno::Reference< css::container::XNameContainer > _xDialogModel;
css::uno::Reference< css::lang::XMultiServiceFactory > _xDialogModelFactory;
+ css::uno::Reference< css::frame::XModel > _xDoc;
+ css::uno::Reference< css::script::XLibraryContainer > _xScriptLibraryContainer;
sal_Int32 XMLNS_DIALOGS_UID, XMLNS_SCRIPT_UID;
@@ -161,16 +164,20 @@ public:
inline DialogImport(
css::uno::Reference<css::uno::XComponentContext> const & xContext,
css::uno::Reference<css::container::XNameContainer>
- const & xDialogModel )
+ const & xDialogModel,
+ css::uno::Reference<css::frame::XModel> const & xDoc )
SAL_THROW( () )
: _xContext( xContext )
, _xDialogModel( xDialogModel )
- , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW )
+ , _xDialogModelFactory( xDialogModel, css::uno::UNO_QUERY_THROW ), _xDoc( xDoc )
{ OSL_ASSERT( _xDialogModel.is() && _xDialogModelFactory.is() &&
_xContext.is() ); }
virtual ~DialogImport()
SAL_THROW( () );
+ inline css::uno::Reference< css::frame::XModel > getDocOwner() { return _xDoc; }
+
+ css::uno::Reference< css::script::XLibraryContainer > getScriptLibraryContainer();
// XRoot
virtual void SAL_CALL startDocument(
css::uno::Reference< css::xml::input::XNamespaceMapping >
@@ -996,6 +1003,49 @@ public:
};
//==============================================================================
+class SpinButtonElement
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline SpinButtonElement(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
+//==============================================================================
+class MultiPage
+ : public ControlElement
+{
+public:
+ virtual css::uno::Reference< css::xml::input::XElement >
+ SAL_CALL startChildElement(
+ sal_Int32 nUid, ::rtl::OUString const & rLocalName,
+ css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+ virtual void SAL_CALL endElement()
+ throw (css::xml::sax::SAXException, css::uno::RuntimeException);
+
+ inline MultiPage(
+ ::rtl::OUString const & rLocalName,
+ css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
+ ElementBase * pParent, DialogImport * pImport )
+ SAL_THROW( () )
+ : ControlElement( rLocalName, xAttributes, pParent, pImport )
+ {}
+};
+
class ProgressBarElement
: public ControlElement
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
index 22c472ac1782..5e9937f061b0 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
@@ -41,6 +41,7 @@
using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
namespace xmlscript
{
@@ -70,7 +71,8 @@ Reference< io::XInputStream > InputStreamProvider::createInputStream()
//==================================================================================================
Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
Reference< container::XNameContainer > const & xDialogModel,
- Reference< XComponentContext > const & xContext )
+ Reference< XComponentContext > const & xContext,
+ Reference< XModel > const & xDocument )
SAL_THROW( (Exception) )
{
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
@@ -95,7 +97,7 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
Reference< io::XActiveDataSource > xSource( xHandler, UNO_QUERY );
xSource->setOutputStream( createOutputStream( &aBytes ) );
- exportDialogModel( xHandler, xDialogModel );
+ exportDialogModel( xHandler, xDialogModel, xDocument );
return new InputStreamProvider( aBytes );
}
@@ -104,7 +106,8 @@ Reference< io::XInputStreamProvider > SAL_CALL exportDialogModel(
void SAL_CALL importDialogModel(
Reference< io::XInputStream > xInput,
Reference< container::XNameContainer > const & xDialogModel,
- Reference< XComponentContext > const & xContext )
+ Reference< XComponentContext > const & xContext,
+ Reference< XModel > const & xDocument )
SAL_THROW( (Exception) )
{
Reference< lang::XMultiComponentFactory > xSMgr( xContext->getServiceManager() );
@@ -126,7 +129,7 @@ void SAL_CALL importDialogModel(
}
// error handler, entity resolver omitted for this helper function
- xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext ) );
+ xParser->setDocumentHandler( importDialogModel( xDialogModel, xContext, xDocument ) );
xml::sax::InputSource source;
source.aInputStream = xInput;
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
index 1d9e67d23d28..3cd7ff985eef 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -29,7 +29,16 @@
#include "precompiled_xmlscript.hxx"
#include "exp_share.hxx"
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
@@ -39,6 +48,66 @@ using ::rtl::OUString;
namespace xmlscript
{
+void lclExportBindableAndListSourceBits( Reference< frame::XModel > const & xDocument, const Reference< beans::XPropertySet >& _xProps, ElementDescriptor& rModel )
+{
+ Reference< lang::XMultiServiceFactory > xFac;
+ if ( xDocument.is() )
+ xFac.set( xDocument, uno::UNO_QUERY );
+
+ Reference< form::binding::XBindableValue > xBinding( _xProps, UNO_QUERY );
+
+ if ( xFac.is() && xBinding.is() )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xBindable( xBinding->getValueBinding(), UNO_QUERY );
+ if ( xBindable.is() )
+ {
+ table::CellAddress aAddress;
+ xBindable->getPropertyValue( OUSTR("BoundCell") ) >>= aAddress;
+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
+ rtl::OUString sAddress;
+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
+ if ( sAddress.getLength() > 0 )
+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":linked-cell"), sAddress );
+
+ OSL_TRACE( "*** Bindable value %s", rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
+
+ }
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ Reference< form::binding::XListEntrySink > xEntrySink( _xProps, UNO_QUERY );
+ if ( xEntrySink.is() )
+ {
+ Reference< beans::XPropertySet > xListSource( xEntrySink->getListEntrySource(), UNO_QUERY );
+ if ( xListSource.is() )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
+
+ table::CellRangeAddress aAddress;
+ xListSource->getPropertyValue( OUSTR( "CellRange" ) ) >>= aAddress;
+
+ rtl::OUString sAddress;
+ xConvertor->setPropertyValue( OUSTR("Address"), makeAny( aAddress ) );
+ xConvertor->getPropertyValue( OUSTR("PersistentRepresentation") ) >>= sAddress;
+ OSL_TRACE("**** cell range source list %s",
+ rtl::OUStringToOString( sAddress, RTL_TEXTENCODING_UTF8 ).getStr() );
+ if ( sAddress.getLength() > 0 );
+ rModel.addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":source-cell-range"), sAddress );
+ }
+ catch( uno::Exception& )
+ {
+ }
+ }
+ }
+
+}
static inline bool readBorderProps(
ElementDescriptor * element, Style & style )
{
@@ -65,6 +134,42 @@ static inline bool readFontProps( ElementDescriptor * element, Style & style )
}
//__________________________________________________________________________________________________
+void ElementDescriptor::readMultiPageModel( StyleBag * all_styles )
+{
+ // collect styles
+ Style aStyle( 0x2 | 0x8 | 0x20 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextColor") ) ) >>= aStyle._textColor)
+ aStyle._set |= 0x2;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("TextLineColor") ) ) >>= aStyle._textLineColor)
+ aStyle._set |= 0x20;
+ if (readFontProps( this, aStyle ))
+ aStyle._set |= 0x8;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+
+ OUString aTitle;
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ) ) >>= aTitle)
+ {
+ ElementDescriptor * title = new ElementDescriptor(
+ _xProps, _xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":title") ) );
+ title->addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ),
+ aTitle );
+ addSubElement( title );
+ }
+
+ readEvents();
+}
void ElementDescriptor::readButtonModel( StyleBag * all_styles )
SAL_THROW( (Exception) )
{
@@ -206,7 +311,7 @@ void ElementDescriptor::readCheckBoxModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
+void ElementDescriptor::readComboBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
// collect styles
@@ -247,7 +352,8 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineCount") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
-
+ // Cell Range, Ref Cell etc.
+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -273,7 +379,7 @@ void ElementDescriptor::readComboBoxModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
+void ElementDescriptor::readListBoxModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
// collect styles
@@ -308,7 +414,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":linecount") ) );
readAlignAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
-
+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
// string item list
Sequence< OUString > itemValues;
if ((readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ) ) >>= itemValues) &&
@@ -348,7 +454,7 @@ void ElementDescriptor::readListBoxModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
+void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
// collect styles
@@ -385,6 +491,8 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-position") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multiline") ) );
+ readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":group-name") ) );
sal_Int16 nState = 0;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ) ) >>= nState)
@@ -404,6 +512,7 @@ void ElementDescriptor::readRadioButtonModel( StyleBag * all_styles )
break;
}
}
+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
readEvents();
}
//__________________________________________________________________________________________________
@@ -576,7 +685,7 @@ void ElementDescriptor::readEditModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
+void ElementDescriptor::readImageControlModel( StyleBag * all_styles, com::sun::star::uno::Reference< com::sun::star::frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
// collect styles
@@ -595,8 +704,31 @@ void ElementDescriptor::readImageControlModel( StyleBag * all_styles )
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scale-image") ) );
- readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":src") ) );
+ rtl::OUString sURL;
+ _xProps->getPropertyValue( OUSTR("ImageURL") ) >>= sURL;
+
+ if ( sURL.indexOf( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.GraphicObject:" ) ) ) == 0 )
+ {
+ Reference< document::XStorageBasedDocument > xDocStorage( xDocument, UNO_QUERY );
+
+ if ( xDocStorage.is() )
+ {
+ uno::Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
+
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicExportHelper" ), aArgs, xGraphicResolver );
+ if ( xGraphicResolver.is() )
+ {
+ sURL = xGraphicResolver->resolveGraphicObjectURL( sURL );
+ }
+ }
+ }
+ if ( sURL.getLength() > 0 )
+ {
+ addAttribute( OUSTR(XMLNS_DIALOGS_PREFIX ":src"), sURL );
+ }
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
readEvents();
@@ -1073,7 +1205,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
readEvents();
}
//__________________________________________________________________________________________________
-void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
+void ElementDescriptor::readScrollBarModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
// collect styles
@@ -1111,6 +1243,47 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":live-scroll") ) );
readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
+ // Cell Range, Ref Cell etc.
+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
+ readEvents();
+}
+//__________________________________________________________________________________________________
+void ElementDescriptor::readSpinButtonModel( StyleBag * all_styles, Reference< frame::XModel > const & xDocument )
+ SAL_THROW( (Exception) )
+{
+ // collect styles
+ Style aStyle( 0x1 | 0x4 );
+ if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
+ aStyle._set |= 0x1;
+ if (readBorderProps( this, aStyle ))
+ aStyle._set |= 0x4;
+ if (aStyle._set)
+ {
+ addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
+ all_styles->getStyleId( aStyle ) );
+ }
+
+ // collect elements
+ readDefaults();
+ readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":increment") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":curval") ) );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxval") ) );
+ readLongAttr( OUSTR("SpinValueMin"),
+ OUSTR(XMLNS_DIALOGS_PREFIX ":minval") );
+ readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Repeat") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":repeat") ) );
+ readLongAttr( OUSTR("RepeatDelay"), OUSTR(XMLNS_DIALOGS_PREFIX ":repeat-delay") );
+ readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ readHexLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":symbol-color") ) );
+ // Cell Range, Ref Cell etc.
+ lclExportBindableAndListSourceBits( xDocument, _xProps, *this );
readEvents();
}
//__________________________________________________________________________________________________
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 365355375808..be4643f35222 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
@@ -1325,7 +1325,8 @@ void StyleBag::dump( Reference< xml::sax::XExtendedDocumentHandler > const & xOu
//==================================================================================================
void SAL_CALL exportDialogModel(
Reference< xml::sax::XExtendedDocumentHandler > const & xOut,
- Reference< container::XNameContainer > const & xDialogModel )
+ Reference< container::XNameContainer > const & xDialogModel,
+ Reference< frame::XModel > const & xDocument )
SAL_THROW( (Exception) )
{
StyleBag all_styles;
@@ -1373,7 +1374,7 @@ void SAL_CALL exportDialogModel(
xProps, xPropState,
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":radio") ) );
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readRadioButtonModel( &all_styles );
+ pElem->readRadioButtonModel( &all_styles, xDocument );
pRadioGroup->addSubElement( xElem );
}
else // no radio
@@ -1402,7 +1403,7 @@ void SAL_CALL exportDialogModel(
xProps, xPropState,
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":combobox") ) );
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readComboBoxModel( &all_styles );
+ pElem->readComboBoxModel( &all_styles, xDocument );
}
else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) ) )
{
@@ -1410,7 +1411,7 @@ void SAL_CALL exportDialogModel(
xProps, xPropState,
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":menulist") ) );
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readListBoxModel( &all_styles );
+ pElem->readListBoxModel( &all_styles, xDocument );
}
else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) ) )
{
@@ -1420,6 +1421,14 @@ void SAL_CALL exportDialogModel(
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
pElem->readGroupBoxModel( &all_styles );
}
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":multipage") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readMultiPageModel( &all_styles );
+ }
else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) ) )
{
pElem = new ElementDescriptor(
@@ -1451,7 +1460,7 @@ void SAL_CALL exportDialogModel(
xProps, xPropState,
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":img") ) );
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readImageControlModel( &all_styles );
+ pElem->readImageControlModel( &all_styles, xDocument );
}
else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) ) )
{
@@ -1531,7 +1540,15 @@ void SAL_CALL exportDialogModel(
xProps, xPropState,
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":scrollbar") ) );
xElem = static_cast< xml::sax::XAttributeList * >( pElem );
- pElem->readScrollBarModel( &all_styles );
+ pElem->readScrollBarModel( &all_styles, xDocument );
+ }
+ else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlSpinButtonModel") ) ) )
+ {
+ pElem = new ElementDescriptor(
+ xProps, xPropState,
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spinbutton") ) );
+ xElem = static_cast< xml::sax::XAttributeList * >( pElem );
+ pElem->readSpinButtonModel( &all_styles, xDocument );
}
else if (xServiceInfo->supportsService( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) ) )
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
index a0968eb007d5..420adb39787d 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -28,17 +28,195 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_xmlscript.hxx"
#include "imp_share.hxx"
-
+#include <com/sun/star/form/binding/XBindableValue.hpp>
+#include <com/sun/star/form/binding/XValueBinding.hpp>
+#include <com/sun/star/form/binding/XListEntrySink.hpp>
+#include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/table/CellAddress.hpp>
+#include <com/sun/star/table/CellRangeAddress.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/document/XGraphicObjectResolver.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
-
+#include <comphelper/componentcontext.hxx>
+#include <comphelper/processfactory.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using ::rtl::OUString;
namespace xmlscript
{
+Reference< xml::input::XElement > MultiPage::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+rtl::OUString _label = rtl::OUString::createFromAscii("foo");
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement(
+ nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("title") ))
+ {
+ getStringAttr( &_label,
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ xAttributes,
+ _pImport->XMLNS_DIALOGS_UID );
+
+ return new ElementBase(
+ _pImport->XMLNS_DIALOGS_UID,
+ rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+
+void MultiPage::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoMultiPageModel") ) );
+// OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlGroupBoxModel") ) );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ pStyle->importTextColorStyle( xControlModel );
+ pStyle->importTextLineColorStyle( xControlModel );
+ pStyle->importFontStyle( xControlModel );
+ }
+
+ ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("value-max") ),
+ _xAttributes );
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+// #FIXME cut'n'pasted from xmloff/source/core/xmlimp.cxx:1251
+// of course we need to find a common home for this helper
+
+bool IsPackageURL( const ::rtl::OUString& rURL )
+{
+ // Some quick tests: Some may rely on the package structure!
+ sal_Int32 nLen = rURL.getLength();
+ if( (nLen > 0 && '/' == rURL[0]) )
+ // RFC2396 net_path or abs_path
+ return false;
+ else if( nLen > 1 && '.' == rURL[0] )
+ {
+ if( '.' == rURL[1] )
+ // ../: We are never going up one level, so we know
+ // it's not an external URI
+ return false;
+ else if( '/' == rURL[1] )
+ // we are remaining on a level, so it's an package URI
+ return true;
+ }
+
+ // Now check for a RFC2396 schema
+ sal_Int32 nPos = 1;
+ while( nPos < nLen )
+ {
+ switch( rURL[nPos] )
+ {
+ case '/':
+ // a relative path segement
+ return true;
+ case ':':
+ // a schema
+ return false;
+ default:
+ break;
+ // we don't care about any other characters
+ }
+ ++nPos;
+ }
+
+ return true;
+}
+
+void importBindableAndListRangeBits( DialogImport* _pImport, const rtl::OUString sLinkedCell, const rtl::OUString & sCellRange, ControlImportContext& ctx )
+{
+ Reference< lang::XMultiServiceFactory > xFac( _pImport->getDocOwner(), UNO_QUERY );
+ if ( xFac.is() && ( sLinkedCell.getLength() || sCellRange.getLength() ) )
+ {
+ // Set up Celllink
+ if ( sLinkedCell.getLength() )
+ {
+ Reference< form::binding::XBindableValue > xBindable( ctx.getControlModel(), uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellAddressConversion" )), uno::UNO_QUERY );
+ if ( xBindable.is() && xConvertor.is() )
+ {
+ table::CellAddress aAddress;
+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sLinkedCell ) );
+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
+ beans::NamedValue aArg1;
+ aArg1.Name = OUSTR("BoundCell");
+ aArg1.Value <<= aAddress;
+
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= aArg1;
+
+ uno::Reference< form::binding::XValueBinding > xBinding( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellValueBinding" ), aArgs ), uno::UNO_QUERY );
+ xBindable->setValueBinding( xBinding );
+
+ }
+ }
+ // Set up CelllRange
+ if ( sCellRange.getLength() )
+ {
+ Reference< form::binding::XListEntrySink > xListEntrySink( ctx.getControlModel(), uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xConvertor( xFac->createInstance( OUSTR( "com.sun.star.table.CellRangeAddressConversion" )), uno::UNO_QUERY );
+ if ( xListEntrySink.is() && xConvertor.is() )
+ {
+ table::CellRangeAddress aAddress;
+ xConvertor->setPropertyValue( OUSTR( "PersistentRepresentation" ), uno::makeAny( sCellRange ) );
+ xConvertor->getPropertyValue( OUSTR( "Address" ) ) >>= aAddress;
+ beans::NamedValue aArg1;
+ aArg1.Name = OUSTR("CellRange");
+ aArg1.Value <<= aAddress;
+
+ uno::Sequence< uno::Any > aArgs(1);
+ aArgs[ 0 ] <<= aArg1;
+
+ uno::Reference< form::binding::XListEntrySource > xSource( xFac->createInstanceWithArguments( OUSTR("com.sun.star.table.CellRangeListSource" ), aArgs ), uno::UNO_QUERY );
+ xListEntrySink->setListEntrySource( xSource );
+
+ }
+ }
+ }
+}
+
+sal_Bool isVBACompatibilityMode( DialogImport* _pImport )
+{
+ sal_Bool bVBAMode = sal_False;
+ Reference< script::vba::XVBACompatibility > xVBACompat( _pImport->getScriptLibraryContainer(), UNO_QUERY );
+ if( xVBACompat.is() )
+ {
+ bVBAMode = xVBACompat->getVBACompatibilityMode();
+ }
+ return bVBAMode;
+}
// progessmeter
//__________________________________________________________________________________________________
@@ -119,9 +297,23 @@ Reference< xml::input::XElement > ScrollBarElement::startChildElement(
void ScrollBarElement::endElement()
throw (xml::sax::SAXException, RuntimeException)
{
+ OUString sService( OUSTR("com.sun.star.awt.UnoControlScrollBarModel") );
+ // we should probably limit this to vba mode also ( leave for now )
+ if ( isVBACompatibilityMode( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.ScrollBar");
+
+ OUString sLinkedCell;
+ try
+ {
+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
+
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlScrollBarModel") ) );
+ sService );
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
@@ -165,6 +357,92 @@ void ScrollBarElement::endElement()
OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
_xAttributes );
+ // import cell-link
+ OUString sCellRange;
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+
+ ctx.importEvents( _events );
+ // avoid ring-reference:
+ // vector< event elements > holding event elements holding this (via _pParent)
+ _events.clear();
+}
+
+//##################################################################################################
+
+// spinbutton
+//__________________________________________________________________________________________________
+Reference< xml::input::XElement > SpinButtonElement::startChildElement(
+ sal_Int32 nUid, OUString const & rLocalName,
+ Reference< xml::input::XAttributes > const & xAttributes )
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ // event
+ if (_pImport->isEventElement( nUid, rLocalName ))
+ {
+ return new EventElement( nUid, rLocalName, xAttributes, this, _pImport );
+ }
+ else
+ {
+ throw xml::sax::SAXException(
+ OUString( RTL_CONSTASCII_USTRINGPARAM("expected event element!") ),
+ Reference< XInterface >(), Any() );
+ }
+}
+//__________________________________________________________________________________________________
+void SpinButtonElement::endElement()
+ throw (xml::sax::SAXException, RuntimeException)
+{
+ OUString sLinkedCell;
+ try
+ {
+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
+
+ ControlImportContext ctx(
+ _pImport, getControlId( _xAttributes ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.form.component.SpinButton") ) );
+
+ Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
+ if (xStyle.is())
+ {
+ StyleElement * pStyle = static_cast< StyleElement * >( xStyle.get () );
+ Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
+ pStyle->importBackgroundColorStyle( xControlModel );
+ pStyle->importBorderStyle( xControlModel );
+ }
+
+ ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
+ ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinIncrement") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("increment") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValue") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("curval") ),
+ _xAttributes );
+ ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SpinValueMax") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("maxval") ),
+ _xAttributes );
+ ctx.importLongProperty( OUSTR("SpinValueMin"), OUSTR("minval"),
+ _xAttributes );
+ ctx.importLongProperty( OUSTR("Repeat"), OUSTR("repeat"),
+ _xAttributes );
+ ctx.importLongProperty( OUSTR("RepeatDelay"), OUSTR("repeat-delay"),
+ _xAttributes );
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
+ _xAttributes );
+ ctx.importHexLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SymbolColor") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("symbol-color") ),
+ _xAttributes );
+ // import cell-link
+ OUString sCellRange;
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -1003,9 +1281,37 @@ void ImageControlElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ScaleImage") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("scale-image") ),
_xAttributes );
- ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("src") ),
- _xAttributes );
+ rtl::OUString sURL = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "src" ) );
+ Reference< document::XStorageBasedDocument > xDocStorage( _pImport->getDocOwner(), UNO_QUERY );
+
+ if ( xDocStorage.is() && IsPackageURL( sURL ) )
+ {
+ uno::Sequence< Any > aArgs( 1 );
+ aArgs[ 0 ] <<= xDocStorage->getDocumentStorage();
+
+ ::comphelper::ComponentContext aContext( ::comphelper::getProcessServiceFactory() );
+ uno::Reference< document::XGraphicObjectResolver > xGraphicResolver;
+ aContext.createComponentWithArguments( OUSTR( "com.sun.star.comp.Svx.GraphicImportHelper" ), aArgs, xGraphicResolver );
+
+ if ( xGraphicResolver.is() )
+ {
+ rtl::OUString aTmp( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ aTmp += sURL;
+ sURL = xGraphicResolver->resolveGraphicObjectURL( aTmp );
+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
+ // we must set the url while the graphic object ( held by the resolver is in scope )
+ if ( xProps.is() )
+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
+ }
+ }
+
+ else if ( sURL.getLength() > 0 )
+ {
+ Reference< beans::XPropertySet > xProps( ctx.getControlModel(), UNO_QUERY );
+ if ( xProps.is() )
+ xProps->setPropertyValue( OUSTR("ImageURL"), makeAny( sURL ) );
+ }
+
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
_xAttributes );
@@ -1338,10 +1644,24 @@ void TitledBoxElement::endElement()
Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
Reference< xml::input::XAttributes > xAttributes(
xRadio->getAttributes() );
+ OUString sLinkedCell;
+ OUString sCellRange;
+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
+ try
+ {
+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ // we should probably limit this to vba mode also ( leave for now )
+ if ( isVBACompatibilityMode( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.RadioButton");
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
+
ControlImportContext ctx(
_pImport, getControlId( xAttributes ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
+ sService );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
@@ -1377,6 +1697,9 @@ void TitledBoxElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
+ xAttributes );
sal_Int16 nVal = 0;
sal_Bool bChecked = sal_False;
@@ -1390,7 +1713,7 @@ void TitledBoxElement::endElement()
}
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
makeAny( nVal ) );
-
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
::std::vector< Reference< xml::input::XElement > > * radioEvents =
static_cast< RadioElement * >( xRadio.get() )->getEvents();
ctx.importEvents( *radioEvents );
@@ -1466,10 +1789,23 @@ void RadioGroupElement::endElement()
Reference< xml::input::XElement > xRadio( _radios[ nPos ] );
Reference< xml::input::XAttributes > xAttributes(
xRadio->getAttributes() );
+ OUString sLinkedCell;
+ OUString sCellRange;
+ OUString sService( OUSTR("com.sun.star.awt.UnoControlRadioButtonModel") );
+ try
+ {
+ sLinkedCell = xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ // we should probably limit this to vba mode also ( leave for now )
+ if ( isVBACompatibilityMode( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.RadioButton");
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
ControlImportContext ctx(
_pImport, getControlId( xAttributes ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) );
+ sService );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
Reference< xml::input::XElement > xStyle( getStyle( xAttributes ) );
@@ -1505,6 +1841,9 @@ void RadioGroupElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("MultiLine") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
xAttributes );
+ ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("GroupName") ),
+ OUString( RTL_CONSTASCII_USTRINGPARAM("group-name") ),
+ xAttributes );
sal_Int16 nVal = 0;
sal_Bool bChecked = sal_False;
if (getBoolAttr( &bChecked,
@@ -1518,6 +1857,7 @@ void RadioGroupElement::endElement()
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
makeAny( nVal ) );
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
::std::vector< Reference< xml::input::XElement > > * radioEvents =
static_cast< RadioElement * >( xRadio.get() )->getEvents();
ctx.importEvents( *radioEvents );
@@ -1638,9 +1978,26 @@ Reference< xml::input::XElement > MenuListElement::startChildElement(
void MenuListElement::endElement()
throw (xml::sax::SAXException, RuntimeException)
{
+ OUString sLinkedCell;
+ OUString sCellRange;
+ OUString sListBoxService( OUSTR("com.sun.star.awt.UnoControlListBoxModel") );
+
+ // we should probably limit this to vba mode also ( leave for now )
+ if ( isVBACompatibilityMode( _pImport ) )
+ sListBoxService = OUSTR("com.sun.star.form.component.ListBox");
+
+ try
+ {
+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
+ //OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlListBoxModel") ) );
+ sListBoxService );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
@@ -1673,13 +2030,16 @@ void MenuListElement::endElement()
ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
_xAttributes );
-
+ // import cell-link and cell source range
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
if (_popup.is())
{
MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
+ if ( !sCellRange.getLength() )
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
makeAny( p->getItemValues() ) );
- xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
+ if ( !sLinkedCell.getLength() )
+ xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectedItems") ),
makeAny( p->getSelectedItems() ) );
}
ctx.importEvents( _events );
@@ -1725,9 +2085,26 @@ Reference< xml::input::XElement > ComboBoxElement::startChildElement(
void ComboBoxElement::endElement()
throw (xml::sax::SAXException, RuntimeException)
{
+ OUString sService( OUSTR("com.sun.star.awt.UnoControlComboBoxModel") );
+
+ // we should probably limit this to vba mode also ( leave for now )
+ if ( isVBACompatibilityMode( _pImport ) )
+ sService = OUSTR("com.sun.star.form.component.ComboBox");
+
+ OUString sLinkedCell;
+ OUString sCellRange;
+ try
+ {
+ sLinkedCell = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "linked-cell" ) );
+ sCellRange = _xAttributes->getValueByUidName( _pImport->XMLNS_DIALOGS_UID, OUSTR( "source-cell-range" ) );
+ }
+ catch( Exception& /*e*/ )
+ {
+ }
+
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlComboBoxModel") ) );
+ sService );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
@@ -1769,8 +2146,10 @@ void ComboBoxElement::endElement()
ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
_xAttributes );
+ // import cell-link and cell source range
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
- if (_popup.is())
+ if (_popup.is() && !sCellRange.getLength() )
{
MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
@@ -2096,11 +2475,20 @@ Reference< xml::input::XElement > BulletinBoardElement::startChildElement(
{
return new ScrollBarElement( rLocalName, xAttributes, this, _pImport );
}
+ // spinbutton
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("spinbutton") ) && isVBACompatibilityMode( _pImport ) )
+ {
+ return new SpinButtonElement( rLocalName, xAttributes, this, _pImport );
+ }
// progressmeter
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("progressmeter") ))
{
return new ProgressBarElement( rLocalName, xAttributes, this, _pImport );
}
+ else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("multipage") ))
+ {
+ return new MultiPage( rLocalName, xAttributes, this, _pImport );
+ }
// bulletinboard
else if (rLocalName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("bulletinboard") ))
{
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index 5fb2a39c6913..fb57c5acb769 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -57,9 +57,13 @@
#include <com/sun/star/script/ScriptEventDescriptor.hpp>
#include <com/sun/star/view/SelectionType.hpp>
+#include <com/sun/star/document/XStorageBasedDocument.hpp>
+#include <com/sun/star/script/DocumentScriptLibraryContainer.hpp>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::frame;
using ::rtl::OUString;
namespace xmlscript
@@ -1888,18 +1892,42 @@ Reference< xml::input::XElement > DialogImport::getStyle(
}
return 0;
}
+//__________________________________________________________________________________________________
+Reference< script::XLibraryContainer > DialogImport::getScriptLibraryContainer()
+{
+ if( !_xScriptLibraryContainer.is() )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProps( _xDoc, UNO_QUERY );
+ if( xProps.is() )
+ _xScriptLibraryContainer.set( xProps->getPropertyValue( OUSTR("BasicLibraries") ), UNO_QUERY );
+ }
+ catch( const Exception& )
+ {
+ }
+ }
+
+ return _xScriptLibraryContainer;
+}
//##################################################################################################
//==================================================================================================
Reference< xml::sax::XDocumentHandler > SAL_CALL importDialogModel(
Reference< container::XNameContainer > const & xDialogModel,
- Reference< XComponentContext > const & xContext )
+ Reference< XComponentContext > const & xContext,
+ Reference< XModel > const & xDocument )
SAL_THROW( (Exception) )
{
+ DialogImport* pImport = new DialogImport( xContext, xDialogModel, xDocument );
+ uno::Reference< script::vba::XVBACompatibility > xVBAModeSource( pImport->getScriptLibraryContainer(), uno::UNO_QUERY );
+
+ uno::Reference< beans::XPropertySet > xDlgProps( xDialogModel, uno::UNO_QUERY );
+ if ( xVBAModeSource.is() && xDlgProps.is() && xVBAModeSource->getVBACompatibilityMode() )
+ xDlgProps->setPropertyValue( OUSTR("VBAForm"), uno::makeAny( sal_True ) );
return ::xmlscript::createDocumentHandler(
- static_cast< xml::input::XRoot * >(
- new DialogImport( xContext, xDialogModel ) ) );
+ static_cast< xml::input::XRoot * >( pImport ) );
}
}
diff --git a/xmlscript/util/makefile.mk b/xmlscript/util/makefile.mk
index 3ccf63dc3b89..7a391cdcaaa9 100644
--- a/xmlscript/util/makefile.mk
+++ b/xmlscript/util/makefile.mk
@@ -54,6 +54,7 @@ SHL1LIBS= \
$(LIB1TARGET)
SHL1STDLIBS= \
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)