1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _DBAUI_MARKTREE_HXX_ 29 #define _DBAUI_MARKTREE_HXX_ 30 31 #ifndef DBAUI_DBTREELISTBOX_HXX 32 #include "dbtreelistbox.hxx" 33 #endif 34 35 36 37 //......................................................................... 38 namespace dbaui 39 { 40 //......................................................................... 41 42 //======================================================================== 43 //= OMarkableTreeListBox 44 //======================================================================== 45 /** a tree list box where all entries can be marked (with a checkbox) and 46 unmarked. In addition, inner nodes know a third state which applies 47 if some, but not all of their descendants are marked. 48 */ 49 class OMarkableTreeListBox : public DBTreeListBox 50 { 51 SvLBoxButtonData* m_pCheckButton; 52 Link m_aCheckButtonHandler; 53 54 public: 55 OMarkableTreeListBox( Window* pParent 56 ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 57 , WinBits nWinStyle=0 ); 58 OMarkableTreeListBox( Window* pParent 59 ,const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB 60 , const ResId& rResId ); 61 ~OMarkableTreeListBox(); 62 63 virtual void KeyInput( const KeyEvent& rKEvt ); 64 virtual void CheckButtonHdl(); 65 void CheckButtons(); // make the button states consistent (bottom-up) 66 67 /// the handler given is called whenever the check state of one or more items changed 68 void SetCheckHandler(const Link& _rHdl) { m_aCheckButtonHandler = _rHdl; } 69 70 protected: 71 virtual void Paint(const Rectangle& _rRect); 72 virtual void checkedButton_noBroadcast(SvLBoxEntry* _pEntry); 73 74 SvButtonState implDetermineState(SvLBoxEntry* _pEntry); 75 // determines the check state of the given entry, by analyzing the states of all descendants 76 77 private: 78 void InitButtonData(); 79 }; 80 81 //......................................................................... 82 } // namespace dbaui 83 //......................................................................... 84 85 #endif // _DBAUI_MARKTREE_HXX_ 86 87