Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / sw / source / core / inc / UndoSort.hxx
blob432dd41133d9922a9114b6edfecc6fc818c04f51
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 #ifndef INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
23 #include <undobj.hxx>
25 #include <rtl/ustring.hxx>
26 #include <tools/solar.h>
28 #include <memory>
29 #include <vector>
31 struct SwSortOptions;
32 class SwTableNode;
33 class SwUndoAttrTable;
35 struct SwSortUndoElement
37 OUString maSourceString;
38 OUString maTargetString;
39 SwNodeOffset mnSourceNodeOffset;
40 SwNodeOffset mnTargetNodeOffset;
42 SwSortUndoElement(const OUString& aSource, const OUString& aTarget)
43 : maSourceString(aSource)
44 , maTargetString(aTarget)
47 SwSortUndoElement(SwNodeOffset nSource, SwNodeOffset nTarget)
48 : mnSourceNodeOffset(nSource)
49 , mnTargetNodeOffset(nTarget)
53 class SwUndoSort final : public SwUndo, private SwUndRng
55 std::unique_ptr<SwSortOptions> m_pSortOptions;
56 std::vector<std::unique_ptr<SwSortUndoElement>> m_SortList;
57 std::unique_ptr<SwUndoAttrTable> m_pUndoAttrTable;
58 SwNodeOffset m_nTableNode;
60 public: SwUndoSort( const SwPaM&, const SwSortOptions& );
61 SwUndoSort( SwNodeOffset nStt, SwNodeOffset nEnd, const SwTableNode&,
62 const SwSortOptions&, bool bSaveTable );
64 virtual ~SwUndoSort() override;
66 virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
67 virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
68 virtual void RepeatImpl( ::sw::RepeatContext & ) override;
70 void Insert( const OUString& rOrgPos, const OUString& rNewPos );
71 void Insert( SwNodeOffset nOrgPos, SwNodeOffset nNewPos );
74 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */