Branch libreoffice-5-0-4
[LibreOffice.git] / include / svtools / simptabl.hxx
blob90346fbba9b46c2e4b6ef569d34a4cba661b58d1
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #ifndef INCLUDED_SVTOOLS_SIMPTABL_HXX
21 #define INCLUDED_SVTOOLS_SIMPTABL_HXX
23 #include <svtools/svtdllapi.h>
24 #include <svtools/headbar.hxx>
25 #include <svtools/svtabbx.hxx>
26 #include <unotools/intlwrapper.hxx>
28 class SvSimpleTable;
29 class SVT_DLLPUBLIC SvSimpleTableContainer : public Control
31 private:
32 VclPtr<SvSimpleTable> m_pTable;
34 protected:
35 virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
37 public:
38 SvSimpleTableContainer( vcl::Window* pParent, WinBits nBits = WB_BORDER );
39 virtual ~SvSimpleTableContainer();
40 virtual void dispose() SAL_OVERRIDE;
42 void SetTable(SvSimpleTable* pTable);
44 virtual void Resize() SAL_OVERRIDE;
46 virtual void GetFocus() SAL_OVERRIDE;
49 class SVT_DLLPUBLIC SvSimpleTable : public SvHeaderTabListBox
51 private:
52 SvSimpleTableContainer& m_rParentTableContainer;
54 Link<> aHeaderBarClickLink;
55 Link<> aHeaderBarDblClickLink;
56 Link<> aCommandLink;
57 CommandEvent aCEvt;
58 VclPtr<HeaderBar> aHeaderBar;
59 long nOldPos;
60 sal_uInt16 nHeaderItemId;
61 bool bPaintFlag;
62 bool bSortDirection;
63 sal_uInt16 nSortCol;
65 const CollatorWrapper aCollator;
67 DECL_LINK( StartDragHdl, HeaderBar* );
68 DECL_LINK( DragHdl, HeaderBar* );
69 DECL_LINK( EndDragHdl, HeaderBar* );
70 DECL_LINK( HeaderBarClick, HeaderBar* );
71 DECL_LINK( HeaderBarDblClick, HeaderBar* );
72 DECL_LINK( CompareHdl, SvSortData* );
74 protected:
76 virtual void NotifyScrolled() SAL_OVERRIDE;
78 virtual void SetTabs() SAL_OVERRIDE;
79 virtual void Paint( vcl::RenderContext& rRenderContext, const Rectangle& rRect ) SAL_OVERRIDE;
81 virtual void HBarClick();
82 void HBarDblClick();
83 void HBarStartDrag();
84 void HBarDrag();
85 void HBarEndDrag();
87 virtual void Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
89 virtual sal_Int32 ColCompare(SvTreeListEntry*,SvTreeListEntry*);
90 public:
92 SvSimpleTable(SvSimpleTableContainer& rParent, WinBits nBits = WB_BORDER);
93 virtual ~SvSimpleTable();
94 virtual void dispose() SAL_OVERRIDE;
96 void UpdateViewSize();
98 void InsertHeaderEntry(const OUString& rText,
99 sal_uInt16 nCol=HEADERBAR_APPEND,
100 HeaderBarItemBits nBits = HeaderBarItemBits::STDSTYLE);
102 void SetTabs(const long* pTabs, MapUnit = MAP_APPFONT);
104 void ClearHeader();
106 void ShowTable();
107 void HideTable();
108 bool IsVisible() const;
110 void EnableTable();
111 void DisableTable();
112 bool IsEnabled() const;
114 sal_uInt16 GetSelectedCol();
115 void SortByCol(sal_uInt16, bool bDir=true);
116 bool GetSortDirection(){ return bSortDirection;}
117 sal_uInt16 GetSortedCol(){ return nSortCol;}
118 SvLBoxItem* GetEntryAtPos( SvTreeListEntry* pEntry, sal_uInt16 nPos ) const;
120 CommandEvent GetCommandEvent()const { return aCEvt;}
121 inline bool IsFocusOnCellEnabled() const { return IsCellFocusEnabled(); }
123 void SetCommandHdl( const Link<>& rLink ) { aCommandLink = rLink; }
124 const Link<>& GetCommandHdl() const { return aCommandLink; }
126 void SetHeaderBarClickHdl( const Link<>& rLink ) { aHeaderBarClickLink = rLink; }
127 const Link<>& GetHeaderBarClickHdl() const { return aHeaderBarClickLink; }
129 void SetHeaderBarDblClickHdl( const Link<>& rLink ) { aHeaderBarDblClickLink = rLink; }
130 const Link<>& GetHeaderBarDblClickHdl() const { return aHeaderBarDblClickLink; }
132 void SetHeaderBarHelpId(const OString& rHelpId) { aHeaderBar->SetHelpId(rHelpId); }
134 HeaderBar& GetTheHeaderBar() { return *aHeaderBar.get(); }
138 #endif // INCLUDED_SVTOOLS_SIMPTABL_HXX
140 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */