Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <undoflystrattr.hxx>
31 : : #include <frmfmt.hxx>
32 : :
33 : 0 : SwUndoFlyStrAttr::SwUndoFlyStrAttr( SwFlyFrmFmt& rFlyFrmFmt,
34 : : const SwUndoId eUndoId,
35 : : const String& sOldStr,
36 : : const String& sNewStr )
37 : : : SwUndo( eUndoId ),
38 : : mrFlyFrmFmt( rFlyFrmFmt ),
39 : : msOldStr( sOldStr ),
40 [ # # ][ # # ]: 0 : msNewStr( sNewStr )
41 : : {
42 : : OSL_ENSURE( eUndoId == UNDO_FLYFRMFMT_TITLE ||
43 : : eUndoId == UNDO_FLYFRMFMT_DESCRIPTION,
44 : : "<SwUndoFlyStrAttr::SwUndoFlyStrAttr(..)> - unexpected undo id --> Undo will not work" );
45 : 0 : }
46 : :
47 [ # # ][ # # ]: 0 : SwUndoFlyStrAttr::~SwUndoFlyStrAttr()
48 : : {
49 [ # # ]: 0 : }
50 : :
51 : 0 : void SwUndoFlyStrAttr::UndoImpl(::sw::UndoRedoContext &)
52 : : {
53 [ # # # ]: 0 : switch ( GetId() )
54 : : {
55 : : case UNDO_FLYFRMFMT_TITLE:
56 : : {
57 : 0 : mrFlyFrmFmt.SetObjTitle( msOldStr, true );
58 : : }
59 : 0 : break;
60 : : case UNDO_FLYFRMFMT_DESCRIPTION:
61 : : {
62 : 0 : mrFlyFrmFmt.SetObjDescription( msOldStr, true );
63 : : }
64 : 0 : break;
65 : : default:
66 : : {
67 : : }
68 : : }
69 : 0 : }
70 : :
71 : 0 : void SwUndoFlyStrAttr::RedoImpl(::sw::UndoRedoContext &)
72 : : {
73 [ # # # ]: 0 : switch ( GetId() )
74 : : {
75 : : case UNDO_FLYFRMFMT_TITLE:
76 : : {
77 : 0 : mrFlyFrmFmt.SetObjTitle( msNewStr, true );
78 : : }
79 : 0 : break;
80 : : case UNDO_FLYFRMFMT_DESCRIPTION:
81 : : {
82 : 0 : mrFlyFrmFmt.SetObjDescription( msNewStr, true );
83 : : }
84 : 0 : break;
85 : : default:
86 : : {
87 : : }
88 : : }
89 : 0 : }
90 : :
91 : 0 : SwRewriter SwUndoFlyStrAttr::GetRewriter() const
92 : : {
93 : 0 : SwRewriter aResult;
94 : :
95 [ # # ]: 0 : aResult.AddRule( UndoArg1, mrFlyFrmFmt.GetName() );
96 : :
97 : 0 : return aResult;
98 : : }
99 : :
100 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|