update ooo310-m15
[ooovba.git] / applied_patches / 0433-vba-fix-Range-Insert-CopyOrigin.diff
blob9484b6c76fb9ae9ba175d5927581f07e74c4e65c
1 --- sc/source/ui/vba/vbarange.cxx 2009-04-27 18:35:48.000000000 +0100
2 +++ sc/source/ui/vba/vbarange.cxx 2009-04-27 19:41:46.000000000 +0100
3 @@ -4340,8 +4340,10 @@ ScVbaRange::AutoFilter( const uno::Any&
6 void SAL_CALL
7 -ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& /*CopyOrigin*/ ) throw (uno::RuntimeException)
8 +ScVbaRange::Insert( const uno::Any& Shift, const uno::Any& CopyOrigin ) throw (uno::RuntimeException)
10 + sal_Bool bCopyOrigin = sal_True;
11 + CopyOrigin >>= bCopyOrigin;
12 // It appears ( from the web ) that the undocumented CopyOrigin
13 // param should contain member of enum XlInsertFormatOrigin
14 // which can have values xlFormatFromLeftOrAbove or xlFormatFromRightOrBelow
15 @@ -4373,8 +4375,17 @@ ScVbaRange::Insert( const uno::Any& Shif
16 mode = sheet::CellInsertMode_RIGHT;
18 RangeHelper thisRange( mxRange );
19 + table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress();
20 uno::Reference< sheet::XCellRangeMovement > xCellRangeMove( thisRange.getSpreadSheet(), uno::UNO_QUERY_THROW );
21 - xCellRangeMove->insertCells( thisRange.getCellRangeAddressable()->getRangeAddress(), mode );
22 + xCellRangeMove->insertCells( thisAddress, mode );
23 + if ( bCopyOrigin )
24 + {
25 + // After the insert ( this range ) actually has moved
26 + ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) );
27 + uno::Reference< table::XCellRange > xRange( new ScCellRangeObj( getDocShellFromRange( mxRange ) , aRange ) );
28 + uno::Reference< excel::XRange > xVbaRange( new ScVbaRange( getParent(), mxContext, xRange, mbIsRows, mbIsColumns ) );
29 + xVbaRange->PasteSpecial( uno::Any(), uno::Any(), uno::Any(), uno::Any() );
30 + }
33 void SAL_CALL