LibreOffice Module sc (master)  1
tpsort.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 #ifndef INCLUDED_SC_SOURCE_UI_INC_TPSORT_HXX
21 #define INCLUDED_SC_SOURCE_UI_INC_TPSORT_HXX
22 
23 #include <vector>
24 
25 #include <sfx2/tabdlg.hxx>
26 #include <svtools/collatorres.hxx>
27 #include <svx/langbox.hxx>
29 #include <vcl/idle.hxx>
30 
31 #include "sortkeydlg.hxx"
32 
33 #include <address.hxx>
34 #include <sheetlimits.hxx>
35 #include <sortparam.hxx>
36 
37 // +1 because one field is reserved for the "- undefined -" entry
38 inline SCCOL SC_MAXFIELDS(const ScSheetLimits& rLimits) { return rLimits.GetMaxColCount() + 1; }
39 
40 class ScViewData;
41 
42 // Sort Criteria
43 
45 {
46 public:
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;
50 
51  virtual bool FillItemSet ( SfxItemSet* rArgSet ) override;
52  virtual void Reset ( const SfxItemSet* rArgSet ) override;
53 
54 protected:
55  virtual void ActivatePage ( const SfxItemSet& rSet ) override;
56  virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
57 
58 private:
60 
61  OUString aStrUndefined;
62  OUString aStrColumn;
63  OUString aStrRow;
64 
65  const sal_uInt16 nWhichSort;
68  std::vector<SCCOLROW> nFieldArr;
69  sal_uInt16 nFieldCount;
70  sal_uInt16 nSortKeyCount;
71 
72  bool bHasHeader;
74 
75  std::unique_ptr<weld::ScrolledWindow> m_xScrolledWindow;
76  std::unique_ptr<weld::Container> m_xBox;
78 
79  void AddSortKey( sal_uInt16 nItem );
80 
81 private:
82  void Init ();
83  void FillFieldLists ( sal_uInt16 nStartField );
84  sal_uInt16 GetFieldSelPos ( SCCOLROW nField );
85  void SetLastSortKey( sal_uInt16 nItem );
86 
87  // Handler ------------------------
88  DECL_LINK(SelectHdl, weld::ComboBox&, void);
89  DECL_LINK(ScrollToEndHdl, Timer*, void);
90 };
91 
92 // Sort Options
93 
94 class ScDocument;
95 
97 {
98 public:
99  ScTabPageSortOptions(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rArgSet);
100  static std::unique_ptr<SfxTabPage> Create(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet* pArgSet);
101 
102  virtual bool FillItemSet ( SfxItemSet* rArgSet ) override;
103  virtual void Reset ( const SfxItemSet* rArgSet ) override;
104 
105 protected:
106  virtual void ActivatePage ( const SfxItemSet& rSet ) override;
107  virtual DeactivateRC DeactivatePage ( SfxItemSet* pSet ) override;
108 
109 private:
110  OUString aStrRowLabel;
111  OUString aStrColLabel;
112  OUString aStrUndefined;
113 
114  const sal_uInt16 nWhichSort;
119 
120  std::unique_ptr<CollatorResource> m_xColRes;
121  std::unique_ptr<CollatorWrapper> m_xColWrap;
122 
123  std::unique_ptr<weld::CheckButton> m_xBtnCase;
124  std::unique_ptr<weld::CheckButton> m_xBtnHeader;
125  std::unique_ptr<weld::CheckButton> m_xBtnFormats;
126  std::unique_ptr<weld::CheckButton> m_xBtnNaturalSort;
127  std::unique_ptr<weld::CheckButton> m_xBtnCopyResult;
128  std::unique_ptr<weld::ComboBox> m_xLbOutPos;
129  std::unique_ptr<weld::Entry> m_xEdOutPos;
130  std::unique_ptr<weld::CheckButton> m_xBtnSortUser;
131  std::unique_ptr<weld::ComboBox> m_xLbSortUser;
132  std::unique_ptr<SvxLanguageBox> m_xLbLanguage;
133  std::unique_ptr<weld::Label> m_xFtAlgorithm;
134  std::unique_ptr<weld::ComboBox> m_xLbAlgorithm;
135  std::unique_ptr<weld::RadioButton> m_xBtnTopDown;
136  std::unique_ptr<weld::RadioButton> m_xBtnLeftRight;
137  std::unique_ptr<weld::CheckButton> m_xBtnIncComments;
138  std::unique_ptr<weld::CheckButton> m_xBtnIncImages;
139 
140 private:
141  void Init ();
142  void FillUserSortListBox ();
143 
144  // Handler ------------------------
145  DECL_LINK( EnableHdl, weld::ToggleButton&, void );
146  DECL_LINK( SelOutPosHdl, weld::ComboBox&, void );
147  void EdOutPosModHdl();
148  DECL_LINK( SortDirHdl, weld::ToggleButton&, void );
149  void FillAlgor();
150  DECL_LINK( FillAlgorHdl, weld::ComboBox&, void );
151 };
152 
153 #endif // INCLUDED_SC_SOURCE_UI_INC_TPSORT_HXX
154 
155 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
std::unique_ptr< weld::ComboBox > m_xLbAlgorithm
Definition: tpsort.hxx:134
std::unique_ptr< weld::CheckButton > m_xBtnSortUser
Definition: tpsort.hxx:130
DECL_LINK(EnableHdl, weld::ToggleButton &, void)
std::unique_ptr< SvxLanguageBox > m_xLbLanguage
Definition: tpsort.hxx:132
std::unique_ptr< weld::Entry > m_xEdOutPos
Definition: tpsort.hxx:129
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsort.cxx:655
OUString aStrUndefined
Definition: tpsort.hxx:61
const SfxItemSet * pSet
std::unique_ptr< weld::ComboBox > m_xLbOutPos
Definition: tpsort.hxx:128
OUString aStrUndefined
Definition: tpsort.hxx:112
ScViewData * pViewData
Definition: tpsort.hxx:116
ScTabPageSortOptions(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsort.cxx:480
ScSortParam aSortData
Definition: tpsort.hxx:115
SCCOL GetMaxColCount() const
Definition: sheetlimits.hxx:64
DECL_LINK(SelectHdl, weld::ComboBox &, void)
sal_uInt16 GetFieldSelPos(SCCOLROW nField)
Definition: tpsort.cxx:387
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tpsort.cxx:275
std::unique_ptr< weld::RadioButton > m_xBtnLeftRight
Definition: tpsort.hxx:136
OUString aStrRow
Definition: tpsort.hxx:63
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpsort.cxx:729
std::unique_ptr< weld::CheckButton > m_xBtnHeader
Definition: tpsort.hxx:124
ScAddress theOutPos
Definition: tpsort.hxx:118
ScSortParam aSortData
Definition: tpsort.hxx:67
std::unique_ptr< weld::CheckButton > m_xBtnNaturalSort
Definition: tpsort.hxx:126
void SetLastSortKey(sal_uInt16 nItem)
Definition: tpsort.cxx:404
sal_Int32 SCCOLROW
a type capable of holding either SCCOL or SCROW
Definition: types.hxx:24
std::unique_ptr< weld::CheckButton > m_xBtnCopyResult
Definition: tpsort.hxx:127
ScViewData * pViewData
Definition: tpsort.hxx:66
std::unique_ptr< weld::CheckButton > m_xBtnIncComments
Definition: tpsort.hxx:137
virtual DeactivateRC DeactivatePage(SfxItemSet *pSet) override
Definition: tpsort.cxx:298
virtual ~ScTabPageSortFields() override
Definition: tpsort.cxx:101
std::unique_ptr< weld::ComboBox > m_xLbSortUser
Definition: tpsort.hxx:131
std::unique_ptr< weld::ScrolledWindow > m_xScrolledWindow
Definition: tpsort.hxx:75
sal_uInt16 nSortKeyCount
Definition: tpsort.hxx:70
sal_Int16 SCCOL
Definition: types.hxx:22
std::unique_ptr< weld::Container > m_xBox
Definition: tpsort.hxx:76
ScSortKeyWindow m_aSortWin
Definition: tpsort.hxx:77
void FillUserSortListBox()
Definition: tpsort.cxx:783
virtual bool FillItemSet(SfxItemSet *rArgSet) override
Definition: tpsort.cxx:212
void FillFieldLists(sal_uInt16 nStartField)
Definition: tpsort.cxx:315
const sal_uInt16 nWhichSort
Definition: tpsort.hxx:65
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *rArgSet)
Definition: tpsort.cxx:126
OUString aStrColumn
Definition: tpsort.hxx:62
std::unique_ptr< weld::RadioButton > m_xBtnTopDown
Definition: tpsort.hxx:135
std::unique_ptr< CollatorWrapper > m_xColWrap
Definition: tpsort.hxx:121
virtual void ActivatePage(const SfxItemSet &rSet) override
Definition: tpsort.cxx:705
sal_uInt16 nFieldCount
Definition: tpsort.hxx:69
void AddSortKey(sal_uInt16 nItem)
Definition: tpsort.cxx:472
std::unique_ptr< weld::CheckButton > m_xBtnIncImages
Definition: tpsort.hxx:138
std::unique_ptr< weld::CheckButton > m_xBtnFormats
Definition: tpsort.hxx:125
std::unique_ptr< CollatorResource > m_xColRes
Definition: tpsort.hxx:120
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsort.cxx:586
std::unique_ptr< weld::Label > m_xFtAlgorithm
Definition: tpsort.hxx:133
virtual void Reset(const SfxItemSet *rArgSet) override
Definition: tpsort.cxx:131
const sal_uInt16 nWhichSort
Definition: tpsort.hxx:114
OUString aStrColLabel
Definition: tpsort.hxx:111
std::vector< SCCOLROW > nFieldArr
Definition: tpsort.hxx:68
SCCOL SC_MAXFIELDS(const ScSheetLimits &rLimits)
Definition: tpsort.hxx:38
ScTabPageSortFields(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet &rArgSet)
Definition: tpsort.cxx:71
DeactivateRC
std::unique_ptr< weld::CheckButton > m_xBtnCase
Definition: tpsort.hxx:123
OUString aStrRowLabel
Definition: tpsort.hxx:110
ScDocument * pDoc
Definition: tpsort.hxx:117
static std::unique_ptr< SfxTabPage > Create(weld::Container *pPage, weld::DialogController *pController, const SfxItemSet *pArgSet)
Definition: tpsort.cxx:581