2010-10-14 08:30:41 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2011-03-31 10:05:04 +02:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2004-09-08 13:57:44 +00:00
|
|
|
|
2006-09-16 20:48:58 +00:00
|
|
|
|
2004-09-08 13:57:44 +00:00
|
|
|
#include <tools/resid.hxx>
|
2010-11-25 14:31:08 +01:00
|
|
|
|
2004-09-08 13:57:44 +00:00
|
|
|
#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 <doc.hxx>
|
2010-11-25 14:31:08 +01:00
|
|
|
#include <IDocumentUndoRedo.hxx>
|
2004-09-08 13:57:44 +00:00
|
|
|
#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),
|
2011-01-17 15:06:54 +01:00
|
|
|
pDoc(_pDoc), pNewSet(NULL), nId(0), bAuto(sal_False)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2005-01-05 10:47:38 +00:00
|
|
|
if (_pDerivedFrom)
|
|
|
|
sDerivedFrom = _pDerivedFrom->GetName();
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoFmtCreate::~SwUndoFmtCreate()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoFmtCreate::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
if (pNew)
|
|
|
|
{
|
2013-10-10 13:58:38 +02:00
|
|
|
if (sNewName.isEmpty() && pNew)
|
2004-09-08 13:57:44 +00:00
|
|
|
sNewName = pNew->GetName();
|
|
|
|
|
2013-10-10 13:58:38 +02:00
|
|
|
if (!sNewName.isEmpty())
|
2004-09-08 13:57:44 +00:00
|
|
|
pNew = Find(sNewName);
|
|
|
|
|
|
|
|
if (pNew)
|
|
|
|
{
|
|
|
|
pNewSet = new SfxItemSet(pNew->GetAttrSet());
|
|
|
|
nId = pNew->GetPoolFmtId() & COLL_GET_RANGE_BITS;
|
|
|
|
bAuto = pNew->IsAuto();
|
|
|
|
|
|
|
|
Delete();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoFmtCreate::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoFmtCreate::GetRewriter() const
|
|
|
|
{
|
2013-10-10 13:58:38 +02:00
|
|
|
if (sNewName.isEmpty() && pNew)
|
2004-09-08 13:57:44 +00:00
|
|
|
sNewName = pNew->GetName();
|
|
|
|
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aRewriter.AddRule(UndoArg1, sNewName);
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
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()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoFmtDelete::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoFmtDelete::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pOld = Find(sOldName);
|
|
|
|
|
|
|
|
if (pOld)
|
|
|
|
{
|
|
|
|
Delete(pOld);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoFmtDelete::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aRewriter.AddRule(UndoArg1, sOldName);
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
|
|
|
|
2007-09-27 08:28:38 +00:00
|
|
|
SwUndoRenameFmt::SwUndoRenameFmt(SwUndoId nUndoId,
|
2013-10-10 13:58:38 +02:00
|
|
|
const OUString & _sOldName,
|
|
|
|
const OUString & _sNewName,
|
2004-09-08 13:57:44 +00:00
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(nUndoId), sOldName(_sOldName),
|
|
|
|
sNewName(_sNewName), pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SwUndoRenameFmt::~SwUndoRenameFmt()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoRenameFmt::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pFmt = Find(sNewName);
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
{
|
2012-10-28 23:38:30 +09:00
|
|
|
pDoc->RenameFmt(*pFmt, sOldName, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoRenameFmt::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
SwFmt * pFmt = Find(sOldName);
|
|
|
|
|
|
|
|
if (pFmt)
|
|
|
|
{
|
2012-10-28 23:38:30 +09:00
|
|
|
pDoc->RenameFmt(*pFmt, sNewName, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoRenameFmt::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aRewriter.AddRule(UndoArg1, sOldName);
|
|
|
|
aRewriter.AddRule(UndoArg2, SW_RES(STR_YIELDS));
|
|
|
|
aRewriter.AddRule(UndoArg3, sNewName);
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoTxtFmtCollCreate::SwUndoTxtFmtCollCreate
|
|
|
|
(SwTxtFmtColl * _pNew, SwTxtFmtColl * _pDerivedFrom, SwDoc * _pDoc)
|
|
|
|
: SwUndoFmtCreate(UNDO_TXTFMTCOL_CREATE, _pNew, _pDerivedFrom, _pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollCreate::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
return pDoc->MakeTxtFmtColl(sNewName, (SwTxtFmtColl *)pDerivedFrom, sal_True);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoTxtFmtCollCreate::Delete()
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
pDoc->DelTxtFmtColl((SwTxtFmtColl *) pNew, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoTxtFmtCollCreate::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
return pDoc->FindTxtFmtCollByName(rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoTxtFmtCollDelete::SwUndoTxtFmtCollDelete(SwTxtFmtColl * _pOld,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndoFmtDelete(UNDO_TXTFMTCOL_DELETE, _pOld, _pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SwFmt * SwUndoTxtFmtCollDelete::Create(SwFmt * pDerivedFrom)
|
|
|
|
{
|
2011-01-17 15:06:54 +01:00
|
|
|
return pDoc->MakeTxtFmtColl(sOldName, (SwTxtFmtColl *) pDerivedFrom, sal_True);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoTxtFmtCollDelete::Delete(SwFmt * pOld)
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
pDoc->DelTxtFmtColl((SwTxtFmtColl *) pOld, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoTxtFmtCollDelete::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
return pDoc->FindTxtFmtCollByName(rName);
|
|
|
|
}
|
|
|
|
|
2013-10-10 13:58:38 +02:00
|
|
|
SwUndoRenameFmtColl::SwUndoRenameFmtColl(const OUString & sInitOldName,
|
|
|
|
const OUString & 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
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoRenameFmtColl::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
return pDoc->MakeCharFmt(sNewName, (SwCharFmt *) pDerivedFrom, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoCharFmtCreate::Delete()
|
|
|
|
{
|
2012-10-23 18:35:04 +09:00
|
|
|
pDoc->DelCharFmt((SwCharFmt *) pNew, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoCharFmtCreate::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
return pDoc->MakeCharFmt(sOldName, (SwCharFmt *) pDerivedFrom, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoCharFmtDelete::Delete(SwFmt * pFmt)
|
|
|
|
{
|
2012-10-23 18:35:04 +09:00
|
|
|
pDoc->DelCharFmt((SwCharFmt *) pFmt, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoCharFmtDelete::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
return pDoc->FindCharFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2013-10-10 13:58:38 +02:00
|
|
|
SwUndoRenameCharFmt::SwUndoRenameCharFmt(const OUString & sInitOldName,
|
|
|
|
const OUString & sInitNewName,
|
2007-09-27 08:28:38 +00:00
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoRenameFmt(UNDO_CHARFMT_RENAME, sInitOldName, sInitNewName, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoRenameCharFmt::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
return pDoc->MakeFrmFmt(sNewName, (SwFrmFmt *) pDerivedFrom, true, bAuto);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoFrmFmtCreate::Delete()
|
|
|
|
{
|
2012-10-23 18:35:04 +09:00
|
|
|
pDoc->DelFrmFmt((SwFrmFmt *) pNew, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoFrmFmtCreate::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2012-10-25 17:01:26 +09:00
|
|
|
return pDoc->MakeFrmFmt(sOldName, (SwFrmFmt *) pDerivedFrom, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void SwUndoFrmFmtDelete::Delete(SwFmt * pFmt)
|
|
|
|
{
|
2012-10-23 18:35:04 +09:00
|
|
|
pDoc->DelFrmFmt((SwFrmFmt *) pFmt, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoFrmFmtDelete::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
return pDoc->FindFrmFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
2013-10-10 13:58:38 +02:00
|
|
|
SwUndoRenameFrmFmt::SwUndoRenameFrmFmt(const OUString & sInitOldName,
|
|
|
|
const OUString & sInitNewName,
|
2007-09-27 08:28:38 +00:00
|
|
|
SwDoc * pDocument)
|
|
|
|
: SwUndoRenameFmt(UNDO_FRMFMT_RENAME, sInitOldName, sInitNewName, pDocument)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2013-07-05 16:25:03 -05:00
|
|
|
SwFmt * SwUndoRenameFrmFmt::Find(const OUString & rName) const
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
return pDoc->FindFrmFmtByName(rName);
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoNumruleCreate::SwUndoNumruleCreate(const SwNumRule * _pNew,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_CREATE), pNew(_pNew), aNew(*_pNew), pDoc(_pDoc),
|
|
|
|
bInitialized(false)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleCreate::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
|
|
|
if (! bInitialized)
|
|
|
|
{
|
|
|
|
aNew = *pNew;
|
|
|
|
bInitialized = true;
|
|
|
|
}
|
|
|
|
|
2012-11-01 08:19:50 +09:00
|
|
|
pDoc->DelNumRule(aNew.GetName(), true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleCreate::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2012-11-03 12:18:57 +09:00
|
|
|
pDoc->MakeNumRule(aNew.GetName(), &aNew, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleCreate::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aResult;
|
|
|
|
|
|
|
|
if (! bInitialized)
|
|
|
|
{
|
|
|
|
aNew = *pNew;
|
|
|
|
bInitialized = true;
|
|
|
|
}
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aResult.AddRule(UndoArg1, aNew.GetName());
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
|
|
|
SwUndoNumruleDelete::SwUndoNumruleDelete(const SwNumRule & rRule,
|
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_DELETE), aOld(rRule), pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleDelete::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2012-11-03 12:18:57 +09:00
|
|
|
pDoc->MakeNumRule(aOld.GetName(), &aOld, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleDelete::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2012-11-01 08:19:50 +09:00
|
|
|
pDoc->DelNumRule(aOld.GetName(), true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleDelete::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aResult;
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aResult.AddRule(UndoArg1, aOld.GetName());
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
return aResult;
|
|
|
|
}
|
|
|
|
|
2013-10-10 13:58:38 +02:00
|
|
|
SwUndoNumruleRename::SwUndoNumruleRename(const OUString & _aOldName,
|
|
|
|
const OUString & _aNewName,
|
2004-09-08 13:57:44 +00:00
|
|
|
SwDoc * _pDoc)
|
|
|
|
: SwUndo(UNDO_NUMRULE_RENAME), aOldName(_aOldName), aNewName(_aNewName),
|
|
|
|
pDoc(_pDoc)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleRename::UndoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2012-11-01 08:19:50 +09:00
|
|
|
pDoc->RenameNumRule(aNewName, aOldName, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
2010-12-15 09:14:11 +01:00
|
|
|
void SwUndoNumruleRename::RedoImpl(::sw::UndoRedoContext &)
|
2004-09-08 13:57:44 +00:00
|
|
|
{
|
2012-11-01 08:19:50 +09:00
|
|
|
pDoc->RenameNumRule(aOldName, aNewName, true);
|
2004-09-08 13:57:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SwRewriter SwUndoNumruleRename::GetRewriter() const
|
|
|
|
{
|
|
|
|
SwRewriter aRewriter;
|
|
|
|
|
2012-04-02 09:34:41 +01:00
|
|
|
aRewriter.AddRule(UndoArg1, aOldName);
|
|
|
|
aRewriter.AddRule(UndoArg2, SW_RESSTR(STR_YIELDS));
|
|
|
|
aRewriter.AddRule(UndoArg3, aNewName);
|
2004-09-08 13:57:44 +00:00
|
|
|
|
|
|
|
return aRewriter;
|
|
|
|
}
|
2010-10-14 08:30:41 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|