LCOV - code coverage report
Current view: top level - sw/source/core/uibase/inc - edtwin.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 11 28 39.3 %
Date: 2014-04-11 Functions: 9 24 37.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : #ifndef INCLUDED_SW_SOURCE_UI_INC_EDTWIN_HXX
      20             : #define INCLUDED_SW_SOURCE_UI_INC_EDTWIN_HXX
      21             : 
      22             : #include <FrameControlsManager.hxx>
      23             : 
      24             : #include <svx/svdobj.hxx>
      25             : #include <tools/link.hxx>
      26             : #include <vcl/timer.hxx>
      27             : #include <vcl/window.hxx>
      28             : #include <svtools/transfer.hxx>
      29             : #include <swevent.hxx>
      30             : 
      31             : class   SwWrtShell;
      32             : class   SwView;
      33             : class   SwRect;
      34             : class   SwViewShell;
      35             : class   SwAnchorMarker;
      36             : class   SdrObject;
      37             : class   SwShadowCursor;
      38             : class   DataChangedEvent;
      39             : class   SvxAutoCorrCfg;
      40             : class   SvxAutoCorrect;
      41             : class   SwPaM;
      42             : struct  SwApplyTemplate;
      43             : struct  QuickHelpData;
      44             : class   SdrDropMarkerOverlay;
      45             : 
      46             : /*--------------------------------------------------------------------
      47             :     Description:    input window
      48             :  --------------------------------------------------------------------*/
      49             : 
      50             : /** Window class for the Writer edit area, this is the one handling mouse
      51             :     and keyboard events and doing the final painting of the document from
      52             :     the buffered layout.
      53             : 
      54             :     To translate the pixel positions from the buffer OutputDevice to the real
      55             :     pixel positions, use the PixelToLogic methods of this class.
      56             :   */
      57             : class SwEditWin: public Window,
      58             :                 public DropTargetHelper, public DragSourceHelper
      59             : {
      60             : friend void     ScrollMDI(SwViewShell* pVwSh, const SwRect&,
      61             :                           sal_uInt16 nRangeX, sal_uInt16 nRangeY);
      62             : friend sal_Bool     IsScrollMDI(SwViewShell* pVwSh, const SwRect&);
      63             : 
      64             : friend void     SizeNotify(SwViewShell* pVwSh, const Size &);
      65             : 
      66             : friend void     PageNumNotify(  SwViewShell* pVwSh,
      67             :                                 sal_uInt16 nPhyNum,
      68             :                                 sal_uInt16 nVirtNum,
      69             :                                 const OUString& rPg );
      70             : 
      71             :     static  QuickHelpData* m_pQuickHlpData;
      72             : 
      73             :     static  long    m_nDDStartPosX, m_nDDStartPosY;
      74             : 
      75             :     static  Color   m_aTextColor;     // text color; for the watering can
      76             :     static  bool    m_bTransparentBackColor; // transparent background
      77             :     static  Color   m_aTextBackColor; // text background; for the watering can
      78             : 
      79             :     /*
      80             :      * timer and handler for scrolling on when the mousepointer
      81             :      * stopps outside of EditWin during a drag-operation.
      82             :      * The selection is increased towards the mouse position
      83             :      * regularly.
      84             :      */
      85             :     AutoTimer       m_aTimer;
      86             :     // timer for overlapping KeyInputs (e.g. for tables)
      87             :     Timer           m_aKeyInputTimer;
      88             :     // timer for ANY-KeyInut question without a following KeyInputEvent
      89             :     Timer           m_aKeyInputFlushTimer;
      90             : 
      91             :     OUString        m_aInBuffer;
      92             :     LanguageType    m_eBufferLanguage;
      93             :     Point           m_aStartPos;
      94             :     Point           m_aMovePos;
      95             :     Point           m_aRszMvHdlPt;
      96             :     Timer           m_aTemplateTimer;
      97             : 
      98             :     // type/object where the mouse pointer is
      99             :     SwCallMouseEvent m_aSaveCallEvent;
     100             : 
     101             :     SwApplyTemplate     *m_pApplyTempl;
     102             :     SwAnchorMarker      *m_pAnchorMarker; // for relocating the anchor
     103             : 
     104             :     SdrDropMarkerOverlay    *m_pUserMarker;
     105             :     SdrObject               *m_pUserMarkerObj;
     106             :     SwShadowCursor          *m_pShadCrsr;
     107             :     Point                   *m_pRowColumnSelectionStart; // save position where table row/column selection has been started
     108             : 
     109             :     SwView         &m_rView;
     110             : 
     111             :     int             m_aActHitType;    // current mouse pointer
     112             : 
     113             :     sal_uLong       m_nDropFormat;   // format from the last QueryDrop
     114             :     sal_uInt16      m_nDropAction;   // action from the last QueryDrop
     115             :     sal_uInt16      m_nDropDestination;  // destination from the last QueryDrop
     116             : 
     117             :     sal_uInt16      m_eBezierMode;
     118             :     sal_uInt16      m_nInsFrmColCount; // column number for interactive frame
     119             :     SdrObjKind      m_eDrawMode;
     120             :     sal_Bool        m_bMBPressed      : 1,
     121             :                     m_bInsDraw        : 1,
     122             :                     m_bInsFrm         : 1,
     123             :                     m_bIsInMove       : 1,
     124             :                     m_bIsInDrag       : 1, // don't execute StartExecuteDrag twice
     125             :                     m_bOldIdle        : 1, // to stop to idle
     126             :                     m_bOldIdleSet     : 1, // during QeueryDrop
     127             :                     m_bTblInsDelMode  : 1,
     128             :                     m_bTblIsInsMode   : 1,
     129             :                     m_bChainMode      : 1, // connect frames
     130             :                     m_bWasShdwCrsr    : 1, // ShadowCrsr was on in MouseButtonDown
     131             :                     m_bLockInput      : 1, // lock while calc panel is active
     132             :                     m_bIsRowDrag      : 1, //selection of rows is used, in combination with m_pRowColumnSelectionStart
     133             :                     /** #i42732# display status of font size/name depending on either the input language or the
     134             :                         selection position depending on what has changed lately
     135             :                      */
     136             :                     m_bUseInputLanguage: 1,
     137             :                     m_bObjectSelect   : 1;
     138             : 
     139             :     sal_uInt16          m_nKS_NUMDOWN_Count; // #i23725#
     140             :     sal_uInt16          m_nKS_NUMINDENTINC_Count;
     141             : 
     142             :     SwFrameControlsManager m_aFrameControlsManager;
     143             : 
     144             :     void            LeaveArea(const Point &);
     145             :     void            JustifyAreaTimer();
     146             :     inline void     EnterArea();
     147             : 
     148             :     void            RstMBDownFlags();
     149             : 
     150             :     void            ChangeFly( sal_uInt8 nDir, sal_Bool bWeb = sal_False );
     151             :     void            ChangeDrawing( sal_uInt8 nDir );
     152             : 
     153             :     sal_Bool            EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
     154             :     sal_Bool            RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode);
     155             : 
     156             :     // helper function for D&D
     157             :     void            DropCleanup();
     158             :     void            CleanupDropUserMarker();
     159             :     sal_uInt16          GetDropDestination( const Point& rPixPnt,
     160             :                                         SdrObject ** ppObj = 0 );
     161             :     //select the object/cursor at the mouse position of the context menu request
     162             :     sal_Bool            SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
     163             : 
     164             :     /*
     165             :      * handler for scrolling on when the mousepointer
     166             :      * stopps outside of EditWin during a drag-operation.
     167             :      * The selection is regularly increased towards the mouse
     168             :      * position.
     169             :      */
     170             :     DECL_LINK( TimerHandler, void * );
     171             :     void            StartDDTimer();
     172             :     void            StopDDTimer(SwWrtShell *, const Point &);
     173             :     DECL_LINK( DDHandler, void * );
     174             : 
     175             :     // timer for ANY-KeyInut question without a following KeyInputEvent
     176             :     DECL_LINK( KeyInputFlushHandler, void * );
     177             : 
     178             :     // timer for overlapping KeyInputs (e.g. for tables)
     179             :     DECL_LINK( KeyInputTimerHandler, void * );
     180             : 
     181             :     // timer for ApplyTemplates via mouse (in disguise Drag&Drop)
     182             :     DECL_LINK( TemplateTimerHdl, void * );
     183             : 
     184             :     using OutputDevice::GetTextColor;
     185             : 
     186             : protected:
     187             : 
     188             :     virtual void    DataChanged( const DataChangedEvent& ) SAL_OVERRIDE;
     189             :     virtual void    PrePaint() SAL_OVERRIDE;
     190             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     191             :     virtual void    KeyInput(const KeyEvent &rKEvt) SAL_OVERRIDE;
     192             : 
     193             :     virtual void    GetFocus() SAL_OVERRIDE;
     194             :     virtual void    LoseFocus() SAL_OVERRIDE;
     195             : 
     196             :     virtual void    MouseMove(const MouseEvent& rMEvt) SAL_OVERRIDE;
     197             :     virtual void    MouseButtonDown(const MouseEvent& rMEvt) SAL_OVERRIDE;
     198             :     virtual void    MouseButtonUp(const MouseEvent& rMEvt) SAL_OVERRIDE;
     199             :     virtual void    RequestHelp(const HelpEvent& rEvt) SAL_OVERRIDE;
     200             : 
     201             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
     202             : 
     203             :                                 // Drag & Drop Interface
     204             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     205             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
     206             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
     207             : 
     208             :     virtual OUString GetSurroundingText() const SAL_OVERRIDE;
     209             :     virtual Selection GetSurroundingTextSelection() const SAL_OVERRIDE;
     210             : 
     211             :     void    ShowAutoTextCorrectQuickHelp( const OUString& rWord, SvxAutoCorrCfg* pACfg,
     212             :                                 SvxAutoCorrect* pACorr, bool bFromIME = false );
     213             : 
     214             :     /// Returns true if in header/footer area, or in the header/footer control.
     215             :     bool    IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const;
     216             : 
     217             :     bool    IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const;
     218             : public:
     219             : 
     220             :     void            UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
     221             : 
     222             :     sal_Bool            IsDrawSelMode();
     223           0 :     sal_Bool            IsDrawAction()                  { return (m_bInsDraw); }
     224           0 :     void            SetDrawAction(sal_Bool bFlag)       { m_bInsDraw = bFlag; }
     225             : 
     226           0 :     void            SetObjectSelect( sal_Bool bVal )    { m_bObjectSelect = bVal; }
     227           0 :     sal_Bool            IsObjectSelect() const          { return m_bObjectSelect; }
     228             : 
     229           0 :     inline SdrObjKind   GetSdrDrawMode(/*sal_Bool bBuf = sal_False*/) const { return m_eDrawMode; }
     230           0 :     inline void         SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { m_eDrawMode = eSdrObjectKind; SetObjectSelect( sal_False ); }
     231             :     void                StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect );
     232             : 
     233       14600 :     bool            IsFrmAction() const             { return (m_bInsFrm); }
     234           0 :     sal_uInt16      GetBezierMode() const           { return m_eBezierMode; }
     235           0 :     void            SetBezierMode(sal_uInt16 eBezMode)  { m_eBezierMode = eBezMode; }
     236             :     void            EnterDrawTextMode(const Point& aDocPos); // turn on DrawTextEditMode
     237             :     void            InsFrm(sal_uInt16 nCols);
     238             :     void            StopInsFrm();
     239           0 :     sal_uInt16      GetFrmColCount() const {return m_nInsFrmColCount;} // column number for interactive frame
     240             : 
     241             :     void            SetChainMode( sal_Bool bOn );
     242       13112 :     sal_Bool            IsChainMode() const             { return m_bChainMode; }
     243             : 
     244             :     void            FlushInBuffer();
     245             :     sal_Bool            IsInputSequenceCheckingRequired( const OUString &rText, const SwPaM& rCrsr ) const;
     246             : 
     247             :     void             SetApplyTemplate(const SwApplyTemplate &);
     248        1772 :     SwApplyTemplate* GetApplyTemplate() const { return m_pApplyTempl; }
     249             : 
     250             :     void            StartExecuteDrag();
     251             :     void            DragFinished();
     252             :     sal_uInt16          GetDropAction() const { return m_nDropAction; }
     253             :     sal_uLong           GetDropFormat() const { return m_nDropFormat; }
     254             : 
     255         679 :     Color           GetTextColor() { return m_aTextColor; }
     256             : 
     257           0 :     void            SetTextColor(const Color& rCol ) { m_aTextColor = rCol; }
     258             : 
     259         679 :     Color           GetTextBackColor()
     260         679 :                                             { return m_aTextBackColor; }
     261           0 :     void            SetTextBackColor(const Color& rCol )
     262           0 :                                             { m_aTextBackColor = rCol; }
     263           0 :     void            SetTextBackColorTransparent(bool bSet)
     264           0 :                                     { m_bTransparentBackColor = bSet; }
     265         679 :     bool            IsTextBackColorTransparent()
     266         679 :                                     { return m_bTransparentBackColor; }
     267           0 :     void            LockKeyInput(sal_Bool bSet){m_bLockInput = bSet;}
     268             : 
     269             :     const SwView &GetView() const { return m_rView; }
     270       23342 :           SwView &GetView()       { return m_rView; }
     271             : 
     272             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     273             : 
     274           0 :     static inline long GetDDStartPosX() { return m_nDDStartPosX; }
     275           0 :     static inline long GetDDStartPosY() { return m_nDDStartPosY; }
     276             : 
     277             :     static void _InitStaticData();
     278             :     static void _FinitStaticData();
     279             : 
     280             :     //#i3370# remove quick help to prevent saving of autocorrection suggestions
     281             :     void StopQuickHelp();
     282             : 
     283             :     // #i42921# - add parameter <bVerticalMode>
     284             :     sal_Bool RulerMarginDrag( const MouseEvent& rMEvt,
     285             :                                      const bool bVerticalMode );
     286             : 
     287             :     /** #i42732# display status of font size/name depending on either the input
     288             :         language or the selection position depending on what has changed lately
     289             :      */
     290             :     void        SetUseInputLanguage( sal_Bool bNew );
     291        2145 :     sal_Bool    IsUseInputLanguage() const { return m_bUseInputLanguage; }
     292             : 
     293       14392 :     SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; }
     294             : 
     295             :     SwEditWin(Window *pParent, SwView &);
     296             :     virtual ~SwEditWin();
     297             :     virtual void SwitchView();
     298             : };
     299             : 
     300             : #endif
     301             : 
     302             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10