diff options
author | Petr Mladek <pmladek@suse.cz> | 2013-05-01 13:05:06 +0200 |
---|---|---|
committer | Petr Mladek <pmladek@suse.cz> | 2013-05-01 13:05:06 +0200 |
commit | 93e11e4fb697aaea63c99308f980e4c932bd1efa (patch) | |
tree | 1892e49932d8d7b7656ae504113a40e4e39f876f /basic | |
parent | a5b6a379a2d628040db98060c2adfe8f2fac5607 (diff) | |
parent | c6786add5a58268e11aa027c47054344040db1bc (diff) |
Merge tag 'libreoffice-4.0.3.2' into suse-4.0
Tag libreoffice-4.0.3.2
Conflicts:
basic/qa/cppunit/test_vba.cxx
basic/source/runtime/step2.cxx
dictionaries
helpcontent2
instsetoo_native/util/openoffice.lst
libvisio/UnpackedTarball_visio.mk
sc/source/ui/vba/vbaapplication.cxx
sc/source/ui/vba/vbavalidation.cxx
solenv/inc/minor.mk
sw/qa/extras/ooxmlimport/ooxmlimport.cxx
translations
Change-Id: Ic1f06489175f3db92d6bbcebb9732fadc1c61fed
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/cppunit/test_vba.cxx | 7 | ||||
-rw-r--r-- | basic/qa/vba_tests/ole_dfltObjDflMethod.vb | 24 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 10 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 8 | ||||
-rw-r--r-- | basic/source/runtime/step2.cxx | 14 |
5 files changed, 48 insertions, 15 deletions
diff --git a/basic/qa/cppunit/test_vba.cxx b/basic/qa/cppunit/test_vba.cxx index abb929f95889..65338a96697f 100644 --- a/basic/qa/cppunit/test_vba.cxx +++ b/basic/qa/cppunit/test_vba.cxx @@ -22,7 +22,7 @@ namespace VBATest() : BootstrapFixture(true, false) {} ~VBATest(){} void testMiscVBAFunctions(); - void testObjAssignWithDefaultMember(); + void testMiscOLEStuff(); // Adds code needed to register the test suite CPPUNIT_TEST_SUITE(VBATest); @@ -30,7 +30,7 @@ namespace CPPUNIT_TEST(testMiscVBAFunctions); // not much point even trying to run except on windows #if defined(WNT) - CPPUNIT_TEST(testObjAssignWithDefaultMember); + CPPUNIT_TEST(testMiscOLEStuff); #endif // End of test suite definition @@ -105,7 +105,7 @@ void VBATest::testMiscVBAFunctions() } } -void VBATest::testObjAssignWithDefaultMember() +void VBATest::testMiscOLEStuff() { bool bCanRunOleTests = hasOLEEnv(); if ( !bCanRunOleTests ) @@ -114,6 +114,7 @@ void VBATest::testObjAssignWithDefaultMember() const char* macroSource[] = { "ole_ObjAssignNoDflt.vb", "ole_ObjAssignToNothing.vb", + "ole_dfltObjDflMethod.vb", }; OUString sMacroPathURL = getURLFromSrc("/basic/qa/vba_tests/"); diff --git a/basic/qa/vba_tests/ole_dfltObjDflMethod.vb b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb new file mode 100644 index 000000000000..f24786098e48 --- /dev/null +++ b/basic/qa/vba_tests/ole_dfltObjDflMethod.vb @@ -0,0 +1,24 @@ +Option VBASupport 1 +Option Explicit + +Rem Test accessing an object that has default object member +Rem which in turn has a default member that is a method +Function doUnitTest(TestData As String) As String +doUnitTest = "Begin" +Dim modifiedTimout As Long +Dim cnn1 As New ADODB.Connection +Dim rst1 As New ADODB.Recordset +Dim conStr As String +cnn1.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _ +"Data Source=" & TestData & ";" & _ +"Extended Properties=""Excel 8.0;HDR=Yes"";" +rst1.Open "SELECT * FROM [Sheet1$];", cnn1, adOpenStatic, adLockReadOnly +Dim val +val = rst1("FirstName") +If val = "Paddy" Then + doUnitTest = "OK" +Else + doUnitTest = "Failed, expected 'Paddy' got " & val +End If + +End Function diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index d0b2c9a95f63..c39c7e69b785 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -22,6 +22,7 @@ #include <osl/process.h> #include <vcl/svapp.hxx> #include <vcl/settings.hxx> +#include <vcl/sound.hxx> #include <tools/wintypes.hxx> #include <vcl/msgbox.hxx> #include <basic/sbx.hxx> @@ -1282,8 +1283,12 @@ RTLFUNC(Mid) else { aResultStr = aArgStr; - aResultStr.remove( nStartPos, nLen ); - aResultStr.insert( nStartPos, rPar.Get(4)->GetOUString().getStr(), nLen); + sal_Int32 nTmpStartPos = nStartPos; + if ( nTmpStartPos > aArgStr.getLength() ) + nTmpStartPos = aArgStr.getLength(); + else + aResultStr.remove( nTmpStartPos, nLen ); + aResultStr.insert( nTmpStartPos, rPar.Get(4)->GetOUString().getStr(), std::min(nLen, rPar.Get(4)->GetOUString().getLength())); } rPar.Get(1)->PutString( aResultStr.makeStringAndClear() ); @@ -4237,6 +4242,7 @@ RTLFUNC(Beep) StarBASIC::Error( SbERR_BAD_ARGUMENT ); return; } + Sound::Beep(); } RTLFUNC(Load) diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 122357733cae..ed1e5d190e1d 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -392,12 +392,14 @@ void SbiInstance::PrepareNumberFormatter( SvNumberFormatter*& rpNumberFormatter, case YMD: aDateStr = "JJJJ.MM.TT"; break; default: aDateStr = "MM.TT.JJJJ"; break; } - rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType, - rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); + OUString aStr( aDateStr ); // PutandConvertEntry() modifies string! + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, + rnStdDateIdx, LANGUAGE_GERMAN, eLangType ); nCheckPos = 0; OUString aStrHHMMSS(" HH:MM:SS"); aDateStr += aStrHHMMSS; - rpNumberFormatter->PutandConvertEntry( aDateStr, nCheckPos, nType, + aStr = aDateStr; + rpNumberFormatter->PutandConvertEntry( aStr, nCheckPos, nType, rnStdDateTimeIdx, LANGUAGE_GERMAN, eLangType ); } diff --git a/basic/source/runtime/step2.cxx b/basic/source/runtime/step2.cxx index cc2fff502b01..464a6d950e60 100644 --- a/basic/source/runtime/step2.cxx +++ b/basic/source/runtime/step2.cxx @@ -617,16 +617,16 @@ SbxVariable* SbiRuntime::CheckArray( SbxVariable* pElem ) if ( pDflt ) { pDflt->Broadcast( SBX_HINT_DATAWANTED ); - SbxBaseRef pObj = (SbxBase*)pDflt->GetObject(); - if( pObj ) + SbxBaseRef pDfltObj = (SbxBase*)pDflt->GetObject(); + if( pDfltObj ) { - if( pObj->ISA(SbUnoObject) ) + if( pDfltObj->ISA(SbUnoObject) ) { - pUnoObj = (SbUnoObject*)(SbxBase*)pObj; - Any aAny = pUnoObj->getUnoAny(); + pUnoObj = (SbUnoObject*)(SbxBase*)pDfltObj; + Any aUnoAny = pUnoObj->getUnoAny(); - if( aAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) - x = *(Reference< XInterface >*)aAny.getValue(); + if( aUnoAny.getValueType().getTypeClass() == TypeClass_INTERFACE ) + x = *(Reference< XInterface >*)aUnoAny.getValue(); pElem = pDflt; } } |