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 <
editeng/colritem.hxx
>
28
#include <com/sun/star/lang/Locale.hpp>
29
#include "
scdllapi.h
"
30
31
struct
ScSubTotalParam
;
32
struct
ScQueryParam
;
33
34
enum class
ScColorSortMode
{
35
None
,
36
TextColor
,
37
BackgroundColor
38
};
39
40
struct
ScSortKeyState
41
{
42
SCCOLROW
nField
;
43
bool
bDoSort
;
44
bool
bAscending
;
45
ScColorSortMode
aColorSortMode
;
46
Color
aColorSortColor
;
47
};
48
52
struct
ScDataAreaExtras
53
{
55
bool
mbCellNotes
=
false
;
57
bool
mbCellDrawObjects
=
false
;
59
bool
mbCellFormats
=
false
;
60
SCCOL
mnStartCol
=
SCCOL_MAX
;
61
SCROW
mnStartRow
=
SCROW_MAX
;
62
SCCOL
mnEndCol
= -1;
63
SCROW
mnEndRow
= -1;
64
65
bool
anyExtrasWanted
()
const
{
return
mbCellNotes
||
mbCellDrawObjects
||
mbCellFormats
; }
66
void
resetArea
() {
mnStartCol
=
SCCOL_MAX
;
mnStartRow
=
SCROW_MAX
;
mnEndCol
= -1;
mnEndRow
= -1; }
67
68
bool
operator==
(
const
ScDataAreaExtras
& rOther )
const
69
{
70
// Ignore area range, this is used in ScSortParam::operator==().
71
return
mbCellNotes
== rOther.
mbCellNotes
72
&&
mbCellDrawObjects
== rOther.
mbCellDrawObjects
73
&&
mbCellFormats
== rOther.
mbCellFormats
;
74
}
75
76
enum class
Clip
77
{
78
None
,
79
Col
,
80
Row
81
};
82
84
void
GetOverallRange
(
SCCOL
& nCol1,
SCROW
& nRow1,
SCCOL
& nCol2,
SCROW
& nRow2,
Clip
eClip =
Clip::None
)
const
85
{
86
if
(eClip !=
Clip::Col
)
87
{
88
if
(nCol1 >
mnStartCol
)
89
nCol1 =
mnStartCol
;
90
if
(nCol2 <
mnEndCol
)
91
nCol2 =
mnEndCol
;
92
}
93
if
(eClip !=
Clip::Row
)
94
{
95
if
(nRow1 >
mnStartRow
)
96
nRow1 =
mnStartRow
;
97
if
(nRow2 <
mnEndRow
)
98
nRow2 =
mnEndRow
;
99
}
100
}
101
103
void
SetOverallRange
(
SCCOL
nCol1,
SCROW
nRow1,
SCCOL
nCol2,
SCROW
nRow2 )
104
{
105
mnStartCol
= nCol1;
106
mnStartRow
= nRow1;
107
mnEndCol
= nCol2;
108
mnEndRow
= nRow2;
109
}
110
};
111
112
struct
SC_DLLPUBLIC
ScSortParam
113
{
114
SCCOL
nCol1
;
115
SCROW
nRow1
;
116
SCCOL
nCol2
;
117
SCROW
nRow2
;
118
ScDataAreaExtras
aDataAreaExtras
;
119
sal_uInt16
nUserIndex
;
120
bool
bHasHeader
;
121
bool
bByRow
;
122
bool
bCaseSens
;
123
bool
bNaturalSort
;
124
bool
bUserDef
;
125
bool
bInplace
;
126
SCTAB
nDestTab
;
127
SCCOL
nDestCol
;
128
SCROW
nDestRow
;
129
::std::vector<ScSortKeyState>
130
maKeyState
;
131
css::lang::Locale
aCollatorLocale
;
132
OUString
aCollatorAlgorithm
;
133
sal_uInt16
nCompatHeader
;
134
135
ScSortParam
();
136
ScSortParam
(
const
ScSortParam
& r );
138
ScSortParam
(
const
ScSubTotalParam
& rSub,
const
ScSortParam
& rOld );
140
ScSortParam
(
const
ScQueryParam
&,
SCCOL
nCol );
141
~ScSortParam
();
142
143
ScSortParam
& operator= (
const
ScSortParam
& r );
144
bool
operator==
(
const
ScSortParam
& rOther )
const
;
145
void
Clear
();
146
void
MoveToDest();
147
148
sal_uInt16
GetSortKeyCount
()
const
{
return
maKeyState.size(); }
149
};
150
151
namespace
sc
{
152
153
struct
ReorderParam
154
{
160
ScRange
maSortRange
;
161
ScDataAreaExtras
maDataAreaExtras
;
162
166
std::vector<SCCOLROW>
maOrderIndices
;
167
bool
mbByRow
;
168
bool
mbHiddenFiltered
;
169
bool
mbUpdateRefs
;
170
bool
mbHasHeaders
;
171
176
void
reverse
();
177
178
ReorderParam
()
179
:
mbByRow
(false)
180
,
mbHiddenFiltered
(false)
181
,
mbUpdateRefs
(false)
182
,
mbHasHeaders
(false)
183
{
184
}
185
};
186
187
}
188
189
/* 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
Color
ScRange
Definition:
address.hxx:495
colritem.hxx
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
ScColorSortMode
ScColorSortMode
Definition:
sortparam.hxx:34
ScColorSortMode::BackgroundColor
@ BackgroundColor
ScColorSortMode::TextColor
@ TextColor
ScDataAreaExtras
Struct to hold non-data extended area, used with ScDocument::ShrinkToUsedDataArea().
Definition:
sortparam.hxx:53
ScDataAreaExtras::mnStartCol
SCCOL mnStartCol
Definition:
sortparam.hxx:60
ScDataAreaExtras::Clip
Clip
Definition:
sortparam.hxx:77
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:57
ScDataAreaExtras::mnStartRow
SCROW mnStartRow
Definition:
sortparam.hxx:61
ScDataAreaExtras::mnEndRow
SCROW mnEndRow
Definition:
sortparam.hxx:63
ScDataAreaExtras::mbCellFormats
bool mbCellFormats
If TRUE, consider the presence of cell formats.
Definition:
sortparam.hxx:59
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:84
ScDataAreaExtras::SetOverallRange
void SetOverallRange(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2)
Set the overall range.
Definition:
sortparam.hxx:103
ScDataAreaExtras::operator==
bool operator==(const ScDataAreaExtras &rOther) const
Definition:
sortparam.hxx:68
ScDataAreaExtras::mnEndCol
SCCOL mnEndCol
Definition:
sortparam.hxx:62
ScDataAreaExtras::mbCellNotes
bool mbCellNotes
If TRUE, consider the presence of cell notes besides data.
Definition:
sortparam.hxx:55
ScDataAreaExtras::anyExtrasWanted
bool anyExtrasWanted() const
Definition:
sortparam.hxx:65
ScDataAreaExtras::resetArea
void resetArea()
Definition:
sortparam.hxx:66
ScQueryParam
Definition:
queryparam.hxx:134
ScSortKeyState
Definition:
sortparam.hxx:41
ScSortKeyState::bAscending
bool bAscending
Definition:
sortparam.hxx:44
ScSortKeyState::aColorSortColor
Color aColorSortColor
Definition:
sortparam.hxx:46
ScSortKeyState::bDoSort
bool bDoSort
Definition:
sortparam.hxx:43
ScSortKeyState::aColorSortMode
ScColorSortMode aColorSortMode
Definition:
sortparam.hxx:45
ScSortKeyState::nField
SCCOLROW nField
Definition:
sortparam.hxx:42
ScSortParam
Definition:
sortparam.hxx:113
ScSortParam::nDestTab
SCTAB nDestTab
Definition:
sortparam.hxx:126
ScSortParam::nDestRow
SCROW nDestRow
Definition:
sortparam.hxx:128
ScSortParam::bUserDef
bool bUserDef
Definition:
sortparam.hxx:124
ScSortParam::nCol1
SCCOL nCol1
Definition:
sortparam.hxx:114
ScSortParam::nCompatHeader
sal_uInt16 nCompatHeader
Definition:
sortparam.hxx:133
ScSortParam::nRow1
SCROW nRow1
Definition:
sortparam.hxx:115
ScSortParam::nDestCol
SCCOL nDestCol
Definition:
sortparam.hxx:127
ScSortParam::bNaturalSort
bool bNaturalSort
Definition:
sortparam.hxx:123
ScSortParam::bByRow
bool bByRow
Definition:
sortparam.hxx:121
ScSortParam::maKeyState
::std::vector< ScSortKeyState > maKeyState
Definition:
sortparam.hxx:130
ScSortParam::aCollatorAlgorithm
OUString aCollatorAlgorithm
Definition:
sortparam.hxx:132
ScSortParam::bHasHeader
bool bHasHeader
Definition:
sortparam.hxx:120
ScSortParam::aDataAreaExtras
ScDataAreaExtras aDataAreaExtras
Definition:
sortparam.hxx:118
ScSortParam::nRow2
SCROW nRow2
Definition:
sortparam.hxx:117
ScSortParam::bInplace
bool bInplace
Definition:
sortparam.hxx:125
ScSortParam::aCollatorLocale
css::lang::Locale aCollatorLocale
Definition:
sortparam.hxx:131
ScSortParam::nUserIndex
sal_uInt16 nUserIndex
Definition:
sortparam.hxx:119
ScSortParam::nCol2
SCCOL nCol2
Definition:
sortparam.hxx:116
ScSortParam::GetSortKeyCount
sal_uInt16 GetSortKeyCount() const
Definition:
sortparam.hxx:148
ScSortParam::bCaseSens
bool bCaseSens
Definition:
sortparam.hxx:122
ScSubTotalParam
Definition:
subtotalparam.hxx:16
sc::ReorderParam
Definition:
sortparam.hxx:154
sc::ReorderParam::reverse
void reverse()
Reorder the position indices such that it can be used to undo the original reordering.
Definition:
sortparam.cxx:281
sc::ReorderParam::maDataAreaExtras
ScDataAreaExtras maDataAreaExtras
Definition:
sortparam.hxx:161
sc::ReorderParam::mbHasHeaders
bool mbHasHeaders
Definition:
sortparam.hxx:170
sc::ReorderParam::mbUpdateRefs
bool mbUpdateRefs
Definition:
sortparam.hxx:169
sc::ReorderParam::mbByRow
bool mbByRow
Definition:
sortparam.hxx:167
sc::ReorderParam::maOrderIndices
std::vector< SCCOLROW > maOrderIndices
List of original column / row positions after reordering.
Definition:
sortparam.hxx:166
sc::ReorderParam::maSortRange
ScRange maSortRange
This sort range already takes into account the presence or absence of header row / column i....
Definition:
sortparam.hxx:160
sc::ReorderParam::ReorderParam
ReorderParam()
Definition:
sortparam.hxx:178
sc::ReorderParam::mbHiddenFiltered
bool mbHiddenFiltered
Definition:
sortparam.hxx:168
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:518
Generated on Sun Jul 30 2023 04:27:49 for LibreOffice Module sc (master) by
1.9.3