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