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