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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
26 struct SwUndoGroupObjImpl
;
32 class SwDrawFrameFormat
;
35 // Undo for Draw Objects
36 class SwSdrUndo
: public SwUndo
38 std::unique_ptr
<SdrUndoAction
> m_pSdrUndo
;
39 std::unique_ptr
<SdrMarkList
> m_pMarkList
; // MarkList for all selected SdrObjects
42 SwSdrUndo(std::unique_ptr
<SdrUndoAction
>, const SdrMarkList
* pMarkList
, const SwDoc
& rDoc
);
44 virtual ~SwSdrUndo() override
;
46 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
47 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
49 virtual OUString
GetComment() const override
;
52 class SwUndoDrawGroup
: public SwUndo
54 std::unique_ptr
<SwUndoGroupObjImpl
[]> m_pObjArray
;
59 SwUndoDrawGroup(sal_uInt16 nCnt
, const SwDoc
& rDoc
);
61 virtual ~SwUndoDrawGroup() override
;
63 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
64 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
66 void AddObj(sal_uInt16 nPos
, SwDrawFrameFormat
*, SdrObject
*);
67 void SetGroupFormat(SwDrawFrameFormat
*);
70 // Action "ungroup drawing object" is now split into three parts - see
71 // method <SwDoc::UnGroupSelection(..)>:
72 // - creation for <SwDrawFrameFormat> instances for the group members of the
73 // selected group objects
74 // - intrinsic ungroup of the selected group objects
75 // - creation of <SwDrawContact> instances for the former group members and
76 // connection to the Writer layout.
77 // Thus, two undo actions (instances of <SwUndo>) are needed:
78 // - Existing class <SwUndoDrawUnGroup> takes over the part for the formats.
79 // - New class <SwUndoDrawUnGroupConnectToLayout> takes over the part for
81 class SwUndoDrawUnGroup
: public SwUndo
83 std::unique_ptr
<SwUndoGroupObjImpl
[]> m_pObjArray
;
88 SwUndoDrawUnGroup(SdrObjGroup
*, const SwDoc
& rDoc
);
90 virtual ~SwUndoDrawUnGroup() override
;
92 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
93 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
95 void AddObj(sal_uInt16 nPos
, SwDrawFrameFormat
*);
98 class SwUndoDrawUnGroupConnectToLayout
: public SwUndo
101 std::vector
<std::pair
<SwDrawFrameFormat
*, SdrObject
*>> m_aDrawFormatsAndObjs
;
104 SwUndoDrawUnGroupConnectToLayout(const SwDoc
& rDoc
);
106 virtual ~SwUndoDrawUnGroupConnectToLayout() override
;
108 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
109 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
111 void AddFormatAndObj(SwDrawFrameFormat
* pDrawFrameFormat
, SdrObject
* pDrawObject
);
114 class SwUndoDrawDelete
: public SwUndo
116 std::unique_ptr
<SwUndoGroupObjImpl
[]> m_pObjArray
;
117 std::unique_ptr
<SdrMarkList
> m_pMarkList
; // MarkList for all selected SdrObjects
118 bool m_bDeleteFormat
;
121 SwUndoDrawDelete(sal_uInt16 nCnt
, const SwDoc
& rDoc
);
123 virtual ~SwUndoDrawDelete() override
;
125 virtual void UndoImpl(::sw::UndoRedoContext
&) override
;
126 virtual void RedoImpl(::sw::UndoRedoContext
&) override
;
128 void AddObj(SwDrawFrameFormat
*, const SdrMark
&);
129 void dumpAsXml(xmlTextWriterPtr pWriter
) const override
;
132 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
134 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */