update dev300-m58
[ooovba.git] / sc / source / ui / inc / inputwin.hxx
blobe162fbf7e2326f831bdce7ef29edab4e3c72336a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: inputwin.hxx,v $
10 * $Revision: 1.17.32.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_INPUTWIN_HXX
32 #define SC_INPUTWIN_HXX
35 #ifndef _TOOLBOX_HXX //autogen
36 #include <vcl/toolbox.hxx>
37 #endif
38 #include <sfx2/childwin.hxx>
39 #include <svtools/lstner.hxx>
40 #ifndef _COMBOBOX_HXX //autogen
41 #include <vcl/combobox.hxx>
42 #endif
43 #include <vcl/window.hxx>
44 #include <svtools/transfer.hxx>
46 class ScEditEngineDefaulter;
47 class EditView;
48 struct ESelection;
49 class ScInputHandler;
50 class ScAccessibleEditLineTextData;
51 struct EENotify;
52 class ScRangeList;
54 //========================================================================
56 class ScTextWnd : public Window, public DragSourceHelper // edit window
58 public:
59 ScTextWnd( Window* pParent );
60 virtual ~ScTextWnd();
62 void SetTextString( const String& rString );
63 const String& GetTextString() const;
65 BOOL IsInputActive();
66 EditView* GetEditView();
68 // fuer FunktionsAutopiloten
69 void MakeDialogEditView();
71 void StartEditEngine();
72 void StopEditEngine( BOOL bAll );
74 virtual void DataChanged( const DataChangedEvent& rDCEvt );
76 void SetFormulaMode( BOOL bSet );
78 virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
80 void SetAccessibleTextData(ScAccessibleEditLineTextData* pTextData) {pAccTextData = pTextData;}
82 DECL_LINK( NotifyHdl, EENotify* );
84 protected:
85 virtual void Paint( const Rectangle& rRec );
86 virtual void Resize();
88 virtual void MouseMove( const MouseEvent& rMEvt );
89 virtual void MouseButtonDown( const MouseEvent& rMEvt );
90 virtual void MouseButtonUp( const MouseEvent& rMEvt );
91 virtual void Command( const CommandEvent& rCEvt );
92 virtual void KeyInput(const KeyEvent& rKEvt);
93 virtual void GetFocus();
94 virtual void LoseFocus();
96 virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel );
98 virtual String GetText() const;
100 private:
101 void ImplInitSettings();
102 void UpdateAutoCorrFlag();
104 private:
105 String aString;
106 Font aTextFont;
107 ScEditEngineDefaulter* pEditEngine; // erst bei Bedarf angelegt
108 EditView* pEditView;
109 ScAccessibleEditLineTextData* pAccTextData;
110 BOOL bIsRTL;
111 BOOL bIsInsertMode;
112 BOOL bFormulaMode;
114 // #102710#; this flag should be true if a key input or a command is handled
115 // it prevents the call of InputChanged in the ModifyHandler of the EditEngine
116 BOOL bInputMode;
119 //========================================================================
121 class ScPosWnd : public ComboBox, public SfxListener // Positionsanzeige
123 private:
124 String aPosStr;
125 Accelerator* pAccel;
126 ULONG nTipVisible;
127 BOOL bFormulaMode;
128 BOOL bTopHadFocus;
130 public:
131 ScPosWnd( Window* pParent );
132 virtual ~ScPosWnd();
134 void SetPos( const String& rPosStr ); // angezeigter Text
135 void SetFormulaMode( BOOL bSet );
137 protected:
138 virtual void Select();
139 virtual void Modify();
141 virtual long Notify( NotifyEvent& rNEvt );
143 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint );
145 private:
146 void FillRangeNames();
147 void FillFunctions();
148 void DoEnter();
149 void HideTip();
151 void ReleaseFocus_Impl();
154 //========================================================================
156 class ScInputWindow : public ToolBox // Parent-Toolbox
158 public:
159 ScInputWindow( Window* pParent, SfxBindings* pBind );
160 virtual ~ScInputWindow();
162 virtual void Resize();
163 virtual void Select();
165 void SetFuncString( const String& rString, BOOL bDoEdit = TRUE );
166 void SetPosString( const String& rStr );
167 void SetTextString( const String& rString );
169 void SetOkCancelMode();
170 void SetSumAssignMode();
171 void EnableButtons( BOOL bEnable = TRUE );
173 void SetFormulaMode( BOOL bSet );
175 BOOL IsInputActive();
176 EditView* GetEditView();
177 //UNUSED2008-05 EditView* ActivateEdit( const String& rText,
178 //UNUSED2008-05 const ESelection& rSel );
180 void TextGrabFocus();
181 void TextInvalidate();
182 void SwitchToTextWin();
184 void PosGrabFocus();
186 // Fuer FunktionsAutopiloten
187 void MakeDialogEditView();
189 void StopEditEngine( BOOL bAll );
191 void SetInputHandler( ScInputHandler* pNew );
193 ScInputHandler* GetInputHandler(){ return pInputHdl;}
195 void StateChanged( StateChangedType nType );
196 virtual void DataChanged( const DataChangedEvent& rDCEvt );
199 protected:
200 virtual void SetText( const String& rString );
201 virtual String GetText() const;
203 sal_Bool UseSubTotal( ScRangeList* pRangeList ) const;
205 private:
206 ScPosWnd aWndPos;
207 ScTextWnd aTextWindow;
208 ScInputHandler* pInputHdl;
209 SfxBindings* pBindings;
210 String aTextOk;
211 String aTextCancel;
212 String aTextSum;
213 String aTextEqual;
214 BOOL bIsOkCancelMode;
217 //==================================================================
219 class ScInputWindowWrapper : public SfxChildWindow
221 public:
222 ScInputWindowWrapper( Window* pParent,
223 USHORT nId,
224 SfxBindings* pBindings,
225 SfxChildWinInfo* pInfo );
227 SFX_DECL_CHILDWINDOW(ScInputWindowWrapper);
231 #endif