summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewfun2.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sc/source/ui/view/viewfun2.cxx')
-rw-r--r--sc/source/ui/view/viewfun2.cxx28
1 files changed, 21 insertions, 7 deletions
diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx
index 2251efd4dd32..c9d38d2a999f 100644
--- a/sc/source/ui/view/viewfun2.cxx
+++ b/sc/source/ui/view/viewfun2.cxx
@@ -86,6 +86,7 @@
#include <rowheightcontext.hxx>
#include <LibreOfficeKit/LibreOfficeKitEnums.h>
#include <comphelper/lok.hxx>
+#include "mergecellsdialog.hxx"
#include <vector>
#include <memory>
@@ -1081,19 +1082,32 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
}
bool bOk = true;
+ bool bEmptyMergedCells = false;
if (bAskDialog)
{
if (!bApi)
{
- ScopedVclPtrInstance<MessBox> aBox( GetViewData().GetDialogParent(),
- WinBits(WB_YES_NO_CANCEL | WB_DEF_NO),
- ScGlobal::GetRscString( STR_MSSG_DOSUBTOTALS_0 ),
- ScGlobal::GetRscString( STR_MERGE_NOTEMPTY ) );
+ VclPtr<ScMergeCellsDialog> aBox = VclPtr<ScMergeCellsDialog>::Create( GetViewData().GetDialogParent() );
sal_uInt16 nRetVal = aBox->Execute();
- if ( nRetVal == RET_YES )
- rDoContents = true;
+ if ( nRetVal == RET_OK )
+ {
+ switch ( aBox->GetMergeCellsOption() )
+ {
+ case MoveContentHiddenCells:
+ rDoContents = true;
+ break;
+ case KeepContentHiddenCells:
+ break; // keep default values
+ case EmptyContentHiddenCells:
+ bEmptyMergedCells = true;
+ break;
+ default:
+ assert(!"Unknown option for merge cells.");
+ break;
+ }
+ }
else if ( nRetVal == RET_CANCEL )
bOk = false;
}
@@ -1101,7 +1115,7 @@ bool ScViewFunc::MergeCells( bool bApi, bool& rDoContents, bool bCenter )
if (bOk)
{
- bOk = pDocSh->GetDocFunc().MergeCells( aMergeOption, rDoContents, true/*bRecord*/, bApi );
+ bOk = pDocSh->GetDocFunc().MergeCells( aMergeOption, rDoContents, true/*bRecord*/, bApi, bEmptyMergedCells );
if (bOk)
{