summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-04-03 11:19:10 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2015-04-08 12:05:27 +0000
commitd1b2478379ac79664f667d55abda1bc05ab8403c (patch)
tree26253f12e1f91780546dab50c754f82396d8452c /sw
parent784ff3f0765eb94d025ef789f15ef10f51b8cc15 (diff)
Resolves: tdf#90099 group new style and change style together as one undo
(cherry picked from commit 39f306df1d5f8daa4747f1e3b26e853c001669f5) Change-Id: I978f503fabce69bb08a892c47d07ff8fa43c73b5 Reviewed-on: https://gerrit.libreoffice.org/15136 Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com> Tested-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/uibase/app/docst.cxx32
1 files changed, 30 insertions, 2 deletions
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 8307399540e2..0190577cd273 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -632,8 +632,17 @@ sal_uInt16 SwDocShell::Edit(
sal_uInt16 nRet = nMask;
bool bModified = mpDoc->getIDocumentState().IsModified();
+ SwUndoId nNewStyleUndoId(UNDO_EMPTY);
+
if( bNew )
{
+ if (!bBasic)
+ {
+ // start undo action in order to get only one undo action for the
+ // UI new style + change style operations
+ mpWrtShell->StartUndo();
+ }
+
if( SFXSTYLEBIT_ALL != nMask && SFXSTYLEBIT_ALL_VISIBLE != nMask && SFXSTYLEBIT_USED != nMask )
nMask |= SFXSTYLEBIT_USERDEF;
else
@@ -720,6 +729,13 @@ sal_uInt16 SwDocShell::Edit(
}
break;
}
+
+ if (!bBasic)
+ {
+ //Get the undo id for the type of style that was created in order to re-use that comment for the grouped
+ //create style + change style operations
+ mpWrtShell->GetLastUndoInfo(0, &nNewStyleUndoId);
+ }
}
else
{
@@ -784,11 +800,23 @@ sal_uInt16 SwDocShell::Edit(
ApplyStyle aApplyStyleHelper(*this, bNew, pStyle, nRet, xTmp, nFamily, pDlg.get(), mxBasePool, bModified);
pDlg->SetApplyHdl(LINK(&aApplyStyleHelper, ApplyStyle, ApplyHdl));
- if (RET_OK == pDlg->Execute())
+ short nDlgRet = pDlg->Execute();
+
+ if (RET_OK == nDlgRet)
{
aApplyStyleHelper.apply();
}
- else
+
+ if (bNew)
+ {
+ SwRewriter aRewriter;
+ aRewriter.AddRule(UndoArg1, xTmp->GetName());
+ //Group the create style and change style operations together under the
+ //one "create style" comment
+ mpWrtShell->EndUndo(nNewStyleUndoId, &aRewriter);
+ }
+
+ if (RET_OK != nDlgRet)
{
if( bNew )
{