ooo-build r12922 - in trunk: . patches/dev300 patches/vba scratch/sc-vba/testvba/TestDocuments scratch/sc-vba/testvba/TestDocuments/logs/unix



Author: pflin
Date: Thu Jun 19 09:26:35 2008
New Revision: 12922
URL: http://svn.gnome.org/viewvc/ooo-build?rev=12922&view=rev

Log:
Add to support Range.ShowDetail, Range.MergeArea.
	* patches/vba/vba-range-missing-api.diff:
	* scratch/sc-vba/testvba/TestDocuments/Ranges-4.xls:
	* scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log:



Added:
   trunk/patches/vba/vba-range-missing-api.diff
   trunk/scratch/sc-vba/testvba/TestDocuments/Ranges-4.xls   (contents, props changed)
   trunk/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log
Modified:
   trunk/ChangeLog
   trunk/patches/dev300/apply

Modified: trunk/patches/dev300/apply
==============================================================================
--- trunk/patches/dev300/apply	(original)
+++ trunk/patches/dev300/apply	Thu Jun 19 09:26:35 2008
@@ -1432,6 +1432,8 @@
 basic-caller-support-dev300.diff
 # comparison of tow empty type fix in vba mode
 vba-empty-comparison-fix.diff, n#397438, Fong
+# support Range.MergeArea, Range.ShowDetail
+vba-range-missing-api.diff, Fong
 [ VBAUntested ]
 SectionOwner => noelpwer
 vba-basic-null.diff i#85349, jjiao

Added: trunk/patches/vba/vba-range-missing-api.diff
==============================================================================
--- (empty file)
+++ trunk/patches/vba/vba-range-missing-api.diff	Thu Jun 19 09:26:35 2008
@@ -0,0 +1,185 @@
+--- oovbaapi/org/openoffice/excel/XRange.idl.orig	2008-04-11 17:55:48.000000000 +0800
++++ oovbaapi/org/openoffice/excel/XRange.idl	2008-06-03 10:08:45.000000000 +0800
+@@ -103,6 +103,7 @@ interface XRange
+ 	[attribute, readonly] XValidation Validation;
+ 	[attribute] any Style;
+ 	[attribute] any AddIndent;
++	[attribute] any ShowDetail;
+ 
+ 	XComment AddComment( [in] any Text ); 
+ 	void Clear();
+@@ -164,6 +165,7 @@ interface XRange
+  	XRange SpecialCells( [in] any Type, [in]  /*Optional*/ any Value ) raises ( com::sun::star::script::BasicErrorException );
+ 	void RemoveSubtotal() raises ( com::sun::star::script::BasicErrorException );
+ 	void	Subtotal( [in] long GroupBy, [in] long Function, [in]  /*Optional*/ sequence<long> TotalList, [in]  /*Optional*/ any Replace, [in]  /*Optional*/ any PageBreaks, [in] any SummaryBelowData ) raises ( com::sun::star::script::BasicErrorException );
++	XRange MergeArea( ) raises ( com::sun::star::script::BasicErrorException );
+ 
+ };
+ 
+--- sc/inc/document.hxx.orig	2008-06-06 18:07:28.000000000 +0800
++++ sc/inc/document.hxx	2008-06-06 18:07:49.000000000 +0800
+@@ -711,7 +711,7 @@ SC_DLLPUBLIC	ScDBCollection*	GetDBCollec
+ 	BOOL			HasBackgroundDraw( SCTAB nTab, const Rectangle& rMMRect );
+ 	BOOL			HasAnyDraw( SCTAB nTab, const Rectangle& rMMRect );
+ 
+-	ScOutlineTable*	GetOutlineTable( SCTAB nTab, BOOL bCreate = FALSE );
++	SC_DLLPUBLIC ScOutlineTable*	GetOutlineTable( SCTAB nTab, BOOL bCreate = FALSE );
+ 	BOOL			SetOutlineTable( SCTAB nTab, const ScOutlineTable* pNewOutline );
+ 
+ 	void			DoAutoOutline( SCCOL nStartCol, SCROW nStartRow,
+--- sc/inc/olinetab.hxx.orig	2008-06-18 12:46:00.000000000 +0800
++++ sc/inc/olinetab.hxx	2008-06-11 17:46:35.000000000 +0800
+@@ -114,7 +114,7 @@ public:
+ 
+     ScOutlineEntry*         GetEntry( USHORT nLevel, USHORT nIndex ) const;
+     USHORT                  GetCount( USHORT nLevel ) const;
+-    ScOutlineEntry*         GetEntryByPos( USHORT nLevel, SCCOLROW nPos ) const;
++    SC_DLLPUBLIC ScOutlineEntry*         GetEntryByPos( USHORT nLevel, SCCOLROW nPos ) const;
+ 
+     BOOL                    GetEntryIndex( USHORT nLevel, SCCOLROW nPos, USHORT& rnIndex ) const;
+     BOOL                    GetEntryIndexInRange(
+--- sc/source/ui/vba/vbarange.hxx.orig	2008-05-14 18:03:47.000000000 +0800
++++ sc/source/ui/vba/vbarange.hxx	2008-06-03 10:08:45.000000000 +0800
+@@ -171,6 +171,10 @@ public:
+ 	virtual css::uno::Reference< oo::excel::XValidation > SAL_CALL getValidation() throw (css::uno::RuntimeException);
+ 	virtual css::uno::Any SAL_CALL getFormulaHidden() throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ 	virtual void SAL_CALL setFormulaHidden(const css::uno::Any& aHidden) throw (css::script::BasicErrorException, css::uno::RuntimeException);	
++	//virtual css::uno::Any SAL_CALL getLocked() throw (css::script::BasicErrorException, css::uno::RuntimeException);
++	//virtual void SAL_CALL setLocked(const css::uno::Any& aLocked) throw (css::script::BasicErrorException, css::uno::RuntimeException);	
++	virtual css::uno::Any SAL_CALL getShowDetail() throw (css::uno::RuntimeException);
++	virtual void SAL_CALL setShowDetail(const css::uno::Any& aShowDetail) throw (css::uno::RuntimeException);	
+ 	// Methods
+ 	sal_Bool IsRows() { return mbIsRows; }
+ 	sal_Bool IsColumns() { return mbIsColumns; }
+@@ -241,6 +245,7 @@ public:
+ 	virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Next() throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ 	virtual css::uno::Reference< oo::excel::XRange > SAL_CALL Previous() throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ 	virtual void SAL_CALL RemoveSubtotal(  ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
++	virtual css::uno::Reference< oo::excel::XRange > SAL_CALL MergeArea() throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ 	virtual void SAL_CALL Subtotal( ::sal_Int32 GroupBy, ::sal_Int32 Function, const css::uno::Sequence< ::sal_Int32 >& TotalList, const css::uno::Any& Replace, const css::uno::Any& PageBreaks, const css::uno::Any& SummaryBelowData ) throw (css::script::BasicErrorException, css::uno::RuntimeException);
+ 	// XEnumerationAccess
+ 	virtual css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() throw (css::uno::RuntimeException);
+--- sc/source/ui/vba/vbarange.cxx.orig	2008-06-02 14:24:47.000000000 +0800
++++ sc/source/ui/vba/vbarange.cxx	2008-06-12 14:46:30.000000000 +0800
+@@ -164,6 +164,7 @@
+ 
+ #include <org/openoffice/excel/Range.hpp>
+ #include <com/sun/star/bridge/oleautomation/Date.hpp>
++#include "olinetab.hxx"
+ 
+ using namespace ::org::openoffice;
+ using namespace ::com::sun::star;
+@@ -4395,6 +4396,113 @@ void ScVbaRange::setFormulaHidden(const 
+ 	xProps->setPropertyValue(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLPRO)), uno::makeAny(rCellAttr));
+ }
+ 
++uno::Any ScVbaRange::getShowDetail() throw ( css::uno::RuntimeException)
++{
++	// #FIXME, If the specified range is in a PivotTable report
++
++	// In MSO VBA, the specified range must be a single summary column or row in an outline. otherwise throw exception
++	if( m_Areas->getCount() > 1 )
++		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not get Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() );
++	
++	sal_Bool bShowDetail = sal_False;
++
++	RangeHelper helper( mxRange );
++	uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = helper.getSheetCellCursor();
++	xSheetCellCursor->collapseToCurrentRegion();
++	uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
++	table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress();
++
++	// check if the specified range is a single summary column or row.
++	table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress();
++	if( (thisAddress.StartRow == thisAddress.EndRow &&  thisAddress.EndRow == aOutlineAddress.EndRow ) ||
++		(thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
++	{
++		sal_Bool bColumn =thisAddress.StartRow == thisAddress.EndRow ? sal_False:sal_True; 
++		ScDocument* pDoc = getDocumentFromRange( mxRange );
++		ScOutlineTable* pOutlineTable = pDoc->GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), sal_True);
++		const ScOutlineArray* pOutlineArray =  bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray();
++		if( pOutlineArray )
++		{
++			SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1);
++			ScOutlineEntry* pEntry = pOutlineArray->GetEntryByPos( 0, nPos );
++			if( pEntry )
++			{
++				bShowDetail = !pEntry->IsHidden();
++				return uno::makeAny( bShowDetail );
++			}
++		}
++	}
++	else
++	{
++		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() );
++	}
++    return aNULL();
++}
++
++void ScVbaRange::setShowDetail(const uno::Any& aShowDetail) throw ( css::uno::RuntimeException)
++{
++	// #FIXME, If the specified range is in a PivotTable report
++
++	// In MSO VBA, the specified range must be a single summary column or row in an outline. otherwise throw exception
++	if( m_Areas->getCount() > 1 )
++		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() );
++	
++	sal_Bool bShowDetail = sal_False;
++	aShowDetail >>= bShowDetail;
++
++	RangeHelper helper( mxRange );
++	uno::Reference< sheet::XSheetCellCursor > xSheetCellCursor = helper.getSheetCellCursor();
++	xSheetCellCursor->collapseToCurrentRegion();
++	uno::Reference< sheet::XCellRangeAddressable > xCellRangeAddressable(xSheetCellCursor, uno::UNO_QUERY_THROW);
++	table::CellRangeAddress aOutlineAddress = xCellRangeAddressable->getRangeAddress();
++
++	// check if the specified range is a single summary column or row.
++	table::CellRangeAddress thisAddress = helper.getCellRangeAddressable()->getRangeAddress();
++	if( (thisAddress.StartRow == thisAddress.EndRow &&  thisAddress.EndRow == aOutlineAddress.EndRow ) ||
++		(thisAddress.StartColumn == thisAddress.EndColumn && thisAddress.EndColumn == aOutlineAddress.EndColumn ))
++	{			
++		// #FIXME, seems there is a different behavior between MSO and OOo. 
++		//	In OOo, the showDetail will show all the level entrys, while only show the first level entry in MSO
++		uno::Reference< sheet::XSheetOutline > xSheetOutline( helper.getSpreadSheet(), uno::UNO_QUERY_THROW );
++		if( bShowDetail )
++			xSheetOutline->showDetail( aOutlineAddress );
++		else
++			xSheetOutline->hideDetail( aOutlineAddress );
++	}
++	else
++	{
++		throw uno::RuntimeException( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Can not set Range.ShowDetail attribute ")), uno::Reference< uno::XInterface >() );
++	}
++}
++
++uno::Reference< excel::XRange > SAL_CALL 
++ScVbaRange::MergeArea() throw (script::BasicErrorException, uno::RuntimeException)
++{
++    uno::Reference< sheet::XSheetCellRange > xMergeShellCellRange(mxRange->getCellRangeByPosition(0,0,0,0), uno::UNO_QUERY_THROW);
++    uno::Reference< sheet::XSheetCellCursor > xMergeSheetCursor(xMergeShellCellRange->getSpreadsheet()->createCursorByRange( xMergeShellCellRange ), uno::UNO_QUERY_THROW);
++    if( xMergeSheetCursor.is() )
++    {
++        xMergeSheetCursor->collapseToMergedArea();
++        uno::Reference<sheet::XCellRangeAddressable> xMergeCellAddress(xMergeSheetCursor, uno::UNO_QUERY_THROW);
++        if( xMergeCellAddress.is() )
++        {
++            table::CellRangeAddress aCellAddress = xMergeCellAddress->getRangeAddress();
++            if( aCellAddress.StartColumn ==0 && aCellAddress.EndColumn==0 &&
++                aCellAddress.StartRow==0 && aCellAddress.EndRow==0)
++            {
++                return new ScVbaRange( getParent(),mxContext,mxRange );
++            }
++            else
++            {
++                ScRange refRange( aCellAddress.StartColumn, aCellAddress.StartRow, aCellAddress.Sheet, 
++                                  aCellAddress.EndColumn, aCellAddress.EndRow, aCellAddress.Sheet);
++                uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getScDocShell() , refRange ) );
++                return new ScVbaRange( getParent(),mxContext,xRange );
++            }
++        }
++    }
++    return new ScVbaRange( getParent(),mxContext,mxRange );
++}
+ 
+ void SAL_CALL 
+ ScVbaRange::PrintOut( const uno::Any& From, const uno::Any& To, const uno::Any& Copies, const uno::Any& Preview, const uno::Any& ActivePrinter, const uno::Any& PrintToFile, const uno::Any& Collate, const uno::Any& PrToFileName ) throw (uno::RuntimeException)

Added: trunk/scratch/sc-vba/testvba/TestDocuments/Ranges-4.xls
==============================================================================
Binary file. No diff available.

Added: trunk/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log
==============================================================================
--- (empty file)
+++ trunk/scratch/sc-vba/testvba/TestDocuments/logs/unix/range-4.log	Thu Jun 19 09:26:35 2008
@@ -0,0 +1,16 @@
+Test run started : 2008ï06ï19 17:14:57
+----------------------------------------------------------------
+ShowDetail-Issue
+ TEST START : ShowDetail-Issue
+  ITEM Assertion OK :  Range.ShowDetail is True
+  ITEM Assertion OK :  Range.ShowDetail is False
+END 'ShowDetail-Issue' Symbol
+ TEST OK : ShowDetail-Issue
+----------------------------------------------------------------
+RangeMerged-Issue
+ TEST START : RangeMerged-Issue
+  ITEM Assertion OK :  Range.RangeMerged is $F$2:$H$5
+  ITEM Assertion OK :  The first address of Range.RangeMerged is $F$2
+END 'RangeMerged-Issue' Symbol
+ TEST OK : RangeMerged-Issue
+Test run finished : 2008ï06ï19 17:14:57



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]