summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2011-03-23 16:59:26 +0100
committerJan Holesovsky <kendy@suse.cz>2011-03-23 16:59:26 +0100
commit3b7ab82aee60aec1e47c1e253d3977a3fc011f5b (patch)
tree1ebee7adb28ba3175deee3948aee8f5489d9b509 /basic
parent486dd9082e177aa63294f76d6a75b08dde5957e5 (diff)
parent61879c218dd0e6e94884e7c6e06e3c5c18540b4a (diff)
Merge commit 'ooo/DEV300_m103'
Conflicts: basic/source/runtime/makefile.mk basic/source/runtime/step2.cxx desktop/prj/build.lst desktop/source/app/app.cxx desktop/source/deployment/registry/dp_backend.cxx drawinglayer/source/attribute/fontattribute.cxx editeng/inc/editeng/fontitem.hxx editeng/source/editeng/edtspell.cxx editeng/source/misc/svxacorr.cxx framework/inc/services/substitutepathvars.hxx framework/source/services/substitutepathvars.cxx sfx2/qa/cppunit/makefile.mk sfx2/source/doc/SfxDocumentMetaData.cxx sfx2/source/doc/objxtor.cxx svx/source/dialog/svxruler.cxx sysui/desktop/icons/so9_base_app.ico sysui/desktop/icons/so9_calc_app.ico sysui/desktop/icons/so9_draw_app.ico sysui/desktop/icons/so9_impress_app.ico sysui/desktop/icons/so9_main_app.ico sysui/desktop/icons/so9_math_app.ico sysui/desktop/icons/so9_writer_app.ico xmlhelp/source/cxxhelp/provider/databases.cxx xmlhelp/source/cxxhelp/provider/db.cxx xmlhelp/source/cxxhelp/provider/db.hxx
Diffstat (limited to 'basic')
-rwxr-xr-xbasic/source/app/app.cxx9
-rwxr-xr-xbasic/source/app/app.hxx1
-rwxr-xr-xbasic/source/app/appwin.cxx8
-rwxr-xr-xbasic/source/basmgr/basmgr.cxx2
-rw-r--r--[-rwxr-xr-x]basic/source/classes/sbxmod.cxx5
-rw-r--r--basic/source/inc/sbdiagnose.hxx34
-rwxr-xr-xbasic/source/runtime/dllmgr-x86.cxx17
-rwxr-xr-xbasic/source/runtime/makefile.mk3
-rwxr-xr-xbasic/source/runtime/rtlproto.hxx1
-rw-r--r--basic/source/runtime/sbdiagnose.cxx134
-rwxr-xr-xbasic/source/runtime/stdobj.cxx2
11 files changed, 202 insertions, 14 deletions
diff --git a/basic/source/app/app.cxx b/basic/source/app/app.cxx
index 544b0f177eaa..6b844a772e03 100755
--- a/basic/source/app/app.cxx
+++ b/basic/source/app/app.cxx
@@ -781,6 +781,15 @@ void BasicFrame::Resize()
}
}
+Rectangle BasicFrame::GetInnerRect() const
+{
+ Rectangle aRect( Point(0,0), GetOutputSizePixel() );
+ aRect.Bottom() = pStatus->GetPosPixel().Y()-1;
+ if( aRect.Bottom() < 0 ) // sanity check
+ aRect.Bottom() = 0;
+ return aRect;
+}
+
void BasicFrame::Move()
{
Config aConf(Config::GetConfigName( Config::GetDefDirectory(), CUniString("testtool") ));
diff --git a/basic/source/app/app.hxx b/basic/source/app/app.hxx
index af1b95714683..3ef46edc2cb1 100755
--- a/basic/source/app/app.hxx
+++ b/basic/source/app/app.hxx
@@ -182,6 +182,7 @@ public:
void SetAppMode( const String &aNewMode ){ aAppMode = aNewMode; UpdateTitle(); }
String GenRealString( const String &aResString );
+ Rectangle GetInnerRect() const;
};
diff --git a/basic/source/app/appwin.cxx b/basic/source/app/appwin.cxx
index d2f8869fd7d8..fc6d5ecfa548 100755
--- a/basic/source/app/appwin.cxx
+++ b/basic/source/app/appwin.cxx
@@ -120,14 +120,8 @@ void AppWin::Maximize()
pFrame->nMaximizedWindows++;
nWinState = TT_WIN_STATE_MAX;
}
- sal_Int32 nTitleHeight;
- {
- sal_Int32 nDummy1, nDummy2, nDummy3;
- pFrame->GetBorder( nDummy1, nTitleHeight, nDummy2, nDummy3 );
- }
- Size aSize = pFrame->GetOutputSizePixel();
- aSize.Height() -= nTitleHeight;
+ Size aSize = pFrame->GetInnerRect().GetSize();
aSize.Height() -= 2;
aSize.Width() -= 2;
SetSizePixel( aSize );
diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index bd73970b118e..2ac89b548598 100755
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -2070,7 +2070,7 @@ ErrCode BasicManager::ExecuteMacro( String const& i_fullyQualifiedName, String c
sCall += ']';
SbxVariable* pRet = pMethod->GetParent()->Execute( sCall );
- if ( pRet )
+ if ( pRet && ( pRet != pMethod ) )
*i_retValue = *pRet;
return SbxBase::GetError();
}
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx
index 4ee2cbf5b9af..7e7304b6ce76 100755..100644
--- a/basic/source/classes/sbxmod.cxx
+++ b/basic/source/classes/sbxmod.cxx
@@ -36,6 +36,7 @@
#include <svl/brdcst.hxx>
#include <tools/shl.hxx>
#include <basic/sbx.hxx>
+#include "sbdiagnose.hxx"
#include "sb.hxx"
#include <sbjsmeth.hxx>
#include "sbjsmod.hxx"
@@ -1215,6 +1216,10 @@ sal_uInt16 SbModule::Run( SbMethod* pMeth )
GlobalRunDeInit();
+#ifdef DBG_UTIL
+ ResetCapturedAssertions();
+#endif
+
// VBA always ensures screenupdating is enabled after completing
if ( mbVBACompat )
VBAUnlockDocuments( PTR_CAST( StarBASIC, GetParent() ) );
diff --git a/basic/source/inc/sbdiagnose.hxx b/basic/source/inc/sbdiagnose.hxx
new file mode 100644
index 000000000000..065efdb183e1
--- /dev/null
+++ b/basic/source/inc/sbdiagnose.hxx
@@ -0,0 +1,34 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 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 BASIC_SBDIAGNOSE_HXX
+#define BASIC_SBDIAGNOSE_HXX
+
+#ifdef DBG_UTIL
+void ResetCapturedAssertions();
+#endif
+
+#endif // BASIC_SBDIAGNOSE_HXX
diff --git a/basic/source/runtime/dllmgr-x86.cxx b/basic/source/runtime/dllmgr-x86.cxx
index b2f48bd0ab1a..1a417e99c284 100755
--- a/basic/source/runtime/dllmgr-x86.cxx
+++ b/basic/source/runtime/dllmgr-x86.cxx
@@ -37,6 +37,7 @@
#include "basic/sbx.hxx"
#include "basic/sbxvar.hxx"
+#include "runtime.hxx"
#include "osl/thread.h"
#include "rtl/ref.hxx"
#include "rtl/string.hxx"
@@ -263,9 +264,15 @@ SbError marshal(
std::vector< char > & blob, std::size_t offset, MarshalData & data)
{
OSL_ASSERT(variable != 0);
- if ((variable->GetFlags() & SBX_REFERENCE) == 0) {
- if ((variable->GetType() & SbxARRAY) == 0) {
- switch (variable->GetType()) {
+
+ SbxDataType eVarType = variable->GetType();
+ bool bByVal = (variable->GetFlags() & SBX_REFERENCE) == 0;
+ if( !bByVal && !SbiRuntime::isVBAEnabled() && eVarType == SbxSTRING )
+ bByVal = true;
+
+ if (bByVal) {
+ if ((eVarType & SbxARRAY) == 0) {
+ switch (eVarType) {
case SbxINTEGER:
add(blob, variable->GetInteger(), outer ? 4 : 2, offset);
break;
@@ -314,8 +321,8 @@ SbError marshal(
}
}
} else {
- if ((variable->GetType() & SbxARRAY) == 0) {
- switch (variable->GetType()) {
+ if ((eVarType & SbxARRAY) == 0) {
+ switch (eVarType) {
case SbxINTEGER:
case SbxLONG:
case SbxSINGLE:
diff --git a/basic/source/runtime/makefile.mk b/basic/source/runtime/makefile.mk
index 29969416caab..80066425e3c1 100755
--- a/basic/source/runtime/makefile.mk
+++ b/basic/source/runtime/makefile.mk
@@ -53,7 +53,8 @@ SLOFILES= \
$(SLO)$/methods.obj \
$(SLO)$/methods1.obj\
$(SLO)$/props.obj \
- $(SLO)$/ddectrl.obj
+ $(SLO)$/ddectrl.obj \
+ $(SLO)$/sbdiagnose.obj
.IF "$(GUI)$(CPU)" == "WNTI"
SLOFILES+= \
diff --git a/basic/source/runtime/rtlproto.hxx b/basic/source/runtime/rtlproto.hxx
index c129d997ca9d..ea83f89fdd36 100755
--- a/basic/source/runtime/rtlproto.hxx
+++ b/basic/source/runtime/rtlproto.hxx
@@ -359,6 +359,7 @@ extern RTLFUNC(CDateToIso);
extern RTLFUNC(CDateFromIso);
extern RTLFUNC(CompatibilityMode);
extern RTLFUNC(CDec);
+extern RTLFUNC(CaptureAssertions);
extern RTLFUNC(Partition); // Fong
diff --git a/basic/source/runtime/sbdiagnose.cxx b/basic/source/runtime/sbdiagnose.cxx
new file mode 100644
index 000000000000..97bfb0a00814
--- /dev/null
+++ b/basic/source/runtime/sbdiagnose.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2011 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_basic.hxx"
+
+#include "rtlproto.hxx"
+#include "sbdiagnose.hxx"
+
+#include "basic/sbstar.hxx"
+
+#include <tools/debug.hxx>
+#include <comphelper/flagguard.hxx>
+
+#ifdef DBG_UTIL
+
+static DbgChannelId nRestoreChannelId = 0;
+static DbgChannelId nAssertionChannelId = 0;
+static StarBASICRef xAssertionChannelBasic;
+static String sCaptureFunctionName;
+static bool bReportingAssertion = false;
+
+void ResetCapturedAssertions()
+{
+ if ( nRestoreChannelId != 0 )
+ {
+ DBG_INSTOUTERROR( nRestoreChannelId );
+ }
+ nRestoreChannelId = 0;
+ xAssertionChannelBasic = NULL;
+ sCaptureFunctionName = String();
+ bReportingAssertion = false;
+}
+
+void DbgReportAssertion( const sal_Char* i_assertionMessage )
+{
+ if ( !xAssertionChannelBasic )
+ {
+ ResetCapturedAssertions();
+ return;
+ }
+
+ // prevent infinite recursion
+ if ( bReportingAssertion )
+ return;
+ ::comphelper::FlagRestorationGuard aGuard( bReportingAssertion, true );
+
+ SbxArrayRef const xArguments( new SbxArray( SbxVARIANT ) );
+ SbxVariableRef const xMessageText = new SbxVariable( SbxSTRING );
+ xMessageText->PutString( String::CreateFromAscii( i_assertionMessage ) );
+ xArguments->Put( xMessageText, 1 );
+
+ ErrCode const nError = xAssertionChannelBasic->Call( sCaptureFunctionName, xArguments );
+ if ( ( nError & SbERR_METHOD_NOT_FOUND ) != 0 )
+ ResetCapturedAssertions();
+}
+
+#endif
+
+/// capture assertions, route them to the given given Basic function
+RTLFUNC(CaptureAssertions)
+{
+ (void)bWrite;
+
+ // need exactly one argument
+ if ( rPar.Count() != 2 )
+ {
+ StarBASIC::Error( SbERR_BAD_ARGUMENT );
+ return;
+ }
+
+#ifdef DBG_UTIL
+ DBG_TESTSOLARMUTEX();
+
+ String const sFunctionName = rPar.Get(1)->GetString();
+ if ( sFunctionName.Len() == 0 )
+ {
+ ResetCapturedAssertions();
+ return;
+ }
+
+ if ( nAssertionChannelId == 0 )
+ {
+ // TODO: should we register a named channel at the VCL API, instead of an unnamed channel at the tools API?
+ // A named channel would mean it would appear in the nonpro-debug-options dialog
+ nAssertionChannelId = DbgRegisterUserChannel( &DbgReportAssertion );
+ }
+
+ DbgChannelId const nCurrentChannelId = (DbgChannelId)DbgGetErrorOut();
+ if ( nCurrentChannelId != nAssertionChannelId )
+ {
+ // remember the current channel
+ nRestoreChannelId = nCurrentChannelId;
+
+ // set the new channel
+ DBG_INSTOUTERROR( nAssertionChannelId );
+
+ // ensure OSL assertions are captured, too
+ DbgData aData( *DbgGetData() );
+ aData.bHookOSLAssert = sal_True;
+ DbgUpdateOslHook( &aData );
+ }
+
+ xAssertionChannelBasic = pBasic;
+ sCaptureFunctionName = sFunctionName;
+#else
+ (void)pBasic;
+ (void)rPar;
+ (void)bWrite;
+#endif
+}
+
diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx
index 5576c1619f6a..966e6a63df45 100755
--- a/basic/source/runtime/stdobj.cxx
+++ b/basic/source/runtime/stdobj.cxx
@@ -188,6 +188,8 @@ static Methods aMethods[] = {
{ "number", SbxDOUBLE, 0,NULL,0 },
{ "CreateObject", SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateObject ),0 },
{ "class", SbxSTRING, 0,NULL,0 },
+{ "CaptureAssertions", SbxNULL, 1 | _FUNCTION, RTLNAME(CaptureAssertions), 0 },
+ { "methodName", SbxSTRING, 0, NULL, 0 },
{ "CreateUnoListener",SbxOBJECT, 1 | _FUNCTION, RTLNAME( CreateUnoListener ),0 },
{ "prefix", SbxSTRING, 0,NULL,0 },
{ "typename", SbxSTRING, 0,NULL,0 },