Version 6.1.0.2, tag libreoffice-6.1.0.2
[LibreOffice.git] / sd / source / ui / func / undolayer.cxx
blobb29142ee8de75df5dab2e4755e388baf4ea4754d
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <undolayer.hxx>
22 #include <DrawDocShell.hxx>
23 #include <drawdoc.hxx>
24 #include <DrawViewShell.hxx>
25 #include <strings.hrc>
26 #include <sdresid.hxx>
29 SdLayerModifyUndoAction::SdLayerModifyUndoAction(
30 SdDrawDocument* _pDoc, SdrLayer* pLayer,
31 const OUString& rOldLayerName, const OUString& rOldLayerTitle, const OUString& rOldLayerDesc, bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
32 const OUString& rNewLayerName, const OUString& rNewLayerTitle, const OUString& rNewLayerDesc, bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable )
33 : SdUndoAction( _pDoc ),
34 mpLayer( pLayer ),
35 maOldLayerName( rOldLayerName ),
36 maOldLayerTitle( rOldLayerTitle ),
37 maOldLayerDesc( rOldLayerDesc ),
38 mbOldIsVisible( bOldIsVisible ),
39 mbOldIsLocked( bOldIsLocked ),
40 mbOldIsPrintable( bOldIsPrintable ),
41 maNewLayerName( rNewLayerName ),
42 maNewLayerTitle( rNewLayerTitle ),
43 maNewLayerDesc( rNewLayerDesc ),
44 mbNewIsVisible( bNewIsVisible ),
45 mbNewIsLocked( bNewIsLocked ),
46 mbNewIsPrintable( bNewIsPrintable )
48 OUString aString(SdResId(STR_MODIFYLAYER));
49 SetComment(aString);
52 void SdLayerModifyUndoAction::Undo()
54 ::sd::DrawDocShell* pDocSh = mpDoc->GetDocSh();
55 if( pDocSh )
57 ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell*> ( pDocSh->GetViewShell() );
58 if( pDrViewSh )
60 pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable );
65 void SdLayerModifyUndoAction::Redo()
67 ::sd::DrawDocShell* pDocSh = mpDoc->GetDocSh();
68 if( pDocSh )
70 ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( pDocSh->GetViewShell() );
71 if( pDrViewSh )
73 pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable );
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */