2004-09-08 13:57:44 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
2008-04-10 15:02:38 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2004-09-08 13:57:44 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
|
2006-09-16 20:48:58 +00:00
|
|
|
// MARKER(update_precomp.py): autogen include statement, do not remove
|
|
|
|
#include "precompiled_sw.hxx"
|
|
|
|
|
2004-09-08 13:57:44 +00:00
|
|
|
#include <tools/resid.hxx>
|
|
|
|
#include <poolfmt.hxx>
|
|
|
|
#include <charfmt.hxx>
|
|
|
|
#include <frmfmt.hxx>
|
|
|
|
#include <SwUndoFmt.hxx>
|
|
|
|
#include <SwRewriter.hxx>
|
|
|
|
#include <swundo.hxx>
|
|
|
|
#include <undobj.hxx>
|
|
|
|
#include <fmtcol.hxx>
|
|
|
|
#include <tools/string.hxx>
|
|
|
|
#include <doc.hxx>
|
|
|
|
#include <comcore.hrc>
|
|
|
|
|
|
|
|
SwUndoFmtCreate::SwUndoFmtCreate
|
2007-09-27 08:28:38 +00:00
|
|
|
(SwUndoId nUndoId, SwFmt * _pNew, SwFmt * _pDerivedFrom, SwDoc * _pDoc)
|
2004-09-08 13:57:44 +00:00
|
|
|
: SwUndo(nUndoId), pNew(_pNew),
|
|
|
|
pDoc(_pDoc), pNewSet(NULL), nId(0), bAuto(FALSE)
|
|
|
|
{
|
2005-01-05 10:47:38 +00:00
|
|
|
if (_pDerivedFrom)
|
|
|
|
sDerivedFrom = _pDerivedFrom->GetName();
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoFmtCreate::~SwUndoFmtCreate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoFmtCreate::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
if (pNew)
|
|
|
|
{
|
|
|
|
if (sNewName.Len() == 0 && pNew)
|
|
|
|
sNewName = pNew->GetName();
|
|
|
|
|
|
|
|
if (sNewName.Len() > 0)
|
|
|
|
pNew = Find(sNewName);
|
|
|
|
|
|
|
|
if (pNew)
|
|
|
|
{
|
|
|
|
pNewSet = new SfxItemSet(pNew->GetAttrSet());
|
|
|
|
nId = pNew->GetPoolFmtId() & COLL_GET_RANGE_BITS;
|
|
|
|
bAuto = pNew->IsAuto();
|
|
|
|
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
Delete();
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoFmtCreate::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
SwFmt * pDerivedFrom = Find(sDerivedFrom);
|
|
|
|
SwFmt * pFmt = Create(pDerivedFrom);
|
|
|
|
|
|
|
|
if (pFmt && pNewSet)
|
|
|
|
{
|
|
|
|
pFmt->SetAuto(bAuto);
|
|
|
|
pDoc->ChgFmt(*pFmt, *pNewSet);
|
|
|
|
pFmt->SetPoolFmtId((pFmt->GetPoolFmtId()
|
|
|
|
& ~COLL_GET_RANGE_BITS)
|
|
|
|
| nId);
|
|
|
|
|
|
|
|
pNew = pFmt;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
pNew = NULL;
|
|
|
|
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoFmtCreate::GetRewriter() const
|
|
|
|
{
|
|
|
|
if (sNewName.Len() == 0 && pNew)
|
|
|
|
sNewName = pNew->GetName();
|
|
|
|
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
|
|
|
aRewriter.AddRule(UNDO_ARG1, sNewName);
|
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoFmtDelete::SwUndoFmtDelete
|
2007-09-27 08:28:38 +00:00
|
|
|
(SwUndoId nUndoId, SwFmt * _pOld, SwDoc * _pDoc)
|
2004-09-08 13:57:44 +00:00
|
|
|
: SwUndo(nUndoId),
|
|
|
|
pDoc(_pDoc), sOldName(_pOld->GetName()),
|
|
|
|
aOldSet(_pOld->GetAttrSet())
|
|
|
|
{
|
|
|
|
sDerivedFrom = _pOld->DerivedFrom()->GetName();
|
|
|
|
nId = _pOld->GetPoolFmtId() & COLL_GET_RANGE_BITS;
|
|
|
|
bAuto = _pOld->IsAuto();
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoFmtDelete::~SwUndoFmtDelete()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoFmtDelete::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
|
|
|
|
SwFmt * pDerivedFrom = Find(sDerivedFrom);
|
|
|
|
|
|
|
|
SwFmt * pFmt = Create(pDerivedFrom);
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
{
|
|
|
|
pDoc->ChgFmt(*pFmt, aOldSet);
|
|
|
|
pFmt->SetAuto(bAuto);
|
|
|
|
pFmt->SetPoolFmtId((pFmt->GetPoolFmtId() &
|
|
|
|
~COLL_GET_RANGE_BITS)
|
|
|
|
| nId);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoFmtDelete::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pOld = Find(sOldName);
|
|
|
|
|
|
|
|
if (pOld)
|
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
Delete(pOld);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoFmtDelete::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
|
|
|
aRewriter.AddRule(UNDO_ARG1, sOldName);
|
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoRenameFmt::SwUndoRenameFmt(SwUndoId nUndoId,
|
2004-09-08 13:57:44 +00:00
|
|
|
const String & _sOldName,
|
|
|
|
const String & _sNewName,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(nUndoId), sOldName(_sOldName),
|
|
|
|
sNewName(_sNewName), pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwUndoRenameFmt::~SwUndoRenameFmt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoRenameFmt::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pFmt = Find(sNewName);
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->RenameFmt(*pFmt, sOldName, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoRenameFmt::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pFmt = Find(sOldName);
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->RenameFmt(*pFmt, sNewName, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoRenameFmt::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
|
|
|
aRewriter.AddRule(UNDO_ARG1, sOldName);
|
|
|
|
aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
|
|
|
|
aRewriter.AddRule(UNDO_ARG3, sNewName);
|
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoTxtFmtCollCreate::SwUndoTxtFmtCollCreate
|
|
|
|
(SwTxtFmtColl * _pNew, SwTxtFmtColl * _pDerivedFrom, SwDoc * _pDoc)
|
|
|
|
: SwUndoFmtCreate(UNDO_TXTFMTCOL_CREATE, _pNew, _pDerivedFrom, _pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollCreate::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
|
|
|
return pDoc->MakeTxtFmtColl(sNewName, (SwTxtFmtColl *)pDerivedFrom, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoTxtFmtCollCreate::Delete()
|
|
|
|
{
|
|
|
|
pDoc->DelTxtFmtColl((SwTxtFmtColl *) pNew, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollCreate::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindTxtFmtCollByName(rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoTxtFmtCollDelete::SwUndoTxtFmtCollDelete(SwTxtFmtColl * _pOld,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndoFmtDelete(UNDO_TXTFMTCOL_DELETE, _pOld, _pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollDelete::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
|
|
|
return pDoc->MakeTxtFmtColl(sOldName, (SwTxtFmtColl *) pDerivedFrom, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoTxtFmtCollDelete::Delete(SwFmt * pOld)
|
|
|
|
{
|
|
|
|
pDoc->DelTxtFmtColl((SwTxtFmtColl *) pOld, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollDelete::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindTxtFmtCollByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoRenameFmtColl::SwUndoRenameFmtColl(const String & sInitOldName,
|
|
|
|
const String & sInitNewName,
|
2004-09-08 13:57:44 +00:00
|
|
|
SwDoc * _pDoc)
|
2007-09-27 08:28:38 +00:00
|
|
|
: SwUndoRenameFmt(UNDO_TXTFMTCOL_RENAME, sInitOldName, sInitNewName, _pDoc)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoRenameFmtColl::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindTxtFmtCollByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoCharFmtCreate::SwUndoCharFmtCreate(SwCharFmt * pNewFmt,
|
2004-09-08 13:57:44 +00:00
|
|
|
SwCharFmt * pDerivedFrom,
|
2007-09-27 08:28:38 +00:00
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoFmtCreate(UNDO_CHARFMT_CREATE, pNewFmt, pDerivedFrom, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoCharFmtCreate::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
|
|
|
return pDoc->MakeCharFmt(sNewName, (SwCharFmt *) pDerivedFrom, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoCharFmtCreate::Delete()
|
|
|
|
{
|
|
|
|
pDoc->DelCharFmt((SwCharFmt *) pNew, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoCharFmtCreate::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindCharFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoCharFmtDelete::SwUndoCharFmtDelete(SwCharFmt * pOld, SwDoc * pDocument)
|
|
|
|
: SwUndoFmtDelete(UNDO_CHARFMT_DELETE, pOld, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoCharFmtDelete::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
|
|
|
return pDoc->MakeCharFmt(sOldName, (SwCharFmt *) pDerivedFrom, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoCharFmtDelete::Delete(SwFmt * pFmt)
|
|
|
|
{
|
|
|
|
pDoc->DelCharFmt((SwCharFmt *) pFmt, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoCharFmtDelete::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindCharFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoRenameCharFmt::SwUndoRenameCharFmt(const String & sInitOldName,
|
|
|
|
const String & sInitNewName,
|
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoRenameFmt(UNDO_CHARFMT_RENAME, sInitOldName, sInitNewName, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoRenameCharFmt::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindCharFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoFrmFmtCreate::SwUndoFrmFmtCreate(SwFrmFmt * pNewFmt,
|
2004-09-08 13:57:44 +00:00
|
|
|
SwFrmFmt * pDerivedFrom,
|
2007-09-27 08:28:38 +00:00
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoFmtCreate(UNDO_FRMFMT_CREATE, pNewFmt, pDerivedFrom, pDocument),
|
|
|
|
bAuto(pNewFmt->IsAuto())
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoFrmFmtCreate::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
2005-01-05 10:47:38 +00:00
|
|
|
return pDoc->MakeFrmFmt(sNewName, (SwFrmFmt *) pDerivedFrom, TRUE, bAuto);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoFrmFmtCreate::Delete()
|
|
|
|
{
|
|
|
|
pDoc->DelFrmFmt((SwFrmFmt *) pNew, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoFrmFmtCreate::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindFrmFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoFrmFmtDelete::SwUndoFrmFmtDelete(SwFrmFmt * pOld, SwDoc * pDocument)
|
|
|
|
: SwUndoFmtDelete(UNDO_FRMFMT_DELETE, pOld, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoFrmFmtDelete::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
|
|
|
return pDoc->MakeFrmFmt(sOldName, (SwFrmFmt *) pDerivedFrom, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoFrmFmtDelete::Delete(SwFmt * pFmt)
|
|
|
|
{
|
|
|
|
pDoc->DelFrmFmt((SwFrmFmt *) pFmt, TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoFrmFmtDelete::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindFrmFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoRenameFrmFmt::SwUndoRenameFrmFmt(const String & sInitOldName,
|
|
|
|
const String & sInitNewName,
|
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoRenameFmt(UNDO_FRMFMT_RENAME, sInitOldName, sInitNewName, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoRenameFrmFmt::Find(const String & rName) const
|
|
|
|
{
|
|
|
|
return pDoc->FindFrmFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoNumruleCreate::SwUndoNumruleCreate(const SwNumRule * _pNew,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_CREATE), pNew(_pNew), aNew(*_pNew), pDoc(_pDoc),
|
|
|
|
bInitialized(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleCreate::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
|
|
|
|
if (! bInitialized)
|
|
|
|
{
|
|
|
|
aNew = *pNew;
|
|
|
|
bInitialized = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
pDoc->DelNumRule(aNew.GetName(), TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleCreate::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->MakeNumRule(aNew.GetName(), &aNew, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleCreate::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aResult;
|
|
|
|
|
|
|
|
if (! bInitialized)
|
|
|
|
{
|
|
|
|
aNew = *pNew;
|
|
|
|
bInitialized = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
aResult.AddRule(UNDO_ARG1, aNew.GetName());
|
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoNumruleDelete::SwUndoNumruleDelete(const SwNumRule & rRule,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_DELETE), aOld(rRule), pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleDelete::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->MakeNumRule(aOld.GetName(), &aOld, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleDelete::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->DelNumRule(aOld.GetName(), TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleDelete::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aResult;
|
|
|
|
|
|
|
|
aResult.AddRule(UNDO_ARG1, aOld.GetName());
|
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoNumruleRename::SwUndoNumruleRename(const String & _aOldName,
|
|
|
|
const String & _aNewName,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_RENAME), aOldName(_aOldName), aNewName(_aNewName),
|
|
|
|
pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleRename::Undo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->RenameNumRule(aNewName, aOldName, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
void SwUndoNumruleRename::Redo(SwUndoIter &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
BOOL bDoesUndo = pDoc->DoesUndo();
|
|
|
|
|
|
|
|
pDoc->DoUndo(FALSE);
|
|
|
|
pDoc->RenameNumRule(aOldName, aNewName, TRUE);
|
|
|
|
pDoc->DoUndo(bDoesUndo);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleRename::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
|
|
|
aRewriter.AddRule(UNDO_ARG1, aOldName);
|
|
|
|
aRewriter.AddRule(UNDO_ARG2, SW_RES(STR_YIELDS));
|
|
|
|
aRewriter.AddRule(UNDO_ARG3, aNewName);
|
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|