xref: /AOO41X/main/svx/inc/svx/simptabl.hxx (revision 3334a7e6acdae9820fa1a6f556bb10129a8de6b2)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SVX_SIMPTABL_HXX
25 #define _SVX_SIMPTABL_HXX
26 
27 #ifndef _MOREBTN_HXX //autogen
28 #include <vcl/morebtn.hxx>
29 #endif
30 
31 #ifndef _COMBOBOX_HXX //autogen
32 #include <vcl/combobox.hxx>
33 #endif
34 
35 #ifndef _GROUP_HXX //autogen
36 #include <vcl/group.hxx>
37 #endif
38 #include <svtools/headbar.hxx>
39 #include <svtools/svtabbx.hxx>
40 #include <vcl/lstbox.hxx>
41 #include "svx/svxdllapi.h"
42 
43 class SvxSimpleTable;
44 class SvxSimpTblContainer : public Control
45 {
46 private:
47     SvxSimpleTable*     m_pTable;
48 
49 protected:
50     virtual long        PreNotify( NotifyEvent& rNEvt );
51 
52 public:
53     SvxSimpTblContainer( Window* pParent, WinBits nWinStyle = 0 );
54     SvxSimpTblContainer( Window* pParent, const ResId& rResId );
55 
SetTable(SvxSimpleTable * _pTable)56     inline void         SetTable( SvxSimpleTable* _pTable ) { m_pTable = _pTable; }
57 };
58 
59 class SVX_DLLPUBLIC SvxSimpleTable : public SvHeaderTabListBox
60 {
61     using Window::SetPosSizePixel;
62 private:
63 
64     Link                aHeaderBarClickLink;
65     Link                aHeaderBarDblClickLink;
66     Link                aCommandLink;
67     CommandEvent        aCEvt;
68     SvxSimpTblContainer aPrivContainer;
69     HeaderBar           aHeaderBar;
70     long                nOldPos;
71     sal_uInt16              nHeaderItemId;
72     sal_Bool                bResizeFlag;
73     sal_Bool                bPaintFlag;
74     sal_Bool                bSortDirection;
75     sal_uInt16              nSortCol;
76     Window*             pMyParentWin;
77 
78     DECL_LINK( StartDragHdl, HeaderBar* );
79     DECL_LINK( DragHdl, HeaderBar* );
80     DECL_LINK( EndDragHdl, HeaderBar* );
81     DECL_LINK( HeaderBarClick, HeaderBar* );
82     DECL_LINK( HeaderBarDblClick, HeaderBar* );
83     DECL_LINK( CompareHdl, SvSortData* );
84 
85 protected:
86 
87     virtual void            NotifyScrolled();
88 
89     virtual void            SetTabs();
90     virtual void            Paint( const Rectangle& rRect );
91     virtual void            UpdateViewSize();
92 
93     virtual void            HBarClick();
94     virtual void            HBarDblClick();
95     virtual void            HBarStartDrag();
96     virtual void            HBarDrag();
97     virtual void            HBarEndDrag();
98 
99     virtual void            Command( const CommandEvent& rCEvt );
100 
101     virtual StringCompare   ColCompare(SvLBoxEntry*,SvLBoxEntry*);
GetTheHeaderBar()102     HeaderBar*              GetTheHeaderBar(){return &aHeaderBar;}
103 
104 public:
105 
106     SvxSimpleTable( Window* pParent,WinBits nBits =WB_BORDER );
107     SvxSimpleTable( Window* pParent,const ResId& );
108     ~SvxSimpleTable();
109 
110     void            InsertHeaderEntry(const XubString& rText,
111                             sal_uInt16 nCol=HEADERBAR_APPEND,
112                             HeaderBarItemBits nBits = HIB_STDSTYLE);
113 
114     void            SetTabs( long* pTabs, MapUnit = MAP_APPFONT );
115 
116     void            ClearAll();
117     void            ClearHeader();
118 
119     // to be removed all calls of the related methods are redirected to *Table() methods
120     using Window::Show;
121     using Window::Hide;
122     using Window::Enable;
123     using Window::Disable;
124     using Window::ToTop;
125 
126     void            Show();
127     void            Hide();
128     void            Enable();
129     void            Disable();
130     void            ToTop();
131 
132     // remove until this line
133 
134     void            ShowTable();
135     void            HideTable();
136     sal_Bool            IsVisible() const;
137 
138     void            EnableTable();
139     void            DisableTable();
140     sal_Bool            IsEnabled() const;
141 
142     void            TableToTop();
143     void            SetPosPixel( const Point& rNewPos );
144     Point           GetPosPixel() const ;
145     virtual void    SetPosSizePixel( const Point& rNewPos, Size& rNewSize );
146     void            SetPosSize( const Point& rNewPos, const Size& rNewSize );
147     void            SetSizePixel(const Size& rNewSize );
148     void            SetOutputSizePixel(const Size& rNewSize );
149 
150     Size            GetSizePixel() const;
151     Size            GetOutputSizePixel() const;
152 
153     sal_uInt16          GetSelectedCol();
154     void            SortByCol(sal_uInt16,sal_Bool bDir=sal_True);
GetSortDirection()155     sal_Bool            GetSortDirection(){ return bSortDirection;}
GetSortedCol()156     sal_uInt16          GetSortedCol(){ return nSortCol;}
157     SvLBoxItem*     GetEntryAtPos( SvLBoxEntry* pEntry, sal_uInt16 nPos ) const;
158 
159     CommandEvent    GetCommandEvent()const;
IsFocusOnCellEnabled() const160     inline sal_Bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
161 
SetCommandHdl(const Link & rLink)162     void            SetCommandHdl( const Link& rLink ) { aCommandLink = rLink; }
GetCommandHdl() const163     const Link&     GetCommandHdl() const { return aCommandLink; }
164 
SetHeaderBarClickHdl(const Link & rLink)165     void            SetHeaderBarClickHdl( const Link& rLink ) { aHeaderBarClickLink = rLink; }
GetHeaderBarClickHdl() const166     const Link&     GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
167 
SetHeaderBarDblClickHdl(const Link & rLink)168     void            SetHeaderBarDblClickHdl( const Link& rLink ) { aHeaderBarDblClickLink = rLink; }
GetHeaderBarDblClickHdl() const169     const Link&     GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
170 
SetHeaderBarHelpId(const rtl::OString & rHelpId)171     void            SetHeaderBarHelpId(const rtl::OString& rHelpId) {aHeaderBar.SetHelpId(rHelpId);}
172 };
173 
174 
175 #endif // _SVX_SIMPTABL_HXX
176 
177