1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir #ifndef SC_INPUTWIN_HXX 29*cdf0e10cSrcweir #define SC_INPUTWIN_HXX 30*cdf0e10cSrcweir 31*cdf0e10cSrcweir #include <vector> 32*cdf0e10cSrcweir #include <vcl/toolbox.hxx> 33*cdf0e10cSrcweir #include <sfx2/childwin.hxx> 34*cdf0e10cSrcweir #include <svl/lstner.hxx> 35*cdf0e10cSrcweir #include <vcl/combobox.hxx> 36*cdf0e10cSrcweir #include <vcl/window.hxx> 37*cdf0e10cSrcweir #include <svtools/transfer.hxx> 38*cdf0e10cSrcweir 39*cdf0e10cSrcweir class ScEditEngineDefaulter; 40*cdf0e10cSrcweir class EditView; 41*cdf0e10cSrcweir struct ESelection; 42*cdf0e10cSrcweir class ScInputHandler; 43*cdf0e10cSrcweir class ScAccessibleEditLineTextData; 44*cdf0e10cSrcweir struct EENotify; 45*cdf0e10cSrcweir class ScRangeList; 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir //======================================================================== 48*cdf0e10cSrcweir 49*cdf0e10cSrcweir class ScTextWnd : public Window, public DragSourceHelper // edit window 50*cdf0e10cSrcweir { 51*cdf0e10cSrcweir public: 52*cdf0e10cSrcweir ScTextWnd( Window* pParent ); 53*cdf0e10cSrcweir virtual ~ScTextWnd(); 54*cdf0e10cSrcweir 55*cdf0e10cSrcweir void SetTextString( const String& rString ); 56*cdf0e10cSrcweir const String& GetTextString() const; 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir sal_Bool IsInputActive(); 59*cdf0e10cSrcweir EditView* GetEditView(); 60*cdf0e10cSrcweir 61*cdf0e10cSrcweir // fuer FunktionsAutopiloten 62*cdf0e10cSrcweir void MakeDialogEditView(); 63*cdf0e10cSrcweir 64*cdf0e10cSrcweir void StartEditEngine(); 65*cdf0e10cSrcweir void StopEditEngine( sal_Bool bAll ); 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 68*cdf0e10cSrcweir 69*cdf0e10cSrcweir void SetFormulaMode( sal_Bool bSet ); 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible(); 72*cdf0e10cSrcweir 73*cdf0e10cSrcweir void InsertAccessibleTextData( ScAccessibleEditLineTextData& rTextData ); 74*cdf0e10cSrcweir void RemoveAccessibleTextData( ScAccessibleEditLineTextData& rTextData ); 75*cdf0e10cSrcweir 76*cdf0e10cSrcweir DECL_LINK( NotifyHdl, EENotify* ); 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir protected: 79*cdf0e10cSrcweir virtual void Paint( const Rectangle& rRec ); 80*cdf0e10cSrcweir virtual void Resize(); 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir virtual void MouseMove( const MouseEvent& rMEvt ); 83*cdf0e10cSrcweir virtual void MouseButtonDown( const MouseEvent& rMEvt ); 84*cdf0e10cSrcweir virtual void MouseButtonUp( const MouseEvent& rMEvt ); 85*cdf0e10cSrcweir virtual void Command( const CommandEvent& rCEvt ); 86*cdf0e10cSrcweir virtual void KeyInput(const KeyEvent& rKEvt); 87*cdf0e10cSrcweir virtual void GetFocus(); 88*cdf0e10cSrcweir virtual void LoseFocus(); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir virtual void StartDrag( sal_Int8 nAction, const Point& rPosPixel ); 91*cdf0e10cSrcweir 92*cdf0e10cSrcweir virtual String GetText() const; 93*cdf0e10cSrcweir 94*cdf0e10cSrcweir private: 95*cdf0e10cSrcweir void ImplInitSettings(); 96*cdf0e10cSrcweir void UpdateAutoCorrFlag(); 97*cdf0e10cSrcweir 98*cdf0e10cSrcweir private: 99*cdf0e10cSrcweir typedef ::std::vector< ScAccessibleEditLineTextData* > AccTextDataVector; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir String aString; 102*cdf0e10cSrcweir Font aTextFont; 103*cdf0e10cSrcweir ScEditEngineDefaulter* pEditEngine; // erst bei Bedarf angelegt 104*cdf0e10cSrcweir EditView* pEditView; 105*cdf0e10cSrcweir AccTextDataVector maAccTextDatas; // #i105267# text datas may be cloned, remember all copies 106*cdf0e10cSrcweir sal_Bool bIsRTL; 107*cdf0e10cSrcweir sal_Bool bIsInsertMode; 108*cdf0e10cSrcweir sal_Bool bFormulaMode; 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir // #102710#; this flag should be true if a key input or a command is handled 111*cdf0e10cSrcweir // it prevents the call of InputChanged in the ModifyHandler of the EditEngine 112*cdf0e10cSrcweir sal_Bool bInputMode; 113*cdf0e10cSrcweir }; 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir //======================================================================== 116*cdf0e10cSrcweir 117*cdf0e10cSrcweir class ScPosWnd : public ComboBox, public SfxListener // Positionsanzeige 118*cdf0e10cSrcweir { 119*cdf0e10cSrcweir private: 120*cdf0e10cSrcweir String aPosStr; 121*cdf0e10cSrcweir Accelerator* pAccel; 122*cdf0e10cSrcweir sal_uLong nTipVisible; 123*cdf0e10cSrcweir sal_Bool bFormulaMode; 124*cdf0e10cSrcweir sal_Bool bTopHadFocus; 125*cdf0e10cSrcweir 126*cdf0e10cSrcweir public: 127*cdf0e10cSrcweir ScPosWnd( Window* pParent ); 128*cdf0e10cSrcweir virtual ~ScPosWnd(); 129*cdf0e10cSrcweir 130*cdf0e10cSrcweir void SetPos( const String& rPosStr ); // angezeigter Text 131*cdf0e10cSrcweir void SetFormulaMode( sal_Bool bSet ); 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir protected: 134*cdf0e10cSrcweir virtual void Select(); 135*cdf0e10cSrcweir virtual void Modify(); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir virtual long Notify( NotifyEvent& rNEvt ); 138*cdf0e10cSrcweir 139*cdf0e10cSrcweir virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ); 140*cdf0e10cSrcweir 141*cdf0e10cSrcweir private: 142*cdf0e10cSrcweir void FillRangeNames(); 143*cdf0e10cSrcweir void FillFunctions(); 144*cdf0e10cSrcweir void DoEnter(); 145*cdf0e10cSrcweir void HideTip(); 146*cdf0e10cSrcweir 147*cdf0e10cSrcweir void ReleaseFocus_Impl(); 148*cdf0e10cSrcweir }; 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir //======================================================================== 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir class ScInputWindow : public ToolBox // Parent-Toolbox 153*cdf0e10cSrcweir { 154*cdf0e10cSrcweir public: 155*cdf0e10cSrcweir ScInputWindow( Window* pParent, SfxBindings* pBind ); 156*cdf0e10cSrcweir virtual ~ScInputWindow(); 157*cdf0e10cSrcweir 158*cdf0e10cSrcweir virtual void Resize(); 159*cdf0e10cSrcweir virtual void Select(); 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir void SetFuncString( const String& rString, sal_Bool bDoEdit = sal_True ); 162*cdf0e10cSrcweir void SetPosString( const String& rStr ); 163*cdf0e10cSrcweir void SetTextString( const String& rString ); 164*cdf0e10cSrcweir 165*cdf0e10cSrcweir void SetOkCancelMode(); 166*cdf0e10cSrcweir void SetSumAssignMode(); 167*cdf0e10cSrcweir void EnableButtons( sal_Bool bEnable = sal_True ); 168*cdf0e10cSrcweir 169*cdf0e10cSrcweir void SetFormulaMode( sal_Bool bSet ); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir sal_Bool IsInputActive(); 172*cdf0e10cSrcweir EditView* GetEditView(); 173*cdf0e10cSrcweir //UNUSED2008-05 EditView* ActivateEdit( const String& rText, 174*cdf0e10cSrcweir //UNUSED2008-05 const ESelection& rSel ); 175*cdf0e10cSrcweir 176*cdf0e10cSrcweir void TextGrabFocus(); 177*cdf0e10cSrcweir void TextInvalidate(); 178*cdf0e10cSrcweir void SwitchToTextWin(); 179*cdf0e10cSrcweir 180*cdf0e10cSrcweir void PosGrabFocus(); 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir // Fuer FunktionsAutopiloten 183*cdf0e10cSrcweir void MakeDialogEditView(); 184*cdf0e10cSrcweir 185*cdf0e10cSrcweir void StopEditEngine( sal_Bool bAll ); 186*cdf0e10cSrcweir 187*cdf0e10cSrcweir void SetInputHandler( ScInputHandler* pNew ); 188*cdf0e10cSrcweir 189*cdf0e10cSrcweir ScInputHandler* GetInputHandler(){ return pInputHdl;} 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir void StateChanged( StateChangedType nType ); 192*cdf0e10cSrcweir virtual void DataChanged( const DataChangedEvent& rDCEvt ); 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir 195*cdf0e10cSrcweir protected: 196*cdf0e10cSrcweir virtual void SetText( const String& rString ); 197*cdf0e10cSrcweir virtual String GetText() const; 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir sal_Bool UseSubTotal( ScRangeList* pRangeList ) const; 200*cdf0e10cSrcweir 201*cdf0e10cSrcweir private: 202*cdf0e10cSrcweir ScPosWnd aWndPos; 203*cdf0e10cSrcweir ScTextWnd aTextWindow; 204*cdf0e10cSrcweir ScInputHandler* pInputHdl; 205*cdf0e10cSrcweir SfxBindings* pBindings; 206*cdf0e10cSrcweir String aTextOk; 207*cdf0e10cSrcweir String aTextCancel; 208*cdf0e10cSrcweir String aTextSum; 209*cdf0e10cSrcweir String aTextEqual; 210*cdf0e10cSrcweir sal_Bool bIsOkCancelMode; 211*cdf0e10cSrcweir }; 212*cdf0e10cSrcweir 213*cdf0e10cSrcweir //================================================================== 214*cdf0e10cSrcweir 215*cdf0e10cSrcweir class ScInputWindowWrapper : public SfxChildWindow 216*cdf0e10cSrcweir { 217*cdf0e10cSrcweir public: 218*cdf0e10cSrcweir ScInputWindowWrapper( Window* pParent, 219*cdf0e10cSrcweir sal_uInt16 nId, 220*cdf0e10cSrcweir SfxBindings* pBindings, 221*cdf0e10cSrcweir SfxChildWinInfo* pInfo ); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir SFX_DECL_CHILDWINDOW(ScInputWindowWrapper); 224*cdf0e10cSrcweir }; 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir #endif 228*cdf0e10cSrcweir 229