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 #ifndef DBAUI_APPSWAPWINDOW_HXX
28 #define DBAUI_APPSWAPWINDOW_HXX
29 
30 #ifndef DBACCESS_TABLEDESIGN_ICLIPBOARDTEST_HXX
31 #include "IClipBoardTest.hxx"
32 #endif
33 #ifndef _SV_LSTBOX_HXX
34 #include <vcl/lstbox.hxx>
35 #endif
36 #ifndef DBAUI_APPICONCONTROL_HXX
37 #include "AppIconControl.hxx"
38 #endif
39 #ifndef DBAUI_APPELEMENTTYPE_HXX
40 #include "AppElementType.hxx"
41 #endif
42 
43 namespace dbaui
44 {
45 	class OAppBorderWindow;
46 	//==================================================================
47 	class OApplicationSwapWindow :  public Window,
48 									public IClipboardTest
49 	{
50 		OApplicationIconControl				m_aIconControl;
51 		ElementType							m_eLastType;
52 		OAppBorderWindow&					m_rBorderWin;
53 
54 		void ImplInitSettings( sal_Bool bFont, sal_Bool bForeground, sal_Bool bBackground );
55 
56 		DECL_LINK( OnContainerSelectHdl,	SvtIconChoiceCtrl* );
57 		DECL_LINK( ChangeToLastSelected, void* );
58 	protected:
59 		virtual void DataChanged(const DataChangedEvent& rDCEvt);
60 	public:
61 		OApplicationSwapWindow( Window* _pParent, OAppBorderWindow& _rBorderWindow );
62 		virtual ~OApplicationSwapWindow();
63 		// window overloads
64 		virtual void Resize();
65 
66 
67 		inline sal_Bool isCutAllowed()		{ return sal_False; }
68 		inline sal_Bool isCopyAllowed()		{ return sal_False; }
69 		inline sal_Bool isPasteAllowed()	{ return sal_False; }
70 		virtual sal_Bool hasChildPathFocus() { return HasChildPathFocus(); }
71 		inline void copy()	{ }
72 		inline void cut()	{ }
73 		inline void paste()	{ }
74 
75 		inline sal_uLong					GetEntryCount() const { return m_aIconControl.GetEntryCount(); }
76 		inline SvxIconChoiceCtrlEntry*	GetEntry( sal_uLong nPos ) const { return m_aIconControl.GetEntry(nPos); }
77 		inline Rectangle				GetBoundingBox( SvxIconChoiceCtrlEntry* pEntry ) const { return m_aIconControl.GetBoundingBox(pEntry); }
78 
79         /** automatically creates mnemonics for the icon/texts in our left hand side panel
80         */
81         void    createIconAutoMnemonics( MnemonicGenerator& _rMnemonics );
82 
83         /** called to give the window the chance to intercept key events, while it has not
84             the focus
85 
86             @return <TRUE/> if and only if the event has been handled, and should not
87                 not be further processed
88         */
89         bool    interceptKeyInput( const KeyEvent& _rEvent );
90 
91 		/// return the element of currently select entry
92 		ElementType getElementType() const;
93 
94 
95 		/** clears the selection in the icon choice control and calls the handler
96 		*/
97 		void clearSelection();
98 
99 		/** changes the container which should be displayed. The select handler will also be called.
100 			@param	_eType
101 				Which container to show.
102 		*/
103 		void selectContainer(ElementType _eType);
104 
105     private:
106         bool onContainerSelected( ElementType _eType );
107 	};
108 // .............................................................
109 } // namespace dbaui
110 // .............................................................
111 #endif // DBAUI_APPSWAPWINDOW_HXX
112 
113