sc/source/ui/view/cellsh2.cxx | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
New commits: commit d4c22dbb1c9d71bb83c218d339df83e8727e469c Author: Dennis Francis <dennisfrancis...@gmail.com> Date: Sat Nov 28 22:47:02 2015 +0530 tdf#73006 : Put results in correct cells after Text to Columns Change-Id: I7a1653424edd93b2de0597ce8a94aa5f4fa85622 Reviewed-on: https://gerrit.libreoffice.org/20258 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Eike Rathke <er...@redhat.com> Tested-by: Eike Rathke <er...@redhat.com> diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index c2c19ba..354ae1f 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -70,7 +70,7 @@ using namespace com::sun::star; -static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange ) +static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange, bool bDoEmptyCheckOnly ) { OSL_ENSURE( pData, "lcl_GetTextToColumnsRange: pData is null!" ); @@ -100,11 +100,28 @@ static bool lcl_GetTextToColumnsRange( const ScViewData* pData, ScRange& rRange const ScDocument* pDoc = pData->GetDocument(); OSL_ENSURE( pDoc, "lcl_GetTextToColumnsRange: pDoc is null!" ); - if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(), - rRange.aStart.Row(), rRange.aEnd.Col(), - rRange.aEnd.Row() ) ) + if ( bDoEmptyCheckOnly ) { - bRet = false; + if ( bRet && pDoc->IsBlockEmpty( rRange.aStart.Tab(), rRange.aStart.Col(), + rRange.aStart.Row(), rRange.aEnd.Col(), + rRange.aEnd.Row() ) ) + { + bRet = false; + } + } + else if ( bRet ) + { + rRange.PutInOrder(); + SCCOL nStartCol = rRange.aStart.Col(), nEndCol = rRange.aEnd.Col(); + SCROW nStartRow = rRange.aStart.Row(), nEndRow = rRange.aEnd.Row(); + bool bShrunk = false; + pDoc->ShrinkToUsedDataArea( bShrunk, rRange.aStart.Tab(), nStartCol, nStartRow, + nEndCol, nEndRow, false, false, true ); + if ( bShrunk ) + { + rRange.aStart.SetRow( nStartRow ); + rRange.aEnd.SetRow( nEndRow ); + } } return bRet; @@ -957,7 +974,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) OSL_ENSURE( pData, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pData is null!" ); ScRange aRange; - if ( lcl_GetTextToColumnsRange( pData, aRange ) ) + if ( lcl_GetTextToColumnsRange( pData, aRange, false ) ) { ScDocument* pDoc = pData->GetDocument(); OSL_ENSURE( pDoc, "ScCellShell::ExecuteDB: SID_TEXT_TO_COLUMNS - pDoc is null!" ); @@ -1195,7 +1212,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) case SID_TEXT_TO_COLUMNS: { ScRange aRange; - if ( !lcl_GetTextToColumnsRange( pData, aRange ) ) + if ( !lcl_GetTextToColumnsRange( pData, aRange, true ) ) { rSet.DisableItem( nWhich ); } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits