1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <undoflystrattr.hxx>
25 SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrameFormat
& rFlyFrameFormat
,
26 const SwUndoId eUndoId
,
29 : SwUndo( eUndoId
, rFlyFrameFormat
.GetDoc() ),
30 mrFlyFrameFormat( rFlyFrameFormat
),
31 msOldStr(std::move( sOldStr
)),
32 msNewStr(std::move( sNewStr
))
34 assert(eUndoId
== SwUndoId::FLYFRMFMT_TITLE
35 || eUndoId
== SwUndoId::FLYFRMFMT_DESCRIPTION
);
38 SwUndoFlyStrAttr::~SwUndoFlyStrAttr()
42 void SwUndoFlyStrAttr::UndoImpl(::sw::UndoRedoContext
&)
46 case SwUndoId::FLYFRMFMT_TITLE
:
48 mrFlyFrameFormat
.SetObjTitle( msOldStr
, true );
51 case SwUndoId::FLYFRMFMT_DESCRIPTION
:
53 mrFlyFrameFormat
.SetObjDescription( msOldStr
, true );
62 void SwUndoFlyStrAttr::RedoImpl(::sw::UndoRedoContext
&)
66 case SwUndoId::FLYFRMFMT_TITLE
:
68 mrFlyFrameFormat
.SetObjTitle( msNewStr
, true );
71 case SwUndoId::FLYFRMFMT_DESCRIPTION
:
73 mrFlyFrameFormat
.SetObjDescription( msNewStr
, true );
82 SwRewriter
SwUndoFlyStrAttr::GetRewriter() const
86 aResult
.AddRule( UndoArg1
, mrFlyFrameFormat
.GetName() );
91 SwUndoFlyDecorative::SwUndoFlyDecorative(SwFlyFrameFormat
& rFlyFrameFormat
,
92 bool const isDecorative
)
93 : SwUndo(SwUndoId::FLYFRMFMT_DECORATIVE
, rFlyFrameFormat
.GetDoc())
94 , m_rFlyFrameFormat(rFlyFrameFormat
)
95 , m_IsDecorative(isDecorative
)
99 SwUndoFlyDecorative::~SwUndoFlyDecorative()
103 void SwUndoFlyDecorative::UndoImpl(::sw::UndoRedoContext
&)
105 m_rFlyFrameFormat
.SetObjDecorative(!m_IsDecorative
);
108 void SwUndoFlyDecorative::RedoImpl(::sw::UndoRedoContext
&)
110 m_rFlyFrameFormat
.SetObjDecorative(m_IsDecorative
);
113 SwRewriter
SwUndoFlyDecorative::GetRewriter() const
117 aResult
.AddRule(UndoArg1
, m_rFlyFrameFormat
.GetName());
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */