basic/source/classes/sbxmod.cxx | 44 ++++++++-- basic/source/inc/filefmt.hxx | 3 officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu | 2 sc/qa/extras/macros-test.cxx | 26 +++++ 4 files changed, 67 insertions(+), 8 deletions(-)
New commits: commit 2052a85447969020572e510b07fd7586cdc058c8 Author: Caolán McNamara <[email protected]> Date: Thu Oct 1 16:11:40 2015 +0100 "Save" and "Save to Remote Server" shared ~S shortcut Change-Id: Ia368eb83202b65d77777874b7e7948f9f3169c58 diff --git a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu index a375ee0..6a88704 100644 --- a/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu +++ b/officecfg/registry/data/org/openoffice/Office/UI/GenericCommands.xcu @@ -1979,7 +1979,7 @@ </node> <node oor:name=".uno:SaveAsRemote" oor:op="replace"> <prop oor:name="Label" oor:type="xs:string"> - <value xml:lang="en-US">~Save to Remote Server</value> + <value xml:lang="en-US">Save to ~Remote Server</value> </prop> <prop oor:name="Properties" oor:type="xs:int"> <value>1</value> commit ddb45261590939d884ac2bcb1fd258de7b2370da Author: Laurent Godard <[email protected]> Date: Fri Sep 18 17:06:29 2015 +0200 tdf#94617 allow to store nStart information greater than sal_Int16 limit - preserve backward compatibility - nDebugFlag is stored but not used when loaded - Flag nDebugFlag set the top bit to 1 - stores the multiplier of sal_Int16 limit to reach nStart - in load, test this flag bit - rebuild correct nStart - new B_CURVERSION file format for binary storage macro - unit test for big modules Reviewed-on: https://gerrit.libreoffice.org/18926 Reviewed-by: Caolán McNamara <[email protected]> Tested-by: Caolán McNamara <[email protected]> (cherry picked from commit db17079fcff6f9a068c499b17f2501cc4c82d10b) Change-Id: Iaa037982d828fef7195615e6eda546b7199a4fe8 diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index 1dc43ff..167a172 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -75,6 +75,8 @@ #include "sbxmod.hxx" #include "parser.hxx" +#include <limits> + using namespace com::sun::star; using namespace com::sun::star::lang; using namespace com::sun::star::reflection; @@ -1064,6 +1066,7 @@ void SbModule::SetVBACompat( bool bCompat ) void SbModule::Run( SbMethod* pMeth ) { SAL_INFO("basic","About to run " << OUStringToOString( pMeth->GetName(), RTL_TEXTENCODING_UTF8 ).getStr() << ", vba compatmode is " << mbVBACompat ); + static sal_uInt16 nMaxCallLevel = 0; bool bDelInst = ( GetSbData()->pInst == NULL ); @@ -1171,7 +1174,9 @@ void SbModule::Run( SbMethod* pMeth ) { GetSbData()->pInst->EnableCompatibility( true ); } + while( pRt->Step() ) {} + if( pRt->pNext ) pRt->pNext->unblock(); @@ -2031,14 +2036,35 @@ bool SbMethod::LoadData( SvStream& rStrm, sal_uInt16 nVer ) { if( !SbxMethod::LoadData( rStrm, 1 ) ) return false; - sal_Int16 n; - rStrm.ReadInt16( n ); + + sal_uInt16 nFlag; + rStrm.ReadUInt16( nFlag ); + sal_Int16 nTempStart = (sal_Int16)nStart; + if( nVer == 2 ) + { rStrm.ReadUInt16( nLine1 ).ReadUInt16( nLine2 ).ReadInt16( nTempStart ).ReadCharAsBool( bInvalid ); + //tdf#94617 + if (nFlag & 0x8000) + { + sal_uInt16 nMult = nFlag & 0x7FFF; + sal_Int16 nMax = std::numeric_limits<sal_Int16>::max(); + nStart = nMult * nMax + nTempStart; + } + else + { + nStart = nTempStart; + } + } + else + { + nStart = nTempStart; + } + // HACK ue to 'Referenz could not be saved' SetFlag( SbxFlagBits::NoModify ); - nStart = nTempStart; + return true; } @@ -2046,11 +2072,19 @@ bool SbMethod::StoreData( SvStream& rStrm ) const { if( !SbxMethod::StoreData( rStrm ) ) return false; - rStrm.WriteInt16( nDebugFlags ) + + //tdf#94617 + sal_Int16 nMax = std::numeric_limits<sal_Int16>::max(); + sal_Int16 nStartTemp = nStart % nMax; + sal_uInt16 nDebugFlagsTemp = nStart / nMax; + nDebugFlagsTemp |= 0x8000; + + rStrm.WriteUInt16( nDebugFlagsTemp ) .WriteInt16( nLine1 ) .WriteInt16( nLine2 ) - .WriteInt16( nStart ) + .WriteInt16( nStartTemp ) .WriteBool( bInvalid ); + return true; } diff --git a/basic/source/inc/filefmt.hxx b/basic/source/inc/filefmt.hxx index db0b1f6..c9d6ba7 100644 --- a/basic/source/inc/filefmt.hxx +++ b/basic/source/inc/filefmt.hxx @@ -40,11 +40,12 @@ class SvStream; // Version 11: #29955 force anew compilation because of build-inconsistences // Version 12: aoo#64377 increase code size that basic can handle // tdf#75973 support user defined types B_USERTYPES in password protected macros +// Version 13: tdf#94617 store methods nStart information greater than sal_Int16 limit // #define B_LEGACYVERSION 0x00000011L #define B_EXT_IMG_VERSION 0x00000012L -#define B_CURVERSION 0x00000012L +#define B_CURVERSION 0x00000013L // The file contains either a module- or a library-record. // Those records contain further records. Every record's got diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 520b31f..33faa9f 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -118,13 +118,37 @@ void ScMacrosTest::testPasswordProtectedStarBasic() ScDocShell* xDocSh = static_cast<ScDocShell*>(pFoundShell); ScDocument& rDoc = xDocSh->GetDocument(); + + // User defined types + SfxObjectShell::CallXScript( xComponent, "vnd.sun.Star.script:MyLibrary.Module1.Main?language=Basic&location=document", aParams, aRet, aOutParamIndex, aOutParam); OUString aValue = rDoc.GetString(0,0,0); - CPPUNIT_ASSERT_MESSAGE("script did not change the value of Sheet1.A1", aValue == "success"); + CPPUNIT_ASSERT_MESSAGE("User defined types script did not change the value of Sheet1.A1", aValue == "success"); + + // Big Module + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:MyLibrary.BigModule.bigMethod?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + aValue = rDoc.GetString(1,0,0); + CPPUNIT_ASSERT_MESSAGE("Big module script did not change the value of Sheet1.B1", aValue == "success"); + + // far big method tdf#94617 + + SfxObjectShell::CallXScript( + xComponent, + "vnd.sun.Star.script:MyLibrary.BigModule.farBigMethod?language=Basic&location=document", + aParams, aRet, aOutParamIndex, aOutParam); + + aValue = rDoc.GetString(2,0,0); + CPPUNIT_ASSERT_MESSAGE("Far Method script did not change the value of Sheet1.C1", aValue == "success"); + xDocSh->DoClose(); }
_______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
