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