LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/inc - edtwin.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 4 28 14.3 %
Date: 2012-12-27 Functions: 4 24 16.7 %
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 _EDTWIN_HXX
      20             : #define _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             : 
      32             : class   SwWrtShell;
      33             : class   SwView;
      34             : class   SwRect;
      35             : class   ViewShell;
      36             : class   SwAnchorMarker;
      37             : class   SdrObject;
      38             : class   SwShadowCursor;
      39             : class   DataChangedEvent;
      40             : class   SvxAutoCorrCfg;
      41             : class   SvxAutoCorrect;
      42             : class   SwPaM;
      43             : struct  SwApplyTemplate;
      44             : struct  QuickHelpData;
      45             : class   SdrDropMarkerOverlay;
      46             : 
      47             : /*--------------------------------------------------------------------
      48             :     Description:    input window
      49             :  --------------------------------------------------------------------*/
      50             : 
      51             : /** Window class for the Writer edit area, this is the one handling mouse
      52             :     and keyboard events and doing the final painting of the document from
      53             :     the buffered layout.
      54             : 
      55             :     To translate the pixel positions from the buffer OutputDevice to the real
      56             :     pixel positions, use the PixelToLogic methods of this class.
      57             :   */
      58             : class SwEditWin: public Window,
      59             :                 public DropTargetHelper, public DragSourceHelper
      60             : {
      61             : friend void     ScrollMDI(ViewShell* pVwSh, const SwRect&,
      62             :                           sal_uInt16 nRangeX, sal_uInt16 nRangeY);
      63             : friend sal_Bool     IsScrollMDI(ViewShell* pVwSh, const SwRect&);
      64             : 
      65             : friend void     SizeNotify(ViewShell* pVwSh, const Size &);
      66             : 
      67             : friend void     PageNumNotify(  ViewShell* pVwSh,
      68             :                                 sal_uInt16 nPhyNum,
      69             :                                 sal_uInt16 nVirtNum,
      70             :                                 const String& rPg );
      71             : 
      72             :     static  QuickHelpData* pQuickHlpData;
      73             : 
      74             :     static  sal_Bool    bReplaceQuote;
      75             :     static  long    nDDStartPosX, nDDStartPosY;
      76             : 
      77             :     static  Color   aTextColor;     // text color; for the watering can
      78             :     static  sal_Bool    bTransparentBackColor; // transparent background
      79             :     static  Color   aTextBackColor; // text background; for the watering can
      80             : 
      81             :     /*
      82             :      * timer and handler for scrolling on when the mousepointer
      83             :      * stopps outside of EditWin during a drag-operation.
      84             :      * The selection is increased towards the mouse position
      85             :      * regularly.
      86             :      */
      87             :     AutoTimer       aTimer;
      88             :     // timer for overlapping KeyInputs (e.g. for tables)
      89             :     Timer           aKeyInputTimer;
      90             :     // timer for ANY-KeyInut question without a following KeyInputEvent
      91             :     Timer           aKeyInputFlushTimer;
      92             : 
      93             :     String          aInBuffer;
      94             :     LanguageType    eBufferLanguage;
      95             :     Point           aStartPos;
      96             :     Point           aMovePos;
      97             :     Point           aRszMvHdlPt;
      98             :     Timer           aTemplateTimer;
      99             : 
     100             :     // type/object where the mouse pointer is
     101             :     SwCallMouseEvent aSaveCallEvent;
     102             : 
     103             :     SwApplyTemplate     *pApplyTempl;
     104             :     SwAnchorMarker      *pAnchorMarker; // for relocating the anchor
     105             : 
     106             :     SdrDropMarkerOverlay    *pUserMarker;
     107             :     SdrObject               *pUserMarkerObj;
     108             :     SwShadowCursor          *pShadCrsr;
     109             :     Point                   *pRowColumnSelectionStart; // save position where table row/column selection has been started
     110             : 
     111             :     SwView         &rView;
     112             : 
     113             :     int             aActHitType;    // current mouse pointer
     114             : 
     115             :     sal_uLong           m_nDropFormat;   // format from the last QueryDrop
     116             :     sal_uInt16          m_nDropAction;   // action from the last QueryDrop
     117             :     sal_uInt16          m_nDropDestination;  // destination from the last QueryDrop
     118             : 
     119             :     sal_uInt16          eBezierMode;
     120             :     sal_uInt16          nInsFrmColCount; // column number for interactive frame
     121             :     SdrObjKind      eDrawMode;
     122             :     sal_Bool            bLinkRemoved    : 1,
     123             :                     bMBPressed      : 1,
     124             :                     bInsDraw        : 1,
     125             :                     bInsFrm         : 1,
     126             :                     bIsInMove       : 1,
     127             :                     bIsInDrag       : 1, // don't execute StartExecuteDrag twice
     128             :                     bOldIdle        : 1, // to stop to idle
     129             :                     bOldIdleSet     : 1, // during QeueryDrop
     130             :                     bTblInsDelMode  : 1, //
     131             :                     bTblIsInsMode   : 1, //
     132             :                     bTblIsColMode   : 1, //
     133             :                     bChainMode      : 1, // connect frames
     134             :                     bWasShdwCrsr    : 1, // ShadowCrsr was on in MouseButtonDown
     135             :                     bLockInput      : 1, // lock while calc panel is active
     136             :                     bIsRowDrag      : 1, //selection of rows is used, in combination with pRowColumnSelectionStart
     137             :                     /** #i42732# display status of font size/name depending on either the input language or the
     138             :                         selection position depending on what has changed lately
     139             :                      */
     140             :                     bUseInputLanguage: 1,
     141             :                     bObjectSelect   : 1;
     142             : 
     143             :     sal_uInt16          nKS_NUMDOWN_Count; // #i23725#
     144             :     sal_uInt16          nKS_NUMINDENTINC_Count;
     145             : 
     146             :     SwFrameControlsManager m_aFrameControlsManager;
     147             : 
     148             :     void            LeaveArea(const Point &);
     149             :     void            JustifyAreaTimer();
     150             :     inline void     EnterArea();
     151             : 
     152             :     void            RstMBDownFlags();
     153             : 
     154             :     void            ChangeFly( sal_uInt8 nDir, sal_Bool bWeb = sal_False );
     155             :     void            ChangeDrawing( sal_uInt8 nDir );
     156             : 
     157             :     sal_Bool            EnterDrawMode(const MouseEvent& rMEvt, const Point& aDocPos);
     158             :     sal_Bool            RulerColumnDrag( const MouseEvent& rMEvt, sal_Bool bVerticalMode);
     159             : 
     160             :     // helper function for D&D
     161             :     void            DropCleanup();
     162             :     void            CleanupDropUserMarker();
     163             :     sal_uInt16          GetDropDestination( const Point& rPixPnt,
     164             :                                         SdrObject ** ppObj = 0 );
     165             :     //select the object/cursor at the mouse position of the context menu request
     166             :     sal_Bool            SelectMenuPosition(SwWrtShell& rSh, const Point& rMousePos );
     167             : 
     168             :     /*
     169             :      * handler for scrolling on when the mousepointer
     170             :      * stopps outside of EditWin during a drag-operation.
     171             :      * The selection is regularly increased towards the mouse
     172             :      * position.
     173             :      */
     174             :     DECL_LINK( TimerHandler, void * );
     175             :     void            StartDDTimer();
     176             :     void            StopDDTimer(SwWrtShell *, const Point &);
     177             :     DECL_LINK( DDHandler, void * );
     178             : 
     179             :     // timer for ANY-KeyInut question without a following KeyInputEvent
     180             :     DECL_LINK( KeyInputFlushHandler, void * );
     181             : 
     182             :     // timer for overlapping KeyInputs (e.g. for tables)
     183             :     DECL_LINK( KeyInputTimerHandler, void * );
     184             : 
     185             :     // timer for ApplyTemplates via mouse (in disguise Drag&Drop)
     186             :     DECL_LINK( TemplateTimerHdl, void * );
     187             : 
     188             :     using OutputDevice::GetTextColor;
     189             : 
     190             : protected:
     191             : 
     192             :     virtual void    DataChanged( const DataChangedEvent& );
     193             :     virtual void    PrePaint();
     194             :     virtual void    Paint( const Rectangle& rRect );
     195             :     virtual void    KeyInput(const KeyEvent &rKEvt);
     196             : 
     197             :     virtual void    GetFocus();
     198             :     virtual void    LoseFocus();
     199             : 
     200             : 
     201             :     virtual void    MouseMove(const MouseEvent& rMEvt);
     202             :     virtual void    MouseButtonDown(const MouseEvent& rMEvt);
     203             :     virtual void    MouseButtonUp(const MouseEvent& rMEvt);
     204             :     virtual void    RequestHelp(const HelpEvent& rEvt);
     205             : 
     206             :     virtual void    Command( const CommandEvent& rCEvt );
     207             : 
     208             :                                 // Drag & Drop Interface
     209             :     virtual sal_Int8    AcceptDrop( const AcceptDropEvent& rEvt );
     210             :     virtual sal_Int8    ExecuteDrop( const ExecuteDropEvent& rEvt );
     211             :     virtual void        StartDrag( sal_Int8 nAction, const Point& rPosPixel );
     212             : 
     213             :     virtual rtl::OUString GetSurroundingText() const;
     214             :     virtual Selection GetSurroundingTextSelection() const;
     215             : 
     216             :     void    ShowAutoTextCorrectQuickHelp( const String& rWord, SvxAutoCorrCfg* pACfg,
     217             :                                 SvxAutoCorrect* pACorr, bool bFromIME = false );
     218             : 
     219             :     /// Returns true if in header/footer area, or in the header/footer control.
     220             :     bool    IsInHeaderFooter( const Point &rDocPt, FrameControlType &rControl ) const;
     221             : 
     222             :     bool    IsOverHeaderFooterFly( const Point& rDocPos, FrameControlType& rControl, bool& bOverFly, bool& bPageAnchored ) const;
     223             : public:
     224             : 
     225             :     void            UpdatePointer(const Point &, sal_uInt16 nButtons = 0);
     226             : 
     227             :     sal_Bool            IsDrawSelMode();
     228           0 :     sal_Bool            IsDrawAction()                  { return (bInsDraw); }
     229           0 :     void            SetDrawAction(sal_Bool bFlag)       { bInsDraw = bFlag; }
     230             : 
     231           0 :     void            SetObjectSelect( sal_Bool bVal )    { bObjectSelect = bVal; }
     232           0 :     sal_Bool            IsObjectSelect() const          { return bObjectSelect; }
     233             : 
     234           0 :     inline SdrObjKind   GetSdrDrawMode(/*sal_Bool bBuf = sal_False*/) const { return eDrawMode; }
     235           0 :     inline void         SetSdrDrawMode( SdrObjKind eSdrObjectKind ) { eDrawMode = eSdrObjectKind; SetObjectSelect( sal_False ); }
     236             :     void                StdDrawMode( SdrObjKind eSdrObjectKind, sal_Bool bObjSelect );
     237             : 
     238         662 :     sal_Bool            IsFrmAction()                   { return (bInsFrm); }
     239           0 :     inline sal_uInt16   GetBezierMode()                 { return eBezierMode; }
     240           0 :     void            SetBezierMode(sal_uInt16 eBezMode)  { eBezierMode = eBezMode; }
     241             :     void            EnterDrawTextMode(const Point& aDocPos); // turn on DrawTextEditMode
     242             :     void            InsFrm(sal_uInt16 nCols);
     243             :     void            StopInsFrm();
     244           0 :     sal_uInt16          GetFrmColCount() const {return nInsFrmColCount;} // column number for interactive frame
     245             : 
     246             : 
     247             :     void            SetChainMode( sal_Bool bOn );
     248         466 :     sal_Bool            IsChainMode() const             { return bChainMode; }
     249             : 
     250             :     void            FlushInBuffer();
     251             :     sal_Bool            IsInputSequenceCheckingRequired( const String &rText, const SwPaM& rCrsr ) const;
     252             : 
     253             : 
     254             :     static  void    SetReplaceQuote(sal_Bool bOn = sal_True) { bReplaceQuote = bOn; }
     255             :     static  sal_Bool    IsReplaceQuote() { return bReplaceQuote; }
     256             : 
     257             :     void             SetApplyTemplate(const SwApplyTemplate &);
     258           0 :     SwApplyTemplate* GetApplyTemplate() const { return pApplyTempl; }
     259             : 
     260             :     void            StartExecuteDrag();
     261             :     void            DragFinished();
     262             :     sal_uInt16          GetDropAction() const { return m_nDropAction; }
     263             :     sal_uLong           GetDropFormat() const { return m_nDropFormat; }
     264             : 
     265           0 :     Color           GetTextColor() { return aTextColor; }
     266             : 
     267           0 :     void            SetTextColor(const Color& rCol ) { aTextColor = rCol; }
     268             : 
     269           0 :     Color           GetTextBackColor()
     270           0 :                                             { return aTextBackColor; }
     271           0 :     void            SetTextBackColor(const Color& rCol )
     272           0 :                                             { aTextBackColor = rCol; }
     273           0 :     void            SetTextBackColorTransparent(sal_Bool bSet)
     274           0 :                                     { bTransparentBackColor = bSet; }
     275           0 :     sal_Bool            IsTextBackColorTransparent()
     276           0 :                                     { return bTransparentBackColor; }
     277           0 :     void            LockKeyInput(sal_Bool bSet){bLockInput = bSet;}
     278             : 
     279             :     const SwView &GetView() const { return rView; }
     280        2052 :           SwView &GetView()       { return rView; }
     281             : 
     282             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
     283             : 
     284           0 :     static inline long GetDDStartPosX() { return nDDStartPosX; }
     285           0 :     static inline long GetDDStartPosY() { return nDDStartPosY; }
     286             : 
     287             :     static void _InitStaticData();
     288             :     static void _FinitStaticData();
     289             : 
     290             :     //#i3370# remove quick help to prevent saving of autocorrection suggestions
     291             :     void StopQuickHelp();
     292             : 
     293             :     // #i42921# - add parameter <bVerticalMode>
     294             :     sal_Bool RulerMarginDrag( const MouseEvent& rMEvt,
     295             :                                      const bool bVerticalMode );
     296             : 
     297             :     /** #i42732# display status of font size/name depending on either the input
     298             :         language or the selection position depending on what has changed lately
     299             :      */
     300             :     void        SetUseInputLanguage( sal_Bool bNew );
     301           0 :     sal_Bool    IsUseInputLanguage() const { return bUseInputLanguage; }
     302             : 
     303         549 :     SwFrameControlsManager& GetFrameControlsManager() { return m_aFrameControlsManager; }
     304             : 
     305             :     SwEditWin(Window *pParent, SwView &);
     306             :     virtual ~SwEditWin();
     307             : };
     308             : 
     309             : #endif
     310             : 
     311             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10