oovbaapi/ooo/vba/msforms/XControl.idl | 5 ++- sc/CppunitTest_sc_macros_test.mk | 3 ++ sc/inc/rangelst.hxx | 2 - sc/qa/extras/macros-test.cxx | 35 +++++++++++++++++++------ sc/qa/unit/data/xls/CheckOptionToggleValue.xls |binary sc/qa/unit/data/xls/GeneratedEventTest.xls |binary sc/qa/unit/data/xls/MiscControlTests.xls |binary sc/qa/unit/data/xls/PageBreaks.xls |binary sc/qa/unit/data/xls/Ranges-3.xls |binary sc/qa/unit/data/xls/Ranges.xls |binary sc/qa/unit/data/xls/Shapes.xls |binary sc/qa/unit/data/xls/Workbooks.xls |binary sc/qa/unit/data/xls/window2.xls |binary sc/source/core/tool/rangelst.cxx | 5 ++- sc/source/ui/vba/vbapagebreaks.cxx | 4 +- sc/source/ui/vba/vbarange.cxx | 2 - vbahelper/source/msforms/vbacontrol.cxx | 7 +++-- vbahelper/source/msforms/vbacontrol.hxx | 2 - 18 files changed, 47 insertions(+), 18 deletions(-)
New commits: commit 6fb16fba6892aa5e131d34505c80cd4053d41250 Author: Noel Power <noel.po...@suse.com> Date: Tue May 7 08:38:55 2013 +0100 some new testdocuments, also some others with newly added tests Change-Id: I4e3cf644d8a6e6989f79a6758ad3d55972fc82b1 diff --git a/sc/qa/unit/data/xls/CheckOptionToggleValue.xls b/sc/qa/unit/data/xls/CheckOptionToggleValue.xls new file mode 100644 index 0000000..14cf152 Binary files /dev/null and b/sc/qa/unit/data/xls/CheckOptionToggleValue.xls differ diff --git a/sc/qa/unit/data/xls/GeneratedEventTest.xls b/sc/qa/unit/data/xls/GeneratedEventTest.xls new file mode 100755 index 0000000..9325de3 Binary files /dev/null and b/sc/qa/unit/data/xls/GeneratedEventTest.xls differ diff --git a/sc/qa/unit/data/xls/MiscControlTests.xls b/sc/qa/unit/data/xls/MiscControlTests.xls new file mode 100755 index 0000000..3503795 Binary files /dev/null and b/sc/qa/unit/data/xls/MiscControlTests.xls differ diff --git a/sc/qa/unit/data/xls/PageBreaks.xls b/sc/qa/unit/data/xls/PageBreaks.xls index 2affd99..4e6ac0a 100644 Binary files a/sc/qa/unit/data/xls/PageBreaks.xls and b/sc/qa/unit/data/xls/PageBreaks.xls differ diff --git a/sc/qa/unit/data/xls/Ranges-3.xls b/sc/qa/unit/data/xls/Ranges-3.xls index e68f6a8..c23b70a 100644 Binary files a/sc/qa/unit/data/xls/Ranges-3.xls and b/sc/qa/unit/data/xls/Ranges-3.xls differ diff --git a/sc/qa/unit/data/xls/Ranges.xls b/sc/qa/unit/data/xls/Ranges.xls index cc12d3f..4d5583e 100644 Binary files a/sc/qa/unit/data/xls/Ranges.xls and b/sc/qa/unit/data/xls/Ranges.xls differ diff --git a/sc/qa/unit/data/xls/Shapes.xls b/sc/qa/unit/data/xls/Shapes.xls index ff15272..dbccf3d 100644 Binary files a/sc/qa/unit/data/xls/Shapes.xls and b/sc/qa/unit/data/xls/Shapes.xls differ diff --git a/sc/qa/unit/data/xls/Workbooks.xls b/sc/qa/unit/data/xls/Workbooks.xls new file mode 100755 index 0000000..a732167 Binary files /dev/null and b/sc/qa/unit/data/xls/Workbooks.xls differ diff --git a/sc/qa/unit/data/xls/window2.xls b/sc/qa/unit/data/xls/window2.xls index 1c84a13..e9deceb 100644 Binary files a/sc/qa/unit/data/xls/window2.xls and b/sc/qa/unit/data/xls/window2.xls differ commit aef911e1988085b184e6bafd750854c998cf485f Author: Noel Power <noel.po...@suse.com> Date: Wed May 1 12:05:22 2013 +0100 tweak vba Control implementation to aritificially fire events from api Previouslly there were some internal methods to allow event handlers to be triggered. To test some functionality from the unit tests we now expose some of that functionality via uno. Change-Id: I11022226260d3dacd82f42ce89413102ce34cc13 diff --git a/oovbaapi/ooo/vba/msforms/XControl.idl b/oovbaapi/ooo/vba/msforms/XControl.idl index 319ff72..b703154 100644 --- a/oovbaapi/ooo/vba/msforms/XControl.idl +++ b/oovbaapi/ooo/vba/msforms/XControl.idl @@ -19,6 +19,7 @@ #define __ooo_vba_msforms_XControl_idl__ #include <com/sun/star/uno/XInterface.idl> +#include <com/sun/star/script/ScriptEvent.idl> #include <ooo/vba/XHelperInterface.idl> module ooo { module vba { module msforms { @@ -29,7 +30,9 @@ interface XControl interface ::ooo::vba::XHelperInterface; void SetFocus(); void Move( [in] double Left, [in] double Top, [in] any Width, [in] any Height ); - + // support for unit test harness ( and possibly internal clients ) + // to generate events that will call appropriate event handlers + void fireEvent( [in] com::sun::star::script::ScriptEvent evt ); [attribute, readonly ] com::sun::star::uno::XInterface Object; [attribute] string ControlSource; [attribute] string RowSource; diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 516cfa6..ae0cc58 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -519,8 +519,9 @@ ScVbaControl::setMousePointer( ::sal_Int32 _mousepointer ) throw (::com::sun::st } } -void ScVbaControl::fireEvent( script::ScriptEvent& evt ) +void SAL_CALL ScVbaControl::fireEvent( const script::ScriptEvent& rEvt ) throw (uno::RuntimeException) { + script::ScriptEvent evt( rEvt ); uno::Reference<lang::XMultiComponentFactory > xServiceManager( mxContext->getServiceManager(), uno::UNO_QUERY_THROW ); uno::Reference< script::XScriptListener > xScriptListener( xServiceManager->createInstanceWithContext( "ooo.vba.EventListener" , mxContext ), uno::UNO_QUERY_THROW ); @@ -546,7 +547,9 @@ void ScVbaControl::fireEvent( script::ScriptEvent& evt ) uno::Reference< document::XCodeNameQuery > xNameQuery( xDocFac->createInstance( "ooo.vba.VBACodeNameProvider" ), uno::UNO_QUERY_THROW ); uno::Reference< uno::XInterface > xIf( xControlShape->getControl(), uno::UNO_QUERY_THROW ); evt.ScriptCode = xNameQuery->getCodeNameForObject( xIf ); - evt.Arguments[ 0 ] = uno::makeAny( aEvt ); + // handle if we passed in our own arguments + if ( !rEvt.Arguments.getLength() ) + evt.Arguments[ 0 ] = uno::makeAny( aEvt ); xScriptListener->firing( evt ); } else diff --git a/vbahelper/source/msforms/vbacontrol.hxx b/vbahelper/source/msforms/vbacontrol.hxx index bf6b8a3..7644b56 100644 --- a/vbahelper/source/msforms/vbacontrol.hxx +++ b/vbahelper/source/msforms/vbacontrol.hxx @@ -57,7 +57,6 @@ protected: virtual css::uno::Reference< css::awt::XWindowPeer > getWindowPeer() throw (css::uno::RuntimeException); void fireChangeEvent(); void fireClickEvent(); - void fireEvent( css::script::ScriptEvent& evt ); public: ScVbaControl( const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::uno::XInterface >& xControl, const css::uno::Reference< css::frame::XModel >& xModel, ov::AbstractGeometryAttributes* pHelper ); @@ -84,6 +83,7 @@ public: virtual void SAL_CALL setTop( double _top ) throw (css::uno::RuntimeException); virtual void SAL_CALL SetFocus( ) throw (css::uno::RuntimeException); virtual void SAL_CALL Move( double Left, double Top, const ::com::sun::star::uno::Any& Width, const ::com::sun::star::uno::Any& Height ) throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL fireEvent( const css::script::ScriptEvent& evt ) throw (::com::sun::star::uno::RuntimeException); virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getObject() throw (css::uno::RuntimeException); virtual OUString SAL_CALL getControlSource() throw (css::uno::RuntimeException); commit 89fec0bf76b9b3a4580050f863ee23436cc49113 Author: Noel Power <noel.po...@suse.com> Date: Tue Apr 30 15:32:15 2013 +0100 adjust components needed for CheckOptionToggleValue.xls testfile Change-Id: Id9aa26cac2f59829e8b00057c82dc52bbbbc20cb diff --git a/sc/CppunitTest_sc_macros_test.mk b/sc/CppunitTest_sc_macros_test.mk index 79bf0ad..f32c6bb 100644 --- a/sc/CppunitTest_sc_macros_test.mk +++ b/sc/CppunitTest_sc_macros_test.mk @@ -105,6 +105,8 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\ sc/util/vbaobj) \ scripting/source/basprov/basprov \ scripting/util/scriptframe \ + scripting/source/vbaevents/vbaevents \ + scripting/source/dlgprov/dlgprov \ sfx2/util/sfx \ sot/util/sot \ svl/source/fsstor/fsstorage \ @@ -120,6 +122,7 @@ $(eval $(call gb_CppunitTest_use_components,sc_macros_test,\ xmloff/util/xo \ eventattacher/source/evtatt \ i18npool/source/search/i18nsearch \ + vbahelper/util/msforms \ )) $(eval $(call gb_CppunitTest_use_configuration,sc_macros_test)) commit a7359287cb2607a6ee08227f6a33c0d5bda3ad5a Author: Noel Power <noel.po...@suse.com> Date: Thu May 2 13:16:08 2013 +0100 Tweak further the indices checked for break, also tweak test document <sigh> pagebreak implementation is still flawed here, the used range is used to determine whether the page break should be considered ( or not ) Problem is that it is not the used range but rather the rightmost column position that contains content ( but not necessarily the column that contains content but rather the righmost column that has content ( or even that is covered either by spillover from an adjacent column or drawing ) Change-Id: I68c8ccc5911049bc4b2076992f839bc684d966a9 diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx index af580da..eed51d7 100644 --- a/sc/source/ui/vba/vbapagebreaks.cxx +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -49,7 +49,7 @@ public: sal_Int32 getAPIEndIndexofRange( const uno::Reference< excel::XRange >& xRange, sal_Int32 nUsedStart ) throw (uno::RuntimeException) { if( m_bColumn ) - return nUsedStart + xRange->Columns( uno::Any() )->getCount(); + return nUsedStart + xRange->Columns( uno::Any() )->getCount() - 1; return nUsedStart + xRange->Rows( uno::Any() )->getCount(); } @@ -107,7 +107,7 @@ sal_Int32 SAL_CALL RangePageBreaks::getCount( ) throw (uno::RuntimeException) for( sal_Int32 i=0; i<nLength; i++ ) { sal_Int32 nPos = aTablePageBreakData[i].Position; - if( nPos > nUsedEnd + 1 ) + if( nPos > nUsedEnd + 1) return nCount; nCount++; } commit 0762392cac69bc80be208443dbdb79c49dda735e Author: Noel Power <noel.po...@suse.com> Date: Fri May 3 17:22:16 2013 +0100 Fix ScRangeList::Parse wrt defaulted delimiter and default tab params At some point in the past default tab was introduced, the VBA Range code calling ScRangeList::Parse was not adjusted to take care of this extra defaulted param and and the delimiter param was passed in place of default tab. Change-Id: I45a971f7ad9cb4f3299fae8cb1882cb0e7744c3b diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx index 7b8f144..0d792b1 100644 --- a/sc/qa/extras/macros-test.cxx +++ b/sc/qa/extras/macros-test.cxx @@ -173,15 +173,10 @@ void ScMacrosTest::testVba() rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TestCalc_Rangetest2.")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")) }, -#if defined FIXRANGEADDRESSING -//ScVbaRange::getRangeForName()/getScRangeListForAddress() seems to get confused -//about the addressing mode of the document vs the addressing mode of a named -//range ( need to fix that ) { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ranges-2.")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")) }, -#endif { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("pagesetup.")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")) @@ -202,15 +197,40 @@ void ScMacrosTest::testVba() rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Shapes.")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")) }, -#if VBA_TEST_WORKING { rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Ranges.")), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document")) }, -#endif + { + OUString("CheckOptionToggleValue."), + OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") + }, + { + OUString("GeneratedEventTest."), + OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") + }, + { + OUString("MiscControlTests."), + OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") + }, + { + OUString("Workbooks."), + OUString("vnd.sun.Star.script:VBAProject.testMacros.test?language=Basic&location=document") + }, + }; rtl::OUString aFileExtension("xls"); + OUString sTempDir; + OUString sTempDirURL; + osl::FileBase:: getTempDirURL( sTempDirURL ); + osl::FileBase::getSystemPathFromFileURL( sTempDirURL, sTempDir ); + Sequence< uno::Any > aParams; + if ( !sTempDir.isEmpty() ) + { + aParams.realloc(1); + aParams[ 0 ] <<= sTempDir; + } for ( sal_uInt32 i=0; i<SAL_N_ELEMENTS( testInfo ); ++i ) { rtl::OUString aFileName; @@ -224,7 +244,6 @@ void ScMacrosTest::testVba() Any aRet; Sequence< sal_Int16 > aOutParamIndex; Sequence< Any > aOutParam; - Sequence< uno::Any > aParams; SfxObjectShell* pFoundShell = SfxObjectShell::GetShellFromComponent(xComponent); diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 5fddd01..e1b62fb 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1165,7 +1165,7 @@ ScVbaRange::getCellRangesForAddress( sal_uInt16& rResFlags, const rtl::OUString& pDoc = pDocSh->GetDocument(); String aString(sAddress); sal_uInt16 nMask = SCA_VALID; - rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, cDelimiter ); + rResFlags = rCellRanges.Parse( sAddress, pDoc, nMask, eConv, 0, cDelimiter ); if ( rResFlags & SCA_VALID ) { return true; commit 229d0d1098300ca852a3fdb47327b355c80136e7 Author: Noel Power <noel.po...@suse.com> Date: Fri May 3 17:21:39 2013 +0100 Revert "remove unused parameter" This reverts commit 7c63d52506b66563eefcf29c803b23bb9b812491. diff --git a/sc/inc/rangelst.hxx b/sc/inc/rangelst.hxx index b67445b..42a72ec 100644 --- a/sc/inc/rangelst.hxx +++ b/sc/inc/rangelst.hxx @@ -41,7 +41,7 @@ public: sal_uInt16 Parse( const String&, ScDocument* = NULL, sal_uInt16 nMask = SCA_VALID, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, - SCTAB nDefaultTab = 0 ); + SCTAB nDefaultTab = 0, sal_Unicode cDelimiter = 0 ); void Format( String&, sal_uInt16 nFlags = 0, ScDocument* = NULL, formula::FormulaGrammar::AddressConvention eConv = formula::FormulaGrammar::CONV_OOO, diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 6f0093d..667d91b 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -185,11 +185,12 @@ ScRangeList::~ScRangeList() sal_uInt16 ScRangeList::Parse( const String& rStr, ScDocument* pDoc, sal_uInt16 nMask, formula::FormulaGrammar::AddressConvention eConv, - SCTAB nDefaultTab ) + SCTAB nDefaultTab, sal_Unicode cDelimiter ) { if ( rStr.Len() ) { - sal_Unicode cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); + if (!cDelimiter) + cDelimiter = ScCompiler::GetNativeSymbol(ocSep).GetChar(0); nMask |= SCA_VALID; // falls das jemand vergessen sollte sal_uInt16 nResult = (sal_uInt16)~0; // alle Bits setzen _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits