android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / undo / undoflystrattr.cxx
blob60d8da4e95af13a796468d4d61049db3790a67b2
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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>
21 #include <frmfmt.hxx>
22 #include <utility>
25 SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrameFormat& rFlyFrameFormat,
26 const SwUndoId eUndoId,
27 OUString sOldStr,
28 OUString sNewStr )
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 &)
44 switch ( GetId() )
46 case SwUndoId::FLYFRMFMT_TITLE:
48 mrFlyFrameFormat.SetObjTitle( msOldStr, true );
50 break;
51 case SwUndoId::FLYFRMFMT_DESCRIPTION:
53 mrFlyFrameFormat.SetObjDescription( msOldStr, true );
55 break;
56 default:
62 void SwUndoFlyStrAttr::RedoImpl(::sw::UndoRedoContext &)
64 switch ( GetId() )
66 case SwUndoId::FLYFRMFMT_TITLE:
68 mrFlyFrameFormat.SetObjTitle( msNewStr, true );
70 break;
71 case SwUndoId::FLYFRMFMT_DESCRIPTION:
73 mrFlyFrameFormat.SetObjDescription( msNewStr, true );
75 break;
76 default:
82 SwRewriter SwUndoFlyStrAttr::GetRewriter() const
84 SwRewriter aResult;
86 aResult.AddRule( UndoArg1, mrFlyFrameFormat.GetName() );
88 return aResult;
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
115 SwRewriter aResult;
117 aResult.AddRule(UndoArg1, m_rFlyFrameFormat.GetName());
119 return aResult;
122 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */