sc/source/ui/vba/vbarange.cxx | 22 ++++++++++ sc/source/ui/vba/vbawindow.cxx | 83 +++++++++++++++++++++++++++-------------- sc/source/ui/vba/vbawindow.hxx | 2 3 files changed, 78 insertions(+), 29 deletions(-)
New commits: commit 21431fa2231de5493235b276b5a1d007708f8099 Author: Noel Power <noel.po...@suse.com> Date: Tue May 28 17:33:33 2013 +0100 some Worksheet.Change support Change-Id: I91203e74d54adba17a20ef7b7d835d9ac49855be (cherry picked from commit 20d792d6379600df8b56a2735f9dd1cb63967e4d) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index ef1adde..c9eb427 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1832,6 +1832,7 @@ ScVbaRange::fillSeries( sheet::FillDirection nFillDirection, sheet::FillMode nFi uno::Reference< sheet::XCellSeries > xCellSeries(mxRange, uno::UNO_QUERY_THROW ); xCellSeries->fillSeries( nFillDirection, nFillMode, nFillDateMode, fStep, fEndValue ); + fireChangeEvent(); } void @@ -3094,7 +3095,28 @@ ScVbaRange::Replace( const ::rtl::OUString& What, const ::rtl::OUString& Replace // OOo.org afaik uno::Reference< util::XSearchDescriptor > xSearch( xDescriptor, uno::UNO_QUERY ); + uno::Reference< container::XIndexAccess > xIndexAccess = xReplace->findAll( xSearch ); xReplace->replaceAll( xSearch ); + if ( xIndexAccess.is() && xIndexAccess->getCount() > 0 ) + { + for ( sal_Int32 i = 0; i < xIndexAccess->getCount(); ++i ) + { + uno::Reference< table::XCellRange > xCellRange( xIndexAccess->getByIndex( i ), uno::UNO_QUERY ); + if ( xCellRange.is() ) + { + uno::Reference< excel::XRange > xRange( new ScVbaRange( mxParent, mxContext, xCellRange ) ); + uno::Reference< container::XEnumerationAccess > xEnumAccess( xRange, uno::UNO_QUERY_THROW ); + uno::Reference< container::XEnumeration > xEnum = xEnumAccess->createEnumeration(); + while ( xEnum->hasMoreElements() ) + { + uno::Reference< excel::XRange > xNextRange( xEnum->nextElement(), uno::UNO_QUERY_THROW ); + ScVbaRange* pRange = dynamic_cast< ScVbaRange * > ( xNextRange.get() ); + if ( pRange ) + pRange->fireChangeEvent(); + } + } + } + } } return sal_True; // always } commit 0ec9b950b1dd0f21891de322597659d794ec2b38 Author: Pedro Giffuni <p...@apache.org> Date: Mon Aug 13 17:05:00 2012 +0000 i106278 - Window.ActiveSheet,Window.FreezePanes,Window.Split, Window.View not working correctly. Patch by: lihuiibm Reviewed by: Chen Peng (cherry picked from commit b1edc65b2ad18720fefb5ba769f2c6f8c46623d6) diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index 925394c..775d4e2 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -597,25 +597,33 @@ ScVbaWindow::getFreezePanes() throw (uno::RuntimeException) } void SAL_CALL -ScVbaWindow::setFreezePanes( ::sal_Bool /*_bFreezePanes*/ ) throw (uno::RuntimeException) +ScVbaWindow::setFreezePanes( ::sal_Bool _bFreezePanes ) throw (uno::RuntimeException) { uno::Reference< sheet::XViewPane > xViewPane( getController(), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XViewSplitable > xViewSplitable( xViewPane, uno::UNO_QUERY_THROW ); uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewPane, uno::UNO_QUERY_THROW ); - if( xViewSplitable->getIsWindowSplit() ) + if( _bFreezePanes ) { - // if there is a split we freeze at the split - sal_Int32 nColumn = getSplitColumn(); - sal_Int32 nRow = getSplitRow(); - xViewFreezable->freezeAtPosition( nColumn, nRow ); + if( xViewSplitable->getIsWindowSplit() ) + { + // if there is a split we freeze at the split + sal_Int32 nColumn = getSplitColumn(); + sal_Int32 nRow = getSplitRow(); + xViewFreezable->freezeAtPosition( nColumn, nRow ); + } + else + { + // otherwise we freeze in the center of the visible sheet + table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); + sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 ); + sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 ); + xViewFreezable->freezeAtPosition( nColumn, nRow ); + } } else { - // otherwise we freeze in the center of the visible sheet - table::CellRangeAddress aCellRangeAddress = xViewPane->getVisibleRange(); - sal_Int32 nColumn = aCellRangeAddress.StartColumn + (( aCellRangeAddress.EndColumn - aCellRangeAddress.StartColumn )/2 ); - sal_Int32 nRow = aCellRangeAddress.StartRow + (( aCellRangeAddress.EndRow - aCellRangeAddress.StartRow )/2 ); - xViewFreezable->freezeAtPosition( nColumn, nRow ); + //remove the freeze panes + xViewSplitable->splitAtPosition(0,0); } } @@ -640,8 +648,7 @@ ScVbaWindow::setSplit( ::sal_Bool _bSplit ) throw (uno::RuntimeException) uno::Reference< excel::XRange > xRange = ActiveCell(); sal_Int32 nRow = xRange->getRow(); sal_Int32 nColumn = xRange->getColumn(); - xViewFreezable->freezeAtPosition( nColumn-1, nRow-1 ); - SplitAtDefinedPosition( sal_True ); + SplitAtDefinedPosition( nColumn-1, nRow-1 ); } } @@ -658,10 +665,8 @@ ScVbaWindow::setSplitColumn( sal_Int32 _splitcolumn ) throw (uno::RuntimeExcepti if( getSplitColumn() != _splitcolumn ) { uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); - sal_Bool bFrozen = getFreezePanes(); sal_Int32 nRow = getSplitRow(); - xViewFreezable->freezeAtPosition( _splitcolumn, nRow ); - SplitAtDefinedPosition( !bFrozen ); + SplitAtDefinedPosition( _splitcolumn, nRow ); } } @@ -684,8 +689,7 @@ sal_Int32 SAL_CALL ScVbaWindow::getSplitRow() throw (uno::RuntimeException) { uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); - sal_Int32 nValue = xViewSplitable->getSplitRow(); - return nValue ? nValue - 1 : nValue; + return xViewSplitable->getSplitRow(); } void SAL_CALL @@ -694,10 +698,8 @@ ScVbaWindow::setSplitRow( sal_Int32 _splitrow ) throw (uno::RuntimeException) if( getSplitRow() != _splitrow ) { uno::Reference< sheet::XViewFreezable > xViewFreezable( getController(), uno::UNO_QUERY_THROW ); - sal_Bool bFrozen = getFreezePanes(); sal_Int32 nColumn = getSplitColumn(); - xViewFreezable->freezeAtPosition( nColumn , _splitrow ); - SplitAtDefinedPosition( !bFrozen ); + SplitAtDefinedPosition( nColumn, _splitrow ); } } @@ -716,15 +718,30 @@ ScVbaWindow::setSplitVertical(double _splitvertical ) throw (uno::RuntimeExcepti xViewSplitable->splitAtPosition( 0, static_cast<sal_Int32>( fVertiPixels ) ); } -void ScVbaWindow::SplitAtDefinedPosition(sal_Bool _bUnFreezePane) +void ScVbaWindow::SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows ) { uno::Reference< sheet::XViewSplitable > xViewSplitable( getController(), uno::UNO_QUERY_THROW ); uno::Reference< sheet::XViewFreezable > xViewFreezable( xViewSplitable, uno::UNO_QUERY_THROW ); - sal_Int32 nVertSplit = xViewSplitable->getSplitVertical(); - sal_Int32 nHoriSplit = xViewSplitable->getSplitHorizontal(); - if( _bUnFreezePane ) - xViewFreezable->freezeAtPosition(0,0); - xViewSplitable->splitAtPosition(nHoriSplit, nVertSplit); + // nColumns and nRows means split columns/rows + if( nColumns == 0 && nRows == 0 ) + return; + + sal_Int32 cellColumn = nColumns + 1; + sal_Int32 cellRow = nRows + 1; + + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); + if ( pViewShell ) + { + //firstly remove the old splitter + xViewSplitable->splitAtPosition(0,0); + + uno::Reference< excel::XApplication > xApplication( Application(), uno::UNO_QUERY_THROW ); + uno::Reference< excel::XWorksheet > xSheet( xApplication->getActiveSheet(), uno::UNO_QUERY_THROW ); + xSheet->Cells(uno::makeAny(cellRow), uno::makeAny(cellColumn))->Select(); + + //pViewShell->FreezeSplitters( FALSE ); + dispatchExecute( pViewShell, SID_WINDOW_SPLIT ); + } } uno::Any SAL_CALL @@ -773,8 +790,18 @@ ScVbaWindow::ActiveSheet( ) throw (script::BasicErrorException, uno::RuntimeExc uno::Any SAL_CALL ScVbaWindow::getView() throw (uno::RuntimeException) { - // not supported now + sal_Bool bPageBreak = sal_False; sal_Int32 nWindowView = excel::XlWindowView::xlNormalView; + + ScTabViewShell* pViewShell = excel::getBestViewShell( m_xModel ); + if (pViewShell) + bPageBreak = pViewShell->GetViewData()->IsPagebreakMode(); + + if( bPageBreak ) + nWindowView = excel::XlWindowView::xlPageBreakPreview; + else + nWindowView = excel::XlWindowView::xlNormalView; + return uno::makeAny( nWindowView ); } diff --git a/sc/source/ui/vba/vbawindow.hxx b/sc/source/ui/vba/vbawindow.hxx index fe57253..51993b2 100644 --- a/sc/source/ui/vba/vbawindow.hxx +++ b/sc/source/ui/vba/vbawindow.hxx @@ -45,7 +45,7 @@ private: css::uno::Reference< css::awt::XDevice > getDevice() throw (css::uno::RuntimeException); protected: - void SplitAtDefinedPosition(sal_Bool _bUnFreezePane); + void SplitAtDefinedPosition( sal_Int32 nColumns, sal_Int32 nRows ); public: void Scroll( const css::uno::Any& Down, const css::uno::Any& Up, const css::uno::Any& ToRight, const css::uno::Any& ToLeft, bool bLargeScroll = false ) throw (css::uno::RuntimeException); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits