/src/libreoffice/sd/source/ui/func/undolayer.cxx
Line | Count | Source (jump to first uncovered line) |
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 | | #include <utility> |
28 | | |
29 | | |
30 | | SdLayerModifyUndoAction::SdLayerModifyUndoAction( |
31 | | SdDrawDocument& rDoc, SdrLayer* pLayer, |
32 | | OUString aOldLayerName, OUString aOldLayerTitle, OUString aOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable, |
33 | | OUString aNewLayerName, OUString aNewLayerTitle, OUString aNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable ) |
34 | 0 | : SdUndoAction( rDoc ), |
35 | 0 | mpLayer( pLayer ), |
36 | 0 | maOldLayerName(std::move( aOldLayerName )), |
37 | 0 | maOldLayerTitle(std::move( aOldLayerTitle )), |
38 | 0 | maOldLayerDesc(std::move( aOldLayerDesc )), |
39 | 0 | mbOldIsVisible( bOldIsVisible ), |
40 | 0 | mbOldIsLocked( bOldIsLocked ), |
41 | 0 | mbOldIsPrintable( bOldIsPrintable ), |
42 | 0 | maNewLayerName(std::move( aNewLayerName )), |
43 | 0 | maNewLayerTitle(std::move( aNewLayerTitle )), |
44 | 0 | maNewLayerDesc(std::move( aNewLayerDesc )), |
45 | 0 | mbNewIsVisible( bNewIsVisible ), |
46 | 0 | mbNewIsLocked( bNewIsLocked ), |
47 | 0 | mbNewIsPrintable( bNewIsPrintable ) |
48 | 0 | { |
49 | 0 | OUString aString(SdResId(STR_MODIFYLAYER)); |
50 | 0 | SetComment(aString); |
51 | 0 | } |
52 | | |
53 | | void SdLayerModifyUndoAction::Undo() |
54 | 0 | { |
55 | 0 | ::sd::DrawDocShell* pDocSh = mrDoc.GetDocSh(); |
56 | 0 | if( pDocSh ) |
57 | 0 | { |
58 | 0 | ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell*> ( pDocSh->GetViewShell() ); |
59 | 0 | if( pDrViewSh ) |
60 | 0 | { |
61 | 0 | pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable ); |
62 | 0 | } |
63 | 0 | } |
64 | 0 | } |
65 | | |
66 | | void SdLayerModifyUndoAction::Redo() |
67 | 0 | { |
68 | 0 | ::sd::DrawDocShell* pDocSh = mrDoc.GetDocSh(); |
69 | 0 | if( pDocSh ) |
70 | 0 | { |
71 | 0 | ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( pDocSh->GetViewShell() ); |
72 | 0 | if( pDrViewSh ) |
73 | 0 | { |
74 | 0 | pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable ); |
75 | 0 | } |
76 | 0 | } |
77 | 0 | } |
78 | | |
79 | | /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |