xref: /aoo42x/main/sw/source/ui/inc/inputwin.hxx (revision cdf0e10c)
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 SW_INPUTWIN_HXX
28 #define SW_INPUTWIN_HXX
29 
30 #include <vcl/edit.hxx>
31 #include <vcl/menu.hxx>
32 #include <vcl/toolbox.hxx>
33 
34 #include <sfx2/childwin.hxx>
35 
36 class SwFldMgr;
37 class SwWrtShell;
38 class SwView;
39 class SfxDispatcher;
40 
41 //========================================================================
42 class InputEdit : public Edit
43 {
44 public:
45 					InputEdit(Window* pParent, WinBits nStyle) :
46 						Edit(pParent , nStyle){}
47 
48 	void			UpdateRange(const String& aSel,
49 								const String& aTblName );
50 
51 protected:
52 	virtual void 	KeyInput( const KeyEvent&  );
53 };
54 
55 //========================================================================
56 
57 class SwInputWindow : public ToolBox
58 {
59 friend class InputEdit;
60 
61 	Edit			aPos;
62 	InputEdit		aEdit;
63 	PopupMenu		aPopMenu;
64 	SwFldMgr*		pMgr;
65 	SwWrtShell*		pWrtShell;
66 	SwView*			pView;
67     SfxBindings*    pBindings;
68 	String 			aAktTableName, sOldFml;
69     sal_Int32       m_nActionCount;
70 
71 	sal_Bool		bFirst : 1;  //Initialisierungen beim ersten Aufruf
72 	sal_Bool		bActive : 1; //fuer Hide/Show beim Dokumentwechsel
73 	sal_Bool		bIsTable : 1;
74 	sal_Bool		bDelSel : 1;
75     bool            m_bDoesUndo : 1;
76     bool            m_bResetUndo : 1;
77     bool            m_bCallUndo : 1;
78 
79     void CleanupUglyHackWithUndo();
80 
81 	void DelBoxCntnt();
82 	DECL_LINK( ModifyHdl, InputEdit* );
83 
84     using Window::IsActive;
85 
86 protected:
87 	virtual void 	Resize();
88 	virtual void 	Click();
89 	DECL_LINK( MenuHdl, Menu * );
90     DECL_LINK( DropdownClickHdl, ToolBox* );
91 	void 			ApplyFormula();
92 	void 			CancelFormula();
93 
94 public:
95                     SwInputWindow( Window* pParent, SfxBindings* pBindings );
96 	virtual			~SwInputWindow();
97 
98     virtual void    DataChanged( const DataChangedEvent& rDCEvt );
99 
100 	void			SelectHdl( ToolBox*);
101 
102 	void 			ShowWin();
103 
104 	sal_Bool			IsActive(){ return bActive; };
105 
106 	DECL_LINK( SelTblCellsNotify, SwWrtShell * );
107 
108 	void 			SetFormula( const String& rFormula, sal_Bool bDelSel = sal_True );
109 	const SwView*	GetView() const{return pView;}
110 };
111 
112 class SwInputChild : public SfxChildWindow
113 {
114 	sal_Bool 			bObjVis;
115 	SfxDispatcher* 	pDispatch;
116 public:
117 	SwInputChild( Window* ,
118 						sal_uInt16 nId,
119 						SfxBindings*,
120 						SfxChildWinInfo*  );
121 	~SwInputChild();
122 	SFX_DECL_CHILDWINDOW( SwInputChild );
123 	void 			SetFormula( const String& rFormula, sal_Bool bDelSel = sal_True )
124 						{ ((SwInputWindow*)pWindow)->SetFormula(
125 									rFormula, bDelSel ); }
126 	const SwView*	GetView() const{return ((SwInputWindow*)pWindow)->GetView();}
127 
128 };
129 
130 //==================================================================
131 
132 #endif
133 
134