summaryrefslogtreecommitdiff
path: root/sc/source/ui/unoobj/servuno.cxx
diff options
context:
space:
mode:
authorNoel Power <noel.power@novell.com>2010-10-13 09:48:44 +0100
committerNoel Power <noel.power@novell.com>2010-10-13 10:01:42 +0100
commitbef01b6751dc826beff29426ad6ac3c3a5f9dbcc (patch)
treeee8414c8bf833f7b98da20fb0c177d389e080781 /sc/source/ui/unoobj/servuno.cxx
parentc4712cc4f3f8cf5e68d8d6b717e6f1f4a9b445f0 (diff)
parentc76ef5619cebf8ebd31db94d15a0861905783a4e (diff)
Merge branch 'vba' fix conflics, trailing ws & tab issues
additionally the following iz patches are rolled up with this commit i#113356, i#112998 i#113955 i#113358 i#113515 i#112531 i#112596 i#112530
Diffstat (limited to 'sc/source/ui/unoobj/servuno.cxx')
-rw-r--r--sc/source/ui/unoobj/servuno.cxx25
1 files changed, 23 insertions, 2 deletions
diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx
index d4eef0c77..70fb76c37 100644
--- a/sc/source/ui/unoobj/servuno.cxx
+++ b/sc/source/ui/unoobj/servuno.cxx
@@ -36,6 +36,7 @@
#include <svx/unofill.hxx>
#include <editeng/unonrule.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
#include "servuno.hxx"
#include "unoguard.hxx"
@@ -72,8 +73,27 @@
#include <basic/basmgr.hxx>
#include <sfx2/app.hxx>
+#include <comphelper/processfactory.hxx>
+#include <com/sun/star/document/XCodeNameQuery.hpp>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/form/XFormsSupplier.hpp>
+#include <com/sun/star/script/ScriptEventDescriptor.hpp>
+#include <comphelper/componentcontext.hxx>
+#include <cppuhelper/component_context.hxx>
+#include <vbahelper/vbaaccesshelper.hxx>
+#include <com/sun/star/script/vba/XVBACompatibility.hpp>
+
using namespace ::com::sun::star;
+bool isInVBAMode( ScDocShell& rDocSh )
+{
+ uno::Reference<script::XLibraryContainer> xLibContainer = rDocSh.GetBasicContainer();
+ uno::Reference<script::vba::XVBACompatibility> xVBACompat( xLibContainer, uno::UNO_QUERY );
+ if ( xVBACompat.is() )
+ return xVBACompat->getVBACompatibilityMode();
+ return false;
+}
+
class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper1< container::XNameAccess >
{
uno::Any maWorkbook;
@@ -286,7 +306,8 @@ static const ProvNamesId_Type __FAR_DATA aProvNamesId[] =
{ "com.sun.star.text.textfield.Time", SC_SERVICE_TIMEFIELD },
{ "com.sun.star.text.textfield.DocumentTitle", SC_SERVICE_TITLEFIELD },
{ "com.sun.star.text.textfield.FileName", SC_SERVICE_FILEFIELD },
- { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD }
+ { "com.sun.star.text.textfield.SheetName", SC_SERVICE_SHEETFIELD },
+ { "ooo.vba.VBAGlobals", SC_SERVICE_VBAGLOBALS },
};
//
@@ -548,7 +569,7 @@ uno::Reference<uno::XInterface> ScServiceProvider::MakeInstance(
}
break;
case SC_SERVICE_VBACODENAMEPROVIDER:
- if (pDocShell && pDocShell->GetDocument()->IsInVBAMode())
+ if ( pDocShell && ooo::vba::isAlienExcelDoc( *pDocShell ) && isInVBAMode( *pDocShell ) )
{
OSL_TRACE("**** creating VBA Object provider");
xRet.set(static_cast<document::XCodeNameQuery*>(new ScVbaCodeNameProvider( pDocShell )));