update ooo310-m15
[ooovba.git] / applied_patches / 0447-vba-fix-range-delete-shift.diff
blob16679b2f4b394453afafc15c5045137ce7c45703
1 diff --git sc/source/ui/vba/vbarange.cxx sc/source/ui/vba/vbarange.cxx
2 index 19bf089..9743989 100644
3 --- sc/source/ui/vba/vbarange.cxx
4 +++ sc/source/ui/vba/vbarange.cxx
5 @@ -3317,7 +3317,6 @@ ScVbaRange::characters( const uno::Any& Start, const uno::Any& Length ) throw (u
6 void SAL_CALL
7 ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
9 -
10 if ( m_Areas->getCount() > 1 )
12 sal_Int32 nItems = m_Areas->getCount();
13 @@ -3329,6 +3328,8 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
14 return;
16 sheet::CellDeleteMode mode = sheet::CellDeleteMode_NONE ;
17 + RangeHelper thisRange( mxRange );
18 + table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
19 if ( Shift.hasValue() )
21 sal_Int32 nShift = 0;
22 @@ -3346,13 +3347,17 @@ ScVbaRange::Delete( const uno::Any& Shift ) throw (uno::RuntimeException)
25 else
26 - if ( getRow() > getColumn() )
27 + {
28 + bool bFullRow = ( thisAddress.StartColumn == 0 && thisAddress.EndColumn == MAXCOL );
29 + sal_Int32 nCols = thisAddress.EndColumn - thisAddress.StartColumn;
30 + sal_Int32 nRows = thisAddress.EndRow - thisAddress.StartRow;
31 + if ( mbIsRows || bFullRow || ( nCols >= nRows ) )
32 mode = sheet::CellDeleteMode_UP;
33 else
34 mode = sheet::CellDeleteMode_LEFT;
35 - RangeHelper thisRange( mxRange );
36 + }
37 uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
38 - xCellRangeMove->removeRange( thisRange.getCellRangeAddressable()->getRangeAddress(), mode );
39 + xCellRangeMove->removeRange( thisAddress, mode );