LibreOffice Module sw (master)  1
UndoSort.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_UNDOSORT_HXX
21 #define INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
22 
23 #include <undobj.hxx>
24 
25 #include <rtl/ustring.hxx>
26 
27 #include <memory>
28 #include <vector>
29 
30 struct SwSortOptions;
31 class SwTableNode;
32 class SwUndoAttrTable;
33 
35 {
36  union {
37  struct {
40  } TXT;
41  struct {
42  OUString *pSource, *pTarget;
43  } TBL;
44  } SORT_TXT_TBL;
45 
46  SwSortUndoElement( const OUString& aS, const OUString& aT )
47  {
48  SORT_TXT_TBL.TBL.pSource = new OUString( aS );
49  SORT_TXT_TBL.TBL.pTarget = new OUString( aT );
50  }
52  {
53  SORT_TXT_TBL.TXT.nSource = nS;
54  SORT_TXT_TBL.TXT.nTarget = nT;
55  SORT_TXT_TBL.TXT.nID = 0xffffffff;
56  }
58 };
59 
60 class SwUndoSort : public SwUndo, private SwUndRng
61 {
62  std::unique_ptr<SwSortOptions> pSortOpt;
63  std::vector<std::unique_ptr<SwSortUndoElement>> m_SortList;
64  std::unique_ptr<SwUndoAttrTable> pUndoTableAttr;
66 
67 public:
68  SwUndoSort( const SwPaM&, const SwSortOptions& );
69  SwUndoSort( sal_uLong nStt, sal_uLong nEnd, const SwTableNode&,
70  const SwSortOptions&, bool bSaveTable );
71 
72  virtual ~SwUndoSort() override;
73 
74  virtual void UndoImpl( ::sw::UndoRedoContext & ) override;
75  virtual void RedoImpl( ::sw::UndoRedoContext & ) override;
76  virtual void RepeatImpl( ::sw::RepeatContext & ) override;
77 
78  void Insert( const OUString& rOrgPos, const OUString& rNewPos );
79  void Insert( sal_uLong nOrgPos, sal_uLong nNewPos );
80 };
81 
82 #endif // INCLUDED_SW_SOURCE_CORE_INC_UNDOSORT_HXX
83 
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwUndoSort(const SwPaM &, const SwSortOptions &)
Definition: unsort.cxx:44
sal_uLong nID
Definition: UndoSort.hxx:38
SwSortUndoElement(sal_uLong nS, sal_uLong nT)
Definition: UndoSort.hxx:51
std::unique_ptr< SwUndoAttrTable > pUndoTableAttr
Definition: UndoSort.hxx:64
sal_uIntPtr sal_uLong
virtual ~SwUndoSort() override
Definition: unsort.cxx:65
virtual void RepeatImpl(::sw::RepeatContext &) override
Definition: unsort.cxx:230
virtual void UndoImpl(::sw::UndoRedoContext &) override
Definition: unsort.cxx:71
sal_uLong nTarget
Definition: UndoSort.hxx:39
std::unique_ptr< SwSortOptions > pSortOpt
Definition: UndoSort.hxx:62
struct SwSortUndoElement::@10::@12 TBL
virtual void RedoImpl(::sw::UndoRedoContext &) override
Definition: unsort.cxx:152
union SwSortUndoElement::@10 SORT_TXT_TBL
void Insert(const OUString &rOrgPos, const OUString &rNewPos)
Definition: unsort.cxx:243
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
SwSortUndoElement(const OUString &aS, const OUString &aT)
Definition: UndoSort.hxx:46
std::vector< std::unique_ptr< SwSortUndoElement > > m_SortList
Definition: UndoSort.hxx:63
sal_uLong nTableNd
Definition: UndoSort.hxx:65
OUString * pTarget
Definition: UndoSort.hxx:42
sal_uLong nSource
Definition: UndoSort.hxx:39
OUString * pSource
Definition: UndoSort.hxx:42
struct SwSortUndoElement::@10::@11 TXT