LibreOffice Module sc (master)
1
sc
inc
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
33
struct
ScSortKeyState
34
{
35
SCCOLROW
nField
;
36
bool
bDoSort
;
37
bool
bAscending
;
38
};
39
43
struct
ScDataAreaExtras
44
{
46
bool
mbCellNotes
=
false
;
48
bool
mbCellDrawObjects
=
false
;
50
bool
mbCellFormats
=
false
;
51
SCCOL
mnStartCol
=
SCCOL_MAX
;
52
SCROW
mnStartRow
=
SCROW_MAX
;
53
SCCOL
mnEndCol
= -1;
54
SCROW
mnEndRow
= -1;
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
103
struct
SC_DLLPUBLIC
ScSortParam
104
{
105
SCCOL
nCol1
;
106
SCROW
nRow1
;
107
SCCOL
nCol2
;
108
SCROW
nRow2
;
109
ScDataAreaExtras
aDataAreaExtras
;
110
sal_uInt16
nUserIndex
;
111
bool
bHasHeader
;
112
bool
bByRow
;
113
bool
bCaseSens
;
114
bool
bNaturalSort
;
115
bool
bUserDef
;
116
bool
bInplace
;
117
SCTAB
nDestTab
;
118
SCCOL
nDestCol
;
119
SCROW
nDestRow
;
120
::std::vector<ScSortKeyState>
121
maKeyState
;
122
css::lang::Locale
aCollatorLocale
;
123
OUString
aCollatorAlgorithm
;
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
144
struct
ReorderParam
145
{
151
ScRange
maSortRange
;
152
ScDataAreaExtras
maDataAreaExtras
;
153
157
std::vector<SCCOLROW>
maOrderIndices
;
158
bool
mbByRow
;
159
bool
mbHiddenFiltered
;
160
bool
mbUpdateRefs
;
161
bool
mbHasHeaders
;
162
167
void
reverse
();
168
169
ReorderParam
()
170
:
mbByRow
(false)
171
,
mbHiddenFiltered
(false)
172
,
mbUpdateRefs
(false)
173
,
mbHasHeaders
(false)
174
{
175
}
176
};
177
178
}
179
180
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
address.hxx
SCCOL_MAX
const SCCOL SCCOL_MAX
Definition:
address.hxx:56
SCROW_MAX
const SCROW SCROW_MAX
Definition:
address.hxx:55
ScRange
Definition:
address.hxx:495
Clear
void Clear(EHistoryType eHistory)
None
None
sc
CAUTION! The following defines must be in the same namespace as the respective type.
Definition:
broadcast.cxx:15
scdllapi.h
SC_DLLPUBLIC
#define SC_DLLPUBLIC
Definition:
scdllapi.h:27
ScDataAreaExtras
Struct to hold non-data extended area, used with ScDocument::ShrinkToUsedDataArea().
Definition:
sortparam.hxx:44
ScDataAreaExtras::mnStartCol
SCCOL mnStartCol
Definition:
sortparam.hxx:51
ScDataAreaExtras::Clip
Clip
Definition:
sortparam.hxx:68
ScDataAreaExtras::Clip::Col
@ Col
ScDataAreaExtras::Clip::None
@ None
ScDataAreaExtras::Clip::Row
@ Row
ScDataAreaExtras::mbCellDrawObjects
bool mbCellDrawObjects
If TRUE, consider the presence of draw objects anchored to the cell.
Definition:
sortparam.hxx:48
ScDataAreaExtras::mnStartRow
SCROW mnStartRow
Definition:
sortparam.hxx:52
ScDataAreaExtras::mnEndRow
SCROW mnEndRow
Definition:
sortparam.hxx:54
ScDataAreaExtras::mbCellFormats
bool mbCellFormats
If TRUE, consider the presence of cell formats.
Definition:
sortparam.hxx:50
ScDataAreaExtras::GetOverallRange
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
ScDataAreaExtras::SetOverallRange
void SetOverallRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Set the overall range.
Definition:
sortparam.hxx:94
ScDataAreaExtras::operator==
bool operator==(const ScDataAreaExtras &rOther) const
Definition:
sortparam.hxx:59
ScDataAreaExtras::mnEndCol
SCCOL mnEndCol
Definition:
sortparam.hxx:53
ScDataAreaExtras::mbCellNotes
bool mbCellNotes
If TRUE, consider the presence of cell notes besides data.
Definition:
sortparam.hxx:46
ScDataAreaExtras::anyExtrasWanted
bool anyExtrasWanted() const
Definition:
sortparam.hxx:56
ScDataAreaExtras::resetArea
void resetArea()
Definition:
sortparam.hxx:57
ScQueryParam
Definition:
queryparam.hxx:134
ScSortKeyState
Definition:
sortparam.hxx:34
ScSortKeyState::bAscending
bool bAscending
Definition:
sortparam.hxx:37
ScSortKeyState::bDoSort
bool bDoSort
Definition:
sortparam.hxx:36
ScSortKeyState::nField
SCCOLROW nField
Definition:
sortparam.hxx:35
ScSortParam
Definition:
sortparam.hxx:104
ScSortParam::nDestTab
SCTAB nDestTab
Definition:
sortparam.hxx:117
ScSortParam::nDestRow
SCROW nDestRow
Definition:
sortparam.hxx:119
ScSortParam::bUserDef
bool bUserDef
Definition:
sortparam.hxx:115
ScSortParam::nCol1
SCCOL nCol1
Definition:
sortparam.hxx:105
ScSortParam::nCompatHeader
sal_uInt16 nCompatHeader
Definition:
sortparam.hxx:124
ScSortParam::nRow1
SCROW nRow1
Definition:
sortparam.hxx:106
ScSortParam::nDestCol
SCCOL nDestCol
Definition:
sortparam.hxx:118
ScSortParam::bNaturalSort
bool bNaturalSort
Definition:
sortparam.hxx:114
ScSortParam::bByRow
bool bByRow
Definition:
sortparam.hxx:112
ScSortParam::maKeyState
::std::vector< ScSortKeyState > maKeyState
Definition:
sortparam.hxx:121
ScSortParam::aCollatorAlgorithm
OUString aCollatorAlgorithm
Definition:
sortparam.hxx:123
ScSortParam::bHasHeader
bool bHasHeader
Definition:
sortparam.hxx:111
ScSortParam::aDataAreaExtras
ScDataAreaExtras aDataAreaExtras
Definition:
sortparam.hxx:109
ScSortParam::nRow2
SCROW nRow2
Definition:
sortparam.hxx:108
ScSortParam::bInplace
bool bInplace
Definition:
sortparam.hxx:116
ScSortParam::aCollatorLocale
css::lang::Locale aCollatorLocale
Definition:
sortparam.hxx:122
ScSortParam::nUserIndex
sal_uInt16 nUserIndex
Definition:
sortparam.hxx:110
ScSortParam::nCol2
SCCOL nCol2
Definition:
sortparam.hxx:107
ScSortParam::GetSortKeyCount
sal_uInt16 GetSortKeyCount() const
Definition:
sortparam.hxx:139
ScSortParam::bCaseSens
bool bCaseSens
Definition:
sortparam.hxx:113
ScSubTotalParam
Definition:
subtotalparam.hxx:16
sc::ReorderParam
Definition:
sortparam.hxx:145
sc::ReorderParam::reverse
void reverse()
Reorder the position indices such that it can be used to undo the original reordering.
Definition:
sortparam.cxx:277
sc::ReorderParam::maDataAreaExtras
ScDataAreaExtras maDataAreaExtras
Definition:
sortparam.hxx:152
sc::ReorderParam::mbHasHeaders
bool mbHasHeaders
Definition:
sortparam.hxx:161
sc::ReorderParam::mbUpdateRefs
bool mbUpdateRefs
Definition:
sortparam.hxx:160
sc::ReorderParam::mbByRow
bool mbByRow
Definition:
sortparam.hxx:158
sc::ReorderParam::maOrderIndices
std::vector< SCCOLROW > maOrderIndices
List of original column / row positions after reordering.
Definition:
sortparam.hxx:157
sc::ReorderParam::maSortRange
ScRange maSortRange
This sort range already takes into account the presence or absence of header row / column i....
Definition:
sortparam.hxx:151
sc::ReorderParam::ReorderParam
ReorderParam()
Definition:
sortparam.hxx:169
sc::ReorderParam::mbHiddenFiltered
bool mbHiddenFiltered
Definition:
sortparam.hxx:159
SwTableSearchType::Col
@ Col
SwTableSearchType::Row
@ Row
SCCOLROW
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition:
types.hxx:23
SCTAB
sal_Int16 SCTAB
Definition:
types.hxx:22
SCCOL
sal_Int16 SCCOL
Definition:
types.hxx:21
SCROW
sal_Int32 SCROW
Definition:
types.hxx:17
operator==
bool operator==(const XclFontData &rLeft, const XclFontData &rRight)
Definition:
xlstyle.cxx:517
Generated on Fri Mar 24 2023 12:11:36 for LibreOffice Module sc (master) by
1.9.3