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