summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 10:51:50 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 10:51:50 +0100
commit606a57481911e111dfab950cd7fb90ae80aed014 (patch)
tree62e85311b32105e6d4e165d60c9d4bbdb80c03bc
parenta4d7dbf897e41a1afda6c2b6f0e5cc35920a1cf3 (diff)
parented49568618442960781b63c3a47ddc65031b2fa0 (diff)
Merge branch 'vba' fix conflics, trailing ws & tab issues
also removed some old headers ( which I need to add new ones for ) Conflicts: basic/source/classes/sbunoobj.cxx basic/source/classes/sbxmod.cxx xmloff/inc/xmlnmspe.hxx xmloff/inc/xmloff/xmltoken.hxx xmlscript/inc/xmlscript/xmldlg_imexp.hxx
-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.cxx23
-rw-r--r--basic/source/classes/image.cxx2
-rw-r--r--basic/source/classes/sb.cxx89
-rw-r--r--basic/source/classes/sbunoobj.cxx308
-rw-r--r--basic/source/classes/sbxmod.cxx279
-rw-r--r--basic/source/comp/codegen.cxx4
-rw-r--r--basic/source/comp/dim.cxx51
-rw-r--r--basic/source/comp/exprtree.cxx24
-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.hxx259
-rw-r--r--basic/source/inc/parser.hxx1
-rw-r--r--basic/source/inc/runtime.hxx4
-rw-r--r--basic/source/inc/sbunoobj.hxx33
-rw-r--r--basic/source/inc/scriptcont.hxx4
-rw-r--r--basic/source/inc/token.hxx2
-rw-r--r--basic/source/runtime/methods.cxx234
-rw-r--r--basic/source/runtime/methods1.cxx559
-rw-r--r--basic/source/runtime/rtlproto.hxx14
-rw-r--r--basic/source/runtime/runtime.cxx66
-rw-r--r--basic/source/runtime/stdobj.cxx125
-rw-r--r--basic/source/runtime/step0.cxx141
-rw-r--r--basic/source/runtime/step1.cxx23
-rw-r--r--basic/source/runtime/step2.cxx24
-rw-r--r--basic/source/sbx/sbxvalue.cxx41
-rw-r--r--basic/source/uno/dlgcont.cxx14
-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.xcs21
-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/XFileDialog.idl53
-rw-r--r--oovbaapi/ooo/vba/XFileDialogSelectedItems.idl53
-rw-r--r--oovbaapi/ooo/vba/XFileSearch.idl61
-rw-r--r--oovbaapi/ooo/vba/XFoundFiles.idl52
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl35
-rw-r--r--oovbaapi/ooo/vba/excel/XGlobals.idl1
-rw-r--r--oovbaapi/ooo/vba/excel/XMenu.idl28
-rw-r--r--oovbaapi/ooo/vba/excel/XMenuBar.idl25
-rw-r--r--oovbaapi/ooo/vba/excel/XMenuBars.idl64
-rw-r--r--oovbaapi/ooo/vba/excel/XMenuItem.idl28
-rw-r--r--oovbaapi/ooo/vba/excel/XMenuItems.idl68
-rw-r--r--oovbaapi/ooo/vba/excel/XMenus.idl68
-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/XQueryTable.idl57
-rw-r--r--oovbaapi/ooo/vba/excel/XRange.idl31
-rw-r--r--oovbaapi/ooo/vba/excel/XWorkbook.idl4
-rw-r--r--oovbaapi/ooo/vba/excel/XWorksheet.idl13
-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.idl16
-rw-r--r--oovbaapi/ooo/vba/msforms/XCheckBox.idl51
-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/XReturnBoolean.idl49
-rw-r--r--oovbaapi/ooo/vba/msforms/XReturnInteger.idl49
-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/XCell.idl57
-rw-r--r--oovbaapi/ooo/vba/word/XCells.idl62
-rw-r--r--oovbaapi/ooo/vba/word/XCheckBox.idl52
-rw-r--r--oovbaapi/ooo/vba/word/XColumn.idl54
-rw-r--r--oovbaapi/ooo/vba/word/XColumns.idl59
-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/XFormField.idl56
-rw-r--r--oovbaapi/ooo/vba/word/XFormFields.idl55
-rw-r--r--oovbaapi/ooo/vba/word/XFrame.idl56
-rw-r--r--oovbaapi/ooo/vba/word/XFrames.idl55
-rw-r--r--oovbaapi/ooo/vba/word/XGlobals.idl1
-rw-r--r--oovbaapi/ooo/vba/word/XHeadersFooters.idl55
-rw-r--r--oovbaapi/ooo/vba/word/XListFormat.idl58
-rw-r--r--oovbaapi/ooo/vba/word/XListGalleries.idl55
-rw-r--r--oovbaapi/ooo/vba/word/XListGallery.idl52
-rw-r--r--oovbaapi/ooo/vba/word/XListLevel.idl64
-rw-r--r--oovbaapi/ooo/vba/word/XListLevels.idl55
-rw-r--r--oovbaapi/ooo/vba/word/XListTemplate.idl52
-rw-r--r--oovbaapi/ooo/vba/word/XListTemplates.idl55
-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/XRevision.idl54
-rw-r--r--oovbaapi/ooo/vba/word/XRevisions.idl58
-rw-r--r--oovbaapi/ooo/vba/word/XRow.idl56
-rw-r--r--oovbaapi/ooo/vba/word/XRows.idl63
-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/XTabStop.idl50
-rw-r--r--oovbaapi/ooo/vba/word/XTabStops.idl59
-rw-r--r--oovbaapi/ooo/vba/word/XTable.idl6
-rw-r--r--oovbaapi/ooo/vba/word/XTableOfContents.idl58
-rw-r--r--oovbaapi/ooo/vba/word/XTablesOfContents.idl59
-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.cxx77
-rw-r--r--scripting/source/basprov/basscript.cxx90
-rw-r--r--scripting/source/basprov/basscript.hxx39
-rw-r--r--scripting/source/dlgprov/dlgevtatt.cxx32
-rw-r--r--scripting/source/dlgprov/dlgevtatt.hxx2
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx70
-rw-r--r--scripting/source/dlgprov/dlgprov.hxx40
-rw-r--r--scripting/source/vbaevents/eventhelper.cxx483
-rw-r--r--scripting/source/vbaevents/makefile.mk1
-rw-r--r--scripting/source/vbaevents/vbamsformreturntypes.hxx73
-rw-r--r--sfx2/inc/sfx2/objsh.hxx7
-rwxr-xr-xsfx2/inc/sfx2/sfx.hrc10
-rw-r--r--sfx2/inc/sfx2/sfxbasemodel.hxx1
-rw-r--r--sfx2/inc/sfx2/sfxsids.hrc1
-rw-r--r--sfx2/source/appl/app.cxx2
-rw-r--r--sfx2/source/appl/appuno.cxx20
-rw-r--r--sfx2/source/control/unoctitm.cxx13
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx86
-rw-r--r--sfx2/source/doc/docinf.cxx24
-rw-r--r--sfx2/source/doc/docmacromode.cxx58
-rw-r--r--sfx2/source/doc/objmisc.cxx27
-rw-r--r--sfx2/source/doc/objuno.cxx47
-rw-r--r--sfx2/source/doc/objxtor.cxx50
-rw-r--r--sfx2/source/doc/oleprops.hxx4
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx36
-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.hxx19
-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.cxx159
-rw-r--r--vbahelper/source/msforms/vbacontrol.hxx13
-rw-r--r--vbahelper/source/msforms/vbaframe.cxx40
-rw-r--r--vbahelper/source/msforms/vbaframe.hxx8
-rw-r--r--vbahelper/source/msforms/vbalabel.cxx28
-rw-r--r--vbahelper/source/msforms/vbalabel.hxx2
-rw-r--r--vbahelper/source/msforms/vbalistbox.cxx66
-rw-r--r--vbahelper/source/msforms/vbalistbox.hxx4
-rw-r--r--vbahelper/source/msforms/vbalistcontrolhelper.cxx106
-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.cxx30
-rw-r--r--vbahelper/source/vbahelper/vbadocumentbase.cxx65
-rw-r--r--vbahelper/source/vbahelper/vbadocumentsbase.cxx11
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx230
-rw-r--r--vbahelper/source/vbahelper/vbapictureformat.cxx9
-rw-r--r--vbahelper/source/vbahelper/vbashape.cxx225
-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.hxx2
-rw-r--r--xmloff/inc/xmloff/shapeexport.hxx5
-rw-r--r--xmloff/inc/xmloff/xmltoken.hxx5
-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.cxx45
-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.hxx20
-rw-r--r--xmlscript/source/xmldlg_imexp/exp_share.hxx14
-rw-r--r--xmlscript/source/xmldlg_imexp/imp_share.hxx186
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx11
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx271
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_export.cxx29
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx572
-rw-r--r--xmlscript/source/xmldlg_imexp/xmldlg_import.cxx54
-rw-r--r--xmlscript/util/makefile.mk1
204 files changed, 7069 insertions, 1720 deletions
diff --git a/basic/inc/basic/basmgr.hxx b/basic/inc/basic/basmgr.hxx
index 73b64a2690..6f74f37843 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 7b3cd4dc03..26e83b3caf 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 ae52ca4046..dbf864925b 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 27fe320dd8..c5e0209ffc 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 30dd13f8d3..6886acc37b 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -343,7 +343,7 @@ void SAL_CALL BasMgrContainerListenerImpl::elementReplaced( const ContainerEvent
pMod->SetSource32( aMod );
else
pLib->MakeModule32( aName, aMod );
-
+
pLib->SetModified( FALSE );
}
}
@@ -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 358da59409..916370e41d 100644
--- a/basic/source/classes/image.cxx
+++ b/basic/source/classes/image.cxx
@@ -431,7 +431,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 90b357395a..3da68f7229 100644
--- 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 6f53cbf6fb..55953d2e5b 100644
--- a/basic/source/classes/sbunoobj.cxx
+++ b/basic/source/classes/sbunoobj.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -58,6 +58,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>
@@ -69,7 +70,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;
@@ -155,6 +156,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;
@@ -456,6 +472,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;
@@ -755,7 +797,7 @@ void unoToSbxValue( SbxVariable* pVar, const Any& aValue )
// instantiate a SbUnoObject
String aName;
SbUnoObject* pSbUnoObject = new SbUnoObject( aName, aValue );
- //If this is called externally e.g. from the scripting
+ //If this is called externally e.g. from the scripting
//framework then there is no 'active' runtime the default property will not be set up
//only a vba object will have XDefaultProp set anyway so... this
//test seems a bit of overkill
@@ -1505,6 +1547,101 @@ 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);
+
+ 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++ )
+ {
+ 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;
+}
+
// Debugging help method to readout the imlemented interfaces of an object
String Impl_GetInterfaceInfo( const Reference< XInterface >& x, const Reference< XIdlClass >& xClass, USHORT nRekLevel )
{
@@ -2011,11 +2148,24 @@ void SbUnoObject::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
{
try
{
- // get the value
- 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
+ aRetAny = mxInvocation->getValue( pProp->GetName() );
// take over the value from Uno to Sbx
unoToSbxValue( pVar, aRetAny );
+ if( pParams && bCanBeConsideredAMethod )
+ pVar->SetParameters( NULL );
+
}
catch( const Exception& )
{
@@ -2140,52 +2290,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);
-
- // ATTENTION: Don't forget for Sbx-Parameter the offset!
- 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++ )
- {
- // ATTENTION: Don't forget for Sbx-Parameter the offset!
- pAnyArgs[i] = sbxToUnoValueImpl( pParams->Get( (USHORT)(i+1) ),
- bBlockConversionToSmallestType );
- }
- }
+ processAutomationParams( pParams, args, bOLEAutomation, nParamCount );
}
// call the method
@@ -2220,26 +2325,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 );
-
- // take over the value from Uno to Sbx
+ 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 ] );
- }
- }
}
// remove parameter here, because this was not done anymore in unoToSbxValue()
@@ -2937,7 +3024,7 @@ void RTL_Impl_CreateUnoServiceWithArguments( StarBASIC* pBasic, SbxArray& rPar,
{
(void)pBasic;
(void)bWrite;
-
+
// We need 2 parameter minimum
if ( rPar.Count() < 3 )
{
@@ -3177,11 +3264,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);
@@ -3189,39 +3281,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;
}
@@ -3424,7 +3554,7 @@ SbxVariable* SbUnoService::Find( const String& rName, SbxClassType )
for( int i = 0 ; i < nCtorCount ; ++i )
{
Reference< XServiceConstructorDescription > xCtor = pCtorSeq[i];
-
+
String aName( xCtor->getName() );
if( !aName.Len() )
{
@@ -3569,7 +3699,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
Reference < XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
xContext.set( xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" )) ), UNO_QUERY_THROW );
}
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Any aRetAny;
if( xServiceMgr.is() )
@@ -3726,7 +3856,7 @@ void SbUnoSingleton::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
SbxObject::SFX_NOTIFY( rBC, rBCType, rHint, rHintType );
}
-
+
//========================================================================
//========================================================================
//========================================================================
@@ -4188,7 +4318,7 @@ public:
throw( UnknownPropertyException );
virtual sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& rName ) throw();
virtual sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& rProp ) throw();
-
+
virtual Any SAL_CALL invoke( const ::rtl::OUString& rFunction,
const Sequence< Any >& rParams,
Sequence< sal_Int16 >& rOutParamIndex,
@@ -4344,7 +4474,7 @@ Reference< XInterface > createComListener( const Any& aControlAny, const ::rtl::
Reference< XInterface > xRet;
Reference< XComponentContext > xContext = getComponentContext_Impl();
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XInvocation > xProxy = new ModuleInvocationProxy( aPrefix, xScopeObj );
@@ -4374,7 +4504,7 @@ bool SbModule::createCOMWrapperForIface( Any& o_rRetAny, SbClassModuleObject* pP
// TODO: Check if support for multiple interfaces is needed
Reference< XComponentContext > xContext = getComponentContext_Impl();
- Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
+ Reference< XMultiComponentFactory > xServiceMgr( xContext->getServiceManager() );
Reference< XSingleServiceFactory > xComImplementsFactory
(
xServiceMgr->createInstanceWithContext(
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index e805f9bbcf..d647d4c9a9 100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -56,6 +56,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;
@@ -84,7 +85,7 @@ using namespace com::sun::star;
#include <map>
#include <com/sun/star/script/XInvocation.hpp>
- using namespace ::com::sun::star;
+ using namespace ::com::sun::star;
using namespace com::sun::star::lang;
using namespace com::sun::star::reflection;
using namespace com::sun::star::beans;
@@ -117,7 +118,7 @@ class DocObjectWrapper : public DocObjectWrapper_BASE
SbPropertyRef getProperty( const rtl::OUString& aName ) throw (RuntimeException);
String mName; // for debugging
-public:
+public:
DocObjectWrapper( SbModule* pMod );
virtual ~DocObjectWrapper();
@@ -139,16 +140,16 @@ public:
virtual ::sal_Bool SAL_CALL hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException);
virtual ::sal_Bool SAL_CALL hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException);
virtual Any SAL_CALL queryInterface( const Type& aType ) throw ( RuntimeException );
-
+
virtual Sequence< Type > SAL_CALL getTypes() throw ( RuntimeException );
};
DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pVar->GetName() )
-{
+{
SbObjModule* pMod = PTR_CAST(SbObjModule,pVar);
if ( pMod )
{
- if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
+ if ( pMod->GetModuleType() == ModuleType::DOCUMENT )
{
Reference< XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
// Use proxy factory service to create aggregatable proxy.
@@ -156,7 +157,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
Reference< XInterface > xIf;
if ( pUnoObj )
{
- Any aObj = pUnoObj->getUnoAny();
+ Any aObj = pUnoObj->getUnoAny();
aObj >>= xIf;
if ( xIf.is() )
{
@@ -181,11 +182,11 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
OSL_ENSURE( false, "DocObjectWrapper::DocObjectWrapper: Caught exception!" );
}
}
-
+
if ( m_xAggProxy.is() )
{
osl_incrementInterlockedCount( &m_refCount );
-
+
/* i35609 - Fix crash on Solaris. The setDelegator call needs
to be in its own block to ensure that all temporary Reference
instances that are acquired during the call are released
@@ -193,7 +194,7 @@ DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ), mName( pV
{
m_xAggProxy->setDelegator( static_cast< cppu::OWeakObject * >( this ) );
}
-
+
osl_decrementInterlockedCount( &m_refCount );
}
}
@@ -206,7 +207,7 @@ DocObjectWrapper::acquire() throw ()
osl_incrementInterlockedCount( &m_refCount );
OSL_TRACE("DocObjectWrapper::acquire(%s) 0x%x refcount is now %d", rtl::OUStringToOString( mName, RTL_TEXTENCODING_UTF8 ).getStr(), this, m_refCount );
}
-void SAL_CALL
+void SAL_CALL
DocObjectWrapper::release() throw ()
{
if ( osl_decrementInterlockedCount( &m_refCount ) == 0 )
@@ -226,7 +227,7 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
throw ( RuntimeException )
{
if ( m_Types.getLength() == 0 )
- {
+ {
Sequence< Type > sTypes;
if ( m_xAggregateTypeProv.is() )
sTypes = m_xAggregateTypeProv->getTypes();
@@ -234,7 +235,7 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
Type* pPtr = m_Types.getArray();
for ( int i=0; i<m_Types.getLength(); ++i, ++pPtr )
{
- if ( i == 0 )
+ if ( i == 0 )
*pPtr = XInvocation::static_type( NULL );
else
*pPtr = sTypes[ i - 1 ];
@@ -243,13 +244,13 @@ Sequence< Type > SAL_CALL DocObjectWrapper::getTypes()
return m_Types;
}
-Reference< XIntrospectionAccess > SAL_CALL
+Reference< XIntrospectionAccess > SAL_CALL
DocObjectWrapper::getIntrospection( ) throw (RuntimeException)
{
return NULL;
}
-Any SAL_CALL
+Any SAL_CALL
DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence< Any >& aParams, Sequence< ::sal_Int16 >& aOutParamIndex, Sequence< Any >& aOutParam ) throw (IllegalArgumentException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aFunctionName ) )
@@ -344,19 +345,19 @@ DocObjectWrapper::invoke( const ::rtl::OUString& aFunctionName, const Sequence<
return aReturn;
}
-void SAL_CALL
+void SAL_CALL
DocObjectWrapper::setValue( const ::rtl::OUString& aPropertyName, const Any& aValue ) throw (UnknownPropertyException, CannotConvertException, InvocationTargetException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
return m_xAggInv->setValue( aPropertyName, aValue );
-
+
SbPropertyRef pProperty = getProperty( aPropertyName );
if ( !pProperty.Is() )
throw UnknownPropertyException();
unoToSbxValue( (SbxVariable*) pProperty, aValue );
}
-Any SAL_CALL
+Any SAL_CALL
DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (UnknownPropertyException, RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aPropertyName ) )
@@ -374,20 +375,20 @@ DocObjectWrapper::getValue( const ::rtl::OUString& aPropertyName ) throw (Unknow
return aRet;
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
DocObjectWrapper::hasMethod( const ::rtl::OUString& aName ) throw (RuntimeException)
{
if ( m_xAggInv.is() && m_xAggInv->hasMethod( aName ) )
- return sal_True;
+ return sal_True;
return getMethod( aName ).Is();
}
-::sal_Bool SAL_CALL
+::sal_Bool SAL_CALL
DocObjectWrapper::hasProperty( const ::rtl::OUString& aName ) throw (RuntimeException)
{
sal_Bool bRes = sal_False;
if ( m_xAggInv.is() && m_xAggInv->hasProperty( aName ) )
- bRes = sal_True;
+ bRes = sal_True;
else bRes = getProperty( aName ).Is();
return bRes;
}
@@ -458,7 +459,7 @@ bool getDefaultVBAMode( StarBASIC* pb )
{
uno::Reference< beans::XPropertySet > xProp( aDoc, uno::UNO_QUERY );
if ( xProp.is() )
- {
+ {
uno::Reference< script::vba::XVBACompatibility > xVBAMode( xProp->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BasicLibraries") ) ), uno::UNO_QUERY );
if ( xVBAMode.is() )
bResult = xVBAMode->getVBACompatibilityMode() == sal_True;
@@ -473,7 +474,7 @@ class AsyncQuitHandler
AsyncQuitHandler() {}
AsyncQuitHandler( const AsyncQuitHandler&);
public:
- static AsyncQuitHandler& instance()
+ static AsyncQuitHandler& instance()
{
static AsyncQuitHandler dInst;
return dInst;
@@ -486,7 +487,7 @@ public:
{
uno::Reference< frame::XDesktop > xDeskTop( xFactory->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.Desktop") ) ), uno::UNO_QUERY );
if ( xDeskTop.is() )
- xDeskTop->terminate();
+ xDeskTop->terminate();
}
}
DECL_LINK( OnAsyncQuit, void* );
@@ -498,7 +499,6 @@ IMPL_LINK( AsyncQuitHandler, OnAsyncQuit, void*, /*pNull*/ )
return 0L;
}
-#if 0
bool UnlockControllerHack( StarBASIC* pBasic )
{
bool bRes = false;
@@ -508,7 +508,7 @@ bool UnlockControllerHack( StarBASIC* pBasic )
::rtl::OUString sVarName( ::rtl::OUString::createFromAscii( "ThisComponent" ) );
SbUnoObject* pGlobs = dynamic_cast<SbUnoObject*>( pBasic->Find( sVarName, SbxCLASS_DONTCARE ) );
if ( pGlobs )
- aUnoVar = pGlobs->getUnoAny();
+ aUnoVar = pGlobs->getUnoAny();
uno::Reference< frame::XModel > xModel( aUnoVar, uno::UNO_QUERY);
if ( xModel.is() )
{
@@ -524,7 +524,7 @@ bool UnlockControllerHack( StarBASIC* pBasic )
}
return bRes;
}
-#endif
+
/////////////////////////////////////////////////////////////////////////////
// A Basic module has set EXTSEARCH, so that the elements, that the modul contains,
@@ -793,6 +793,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 )
@@ -817,7 +893,7 @@ void SbModule::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType,
}
else
{
- // #i92642: Special handling for name property to avoid
+ // #i92642: Special handling for name property to avoid
// side effects when using name as variable implicitely
bool bForwardToSbxObject = true;
@@ -847,6 +923,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
aOUSource = r;
StartDefinitions();
SbiTokenizer aTok( r );
+ aTok.SetCompatible( IsVBACompat() );
while( !aTok.IsEof() )
{
SbiToken eEndTok = NIL;
@@ -877,7 +954,7 @@ void SbModule::SetSource32( const ::rtl::OUString& r )
if( eCurTok == COMPATIBLE )
aTok.SetCompatible( true );
else if ( ( eCurTok == VBASUPPORT ) && ( aTok.Next() == NUMBER ) )
- {
+ {
BOOL bIsVBA = ( aTok.GetDbl()== 1 );
SetVBACompat( bIsVBA );
aTok.SetCompatible( bIsVBA );
@@ -1026,7 +1103,7 @@ BOOL SbModule::IsVBACompat() const
{
return mbVBACompat;
}
-
+
void SbModule::SetVBACompat( BOOL bCompat )
{
mbVBACompat = bCompat;
@@ -1034,12 +1111,14 @@ void SbModule::SetVBACompat( BOOL bCompat )
// Run a Basic-subprogram
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 )
{
@@ -1172,6 +1251,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 Clear Uno-Objects, which were helt in RTL functions,
@@ -1199,10 +1287,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 Clear Uno-Objects, which were helt in RTL functions,
@@ -1213,6 +1299,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 );
}
@@ -1268,16 +1356,16 @@ void SbModule::RunInit()
// Delete with private/dim declared variables
-void SbModule::AddVarName( const String& aName )
-{
+void SbModule::AddVarName( const String& aName )
+{
// see if the name is added allready
std::vector< String >::iterator it_end = mModuleVariableNames.end();
for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
if ( aName == *it )
- return;
+ return;
}
- mModuleVariableNames.push_back( aName );
+ mModuleVariableNames.push_back( aName );
}
void SbModule::RemoveVars()
@@ -1285,8 +1373,8 @@ void SbModule::RemoveVars()
std::vector< String >::iterator it_end = mModuleVariableNames.end();
for ( std::vector< String >::iterator it = mModuleVariableNames.begin(); it != it_end; ++it )
{
- // We don't want a Find being called in a derived class ( e.g.
- // SbUserform because it could trigger say an initialise event
+ // We don't want a Find being called in a derived class ( e.g.
+ // SbUserform because it could trigger say an initialise event
// which would cause basic to be re-run in the middle of the init ( and remember RemoveVars is called from compile and we don't want code to run as part of the compile )
SbxVariableRef p = SbModule::Find( *it, SbxCLASS_PROPERTY );
if( p.Is() )
@@ -1663,6 +1751,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 )
@@ -1712,7 +1842,6 @@ BOOL SbModule::LoadBinaryData( SvStream& rStrm )
return bRet;
}
-
BOOL SbModule::LoadCompleted()
{
SbxArray* p = GetMethods();
@@ -1780,6 +1909,7 @@ SbMethod::SbMethod( const String& r, SbxDataType t, SbModule* p )
nLine1 =
nLine2 = 0;
refStatics = new SbxArray;
+ mCaller = 0;
// From: 1996-07.02: HACK due to 'Referenz could not be saved'
SetFlag( SBX_NO_MODIFY );
}
@@ -1793,7 +1923,8 @@ SbMethod::SbMethod( const SbMethod& r )
nDebugFlags = r.nDebugFlags;
nLine1 = r.nLine1;
nLine2 = r.nLine2;
- refStatics = r.refStatics;
+ refStatics = r.refStatics;
+ mCaller = r.mCaller;
SetFlag( SBX_NO_MODIFY );
}
@@ -1812,7 +1943,7 @@ SbxArray* SbMethod::GetLocals()
void SbMethod::ClearStatics()
{
refStatics = new SbxArray;
-
+
}
SbxArray* SbMethod::GetStatics()
{
@@ -1862,9 +1993,14 @@ SbxInfo* SbMethod::GetInfo()
// Interface to execute a method of the applications
// #34191# With special RefCounting, damit so that the Basic was not fired of by CloseDocument()
// The return value will be delivered as string.
-ErrCode SbMethod::Call( SbxValue* pRet )
+ErrCode SbMethod::Call( SbxValue* pRet, SbxVariable* pCaller )
{
- // Increment the RefCount of the module
+ 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();
@@ -1891,7 +2027,7 @@ ErrCode SbMethod::Call( SbxValue* pRet )
// Release objects
pMod_->ReleaseRef();
pBasic->ReleaseRef();
-
+ mCaller = 0;
return nErr;
}
@@ -1970,7 +2106,7 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do
return;
pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) );
-
+
com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW );
if( xServiceInfo->supportsService( rtl::OUString::createFromAscii( "ooo.vba.excel.Worksheet" ) ) )
{
@@ -1983,7 +2119,7 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException
}
SbxVariable*
-SbObjModule::GetObject()
+SbObjModule::GetObject()
{
return pDocObject;
}
@@ -2072,11 +2208,10 @@ public:
}
}
}
-
+
//liuchen 2009-7-21, support Excel VBA Form_QueryClose event
- virtual void SAL_CALL windowClosing( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
- {
-#if IN_THE_FUTURE
+ virtual void SAL_CALL windowClosing( const lang::EventObject& e ) throw (uno::RuntimeException)
+ {
uno::Reference< awt::XDialog > xDialog( e.Source, uno::UNO_QUERY );
if ( xDialog.is() )
{
@@ -2085,7 +2220,7 @@ public:
{
uno::Reference< document::XVbaMethodParameter > xVbaMethodParameter( xControl->getPeer(), uno::UNO_QUERY );
if ( xVbaMethodParameter.is() )
- {
+ {
sal_Int8 nCancel = 0;
sal_Int8 nCloseMode = 0;
@@ -2098,16 +2233,15 @@ public:
aParams);
xVbaMethodParameter->setVbaMethodParameter( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Cancel")), aParams[0]);
return;
-
- }
- }
+
+ }
+ }
}
-
+
mpUserForm->triggerMethod( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Userform_QueryClose") ) );
-#endif
}
//liuchen 2009-7-21
-
+
virtual void SAL_CALL windowClosed( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
mbOpened = sal_False;
@@ -2134,7 +2268,7 @@ public:
}
}
}
-
+
virtual void SAL_CALL windowDeactivated( const lang::EventObject& /*e*/ ) throw (uno::RuntimeException)
{
if ( mpUserForm )
@@ -2201,14 +2335,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
{
@@ -2229,16 +2362,15 @@ void SbUserFormModule::triggerMethod( const String& aMethodToRun, Sequence< Any
SbxValues aVals;
pMeth->Get( aVals );
-
+
for ( sal_Int32 i = 0; i < aArguments.getLength(); ++i )
{
aArguments[i] = sbxToUnoValue( xArray->Get( static_cast< USHORT >(i) + 1) );
- }
+ }
pMeth->SetParameters( NULL );
}
else
//liuchen 2009-7-21
-#endif
{
SbxValues aVals;
pMeth->Get( aVals );
@@ -2340,11 +2472,14 @@ 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;
}
-
+
if ( m_xDialog.is() )
{
triggerTerminateEvent();
@@ -2379,10 +2514,10 @@ void SbUserFormModule::InitObject()
{
String aHook( RTL_CONSTASCII_USTRINGPARAM( "VBAGlobals" ) );
- SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
+ SbUnoObject* pGlobs = (SbUnoObject*)GetParent()->Find( aHook, SbxCLASS_DONTCARE );
if ( m_xModel.is() && pGlobs )
{
-
+
uno::Reference< lang::XMultiServiceFactory > xVBAFactory( pGlobs->getUnoAny(), uno::UNO_QUERY_THROW );
uno::Reference< lang::XMultiServiceFactory > xFactory = comphelper::getProcessServiceFactory();
uno::Sequence< uno::Any > aArgs(1);
@@ -2390,8 +2525,8 @@ void SbUserFormModule::InitObject()
rtl::OUString sDialogUrl( RTL_CONSTASCII_USTRINGPARAM("vnd.sun.star.script:" ) );
rtl::OUString sProjectName( RTL_CONSTASCII_USTRINGPARAM("Standard") );
if ( this->GetParent()->GetName().Len() )
- sProjectName = this->GetParent()->GetName();
- sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
+ sProjectName = this->GetParent()->GetName();
+ sDialogUrl = sDialogUrl.concat( sProjectName ).concat( rtl::OUString( '.') ).concat( GetName() ).concat( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("?location=document") ) );
uno::Reference< awt::XDialogProvider > xProvider( xFactory->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.DialogProvider")), aArgs ), uno::UNO_QUERY_THROW );
m_xDialog = xProvider->createDialog( sDialogUrl );
@@ -2401,7 +2536,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 256dcf92e0..22f3b32315 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 367be2a3e3..c17f4a874d 100644
--- a/basic/source/comp/dim.cxx
+++ b/basic/source/comp/dim.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
@@ -210,9 +212,9 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
if( eCurTok == GLOBAL )
bPersistantGlobal = TRUE;
}
- // behavior in VBA is that a module scope variable's lifetime is
+ // behavior in VBA is that a module scope variable's lifetime is
// tied to the document. e.g. a module scope variable is global
- if( GetBasic()->IsDocBasic() && bVBASupportOn && !pProc )
+ if( GetBasic()->IsDocBasic() && bVBASupportOn && !pProc )
bPersistantGlobal = TRUE;
// PRIVATE ist Synonym fuer DIM
// _CONST_?
@@ -236,7 +238,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
}
else if( eCurTok == SUB || eCurTok == FUNCTION || eCurTok == PROPERTY )
{
- // End global chain if necessary (not done in
+ // End global chain if necessary (not done in
// SbiParser::Parse() under these conditions
if( bNewGblDefs && nGblChain == 0 )
{
@@ -256,7 +258,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
else if( eCurTok == DECLARE )
{
Next();
- DefDeclare( bPrivate );
+ DefDeclare( bPrivate );
return;
}
// #i109049
@@ -356,7 +358,7 @@ void SbiParser::DefVar( SbiOpcode eOp, BOOL bStatic )
SbiOpcode eOp2;
switch ( pDef->GetScope() )
{
- case SbGLOBAL: eOp2 = bPersistantGlobal ? _GLOBAL_P : _GLOBAL;
+ case SbGLOBAL: eOp2 = bPersistantGlobal ? _GLOBAL_P : _GLOBAL;
goto global;
case SbPUBLIC: eOp2 = bPersistantGlobal ? _PUBLIC_P : _PUBLIC;
// AB 9.7.97, #40689, kein eigener Opcode mehr
@@ -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
@@ -603,7 +608,7 @@ void SbiParser::DefType( BOOL bPrivate )
SbxProperty *pTypeElem = new SbxProperty( aElemName, eElemType );
if( pDim )
{
- SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
+ SbxDimArray* pArray = new SbxDimArray( pElem->GetType() );
if ( pDim->GetSize() )
{
// Dimension the target array
@@ -624,15 +629,15 @@ void SbiParser::DefType( BOOL bPrivate )
}
else if ( !bCompatible )
ub += nBase;
- pArray->AddDim32( lb, ub );
+ pArray->AddDim32( lb, ub );
}
pArray->setHasFixedSize( true );
}
else
pArray->unoAddDim( 0, -1 ); // variant array
USHORT nSavFlags = pTypeElem->GetFlags();
- // need to reset the FIXED flag
- // when calling PutObject ( because the type will not match Object )
+ // need to reset the FIXED flag
+ // when calling PutObject ( because the type will not match Object )
pTypeElem->ResetFlag( SBX_FIXED );
pTypeElem->PutObject( pArray );
pTypeElem->SetFlags( nSavFlags );
@@ -766,7 +771,7 @@ void SbiParser::DefEnum( BOOL bPrivate )
if( !bPrivate )
{
- SbiOpcode eOp = _GLOBAL;
+ SbiOpcode eOp = _GLOBAL;
aGen.BackChain( nGblChain );
nGblChain = 0;
bGblDefs = bNewGblDefs = TRUE;
@@ -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()
@@ -1179,7 +1202,7 @@ void SbiParser::DefStatic( BOOL bPrivate )
case SUB:
case FUNCTION:
case PROPERTY:
- // End global chain if necessary (not done in
+ // End global chain if necessary (not done in
// SbiParser::Parse() under these conditions
if( bNewGblDefs && nGblChain == 0 )
{
diff --git a/basic/source/comp/exprtree.cxx b/basic/source/comp/exprtree.cxx
index f858c428af..50ddc0f85d 100644
--- a/basic/source/comp/exprtree.cxx
+++ b/basic/source/comp/exprtree.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,7 +46,7 @@ SbiExpression::SbiExpression( SbiParser* p, SbiExprType t,
nParenLevel = 0;
eCurExpr = t;
m_eMode = eMode;
- pNext = NULL;
+ pNext = NULL;
pExpr = (t != SbSTDEXPR ) ? Term( pKeywordSymbolInfo ) : Boolean();
if( t != SbSYMBOL )
pExpr->Optimize();
@@ -127,7 +127,7 @@ static BOOL DoParametersFollow( SbiParser* p, SbiExprType eCurExpr, SbiToken eTo
if ( tokens.Peek() == ASSIGN )
return TRUE;
}
- return FALSE;
+ return FALSE;
}
// Definition eines neuen Symbols
@@ -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 );
@@ -435,7 +439,7 @@ SbiExprNode* SbiExpression::ObjTerm( SbiSymDef& rObj )
bError |= !pPar->IsValid();
eTok = pParser->Peek();
}
-
+
}
BOOL bObj = BOOL( ( eTok == DOT || eTok == EXCLAM ) && !pParser->WhiteSpace() );
if( bObj )
@@ -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 83e7bbd604..31a78f1e47 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 00690796a7..3312e66bf3 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 614fccf30c..00abc7df3f 100644
--- a/basic/source/inc/dlgcont.hxx
+++ b/basic/source/inc/dlgcont.hxx
@@ -94,7 +94,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 72cdcee2da..69ea926775 100644
--- a/basic/source/inc/namecont.hxx
+++ b/basic/source/inc/namecont.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
@@ -133,45 +136,45 @@ public:
{ mpxEventSource = pxEventSource; }
// Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements( )
+ virtual sal_Bool SAL_CALL hasElements( )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::lang::WrappedTargetException,
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
};
@@ -256,21 +259,21 @@ protected:
void implStoreLibrary( SfxLibrary* pLib,
const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI,
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler );
- void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
// New variant for library export
- void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
+ void implStoreLibraryIndexFile( SfxLibrary* pLib, const ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI );
sal_Bool implLoadLibraryIndexFile( SfxLibrary* pLib,
- ::xmlscript::LibDescriptor& rLib,
+ ::xmlscript::LibDescriptor& rLib,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
const ::rtl::OUString& aIndexFileName );
@@ -279,45 +282,45 @@ protected:
// Methods to distinguish between deffirent library types
virtual SfxLibrary* SAL_CALL implCreateLibrary( const ::rtl::OUString& aName ) = 0;
virtual SfxLibrary* SAL_CALL implCreateLibraryLink
- ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
+ ( const ::rtl::OUString& aName, const ::rtl::OUString& aLibInfoFileURL,
const ::rtl::OUString& StorageURL, sal_Bool ReadOnly ) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL createEmptyLibraryElement( void ) = 0;
virtual bool SAL_CALL isLibraryElementValid( ::com::sun::star::uno::Any aElement ) const = 0;
virtual void SAL_CALL writeLibraryElement
- (
+ (
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
+ const ::rtl::OUString& aElementName,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream >& xOutput
)
throw(::com::sun::star::uno::Exception) = 0;
virtual ::com::sun::star::uno::Any SAL_CALL importLibraryElement
- (
+ (
const ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer>& xLibrary,
- const ::rtl::OUString& aElementName,
+ const ::rtl::OUString& aElementName,
const ::rtl::OUString& aFile,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xElementStream ) = 0;
virtual void SAL_CALL importFromOldStorage( const ::rtl::OUString& aFile ) = 0;
// Password encryption
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
// New variant for library export
- virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
+ virtual sal_Bool implStorePasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& aName,
const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& aTargetURL,
+ const ::rtl::OUString& aTargetURL,
const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > xToUseSFI, const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler );
virtual sal_Bool implLoadPasswordLibrary( SfxLibrary* pLib, const ::rtl::OUString& Name,
- sal_Bool bVerifyPasswordOnly=false )
- throw(::com::sun::star::lang::WrappedTargetException,
+ sal_Bool bVerifyPasswordOnly=false )
+ throw(::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
virtual void onNewRootStorage() = 0;
- // #56666, Creates another library container
+ // #56666, Creates another library container
// instance of the same derived class
virtual SfxLibraryContainer* createInstanceImpl( void ) = 0;
@@ -337,8 +340,8 @@ protected:
// Handle maLibInfoFileURL and maStorageURL correctly
void checkStorageURL
(
- const ::rtl::OUString& aSourceURL,
- ::rtl::OUString& aLibInfoFileURL,
+ const ::rtl::OUString& aSourceURL,
+ ::rtl::OUString& aLibInfoFileURL,
::rtl::OUString& aStorageURL,
::rtl::OUString& aUnexpandedStorageURL
);
@@ -368,11 +371,11 @@ private:
public:
SfxLibraryContainer( void );
~SfxLibraryContainer();
-
+
// Interface to set the BasicManager (Hack for password implementation)
void setBasicManager( BasicManager* pBasMgr )
- {
+ {
mpBasMgr = pBasMgr;
}
@@ -384,17 +387,17 @@ public:
// Methods XElementAccess
virtual ::com::sun::star::uno::Type SAL_CALL getElementType()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements()
+ virtual sal_Bool SAL_CALL hasElements()
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames()
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Members XStorageBasedLibraryContainer
@@ -414,90 +417,90 @@ public:
virtual void SAL_CALL storeLibraries( ) throw (::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
//Methods XLibraryContainer3
- virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual ::rtl::OUString SAL_CALL getOriginalLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
-
+
// Methods XLibraryContainer2 (base of XPersistentLibraryContainer)
- virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryLink( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual ::rtl::OUString SAL_CALL getLibraryLinkURL( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryReadOnly( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL setLibraryReadOnly( const ::rtl::OUString& Name, sal_Bool bReadOnly )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
- throw (::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::container::ElementExistException,
+ virtual void SAL_CALL renameLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& NewName )
+ throw (::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainer (base of XLibraryContainer2)
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
- createLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > SAL_CALL
+ createLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess > SAL_CALL createLibraryLink
- ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
+ ( const ::rtl::OUString& Name, const ::rtl::OUString& StorageURL, sal_Bool ReadOnly )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryLoaded( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL loadLibrary( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Any >& aArguments )
- throw (::com::sun::star::uno::Exception,
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception,
::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerPassword
- virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
- throw (::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryPasswordProtected( const ::rtl::OUString& Name )
+ throw (::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL isLibraryPasswordVerified( const ::rtl::OUString& Name )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual sal_Bool SAL_CALL verifyLibraryPassword( const ::rtl::OUString& Name, const ::rtl::OUString& Password )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
- const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
- throw (::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL changeLibraryPassword( const ::rtl::OUString& Name,
+ const ::rtl::OUString& OldPassword, const ::rtl::OUString& NewPassword )
+ throw (::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
// Methods XLibraryContainerExport
- virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
- const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
- throw (::com::sun::star::uno::Exception,
- ::com::sun::star::container::NoSuchElementException,
+ virtual void SAL_CALL exportLibrary( const ::rtl::OUString& Name, const ::rtl::OUString& URL,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& Handler )
+ throw (::com::sun::star::uno::Exception,
+ ::com::sun::star::container::NoSuchElementException,
::com::sun::star::uno::RuntimeException);
// Methods XServiceInfo
@@ -559,7 +562,7 @@ private:
::rtl::OUString maStorageURL;
::rtl::OUString maUnexpandedStorageURL;
::rtl::OUString maOrignialStorageURL;
-
+
sal_Bool mbLink;
sal_Bool mbReadOnly;
sal_Bool mbReadOnlyLink;
@@ -623,51 +626,51 @@ public:
virtual void SAL_CALL release() throw() { OComponentHelper::release(); }
// Methods XElementAccess
- virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
+ virtual ::com::sun::star::uno::Type SAL_CALL getElementType( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasElements( )
+ virtual sal_Bool SAL_CALL hasElements( )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameAccess
- virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual ::com::sun::star::uno::Any SAL_CALL getByName( const ::rtl::OUString& aName )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames( )
throw(::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
+ virtual sal_Bool SAL_CALL hasByName( const ::rtl::OUString& aName )
throw(::com::sun::star::uno::RuntimeException);
// Methods XNameReplace
- virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL replaceByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// Methods XNameContainer
virtual void SAL_CALL insertByName( const ::rtl::OUString& aName, const ::com::sun::star::uno::Any& aElement )
- throw(::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::container::ElementExistException,
- ::com::sun::star::lang::WrappedTargetException,
+ throw(::com::sun::star::lang::IllegalArgumentException,
+ ::com::sun::star::container::ElementExistException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
- throw(::com::sun::star::container::NoSuchElementException,
- ::com::sun::star::lang::WrappedTargetException,
+ virtual void SAL_CALL removeByName( const ::rtl::OUString& Name )
+ throw(::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException);
// XTypeProvider
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes( )
throw( ::com::sun::star::uno::RuntimeException );
- ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( )
+ ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL getImplementationId( )
throw( ::com::sun::star::uno::RuntimeException );
// Methods XContainer
- virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL addContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
- ::com::sun::star::container::XContainerListener >& xListener )
+ virtual void SAL_CALL removeContainerListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XContainerListener >& xListener )
throw (::com::sun::star::uno::RuntimeException);
public:
@@ -732,7 +735,7 @@ protected:
implGetNextBundledScriptPackage( bool& rbPureDialogLib );
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
-
+
IteratorState m_eState;
com::sun::star::uno::Sequence< com::sun::star::uno::Reference
diff --git a/basic/source/inc/parser.hxx b/basic/source/inc/parser.hxx
index d83bc3c68c..cf4dad844d 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 f549659904..1e944dd824 100644
--- a/basic/source/inc/runtime.hxx
+++ b/basic/source/inc/runtime.hxx
@@ -196,7 +196,6 @@ class SbiInstance
BOOL bCompatibility; // Flag: TRUE = VBA runtime compatibility mode
ComponentVector_t ComponentVector;
-
public:
SbiRuntime* pRun; // Call-Stack
SbiInstance* pNext; // Instanzen-Chain
@@ -285,7 +284,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
@@ -455,6 +456,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 a1274b9f50..fe6e16f171 100644
--- a/basic/source/inc/sbunoobj.hxx
+++ b/basic/source/inc/sbunoobj.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,9 +38,10 @@
#include <com/sun/star/beans/XIntrospection.hpp>
#include <com/sun/star/script/XInvocation.hpp>
#include <com/sun/star/reflection/XIdlClass.hpp>
-#include <com/sun/star/reflection/XServiceTypeDescription2.hpp>
-#include <com/sun/star/reflection/XSingletonTypeDescription.hpp>
+#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
{
@@ -106,7 +107,7 @@ class SbUnoMethod : public SbxMethod
public:
TYPEINFO();
- SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
+ SbUnoMethod( const String& aName_, SbxDataType eSbxType, ::com::sun::star::uno::Reference< ::com::sun::star::reflection::XIdlMethod > xUnoMethod_,
bool bInvocation );
virtual ~SbUnoMethod();
virtual SbxInfo* GetInfo();
@@ -225,7 +226,7 @@ public:
{ return m_xServiceCtorDesc; }
};
-
+
// Wrapper for UNO Singleton
class SbUnoSingleton : public SbxObject
{
@@ -261,7 +262,7 @@ public:
};
-// #112509 Special SbxArray to transport named parameters for calls
+// #112509 Special SbxArray to transport named parameters for calls
// to OLEAutomation objects through the UNO OLE automation bridge
class AutomationNamedArgsSbxArray : public SbxArray
@@ -319,6 +320,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 71ad535600..3fb35ed429 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 4bac670594..2c71d263e8 100644
--- a/basic/source/inc/token.hxx
+++ b/basic/source/inc/token.hxx
@@ -70,7 +70,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 df4f65d7bc..8ebf80ea18 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,6 +46,7 @@
#include <unotools/ucbstreamhelper.hxx>
#include <tools/wldcrd.hxx>
#include <i18npool/lang.h>
+#include <rtl/string.hxx>
#include "runtime.hxx"
#include "sbunoobj.hxx"
@@ -71,13 +72,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 */
@@ -99,6 +103,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
@@ -117,6 +123,9 @@ using namespace com::sun::star::io;
#include <io.h>
#endif
+
+#include <basic/sbobjmod.hxx>
+
#include <basic/sbobjmod.hxx>
static void FilterWhiteSpace( String& rStr )
@@ -702,6 +711,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 & )
@@ -936,6 +975,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)
@@ -1340,13 +1399,13 @@ RTLFUNC(Oct)
}
}
-// Replace(expression, find, replace[, start[, count[, compare]]])
+// Replace(expression, find, replace[, start[, count[, compare]]])
RTLFUNC(Replace)
{
(void)pBasic;
(void)bWrite;
-
+
ULONG nArgCount = rPar.Count()-1;
if ( nArgCount < 3 || nArgCount > 6 )
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -1376,7 +1435,7 @@ RTLFUNC(Replace)
if( lCount < -1 || lCount > 0xffff )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- lCount = -1;
+ lCount = -1;
}
}
@@ -1808,7 +1867,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
else if ( nYear < 100 )
nYear += 1900;
Date aCurDate( nDay, nMonth, nYear );
- if ((nYear < 100 || nYear > 9999) )
+ if ((nYear < 100 || nYear > 9999) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return FALSE;
@@ -1816,7 +1875,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
if ( !SbiRuntime::isVBAEnabled() )
{
if ( (nMonth < 1 || nMonth > 12 )||
- (nDay < 1 || nDay > 31 ) )
+ (nDay < 1 || nDay > 31 ) )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
return FALSE;
@@ -1826,7 +1885,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
{
// grab the year & month
aCurDate = Date( 1, (( nMonth % 12 ) > 0 ) ? ( nMonth % 12 ) : 12 + ( nMonth % 12 ), nYear );
-
+
// adjust year based on month value
// e.g. 2000, 0, xx = 1999, 12, xx ( or December of the previous year )
// 2000, 13, xx = 2001, 1, xx ( or January of the following year )
@@ -1847,7 +1906,7 @@ BOOL implDateSerial( INT16 nYear, INT16 nMonth, INT16 nDay, double& rdRet )
aCurDate += nDay - 1;
else
aCurDate.SetDay( nDay );
- }
+ }
long nDiffDays = GetDayDiff( aCurDate );
rdRet = (double)nDiffDays;
@@ -1975,16 +2034,16 @@ RTLFUNC(DateValue)
String aStr( rPar.Get(1)->GetString() );
BOOL bSuccess = pFormatter->IsNumberFormat( aStr, nIndex, fResult );
short nType = pFormatter->GetType( nIndex );
-
+
// DateValue("February 12, 1969") raises error if the system locale is not en_US
// by using SbiInstance::GetNumberFormatter.
- // It seems that both locale number formatter and English number formatter
+ // It seems that both locale number formatter and English number formatter
// are supported in Visual Basic.
LanguageType eLangType = GetpApp()->GetSettings().GetLanguage();
if( !bSuccess && ( eLangType != LANGUAGE_ENGLISH_US ) )
{
// Create a new SvNumberFormatter by using LANGUAGE_ENGLISH to get the date value;
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
xFactory = comphelper::getProcessServiceFactory();
SvNumberFormatter aFormatter( xFactory, LANGUAGE_ENGLISH_US );
bSuccess = aFormatter.IsNumberFormat( aStr, nIndex, fResult );
@@ -2407,7 +2466,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)
@@ -2418,7 +2488,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)
@@ -2986,8 +3071,8 @@ RTLFUNC(GetAttr)
return;
}
- #endif
-
+ #endif
+
// <-- UCB
if( hasUno() )
{
@@ -3538,6 +3623,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 )
@@ -3552,7 +3644,7 @@ RTLFUNC(Shell)
if( !bSucc )
StarBASIC::Error( SbERR_FILE_NOT_FOUND );
else
- rPar.Get(0)->PutLong( 0 );
+ rPar.Get(0)->PutLong( nResult );
}
}
@@ -3623,6 +3715,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;
@@ -3634,7 +3785,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 );
@@ -3976,28 +4132,28 @@ RTLFUNC(StrConv)
{
(void)pBasic;
(void)bWrite;
-
+
ULONG nArgCount = rPar.Count()-1;
if( nArgCount < 2 || nArgCount > 3 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
- return;
+ return;
}
- String aOldStr = rPar.Get(1)->GetString();
+ String aOldStr = rPar.Get(1)->GetString();
INT32 nConversion = rPar.Get(2)->GetLong();
-
+
USHORT nLanguage = LANGUAGE_SYSTEM;
if( nArgCount == 3 )
{
- // LCID not supported now
+ // LCID not supported now
//nLanguage = rPar.Get(3)->GetInteger();
}
USHORT nOldLen = aOldStr.Len();
if( nOldLen == 0 )
{
- // null string,return
+ // null string,return
rPar.Get(0)->PutString(aOldStr);
return;
}
@@ -4012,7 +4168,7 @@ RTLFUNC(StrConv)
nType |= ::com::sun::star::i18n::TransliterationModules_LOWERCASE_UPPERCASE;
else if ( (nConversion & 0x02) == 2 ) // vbLowerCase
nType |= ::com::sun::star::i18n::TransliterationModules_UPPERCASE_LOWERCASE;
-
+
if ( (nConversion & 0x04) == 4 ) // vbWide
nType |= ::com::sun::star::i18n::TransliterationModules_HALFWIDTH_FULLWIDTH;
else if ( (nConversion & 0x08) == 8 ) // vbNarrow
@@ -4043,12 +4199,12 @@ RTLFUNC(StrConv)
{
pChar[i] = static_cast< sal_Char >( i%2 ? ((*pSrc) >> 8) & 0xff : (*pSrc) & 0xff );
if( i%2 )
- pSrc++;
+ pSrc++;
}
pChar[nSize] = '\0';
- ::rtl::OString aOStr(pChar);
-
- // there is no concept about default codepage in unix. so it is incorrectly in unix
+ ::rtl::OString aOStr(pChar);
+
+ // there is no concept about default codepage in unix. so it is incorrectly in unix
::rtl::OUString aOUStr = ::rtl::OStringToOUString(aOStr, osl_getThreadTextEncoding());
aNewStr = String(aOUStr);
rPar.Get(0)->PutString( aNewStr );
@@ -4057,7 +4213,7 @@ RTLFUNC(StrConv)
else if ( (nConversion & 0x80) == 128 ) // vbFromUnicode
{
::rtl::OUString aOUStr(aNewStr);
- // there is no concept about default codepage in unix. so it is incorrectly in unix
+ // there is no concept about default codepage in unix. so it is incorrectly in unix
::rtl::OString aOStr = ::rtl::OUStringToOString(aNewStr,osl_getThreadTextEncoding());
const sal_Char* pChar = aOStr.getStr();
USHORT nArraySize = static_cast< USHORT >( aOStr.getLength() );
@@ -4068,11 +4224,11 @@ RTLFUNC(StrConv)
if( bIncIndex )
pArray->AddDim( 1, nArraySize );
else
- pArray->AddDim( 0, nArraySize-1 );
+ pArray->AddDim( 0, nArraySize-1 );
}
else
{
- pArray->unoAddDim( 0, -1 );
+ pArray->unoAddDim( 0, -1 );
}
for( USHORT i=0; i< nArraySize; i++)
@@ -4084,7 +4240,7 @@ RTLFUNC(StrConv)
short index = i;
if( bIncIndex )
++index;
- pArray->Put( pNew, &index );
+ pArray->Put( pNew, &index );
}
SbxVariableRef refVar = rPar.Get(0);
@@ -4093,7 +4249,7 @@ RTLFUNC(StrConv)
refVar->PutObject( pArray );
refVar->SetFlags( nFlags );
refVar->SetParameters( NULL );
- return;
+ return;
}
rPar.Get(0)->PutString(aNewStr);
@@ -4502,7 +4658,7 @@ RTLFUNC(Partition)
{
(void)pBasic;
(void)bWrite;
-
+
if ( rPar.Count() != 5 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4513,7 +4669,7 @@ RTLFUNC(Partition)
INT32 nStart = rPar.Get(2)->GetLong();
INT32 nStop = rPar.Get(3)->GetLong();
INT32 nInterval = rPar.Get(4)->GetLong();
-
+
if( nStart < 0 || nStop <= nStart || nInterval < 1 )
{
StarBASIC::Error( SbERR_BAD_ARGUMENT );
@@ -4523,7 +4679,7 @@ RTLFUNC(Partition)
// the Partition function inserts leading spaces before lowervalue and uppervalue
// so that they both have the same number of characters as the string
// representation of the value (Stop + 1). This ensures that if you use the output
- // of the Partition function with several values of Number, the resulting text
+ // of the Partition function with several values of Number, the resulting text
// will be handled properly during any subsequent sort operation.
// calculate the maximun number of characters before lowervalue and uppervalue
@@ -4535,7 +4691,7 @@ RTLFUNC(Partition)
::rtl::OUStringBuffer aRetStr( nLen * 2 + 1);
::rtl::OUString aLowerValue;
- ::rtl::OUString aUpperValue;
+ ::rtl::OUString aUpperValue;
if( nNumber < nStart )
{
aUpperValue = aBeforeStart;
@@ -4553,7 +4709,7 @@ RTLFUNC(Partition)
nLowerValue = ((( nNumber - nStart ) / nInterval ) * nInterval ) + nStart;
nUpperValue = nLowerValue + nInterval - 1;
}
-
+
aLowerValue = ::rtl::OUString::valueOf( nLowerValue );
aUpperValue = ::rtl::OUString::valueOf( nUpperValue );
}
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index dfcbeca66b..d044f0202a 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -76,11 +76,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 )
{
@@ -526,6 +530,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;
@@ -533,6 +541,9 @@ RTLFUNC(DoEvents)
//aTimer.Start();
//while ( aTimer.IsActive() )
// Application::Reschedule();
+#endif
+ // always return 0
+ rPar.Get(0)->PutInteger( 0 );
}
RTLFUNC(GetGUIVersion)
@@ -671,8 +682,8 @@ RTLFUNC(Array)
}
// Parameter ins Array uebernehmen
- // ATTENTION: Using type USHORT for loop variable is
- // mandatory to workaround a problem with the
+ // ATTENTION: Using type USHORT for loop variable is
+ // mandatory to workaround a problem with the
// Solaris Intel compiler optimizer! See i104354
for( USHORT i = 0 ; i < nArraySize ; i++ )
{
@@ -1407,7 +1418,7 @@ RTLFUNC(CreateUnoServiceWithArguments)
{
(void)pBasic;
(void)bWrite;
-
+
RTL_Impl_CreateUnoServiceWithArguments( pBasic, rPar, bWrite );
}
@@ -2516,6 +2527,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 e3b2a05395..b1145c84ed 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 a8eff4d55d..f358178da3 100644
--- a/basic/source/runtime/runtime.cxx
+++ b/basic/source/runtime/runtime.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -46,6 +46,8 @@
#include "errobject.hxx"
#include "sbtrace.hxx"
+SbxVariable* getDefaultProp( SbxVariable* pRef );
+
using namespace ::com::sun::star;
bool SbiRuntime::isVBAEnabled()
@@ -54,7 +56,7 @@ bool SbiRuntime::isVBAEnabled()
SbiInstance* pInst = pINST;
if ( pInst && pINST->pRun )
result = pInst->pRun->bVBAEnabled;
- return result;
+ return result;
}
// #91147 Global reschedule flag
@@ -75,7 +77,7 @@ void StarBASIC::SetVBAEnabled( BOOL bEnabled )
BOOL StarBASIC::isVBAEnabled()
{
if ( bDocBasic )
- {
+ {
if( SbiRuntime::isVBAEnabled() )
return TRUE;
return bVBAEnabled;
@@ -209,7 +211,7 @@ SbiRuntime::pStep2 SbiRuntime::aStep2[] = {// Alle Opcodes mit zwei Operanden
&SbiRuntime::StepSTATIC, // Statische Variable (+StringId+StringId)
&SbiRuntime::StepTCREATE, // User Defined Objekte (+StringId+StringId)
&SbiRuntime::StepDCREATE, // Objekt-Array kreieren (+StringID+StringID)
- &SbiRuntime::StepGLOBAL_P, // Globale Variable definieren, die beim Neustart
+ &SbiRuntime::StepGLOBAL_P, // Globale Variable definieren, die beim Neustart
// von Basic nicht ueberschrieben wird (+StringID+Typ)
&SbiRuntime::StepFIND_G, // Sucht globale Variable mit Spezialbehandlung wegen _GLOBAL_P
&SbiRuntime::StepDCREATE_REDIMP, // Objekt-Array redimensionieren (+StringID+StringID)
@@ -363,7 +365,7 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter,
sal_uInt32 &rnStdDateIdx, sal_uInt32 &rnStdTimeIdx, sal_uInt32 &rnStdDateTimeIdx,
LanguageType* peFormatterLangType, DateFormat* peFormatterDateFormat )
{
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
+ com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
xFactory = comphelper::getProcessServiceFactory();
LanguageType eLangType;
@@ -543,8 +545,8 @@ SbxArray* SbiInstance::GetLocals( SbMethod* pMeth )
// Achtung: pMeth kann auch NULL sein (beim Aufruf des Init-Codes)
SbiRuntime::SbiRuntime( SbModule* pm, SbMethod* pe, UINT32 nStart )
- : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
- pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), m_nLastTime(0)
+ : rBasic( *(StarBASIC*)pm->pParent ), pInst( pINST ),
+ pMod( pm ), pMeth( pe ), pImg( pMod->pImage ), mpExtCaller(0), m_nLastTime(0)
{
nFlags = pe ? pe->GetDebugFlags() : 0;
pIosys = pInst->pIosys;
@@ -600,7 +602,14 @@ SbiRuntime::~SbiRuntime()
void SbiRuntime::SetVBAEnabled(bool bEnabled )
{
- bVBAEnabled = bEnabled;
+ bVBAEnabled = bEnabled;
+ if ( bVBAEnabled )
+ {
+ if ( pMeth )
+ mpExtCaller = pMeth->mCaller;
+ }
+ else
+ mpExtCaller = 0;
}
// Aufbau der Parameterliste. Alle ByRef-Parameter werden direkt
@@ -652,7 +661,7 @@ void SbiRuntime::SetParameters( SbxArray* pParams )
bByVal |= BOOL( ( p->eType & SbxBYREF ) == 0 );
t = (SbxDataType) ( p->eType & 0x0FFF );
- if( !bByVal && t != SbxVARIANT &&
+ if( !bByVal && t != SbxVARIANT &&
(!v->IsFixed() || (SbxDataType)(v->GetType() & 0x0FFF ) != t) )
bByVal = TRUE;
}
@@ -736,7 +745,7 @@ BOOL SbiRuntime::Step()
else if( eOp >= SbOP1_START && eOp <= SbOP1_END )
{
nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24;
-
+
(this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 );
}
else if( eOp >= SbOP2_START && eOp <= SbOP2_END )
@@ -775,7 +784,7 @@ BOOL SbiRuntime::Step()
pInst->nErl = nLine;
pErrCode = pCode;
pErrStmnt = pStmnt;
- // An error occured in an error handler
+ // An error occured in an error handler
// force parent handler ( if there is one )
// to handle the error
bool bLetParentHandleThis = false;
@@ -789,14 +798,14 @@ BOOL SbiRuntime::Step()
StepRESUME( 1 );
else if( pError ) // On Error Goto ...
pCode = pError;
- else
+ else
bLetParentHandleThis = true;
}
else
{
bLetParentHandleThis = true;
pError = NULL; //terminate the handler
- }
+ }
if ( bLetParentHandleThis )
{
// AB 13.2.1997, neues Error-Handling:
@@ -930,7 +939,7 @@ sal_Int32 SbiRuntime::translateErrorToVba( SbError nError, String& rMsg )
DBG_ASSERT( nTmp, "No VB error!" );
#endif
- StarBASIC::MakeErrorText( nError, rMsg );
+ StarBASIC::MakeErrorText( nError, rMsg );
rMsg = StarBASIC::GetErrorText();
if ( !rMsg.Len() ) // no message for err no, need localized resource here
rMsg = String( RTL_CONSTASCII_USTRINGPARAM("Internal Object Error:") );
@@ -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 )
@@ -1258,11 +1284,11 @@ void SbiRuntime::DllCall
}
USHORT
SbiRuntime::GetImageFlag( USHORT n ) const
-{
- return pImg->GetFlag( n );
-}
+{
+ return pImg->GetFlag( n );
+}
USHORT
SbiRuntime::GetBase()
-{
+{
return pImg->GetBase();
}
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index d621a12f0f..c23ebe8e70 100644
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 7d1f92fcf4..c714832608 100644
--- a/basic/source/runtime/step0.cxx
+++ b/basic/source/runtime/step0.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 );
@@ -105,23 +82,28 @@ void SbiRuntime::StepCompare( SbxOperator eOp )
SbxVariableRef p1 = PopVar();
SbxVariableRef p2 = PopVar();
- // Make sure objects with default params have
+ // Make sure objects with default params have
// values ( and type ) set as appropriate
- SbxDataType p1Type = p1->GetType();
- SbxDataType p2Type = p2->GetType();
+ 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
+ // 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
}
@@ -212,7 +212,7 @@ namespace
sResult.Append('^');
- while (start < end)
+ while (start < end)
{
switch (*start)
{
@@ -394,20 +394,20 @@ void SbiRuntime::StepPUT()
refVar->SetFlag( SBX_WRITE );
}
- // if left side arg is an object or variant and right handside isn't
- // either an object or a variant then try and see if a default
+ // if left side arg is an object or variant and right handside isn't
+ // either an object or a variant then try and see if a default
// property exists.
// to use e.g. Range{"A1") = 34
- // could equate to Range("A1").Value = 34
+ // could equate to Range("A1").Value = 34
if ( bVBAEnabled )
{
- if ( refVar->GetType() == SbxOBJECT )
+ if ( refVar->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVar );
if ( pDflt )
refVar = pDflt;
}
- if ( refVal->GetType() == SbxOBJECT )
+ if ( refVal->GetType() == SbxOBJECT )
{
SbxVariable* pDflt = getDefaultProp( refVal );
if ( pDflt )
@@ -511,7 +511,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
// if it is then use the object not the default property
SbxObject* pObj = NULL;
-
+
pObj = PTR_CAST(SbxObject,(SbxVariable*)refVar);
// calling GetObject on a SbxEMPTY variable raises
@@ -520,7 +520,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
{
SbxBase* pObjVarObj = refVar->GetObject();
pObj = PTR_CAST(SbxObject,pObjVarObj);
- }
+ }
SbxVariable* pDflt = NULL;
if ( pObj || bLHSHasDefaultProp )
// lhs is either a valid object || or has a defaultProp
@@ -528,8 +528,8 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
if ( pDflt )
refVal = pDflt;
}
- }
-
+ }
+
// Handle withevents
BOOL bWithEvents = refVar->IsSet( SBX_WITH_EVENTS );
if ( bWithEvents )
@@ -559,7 +559,7 @@ void SbiRuntime::StepSET_Impl( SbxVariableRef& refVal, SbxVariableRef& refVar, b
}
// lhs is a property who's value is currently (Empty e.g. no broadcast yet)
- // in this case if there is a default prop involved the value of the
+ // in this case if there is a default prop involved the value of the
// default property may infact be void so the type will also be SbxEMPTY
// in this case we do not want to call checkUnoStructCopy 'cause that will
// cause an error also
@@ -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!
@@ -737,7 +748,7 @@ void implCopyDimArray( SbxDimArray* pNewArray, SbxDimArray* pOldArray, short nMa
{
if( nActualDim < nMaxDimIndex )
{
- implCopyDimArray( pNewArray, pOldArray, nMaxDimIndex, nActualDim + 1,
+ implCopyDimArray( pNewArray, pOldArray, nMaxDimIndex, nActualDim + 1,
pActualIndices, pLowerBounds, pUpperBounds );
}
else
@@ -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() )
@@ -903,7 +909,7 @@ void lcl_eraseImpl( SbxVariableRef& refVar, bool bVBAEnabled )
SbxArray* pArray = PTR_CAST(SbxArray,pElemObj);
if ( pArray )
pArray->Clear();
- }
+ }
}
else
// AB 2.4.1996
@@ -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()
@@ -1083,7 +1086,7 @@ void SbiRuntime::StepINPUT()
// ErrorBox( NULL, WB_OK, aMsg ).Execute();
//****** DONT CHECK IN, TEST ONLY *******
//****** DONT CHECK IN, TEST ONLY *******
-
+
pCode = pRestart;
}
else
@@ -1324,7 +1327,7 @@ void SbiRuntime::StepERROR()
SbxVariableRef refCode = PopVar();
USHORT n = refCode->GetUShort();
SbError error = StarBASIC::GetSfxFromVBError( n );
- if ( bVBAEnabled )
+ if ( bVBAEnabled )
pInst->Error( error );
else
Error( error );
diff --git a/basic/source/runtime/step1.cxx b/basic/source/runtime/step1.cxx
index f448f7900b..0a82b9af57 100644
--- a/basic/source/runtime/step1.cxx
+++ b/basic/source/runtime/step1.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,7 +38,7 @@
#include "sbunoobj.hxx"
#include "errobject.hxx"
-bool checkUnoObjectType( SbUnoObject* refVal,
+bool checkUnoObjectType( SbUnoObject* refVal,
const String& aClass );
// Laden einer numerischen Konstanten (+ID)
@@ -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++ );
}
@@ -160,7 +169,7 @@ void SbiRuntime::StepPAD( UINT32 nOp1 )
void SbiRuntime::StepJUMP( UINT32 nOp1 )
{
#ifdef DBG_UTIL
- // #QUESTION shouln't this be
+ // #QUESTION shouln't this be
// if( (BYTE*)( nOp1+pImagGetCode() ) >= pImg->GetCodeSize() )
if( nOp1 >= pImg->GetCodeSize() )
StarBASIC::FatalError( SbERR_INTERNAL_ERROR );
@@ -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 );
}
@@ -443,7 +454,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
SbClassData* pClassData;
if( pClassMod && (pClassData=pClassMod->pClassData) != NULL )
{
- SbxVariable* pClassVar =
+ SbxVariable* pClassVar =
pClassData->mxIfaces->Find( aClass, SbxCLASS_DONTCARE );
bRet = (pClassVar != NULL);
}
@@ -452,7 +463,7 @@ bool SbiRuntime::implIsClass( SbxObject* pObj, const String& aClass )
return bRet;
}
-bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
+bool SbiRuntime::checkClass_Impl( const SbxVariableRef& refVal,
const String& aClass, bool bRaiseErrors, bool bDefault )
{
bool bOk = bDefault;
diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx
index 419f00bd21..5068470278 100644
--- a/basic/source/runtime/step2.cxx
+++ b/basic/source/runtime/step2.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -96,7 +96,7 @@ SbxVariable* SbiRuntime::FindElement
if( bLocal )
{
if ( bStatic )
- {
+ {
if ( pMeth )
pElem = pMeth->GetStatics()->Find( aName, SbxCLASS_DONTCARE );
}
@@ -139,7 +139,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!
@@ -259,10 +259,10 @@ SbxVariable* SbiRuntime::FindElement
if( bSet )
pElem->SetType( t2 );
pElem = pNew;
- }
+ }
// Index-Access bei UnoObjekten beruecksichtigen
- // definitely we want this for VBA where properties are often
- // collections ( which need index access ), but lets only do
+ // definitely we want this for VBA where properties are often
+ // collections ( which need index access ), but lets only do
// this if we actually have params following
else if( bVBAEnabled && pElem->ISA(SbUnoProperty) && pElem->GetParameters() )
{
@@ -455,7 +455,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);
@@ -487,7 +487,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 )
@@ -679,7 +679,7 @@ void SbiRuntime::StepPARAM( UINT32 nOp1, UINT32 nOp2 )
p = new SbxVariable();
if( SbiRuntime::isVBAEnabled() &&
- (t == SbxOBJECT || t == SbxSTRING) )
+ (t == SbxOBJECT || t == SbxSTRING) )
{
if( t == SbxOBJECT )
p->PutObject( NULL );
@@ -731,6 +731,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 ) );
@@ -1170,11 +1172,11 @@ void SbiRuntime::StepGLOBAL( UINT32 nOp1, UINT32 nOp2 )
String aName( pImg->GetString( static_cast<short>( nOp1 ) ) );
SbxDataType t = (SbxDataType)(nOp2 & 0xffff);
- // Store module scope variables at module scope
+ // Store module scope variables at module scope
// in non vba mode these are stored at the library level :/
// not sure if this really should not be enabled for ALL basic
SbxObject* pStorage = &rBasic;
- if ( SbiRuntime::isVBAEnabled() )
+ if ( SbiRuntime::isVBAEnabled() )
{
pStorage = pMod;
pMod->AddVarName( aName );
diff --git a/basic/source/sbx/sbxvalue.cxx b/basic/source/sbx/sbxvalue.cxx
index 2200aaa8c8..ebf05b6b73 100644
--- a/basic/source/sbx/sbxvalue.cxx
+++ b/basic/source/sbx/sbxvalue.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -301,7 +301,7 @@ SbxValue& SbxValue::operator=( const SbxValue& r )
{
// string -> byte array
if( IsFixed() && (aData.eType == SbxOBJECT)
- && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
+ && aData.pObj && ( aData.pObj->GetType() == (SbxARRAY | SbxBYTE) )
&& (r.aData.eType == SbxSTRING) )
{
::rtl::OUString aStr = r.GetString();
@@ -1122,7 +1122,7 @@ BOOL SbxValue::Convert( SbxDataType eTo )
BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
- bool bVBAInterop = SbiRuntime::isVBAEnabled();
+ bool bVBAInterop = SbiRuntime::isVBAEnabled();
SbxDataType eThisType = GetType();
SbxDataType eOpType = rOp.GetType();
@@ -1137,8 +1137,8 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
else if( eThisType == SbxNULL || eOpType == SbxNULL )
SetType( SbxNULL );
// Sonderregel 2: Ist ein Operand Empty, ist das Ergebnis der 2. Operand
- else if( eThisType == SbxEMPTY
- && !bVBAInterop
+ else if( eThisType == SbxEMPTY
+ && !bVBAInterop
)
*this = rOp;
// 13.2.96: Nicht schon vor Get auf SbxEMPTY pruefen
@@ -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;
@@ -1288,7 +1295,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
}
}
- else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL ) &&
+ else if( ( GetType() == SbxDECIMAL || rOp.GetType() == SbxDECIMAL ) &&
( eOp == SbxMUL || eOp == SbxDIV || eOp == SbxPLUS || eOp == SbxMINUS || eOp == SbxNEG ) )
{
aL.eType = aR.eType = SbxDECIMAL;
@@ -1300,7 +1307,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
releaseDecimalPtr( aL.pDecimal );
goto Lbl_OpIsEmpty;
}
- if( Get( aL ) )
+ if( Get( aL ) )
{
if( aL.pDecimal && aR.pDecimal )
{
@@ -1371,7 +1378,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
{
SetError( SbxERR_ZERODIV );
}
- else
+ else
{
// #i20704 Implement directly
BigInt b1( aL.nLong64 );
@@ -1397,7 +1404,7 @@ BOOL SbxValue::Compute( SbxOperator eOp, const SbxValue& rOp )
}
}
else
-Lbl_OpIsDouble:
+Lbl_OpIsDouble:
{ // Andere Operatoren
aL.eType = aR.eType = SbxDOUBLE;
if( rOp.Get( aR ) )
@@ -1456,7 +1463,7 @@ Lbl_OpIsEmpty:
BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
{
- bool bVBAInterop = SbiRuntime::isVBAEnabled();
+ bool bVBAInterop = SbiRuntime::isVBAEnabled();
BOOL bRes = FALSE;
SbxError eOld = GetError();
@@ -1476,12 +1483,12 @@ BOOL SbxValue::Compare( SbxOperator eOp, const SbxValue& rOp ) const
// Sonderregel 2: Wenn beide Variant sind und einer ist numerisch,
// und der andere ein String, ist num < str
else if( !IsFixed() && !rOp.IsFixed()
- && ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop
+ && ( rOp.GetType() == SbxSTRING && GetType() != SbxSTRING && IsNumeric() ) && !bVBAInterop
)
bRes = BOOL( eOp == SbxLT || eOp == SbxLE || eOp == SbxNE );
else if( !IsFixed() && !rOp.IsFixed()
- && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() )
-&& !bVBAInterop
+ && ( GetType() == SbxSTRING && rOp.GetType() != SbxSTRING && rOp.IsNumeric() )
+&& !bVBAInterop
)
bRes = BOOL( eOp == SbxGT || eOp == SbxGE || eOp == SbxNE );
else
@@ -1813,7 +1820,7 @@ BOOL SbxValue::StoreData( SvStream& r ) const
break;
case SbxCHAR:
{
- char c = sal::static_int_cast< char >(aData.nChar);
+ char c = sal::static_int_cast< char >(aData.nChar);
r << c;
break;
}
diff --git a/basic/source/uno/dlgcont.cxx b/basic/source/uno/dlgcont.cxx
index aee3d18392..c1772422bc 100644
--- a/basic/source/uno/dlgcont.cxx
+++ b/basic/source/uno/dlgcont.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -258,7 +258,7 @@ void SfxDialogLibraryContainer::storeLibrariesToStorage( const uno::Reference< e
Any SAL_CALL SfxDialogLibraryContainer::importLibraryElement
( const Reference < XNameContainer >& /*xLib*/,
- const OUString& /*aElementName */, const OUString& aFile,
+ const OUString& /*aElementName */, const OUString& aFile,
const uno::Reference< io::XInputStream >& xElementStream )
{
Any aRetAny;
@@ -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 22d000f5ce..30402ac132 100644
--- a/basic/source/uno/scriptcont.cxx
+++ b/basic/source/uno/scriptcont.cxx
@@ -64,7 +64,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
{
@@ -135,7 +136,6 @@ sal_Bool SfxScriptLibraryContainer::hasLibraryPassword( const String& rLibraryNa
return pImplLib->mbPasswordProtected;
}
-
// Ctor for service
SfxScriptLibraryContainer::SfxScriptLibraryContainer( void )
:maScriptLanguage( RTL_CONSTASCII_USTRINGPARAM( "StarBasic" ) )
@@ -1163,6 +1163,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 1ccdf2d487..5b84beade4 100644
--- a/formula/inc/formula/FormulaCompiler.hxx
+++ b/formula/inc/formula/FormulaCompiler.hxx
@@ -220,6 +220,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 3c87ce3855..739504435f 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 )
{
@@ -973,44 +997,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 251c9859e4..3c2584126a 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 3a9cd0270b..ed6471d1b1 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1402,7 +1402,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 d75708e9c1..3c3c5dbde3 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Writer.xcs
@@ -2,7 +2,7 @@
<!--***********************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 33e28e2c73..972e8b3445 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 2a9830568d..c1490fc643 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 ee5c8330cb..9a4cef9682 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 bb45cafdac..04181bb33c 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/XFileDialog.idl b/oovbaapi/ooo/vba/XFileDialog.idl
new file mode 100644
index 0000000000..f7639860ca
--- /dev/null
+++ b/oovbaapi/ooo/vba/XFileDialog.idl
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_excel_XFileDialog_idl__
+#define __ooo_vba_excel_XFileDialog_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#include <ooo/vba/XFileDialogSelectedItems.idl>
+
+//=============================================================================
+
+module ooo { module vba {
+
+//=============================================================================
+
+interface XFileDialog : com::sun::star::uno::XInterface
+{
+ [attribute, readonly] ooo::vba::XFileDialogSelectedItems SelectedItems;
+
+ long Show();
+};
+
+}; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl b/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
new file mode 100644
index 0000000000..6ff2138de7
--- /dev/null
+++ b/oovbaapi/ooo/vba/XFileDialogSelectedItems.idl
@@ -0,0 +1,53 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef __ooo_vba_excel_XFileDialogSelectedItems_idl__
+#define __ooo_vba_excel_XFileDialogSelectedItems_idl__
+
+// #ifndef __com_sun_star_uno_XInterface_idl__
+// #include <com/sun/star/uno/XInterface.idl>
+// #endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+//=============================================================================
+
+module ooo { module vba {
+
+//=============================================================================
+
+interface XFileDialogSelectedItems
+{
+ interface ooo::vba::XCollection;
+};
+
+}; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/XFileSearch.idl b/oovbaapi/ooo/vba/XFileSearch.idl
new file mode 100644
index 0000000000..7b67c995fa
--- /dev/null
+++ b/oovbaapi/ooo/vba/XFileSearch.idl
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_XFileSearch_idl__
+#define __ooo_vba_XFileSearch_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XFoundFiles_idl__
+#include <ooo/vba/XFoundFiles.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba {
+//=============================================================================
+
+interface XFileSearch
+{
+ interface ::com::sun::star::uno::XInterface;
+
+ [attribute] string FileName;
+ [attribute] string LookIn;
+ [attribute] boolean SearchSubFolders;
+ [attribute] boolean MatchTextExactly;
+ [attribute, readonly] XFoundFiles FoundFiles;
+
+ long Execute();
+ void NewSearch();
+};
+
+}; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/XFoundFiles.idl b/oovbaapi/ooo/vba/XFoundFiles.idl
new file mode 100644
index 0000000000..a11fa98e6b
--- /dev/null
+++ b/oovbaapi/ooo/vba/XFoundFiles.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_XFoundFiles_idl__
+#define __ooo_vba_XFoundFiles_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba {
+//=============================================================================
+
+interface XFoundFiles
+{
+ interface ooo::vba::XCollection;
+};
+
+}; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index ac1f4c4ee0..0096b04cdc 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -32,7 +32,15 @@
#include <ooo/vba/XHelperInterface.idl>
#include <ooo/vba/XAssistant.idl>
-module ooo { module vba { module excel {
+#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;
interface XWorkbook;
@@ -41,13 +49,15 @@ interface XWorksheets;
interface XWorksheetFunction;
interface XWindow;
interface XWorksheet;
+interface XFileDialog;
+interface XFileSearch;
interface XApplication
{
// Application serves as WorksheetFunction object with little differences
interface ::com::sun::star::beans::XExactName;
interface ::com::sun::star::script::XInvocation;
-
+
// interface ::ooo::vba::XHelperInterface;
[attribute, readonly] any Selection;
@@ -56,19 +66,26 @@ 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;
[attribute] any CutCopyMode;
[attribute] any StatusBar;
- [attribute] long Cursor;
+ [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);
+ 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);
@@ -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 ad9d85eb45..c3104cebf8 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/XMenu.idl b/oovbaapi/ooo/vba/excel/XMenu.idl
new file mode 100644
index 0000000000..eece24c5e6
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenu.idl
@@ -0,0 +1,28 @@
+#ifndef __ooo_vba_excel_XMenu_idl__
+#define __ooo_vba_excel_XMenu_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+//=============================================================================
+
+module ooo { module vba { module excel {
+//=============================================================================
+
+interface XMenu
+{
+ interface XHelperInterface;
+
+ [attribute] string Caption;
+
+ void Delete() raises ( com::sun::star::script::BasicErrorException );
+ any MenuItems( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XMenuBar.idl b/oovbaapi/ooo/vba/excel/XMenuBar.idl
new file mode 100644
index 0000000000..6513706052
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenuBar.idl
@@ -0,0 +1,25 @@
+#ifndef __ooo_vba_excel_XMenuBar_idl__
+#define __ooo_vba_excel_XMenuBar_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+//=============================================================================
+
+module ooo { module vba { module excel {
+//=============================================================================
+
+interface XMenuBar
+{
+ interface XHelperInterface;
+
+ any Menus( [in] any Index ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XMenuBars.idl b/oovbaapi/ooo/vba/excel/XMenuBars.idl
new file mode 100644
index 0000000000..597ccebe2f
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenuBars.idl
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XMenuBars.idl,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_excel_XMenuBars_idl__
+#define __ooo_vba_excel_XMenuBars_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
+#include <com/sun/star/script/BasicErrorException.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+interface XMenuBars
+{
+ interface ooo::vba::XCollection;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XMenuItem.idl b/oovbaapi/ooo/vba/excel/XMenuItem.idl
new file mode 100644
index 0000000000..2941b7ac40
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenuItem.idl
@@ -0,0 +1,28 @@
+#ifndef __ooo_vba_excel_XMenuItem_idl__
+#define __ooo_vba_excel_XMenuItem_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+//=============================================================================
+
+module ooo { module vba { module excel {
+//=============================================================================
+
+interface XMenuItem
+{
+ interface XHelperInterface;
+
+ [attribute] string Caption;
+ [attribute] string OnAction;
+
+ void Delete() raises ( com::sun::star::script::BasicErrorException );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XMenuItems.idl b/oovbaapi/ooo/vba/excel/XMenuItems.idl
new file mode 100644
index 0000000000..0c92583d0a
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenuItems.idl
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XMenuItems.idl,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_excel_XMenuItems_idl__
+#define __ooo_vba_excel_XMenuItems_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
+#include <com/sun/star/script/BasicErrorException.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+interface XMenuItem;
+
+interface XMenuItems
+{
+ interface ooo::vba::XCollection;
+
+ XMenuItem Add( [in] string Caption, [in] any OnAction, [in] any ShortcutKey, [in] any Before, [in] any Restore, [in] any StatusBar, [in] any HelpFile, [in] any HelpContextID ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XMenus.idl b/oovbaapi/ooo/vba/excel/XMenus.idl
new file mode 100644
index 0000000000..770f9751e7
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XMenus.idl
@@ -0,0 +1,68 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XMenus.idl,v $
+ * $Revision: 1.0 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_excel_XMenus_idl__
+#define __ooo_vba_excel_XMenus_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+#ifndef __com_sun_star_helper_script_BasicErrorException_idl__
+#include <com/sun/star/script/BasicErrorException.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+interface XMenu;
+
+interface XMenus
+{
+ interface ooo::vba::XCollection;
+
+ XMenu Add( [in] string Caption, [in] any Before, [in] any Restore ) raises ( com::sun::star::script::BasicErrorException );
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XName.idl b/oovbaapi/ooo/vba/excel/XName.idl
index 6397e7a9c2..e5faa0ab58 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 70a1ae88c7..31ad1a57b6 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 65fd014e18..375e5a0d71 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/XQueryTable.idl b/oovbaapi/ooo/vba/excel/XQueryTable.idl
new file mode 100644
index 0000000000..893fa3062d
--- /dev/null
+++ b/oovbaapi/ooo/vba/excel/XQueryTable.idl
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_excel_XQueryTable_idl__
+#define __ooo_vba_excel_XQueryTable_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba__XHelperInterface_idl__
+#define __ooo_vba__XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module excel {
+
+//=============================================================================
+
+interface XQueryTable
+{
+ interface com::sun::star::uno::XInterface;
+ //interface ooo::vba::XHelperInterface;
+ boolean Refresh([in] any aBackgroundQuery);
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/excel/XRange.idl b/oovbaapi/ooo/vba/excel/XRange.idl
index 5d59a3baec..30edc48ecb 100644
--- a/oovbaapi/ooo/vba/excel/XRange.idl
+++ b/oovbaapi/ooo/vba/excel/XRange.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
@@ -56,7 +59,7 @@
#endif
//=============================================================================
-module ooo { module vba { module excel {
+module ooo { module vba { module excel {
interface XFont;
interface XRows;
@@ -69,15 +72,19 @@ 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] any Value;
+ [attribute, readonly] any Name;
+ [attribute] any Value;
[attribute] any Formula;
[attribute] any FormulaArray;
[attribute] any FormulaR1C1;
@@ -102,8 +109,9 @@ interface XRange
[attribute] any Style;
[attribute] any AddIndent;
[attribute] any ShowDetail;
+ [attribute, readonly] XQueryTable QueryTable;
- XComment AddComment( [in] any Text );
+ XComment AddComment( [in] any Text );
void Clear();
void ClearComments();
void ClearContents();
@@ -116,9 +124,9 @@ interface XRange
XRange Item([in] any row, [in] any column) raises(com::sun::star::script::BasicErrorException);
XRange Offset([in] any RowOffset, [in] any ColumnOffset);
XRange CurrentRegion();
- XRange CurrentArray();
+ XRange CurrentArray();
string Characters([in] any Start, [in] any Length);
- string Address( [in] any RowAbsolute, [in] any ColumnAbsolute, [in] any ReferenceStyle, [in] any External, [in] any RelativeTo );
+ string Address( [in] any RowAbsolute, [in] any ColumnAbsolute, [in] any ReferenceStyle, [in] any External, [in] any RelativeTo );
XRange Cells([in] any RowIndex, [in] any ColumnIndex);
void Select();
void AutoOutline() raises(com::sun::star::script::BasicErrorException);
@@ -134,10 +142,10 @@ interface XRange
void PasteSpecial([in] any Paste, [in] any Operation,[in] any SkipBlanks, [in] any Transpose);
boolean Replace( [in] string What, [in] string Replacement, [in] any LookAt, [in] any SearchOrder, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat, [in] any ReplaceFormat );
XRange Find( [in] any What, [in] any After, [in] any LookIn, [in] any LookAt, [in] any SearchOrder, [in] any SearchDirection, [in] any MatchCase, [in] any MatchByte, [in] any SearchFormat );
-
+
void Sort( [in] any Key1, [in] any Order1, [in] any Key2, [in] any Type,
[in] any Order2, [in] any Key3, [in] any Order3,
- [in] any Header, [in] any OrderCustom, [in] any MatchCase,
+ [in] any Header, [in] any OrderCustom, [in] any MatchCase,
[in] any Orientation, [in] any SortMethod, [in] any DataOption1,
[in] any DataOption2, [in] any DataOption3 );
XRange End( [in] long Direction );
@@ -145,7 +153,7 @@ interface XRange
// idl complains
XCharacters characters([in] any Start, [in] any Length);
void Delete( [in] any Shift );
-
+
any Areas( [in] any item );
any BorderAround( [in] any LineStyle, [in] any Weight, [in] any ColorIndex, [in] any Color );
void AutoFilter([in ] any Field, [in] any Criteria1, [in] any Operator, [in] any Criteria2, [in] any VisibleDropDown);
@@ -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 e35b661a44..317b1fb215 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 a6d86957ec..8b0aee0575 100644
--- a/oovbaapi/ooo/vba/excel/XWorksheet.idl
+++ b/oovbaapi/ooo/vba/excel/XWorksheet.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -38,13 +38,14 @@
#ifndef __com_sun_star_script_XInvocation_idl__
#include <com/sun/star/script/XInvocation.idl>
#endif
-
+
+
#ifndef __com_sun_star_container_XNamed_idl__
#include <com/sun/star/container/XNamed.idl>
#endif
//=============================================================================
-module ooo { module vba { module excel {
+module ooo { module vba { module excel {
//=============================================================================
@@ -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);
@@ -119,7 +120,7 @@ interface XWorksheet
any Names( [in] any Index );
any Evaluate( [in] string Name);
-
+
void setEnableCalculation([in] boolean EnableCalculation) raises(com::sun::star::script::BasicErrorException);
boolean getEnableCalculation() raises(com::sun::star::script::BasicErrorException);
void PrintOut( [in] any From, [in] any To, [in] any Copies, [in] any Preview, [in] any ActivePrinter, [in] any PrintToFile, [in] any Collate, [in] any PrToFileName, [in] any IgnorePrintAreas );
diff --git a/oovbaapi/ooo/vba/excel/makefile.mk b/oovbaapi/ooo/vba/excel/makefile.mk
index 2515880867..428062f5c9 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 4f6d378cfe..bacb05fb6f 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 e7532e3cb2..c2ca0877ff 100644
--- a/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
+++ b/oovbaapi/ooo/vba/msforms/MSFormReturnTypes.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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/XCheckBox.idl b/oovbaapi/ooo/vba/msforms/XCheckBox.idl
new file mode 100644
index 0000000000..f7001fa262
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XCheckBox.idl
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: XCheckBox.idl,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_msforms_XCheckBox_idl__
+#define __ooo_vba_msforms_XCheckBox_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+//=============================================================================
+
+module ooo { module vba { module msforms {
+
+//=============================================================================
+interface XCheckBox: com::sun::star::uno::XInterface
+{
+ [attribute] string Caption;
+ [attribute] any Value;
+};
+
+//=============================================================================
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XComboBox.idl b/oovbaapi/ooo/vba/msforms/XComboBox.idl
index 8581392dd1..49e4320c2a 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 50d15db3aa..42abf15426 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 60427f6e4e..ea4d9448a8 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 627c5418bf..6ee54502e0 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/XReturnBoolean.idl b/oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
new file mode 100644
index 0000000000..6ffc4d1be9
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XReturnBoolean.idl
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
+#define __ooo_vba_msforms_XReturnInteger_idl__
+
+#ifndef __com_sun_star_script_XDefaultProperty_idl__
+#include <com/sun/star/script/XDefaultProperty.idl>
+#endif
+//=============================================================================
+
+module msforms
+{
+
+//=============================================================================
+interface XReturnBoolean: com::sun::star::script::XDefaultProperty
+{
+ [attribute] boolean Value;
+};
+//=============================================================================
+
+};
+
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XReturnInteger.idl b/oovbaapi/ooo/vba/msforms/XReturnInteger.idl
new file mode 100644
index 0000000000..3f7d7975cf
--- /dev/null
+++ b/oovbaapi/ooo/vba/msforms/XReturnInteger.idl
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __ooo_vba_msforms_XReturnInteger_idl__
+#define __ooo_vba_msforms_XReturnInteger_idl__
+
+#ifndef __com_sun_star_script_XDefaultProperty_idl__
+#include <com/sun/star/script/XDefaultProperty.idl>
+#endif
+//=============================================================================
+
+module msforms
+{
+
+//=============================================================================
+interface XReturnInteger: com::sun::star::script::XDefaultProperty
+{
+ [attribute] long Value;
+};
+//=============================================================================
+
+};
+
+#endif
diff --git a/oovbaapi/ooo/vba/msforms/XShape.idl b/oovbaapi/ooo/vba/msforms/XShape.idl
index e8682a6d8e..eec1a7fb20 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 d5b0df20ea..2d936e087b 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 56ac4caf87..ebf4d2ee89 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 e6cde02f81..311f981afe 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/XCell.idl b/oovbaapi/ooo/vba/word/XCell.idl
new file mode 100644
index 0000000000..be075e2df2
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XCell.idl
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XCell_idl__
+#define __ooo_vba_word_XCell_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XCell
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] long Width;
+ [attribute] any Height;
+ [attribute] long HeightRule;
+
+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XCells.idl b/oovbaapi/ooo/vba/word/XCells.idl
new file mode 100644
index 0000000000..b1f1d9f960
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XCells.idl
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XCells_idl__
+#define __ooo_vba_word_XCells_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XCells
+{
+ interface ::ooo::vba::XCollection;
+
+ [attribute] long Width;
+ [attribute] any Height;
+ [attribute] long HeightRule;
+
+ void SetWidth( [in] float ColumnWidth, [in] long RulerStyle );
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XCheckBox.idl b/oovbaapi/ooo/vba/word/XCheckBox.idl
new file mode 100644
index 0000000000..d0733a150a
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XCheckBox.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XCheckBox_idl__
+#define __ooo_vba_word_XCheckBox_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XCheckBox
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] boolean Value;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XColumn.idl b/oovbaapi/ooo/vba/word/XColumn.idl
new file mode 100644
index 0000000000..273cbdce26
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XColumn.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XColumn_idl__
+#define __ooo_vba_word_XColumn_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XColumn
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] long Width;
+
+ void Select();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XColumns.idl b/oovbaapi/ooo/vba/word/XColumns.idl
new file mode 100644
index 0000000000..9e2e4447cd
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XColumns.idl
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XColumns_idl__
+#define __ooo_vba_word_XColumns_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XColumns
+{
+ interface ::ooo::vba::XCollection;
+
+ [attribute] long Width;
+
+ void Select();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XDocument.idl b/oovbaapi/ooo/vba/word/XDocument.idl
index 4b55552856..1ab2080f2c 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 d610da631c..29d30aa631 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/XFormField.idl b/oovbaapi/ooo/vba/word/XFormField.idl
new file mode 100644
index 0000000000..37c334e83c
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XFormField.idl
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XFormField_idl__
+#define __ooo_vba_word_XFormField_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XFormField
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] string Result;
+ [attribute] boolean Enabled;
+
+ any CheckBox();
+
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XFormFields.idl b/oovbaapi/ooo/vba/word/XFormFields.idl
new file mode 100644
index 0000000000..5160604a8f
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XFormFields.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XFormFields_idl__
+#define __ooo_vba_word_XFormFields_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XFormFields
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XFrame.idl b/oovbaapi/ooo/vba/word/XFrame.idl
new file mode 100644
index 0000000000..a81f46e731
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XFrame.idl
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XFrame_idl__
+#define __ooo_vba_word_XFrame_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+#ifndef __com_sun_star_container_XNamed_idl__
+#include <com/sun/star/container/XNamed.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XFrame
+{
+ interface ooo::vba::XHelperInterface;
+
+ void Select();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XFrames.idl b/oovbaapi/ooo/vba/word/XFrames.idl
new file mode 100644
index 0000000000..5cff31cd94
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XFrames.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XFrames_idl__
+#define __ooo_vba_word_XFrames_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XFrames
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XGlobals.idl b/oovbaapi/ooo/vba/word/XGlobals.idl
index 45b52fc2fb..c3cfd6de45 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/XHeadersFooters.idl b/oovbaapi/ooo/vba/word/XHeadersFooters.idl
new file mode 100644
index 0000000000..5d92b04afd
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XHeadersFooters.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XHeadersFooters_idl__
+#define __ooo_vba_word_XHeadersFooters_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XHeadersFooters
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListFormat.idl b/oovbaapi/ooo/vba/word/XListFormat.idl
new file mode 100644
index 0000000000..93eccfa944
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListFormat.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListFormat_idl__
+#define __ooo_vba_word_XListFormat_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XListTemplate;
+interface XListFormat
+{
+ interface ooo::vba::XHelperInterface;
+
+ void ApplyListTemplate([in] XListTemplate ListTemplate,
+ [in] any /* optional */ ContinuePreviousList,
+ [in] any /* optional */ ApplyTo,
+ [in] any /* optional */ DefaultListBehavior);
+
+ void ConvertNumbersToText();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListGalleries.idl b/oovbaapi/ooo/vba/word/XListGalleries.idl
new file mode 100644
index 0000000000..e6158caab9
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListGalleries.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListGalleries_idl__
+#define __ooo_vba_word_XListGalleries_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XListGalleries
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListGallery.idl b/oovbaapi/ooo/vba/word/XListGallery.idl
new file mode 100644
index 0000000000..47f68f3c8d
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListGallery.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListGallery_idl__
+#define __ooo_vba_word_XListGallery_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XListGallery
+{
+ interface ooo::vba::XHelperInterface;
+
+ any ListTemplates( [in] any aIndex );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListLevel.idl b/oovbaapi/ooo/vba/word/XListLevel.idl
new file mode 100644
index 0000000000..897dd7939b
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListLevel.idl
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListLevel_idl__
+#define __ooo_vba_word_XListLevel_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XFont;
+interface XListLevel
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] long Alignment;
+ [attribute] XFont Font;
+ [attribute, readonly] long Index;
+ [attribute] string LinkedStyle;
+ [attribute] string NumberFormat;
+ [attribute] float NumberPosition;
+ [attribute] long NumberStyle;
+ [attribute] long ResetOnHigher;
+ [attribute] long StartAt;
+ [attribute] float TabPosition;
+ [attribute] float TextPosition;
+ [attribute] long TrailingCharacter;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListLevels.idl b/oovbaapi/ooo/vba/word/XListLevels.idl
new file mode 100644
index 0000000000..30e59b6f5a
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListLevels.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListLevels_idl__
+#define __ooo_vba_word_XListLevels_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XListLevels
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListTemplate.idl b/oovbaapi/ooo/vba/word/XListTemplate.idl
new file mode 100644
index 0000000000..eadd982448
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListTemplate.idl
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListTemplate_idl__
+#define __ooo_vba_word_XListTemplate_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XListTemplate
+{
+ interface ooo::vba::XHelperInterface;
+
+ any ListLevels( [in] any aIndex );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XListTemplates.idl b/oovbaapi/ooo/vba/word/XListTemplates.idl
new file mode 100644
index 0000000000..6d7cfcc659
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XListTemplates.idl
@@ -0,0 +1,55 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XListTemplates_idl__
+#define __ooo_vba_word_XListTemplates_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XListTemplates
+{
+ interface ::ooo::vba::XCollection;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XParagraph.idl b/oovbaapi/ooo/vba/word/XParagraph.idl
index 057875d7e7..a585e32cb0 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 868613c6af..4bed0c0fb9 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 2d6dcd2840..778f9e1184 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/XRevision.idl b/oovbaapi/ooo/vba/word/XRevision.idl
new file mode 100644
index 0000000000..17d1772a2a
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XRevision.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XRevision_idl__
+#define __ooo_vba_word_XRevision_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XRange;
+interface XRevision
+{
+ interface ooo::vba::XHelperInterface;
+
+ void Accept();
+ void Reject();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XRevisions.idl b/oovbaapi/ooo/vba/word/XRevisions.idl
new file mode 100644
index 0000000000..abed41bf1d
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XRevisions.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XRevisions_idl__
+#define __ooo_vba_word_XRevisions_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XRevisions
+{
+ interface ::ooo::vba::XCollection;
+
+ void AcceptAll();
+ void RejectAll();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XRow.idl b/oovbaapi/ooo/vba/word/XRow.idl
new file mode 100644
index 0000000000..7b296ee73d
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XRow.idl
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XRow_idl__
+#define __ooo_vba_word_XRow_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XRow
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] any Height;
+ [attribute] long HeightRule;
+
+ void Select();
+ void SetHeight( [in] float RowHeight, [in] long HeightRule );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XRows.idl b/oovbaapi/ooo/vba/word/XRows.idl
new file mode 100644
index 0000000000..e0d855c6ff
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XRows.idl
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XRows_idl__
+#define __ooo_vba_word_XRows_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XRows
+{
+ interface ::ooo::vba::XCollection;
+
+ [attribute] long Alignment;
+ [attribute] any AllowBreakAcrossPages;
+ [attribute] float SpaceBetweenColumns;
+
+ void Delete();
+ void SetLeftIndent( [in] float LeftIndent, [in] long RulerStyle );
+ void Select();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XSection.idl b/oovbaapi/ooo/vba/word/XSection.idl
index 325ddf5dc8..ec4569b03e 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 053cbc67e1..3cbcfaaf08 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 b89798d30b..1c0f30534a 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/XTabStop.idl b/oovbaapi/ooo/vba/word/XTabStop.idl
new file mode 100644
index 0000000000..4cd068e21e
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XTabStop.idl
@@ -0,0 +1,50 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XTabStop_idl__
+#define __ooo_vba_word_XTabStop_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XTabStop
+{
+ interface ooo::vba::XHelperInterface;
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XTabStops.idl b/oovbaapi/ooo/vba/word/XTabStops.idl
new file mode 100644
index 0000000000..eaccadaab6
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XTabStops.idl
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XTabStops_idl__
+#define __ooo_vba_word_XTabStops_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XTabStop;
+interface XTabStops
+{
+ interface ::ooo::vba::XCollection;
+
+ XTabStop Add([in] float Position, [in] any Alignment, [in] any Leader );
+ void ClearAll();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XTable.idl b/oovbaapi/ooo/vba/word/XTable.idl
index 235067c4bf..1d21c4db50 100644
--- a/oovbaapi/ooo/vba/word/XTable.idl
+++ b/oovbaapi/ooo/vba/word/XTable.idl
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -39,7 +39,7 @@ module ooo { module vba { module word {
interface XRange;
-interface XTable
+interface XTable
{
interface ::ooo::vba::XHelperInterface;
[attribute, readonly ] string Name; // for debug only
@@ -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/XTableOfContents.idl b/oovbaapi/ooo/vba/word/XTableOfContents.idl
new file mode 100644
index 0000000000..30b9e06f16
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XTableOfContents.idl
@@ -0,0 +1,58 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XTableOfContents_idl__
+#define __ooo_vba_word_XTableOfContents_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XHelperInterface_idl__
+#include <ooo/vba/XHelperInterface.idl>
+#endif
+
+module ooo { module vba { module word {
+
+interface XTableOfContents
+{
+ interface ooo::vba::XHelperInterface;
+
+ [attribute] long LowerHeadingLevel;
+ [attribute] long TabLeader;
+ [attribute] boolean UseFields;
+ [attribute] boolean UseOutlineLevels;
+
+ void Delete();
+ void Update();
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XTablesOfContents.idl b/oovbaapi/ooo/vba/word/XTablesOfContents.idl
new file mode 100644
index 0000000000..8a14ca434c
--- /dev/null
+++ b/oovbaapi/ooo/vba/word/XTablesOfContents.idl
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile:
+ * $Revision:
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef __ooo_vba_word_XTablesOfContents_idl__
+#define __ooo_vba_word_XTablesOfContents_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+#ifndef __ooo_vba_XCollection_idl__
+#include <ooo/vba/XCollection.idl>
+#endif
+
+
+//=============================================================================
+
+module ooo { module vba { module word {
+
+//=============================================================================
+
+interface XTableOfContents;
+interface XRange;
+interface XTablesOfContents
+{
+ interface ::ooo::vba::XCollection;
+
+ XTableOfContents Add([in] XRange Range, [in] any UseHeadingStyles, [in] any UpperHeadingLevel, [in] any LowerHeadingLevel, [in] any UseFields, [in] any TableID, [in] any RightAlignPageNumbers, [in] any IncludePageNumbers, [in] any AddedStyles, [in] any UseHyperlinks, [in] any HidePageNumbersInWeb, [in] any UseOutlineLevels );
+};
+
+}; }; };
+
+#endif
diff --git a/oovbaapi/ooo/vba/word/XTemplate.idl b/oovbaapi/ooo/vba/word/XTemplate.idl
index 0a5f0ed38c..04e7063923 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 225a92381c..4ef56da9a3 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 543e99f7c5..4ed210befa 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 b2cd1018c5..88d38ae487 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -149,12 +149,12 @@ namespace basprov
Reference< lang::XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() );
if ( xSMgr.is() )
{
- xUriFac.set( xSMgr->createInstanceWithContext( ::rtl::OUString::createFromAscii(
+ xUriFac.set( xSMgr->createInstanceWithContext( ::rtl::OUString::createFromAscii(
"com.sun.star.uri.UriReferenceFactory" ), m_xContext ), UNO_QUERY );
}
if ( xUriFac.is() )
- {
+ {
::rtl::OUString aLinkURL( xLibContainer->getLibraryLinkURL( rLibName ) );
Reference< uri::XUriReference > xUriRef( xUriFac->parse( aLinkURL ), UNO_QUERY );
@@ -172,10 +172,10 @@ namespace basprov
{
::rtl::OUString aDecodedURL( aAuthority.copy( sizeof ( "vnd.sun.star.expand:" ) - 1 ) );
aDecodedURL = ::rtl::Uri::decode( aDecodedURL, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 );
- Reference<util::XMacroExpander> xMacroExpander(
- m_xContext->getValueByName(
+ Reference<util::XMacroExpander> xMacroExpander(
+ m_xContext->getValueByName(
::rtl::OUString::createFromAscii( "/singletons/com.sun.star.util.theMacroExpander" ) ),
- UNO_QUERY );
+ UNO_QUERY );
if ( xMacroExpander.is() )
aFileURL = xMacroExpander->expandMacros( aDecodedURL );
}
@@ -194,7 +194,7 @@ namespace basprov
::rtl::OUString aSearchURL1( RTL_CONSTASCII_USTRINGPARAM( "share/basic" ) );
::rtl::OUString aSearchURL2( RTL_CONSTASCII_USTRINGPARAM( "share/uno_packages" ) );
- if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 )
+ if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 )
bIsShared = true;
}
}
@@ -327,7 +327,7 @@ namespace basprov
// XScriptProvider
// -----------------------------------------------------------------------------
- Reference < provider::XScript > BasicProviderImpl::getScript( const ::rtl::OUString& scriptURI )
+ Reference < provider::XScript > BasicProviderImpl::getScript( const ::rtl::OUString& scriptURI )
throw ( provider::ScriptFrameworkErrorException, RuntimeException)
{
// TODO
@@ -347,7 +347,7 @@ namespace basprov
scriptURI, OUSTR("Basic"),
provider::ScriptFrameworkErrorType::UNKNOWN );
}
-
+
Reference< uri::XUriReference > uriRef(
xFac->parse( scriptURI ), UNO_QUERY );
@@ -355,7 +355,7 @@ namespace basprov
if ( !uriRef.is() || !sfUri.is() )
{
- ::rtl::OUString errorMsg = ::rtl::OUString::createFromAscii( "BasicProviderImpl::getScript: failed to parse URI: " );
+ ::rtl::OUString errorMsg = ::rtl::OUString::createFromAscii( "BasicProviderImpl::getScript: failed to parse URI: " );
errorMsg = errorMsg.concat( scriptURI );
throw provider::ScriptFrameworkErrorException(
errorMsg, Reference< XInterface >(),
@@ -363,13 +363,39 @@ namespace basprov
provider::ScriptFrameworkErrorType::MALFORMED_URL );
}
-
+
::rtl::OUString aDescription = sfUri->getName();
- ::rtl::OUString aLocation = sfUri->getParameter(
+ ::rtl::OUString aLocation = sfUri->getParameter(
::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 );
@@ -379,15 +405,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 )
{
@@ -465,7 +482,7 @@ namespace basprov
if ( m_bIsAppScriptCtx )
{
- xLibContainer = m_xLibContainerApp;
+ xLibContainer = m_xLibContainerApp;
pBasicManager = m_pAppBasicManager;
}
else
@@ -474,7 +491,7 @@ namespace basprov
pBasicManager = m_pDocBasicManager;
}
- Sequence< Reference< browse::XBrowseNode > > aChildNodes;
+ Sequence< Reference< browse::XBrowseNode > > aChildNodes;
if ( pBasicManager && xLibContainer.is() )
{
@@ -500,7 +517,7 @@ namespace basprov
}
if ( bCreate )
{
- pChildNodes[childsFound++] = static_cast< browse::XBrowseNode* >( new BasicLibraryNodeImpl(
+ pChildNodes[childsFound++] = static_cast< browse::XBrowseNode* >( new BasicLibraryNodeImpl(
m_xContext, m_sScriptingContext, pBasicManager, xLibContainer, pLibNames[i], m_bIsAppScriptCtx ) );
}
}
@@ -522,7 +539,7 @@ namespace basprov
Reference< script::XLibraryContainer > xLibContainer;
if ( m_bIsAppScriptCtx )
{
- xLibContainer = m_xLibContainerApp;
+ xLibContainer = m_xLibContainerApp;
}
else
{
@@ -579,7 +596,7 @@ namespace basprov
extern "C"
{
- SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
+ SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
(void)ppEnv;
@@ -587,18 +604,18 @@ extern "C"
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
+ SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(
lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
{
return ::cppu::component_writeInfoHelper(
pServiceManager, pRegistryKey, ::basprov::s_component_entries );
}
- SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
+ SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
registry::XRegistryKey * pRegistryKey )
{
- return ::cppu::component_getFactoryHelper(
+ return ::cppu::component_getFactoryHelper(
pImplName, pServiceManager, pRegistryKey, ::basprov::s_component_entries );
}
}
diff --git a/scripting/source/basprov/basscript.cxx b/scripting/source/basprov/basscript.cxx
index 620e249362..91daf8dc41 100644
--- a/scripting/source/basprov/basscript.cxx
+++ b/scripting/source/basprov/basscript.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
// -----------------------------------------------------------------------------
@@ -112,7 +168,7 @@ namespace basprov
sal_Int32 nParamsCount = aParams.getLength();
SbxInfo* pInfo = m_xMethod->GetInfo();
if ( pInfo )
- {
+ {
sal_Int32 nSbxOptional = 0;
USHORT n = 1;
for ( const SbxParamInfo* pParamInfo = pInfo->GetParam( n ); pParamInfo; pParamInfo = pInfo->GetParam( ++n ) )
@@ -126,12 +182,12 @@ namespace basprov
if ( nParamsCount < nSbxCount - nSbxOptional )
{
throw provider::ScriptFrameworkErrorException(
- ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(
+ ::rtl::OUString(
+ RTL_CONSTASCII_USTRINGPARAM(
"wrong number of parameters!" ) ),
- Reference< XInterface >(),
+ Reference< XInterface >(),
m_funcName,
- ::rtl::OUString(
+ ::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "Basic" ) ),
provider::ScriptFrameworkErrorType::NO_SUCH_SCRIPT );
}
@@ -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 );
}
@@ -181,8 +243,8 @@ namespace basprov
{
SbxInfo* pInfo_ = m_xMethod->GetInfo();
if ( pInfo_ )
- {
- OutParamMap aOutParamMap;
+ {
+ OutParamMap aOutParamMap;
for ( USHORT n = 1, nCount = xSbxParams->Count(); n < nCount; ++n )
{
const SbxParamInfo* pParamInfo = pInfo_->GetParam( n );
@@ -216,7 +278,7 @@ namespace basprov
m_xMethod->SetParameters( NULL );
}
- return aReturn;
+ return aReturn;
}
// -----------------------------------------------------------------------------
diff --git a/scripting/source/basprov/basscript.hxx b/scripting/source/basprov/basscript.hxx
index a524c186b2..a140187ca7 100644
--- a/scripting/source/basprov/basscript.hxx
+++ b/scripting/source/basprov/basscript.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
//.........................................................................
@@ -45,11 +47,15 @@ namespace basprov
// class BasicScriptImpl
// ----------------------------------------------------
- typedef ::cppu::WeakImplHelper1<
+ typedef ::cppu::WeakImplHelper1<
::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,15 +87,24 @@ 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,
::com::sun::star::uno::Sequence< sal_Int16 >& aOutParamIndex,
::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aOutParam )
- throw (
- ::com::sun::star::script::provider::ScriptFrameworkErrorException,
+ throw (
+ ::com::sun::star::script::provider::ScriptFrameworkErrorException,
::com::sun::star::reflection::InvocationTargetException,
- ::com::sun::star::uno::RuntimeException );
+ ::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 11a101454e..8515ca3284 100644
--- a/scripting/source/dlgprov/dlgevtatt.cxx
+++ b/scripting/source/dlgprov/dlgevtatt.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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);
@@ -131,7 +132,7 @@ namespace dlgprov
xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= msDialogCodeName;
xProps.set( mxListener, UNO_QUERY_THROW );
xProps->setPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Model") ), args[ 0 ] );
- }
+ }
catch( const Exception& )
{
DBG_UNHANDLED_EXCEPTION();
@@ -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;
}
@@ -321,18 +323,18 @@ namespace dlgprov
// go over all objects
const Reference< XInterface >* pObjects = Objects.getConstArray();
sal_Int32 nObjCount = Objects.getLength();
- Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
+ Reference< awt::XControl > xDlgControl( Objects[ nObjCount - 1 ], uno::UNO_QUERY ); // last object is the dialog
rtl::OUString sDialogCodeName;
if ( xDlgControl.is() )
{
Reference< XPropertySet > xProps( xDlgControl->getModel(), UNO_QUERY );
try
{
- xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sDialogCodeName;
+ xProps->getPropertyValue( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Name") ) ) >>= sDialogCodeName;
}
catch( Exception& ){}
}
-
+
for ( sal_Int32 i = 0; i < nObjCount; ++i )
{
// We know that we have to do with instances of XControl.
@@ -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 428b938933..0868465df2 100644
--- a/scripting/source/dlgprov/dlgevtatt.hxx
+++ b/scripting/source/dlgprov/dlgevtatt.hxx
@@ -76,7 +76,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 e9e12993c4..7926ba0382 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -164,7 +164,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Reference< resource::XStringResourceResolver >
xStringResourceResolver = xStringResourceSupplier->getStringResource();
- xStringResourceManager =
+ xStringResourceManager =
Reference< resource::XStringResourceManager >( xStringResourceResolver, UNO_QUERY );
}
}
@@ -178,8 +178,8 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
return xControlModel;
}
- Reference< container::XNameContainer > DialogProviderImpl::createDialogModel(
- const Reference< io::XInputStream >& xInput,
+ Reference< container::XNameContainer > DialogProviderImpl::createDialogModel(
+ const Reference< io::XInputStream >& xInput,
const Reference< resource::XStringResourceManager >& xStringResourceManager,
const Any &aDialogSourceURL) throw ( Exception )
{
@@ -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() )
{
@@ -198,17 +206,17 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
aStringResourceManagerAny <<= xStringResourceManager;
xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny );
}
-
- return xDialogModel;
+
+ return xDialogModel;
}
Reference< XControlModel > DialogProviderImpl::createDialogModelForBasic() throw ( Exception )
{
- if ( !m_BasicInfo.get() )
- // shouln't get here
+ if ( !m_BasicInfo.get() )
+ // shouln't get here
throw RuntimeException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("No information to create dialog" ) ), Reference< XInterface >() );
Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib );
-
+
rtl::OUString aURL(RTL_CONSTASCII_USTRINGPARAM("" ));
Any aDialogSourceURL;
aDialogSourceURL <<= aURL;
@@ -225,7 +233,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
// TODO: use URL parsing class
// TODO: decoding of location
Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager(), UNO_QUERY );
-
+
if ( !xSMgr.is() )
{
throw RuntimeException(
@@ -244,7 +252,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Reference< XInterface >() );
}
- // i75778: Support non-script URLs
+ // i75778: Support non-script URLs
Reference< io::XInputStream > xInput;
Reference< container::XNameContainer > xDialogLib;
@@ -294,7 +302,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
else
{
::rtl::OUString sDescription = sfUri->getName();
-
+
sal_Int32 nIndex = 0;
::rtl::OUString sLibName = sDescription.getToken( 0, (sal_Unicode)'.', nIndex );
@@ -403,6 +411,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
if ( xISP.is() )
xInput = xISP->createInputStream();
+ msDialogLibName = sLibName;
}
// import dialog model
@@ -432,7 +441,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Reference< XMultiComponentFactory > xSMgr_( m_xContext->getServiceManager(), UNO_QUERY_THROW );
// TODO: Ctor
xStringResourceManager = Reference< resource::XStringResourceManager >( xSMgr_->createInstanceWithContext
- ( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ),
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.resource.StringResourceWithLocation" ),
m_xContext ), UNO_QUERY );
if( xStringResourceManager.is() )
{
@@ -448,7 +457,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
Any aDialogSourceURLAny;
aDialogSourceURLAny <<= aURL;
-
+
Reference< container::XNameContainer > xDialogModel( createDialogModel( xInput , xStringResourceManager, aDialogSourceURLAny ), UNO_QUERY_THROW);
xCtrlModel = Reference< XControlModel >( xDialogModel, UNO_QUERY );
@@ -503,7 +512,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
}
// create a peer
- Reference< XToolkit> xToolkit( xSMgr->createInstanceWithContext(
+ Reference< XToolkit> xToolkit( xSMgr->createInstanceWithContext(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" ) ), m_xContext ), UNO_QUERY );
if ( xToolkit.is() )
xDialogControl->createPeer( xToolkit, xPeer );
@@ -516,11 +525,11 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
// -----------------------------------------------------------------------------
- void DialogProviderImpl::attachControlEvents(
+ void DialogProviderImpl::attachControlEvents(
const Reference< XControl >& rxControl,
const Reference< XInterface >& rxHandler,
const Reference< XIntrospectionAccess >& rxIntrospectionAccess,
- bool bDialogProviderMode )
+ bool bDialogProviderMode, const rtl::OUString& sDialogLibName )
{
if ( rxControl.is() )
{
@@ -543,8 +552,8 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
pObjects[nControlCount] = Reference< XInterface >( rxControl, UNO_QUERY );
Reference< XScriptEventsAttacher > xScriptEventsAttacher = new DialogEventsAttacherImpl
- ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
- bDialogProviderMode, ( m_BasicInfo.get() ? m_BasicInfo->mxBasicRTLListener : NULL ) );
+ ( m_xContext, m_xModel, rxControl, rxHandler, rxIntrospectionAccess,
+ 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 );
}
}
@@ -791,9 +803,9 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
return xDialog;
}
- Reference< XWindow > DialogProviderImpl::createContainerWindow(
- const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
- const Reference< XWindowPeer >& xParent, const Reference< XInterface >& xHandler )
+ Reference< XWindow > DialogProviderImpl::createContainerWindow(
+ const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
+ const Reference< XWindowPeer >& xParent, const Reference< XInterface >& xHandler )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
{
(void)WindowType; // for future use
@@ -845,7 +857,7 @@ static ::rtl::OUString aResourceResolverPropName = ::rtl::OUString::createFromAs
extern "C"
{
- void SAL_CALL component_getImplementationEnvironment(
+ void SAL_CALL component_getImplementationEnvironment(
const sal_Char ** ppEnvTypeName, uno_Environment ** ppEnv )
{
(void)ppEnv;
@@ -853,18 +865,18 @@ extern "C"
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
- sal_Bool SAL_CALL component_writeInfo(
+ sal_Bool SAL_CALL component_writeInfo(
lang::XMultiServiceFactory * pServiceManager, registry::XRegistryKey * pRegistryKey )
{
return ::cppu::component_writeInfoHelper(
pServiceManager, pRegistryKey, ::dlgprov::s_component_entries );
}
- void * SAL_CALL component_getFactory(
+ void * SAL_CALL component_getFactory(
const sal_Char * pImplName, lang::XMultiServiceFactory * pServiceManager,
registry::XRegistryKey * pRegistryKey )
{
- return ::cppu::component_getFactoryHelper(
+ return ::cppu::component_getFactoryHelper(
pImplName, pServiceManager, pRegistryKey, ::dlgprov::s_component_entries );
}
}
diff --git a/scripting/source/dlgprov/dlgprov.hxx b/scripting/source/dlgprov/dlgprov.hxx
index 82faef2f86..f064e79c80 100644
--- a/scripting/source/dlgprov/dlgprov.hxx
+++ b/scripting/source/dlgprov/dlgprov.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -62,7 +62,7 @@ namespace dlgprov
// class DialogProviderImpl
// =============================================================================
- typedef ::cppu::WeakImplHelper4<
+ typedef ::cppu::WeakImplHelper4<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::lang::XInitialization,
::com::sun::star::awt::XDialogProvider2,
@@ -81,30 +81,30 @@ 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(
+ ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControl > createDialogControl(
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel >& rxDialogModel,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent );
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 );
- ::com::sun::star::uno::Reference< ::com::sun::star::beans::XIntrospectionAccess > inspectHandler(
+ 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
::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createControlModel() throw ( ::com::sun::star::uno::Exception );
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogModel(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
+ ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createDialogModel(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInput,
const ::com::sun::star::uno::Reference< ::com::sun::star::resource::XStringResourceManager >& xStringResourceManager,
const ::com::sun::star::uno::Any &aDialogSourceURL) throw ( ::com::sun::star::uno::Exception );
::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlModel > createDialogModelForBasic() throw ( ::com::sun::star::uno::Exception );
// XDialogProvider / XDialogProvider2 impl method
virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XControl > SAL_CALL createDialogImpl(
- const ::rtl::OUString& URL,
+ const ::rtl::OUString& URL,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler,
const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
bool bDialogProviderMode )
@@ -116,37 +116,37 @@ namespace dlgprov
virtual ~DialogProviderImpl();
// XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName( )
+ virtual ::rtl::OUString SAL_CALL getImplementationName( )
throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
+ virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
+ virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
throw (::com::sun::star::uno::RuntimeException);
// XInitialization
- virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
// XDialogProvider
- virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialog(
+ virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialog(
const ::rtl::OUString& URL )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
// XDialogProvider2
virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithHandler(
- const ::rtl::OUString& URL,
+ const ::rtl::OUString& URL,
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
virtual ::com::sun::star::uno::Reference < ::com::sun::star::awt::XDialog > SAL_CALL createDialogWithArguments(
- const ::rtl::OUString& URL,
+ const ::rtl::OUString& URL,
const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow(
- const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
- const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > SAL_CALL createContainerWindow(
+ const ::rtl::OUString& URL, const ::rtl::OUString& WindowType,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xHandler )
throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
};
diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx
index 6975fba08e..7e8155fa78 100644
--- a/scripting/source/vbaevents/eventhelper.cxx
+++ b/scripting/source/vbaevents/eventhelper.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2008 by Sun Microsystems, Inc.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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;
@@ -97,7 +113,7 @@ using namespace ::ooo::vba;
#define MAP_CHAR_LEN(x) ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))//liuchen 2009-6-8
#define GET_TYPE(x) ::getCppuType((uno::Reference< x > *)0);
-// Some constants
+// Some constants
const static rtl::OUString DELIM = rtl::OUString::createFromAscii( "::" );
const static sal_Int32 DELIMLEN = DELIM.getLength();
@@ -107,12 +123,12 @@ void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, co
Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
if ( xIntrospection.is() )
{
- xIntrospectionAccess = xIntrospection->inspect(
+ xIntrospectionAccess = xIntrospection->inspect(
makeAny( xIfc ) );
- Sequence< Type > aControlListeners =
+ Sequence< Type > aControlListeners =
xIntrospectionAccess->getSupportedListeners();
sal_Int32 nLength = aControlListeners.getLength();
-
+
for ( sal_Int32 i = 0; i< nLength; ++i )
{
Type& listType = aControlListeners[ i ];
@@ -121,51 +137,51 @@ void dumpListeners( const Reference< beans::XIntrospection >& xIntrospection, co
sal_Int32 lastDotIndex = -1;
if ( ( lastDotIndex = sFullTypeName.lastIndexOf( '.' ) ) > -1 )
{
- sTypeName = sFullTypeName.copy( lastDotIndex + 1 );
- }
- Sequence< ::rtl::OUString > sMeths = comphelper::getEventMethodsForType( listType );
+ sTypeName = sFullTypeName.copy( lastDotIndex + 1 );
+ }
+ Sequence< ::rtl::OUString > sMeths = comphelper::getEventMethodsForType( listType );
sal_Int32 sMethLen = sMeths.getLength();
for ( sal_Int32 j=0 ; j < sMethLen; ++j )
{
OSL_TRACE("**Listener [%d] Type[%s] Method[%s]",j,
- rtl::OUStringToOString( sTypeName,
+ rtl::OUStringToOString( sTypeName,
RTL_TEXTENCODING_UTF8 ).getStr(),
- rtl::OUStringToOString( sMeths[ j ],
+ rtl::OUStringToOString( sMeths[ j ],
RTL_TEXTENCODING_UTF8 ).getStr() );
}
}
-
+
}
}
void dumpEvent( const ScriptEvent& evt )
{
OSL_TRACE("dumpEvent: Source %s",
- rtl::OUStringToOString( comphelper::anyToString( makeAny(evt.Source)),
+ rtl::OUStringToOString( comphelper::anyToString( makeAny(evt.Source)),
RTL_TEXTENCODING_UTF8 ).getStr() );
OSL_TRACE("dumpEvent: ScriptType %s",
- rtl::OUStringToOString( evt.ScriptType,
+ rtl::OUStringToOString( evt.ScriptType,
RTL_TEXTENCODING_UTF8 ).getStr() );
-
+
OSL_TRACE("dumpEvent: ScriptCode %s",
- rtl::OUStringToOString( evt.ScriptCode,
+ rtl::OUStringToOString( evt.ScriptCode,
RTL_TEXTENCODING_UTF8 ).getStr() );
OSL_TRACE("dumpEvent: ListenerType %s",
- rtl::OUStringToOString( evt.ListenerType.getTypeName(),
+ rtl::OUStringToOString( evt.ListenerType.getTypeName(),
RTL_TEXTENCODING_UTF8 ).getStr() );
-
+
OSL_TRACE("dumpEvent: Listener methodname %s",
- rtl::OUStringToOString( evt.MethodName,
+ rtl::OUStringToOString( evt.MethodName,
RTL_TEXTENCODING_UTF8 ).getStr() );
OSL_TRACE("dumpEvent: arguments;");
sal_Int32 nLen = evt.Arguments.getLength();
for ( sal_Int32 index=0; index < nLen; ++index )
{
- OSL_TRACE("\t [%d] %s", index,
- rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[ index ] ),
+ OSL_TRACE("\t [%d] %s", index,
+ rtl::OUStringToOString( comphelper::anyToString( evt.Arguments[ index ] ),
RTL_TEXTENCODING_UTF8 ).getStr() );
}
@@ -189,14 +205,22 @@ 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;
awt::MouseEvent evt;
- if ( !( isMouseEventOk(evt, params)) ||
+ if ( !( isMouseEventOk(evt, params)) ||
(evt.ClickCount != 2) )
- return Sequence< Any >();
+ return Sequence< Any >();
// give back orig params, this will signal that the event is good
return params;
}
@@ -207,7 +231,7 @@ Sequence< Any > ooMouseEvtToVBAMouseEvt( const Sequence< Any >& params )
awt::MouseEvent evt;
if ( !isMouseEventOk(evt, params) )
- return Sequence< Any >();
+ return Sequence< Any >();
translatedParams.realloc(4);
@@ -228,13 +252,18 @@ Sequence< Any > ooKeyPressedToVBAKeyPressed( const Sequence< Any >& params )
awt::KeyEvent evt;
if ( !isKeyEventOk( evt, params ) )
- return Sequence< Any >();
+ return Sequence< Any >();
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;
}
@@ -244,35 +273,57 @@ Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params )
awt::KeyEvent evt;
if ( !isKeyEventOk( evt, params ) )
- return Sequence< Any >();
+ return Sequence< Any >();
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
-//expand the "TranslateInfo" struct to support more kinds of events
+//expand the "TranslateInfo" struct to support more kinds of events
struct TranslateInfo
{
rtl::OUString sVBAName; //vba event name
- Translator toVBA; //the method to convert OO event parameters to VBA event parameters
- bool (*ApproveRule)(const ScriptEvent& evt, void* pPara); //this method is used to determine which types of controls should execute the event
+ Translator toVBA; //the method to convert OO event parameters to VBA event parameters
+ bool (*ApproveRule)(const ScriptEvent& evt, void* pPara); //this method is used to determine which types of controls should execute the event
void *pPara; //Parameters for the above approve method
};
-typedef std::hash_map< rtl::OUString,
-std::list< TranslateInfo >,
+typedef std::hash_map< rtl::OUString,
+std::list< TranslateInfo >,
::rtl::OUStringHash,
::std::equal_to< ::rtl::OUString > > EventInfoHash;
@@ -280,13 +331,14 @@ std::list< TranslateInfo >,
struct TranslatePropMap
{
rtl::OUString sEventInfo; //OO event name
- TranslateInfo aTransInfo;
+ TranslateInfo aTransInfo;
};
-
+
bool ApproveAll(const ScriptEvent& evt, void* pPara); //allow all types of controls to execute the event
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,37 +346,39 @@ 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[] =
+static TranslatePropMap aTranslatePropMap_Impl[] =
{
- // 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
-
+ // actionPerformed ooo event
+ { MAP_CHAR_LEN("actionPerformed"), { MAP_CHAR_LEN("_Click"), NULL, ApproveAll, NULL } },
+ { 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 } },
+ { MAP_CHAR_LEN("changed"), { MAP_CHAR_LEN("_Change"), NULL, ApproveAll, NULL } },
// focusGained ooo event
{ MAP_CHAR_LEN("focusGained"), { MAP_CHAR_LEN("_GotFocus"), NULL, ApproveAll, NULL } },
// 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 } },
@@ -344,13 +398,13 @@ static TranslatePropMap aTranslatePropMap_Impl[] =
{ MAP_CHAR_LEN("mousePressed"), { MAP_CHAR_LEN("_MouseDown"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } },
{ MAP_CHAR_LEN("mousePressed"), { MAP_CHAR_LEN("_DblClick"), ooMouseEvtToVBADblClick, ApproveAll, NULL } },
- // mouseMoved ooo event
+ // mouseMoved ooo event
{ MAP_CHAR_LEN("mouseMoved"), { MAP_CHAR_LEN("_MouseMove"), ooMouseEvtToVBAMouseEvt, ApproveAll, NULL } },
{ 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()
@@ -365,17 +419,17 @@ EventInfoHash& getEventTransInfo()
int i = 0;
while (i < nCount)
- {
+ {
sEventInfo = pTransProp->sEventInfo;
std::list< TranslateInfo > infoList;
do
- {
+ {
infoList.push_back( pTransProp->aTransInfo );
pTransProp++;
i++;
}while(i < nCount && sEventInfo == pTransProp->sEventInfo);
- eventTransInfo[sEventInfo] = infoList;
- }
+ eventTransInfo[sEventInfo] = infoList;
+ }
initialised = true;
}
return eventTransInfo;
@@ -388,7 +442,7 @@ class ScriptEventHelper
{
public:
ScriptEventHelper( const Reference< XInterface >& xControl );
- Sequence< ScriptEventDescriptor > createEvents( const rtl::OUString& sCodeName );
+ Sequence< ScriptEventDescriptor > createEvents( const rtl::OUString& sCodeName );
Sequence< rtl::OUString > getEventListeners();
private:
Reference< XComponentContext > m_xCtx;
@@ -411,16 +465,16 @@ eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescrip
}
sMethodName = rEventMethod.copy( nDelimPos + DELIMLEN );
sTypeName = rEventMethod.copy( 0, nDelimPos );
-
+
EventInfoHash& infos = getEventTransInfo();
// Only create an ScriptEventDescriptor for an event we can translate
// or emulate
- if ( sMethodName.getLength()
+ if ( sMethodName.getLength()
&& sTypeName.getLength()
&& ( infos.find( sMethodName ) != infos.end() ) )
{
- // just fill in CodeName, when the event fires the other
+ // just fill in CodeName, when the event fires the other
// info is gathered from the event source to determine what
// event handler we try to call
evtDesc.ScriptCode = sCodeName;
@@ -430,7 +484,7 @@ eventMethodToDescriptor( const ::rtl::OUString& rEventMethod, ScriptEventDescrip
// set this it VBAInterop, ensures that it doesn't
// get persisted or shown in property editors
evtDesc.ScriptType = rtl::OUString::createFromAscii(
- "VBAInterop" );
+ "VBAInterop" );
return true;
}
return false;
@@ -442,40 +496,40 @@ ScriptEventHelper::ScriptEventHelper( const Reference< XInterface >& xControl )
Reference < beans::XPropertySet > xProps(
::comphelper::getProcessServiceFactory(), UNO_QUERY_THROW );
m_xCtx.set( xProps->getPropertyValue( rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
+ RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))),
uno::UNO_QUERY_THROW );
}
-Sequence< rtl::OUString >
+Sequence< rtl::OUString >
ScriptEventHelper::getEventListeners()
{
- Reference< lang::XMultiComponentFactory > xMFac(
+ Reference< lang::XMultiComponentFactory > xMFac(
m_xCtx->getServiceManager(), UNO_QUERY );
std::list< rtl::OUString > eventMethods;
if ( xMFac.is() )
{
- Reference< beans::XIntrospection > xIntrospection(
- xMFac->createInstanceWithContext( rtl::OUString(
+ Reference< beans::XIntrospection > xIntrospection(
+ xMFac->createInstanceWithContext( rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.beans.Introspection" ) ), m_xCtx ), UNO_QUERY );
#if 0
dumpListeners( xIntrospection, m_xControl );
dumpListeners( xIntrospection, m_xControl->getModel() );
-#endif
+#endif
Reference< beans::XIntrospectionAccess > xIntrospectionAccess;
if ( xIntrospection.is() )
{
- xIntrospectionAccess = xIntrospection->inspect(
+ xIntrospectionAccess = xIntrospection->inspect(
makeAny( m_xControl ) );
- Sequence< Type > aControlListeners =
+ Sequence< Type > aControlListeners =
xIntrospectionAccess->getSupportedListeners();
- sal_Int32 nLength = aControlListeners.getLength();
+ sal_Int32 nLength = aControlListeners.getLength();
for ( sal_Int32 i = 0; i< nLength; ++i )
{
Type& listType = aControlListeners[ i ];
rtl::OUString sFullTypeName = listType.getTypeName();
- Sequence< ::rtl::OUString > sMeths =
- comphelper::getEventMethodsForType( listType );
+ Sequence< ::rtl::OUString > sMeths =
+ comphelper::getEventMethodsForType( listType );
sal_Int32 sMethLen = sMeths.getLength();
for ( sal_Int32 j=0 ; j < sMethLen; ++j )
{
@@ -485,7 +539,7 @@ ScriptEventHelper::getEventListeners()
eventMethods.push_back( sEventMethod );
}
}
-
+
}
}
@@ -494,20 +548,20 @@ ScriptEventHelper::getEventListeners()
rtl::OUString* pDest = sEventMethodNames.getArray();
for ( ; it != eventMethods.end(); ++it, ++pDest )
- *pDest = *it;
+ *pDest = *it;
return sEventMethodNames;
}
-Sequence< ScriptEventDescriptor >
+Sequence< ScriptEventDescriptor >
ScriptEventHelper::createEvents( const rtl::OUString& sCodeName )
{
Sequence< rtl::OUString > aControlListeners = getEventListeners();
rtl::OUString* pSrc = aControlListeners.getArray();
- sal_Int32 nLength = aControlListeners.getLength();
+ sal_Int32 nLength = aControlListeners.getLength();
Sequence< ScriptEventDescriptor > aDest( nLength );
- sal_Int32 nEvts = 0;
+ sal_Int32 nEvts = 0;
for ( sal_Int32 i = 0; i< nLength; ++i, ++pSrc )
{
// from getListeners eventName is of form
@@ -541,7 +595,7 @@ public:
virtual void SAL_CALL insertByName( const ::rtl::OUString&, const Any& ) throw (lang::IllegalArgumentException, container::ElementExistException, lang::WrappedTargetException, RuntimeException)
{
throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-
+
}
virtual void SAL_CALL removeByName( const ::rtl::OUString& ) throw (::com::sun::star::container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
{
@@ -552,9 +606,9 @@ public:
virtual void SAL_CALL replaceByName( const ::rtl::OUString&, const Any& ) throw (lang::IllegalArgumentException, container::NoSuchElementException, lang::WrappedTargetException, RuntimeException)
{
throw RuntimeException( rtl::OUString::createFromAscii( "ReadOnly container" ), Reference< XInterface >() );
-
+
}
-
+
// XNameAccess
virtual Any SAL_CALL getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException);
virtual Sequence< ::rtl::OUString > SAL_CALL getElementNames( ) throw (RuntimeException);
@@ -583,13 +637,13 @@ ReadOnlyEventsNameContainer::ReadOnlyEventsNameContainer( const Sequence< rtl::O
ScriptEventDescriptor evtDesc;
if ( eventMethodToDescriptor( *pSrc, evtDesc, sCodeName ) )
{
- aDesc <<= evtDesc;
+ aDesc <<= evtDesc;
m_hEvents[ *pSrc ] = aDesc;
}
}
}
-Any SAL_CALL
+Any SAL_CALL
ReadOnlyEventsNameContainer::getByName( const ::rtl::OUString& aName ) throw (container::NoSuchElementException, lang::WrappedTargetException, RuntimeException){
EventSupplierHash::const_iterator it = m_hEvents.find( aName );
if ( it == m_hEvents.end() )
@@ -597,7 +651,7 @@ ReadOnlyEventsNameContainer::getByName( const ::rtl::OUString& aName ) throw (co
return it->second;
}
-Sequence< ::rtl::OUString > SAL_CALL
+Sequence< ::rtl::OUString > SAL_CALL
ReadOnlyEventsNameContainer::getElementNames( ) throw (RuntimeException)
{
Sequence< ::rtl::OUString > names(m_hEvents.size());
@@ -609,7 +663,7 @@ ReadOnlyEventsNameContainer::getElementNames( ) throw (RuntimeException)
return names;
}
-sal_Bool SAL_CALL
+sal_Bool SAL_CALL
ReadOnlyEventsNameContainer::hasByName( const ::rtl::OUString& aName ) throw (RuntimeException)
{
EventSupplierHash::const_iterator it = m_hEvents.find( aName );
@@ -625,14 +679,14 @@ class ReadOnlyEventsSupplier : public EventsSupplier_BASE
public:
ReadOnlyEventsSupplier( const Sequence< ::rtl::OUString >& eventMethods, const rtl::OUString& sCodeName )
{ m_xNameContainer = new ReadOnlyEventsNameContainer( eventMethods, sCodeName ); }
-
+
// XScriptEventSupplier
virtual Reference< container::XNameContainer > SAL_CALL getEvents( ) throw (RuntimeException){ return m_xNameContainer; }
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" ) )
@@ -643,7 +697,7 @@ class EventListener : public EventListener_BASE
,public ::comphelper::OPropertyArrayUsageHelper< EventListener >
{
-
+
public:
EventListener( const Reference< XComponentContext >& rxContext );
// XEventListener
@@ -653,8 +707,11 @@ 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);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) throw (::com::sun::star::uno::RuntimeException);
// XInitialization
virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException);
// XInterface
@@ -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 ) );
@@ -708,7 +788,7 @@ EventListener::setShellFromModel()
break;
}
pShell = SfxObjectShell::GetNext( *pShell );
- }
+ }
}
//XEventListener
@@ -719,13 +799,43 @@ EventListener::disposing(const lang::EventObject&) throw( RuntimeException )
//XScriptListener
-void SAL_CALL
+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
}
-Any SAL_CALL
+#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)
{
Any ret;
@@ -733,8 +843,26 @@ 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
+void SAL_CALL
EventListener::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException)
{
if ( aArguments.getLength() == 1 )
@@ -752,7 +880,7 @@ IMPLEMENT_FORWARD_XTYPEPROVIDER2( EventListener, EventListener_BASE, OPropertyCo
// OPropertySetHelper
-::cppu::IPropertyArrayHelper&
+::cppu::IPropertyArrayHelper&
EventListener::getInfoHelper( )
{
return *getArrayHelper();
@@ -760,7 +888,7 @@ EventListener::getInfoHelper( )
// OPropertyArrayUsageHelper
-::cppu::IPropertyArrayHelper*
+::cppu::IPropertyArrayHelper*
EventListener::createArrayHelper( ) const
{
Sequence< beans::Property > aProps;
@@ -769,7 +897,7 @@ EventListener::createArrayHelper( ) const
}
// XPropertySet
-Reference< beans::XPropertySetInfo >
+Reference< beans::XPropertySetInfo >
EventListener::getPropertySetInfo( ) throw (RuntimeException)
{
Reference< beans::XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
@@ -819,7 +947,7 @@ bool DenyType(const ScriptEvent& evt, void* pPara)
}
//when mouse is moving, either the mouse button is pressed or some key is pressed can trigger the OO mouseDragged event,
-//the former should be denyed, and the latter allowed, only by doing so can the VBA MouseMove event when the "Shift" key is
+//the former should be denyed, and the latter allowed, only by doing so can the VBA MouseMove event when the "Shift" key is
//pressed can be correctly triggered
bool DenyMouseDrag(const ScriptEvent& evt, void* )
{
@@ -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() )
+ {
+ 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 );
-
+ // where ScriptCode is methodname_handlerextension
+ 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) )
@@ -906,7 +1106,7 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* /*pRet*/ ) throw(Runtime
continue;
}
//liuchen 2009-6-8
- // !! translate arguments & emulate events where necessary
+ // !! translate arguments & emulate events where necessary
Sequence< Any > aArguments;
if ( (*txInfo).toVBA )
aArguments = (*txInfo).toVBA( evt.Arguments );
@@ -916,31 +1116,28 @@ 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;
-
- OSL_TRACE("script url = %s",
- rtl::OUStringToOString( url,
+ rtl::OUString url = aMacroResolvedInfo.ResolvedMacro();
+
+ 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 )
{
OSL_TRACE("event script raised %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
}
- }
+ }
}
}
}
@@ -959,29 +1156,29 @@ public:
virtual Reference< XScriptEventsSupplier > SAL_CALL getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException);
private:
Reference< XComponentContext > m_xContext;
-
+
};
VBAToOOEventDescGen::VBAToOOEventDescGen( const Reference< XComponentContext >& rxContext ):m_xContext( rxContext ) {}
-Sequence< ScriptEventDescriptor > SAL_CALL
+Sequence< ScriptEventDescriptor > SAL_CALL
VBAToOOEventDescGen::getEventDescriptions( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (RuntimeException)
{
- ScriptEventHelper evntHelper( xControl );
- return evntHelper.createEvents( sCodeName );
+ ScriptEventHelper evntHelper( xControl );
+ return evntHelper.createEvents( sCodeName );
}
-Reference< XScriptEventsSupplier > SAL_CALL
+Reference< XScriptEventsSupplier > SAL_CALL
VBAToOOEventDescGen::getEventSupplier( const Reference< XInterface >& xControl, const rtl::OUString& sCodeName ) throw (::com::sun::star::uno::RuntimeException)
{
- ScriptEventHelper evntHelper( xControl );
- Reference< XScriptEventsSupplier > xSupplier =
- new ReadOnlyEventsSupplier(
+ ScriptEventHelper evntHelper( xControl );
+ Reference< XScriptEventsSupplier > xSupplier =
+ new ReadOnlyEventsSupplier(
evntHelper.getEventListeners(), sCodeName ) ;
return xSupplier;
}
-// Component related
+// Component related
namespace evtlstner
{
@@ -1011,9 +1208,9 @@ namespace evtlstner
{
const ::rtl::OUString strName( ::evtlstner::getImplementationName() );
return Sequence< ::rtl::OUString >( &strName, 1 );
- }
+ }
}
-namespace ooevtdescgen
+namespace ooevtdescgen
{
::rtl::OUString SAL_CALL getImplementationName()
{
@@ -1041,5 +1238,5 @@ namespace ooevtdescgen
{
const ::rtl::OUString strName( ::ooevtdescgen::getImplementationName() );
return Sequence< ::rtl::OUString >( &strName, 1 );
- }
+ }
}
diff --git a/scripting/source/vbaevents/makefile.mk b/scripting/source/vbaevents/makefile.mk
index 1946c61d1e..4784985e8a 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/scripting/source/vbaevents/vbamsformreturntypes.hxx b/scripting/source/vbaevents/vbamsformreturntypes.hxx
new file mode 100644
index 0000000000..0aa1b9ec53
--- /dev/null
+++ b/scripting/source/vbaevents/vbamsformreturntypes.hxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright IBM Corporation 2009, 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef VBA_MSFORM_RETURNTYPES_HXX
+#define VBA_MSFORM_RETURNTYPES_HXX
+
+#include <cppuhelper/implbase1.hxx>
+#include <msforms/XReturnBoolean.hpp>
+#include <msforms/XReturnInteger.hpp>
+
+
+typedef ::cppu::WeakImplHelper1<msforms::XReturnBoolean> ReturnBoolean_BASE;
+
+class SAL_DLLPUBLIC_EXPORT VbaReturnBoolean : public ReturnBoolean_BASE
+{
+public:
+ sal_Bool Value;
+
+public:
+ VbaReturnBoolean() : Value(false) {} ;
+
+ // XReturnBoolean
+ virtual ::sal_Bool SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
+ virtual void SAL_CALL setValue( ::sal_Bool _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
+
+ // XDefaultProperty
+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+};
+
+
+typedef ::cppu::WeakImplHelper1<msforms::XReturnInteger> ReturnInteger_BASE;
+
+class SAL_DLLPUBLIC_EXPORT VbaReturnInteger : public ReturnInteger_BASE
+{
+public:
+ sal_Int32 Value;
+
+public:
+ VbaReturnInteger() : Value(0) {} ;
+
+ // XReturnInteger
+ virtual ::sal_Int32 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return Value; }
+ virtual void SAL_CALL setValue( ::sal_Int32 _value ) throw (::com::sun::star::uno::RuntimeException) { Value = _value; }
+
+ // XDefaultProperty
+ ::rtl::OUString SAL_CALL getDefaultPropertyName() throw (com::sun::star::uno::RuntimeException) { return ::rtl::OUString::createFromAscii("Value"); }
+};
+#endif
diff --git a/sfx2/inc/sfx2/objsh.hxx b/sfx2/inc/sfx2/objsh.hxx
index da9c46ff45..d1683998d7 100644
--- a/sfx2/inc/sfx2/objsh.hxx
+++ b/sfx2/inc/sfx2/objsh.hxx
@@ -414,8 +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 );
static ErrCode CallXScript(
const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxScriptContext,
@@ -424,7 +424,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 87cc2b6881..e6a900ed34 100755
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -268,7 +268,7 @@
#define STR_ERRUNOEVENTBINDUNG (RID_SFX_START+119)
#define STR_SHARED (RID_SFX_START+120)
#define RID_XMLSEC_DOCUMENTSIGNED (RID_SFX_START+121)
-
+
//=========================================================================
// group ids
@@ -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 52fe2c14bf..8fe1468f20 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 695a47671a..ae27983663 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 5cb5ab2995..27cfa2015e 100644
--- a/sfx2/source/appl/app.cxx
+++ b/sfx2/source/appl/app.cxx
@@ -741,7 +741,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 f38aabd327..1d3994015e 100644
--- a/sfx2/source/appl/appuno.cxx
+++ b/sfx2/source/appl/appuno.cxx
@@ -2291,6 +2291,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;
}
@@ -2350,6 +2360,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 14b3fe06e9..0a51e21b1c 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 95fe000709..0b79440644 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 15f231795e..94e92ee08d 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 613d90cb17..e542377c47 100644
--- a/sfx2/source/doc/docmacromode.cxx
+++ b/sfx2/source/doc/docmacromode.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 cdb13902c3..dce679dd85 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -462,7 +462,7 @@ void SfxObjectShell::SetReadOnlyUI( sal_Bool bReadOnly )
void SfxObjectShell::SetReadOnly()
{
- // Let the document be completely readonly, means that the
+ // Let the document be completely readonly, means that the
// medium open mode is adjusted accordingly, and the write lock
// on the file is removed.
@@ -471,13 +471,13 @@ void SfxObjectShell::SetReadOnly()
sal_Bool bWasROUI = IsReadOnly();
pMedium->UnlockFile( sal_False );
-
+
// the storage-based mediums are already based on the temporary file
// so UnlockFile has already closed the locking stream
if ( !pMedium->HasStorage_Impl() && IsLoadingFinished() )
pMedium->CloseInStream();
- pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True );
+ pMedium->SetOpenMode( SFX_STREAM_READONLY, pMedium->IsDirect(), sal_True );
pMedium->GetItemSet()->Put( SfxBoolItem( SID_DOC_READONLY, sal_True ) );
if ( !bWasROUI )
@@ -1700,7 +1700,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;
@@ -1731,7 +1731,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& )
@@ -1764,10 +1773,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 ac45ef594d..aae9062e78 100644
--- a/sfx2/source/doc/objuno.cxx
+++ b/sfx2/source/doc/objuno.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -96,7 +97,7 @@ using namespace ::com::sun::star;
#define PROPERTY_UNBOUND 0
#define PROPERTY_MAYBEVOID ::com::sun::star::beans::PropertyAttribute::MAYBEVOID
-const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
+const SfxItemPropertyMapEntry* lcl_GetDocInfoPropertyMap()
{
static SfxItemPropertyMapEntry aDocInfoPropertyMap_Impl[] =
{
@@ -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 },
@@ -262,7 +266,7 @@ MixedPropertySetInfo::~MixedPropertySetInfo()
::comphelper::SequenceAsVector< ::com::sun::star::beans::Property > lProps;
// copy "fix" props
- //todo: os: this ugly thing should be replaced
+ //todo: os: this ugly thing should be replaced
const SfxItemPropertyMapEntry* pFixProp = lcl_GetDocInfoPropertyMap();
while(pFixProp && pFixProp->pName)
@@ -303,7 +307,7 @@ MixedPropertySetInfo::~MixedPropertySetInfo()
//-----------------------------------------------------------------------------
-::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName(
+::com::sun::star::beans::Property SAL_CALL MixedPropertySetInfo::getPropertyByName(
const ::rtl::OUString& sName )
throw(::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::uno::RuntimeException )
@@ -324,7 +328,7 @@ MixedPropertySetInfo::~MixedPropertySetInfo()
throw(::com::sun::star::uno::RuntimeException)
{
return _aPropertyMap.hasPropertyByName( sName ) ? // "fix" prop?
- sal_True :
+ sal_True :
_xUDProps->getPropertySetInfo()->hasPropertyByName(sName); // "dynamic" prop?
}
@@ -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 017b5873e5..d850fc03c7 100644
--- a/sfx2/source/doc/objxtor.cxx
+++ b/sfx2/source/doc/objxtor.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -124,6 +124,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 )
+ {
+ }
+ }
+ }
+}
+
//=========================================================================
@@ -158,6 +192,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 >() );
}
@@ -910,7 +945,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";
@@ -1100,7 +1138,7 @@ bool SfxObjectShell::IsChangeRecording() const
return false;
}
-
+
bool SfxObjectShell::HasChangeRecordProtection() const
{
// currently this function needs to be overwritten by Writer and Calc only
@@ -1108,20 +1146,20 @@ bool SfxObjectShell::HasChangeRecordProtection() const
return false;
}
-
+
void SfxObjectShell::SetChangeRecording( bool /*bActivate*/ )
{
// currently this function needs to be overwritten by Writer and Calc only
DBG_ASSERT( 0, "function not implemented" );
}
-
+
bool SfxObjectShell::SetProtectionPassword( const String & /*rPassword*/ )
{
// currently this function needs to be overwritten by Writer and Calc only
DBG_ASSERT( 0, "function not implemented" );
return false;
-}
+}
bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal_Int8 > & /*rPasswordHash*/ )
@@ -1129,5 +1167,5 @@ bool SfxObjectShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence<
// currently this function needs to be overwritten by Writer and Calc only
DBG_ASSERT( 0, "function not implemented" );
return false;
-}
+}
diff --git a/sfx2/source/doc/oleprops.hxx b/sfx2/source/doc/oleprops.hxx
index 0fddd50de0..c277ec5534 100644
--- 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 24a68de511..15814bee6e 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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()
@@ -2756,7 +2764,7 @@ void SfxBaseModel::impl_store( const ::rtl::OUString& sURL
m_pData->m_pObjectShell->SetModifyPasswordHash( nModifyPasswordHash );
uno::Sequence< beans::PropertyValue > aOldModifyPasswordInfo = m_pData->m_pObjectShell->GetModifyPasswordInfo();
m_pData->m_pObjectShell->SetModifyPasswordInfo( aModifyPasswordInfo );
-
+
// since saving a document modifies its DocumentInfo, the current
// DocumentInfo must be saved on "SaveTo", so it can be restored
// after saving
@@ -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 871ed19d5e..61143399a5 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 6780561600..ad5a07b6b7 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 74d9585087..c14d2f169f 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 d6dc1bd653..44bcd53d23 100644
--- a/svx/source/form/makefile.mk
+++ b/svx/source/form/makefile.mk
@@ -44,6 +44,10 @@ ENABLE_EXCEPTIONS=TRUE
CDEFS+=-DENABLE_VBA
.ENDIF
+.IF "$(ENABLE_VBA)"=="YES"
+ CDEFS+=-DENABLE_VBA
+.ENDIF
+
SRS1NAME=form
SRC1FILES= \
fmexpl.src \
diff --git a/vbahelper/inc/vbahelper/vbaaccesshelper.hxx b/vbahelper/inc/vbahelper/vbaaccesshelper.hxx
index cfbe9e761e..29c90f2c9b 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 4ba494f83b..d1ef76ca1c 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 27ffa25eeb..590b551ae9 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 70bd565656..32e2f375c0 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 b68eb06815..6599204e84 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 77c5338442..46396bb8d4 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 8fc259046d..bb39d6ba0d 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 d1bc1e576e..97d9f42656 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 2d20ab1f98..92b01be839 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 5fce64649d..30ce22139c 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 15175f0e0f..16f5d16103 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 d3922d84a9..b99850b79b 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 4dfbf2908a..b7f713c9cf 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 7485073321..2290e476c8 100644
--- a/vbahelper/source/msforms/vbacontrol.cxx
+++ b/vbahelper/source/msforms/vbacontrol.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -65,15 +69,15 @@
using namespace com::sun::star;
using namespace ooo::vba;
-uno::Reference< css::awt::XWindowPeer >
+uno::Reference< css::awt::XWindowPeer >
ScVbaControl::getWindowPeer() throw (uno::RuntimeException)
{
uno::Reference< drawing::XControlShape > xControlShape( m_xControl, uno::UNO_QUERY );
uno::Reference< awt::XControlModel > xControlModel;
uno::Reference< css::awt::XWindowPeer > xWinPeer;
- if ( !xControlShape.is() )
- {
+ if ( !xControlShape.is() )
+ {
// would seem to be a Userform control
uno::Reference< awt::XControl > xControl( m_xControl, uno::UNO_QUERY_THROW );
xWinPeer = xControl->getPeer();
@@ -127,21 +131,30 @@ 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 ) );
setGeometryHelper( pGeomHelper );
uno::Reference< lang::XComponent > xComponent( m_xControl, uno::UNO_QUERY_THROW );
xComponent->addEventListener( m_xEventListener );
-
+
//init m_xProps
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()
@@ -153,7 +166,7 @@ ScVbaControl::~ScVbaControl()
}
}
-void
+void
ScVbaControl::setGeometryHelper( AbstractGeometryAttributes* pHelper )
{
mpGeometryHelper.reset( pHelper );
@@ -249,7 +262,7 @@ ScVbaControl::getObject() throw (uno::RuntimeException)
return xRet;
}
-void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
+void SAL_CALL ScVbaControl::SetFocus() throw (uno::RuntimeException)
{
uno::Reference< awt::XWindow > xWin( m_xControl, uno::UNO_QUERY_THROW );
xWin->setFocus();
@@ -271,7 +284,7 @@ void SAL_CALL ScVbaControl::Move( double Left, double Top, const uno::Any& Width
setHeight( nHeight );
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getControlSource() throw (uno::RuntimeException)
{
// #FIXME I *hate* having these upstream differences
@@ -294,7 +307,7 @@ ScVbaControl::getControlSource() throw (uno::RuntimeException)
}
catch( uno::Exception& )
{
- }
+ }
}
return sControlSource;
#else
@@ -302,7 +315,7 @@ ScVbaControl::getControlSource() throw (uno::RuntimeException)
#endif
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -313,7 +326,7 @@ ScVbaControl::setControlSource( const rtl::OUString& _controlsource ) throw (uno
#endif
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getRowSource() throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -334,7 +347,7 @@ ScVbaControl::getRowSource() throw (uno::RuntimeException)
}
catch( uno::Exception& )
{
- }
+ }
}
return sRowSource;
#else
@@ -342,7 +355,7 @@ ScVbaControl::getRowSource() throw (uno::RuntimeException)
#endif
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::RuntimeException)
{
#ifdef VBA_OOBUILD_HACK
@@ -353,7 +366,7 @@ ScVbaControl::setRowSource( const rtl::OUString& _rowsource ) throw (uno::Runtim
#endif
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getName() throw (uno::RuntimeException)
{
rtl::OUString sName;
@@ -370,7 +383,7 @@ ScVbaControl::setName( const rtl::OUString& _name ) throw (uno::RuntimeException
(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Name" ) ), uno::makeAny( _name ) );
}
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaControl::getControlTipText() throw (css::uno::RuntimeException)
{
rtl::OUString sName;
@@ -379,7 +392,7 @@ ScVbaControl::getControlTipText() throw (css::uno::RuntimeException)
return sName;
}
-void SAL_CALL
+void SAL_CALL
ScVbaControl::setControlTipText( const rtl::OUString& rsToolTip ) throw (css::uno::RuntimeException)
{
m_xProps->setPropertyValue
@@ -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:
@@ -454,9 +555,9 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
ScVbaControl* pControl = NULL;
uno::Reference< XHelperInterface > xVbaParent; // #FIXME - should be worksheet I guess
if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) ) )
- pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaCheckbox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlRadioButtonModel") ) ) )
- pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
+ pControl = new ScVbaRadioButton( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ) );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) ) )
pControl = new ScVbaTextBox( xVbaParent, m_xContext, xControl, m_xModel, new UserFormGeometryHelper( m_xContext, xControl ), true );
else if ( xServiceInfo->supportsService( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) ) )
@@ -493,14 +594,14 @@ ScVbaControl* ScVbaControlFactory::createControl( const uno::Reference< awt::XCo
return pControl;
}
-rtl::OUString&
+rtl::OUString&
ScVbaControl::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaControl") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaControl::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
@@ -524,25 +625,25 @@ public:
virtual uno::Reference< msforms::XControl > SAL_CALL createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException);
};
-uno::Reference< msforms::XControl > SAL_CALL
+uno::Reference< msforms::XControl > SAL_CALL
ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
{
uno::Reference< msforms::XControl > xControlToReturn;
- if ( xControlShape.is() )
+ if ( xControlShape.is() )
{
ScVbaControlFactory controlFactory( m_xCtx, xControlShape, xDocOwner );
xControlToReturn.set( controlFactory.createControl( xDocOwner ) );
}
return xControlToReturn;
-
+
}
-uno::Reference< msforms::XControl > SAL_CALL
+uno::Reference< msforms::XControl > SAL_CALL
ControlProviderImpl::createUserformControl( const uno::Reference< awt::XControl >& xControl, const uno::Reference< awt::XControl >& xDialog, const uno::Reference< frame::XModel >& xDocOwner ) throw (uno::RuntimeException)
{
uno::Reference< msforms::XControl > xControlToReturn;
- if ( xControl.is() && xDialog.is() )
- {
-
+ if ( xControl.is() && xDialog.is() )
+ {
+
ScVbaControlFactory controlFactory( m_xCtx, xControl, xDocOwner );
xControlToReturn.set( controlFactory.createControl( xDialog->getModel() ) );
ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xControlToReturn.get() );
diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx
index d2631c761e..3b80b89108 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 3c202f1e58..4e15918853 100644
--- a/vbahelper/source/msforms/vbaframe.cxx
+++ b/vbahelper/source/msforms/vbaframe.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +37,7 @@ ScVbaFrame::ScVbaFrame( const uno::Reference< XHelperInterface >& xParent, const
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
@@ -45,34 +45,58 @@ ScVbaFrame::getCaption() throw (css::uno::RuntimeException)
return Label;
}
-void SAL_CALL
+void SAL_CALL
ScVbaFrame::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaFrame::getValue() throw (css::uno::RuntimeException)
{
return uno::makeAny( getCaption() );
}
-void SAL_CALL
+void SAL_CALL
ScVbaFrame::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sCaption;
_value >>= sCaption;
- setCaption( 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&
+rtl::OUString&
ScVbaFrame::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaFrame") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaFrame::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
diff --git a/vbahelper/source/msforms/vbaframe.hxx b/vbahelper/source/msforms/vbaframe.hxx
index c55a41bf08..c92c007f06 100644
--- a/vbahelper/source/msforms/vbaframe.hxx
+++ b/vbahelper/source/msforms/vbaframe.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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 5fb6ebeabb..16256bf482 100644
--- a/vbahelper/source/msforms/vbalabel.cxx
+++ b/vbahelper/source/msforms/vbalabel.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -37,7 +37,7 @@ ScVbaLabel::ScVbaLabel( const css::uno::Reference< XHelperInterface >& xParent,
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
{
rtl::OUString Label;
@@ -45,34 +45,46 @@ ScVbaLabel::getCaption() throw (css::uno::RuntimeException)
return Label;
}
-void SAL_CALL
+void SAL_CALL
ScVbaLabel::setCaption( const rtl::OUString& _caption ) throw (::com::sun::star::uno::RuntimeException)
{
m_xProps->setPropertyValue( LABEL, uno::makeAny( _caption ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaLabel::getValue() throw (css::uno::RuntimeException)
{
return uno::makeAny( getCaption() );
}
-void SAL_CALL
+void SAL_CALL
ScVbaLabel::setValue( const uno::Any& _value ) throw (::com::sun::star::uno::RuntimeException)
{
rtl::OUString sCaption;
_value >>= sCaption;
- setCaption( sCaption );
+ 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&
+rtl::OUString&
ScVbaLabel::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaLabel") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaLabel::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
diff --git a/vbahelper/source/msforms/vbalabel.hxx b/vbahelper/source/msforms/vbalabel.hxx
index fd6b1c199f..e723098bd6 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 8538fc29bc..8d61cf5114 100644
--- a/vbahelper/source/msforms/vbalistbox.cxx
+++ b/vbahelper/source/msforms/vbalistbox.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -45,16 +45,16 @@ ScVbaListBox::ScVbaListBox( const uno::Reference< XHelperInterface >& xParent, c
}
// Attributes
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setListIndex( const uno::Any& _value ) throw (uno::RuntimeException)
{
sal_Int32 nIndex = 0;
_value >>= nIndex;
uno::Reference< XPropValue > xPropVal( Selected( nIndex ), uno::UNO_QUERY_THROW );
- xPropVal->setValue( uno::makeAny( sal_True ) );
+ xPropVal->setValue( uno::makeAny( sal_True ) );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::getListIndex() throw (uno::RuntimeException)
{
uno::Sequence< sal_Int16 > sSelection;
@@ -64,7 +64,7 @@ ScVbaListBox::getListIndex() throw (uno::RuntimeException)
return uno::Any( sSelection[ 0 ] );
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::getValue() throw (uno::RuntimeException)
{
uno::Sequence< sal_Int16 > sSelection;
@@ -76,15 +76,15 @@ ScVbaListBox::getValue() throw (uno::RuntimeException)
"Attribute use invalid." ), uno::Reference< uno::XInterface >() );
uno::Any aRet;
if ( sSelection.getLength() )
- aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
+ aRet = uno::makeAny( sItems[ sSelection[ 0 ] ] );
return aRet;
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
if( getMultiSelect() )
- {
+ {
throw uno::RuntimeException( rtl::OUString::createFromAscii(
"Attribute use invalid." ), uno::Reference< uno::XInterface >() );
}
@@ -99,7 +99,7 @@ ScVbaListBox::setValue( const uno::Any& _value ) throw (uno::RuntimeException)
{
if( sList[i].equals( sValue ) )
{
- nValue = i;
+ nValue = i;
break;
}
}
@@ -108,12 +108,16 @@ 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 ) );
+ m_xProps->setPropertyValue( SELECTEDITEMS, uno::makeAny( nSelectedIndices ) );
+ 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
+::rtl::OUString SAL_CALL
ScVbaListBox::getText() throw (uno::RuntimeException)
{
rtl::OUString result;
@@ -121,34 +125,36 @@ ScVbaListBox::getText() throw (uno::RuntimeException)
return result;
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::setText( const ::rtl::OUString& _text ) throw (uno::RuntimeException)
{
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)
+void SAL_CALL
+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
+
+css::uno::Any SAL_CALL
ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
{
uno::Sequence< rtl::OUString > sList;
m_xProps->getPropertyValue( ITEMS ) >>= sList;
sal_Int16 nLength = static_cast< sal_Int16 >( sList.getLength() );
// no choice but to do a horror cast as internally
- // the indices are but sal_Int16
+ // the indices are but sal_Int16
sal_Int16 nIndex = static_cast< sal_Int16 >( index );
if( nIndex < 0 || nIndex >= nLength )
throw uno::RuntimeException( rtl::OUString::createFromAscii(
@@ -158,19 +164,19 @@ ScVbaListBox::Selected( sal_Int32 index ) throw (css::uno::RuntimeException)
}
// Methods
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::AddItem( const uno::Any& pvargItem, const uno::Any& pvargIndex ) throw (uno::RuntimeException)
{
mpListHelper->AddItem( pvargItem, pvargIndex );
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
{
mpListHelper->removeItem( index );
}
-void SAL_CALL
+void SAL_CALL
ScVbaListBox::Clear( ) throw (uno::RuntimeException)
{
mpListHelper->Clear();
@@ -180,7 +186,7 @@ ScVbaListBox::Clear( ) throw (uno::RuntimeException)
// to set the selected state of particular entries in the Listbox
// ListBox1.Selected( 3 ) = false
//PropListener
-void
+void
ScVbaListBox::setValueEvent( const uno::Any& value )
{
sal_Bool bValue = sal_False;
@@ -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 ) );
}
}
@@ -231,14 +239,14 @@ ScVbaListBox::setValueEvent( const uno::Any& value )
// to determine the selected state of particular entries in the Listbox
// msgbox ListBox1.Selected( 3 )
-css::uno::Any
+css::uno::Any
ScVbaListBox::getValueEvent()
{
uno::Sequence< sal_Int16 > nList;
m_xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SelectedItems" ) ) ) >>= nList;
sal_Int32 nLength = nList.getLength();
sal_Int32 nIndex = m_nIndex;
-
+
for( sal_Int32 i = 0; i < nLength; i++ )
{
if( nList[i] == nIndex )
@@ -261,20 +269,20 @@ ScVbaListBox::getListCount() throw (uno::RuntimeException)
return mpListHelper->getListCount();
}
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaListBox::List( const ::uno::Any& pvargIndex, const uno::Any& pvarColumn ) throw (uno::RuntimeException)
{
return mpListHelper->List( pvargIndex, pvarColumn );
}
-rtl::OUString&
+rtl::OUString&
ScVbaListBox::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaListBox") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaListBox::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
diff --git a/vbahelper/source/msforms/vbalistbox.hxx b/vbahelper/source/msforms/vbalistbox.hxx
index 01c53d1b0f..d540102a67 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 36683ae6f7..16e143bd2e 100644
--- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx
+++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx
@@ -1,12 +1,70 @@
#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") );
-void SAL_CALL
+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)
{
if ( pvargItem.hasValue() )
@@ -21,13 +79,13 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
rtl::OUString sString = getAnyAsString( pvargItem );
- // if no index specified or item is to be appended to end of
+ // if no index specified or item is to be appended to end of
// list just realloc the array and set the last item
if ( nIndex == sList.getLength() )
{
sal_Int32 nOldSize = sList.getLength();
sList.realloc( nOldSize + 1 );
- sList[ nOldSize ] = sString;
+ sList[ nOldSize ] = sString;
}
else
{
@@ -41,10 +99,10 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
const rtl::OUString* pEndString = sList.getArray() + sList.getLength();
// insert the new element
sVec.push_back( sString );
- // copy elements
+ // copy elements
for ( ; pString != pEndString; ++pString )
sVec.push_back( *pString );
-
+
sList.realloc( sList.getLength() + 1 );
// point at first element to be overwritten
@@ -52,16 +110,16 @@ ListControlHelper::AddItem( const uno::Any& pvargItem, const uno::Any& pvargInde
pEndString = sList.getArray() + sList.getLength();
std::vector< rtl::OUString >::iterator it = sVec.begin();
for ( ; pString != pEndString; ++pString, ++it)
- *pString = *it;
+ *pString = *it;
//
}
m_xProps->setPropertyValue( ITEMS, uno::makeAny( sList ) );
-
+
}
}
-void SAL_CALL
+void SAL_CALL
ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeException)
{
sal_Int32 nIndex = 0;
@@ -90,7 +148,7 @@ ListControlHelper::removeItem( const uno::Any& index ) throw (uno::RuntimeExcept
}
}
-void SAL_CALL
+void SAL_CALL
ListControlHelper::Clear( ) throw (uno::RuntimeException)
{
// urk, setValue doesn't seem to work !!
@@ -113,34 +171,8 @@ ListControlHelper::getListCount() throw (uno::RuntimeException)
return sList.getLength();
}
-uno::Any SAL_CALL
+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 4cdf220aa6..8b3592c100 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 3853f380d9..f8d6e215fd 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 730f24c961..133d9ba849 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 d16fab90e4..8d7206d54f 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 33e357b00c..e2996d1e3c 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 463a3cba3b..216f5580f7 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 22ed40a3ad..31fefa8430 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 57e303893e..940a3d9a57 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 ec7ecae9f4..256be61993 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 0eba699a07..b4a7a12872 100644
--- a/vbahelper/source/vbahelper/vbadocumentbase.cxx
+++ b/vbahelper/source/vbahelper/vbadocumentbase.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -24,7 +24,7 @@
* for a copy of the LGPLv3 License.
*
************************************************************************/
-
+
#include "vbahelper/vbadocumentbase.hxx"
#include "vbahelper/helperdecl.hxx"
@@ -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>
@@ -47,12 +48,12 @@ VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >&
{
}
-VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ) : VbaDocumentBase_BASE( xParent, xContext ), mxModel( xModel )
-{
+VbaDocumentBase::VbaDocumentBase( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > xModel ) : VbaDocumentBase_BASE( xParent, xContext ), mxModel( xModel )
+{
}
VbaDocumentBase::VbaDocumentBase( uno::Sequence< uno::Any> const & args,
- uno::Reference< uno::XComponentContext> const & xContext ) : VbaDocumentBase_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
+ uno::Reference< uno::XComponentContext> const & xContext ) : VbaDocumentBase_BASE( getXSomethingFromArgs< XHelperInterface >( args, 0 ), xContext ), mxModel( getXSomethingFromArgs< frame::XModel >( args, 1 ) )
{
}
@@ -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;
}
@@ -114,28 +110,36 @@ VbaDocumentBase::Close( const uno::Any &rSaveArg, const uno::Any &rFileArg,
if( bSaveChanges )
{
if( xStorable->isReadonly() )
- {
- throw uno::RuntimeException(::rtl::OUString(
+ {
+ throw uno::RuntimeException(::rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM( "Unable to save to a read only file ") ),
uno::Reference< XInterface >() );
}
if( bFileName )
- xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
+ xStorable->storeAsURL( aFileName, uno::Sequence< beans::PropertyValue >(0) );
else
xStorable->store();
- }
+ }
else
- xModifiable->setModified( false );
+ xModifiable->setModified( false );
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& )
+ {
+ }
+ }
}
}
@@ -159,7 +172,7 @@ VbaDocumentBase::Protect( const uno::Any &aPassword ) throw (uno::RuntimeExcepti
xProt->protect( rtl::OUString() );
}
-void
+void
VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeException)
{
rtl::OUString rPassword;
@@ -176,8 +189,8 @@ VbaDocumentBase::Unprotect( const uno::Any &aPassword ) throw (uno::RuntimeExcep
xProt->unprotect( rtl::OUString() );
}
}
-
-void
+
+void
VbaDocumentBase::setSaved( sal_Bool bSave ) throw (uno::RuntimeException)
{
uno::Reference< util::XModifiable > xModifiable( getModel(), uno::UNO_QUERY_THROW );
@@ -199,12 +212,12 @@ VbaDocumentBase::Save() throw (uno::RuntimeException)
dispatchRequests(xModel,url);
}
-void
+void
VbaDocumentBase::Activate() throw (uno::RuntimeException)
{
uno::Reference< frame::XFrame > xFrame( getModel()->getCurrentController()->getFrame(), uno::UNO_QUERY_THROW );
xFrame->activate();
-}
+}
uno::Any SAL_CALL
VbaDocumentBase::getVBProject() throw (uno::RuntimeException)
@@ -232,7 +245,7 @@ VbaDocumentBase::getServiceImplName()
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
VbaDocumentBase::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx
index 61cdb52ca3..a8998ae6fa 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 cf1981fa8f..2fcda8e709 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -73,7 +74,7 @@
#ifndef OOVBA_DLLIMPLEMENTATION
#define OOVBA_DLLIMPLEMENTATION
-#endif
+#endif
#include <vbahelper/vbahelper.hxx>
#include <sfx2/app.hxx>
@@ -190,7 +191,7 @@ implnCopy()
pViewShell->CopyToClip(NULL,false,false,true);
}
-void
+void
implnCut()
{
ScTabViewShell* pViewShell = getCurrentBestViewShell();
@@ -203,23 +204,23 @@ void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,
sal_Bool bAsLink(sal_False), bOtherDoc(sal_False);
InsCellCmd eMoveMode = INS_NONE;
- if ( !pTabViewShell )
+ if ( !pTabViewShell )
// none active, try next best
pTabViewShell = getCurrentBestViewShell();
if ( pTabViewShell )
{
- ScViewData* pView = pTabViewShell->GetViewData();
+ ScViewData* pView = pTabViewShell->GetViewData();
Window* pWin = ( pView != NULL ) ? pView->GetActiveWin() : NULL;
if ( pView && pWin )
{
if ( bAsLink && bOtherDoc )
pTabViewShell->PasteFromSystem(0);//SOT_FORMATSTR_ID_LINK
- else
+ else
{
ScTransferObj* pOwnClip = ScTransferObj::GetOwnClipboard( pWin );
- ScDocument* pDoc = NULL;
+ ScDocument* pDoc = NULL;
if ( pOwnClip )
- pDoc = pOwnClip->GetDocument();
+ pDoc = pOwnClip->GetDocument();
pTabViewShell->PasteFromClip( nFlags, pDoc,
nFunction, bSkipEmpty, bTranspose, bAsLink,
eMoveMode, IDF_NONE, TRUE );
@@ -230,8 +231,8 @@ void implnPasteSpecial(SfxViewShell* pViewShell, USHORT nFlags,USHORT nFunction,
}
-ScDocShell*
-getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
+ScDocShell*
+getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
{
uno::Reference< uno::XInterface > xIf( xModel, uno::UNO_QUERY_THROW );
ScModelObj* pModel = dynamic_cast< ScModelObj* >( xIf.get() );
@@ -242,7 +243,7 @@ getDocShell( css::uno::Reference< css::frame::XModel>& xModel )
}
-ScTabViewShell*
+ScTabViewShell*
getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
{
ScDocShell* pDocShell = getDocShell( xModel );
@@ -251,17 +252,17 @@ getBestViewShell( css::uno::Reference< css::frame::XModel>& xModel )
return NULL;
}
-ScTabViewShell*
+ScTabViewShell*
getCurrentBestViewShell()
-{
+{
uno::Reference< frame::XModel > xModel = getCurrentDocument();
return getBestViewShell( xModel );
}
-SfxViewFrame*
+SfxViewFrame*
getCurrentViewFrame()
{
- ScTabViewShell* pViewShell = getCurrentBestViewShell();
+ ScTabViewShell* pViewShell = getCurrentBestViewShell();
if ( pViewShell )
return pViewShell->GetViewFrame();
return NULL;
@@ -307,11 +308,11 @@ void dispatchExecute(SfxViewShell* pViewShell, USHORT nSlot, SfxCallMode nCall)
{
pDispatcher->Execute( nSlot , 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;
@@ -329,7 +330,7 @@ dispatchRequests( const uno::Reference< frame::XModel>& xModel, const rtl::OUStr
uno::Reference<lang::XMultiComponentFactory > xServiceManager = xContext->getServiceManager();
if ( !xServiceManager.is() )
return;
-
+
uno::Reference<util::XURLTransformer> xParser( xServiceManager->createInstanceWithContext(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.util.URLTransformer" ) ), xContext),
uno::UNO_QUERY_THROW );
@@ -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
@@ -382,7 +393,7 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
{
OSL_TRACE("getModelFromBasic() StarBASIC* is NULL" );
return xModel;
- }
+ }
SbxObject* p = pBasic;
SbxObject* pParent = p->GetParent();
SbxObject* pParentParent = pParent ? pParent->GetParent() : NULL;
@@ -397,7 +408,7 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
}
- uno::Any aModel;
+ uno::Any aModel;
SbxVariable *pCompVar = basicChosen->Find( sKey, SbxCLASS_OBJECT );
if ( pCompVar )
@@ -406,7 +417,7 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
if ( sal_False == ( aModel >>= xModel ) ||
!xModel.is() )
{
- throw uno::RuntimeException(
+ throw uno::RuntimeException(
rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can't extract model from basic ( its obviously not set yet ) therefore don't know the current documet context") ), uno::Reference< uno::XInterface >() );
}
else
@@ -419,8 +430,8 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
else
{
OSL_TRACE("Failed to get %s", rtl::OUStringToOString( sKey, RTL_TEXTENCODING_UTF8 ).getStr() );
- throw uno::RuntimeException(
- rtl::OUString(
+ throw uno::RuntimeException(
+ rtl::OUString(
RTL_CONSTASCII_USTRINGPARAM(
"Can't determine the currently selected document") ),
uno::Reference< uno::XInterface >() );
@@ -428,7 +439,7 @@ getCurrentDoc( const rtl::OUString& sKey ) throw (uno::RuntimeException)
return xModel;
}
- uno::Reference< frame::XModel >
+ uno::Reference< frame::XModel >
getCurrentDocCtx( const rtl::OUString& ctxName, const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
uno::Reference< frame::XModel > xModel;
@@ -466,14 +477,14 @@ getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) t
return xModel;
}
- uno::Reference< frame::XModel >
+ uno::Reference< frame::XModel >
getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
static const rtl::OUString sThisWordDoc( RTL_CONSTASCII_USTRINGPARAM("ThisWordDoc" ) );
uno::Reference< frame::XModel > xModel;
try
{
- xModel = getCurrentDoc( sThisWordDoc );
+ xModel = getCurrentDoc( sThisWordDoc );
}
catch( uno::Exception& e )
{
@@ -498,7 +509,7 @@ OORGBToXLRGB( sal_Int32 nCol )
sal_Int32 nRGB = ( nAutoBits | (nBlue << 16) | (nGreen << 8) | nRed );
return nRGB;
}
-sal_Int32
+sal_Int32
XLRGBToOORGB( sal_Int32 nCol )
{
sal_Int32 nAutoBits = nCol;
@@ -515,7 +526,7 @@ XLRGBToOORGB( sal_Int32 nCol )
sal_Int32 nRGB = ( nAutoBits | (nRed << 16) | (nGreen << 8) | nBlue );
return nRGB;
}
-uno::Any
+uno::Any
OORGBToXLRGB( const uno::Any& aCol )
{
sal_Int32 nCol(0);
@@ -523,7 +534,7 @@ OORGBToXLRGB( const uno::Any& aCol )
nCol = OORGBToXLRGB( nCol );
return uno::makeAny( nCol );
}
-uno::Any
+uno::Any
XLRGBToOORGB( const uno::Any& aCol )
{
sal_Int32 nCol(0);
@@ -549,7 +560,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
rtl::OUString sRange( RTL_CONSTASCII_USTRINGPARAM( "-" ) );
rtl::OUString sFileName;
-
+
if (( nFrom || nTo ) )
{
if ( nFrom )
@@ -568,7 +579,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
if ( pViewFrame )
{
SfxAllItemSet aArgs( SFX_APP()->GetPool() );
-
+
SfxBoolItem sfxCollate( SID_PRINT_COLLATE, bCollate );
aArgs.Put( sfxCollate, sfxCollate.Which() );
SfxInt16Item sfxCopies( SID_PRINT_COPIES, nCopies );
@@ -577,7 +588,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
{
SfxStringItem sfxFileName( SID_FILE_NAME, sFileName);
aArgs.Put( sfxFileName, sfxFileName.Which() );
-
+
}
if ( sRange.getLength() )
{
@@ -594,7 +605,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
{
if ( bPreview )
{
- if ( !pViewFrame->GetFrame().IsInPlace() )
+ if ( !pViewFrame->GetFrame().IsInPlace() )
{
// #TODO is this necessary ( calc specific )
// SC_MOD()->InputEnterHandler();
@@ -606,12 +617,12 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
else
pDispatcher->Execute( (USHORT)SID_PRINTDOC, (SfxCallMode)SFX_CALLMODE_SYNCHRON, aArgs );
}
-
+
}
-
+
// #FIXME #TODO
// 1 ActivePrinter ( how/can we switch a printer via API? )
- // 2 PrintToFile ( ms behaviour if this option is specified but no
+ // 2 PrintToFile ( ms behaviour if this option is specified but no
// filename supplied 'PrToFileName' then the user will be prompted )
// 3 Need to check behaviour of Selected sheets with range ( e.g. From & To
// values ) in oOO these options are mutually exclusive
@@ -628,7 +639,7 @@ void PrintOutHelper( SfxViewShell* pViewShell, const uno::Any& From, const uno::
bool extractBoolFromAny( bool& rbValue, const uno::Any& rAny )
{
if( rAny >>= rbValue ) return true;
-
+
sal_Int64 nSigned = 0;
if( rAny >>= nSigned ) { rbValue = nSigned != 0; return true; }
@@ -637,7 +648,7 @@ bool extractBoolFromAny( bool& rbValue, const uno::Any& rAny )
double fDouble = 0.0;
if( rAny >>= fDouble ) { rbValue = fDouble != 0.0; return true; }
-
+
return false;
}
@@ -704,13 +715,13 @@ rtl::OUString getAnyAsString( const uno::Any& pvargItem ) throw ( uno::RuntimeEx
}
-rtl::OUString
+rtl::OUString
ContainerUtilities::getUniqueName( const uno::Sequence< ::rtl::OUString >& _slist, const rtl::OUString& _sElementName, const ::rtl::OUString& _sSuffixSeparator)
{
return getUniqueName(_slist, _sElementName, _sSuffixSeparator, sal_Int32(2));
}
-rtl::OUString
+rtl::OUString
ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist, const rtl::OUString _sElementName, const rtl::OUString& _sSuffixSeparator, sal_Int32 _nStartSuffix)
{
sal_Int32 a = _nStartSuffix;
@@ -720,7 +731,7 @@ ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist,
if ( nLen == 0 )
return _sElementName;
- while (bElementexists == true)
+ while (bElementexists == true)
{
for (sal_Int32 i = 0; i < nLen; i++)
{
@@ -734,17 +745,17 @@ ContainerUtilities::getUniqueName( const uno::Sequence< rtl::OUString >& _slist,
return rtl::OUString();
}
-sal_Int32
+sal_Int32
ContainerUtilities::FieldInList( const uno::Sequence< rtl::OUString >& SearchList, const rtl::OUString& SearchString )
{
sal_Int32 FieldLen = SearchList.getLength();
sal_Int32 retvalue = -1;
- for (sal_Int32 i = 0; i < FieldLen; i++)
+ for (sal_Int32 i = 0; i < FieldLen; i++)
{
// I wonder why comparing lexicographically is done
// when its a match is whats interesting?
- //if (SearchList[i].compareTo(SearchString) == 0)
- if ( SearchList[i].equals( SearchString ) )
+ //if (SearchList[i].compareTo(SearchString) == 0)
+ if ( SearchList[i].equals( SearchString ) )
{
retvalue = i;
break;
@@ -769,7 +780,7 @@ rtl::OUString VBAToRegexp(const rtl::OUString &rIn, bool bForLike )
if ( bForLike )
sResult.append(static_cast<sal_Unicode>('^'));
- while (start < end)
+ while (start < end)
{
switch (*start)
{
@@ -846,7 +857,7 @@ double getPixelTo100thMillimeterConversionFactor( css::uno::Reference< css::awt:
}
else
{
- fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
+ fConvertFactor = xDevice->getInfo().PixelPerMeterX/100000;
}
return fConvertFactor;
}
@@ -879,7 +890,7 @@ ConcreteXShapeGeometryAttributes::ConcreteXShapeGeometryAttributes( const css::u
sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel )
{
-
+
sal_Int32 nPointerStyle( POINTER_ARROW );
try
{
@@ -899,7 +910,7 @@ sal_Int32 getPointerStyle( const uno::Reference< frame::XModel >& xModel )
}
// #FIXME this method looks wrong, shouldn't it just affect calc *or* writer
-// document/frame/window(s) but not both ( and depending on what api called
+// document/frame/window(s) but not both ( and depending on what api called
// this )
void setCursorHelper( const uno::Reference< frame::XModel >& xModel, const Pointer& rPointer, sal_Bool bOverWrite )
{
@@ -946,19 +957,36 @@ void setDefaultPropByIntrospection( const uno::Any& aObj, const uno::Any& aValue
{
uno::Reference< beans::XIntrospectionAccess > xUnoAccess( getIntrospectionAccess( aObj ) );
- // #MAYBE #FIXME sort of a bit of a hack,
+ // #MAYBE #FIXME sort of a bit of a hack,
uno::Reference< script::XDefaultProperty > xDflt( 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() )
xPropSet->setPropertyValue( xDflt->getDefaultPropertyName(), aValue );
else
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 )
@@ -1076,7 +1116,7 @@ double UserFormGeometryHelper::getLeft()
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position X!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
return nResult;
@@ -1102,7 +1142,7 @@ void UserFormGeometryHelper::setLeft( double nLeft )
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
}
@@ -1128,7 +1168,7 @@ double UserFormGeometryHelper::getTop()
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get position Y!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
return nResult;
@@ -1154,7 +1194,7 @@ void UserFormGeometryHelper::setTop( double nTop )
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set position X!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
}
@@ -1180,7 +1220,7 @@ double UserFormGeometryHelper::getWidth()
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get width!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
return nResult;
@@ -1206,7 +1246,7 @@ void UserFormGeometryHelper::setWidth( double nWidth)
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set width!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
}
@@ -1232,7 +1272,7 @@ double UserFormGeometryHelper::getHeight()
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not get height!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
return nResult;
@@ -1258,7 +1298,7 @@ void UserFormGeometryHelper::setHeight( double nHeight )
{
throw lang::WrappedTargetException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Can not set height!" ) ),
uno::Reference< uno::XInterface >(),
- uno::makeAny( e ) );
+ uno::makeAny( e ) );
}
}
@@ -1300,11 +1340,11 @@ void UserFormGeometryHelper::setHeight( double nHeight )
ShapeHelper::ShapeHelper( const css::uno::Reference< css::drawing::XShape >& _xShape) throw (css::script::BasicErrorException ) : xShape( _xShape )
- {
- if( !xShape.is() )
+ {
+ if( !xShape.is() )
throw css::uno::RuntimeException( rtl::OUString::createFromAscii("No valid shape for helper"), css::uno::Reference< css::uno::XInterface >() );
}
-
+
double ShapeHelper::getHeight()
{
return Millimeter::getInPoints(xShape->getSize().Height);
@@ -1324,10 +1364,10 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
}
-
-
+
+
double ShapeHelper::getWidth()
- {
+ {
return Millimeter::getInPoints(xShape->getSize().Width);
}
@@ -1344,35 +1384,35 @@ void UserFormGeometryHelper::setHeight( double nHeight )
throw css::script::BasicErrorException( rtl::OUString(), css::uno::Reference< css::uno::XInterface >(), SbERR_METHOD_FAILED, rtl::OUString() );
}
}
-
-
+
+
double ShapeHelper::getLeft()
{
return Millimeter::getInPoints(xShape->getPosition().X);
}
-
+
void ShapeHelper::setLeft(double _fLeft)
{
css::awt::Point aPoint = xShape->getPosition();
aPoint.X = Millimeter::getInHundredthsOfOneMillimeter(_fLeft);
xShape->setPosition(aPoint);
}
-
+
double ShapeHelper::getTop()
{
return Millimeter::getInPoints(xShape->getPosition().Y);
}
-
+
void ShapeHelper::setTop(double _fTop)
{
css::awt::Point aPoint = xShape->getPosition();
aPoint.Y = Millimeter::getInHundredthsOfOneMillimeter(_fTop);
xShape->setPosition(aPoint);
}
-
+
void DebugHelper::exception( const rtl::OUString& DetailedMessage, const css::uno::Exception& ex, int err, const rtl::OUString& /*additionalArgument*/ ) throw( css::script::BasicErrorException )
{
// #TODO #FIXME ( do we want to support additionalArg here )
@@ -1389,20 +1429,20 @@ void UserFormGeometryHelper::setHeight( double nHeight )
}
Millimeter::Millimeter():m_nMillimeter(0) {}
-
+
Millimeter::Millimeter(double mm):m_nMillimeter(mm) {}
-
+
void Millimeter::set(double mm) { m_nMillimeter = mm; }
- void Millimeter::setInPoints(double points)
- {
+ void Millimeter::setInPoints(double points)
+ {
m_nMillimeter = points * factor / 100.0;
}
-
+
void Millimeter::setInHundredthsOfOneMillimeter(double hmm)
{
m_nMillimeter = hmm / 100;
}
-
+
double Millimeter::get()
{
return m_nMillimeter;
@@ -1414,14 +1454,14 @@ void UserFormGeometryHelper::setHeight( double nHeight )
double Millimeter::getInPoints()
{
return m_nMillimeter / factor * 100.0;
- }
+ }
sal_Int32 Millimeter::getInHundredthsOfOneMillimeter(double points)
{
sal_Int32 mm = static_cast<sal_Int32>(points * factor);
return mm;
}
-
+
double Millimeter::getInPoints(int _hmm)
{
double points = double( static_cast<double>(_hmm) / factor);
@@ -1444,10 +1484,32 @@ void UserFormGeometryHelper::setHeight( double nHeight )
if ( pMod )
xIf = pMod->GetUnoModule();
}
- }
+ }
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 bcdf83a88c..cb0fab6e6b 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 e0ec739f23..2073642251 100644
--- a/vbahelper/source/vbahelper/vbashape.cxx
+++ b/vbahelper/source/vbahelper/vbashape.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -69,7 +70,7 @@ ScVbaShape::ScVbaShape( const uno::Reference< uno::XComponentContext >& xContext
}
ScVbaShape::~ScVbaShape()
-{
+{
// dtor must never ever throw
/*try
{
@@ -78,10 +79,10 @@ ScVbaShape::~ScVbaShape()
}
catch( uno::Exception& )
{
- }*/
+ }*/
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::RuntimeException )
{
try
@@ -92,7 +93,7 @@ ScVbaShape::disposing( const lang::EventObject& rEventObject ) throw( uno::Runti
removeShapesListener();
if ( xShape.is() )
removeShapeListener();
- }
+ }
catch( uno::Exception& )
{
}
@@ -133,7 +134,7 @@ ScVbaShape::removeShapesListener() throw( uno::RuntimeException )
m_xShapes = NULL;
}
-sal_Int32
+sal_Int32
ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw (uno::RuntimeException)
{
rtl::OUString sShapeType;
@@ -145,7 +146,7 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw
return office::MsoShapeType::msoGroup;
else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.GraphicObjectShape" ) ) )
return office::MsoShapeType::msoPicture;
- else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ||
+ else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.ControlShape" ) ) ||
sShapeType.equals( rtl::OUString::createFromAscii( "FrameShape" ) ) )
return office::MsoShapeType::msoOLEControlObject;
// OOo don't support office::MsoShapeType::msoComment as a Shape.
@@ -161,7 +162,7 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw
return office::MsoShapeType::msoFreeform;
else if( connectorType == drawing::ConnectorType_LINE )
return office::MsoShapeType::msoLine;
- else
+ else
return office::MsoShapeType::msoAutoShape;
}
else if( sShapeType.equals( rtl::OUString::createFromAscii( "com.sun.star.drawing.LineShape" ) ) )
@@ -176,7 +177,7 @@ ScVbaShape::getType( const css::uno::Reference< drawing::XShape > xShape ) throw
}
// Attributes
-rtl::OUString SAL_CALL
+rtl::OUString SAL_CALL
ScVbaShape::getName() throw (uno::RuntimeException)
{
rtl::OUString sName;
@@ -185,75 +186,116 @@ ScVbaShape::getName() throw (uno::RuntimeException)
return sName;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setName( const rtl::OUString& _name ) throw (uno::RuntimeException)
{
uno::Reference< container::XNamed > xNamed( m_xShape, uno::UNO_QUERY_THROW );
xNamed->setName( _name );
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getHeight() throw (uno::RuntimeException)
{
return m_pShapeHelper->getHeight();
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setHeight( double _height ) throw (uno::RuntimeException)
{
m_pShapeHelper->setHeight( _height );
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getWidth() throw (uno::RuntimeException)
{
return m_pShapeHelper->getWidth();
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setWidth( double _width ) throw (uno::RuntimeException)
{
m_pShapeHelper->setWidth( _width );
}
-double SAL_CALL
+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
+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
+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
+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
+sal_Bool SAL_CALL
ScVbaShape::getVisible() throw (uno::RuntimeException)
{
//UNO Shapes are always visible
return sal_True;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setVisible( sal_Bool /*_visible*/ ) throw (uno::RuntimeException)
{
//UNO Shapes are always visible
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getZOrderPosition() throw (uno::RuntimeException)
{
sal_Int32 nZOrderPosition = 0;
@@ -262,13 +304,13 @@ ScVbaShape::getZOrderPosition() throw (uno::RuntimeException)
return nZOrderPosition + 1;
}
-sal_Int32 SAL_CALL
+sal_Int32 SAL_CALL
ScVbaShape::getType() throw (uno::RuntimeException)
{
return m_nType;
}
-double SAL_CALL
+double SAL_CALL
ScVbaShape::getRotation() throw (uno::RuntimeException)
{
double dRotation = 0;
@@ -278,14 +320,14 @@ ScVbaShape::getRotation() throw (uno::RuntimeException)
return dRotation;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setRotation( double _rotation ) throw (uno::RuntimeException)
{
sal_Int32 nRotation = static_cast < sal_Int32 > ( _rotation * 100 );
m_xPropertySet->setPropertyValue( rtl::OUString::createFromAscii( "RotateAngle" ), uno::makeAny( nRotation ) );
}
-uno::Reference< msforms::XLineFormat > SAL_CALL
+uno::Reference< msforms::XLineFormat > SAL_CALL
ScVbaShape::getLine() throw (uno::RuntimeException)
{
// TODO should ongly return line
@@ -305,7 +347,7 @@ ScVbaShape::getPictureFormat() throw (uno::RuntimeException)
}
// Methods
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaShape::TextFrame() throw (uno::RuntimeException)
{
uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
@@ -322,14 +364,14 @@ ScVbaShape::TextFrame() throw (uno::RuntimeException)
return uno::makeAny( uno::Reference< msforms::XTextFrame >( new VbaTextFrame( this, mxContext, m_xShape ) ) );
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::Delete() throw (uno::RuntimeException)
{
OGuard aGuard( Application::GetSolarMutex() );
m_xShapes->remove( m_xShape );
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
{
sal_Int32 nOrderPositon;
@@ -363,7 +405,7 @@ ScVbaShape::ZOrder( sal_Int32 ZOrderCmd ) throw (uno::RuntimeException)
}
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
{
double nCurrentRotation = getRotation();
@@ -371,7 +413,7 @@ ScVbaShape::IncrementRotation( double Increment ) throw (uno::RuntimeException)
setRotation(nCurrentRotation);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
{
double nCurrentLeft = getLeft();
@@ -379,7 +421,7 @@ ScVbaShape::IncrementLeft( double Increment ) throw (uno::RuntimeException)
setLeft(nCurrentLeft);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
{
double nCurrentTop = getTop();
@@ -387,7 +429,7 @@ ScVbaShape::IncrementTop( double Increment ) throw (uno::RuntimeException)
setTop(nCurrentTop);
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
{
double nHeight = getHeight();
@@ -416,7 +458,7 @@ ScVbaShape::ScaleHeight( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal
}
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::ScaleWidth( double Factor, sal_Bool /*RelativeToOriginalSize*/, sal_Int32 Scale ) throw (uno::RuntimeException)
{
double nWidth = getWidth();
@@ -453,20 +495,20 @@ ScVbaShape::Select( const uno::Any& /*Replace*/ ) throw ( uno::RuntimeException
}
// This method should not be part of Shape, what we reall need to do is...
-// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
+// dynamically create the appropriate objects e.g. TextBox, Oval, Picture etc.
// ( e.g. the ones that really do have ShapeRange as an attribute )
-uno::Any SAL_CALL
+uno::Any SAL_CALL
ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
{
- // perhaps we should store a reference to the Shapes Collection
+ // perhaps we should store a reference to the Shapes Collection
// in this class
// but anyway this method should not even be in this class
// #TODO not sure what the parent of the Shapes collection should be
-
+
XNamedObjectCollectionHelper< drawing::XShape >::XNamedVec aVec;
aVec.push_back( m_xShape );
uno::Reference< container::XIndexAccess > xIndexAccess( new XNamedObjectCollectionHelper< drawing::XShape >( aVec ) );
- uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
+ uno::Reference< container::XChild > xChild( m_xShape, uno::UNO_QUERY_THROW );
// #FIXME for want of a better parent, setting this
uno::Reference< msforms::XShapeRange > xShapeRange( new ScVbaShapeRange( mxParent, mxContext, xIndexAccess, uno::Reference< drawing::XDrawPage >( xChild->getParent(), uno::UNO_QUERY_THROW ), m_xModel ) );
if ( index.hasValue() )
@@ -474,90 +516,104 @@ ScVbaShape::ShapeRange( const uno::Any& index ) throw ( uno::RuntimeException )
return uno::makeAny( xShapeRange );
}
-sal_Bool SAL_CALL
+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)
{
// FIXME:
return sal_False;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setLockAspectRatio( sal_Bool /*_lockaspectratio*/ ) throw (uno::RuntimeException)
{
// FIXME:
}
-sal_Bool SAL_CALL
+sal_Bool SAL_CALL
ScVbaShape::getLockAnchor() throw (uno::RuntimeException)
{
// FIXME:
return sal_True;
}
-void SAL_CALL
+void SAL_CALL
ScVbaShape::setLockAnchor( sal_Bool /*_lockanchor*/ ) throw (uno::RuntimeException)
{
// FIXME:
}
-sal_Int32 SAL_CALL
+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;
-
- switch( eType )
+ sal_Int16 nType = text::RelOrientation::PAGE_LEFT;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HoriOrientRelation") ) ) >>= nType;
+
+ 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;
}
-void SAL_CALL
+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,67 +621,70 @@ 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
+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;
-
- switch( eType )
+ sal_Int16 nType = text::RelOrientation::PAGE_FRAME;
+ m_xPropertySet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("VertOrientRelation") ) ) >>= nType;
+
+ 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;
}
-void SAL_CALL
+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,10 +692,10 @@ 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
+uno::Any SAL_CALL
ScVbaShape::WrapFormat() throw (uno::RuntimeException)
{
uno::Reference< lang::XServiceInfo > xServiceInfo( m_xModel, uno::UNO_QUERY_THROW );
@@ -653,14 +712,14 @@ ScVbaShape::WrapFormat() throw (uno::RuntimeException)
}
-rtl::OUString&
+rtl::OUString&
ScVbaShape::getServiceImplName()
{
static rtl::OUString sImplName( RTL_CONSTASCII_USTRINGPARAM("ScVbaShape") );
return sImplName;
}
-uno::Sequence< rtl::OUString >
+uno::Sequence< rtl::OUString >
ScVbaShape::getServiceNames()
{
static uno::Sequence< rtl::OUString > aServiceNames;
diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx
index f6dc8ad72c..0339e8e2f0 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 f64b4aafd0..1b77ef8a63 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 dda4be0cbc..a09ffa5944 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 3378c56226..79197cf8f9 100644
--- a/xmloff/inc/xmlnmspe.hxx
+++ b/xmloff/inc/xmlnmspe.hxx
@@ -105,5 +105,7 @@ XML_OLD_NAMESPACE( META, 6U )
// experimental namespaces
XML_NAMESPACE( FIELD, 100U )
XML_NAMESPACE( CSS3TEXT, 103U ) // CSS Text Level 3
+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 9f28c27207..43cabbeaf1 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 0e848d69b1..0f9ff6695b 100644
--- a/xmloff/inc/xmloff/xmltoken.hxx
+++ b/xmloff/inc/xmloff/xmltoken.hxx
@@ -145,10 +145,13 @@ 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,
-
XML_NP_DRAW_EXT,
XML_N_DRAW_EXT,
diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx
index 01c6647ef2..c58cdb4297 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 87c29594ca..2bbfdad82c 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";
@@ -310,6 +311,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 0ebf878d95..7564910281 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 dcc9ff48cb..732fc07de9 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 76353ba6a3..7dc8ce67d3 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 6a21bf5bee..f28591ffc7 100644
--- a/xmloff/source/draw/shapeexport2.cxx
+++ b/xmloff/source/draw/shapeexport2.cxx
@@ -291,9 +291,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
@@ -383,33 +380,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 )
@@ -561,15 +531,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 )
@@ -584,18 +548,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 82285ba30d..a12207781e 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -187,7 +187,7 @@ SvXMLImportContext *SdXMLShapeContext::CreateChildContext( USHORT p_nPrefix,
SvXMLImportContext * pContext = NULL;
// #i68101#
- if( p_nPrefix == XML_NAMESPACE_SVG &&
+ if( p_nPrefix == XML_NAMESPACE_SVG &&
(IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
{
pContext = new SdXMLDescriptionContext( GetImport(), p_nPrefix, rLocalName, xAttrList, mxShape );
@@ -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" ) );
@@ -1834,8 +1840,8 @@ void SdXMLConnectorShapeContext::processAttribute( sal_uInt16 nPrefix, const ::r
{
SdXMLImExViewBox aViewBox( 0, 0, 1, 1 );
awt::Point aPoint( 0, 0 );
- awt::Size aSize( 1, 1 );
-
+ awt::Size aSize( 1, 1 );
+
SdXMLImExSvgDElement aPoints( rValue, aViewBox,
aPoint, aSize, GetImport().GetMM100UnitConverter() );
@@ -2184,7 +2190,7 @@ void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAtt
uno::Reference< beans::XPropertySet > xProps( mxShape, uno::UNO_QUERY );
// SJ: If AutoGrowWidthItem is set, SetTransformation will lead to the wrong SnapRect
- // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
+ // because NbcAdjustTextFrameWidthAndHeight() is called (text is set later and center alignment
// is the default setting, so the top left reference point that is used by the caption point is
// no longer correct) There are two ways to solve this problem, temporarily disabling the
// autogrowwith as we are doing here or to apply the CaptionPoint after setting text
@@ -2197,7 +2203,7 @@ void SdXMLCaptionShapeContext::StartElement(const uno::Reference< xml::sax::XAtt
if ( bIsAutoGrowWidth )
xProps->setPropertyValue( OUString(RTL_CONSTASCII_USTRINGPARAM("TextAutoGrowWidth")), uno::makeAny( sal_False ) );
}
-
+
// set pos, size, shear and rotate
SetTransformation();
if( xProps.is() )
@@ -2821,7 +2827,7 @@ void SdXMLAppletShapeContext::EndElement()
aAny <<= aRect;
xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );
}
-
+
if( maParams.getLength() )
{
aAny <<= maParams;
@@ -3059,17 +3065,17 @@ void SdXMLPluginShapeContext::EndElement()
else
{
// in case we have a media object
-
+
OUString sTempRef;
-
+
// check for package URL
if( GetImport().IsPackageURL( maHref ) )
{
- sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
+ sTempRef = OUString( RTL_CONSTASCII_USTRINGPARAM( "vnd.sun.star.Package:" ) );
}
-
+
sTempRef += maHref;
-
+
xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MediaURL" ) ), uno::makeAny( sTempRef ) );
for( sal_Int32 nParam = 0; nParam < maParams.getLength(); ++nParam )
@@ -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 );
@@ -3333,7 +3346,7 @@ SvXMLImportContext *SdXMLFrameShapeContext::CreateChildContext( USHORT nPrefix,
}
}
}
- else if(
+ else if(
( nPrefix == XML_NAMESPACE_SVG && // #i68101#
(IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) ||
(nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) ||
@@ -3669,7 +3682,7 @@ void SdXMLTableShapeContext::StartElement( const ::com::sun::star::uno::Referenc
catch( Exception& )
{
DBG_ERROR("SdXMLTableShapeContext::StartElement(), exception caught!");
- }
+ }
}
}
diff --git a/xmloff/source/forms/elementexport.cxx b/xmloff/source/forms/elementexport.cxx
index d3f39ec996..4cd111e3d5 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 430b2573af..9bdd5b21b8 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 f2e7bb7cc3..a406a6e7c9 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 5fe178f561..bb478f1078 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 83d4262531..8b7b6ef4b2 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 c2d7abc951..ed3c131d10 100644
--- a/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
+++ b/xmlscript/inc/xmlscript/xmldlg_imexp.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -27,6 +27,8 @@
#ifndef _XMLSCRIPT_XMLDLG_IMEXP_HXX_
#define _XMLSCRIPT_XMLDLG_IMEXP_HXX_
+#include <com/sun/star/frame/XModel.hpp>
+
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/io/XInputStreamProvider.hpp>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
@@ -43,7 +45,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) );
//==============================================================================
@@ -52,7 +56,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
@@ -63,7 +69,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) );
//==============================================================================
@@ -73,7 +81,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 9ea565fc54..d06ffee2ab 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 ce9e43fd05..a13a205a7b 100644
--- a/xmlscript/source/xmldlg_imexp/imp_share.hxx
+++ b/xmlscript/source/xmldlg_imexp/imp_share.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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>
@@ -62,7 +63,7 @@ inline sal_Int32 toInt32( ::rtl::OUString const & rStr ) SAL_THROW( () )
}
inline bool getBoolAttr(
- sal_Bool * pRet, ::rtl::OUString const & rAttrName,
+ sal_Bool * pRet, ::rtl::OUString const & rAttrName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
sal_Int32 nUid )
{
@@ -90,7 +91,7 @@ inline bool getBoolAttr(
}
inline bool getStringAttr(
- ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString * pRet, ::rtl::OUString const & rAttrName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
sal_Int32 nUid )
{
@@ -99,7 +100,7 @@ inline bool getStringAttr(
}
inline bool getLongAttr(
- sal_Int32 * pRet, ::rtl::OUString const & rAttrName,
+ sal_Int32 * pRet, ::rtl::OUString const & rAttrName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
sal_Int32 nUid )
{
@@ -119,18 +120,20 @@ struct DialogImport
: public ::cppu::WeakImplHelper1< css::xml::input::XRoot >
{
friend class ImportContext;
-
+
css::uno::Reference< css::uno::XComponentContext > _xContext;
css::uno::Reference< css::util::XNumberFormatsSupplier > _xSupplier;
-
+
::std::vector< ::rtl::OUString > _styleNames;
::std::vector< css::uno::Reference< css::xml::input::XElement > > _styles;
-
+
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;
-
+
public:
inline bool isEventElement(
sal_Int32 nUid, ::rtl::OUString const & rLocalName )
@@ -144,7 +147,7 @@ public:
rLocalName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("event") )));
}
-
+
void addStyle(
::rtl::OUString const & rStyleId,
css::uno::Reference< css::xml::input::XElement > const & xStyle )
@@ -152,25 +155,29 @@ public:
css::uno::Reference< css::xml::input::XElement > getStyle(
::rtl::OUString const & rStyleId ) const
SAL_THROW( () );
-
+
inline css::uno::Reference< css::uno::XComponentContext >
const & getComponentContext() SAL_THROW( () ) { return _xContext; }
css::uno::Reference< css::util::XNumberFormatsSupplier >
const & getNumberFormatsSupplier();
-
+
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 >
@@ -195,14 +202,14 @@ public:
class ElementBase
: public ::cppu::WeakImplHelper1< css::xml::input::XElement >
{
-protected:
+protected:
DialogImport * _pImport;
ElementBase * _pParent;
sal_Int32 _nUid;
::rtl::OUString _aLocalName;
css::uno::Reference< css::xml::input::XAttributes > _xAttributes;
-
+
public:
ElementBase(
sal_Int32 nUid, ::rtl::OUString const & rLocalName,
@@ -211,7 +218,7 @@ public:
SAL_THROW( () );
virtual ~ElementBase()
SAL_THROW( () );
-
+
// XElement
virtual css::uno::Reference<css::xml::input::XElement> SAL_CALL getParent()
throw (css::uno::RuntimeException);
@@ -248,7 +255,7 @@ public:
sal_Int32 nUid, ::rtl::OUString const & rLocalName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline StylesElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -276,10 +283,10 @@ class StyleElement
// current highest mask: 0x40
short _inited, _hasValue;
-
+
void setFontProperties(
css::uno::Reference< css::beans::XPropertySet > const & xProps );
-
+
public:
virtual css::uno::Reference< css::xml::input::XElement >
SAL_CALL startChildElement(
@@ -288,7 +295,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
bool importTextColorStyle(
css::uno::Reference< css::beans::XPropertySet > const & xProps );
bool importTextLineColorStyle(
@@ -303,7 +310,7 @@ public:
css::uno::Reference< css::beans::XPropertySet > const & xProps );
bool importVisualEffectStyle(
css::uno::Reference< css::beans::XPropertySet > const & xProps );
-
+
inline StyleElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -327,13 +334,13 @@ class MenuPopupElement
public:
css::uno::Sequence< ::rtl::OUString > getItemValues();
css::uno::Sequence< sal_Int16 > getSelectedItems();
-
+
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);
-
+
inline MenuPopupElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -349,12 +356,12 @@ class ControlElement
: public ElementBase
{
friend class EventElement;
-
+
protected:
sal_Int32 _nBasePosX, _nBasePosY;
-
+
::std::vector< css::uno::Reference< css::xml::input::XElement > > _events;
-
+
::rtl::OUString getControlId(
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
css::uno::Reference< css::xml::input::XElement > getStyle(
@@ -362,7 +369,7 @@ protected:
public:
::std::vector<css::uno::Reference< css::xml::input::XElement> > *getEvents()
SAL_THROW( () ) { return &_events; }
-
+
ControlElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -377,7 +384,7 @@ protected:
DialogImport * _pImport;
css::uno::Reference< css::beans::XPropertySet > _xControlModel;
::rtl::OUString _aId;
-
+
public:
inline ImportContext(
DialogImport * pImport,
@@ -387,10 +394,10 @@ public:
_xControlModel( xControlModel_ ),
_aId( id )
{ OSL_ASSERT( _xControlModel.is() ); }
-
+
inline css::uno::Reference< css::beans::XPropertySet > getControlModel()
{ return _xControlModel; }
-
+
void importDefaults(
sal_Int32 nBaseX, sal_Int32 nBaseY,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -398,7 +405,7 @@ public:
void importEvents(
::std::vector< css::uno::Reference< css::xml::input::XElement > >
const & rEvents );
-
+
bool importStringProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
@@ -406,44 +413,44 @@ public:
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importBooleanProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importShortProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importLongProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importLongProperty(
sal_Int32 nOffset,
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importHexLongProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importAlignProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importVerticalAlignProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importImageAlignProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importImagePositionProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importDateFormatProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importTimeFormatProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importOrientationProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importButtonTypeProperty(
- ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
+ ::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes );
bool importLineEndFormatProperty(
::rtl::OUString const & rPropName, ::rtl::OUString const & rAttrName,
@@ -487,7 +494,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline WindowElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -504,7 +511,7 @@ class EventElement
public:
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline EventElement(
sal_Int32 nUid, ::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -524,7 +531,7 @@ public:
sal_Int32 nUid, ::rtl::OUString const & rLocalName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
BulletinBoardElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -544,7 +551,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline ButtonElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -566,7 +573,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline CheckBoxElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -589,7 +596,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline ComboBoxElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -612,7 +619,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline MenuListElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -632,7 +639,7 @@ public:
sal_Int32 nUid, ::rtl::OUString const & rLocalName,
css::uno::Reference<css::xml::input::XAttributes> const & xAttributes )
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline RadioElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -655,7 +662,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline RadioGroupElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -679,7 +686,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline TitledBoxElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -701,7 +708,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline TextElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -722,7 +729,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline FixedHyperLinkElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -743,7 +750,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline TextFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -765,7 +772,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline ImageControlElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -787,7 +794,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline FileControlElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -809,7 +816,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline TreeControlElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -831,7 +838,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline CurrencyFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -853,7 +860,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline DateFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -875,7 +882,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline NumericFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -897,7 +904,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline TimeFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -919,7 +926,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline PatternFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -941,7 +948,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline FormattedFieldElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -963,7 +970,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline FixedLineElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -985,7 +992,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline ScrollBarElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
@@ -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
{
@@ -1007,7 +1057,7 @@ public:
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
virtual void SAL_CALL endElement()
throw (css::xml::sax::SAXException, css::uno::RuntimeException);
-
+
inline ProgressBarElement(
::rtl::OUString const & rLocalName,
css::uno::Reference< css::xml::input::XAttributes > const & xAttributes,
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx
index 0a5d74ae9a..c21db9dfc2 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 2449c09377..3cd7ff985e 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_expmodels.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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();
@@ -657,7 +789,7 @@ void ElementDescriptor::readTreeControlModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
readSelectionTypeAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":selectiontype") ) );
-
+
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":rootdisplayed") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
@@ -751,27 +883,27 @@ void ElementDescriptor::readDateFieldModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
readBoolAttr( OUSTR("HideInactiveSelection"),
OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
readDateFormatAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateFormat") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":date-format") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateShowCentury") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":show-century") ) );
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Date") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMin") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DateMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
@@ -806,31 +938,31 @@ void ElementDescriptor::readNumericFieldModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
readBoolAttr( OUSTR("HideInactiveSelection"),
OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":decimal-accuracy") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowThousandsSeparator") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":thousands-separator") ) );
readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Value") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMin") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-min") ) );
readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueMax") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ValueStep") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-step") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Spin") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":spin") ) );
if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
readLongAttr( OUSTR("RepeatDelay"),
OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
@@ -859,7 +991,7 @@ void ElementDescriptor::readTimeFieldModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
@@ -910,25 +1042,25 @@ void ElementDescriptor::readPatternFieldModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":tabstop") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":readonly") ) );
readBoolAttr( OUSTR("HideInactiveSelection"),
OUSTR(XMLNS_DIALOGS_PREFIX ":hide-inactive-selection") );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("StrictFormat") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":strict-format") ) );
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
readShortAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("MaxTextLen") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":maxlength") ) );
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EditMask") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":edit-mask") ) );
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LiteralMask") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":literal-mask") ) );
readEvents();
}
//__________________________________________________________________________________________________
@@ -952,7 +1084,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
@@ -974,7 +1106,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
if (extract_throw<bool>( _xProps->getPropertyValue( OUSTR("Repeat") ) ))
readLongAttr( OUSTR("RepeatDelay"),
OUSTR(XMLNS_DIALOGS_PREFIX ":repeat"), true /* force */ );
-
+
Any a( readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveDefault") ) ) );
switch (a.getValueTypeClass())
{
@@ -997,7 +1129,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value-max") ) );
readDoubleAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
-
+
// format spec
sal_Int32 nKey = 0;
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("FormatKey") ) ) >>= nKey)
@@ -1015,7 +1147,7 @@ void ElementDescriptor::readFormattedFieldModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":treat-as-number") ) );
readBoolAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":enforce-format") ) );
-
+
readEvents();
}
//__________________________________________________________________________________________________
@@ -1035,11 +1167,11 @@ void ElementDescriptor::readFixedLineModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":value") ) );
readOrientationAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readEvents();
@@ -1061,7 +1193,7 @@ void ElementDescriptor::readProgressBarModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults();
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
@@ -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
@@ -1087,11 +1219,11 @@ void ElementDescriptor::readScrollBarModel( StyleBag * all_styles )
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") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":align") ) );
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("BlockIncrement") ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":pageincrement") ) );
readLongAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("LineIncrement") ),
@@ -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();
}
//__________________________________________________________________________________________________
@@ -1122,7 +1295,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_URI) ) );
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM("xmlns:" XMLNS_SCRIPT_PREFIX) ),
OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_SCRIPT_URI) ) );
-
+
// collect styles
Style aStyle( 0x1 | 0x2 | 0x8 | 0x20 );
if (readProp( OUString( RTL_CONSTASCII_USTRINGPARAM("BackgroundColor") ) ) >>= aStyle._backgroundColor)
@@ -1138,7 +1311,7 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":style-id") ),
all_styles->getStyleId( aStyle ) );
}
-
+
// collect elements
readDefaults( false, false );
readBoolAttr(
@@ -1158,10 +1331,10 @@ void ElementDescriptor::readDialogModel( StyleBag * all_styles )
bool bDecoration = sal_False;
if ( (aDecorationAny >>= bDecoration) && !bDecoration )
addAttribute( OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":withtitlebar") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM("false") ) );
readStringAttr( OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
- OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
+ OUString( RTL_CONSTASCII_USTRINGPARAM(XMLNS_DIALOGS_PREFIX ":image-src") ) );
readEvents();
}
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_export.cxx
index 2898ac1386..47b1d2f4e9 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 1c43cc83d9..481e8a3a1f 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_impmodels.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
//__________________________________________________________________________________________________
@@ -67,7 +245,7 @@ void ProgressBarElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlProgressBarModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -77,7 +255,7 @@ void ProgressBarElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFillColorStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importLongProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ProgressValue") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
@@ -119,10 +297,24 @@ 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())
{
@@ -131,7 +323,7 @@ void ScrollBarElement::endElement()
pStyle->importBackgroundColorStyle( xControlModel );
pStyle->importBorderStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importOrientationProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Orientation") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
@@ -164,7 +356,93 @@ void ScrollBarElement::endElement()
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)
+ _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)
@@ -199,7 +477,7 @@ void FixedLineElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedLineModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -209,7 +487,7 @@ void FixedLineElement::endElement()
pStyle->importTextLineColorStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
@@ -251,7 +529,7 @@ void PatternFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlPatternFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -263,7 +541,7 @@ void PatternFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -323,7 +601,7 @@ void FormattedFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFormattedFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -335,7 +613,7 @@ void FormattedFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -360,7 +638,7 @@ void FormattedFieldElement::endElement()
_xAttributes );
ctx.importDoubleProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EffectiveValue") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
- _xAttributes );
+ _xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("text") ),
_xAttributes );
@@ -374,7 +652,7 @@ void FormattedFieldElement::endElement()
_xAttributes ))
ctx.getControlModel()->setPropertyValue(
OUSTR("Repeat"), makeAny(true) );
-
+
OUString sDefault(
_xAttributes->getValueByUidName(
_pImport->XMLNS_DIALOGS_UID,
@@ -397,12 +675,12 @@ void FormattedFieldElement::endElement()
makeAny( sDefault ) );
}
}
-
+
// format spec
ctx.getControlModel()->setPropertyValue(
OUString( RTL_CONSTASCII_USTRINGPARAM("FormatsSupplier") ),
makeAny( _pImport->getNumberFormatsSupplier() ) );
-
+
OUString sFormat(
_xAttributes->getValueByUidName(
_pImport->XMLNS_DIALOGS_UID,
@@ -410,7 +688,7 @@ void FormattedFieldElement::endElement()
if (sFormat.getLength())
{
lang::Locale locale;
-
+
OUString sLocale(
_xAttributes->getValueByUidName(
_pImport->XMLNS_DIALOGS_UID,
@@ -439,7 +717,7 @@ void FormattedFieldElement::endElement()
}
}
}
-
+
try
{
Reference< util::XNumberFormats > xFormats(
@@ -466,7 +744,7 @@ void FormattedFieldElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
_xAttributes );
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -501,7 +779,7 @@ void TimeFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlTimeFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -513,7 +791,7 @@ void TimeFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -552,7 +830,7 @@ void TimeFieldElement::endElement()
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
_xAttributes );
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -587,7 +865,7 @@ void NumericFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlNumericFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -599,7 +877,7 @@ void NumericFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -640,7 +918,7 @@ void NumericFieldElement::endElement()
OUSTR("Repeat"), makeAny(true) );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("EnforceFormat") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("enforce-format") ),
- _xAttributes );
+ _xAttributes );
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -675,7 +953,7 @@ void DateFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlDateFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -687,7 +965,7 @@ void DateFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -766,7 +1044,7 @@ void CurrencyFieldElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCurrencyFieldModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -778,7 +1056,7 @@ void CurrencyFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -794,7 +1072,7 @@ void CurrencyFieldElement::endElement()
_xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("CurrencySymbol") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("currency-symbol") ),
- _xAttributes );
+ _xAttributes );
ctx.importShortProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("DecimalAccuracy") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("decimal-accuracy") ),
_xAttributes );
@@ -860,7 +1138,7 @@ void FileControlElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFileControlModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -872,7 +1150,7 @@ void FileControlElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -882,7 +1160,7 @@ void FileControlElement::endElement()
_xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Text") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
- _xAttributes );
+ _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ReadOnly") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("readonly") ),
_xAttributes );
@@ -919,7 +1197,7 @@ void TreeControlElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.tree.TreeControlModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -928,18 +1206,18 @@ void TreeControlElement::endElement()
pStyle->importBackgroundColorStyle( xControlModel );
pStyle->importBorderStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
_xAttributes );
ctx.importSelectionTypeProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("SelectionType") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("selectiontype") ),
- _xAttributes );
+ _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("RootDisplayed") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("rootdisplayed") ),
_xAttributes );
- ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
+ ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsHandles") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("showshandles") ),
_xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("ShowsRootHandles") ),
@@ -989,7 +1267,7 @@ void ImageControlElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlImageControlModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -998,14 +1276,42 @@ void ImageControlElement::endElement()
pStyle->importBackgroundColorStyle( xControlModel );
pStyle->importBorderStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
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 );
@@ -1043,7 +1349,7 @@ void TextElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedTextModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -1055,7 +1361,7 @@ void TextElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
@@ -1108,7 +1414,7 @@ void FixedHyperLinkElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlFixedHyperlinkModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -1120,7 +1426,7 @@ void FixedHyperLinkElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importStringProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
@@ -1182,7 +1488,7 @@ void TextFieldElement::endElement()
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlEditModel") ) );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -1193,7 +1499,7 @@ void TextFieldElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -1240,7 +1546,7 @@ void TextFieldElement::endElement()
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("EchoChar") ),
makeAny( nChar ) );
}
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -1274,7 +1580,7 @@ Reference< xml::input::XElement > TitledBoxElement::startChildElement(
OUString( RTL_CONSTASCII_USTRINGPARAM("value") ),
xAttributes,
_pImport->XMLNS_DIALOGS_UID );
-
+
return new ElementBase(
_pImport->XMLNS_DIALOGS_UID,
rLocalName, xAttributes, this, _pImport );
@@ -1308,7 +1614,7 @@ void TitledBoxElement::endElement()
_pImport, getControlId( _xAttributes ),
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())
{
@@ -1317,9 +1623,9 @@ void TitledBoxElement::endElement()
pStyle->importTextLineColorStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( 0, 0, _xAttributes ); // inherited from BulletinBoardElement
-
+
if (_label.getLength())
{
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("Label") ),
@@ -1331,19 +1637,33 @@ void TitledBoxElement::endElement()
// vector< event elements > holding event elements holding this (via _pParent)
_events.clear();
}
-
+
// create radios AFTER group box!
for ( size_t nPos = 0; nPos < _radios.size(); ++nPos )
{
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 ) );
if (xStyle.is())
{
@@ -1354,7 +1674,7 @@ void TitledBoxElement::endElement()
pStyle->importFontStyle( xControlModel );
pStyle->importVisualEffectStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -1377,7 +1697,10 @@ 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;
if (getBoolAttr( &bChecked,
@@ -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,12 +1789,25 @@ 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 ) );
if (xStyle.is())
{
@@ -1482,7 +1818,7 @@ void RadioGroupElement::endElement()
pStyle->importFontStyle( xControlModel );
pStyle->importVisualEffectStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -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,
@@ -1517,7 +1856,8 @@ 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 );
@@ -1556,7 +1896,7 @@ Reference< xml::input::XElement > MenuPopupElement::startChildElement(
if (aValue.getLength())
{
_itemValues.push_back( aValue );
-
+
OUString aSel(
xAttributes->getValueByUidName(
_pImport->XMLNS_DIALOGS_UID,
@@ -1638,11 +1978,28 @@ 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 ) );
if (xStyle.is())
{
@@ -1653,7 +2010,7 @@ void MenuListElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -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,11 +2085,28 @@ 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 ) );
if (xStyle.is())
{
@@ -1740,7 +2117,7 @@ void ComboBoxElement::endElement()
pStyle->importBorderStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -1769,14 +2146,16 @@ void ComboBoxElement::endElement()
ctx.importAlignProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Align") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("align") ),
_xAttributes );
-
- if (_popup.is())
+ // import cell-link and cell source range
+ importBindableAndListRangeBits( _pImport, sLinkedCell, sCellRange, ctx );
+
+ if (_popup.is() && !sCellRange.getLength() )
{
MenuPopupElement * p = static_cast< MenuPopupElement * >( _popup.get() );
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("StringItemList") ),
makeAny( p->getItemValues() ) );
}
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -1812,7 +2191,7 @@ void CheckBoxElement::endElement()
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlCheckBoxModel") ) );
Reference< beans::XPropertySet > xControlModel( ctx.getControlModel() );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -1823,7 +2202,7 @@ void CheckBoxElement::endElement()
pStyle->importFontStyle( xControlModel );
pStyle->importVisualEffectStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -1847,7 +2226,7 @@ void CheckBoxElement::endElement()
OUString( RTL_CONSTASCII_USTRINGPARAM("multiline") ),
_xAttributes );
-
+
sal_Bool bTriState = sal_False;
if (getBoolAttr( &bTriState,
OUString( RTL_CONSTASCII_USTRINGPARAM("tristate") ),
@@ -1874,7 +2253,7 @@ void CheckBoxElement::endElement()
xControlModel->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM("State") ),
makeAny( nVal ) );
}
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -1909,7 +2288,7 @@ void ButtonElement::endElement()
ControlImportContext ctx(
_pImport, getControlId( _xAttributes ),
OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.UnoControlButtonModel") ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -1920,7 +2299,7 @@ void ButtonElement::endElement()
pStyle->importTextLineColorStyle( xControlModel );
pStyle->importFontStyle( xControlModel );
}
-
+
ctx.importDefaults( _nBasePosX, _nBasePosY, _xAttributes );
ctx.importBooleanProperty( OUString( RTL_CONSTASCII_USTRINGPARAM("Tabstop") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("tabstop") ),
@@ -1975,7 +2354,7 @@ void ButtonElement::endElement()
ctx.getControlModel()->setPropertyValue(
OUString( RTL_CONSTASCII_USTRINGPARAM("State") ), makeAny( nVal ) );
}
-
+
ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
@@ -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") ))
{
@@ -2244,7 +2632,7 @@ void WindowElement::endElement()
Reference< beans::XPropertySet > xProps(
_pImport->_xDialogModel, UNO_QUERY_THROW );
ImportContext ctx( _pImport, xProps, getControlId( _xAttributes ) );
-
+
Reference< xml::input::XElement > xStyle( getStyle( _xAttributes ) );
if (xStyle.is())
{
@@ -2254,7 +2642,7 @@ void WindowElement::endElement()
pStyle->importTextLineColorStyle( xProps );
pStyle->importFontStyle( xProps );
}
-
+
ctx.importDefaults( 0, 0, _xAttributes, false );
ctx.importBooleanProperty(
OUString( RTL_CONSTASCII_USTRINGPARAM("Closeable") ),
@@ -2276,11 +2664,11 @@ void WindowElement::endElement()
OUString( RTL_CONSTASCII_USTRINGPARAM("Decoration") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("withtitlebar") ),
_xAttributes );
- ctx.importStringProperty(
+ ctx.importStringProperty(
OUString( RTL_CONSTASCII_USTRINGPARAM("ImageURL") ),
OUString( RTL_CONSTASCII_USTRINGPARAM("image-src") ),
_xAttributes );
- ctx.importEvents( _events );
+ ctx.importEvents( _events );
// avoid ring-reference:
// vector< event elements > holding event elements holding this (via _pParent)
_events.clear();
diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
index f3c0e551f1..fb57c5acb7 100644
--- a/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
+++ b/xmlscript/source/xmldlg_imexp/xmldlg_import.cxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -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
@@ -276,7 +280,7 @@ bool StyleElement::importBorderStyle(
_border = BORDER_SIMPLE_COLOR;
_borderColor = toInt32(aValue);
}
-
+
_hasValue |= 0x4;
importBorderStyle(xProps); // write values
}
@@ -298,7 +302,7 @@ bool StyleElement::importVisualEffectStyle(
return false;
}
_inited |= 0x40;
-
+
OUString aValue;
if (getStringAttr( &aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("look") ),
_xAttributes, _pImport->XMLNS_DIALOGS_UID ))
@@ -317,7 +321,7 @@ bool StyleElement::importVisualEffectStyle(
}
else
OSL_ASSERT( 0 );
-
+
_hasValue |= 0x40;
xProps->setPropertyValue( OUSTR("VisualEffect"),
makeAny(_visualEffect) );
@@ -677,7 +681,7 @@ bool StyleElement::importFontStyle(
&_descr.WordLineMode,
OUString( RTL_CONSTASCII_USTRINGPARAM("font-wordlinemode") ),
_xAttributes, _pImport->XMLNS_DIALOGS_UID );
-
+
// dialog:font-type "(raster|device|scalable)" #IMPLIED
if (getStringAttr(
&aValue, OUString( RTL_CONSTASCII_USTRINGPARAM("font-type") ),
@@ -1451,10 +1455,10 @@ void ImportContext::importEvents(
}
}
else if ( descr.ScriptType.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "Script" ) ) ) )
- {
+ {
// Check if there is a protocol, if not assume
// this is an early scripting framework url ( without
- // the protocol ) and fix it up!!
+ // the protocol ) and fix it up!!
if ( descr.ScriptCode.indexOf( ':' ) == -1 )
{
::rtl::OUStringBuffer buf;
@@ -1546,7 +1550,7 @@ void ImportContext::importEvents(
_pImport->XMLNS_DIALOGS_UID == nUid &&
aLocalName.equalsAsciiL(
RTL_CONSTASCII_STRINGPARAM("event") ) );
-
+
if (!getStringAttr( &descr.ListenerType,
OUString( RTL_CONSTASCII_USTRINGPARAM(
"listener-type") ),
@@ -1617,7 +1621,7 @@ void ImportContext::importDefaults(
{
try
{
-
+
_xControlModel->setPropertyValue(
OUString( RTL_CONSTASCII_USTRINGPARAM("EnableVisible") ), makeAny( sal_False ) );
}
@@ -1855,7 +1859,7 @@ Reference< util::XNumberFormatsSupplier > const & DialogImport::getNumberFormats
OUString( RTL_CONSTASCII_USTRINGPARAM(
"com.sun.star.util.NumberFormatsSupplier") ),
xContext ), UNO_QUERY );
-
+
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
if (! _xSupplier.is())
{
@@ -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 3ccf63dc3b..bc259db754 100644
--- a/xmlscript/util/makefile.mk
+++ b/xmlscript/util/makefile.mk
@@ -54,6 +54,7 @@ SHL1LIBS= \
$(LIB1TARGET)
SHL1STDLIBS= \
+ $(COMPHELPERLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
$(SALLIB)