LCOV - code coverage report
Current view: top level - sw/source/uibase/inc - edtwin.hxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 6 24 25.0 %
Date: 2014-11-03 Functions: 6 22 27.3 %
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_UIBASE_INC_EDTWIN_HXX
      20             : #define INCLUDED_SW_SOURCE_UIBASE_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             : // input window
      47             : 
      48             : /** Window class for the Writer edit area, this is the one handling mouse
      49             :     and keyboard events and doing the final painting of the document from
      50             :     the buffered layout.
      51             : 
      52             :     To translate the pixel positions from the buffer OutputDevice to the real
      53             :     pixel positions, use the PixelToLogic methods of this class.
      54             :   */
      55             : class SwEditWin: public vcl::Window,
      56             :                 public DropTargetHelper, public DragSourceHelper
      57             : {
      58             : friend void     ScrollMDI(SwViewShell* pVwSh, const SwRect&,
      59             :                           sal_uInt16 nRangeX, sal_uInt16 nRangeY);
      60             : friend bool     IsScrollMDI(SwViewShell* pVwSh, const SwRect&);
      61             : 
      62             : friend void     SizeNotify(SwViewShell* pVwSh, const Size &);
      63             : 
      64             : friend void     PageNumNotify(  SwViewShell* pVwSh,
      65             :                                 sal_uInt16 nPhyNum,
      66             :                                 sal_uInt16 nVirtNum,
      67             :                                 const OUString& rPg );
      68             : 
      69             :     static  QuickHelpData* m_pQuickHlpData;
      70             : 
      71             :     static  long    m_nDDStartPosX, m_nDDStartPosY;
      72             : 
      73             :     static  Color   m_aTextColor;     // text color; for the watering can
      74             :     static  Color   m_aTextBackColor; // text background; for the watering can
      75             : 
      76             :     /*
      77             :      * timer and handler for scrolling on when the mousepointer
      78             :      * stopps outside of EditWin during a drag-operation.
      79             :      * The selection is increased towards the mouse position
      80             :      * regularly.
      81             :      */
      82             :     AutoTimer       m_aTimer;
      83             :     // timer for overlapping KeyInputs (e.g. for tables)
      84             :     Timer           m_aKeyInputTimer;
      85             :     // timer for ANY-KeyInut question without a following KeyInputEvent
      86             :     Timer           m_aKeyInputFlushTimer;
      87             : 
      88             :     OUString        m_aInBuffer;
      89             :     LanguageType    m_eBufferLanguage;
      90             :     Point           m_aStartPos;
      91             :     Point           m_aMovePos;
      92             :     Point           m_aRszMvHdlPt;
      93             :     Timer           m_aTemplateTimer;
      94             : 
      95             :     // type/object where the mouse pointer is
      96             :     SwCallMouseEvent m_aSaveCallEvent;
      97             : 
      98             :     SwApplyTemplate     *m_pApplyTempl;
      99             :     SwAnchorMarker      *m_pAnchorMarker; // for relocating the anchor
     100             : 
     101             :     SdrDropMarkerOverlay    *m_pUserMarker;
     102             :     SdrObject               *m_pUserMarkerObj;
     103             :     SwShadowCursor          *m_pShadCrsr;
     104             :     Point                   *m_pRowColumnSelectionStart; // save position where table row/column selection has been started
     105             : 
     106             :     SwView         &m_rView;
     107             : 
     108             :     int             m_aActHitType;    // current mouse pointer
     109             : 
     110             :     sal_uLong       m_nDropFormat;   // format from the last QueryDrop
     111             :     sal_uInt16      m_nDropAction;   // action from the last QueryDrop
     112             :     sal_uInt16      m_nDropDestination;  // destination from the last QueryDrop
     113             : 
     114             :     sal_uInt16      m_eBezierMode;
     115             :     sal_uInt16      m_nInsFrmColCount; // column number for interactive frame
     116             :     SdrObjKind      m_eDrawMode;
     117             :     bool        m_bMBPressed      : 1,
     118             :                     m_bInsDraw        : 1,
     119             :                     m_bInsFrm         : 1,
     120             :                     m_bIsInMove       : 1,
     121             :                     m_bIsInDrag       : 1, // don't execute StartExecuteDrag twice
     122             :                     m_bOldIdle        : 1, // to stop to idle
     123             :                     m_bOldIdleSet     : 1, // during QeueryDrop
     124             :                     m_bTblInsDelMode  : 1,
     125             :                     m_bTblIsInsMode   : 1,
     126             :                     m_bChainMode      : 1, // connect frames
     127             :                     m_bWasShdwCrsr    : 1, // ShadowCrsr was on in MouseButtonDown
     128             :                     m_bLockInput      : 1, // lock while calc panel is active
     129             :                     m_bIsRowDrag      : 1, //selection of rows is used, in combination with m_pRowColumnSelectionStart
     130             :                     /** #i42732# display status of font size/name depending on either the input language or the
     131             :                         selection position depending on what has changed lately
     132             :                      */
     133             :                     m_bUseInputLanguage: 1,
     134             :                     m_bObjectSelect   : 1;
     135             : 
     136             :     sal_uInt16          m_nKS_NUMDOWN_Count; // #i23725#
     137             :     sal_uInt16          m_nKS_NUMINDENTINC_Count;
     138             : 
     139             :     SwFrameControlsManager m_aFrameControlsManager;
     140             : 
     141             :     void            LeaveArea(const Point &);
     142             :     void            JustifyAreaTimer();
     143             :     inline void     EnterArea();
     144             : 
     145             :     void            RstMBDownFlags();
     146             : 
     147             :     void            ChangeFly( sal_uInt8 nDir, bool bWeb = false );
     148             :     void            ChangeDrawing( sal_uInt8 nDir );
     149             : 
     150             :     bool            EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
     151             :     bool            RulerColumnDrag( const MouseEvent& rMEvt, bool bVerticalMode);
     152             : 
     153             :     // helper function for D&D
     154             :     void            DropCleanup();
     155             :     void            CleanupDropUserMarker();
     156             :     sal_uInt16      GetDropDestination( const Point& rPixPnt,
     157             :                                         SdrObject ** ppObj = 0 );
     158             :     //select the object/cursor at the mouse position of the context menu request
     159             :     bool            SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
     160             : 
     161             :     /*
     162             :      * handler for scrolling on when the mousepointer
     163             :      * stopps outside of EditWin during a drag-operation.
     164             :      * The selection is regularly increased towards the mouse
     165             :      * position.
     166             :      */
     167             :     DECL_LINK( TimerHandler, void * );
     168             :     void            StartDDTimer();
     169             :     void            StopDDTimer(SwWrtShell *, const Point &);
     170             :     DECL_LINK( DDHandler, void * );
     171             : 
     172             :     // timer for ANY-KeyInut question without a following KeyInputEvent
     173             :     DECL_LINK( KeyInputFlushHandler, void * );
     174             : 
     175             :     // timer for overlapping KeyInputs (e.g. for tables)
     176             :     DECL_LINK( KeyInputTimerHandler, void * );
     177             : 
     178             :     // timer for ApplyTemplates via mouse (in disguise Drag&Drop)
     179             :     DECL_LINK( TemplateTimerHdl, void * );
     180             : 
     181             :     using OutputDevice::GetTextColor;
     182             : 
     183             :     void            MoveCursor( SwWrtShell &rSh, const Point aDocPos,
     184             :                                 const bool bOnlyText, bool bLockView );
     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             :     bool            IsDrawSelMode();
     223           0 :     bool            IsDrawAction()                  { return (m_bInsDraw); }
     224           0 :     void            SetDrawAction(bool bFlag)       { m_bInsDraw = bFlag; }
     225             : 
     226           0 :     void            SetObjectSelect( bool bVal )    { m_bObjectSelect = bVal; }
     227           0 :     bool            IsObjectSelect() const          { return m_bObjectSelect; }
     228             : 
     229           0 :     inline SdrObjKind   GetSdrDrawMode() const { return m_eDrawMode; }
     230           0 :     inline void         SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { m_eDrawMode = eSdrObjectKind; SetObjectSelect( false ); }
     231             :     void                StdDrawMode( SdrObjKind eSdrObjectKind, bool bObjSelect );
     232             : 
     233       33736 :     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( bool bOn );
     242       28372 :     bool            IsChainMode() const             { return m_bChainMode; }
     243             : 
     244             :     void            FlushInBuffer();
     245             :     bool            IsInputSequenceCheckingRequired( const OUString &rText, const SwPaM& rCrsr ) const;
     246             : 
     247             :     void             SetApplyTemplate(const SwApplyTemplate &);
     248        3296 :     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           0 :     Color           GetTextColor() { return m_aTextColor; }
     256             : 
     257           0 :     void            SetTextColor(const Color& rCol ) { m_aTextColor = rCol; }
     258             : 
     259           0 :     Color           GetTextBackColor()
     260           0 :                                             { return m_aTextBackColor; }
     261           0 :     void            SetTextBackColor(const Color& rCol )
     262           0 :                                             { m_aTextBackColor = rCol; }
     263           0 :     void            LockKeyInput(bool bSet){m_bLockInput = bSet;}
     264             : 
     265             :     const SwView &GetView() const { return m_rView; }
     266       62978 :           SwView &GetView()       { return m_rView; }
     267             : 
     268             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     269             : 
     270           0 :     static inline long GetDDStartPosX() { return m_nDDStartPosX; }
     271           0 :     static inline long GetDDStartPosY() { return m_nDDStartPosY; }
     272             : 
     273             :     static void _InitStaticData();
     274             :     static void _FinitStaticData();
     275             : 
     276             :     //#i3370# remove quick help to prevent saving of autocorrection suggestions
     277             :     void StopQuickHelp();
     278             : 
     279             :     // #i42921# - add parameter <bVerticalMode>
     280             :     bool RulerMarginDrag( const MouseEvent& rMEvt,
     281             :                                      const bool bVerticalMode );
     282             : 
     283             :     /** #i42732# display status of font size/name depending on either the input
     284             :         language or the selection position depending on what has changed lately
     285             :      */
     286             :     void    SetUseInputLanguage( bool bNew );
     287        7446 :     bool    IsUseInputLanguage() const { return m_bUseInputLanguage; }
     288             : 
     289             :     /** fdo#55546 cut very long tooltips to 2/3 of the width of the screen
     290             :         via center ellipsis
     291             :      */
     292             :     OUString ClipLongToolTip(const OUString& rTxt);
     293             : 
     294       26255 :     SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; }
     295             : 
     296             :     SwEditWin(vcl::Window *pParent, SwView &);
     297             :     virtual ~SwEditWin();
     298             :     virtual void SwitchView();
     299             : };
     300             : 
     301             : #endif
     302             : 
     303             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10