LibreOffice Module sw (master) 1
UndoDraw.hxx
Go to the documentation of this file.
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#ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
21#define INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
22
23#include <undobj.hxx>
24#include <memory>
25
27class SdrMark;
28class SdrMarkList;
29class SdrObject;
30class SdrObjGroup;
31class SdrUndoAction;
33class SwDoc;
34
35// Undo for Draw Objects
36class SwSdrUndo final : public SwUndo
37{
38 std::unique_ptr<SdrUndoAction> m_pSdrUndo;
39 std::unique_ptr<SdrMarkList> m_pMarkList; // MarkList for all selected SdrObjects
40
41public:
42 SwSdrUndo(std::unique_ptr<SdrUndoAction>, const SdrMarkList* pMarkList, const SwDoc& rDoc);
43
44 virtual ~SwSdrUndo() override;
45
46 virtual void UndoImpl(::sw::UndoRedoContext&) override;
47 virtual void RedoImpl(::sw::UndoRedoContext&) override;
48
49 virtual OUString GetComment() const override;
50};
51
52class SwUndoDrawGroup final : public SwUndo
53{
54 std::unique_ptr<SwUndoGroupObjImpl[]> m_pObjArray;
55 sal_uInt16 m_nSize;
57
58public:
59 SwUndoDrawGroup(sal_uInt16 nCnt, const SwDoc& rDoc);
60
61 virtual ~SwUndoDrawGroup() override;
62
63 virtual void UndoImpl(::sw::UndoRedoContext&) override;
64 virtual void RedoImpl(::sw::UndoRedoContext&) override;
65
66 void AddObj(sal_uInt16 nPos, SwDrawFrameFormat*, SdrObject*);
68};
69
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
80// contact object.
81class SwUndoDrawUnGroup final : public SwUndo
82{
83 std::unique_ptr<SwUndoGroupObjImpl[]> m_pObjArray;
84 sal_uInt16 m_nSize;
86
87public:
88 SwUndoDrawUnGroup(SdrObjGroup*, const SwDoc& rDoc);
89
90 virtual ~SwUndoDrawUnGroup() override;
91
92 virtual void UndoImpl(::sw::UndoRedoContext&) override;
93 virtual void RedoImpl(::sw::UndoRedoContext&) override;
94
95 void AddObj(sal_uInt16 nPos, SwDrawFrameFormat*);
96};
97
99{
100private:
101 std::vector<std::pair<SwDrawFrameFormat*, SdrObject*>> m_aDrawFormatsAndObjs;
102
103public:
105
106 virtual ~SwUndoDrawUnGroupConnectToLayout() override;
107
108 virtual void UndoImpl(::sw::UndoRedoContext&) override;
109 virtual void RedoImpl(::sw::UndoRedoContext&) override;
110
111 void AddFormatAndObj(SwDrawFrameFormat* pDrawFrameFormat, SdrObject* pDrawObject);
112};
113
114class SwUndoDrawDelete final : public SwUndo
115{
116 std::unique_ptr<SwUndoGroupObjImpl[]> m_pObjArray;
117 std::unique_ptr<SdrMarkList> m_pMarkList; // MarkList for all selected SdrObjects
119
120public:
121 SwUndoDrawDelete(sal_uInt16 nCnt, const SwDoc& rDoc);
122
123 virtual ~SwUndoDrawDelete() override;
124
125 virtual void UndoImpl(::sw::UndoRedoContext&) override;
126 virtual void RedoImpl(::sw::UndoRedoContext&) override;
127
128 void AddObj(SwDrawFrameFormat*, const SdrMark&);
129 void dumpAsXml(xmlTextWriterPtr pWriter) const override;
130};
131
132#endif // INCLUDED_SW_SOURCE_CORE_INC_UNDODRAW_HXX
133
134/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Definition: doc.hxx:197
std::unique_ptr< SdrUndoAction > m_pSdrUndo
Definition: UndoDraw.hxx:38
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:88
SwSdrUndo(std::unique_ptr< SdrUndoAction >, const SdrMarkList *pMarkList, const SwDoc &rDoc)
Definition: undraw.cxx:69
virtual ~SwSdrUndo() override
Definition: undraw.cxx:76
std::unique_ptr< SdrMarkList > m_pMarkList
Definition: UndoDraw.hxx:39
virtual OUString GetComment() const override
Returns textual comment for this undo object.
Definition: undraw.cxx:94
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:82
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:619
std::unique_ptr< SdrMarkList > m_pMarkList
Definition: UndoDraw.hxx:117
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:116
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: undraw.cxx:659
void AddObj(SwDrawFrameFormat *, const SdrMark &)
Definition: undraw.cxx:641
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:588
virtual ~SwUndoDrawDelete() override
Definition: undraw.cxx:578
SwUndoDrawDelete(sal_uInt16 nCnt, const SwDoc &rDoc)
Definition: undraw.cxx:571
sal_uInt16 m_nSize
Definition: UndoDraw.hxx:55
bool m_bDeleteFormat
Definition: UndoDraw.hxx:56
virtual ~SwUndoDrawGroup() override
Definition: undraw.cxx:177
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *, SdrObject *)
Definition: undraw.cxx:329
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:261
SwUndoDrawGroup(sal_uInt16 nCnt, const SwDoc &rDoc)
Definition: undraw.cxx:171
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:54
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:189
void SetGroupFormat(SwDrawFrameFormat *)
Definition: undraw.cxx:343
virtual ~SwUndoDrawUnGroupConnectToLayout() override
Definition: undraw.cxx:529
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:553
SwUndoDrawUnGroupConnectToLayout(const SwDoc &rDoc)
Definition: undraw.cxx:524
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:534
std::vector< std::pair< SwDrawFrameFormat *, SdrObject * > > m_aDrawFormatsAndObjs
Definition: UndoDraw.hxx:101
void AddFormatAndObj(SwDrawFrameFormat *pDrawFrameFormat, SdrObject *pDrawObject)
Definition: undraw.cxx:565
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:456
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: undraw.cxx:386
virtual ~SwUndoDrawUnGroup() override
Definition: undraw.cxx:374
sal_uInt16 m_nSize
Definition: UndoDraw.hxx:84
void AddObj(sal_uInt16 nPos, SwDrawFrameFormat *)
Definition: undraw.cxx:517
std::unique_ptr< SwUndoGroupObjImpl[]> m_pObjArray
Definition: UndoDraw.hxx:83
SwUndoDrawUnGroup(SdrObjGroup *, const SwDoc &rDoc)
Definition: undraw.cxx:349
struct _xmlTextWriter * xmlTextWriterPtr