Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License or as specified alternatively below. You may obtain a copy of
8 : * the License at http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * Major Contributor(s):
16 : * Copyright (C) 2012 Albert Thuswaldner <albert.thuswaldner@gmail.com> (initial developer)
17 : *
18 : * All Rights Reserved.
19 : *
20 : * For minor contributions see the git repository.
21 : *
22 : * Alternatively, the contents of this file may be used under the terms of
23 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : * instead of those above.
27 : */
28 :
29 : #ifndef SC_SORTKEYDLG_HXX
30 : #define SC_SORTKEYDLG_HXX
31 :
32 : #include <boost/ptr_container/ptr_vector.hpp>
33 :
34 : #include "anyrefdg.hxx"
35 : #include "sortdlg.hrc"
36 :
37 : #include <vcl/edit.hxx>
38 : #include <vcl/fixed.hxx>
39 : #include <vcl/layout.hxx>
40 : #include <vcl/lstbox.hxx>
41 : #include <vcl/scrbar.hxx>
42 : #include <vcl/ctrl.hxx>
43 : #include <svtools/stdctrl.hxx>
44 : #include <svx/langbox.hxx>
45 :
46 : // =======================================================================
47 :
48 0 : struct ScSortKeyItem : public VclBuilderContainer
49 : {
50 : VclFrame* m_pFrame;
51 : FixedText* m_pFlSort;
52 : ListBox* m_pLbSort;
53 : RadioButton* m_pBtnUp;
54 : RadioButton* m_pBtnDown;
55 :
56 : ScSortKeyItem(Window* pParent);
57 :
58 : void DisableField();
59 : void EnableField();
60 :
61 : long getItemHeight() const;
62 : };
63 :
64 : typedef boost::ptr_vector<ScSortKeyItem> ScSortKeyItems;
65 :
66 : // =======================================================================
67 :
68 : class ScSortKeyWindow
69 : {
70 : private:
71 : VclBox* m_pBox;
72 : sal_Int32 nItemHeight;
73 :
74 : ScSortKeyItems& mrSortKeyItems;
75 :
76 : public:
77 : ScSortKeyWindow(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
78 : ~ScSortKeyWindow();
79 :
80 : void AddSortKey( sal_uInt16 nItem );
81 : void DoScroll( sal_Int32 nNewPos );
82 0 : sal_Int32 GetItemHeight() const { return nItemHeight; }
83 : sal_Int32 GetTotalHeight() const { return m_pBox->GetSizePixel().Height(); }
84 : };
85 :
86 : // =======================================================================
87 :
88 0 : class ScSortKeyCtrl
89 : {
90 : private:
91 : ScSortKeyWindow m_aSortWin;
92 : VclScrolledWindow& m_rScrolledWindow;
93 : ScrollBar& m_rVertScroll;
94 :
95 : DECL_LINK(ScrollHdl, ScrollBar*);
96 :
97 : public:
98 : ScSortKeyCtrl(SfxTabPage* pParent, ScSortKeyItems& mrSortKeyItems);
99 : void setScrollRange();
100 : void AddSortKey( sal_uInt16 nItem );
101 : };
102 :
103 : #endif // SC_SORTKEYDLG_HXX
104 :
105 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|