bump product version to 5.0.4.1
[LibreOffice.git] / sd / source / ui / func / undolayer.cxx
blob33897e1dc33cb91658f7a4393a50437869ccbe97
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"
28 TYPEINIT1(SdLayerModifyUndoAction, SdUndoAction);
30 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 mbNewIsPrintable( bNewIsPrintable )
49 OUString aString(SdResId(STR_MODIFYLAYER));
50 SetComment(aString);
53 void SdLayerModifyUndoAction::Undo()
55 ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
56 if( mpDocSh )
58 ::sd::DrawViewShell* pDrViewSh =
59 PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
60 if( pDrViewSh )
62 pDrViewSh->ModifyLayer( mpLayer, maOldLayerName, maOldLayerTitle, maOldLayerDesc, mbOldIsVisible, mbOldIsLocked, mbOldIsPrintable );
67 void SdLayerModifyUndoAction::Redo()
69 ::sd::DrawDocShell* mpDocSh = mpDoc->GetDocSh();
70 if( mpDocSh )
72 ::sd::DrawViewShell* pDrViewSh =
73 PTR_CAST(::sd::DrawViewShell, mpDocSh->GetViewShell() );
74 if( pDrViewSh )
76 pDrViewSh->ModifyLayer( mpLayer, maNewLayerName, maNewLayerTitle, maNewLayerDesc, mbNewIsVisible, mbNewIsLocked, mbNewIsPrintable );
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */