diff options
author | Laurent Balland-Poirier <laurent.balland-poirier@laposte.net> | 2016-07-20 09:24:13 +0200 |
---|---|---|
committer | Laurent BP <laurent.balland-poirier@laposte.net> | 2016-08-16 19:21:32 +0000 |
commit | 0da121bc6702b8ae1859708c7e5532f7b97e4c2a (patch) | |
tree | 42cbefafe67c20d71e2eddb2779ce4f77b9ed768 /sc/source/ui/docshell | |
parent | 6e44bb1b67f41dc7dbf15fe4502578a38ac59738 (diff) |
tdf#30456 Enable to empty or not merged cells
Insert options during MergeCells to empty hidden cells
Three options:
- Move contents to first cell (previous Yes)
- Keep contents in covered cells (previous No, default)
- Empty covered cells (new option)
To be done: link to the help system
https://gerrit.libreoffice.org/27467/
Change-Id: I98e85296591cce8ba789d282cead1f1010e5e2ce
Reviewed-on: https://gerrit.libreoffice.org/27463
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Laurent BP <laurent.balland-poirier@laposte.net>
Diffstat (limited to 'sc/source/ui/docshell')
-rw-r--r-- | sc/source/ui/docshell/docfunc.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 69550297d555..b72da3a7a935 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -4673,7 +4673,7 @@ bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir e return true; } -bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bool bRecord, bool bApi ) +bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bool bRecord, bool bApi, bool bEmptyMergedCells /*=false*/ ) { using ::std::set; @@ -4721,9 +4721,12 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo for (set<SCTAB>::const_iterator itr = itrBeg; itr != itrEnd; ++itr) { SCTAB nTab = *itr; - bool bNeedContents = bContents && - ( !rDoc.IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) || - !rDoc.IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) ); + bool bIsBlockEmpty = ( nStartRow == nEndRow ) + ? rDoc.IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ) + : rDoc.IsBlockEmpty( nTab, nStartCol,nStartRow+1, nStartCol,nEndRow, true ) && + rDoc.IsBlockEmpty( nTab, nStartCol+1,nStartRow, nEndCol,nEndRow, true ); + bool bNeedContents = bContents && !bIsBlockEmpty; + bool bNeedEmpty = bEmptyMergedCells && !bIsBlockEmpty && !bNeedContents; // if DoMergeContents then cells are emptyed if (bRecord) { @@ -4747,6 +4750,8 @@ bool ScDocFunc::MergeCells( const ScCellMergeOption& rOption, bool bContents, bo if (bNeedContents) rDoc.DoMergeContents( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); + else if ( bNeedEmpty ) + rDoc.DoEmptyBlock( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); rDoc.DoMerge( nTab, nStartCol,nStartRow, nEndCol,nEndRow ); if (rOption.mbCenter) |