fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / ui / undo / undosort.cxx
blobacdac407b0855cb2c3e71394a2e5480c9b4d45fd
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/.
8 */
10 #include <undosort.hxx>
11 #include <globstr.hrc>
12 #include <global.hxx>
13 #include <undoutil.hxx>
15 namespace sc {
17 UndoSort::UndoSort( ScDocShell* pDocSh, const ReorderParam& rParam ) :
18 ScSimpleUndo(pDocSh), maParam(rParam) {}
20 OUString UndoSort::GetComment() const
22 return ScGlobal::GetRscString(STR_UNDO_SORT);
25 void UndoSort::Undo()
27 BeginUndo();
28 Execute(true);
29 EndUndo();
32 void UndoSort::Redo()
34 BeginRedo();
35 Execute(false);
36 EndRedo();
39 void UndoSort::Execute( bool bUndo )
41 ScDocument& rDoc = pDocShell->GetDocument();
42 sc::ReorderParam aParam = maParam;
43 if (bUndo)
44 aParam.reverse();
45 rDoc.Reorder(aParam, NULL);
47 if (maParam.mbHasHeaders)
49 ScRange aMarkRange( maParam.maSortRange);
50 if (maParam.mbByRow)
52 if (aMarkRange.aStart.Row() > 0)
53 aMarkRange.aStart.IncRow(-1);
55 else
57 if (aMarkRange.aStart.Col() > 0)
58 aMarkRange.aStart.IncCol(-1);
60 ScUndoUtil::MarkSimpleBlock(pDocShell, aMarkRange);
62 else
64 ScUndoUtil::MarkSimpleBlock(pDocShell, maParam.maSortRange);
67 rDoc.SetDirty(maParam.maSortRange, true);
68 if (!aParam.mbUpdateRefs)
69 rDoc.BroadcastCells(aParam.maSortRange, SC_HINT_DATACHANGED);
71 pDocShell->PostPaint(maParam.maSortRange, PAINT_GRID);
72 pDocShell->PostDataChanged();
77 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */