LibreOffice Module sc (master)  1
sortparam.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 #pragma once
21 
22 #define DEFSORT 3
23 
24 #include <vector>
25 
26 #include "address.hxx"
27 #include <com/sun/star/lang/Locale.hpp>
28 #include "scdllapi.h"
29 
30 struct ScSubTotalParam;
31 struct ScQueryParam;
32 
34 {
36  bool bDoSort;
37  bool bAscending;
38 };
39 
44 {
46  bool mbCellNotes = false;
48  bool mbCellDrawObjects = false;
50  bool mbCellFormats = false;
55 
56  bool anyExtrasWanted() const { return mbCellNotes || mbCellDrawObjects || mbCellFormats; }
57  void resetArea() { mnStartCol = SCCOL_MAX; mnStartRow = SCROW_MAX; mnEndCol = -1; mnEndRow = -1; }
58 
59  bool operator==( const ScDataAreaExtras& rOther ) const
60  {
61  // Ignore area range, this is used in ScSortParam::operator==().
62  return mbCellNotes == rOther.mbCellNotes
63  && mbCellDrawObjects == rOther.mbCellDrawObjects
64  && mbCellFormats == rOther.mbCellFormats;
65  }
66 
67  enum class Clip
68  {
69  None,
70  Col,
71  Row
72  };
73 
75  void GetOverallRange( SCCOL& nCol1, SCROW& nRow1, SCCOL& nCol2, SCROW& nRow2, Clip eClip = Clip::None ) const
76  {
77  if (eClip != Clip::Col)
78  {
79  if (nCol1 > mnStartCol)
80  nCol1 = mnStartCol;
81  if (nCol2 < mnEndCol)
82  nCol2 = mnEndCol;
83  }
84  if (eClip != Clip::Row)
85  {
86  if (nRow1 > mnStartRow)
87  nRow1 = mnStartRow;
88  if (nRow2 < mnEndRow)
89  nRow2 = mnEndRow;
90  }
91  }
92 
94  void SetOverallRange( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 )
95  {
96  mnStartCol = nCol1;
97  mnStartRow = nRow1;
98  mnEndCol = nCol2;
99  mnEndRow = nRow2;
100  }
101 };
102 
104 {
110  sal_uInt16 nUserIndex;
112  bool bByRow;
113  bool bCaseSens;
115  bool bUserDef;
116  bool bInplace;
120  ::std::vector<ScSortKeyState>
122  css::lang::Locale aCollatorLocale;
124  sal_uInt16 nCompatHeader;
125 
126  ScSortParam();
127  ScSortParam( const ScSortParam& r );
129  ScSortParam( const ScSubTotalParam& rSub, const ScSortParam& rOld );
131  ScSortParam( const ScQueryParam&, SCCOL nCol );
132  ~ScSortParam();
133 
134  ScSortParam& operator= ( const ScSortParam& r );
135  bool operator== ( const ScSortParam& rOther ) const;
136  void Clear ();
137  void MoveToDest();
138 
139  sal_uInt16 GetSortKeyCount() const { return maKeyState.size(); }
140 };
141 
142 namespace sc {
143 
145 {
153 
157  std::vector<SCCOLROW> maOrderIndices;
158  bool mbByRow;
162 
167  void reverse();
168 };
169 
170 }
171 
172 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition: xlstyle.cxx:519
::std::vector< ScSortKeyState > maKeyState
Definition: sortparam.hxx:121
sal_uInt16 nUserIndex
Definition: sortparam.hxx:110
css::lang::Locale aCollatorLocale
Definition: sortparam.hxx:122
SCCOL nDestCol
Definition: sortparam.hxx:118
const SCCOL SCCOL_MAX
Definition: address.hxx:56
bool anyExtrasWanted() const
Definition: sortparam.hxx:56
const SCROW SCROW_MAX
Definition: address.hxx:55
bool mbCellDrawObjects
If TRUE, consider the presence of draw objects anchored to the cell.
Definition: sortparam.hxx:48
void SetOverallRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Set the overall range.
Definition: sortparam.hxx:94
ScRange maSortRange
This sort range already takes into account the presence or absence of header row / column i...
Definition: sortparam.hxx:151
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:23
bool bNaturalSort
Definition: sortparam.hxx:114
bool mbCellNotes
If TRUE, consider the presence of cell notes besides data.
Definition: sortparam.hxx:46
bool operator==(const ScDataAreaExtras &rOther) const
Definition: sortparam.hxx:59
sal_Int16 SCCOL
Definition: types.hxx:21
Struct to hold non-data extended area, used with ScDocument::ShrinkToUsedDataArea().
Definition: sortparam.hxx:43
bool bCaseSens
Definition: sortparam.hxx:113
void Clear(EHistoryType eHistory)
ScDataAreaExtras aDataAreaExtras
Definition: sortparam.hxx:109
std::vector< SCCOLROW > maOrderIndices
List of original column / row positions after reordering.
Definition: sortparam.hxx:157
bool mbCellFormats
If TRUE, consider the presence of cell formats.
Definition: sortparam.hxx:50
sal_Int32 SCROW
Definition: types.hxx:17
bool bHasHeader
Definition: sortparam.hxx:111
void reverse()
Reorder the position indices such that it can be used to undo the original reordering.
Definition: sortparam.cxx:277
sal_uInt16 GetSortKeyCount() const
Definition: sortparam.hxx:139
SCCOLROW nField
Definition: sortparam.hxx:35
void GetOverallRange(SCCOL &nCol1, SCROW &nRow1, SCCOL &nCol2, SCROW &nRow2, Clip eClip=Clip::None) const
Obtain the overall range if area extras are larger.
Definition: sortparam.hxx:75
OUString aCollatorAlgorithm
Definition: sortparam.hxx:123
SCROW nDestRow
Definition: sortparam.hxx:119
ScDataAreaExtras maDataAreaExtras
Definition: sortparam.hxx:152
sal_uInt16 nCompatHeader
Definition: sortparam.hxx:124
#define SC_DLLPUBLIC
Definition: scdllapi.h:27
sal_Int16 SCTAB
Definition: types.hxx:22
SCTAB nDestTab
Definition: sortparam.hxx:117