Branch data 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 : :
21 : : #include "undolayer.hxx"
22 : :
23 : : #include "DrawDocShell.hxx"
24 : : #include "drawdoc.hxx"
25 : : #include "DrawViewShell.hxx"
26 : : #include "strings.hrc"
27 : : #include "sdresid.hxx"
28 : :
29 [ # # ][ # # ]: 0 : TYPEINIT1(SdLayerModifyUndoAction, SdUndoAction);
30 : :
31 : 0 : SdLayerModifyUndoAction::SdLayerModifyUndoAction(
32 : : SdDrawDocument* _pDoc, SdrLayer* pLayer,
33 : : const String& rOldLayerName, const String& rOldLayerTitle, const String& rOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
34 : : const String& rNewLayerName, const String& rNewLayerTitle, const String& rNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable )
35 : : : SdUndoAction( _pDoc ),
36 : : mpLayer( pLayer ),
37 : : maOldLayerName( rOldLayerName ),
38 : : maOldLayerTitle( rOldLayerTitle ),
39 : : maOldLayerDesc( rOldLayerDesc ),
40 : : mbOldIsVisible( bOldIsVisible ),
41 : : mbOldIsLocked( bOldIsLocked ),
42 : : mbOldIsPrintable( bOldIsPrintable ),
43 : : maNewLayerName( rNewLayerName ),
44 : : maNewLayerTitle( rNewLayerTitle ),
45 : : maNewLayerDesc( rNewLayerDesc ),
46 : : mbNewIsVisible( bNewIsVisible ),
47 : : mbNewIsLocked( bNewIsLocked ),
48 [ # # ][ # # ]: 0 : mbNewIsPrintable( bNewIsPrintable )
[ # # ][ # # ]
[ # # ][ # # ]
49 : : {
50 [ # # ][ # # ]: 0 : String aString(SdResId(STR_MODIFYLAYER));
51 [ # # ][ # # ]: 0 : SetComment(aString);
52 : 0 : }
53 : :
54 : 0 : void SdLayerModifyUndoAction::Undo()
55 : : {
56 : 0 : ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
57 [ # # ]: 0 : if( mpDocSh )
58 : : {
59 : : ::sd::DrawViewShell* pDrViewSh =
60 [ # # ][ # # ]: 0 : PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
61 [ # # ]: 0 : if( pDrViewSh )
62 : : {
63 : 0 : pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable );
64 : : }
65 : : }
66 : 0 : }
67 : :
68 : 0 : void SdLayerModifyUndoAction::Redo()
69 : : {
70 : 0 : ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
71 [ # # ]: 0 : if( mpDocSh )
72 : : {
73 : : ::sd::DrawViewShell* pDrViewSh =
74 [ # # ][ # # ]: 0 : PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
75 [ # # ]: 0 : if( pDrViewSh )
76 : : {
77 : 0 : pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable );
78 : : }
79 : : }
80 : 0 : }
81 : :
82 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|