Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include <undoflystrattr.hxx>
21 : #include <frmfmt.hxx>
22 :
23 :
24 0 : SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrameFormat& rFlyFrameFormat,
25 : const SwUndoId eUndoId,
26 : const OUString& sOldStr,
27 : const OUString& sNewStr )
28 : : SwUndo( eUndoId ),
29 : mrFlyFrameFormat( rFlyFrameFormat ),
30 : msOldStr( sOldStr ),
31 0 : msNewStr( sNewStr )
32 : {
33 : assert(eUndoId == UNDO_FLYFRMFMT_TITLE
34 : || eUndoId == UNDO_FLYFRMFMT_DESCRIPTION);
35 0 : }
36 :
37 0 : SwUndoFlyStrAttr::~SwUndoFlyStrAttr()
38 : {
39 0 : }
40 :
41 0 : void SwUndoFlyStrAttr::UndoImpl(::sw::UndoRedoContext &)
42 : {
43 0 : switch ( GetId() )
44 : {
45 : case UNDO_FLYFRMFMT_TITLE:
46 : {
47 0 : mrFlyFrameFormat.SetObjTitle( msOldStr, true );
48 : }
49 0 : break;
50 : case UNDO_FLYFRMFMT_DESCRIPTION:
51 : {
52 0 : mrFlyFrameFormat.SetObjDescription( msOldStr, true );
53 : }
54 0 : break;
55 : default:
56 : {
57 : }
58 : }
59 0 : }
60 :
61 0 : void SwUndoFlyStrAttr::RedoImpl(::sw::UndoRedoContext &)
62 : {
63 0 : switch ( GetId() )
64 : {
65 : case UNDO_FLYFRMFMT_TITLE:
66 : {
67 0 : mrFlyFrameFormat.SetObjTitle( msNewStr, true );
68 : }
69 0 : break;
70 : case UNDO_FLYFRMFMT_DESCRIPTION:
71 : {
72 0 : mrFlyFrameFormat.SetObjDescription( msNewStr, true );
73 : }
74 0 : break;
75 : default:
76 : {
77 : }
78 : }
79 0 : }
80 :
81 0 : SwRewriter SwUndoFlyStrAttr::GetRewriter() const
82 : {
83 0 : SwRewriter aResult;
84 :
85 0 : aResult.AddRule( UndoArg1, mrFlyFrameFormat.GetName() );
86 :
87 0 : return aResult;
88 : }
89 :
90 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|