1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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>
30 SdLayerModifyUndoAction::SdLayerModifyUndoAction(
31 SdDrawDocument
* _pDoc
, 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 : SdUndoAction( _pDoc
),
36 maOldLayerName(std::move( aOldLayerName
)),
37 maOldLayerTitle(std::move( aOldLayerTitle
)),
38 maOldLayerDesc(std::move( aOldLayerDesc
)),
39 mbOldIsVisible( bOldIsVisible
),
40 mbOldIsLocked( bOldIsLocked
),
41 mbOldIsPrintable( bOldIsPrintable
),
42 maNewLayerName(std::move( aNewLayerName
)),
43 maNewLayerTitle(std::move( aNewLayerTitle
)),
44 maNewLayerDesc(std::move( aNewLayerDesc
)),
45 mbNewIsVisible( bNewIsVisible
),
46 mbNewIsLocked( bNewIsLocked
),
47 mbNewIsPrintable( bNewIsPrintable
)
49 OUString
aString(SdResId(STR_MODIFYLAYER
));
53 void SdLayerModifyUndoAction::Undo()
55 ::sd::DrawDocShell
* pDocSh
= mpDoc
->GetDocSh();
58 ::sd::DrawViewShell
* pDrViewSh
= dynamic_cast< ::sd::DrawViewShell
*> ( pDocSh
->GetViewShell() );
61 pDrViewSh
->ModifyLayer( mpLayer
, maOldLayerName
, maOldLayerTitle
, maOldLayerDesc
, mbOldIsVisible
, mbOldIsLocked
, mbOldIsPrintable
);
66 void SdLayerModifyUndoAction::Redo()
68 ::sd::DrawDocShell
* pDocSh
= mpDoc
->GetDocSh();
71 ::sd::DrawViewShell
* pDrViewSh
= dynamic_cast< ::sd::DrawViewShell
* >( pDocSh
->GetViewShell() );
74 pDrViewSh
->ModifyLayer( mpLayer
, maNewLayerName
, maNewLayerTitle
, maNewLayerDesc
, mbNewIsVisible
, mbNewIsLocked
, mbNewIsPrintable
);
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */