1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
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 .
24 #include <sfx2/tabdlg.hxx>
25 #include <svtools/collatorres.hxx>
26 #include <svx/langbox.hxx>
27 #include <unotools/collatorwrapper.hxx>
28 #include <vcl/idle.hxx>
30 #include "sortkeydlg.hxx"
32 #include <address.hxx>
33 #include <sheetlimits.hxx>
34 #include <sortparam.hxx>
36 // +1 because one field is reserved for the "- undefined -" entry
37 inline SCCOL
SC_MAXFIELDS(const ScSheetLimits
& rLimits
) { return rLimits
.GetMaxColCount() + 1; }
44 class ScTabPageSortFields
: public SfxTabPage
47 ScTabPageSortFields(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rArgSet
);
48 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* rArgSet
);
49 virtual ~ScTabPageSortFields() override
;
51 virtual bool FillItemSet ( SfxItemSet
* rArgSet
) override
;
52 virtual void Reset ( const SfxItemSet
* rArgSet
) override
;
55 virtual void ActivatePage ( const SfxItemSet
& rSet
) override
;
56 virtual DeactivateRC
DeactivatePage ( SfxItemSet
* pSet
) override
;
61 OUString aStrUndefined
;
64 OUString aStrRowLabel
;
65 OUString aStrColLabel
;
67 TypedWhichId
<ScSortItem
> nWhichSort
;
68 ScViewData
* pViewData
;
69 ScSortParam aSortData
;
70 std::vector
<SCCOLROW
> nFieldArr
;
71 sal_uInt16 nFieldCount
;
72 sal_uInt16 nSortKeyCount
;
74 std::unique_ptr
<weld::Container
> m_xTop
;
75 std::unique_ptr
<weld::CheckButton
> m_xBtnHeader
;
76 std::unique_ptr
<weld::RadioButton
> m_xBtnTopDown
;
77 std::unique_ptr
<weld::RadioButton
> m_xBtnLeftRight
;
78 std::unique_ptr
<weld::ScrolledWindow
> m_xScrolledWindow
;
79 std::unique_ptr
<weld::Container
> m_xBox
;
80 ScSortKeyWindow m_aSortWin
;
82 void AddSortKey( sal_uInt16 nItem
);
86 void FillFieldLists ( sal_uInt16 nStartField
);
87 sal_uInt16
GetFieldSelPos ( SCCOLROW nField
);
88 void SetLastSortKey( sal_uInt16 nItem
);
90 // Handler ------------------------
91 DECL_LINK(SelectHdl
, weld::ComboBox
&, void);
92 DECL_LINK(ScrollToEndHdl
, Timer
*, void);
93 DECL_LINK(SortDirHdl
, weld::Toggleable
&, void);
101 class ScTabPageSortOptions
: public SfxTabPage
104 ScTabPageSortOptions(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
& rArgSet
);
105 static std::unique_ptr
<SfxTabPage
> Create(weld::Container
* pPage
, weld::DialogController
* pController
, const SfxItemSet
* pArgSet
);
107 virtual bool FillItemSet ( SfxItemSet
* rArgSet
) override
;
108 virtual void Reset ( const SfxItemSet
* rArgSet
) override
;
111 virtual void ActivatePage ( const SfxItemSet
& rSet
) override
;
112 virtual DeactivateRC
DeactivatePage ( SfxItemSet
* pSet
) override
;
115 OUString aStrUndefined
;
116 OUString aStrCommentsRowLabel
;
117 OUString aStrCommentsColLabel
;
118 OUString aStrImgRowLabel
;
119 OUString aStrImgColLabel
;
121 TypedWhichId
<ScSortItem
> nWhichSort
;
122 ScSortParam aSortData
;
123 ScViewData
* pViewData
;
127 std::unique_ptr
<CollatorResource
> m_xColRes
;
128 std::optional
<CollatorWrapper
> m_oColWrap
;
130 std::unique_ptr
<weld::CheckButton
> m_xBtnCase
;
131 std::unique_ptr
<weld::CheckButton
> m_xBtnFormats
;
132 std::unique_ptr
<weld::CheckButton
> m_xBtnNaturalSort
;
133 std::unique_ptr
<weld::CheckButton
> m_xBtnCopyResult
;
134 std::unique_ptr
<weld::ComboBox
> m_xLbOutPos
;
135 std::unique_ptr
<weld::Entry
> m_xEdOutPos
;
136 std::unique_ptr
<weld::CheckButton
> m_xBtnSortUser
;
137 std::unique_ptr
<weld::ComboBox
> m_xLbSortUser
;
138 std::unique_ptr
<SvxLanguageBox
> m_xLbLanguage
;
139 std::unique_ptr
<weld::Label
> m_xFtAlgorithm
;
140 std::unique_ptr
<weld::ComboBox
> m_xLbAlgorithm
;
141 std::unique_ptr
<weld::CheckButton
> m_xBtnIncComments
;
142 std::unique_ptr
<weld::CheckButton
> m_xBtnIncImages
;
146 void FillUserSortListBox ();
148 // Handler ------------------------
149 DECL_LINK( EnableHdl
, weld::Toggleable
&, void );
150 DECL_LINK( SelOutPosHdl
, weld::ComboBox
&, void );
151 void EdOutPosModHdl();
153 DECL_LINK( FillAlgorHdl
, weld::ComboBox
&, void );
156 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */