summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornpower Developer <npower@openoffice.org>2010-04-07 17:02:52 +0100
committernpower Developer <npower@openoffice.org>2010-04-07 17:02:52 +0100
commit708b462a826eef5634275fa0400ec003c310619f (patch)
treeb8a98a07fe9c323e177f4f0cd902852b8a2fce8b
parent6302434c682f559337bb3b4efc8e2d6ceadd9341 (diff)
npower13_objectmodule: #i110672# fix Application.ThisWorkbook ( from dr )
-rw-r--r--oovbaapi/ooo/vba/excel/XApplication.idl4
-rw-r--r--vbahelper/inc/vbahelper/vbahelper.hxx2
-rw-r--r--vbahelper/source/vbahelper/vbahelper.cxx16
3 files changed, 16 insertions, 6 deletions
diff --git a/oovbaapi/ooo/vba/excel/XApplication.idl b/oovbaapi/ooo/vba/excel/XApplication.idl
index 1a29a0d0c459..e4c063d161cf 100644
--- a/oovbaapi/ooo/vba/excel/XApplication.idl
+++ b/oovbaapi/ooo/vba/excel/XApplication.idl
@@ -61,10 +61,6 @@ interface XApplication : com::sun::star::uno::XInterface
[attribute, readonly] XWorksheet ActiveSheet;
[attribute, readonly] ooo::vba::XAssistant Assistant;
[attribute] long Calculation;
- //#TODO #FIXME this is more of a placeholder, will return
- // the value of activeworkbook, in xl 'ThisWorkbook' should return the
- // workbook in which the 'calling' macro is running. Should be possible
- // to determine this
[attribute, readonly] XWorkbook ThisWorkbook;
[attribute, readonly] string Name;
[attribute] boolean DisplayAlerts;
diff --git a/vbahelper/inc/vbahelper/vbahelper.hxx b/vbahelper/inc/vbahelper/vbahelper.hxx
index 315ddb19b7ca..83b9737315ea 100644
--- a/vbahelper/inc/vbahelper/vbahelper.hxx
+++ b/vbahelper/inc/vbahelper/vbahelper.hxx
@@ -64,6 +64,8 @@ namespace ooo
VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIService( SfxObjectShell* pShell, const sal_Char* _pAsciiName ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::uno::XInterface > createVBAUnoAPIServiceWithArgs( SfxObjectShell* pShell, const sal_Char* _pAsciiName, const css::uno::Sequence< css::uno::Any >& aArgs ) throw (css::uno::RuntimeException);
css::uno::Reference< css::frame::XModel > getCurrentDoc( const rtl::OUString& sKey ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
+ VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getThisWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentExcelDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
VBAHELPER_DLLPUBLIC css::uno::Reference< css::frame::XModel > getCurrentWordDoc( const css::uno::Reference< css::uno::XComponentContext >& xContext ) throw (css::uno::RuntimeException);
diff --git a/vbahelper/source/vbahelper/vbahelper.cxx b/vbahelper/source/vbahelper/vbahelper.cxx
index 83bd677dd7de..ac8423d2ce3a 100644
--- a/vbahelper/source/vbahelper/vbahelper.cxx
+++ b/vbahelper/source/vbahelper/vbahelper.cxx
@@ -464,6 +464,18 @@ getCurrentDocCtx( const rtl::OUString& ctxName, const uno::Reference< uno::XComp
return xModel;
}
+uno::Reference< frame::XModel >
+getThisExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
+{
+ return getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext );
+}
+
+uno::Reference< frame::XModel >
+getThisWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
+{
+ return getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext );
+}
+
uno::Reference< frame::XModel >
getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) throw (uno::RuntimeException)
{
@@ -475,7 +487,7 @@ getCurrentExcelDoc( const uno::Reference< uno::XComponentContext >& xContext ) t
}
catch( uno::Exception& e )
{
- xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ExcelDocumentContext" ) ), xContext );
+ xModel = getThisExcelDoc( xContext );
}
return xModel;
}
@@ -491,7 +503,7 @@ getCurrentWordDoc( const uno::Reference< uno::XComponentContext >& xContext ) th
}
catch( uno::Exception& e )
{
- xModel = getCurrentDocCtx( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WordDocumentContext" ) ), xContext );
+ xModel = getThisWordDoc( xContext );
}
return xModel;
}