LCOV - code coverage report
Current view: top level - sc/source/ui/inc - gridwin.hxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 1 0.0 %
Date: 2014-04-14 Functions: 0 1 0.0 %
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             : 
      20             : #ifndef SC_GRIDWIN_HXX
      21             : #define SC_GRIDWIN_HXX
      22             : 
      23             : #include <svtools/transfer.hxx>
      24             : #include "viewutil.hxx"
      25             : #include "viewdata.hxx"
      26             : #include "cbutton.hxx"
      27             : #include <svx/sdr/overlay/overlayobject.hxx>
      28             : #include <com/sun/star/sheet/DataPilotFieldOrientation.hpp>
      29             : #include <basegfx/matrix/b2dhommatrix.hxx>
      30             : 
      31             : #include <vector>
      32             : #include <boost/scoped_ptr.hpp>
      33             : #include <boost/unordered_map.hpp>
      34             : #include <boost/ptr_container/ptr_map.hpp>
      35             : 
      36             : namespace editeng {
      37             :     struct MisspellRanges;
      38             : }
      39             : 
      40             : namespace sc {
      41             :     struct SpellCheckContext;
      42             : }
      43             : 
      44             : struct ScTableInfo;
      45             : class ScDPObject;
      46             : class ScCheckListMenuWindow;
      47             : class ScDPFieldButton;
      48             : class ScOutputData;
      49             : class ScFilterListBox;
      50             : class SdrObject;
      51             : class SdrEditView;
      52             : class ScNoteMarker;
      53             : class FloatingWindow;
      54             : class SdrHdlList;
      55             : class ScTransferObj;
      56             : struct SpellCallbackInfo;
      57             : 
      58             :         //  Maus-Status (nMouseStatus)
      59             : 
      60             : #define SC_GM_NONE          0
      61             : #define SC_GM_TABDOWN       1
      62             : #define SC_GM_DBLDOWN       2
      63             : #define SC_GM_FILTER        3
      64             : #define SC_GM_IGNORE        4
      65             : #define SC_GM_WATERUNDO     5
      66             : #define SC_GM_URLDOWN       6
      67             : 
      68             :         //  Page-Drag-Modus
      69             : 
      70             : #define SC_PD_NONE          0
      71             : #define SC_PD_RANGE_L       1
      72             : #define SC_PD_RANGE_R       2
      73             : #define SC_PD_RANGE_T       4
      74             : #define SC_PD_RANGE_B       8
      75             : #define SC_PD_RANGE_TL      (SC_PD_RANGE_T|SC_PD_RANGE_L)
      76             : #define SC_PD_RANGE_TR      (SC_PD_RANGE_T|SC_PD_RANGE_R)
      77             : #define SC_PD_RANGE_BL      (SC_PD_RANGE_B|SC_PD_RANGE_L)
      78             : #define SC_PD_RANGE_BR      (SC_PD_RANGE_B|SC_PD_RANGE_R)
      79             : #define SC_PD_BREAK_H       16
      80             : #define SC_PD_BREAK_V       32
      81             : 
      82             : // predefines
      83             : namespace sdr { namespace overlay { class OverlayObjectList; }}
      84             : 
      85             : class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHelper
      86             : {
      87             :     // ScFilterListBox is always used for selection list
      88             :     friend class ScFilterListBox;
      89             : 
      90             :     enum RfCorner
      91             :     {
      92             :         NONE,
      93             :         LEFT_UP,
      94             :         RIGHT_UP,
      95             :         LEFT_DOWN,
      96             :         RIGHT_DOWN
      97             :     };
      98             : 
      99             :     // #114409#
     100             :     ::sdr::overlay::OverlayObjectList*              mpOOCursors;
     101             :     ::sdr::overlay::OverlayObjectList*              mpOOSelection;
     102             :     ::sdr::overlay::OverlayObjectList*              mpOOSelectionBorder;
     103             :     ::sdr::overlay::OverlayObjectList*              mpOOAutoFill;
     104             :     ::sdr::overlay::OverlayObjectList*              mpOODragRect;
     105             :     ::sdr::overlay::OverlayObjectList*              mpOOHeader;
     106             :     ::sdr::overlay::OverlayObjectList*              mpOOShrink;
     107             : 
     108             :     boost::scoped_ptr<Rectangle> mpAutoFillRect;
     109             : 
     110             :     struct MouseEventState;
     111             : 
     112             :     /**
     113             :      * Stores current visible column and row ranges, used to avoid expensive
     114             :      * operations on objects that are outside visible area.
     115             :      */
     116             :     struct VisibleRange
     117             :     {
     118             :         SCCOL mnCol1;
     119             :         SCCOL mnCol2;
     120             :         SCROW mnRow1;
     121             :         SCROW mnRow2;
     122             : 
     123             :         VisibleRange();
     124             : 
     125             :         bool isInside(SCCOL nCol, SCROW nRow) const;
     126             :         bool set(SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2);
     127             :     };
     128             : 
     129             :     VisibleRange maVisibleRange;
     130             : 
     131             :     boost::scoped_ptr<sc::SpellCheckContext> mpSpellCheckCxt;
     132             : 
     133             :     ScViewData*             pViewData;
     134             :     ScSplitPos              eWhich;
     135             :     ScHSplitPos             eHWhich;
     136             :     ScVSplitPos             eVWhich;
     137             : 
     138             :     ScNoteMarker*           pNoteMarker;
     139             : 
     140             :     ScFilterListBox*        pFilterBox;
     141             :     FloatingWindow*         pFilterFloat;
     142             :     boost::scoped_ptr<ScCheckListMenuWindow> mpAutoFilterPopup;
     143             :     boost::scoped_ptr<ScCheckListMenuWindow> mpDPFieldPopup;
     144             :     boost::scoped_ptr<ScDPFieldButton>       mpFilterButton;
     145             : 
     146             :     sal_uInt16              nCursorHideCount;
     147             : 
     148             :     sal_uInt16              nButtonDown;
     149             :     sal_uInt8               nMouseStatus;
     150             :     sal_uInt8               nNestedButtonState;     // track nested button up/down calls
     151             : 
     152             :     long                    nDPField;
     153             :     ScDPObject*             pDragDPObj; //! name?
     154             : 
     155             :     sal_uInt16              nRFIndex;
     156             :     SCsCOL                  nRFAddX;
     157             :     SCsROW                  nRFAddY;
     158             : 
     159             :     sal_uInt16              nPagebreakMouse;        // Page break mode, Drag
     160             :     SCCOLROW                nPagebreakBreak;
     161             :     SCCOLROW                nPagebreakPrev;
     162             :     ScRange                 aPagebreakSource;
     163             :     ScRange                 aPagebreakDrag;
     164             : 
     165             :     sal_uInt8               nPageScript;
     166             : 
     167             :     long                    nLastClickX;
     168             :     long                    nLastClickY;
     169             : 
     170             :     SCCOL                   nDragStartX;
     171             :     SCROW                   nDragStartY;
     172             :     SCCOL                   nDragEndX;
     173             :     SCROW                   nDragEndY;
     174             :     InsCellCmd              meDragInsertMode;
     175             : 
     176             :     sal_uInt16              nCurrentPointer;
     177             : 
     178             :     ScDDComboBoxButton      aComboButton;
     179             : 
     180             :     Point                   aCurMousePos;
     181             : 
     182             :     sal_uInt16              nPaintCount;
     183             :     Rectangle               aRepaintPixel;
     184             : 
     185             :     ScAddress               aAutoMarkPos;
     186             :     ScAddress               aListValPos;
     187             : 
     188             :     Rectangle               aInvertRect;
     189             : 
     190             :     RfCorner                aRFSelectedCorned;
     191             : 
     192             :     bool                    bEEMouse:1;               // Edit Engine has mouse
     193             :     bool                    bDPMouse:1;               // DataPilot D&D (new Pivot table)
     194             :     bool                    bRFMouse:1;               // RangeFinder drag
     195             :     bool                    bRFSize:1;
     196             :     bool                    bPagebreakDrawn:1;
     197             :     bool                    bDragRect:1;
     198             :     bool                    bIsInScroll:1;
     199             :     bool                    bIsInPaint:1;
     200             :     bool                    bNeedsRepaint:1;
     201             :     bool                    bAutoMarkVisible:1;
     202             :     bool                    bListValButton:1;
     203             : 
     204             :     DECL_LINK( PopupModeEndHdl, void* );
     205             :     DECL_LINK( PopupSpellingHdl, SpellCallbackInfo* );
     206             : 
     207             :     bool            TestMouse( const MouseEvent& rMEvt, bool bAction );
     208             : 
     209             :     bool            DoPageFieldSelection( SCCOL nCol, SCROW nRow );
     210             :     bool            DoAutoFilterButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt );
     211             :     void DoPushPivotButton( SCCOL nCol, SCROW nRow, const MouseEvent& rMEvt, bool bButton, bool bPopup );
     212             : 
     213             :     void            DPMouseMove( const MouseEvent& rMEvt );
     214             :     void            DPMouseButtonUp( const MouseEvent& rMEvt );
     215             :     void            DPTestMouse( const MouseEvent& rMEvt, bool bMove );
     216             : 
     217             :     /**
     218             :      * Check if the mouse click is on a field popup button.
     219             :      *
     220             :      * @return true if the field popup menu has been launched and no further
     221             :      *         mouse event handling is necessary, false otherwise.
     222             :      */
     223             :     bool DPTestFieldPopupArrow(const MouseEvent& rMEvt, const ScAddress& rPos, const ScAddress& rDimPos, ScDPObject* pDPObj);
     224             :     void            DPLaunchFieldPopupMenu(
     225             :         const Point& rScrPos, const Size& rScrSize, const ScAddress& rPos, ScDPObject* pDPObj);
     226             : 
     227             :     void            RFMouseMove( const MouseEvent& rMEvt, bool bUp );
     228             : 
     229             :     void            PagebreakMove( const MouseEvent& rMEvt, bool bUp );
     230             : 
     231             :     void            UpdateDragRect( bool bShowRange, const Rectangle& rPosRect );
     232             : 
     233             :     bool            IsAutoFilterActive( SCCOL nCol, SCROW nRow, SCTAB nTab );
     234             :     void            ExecFilter( sal_uLong nSel, SCCOL nCol, SCROW nRow,
     235             :                                 const OUString& aValue, bool bCheckForDates );
     236             :     void            FilterSelect( sal_uLong nSel );
     237             : 
     238             :     void            ExecDataSelect( SCCOL nCol, SCROW nRow, const OUString& rStr );
     239             : 
     240             :     void            ExecPageFieldSelect( SCCOL nCol, SCROW nRow, bool bHasSelection, const OUString& rStr );
     241             : 
     242             :     bool            HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange );
     243             : 
     244             :     bool            DropScroll( const Point& rMousePos );
     245             : 
     246             :     sal_Int8        AcceptPrivateDrop( const AcceptDropEvent& rEvt );
     247             :     sal_Int8        ExecutePrivateDrop( const ExecuteDropEvent& rEvt );
     248             :     sal_Int8        DropTransferObj( ScTransferObj* pTransObj, SCCOL nDestPosX, SCROW nDestPosY,
     249             :                                      const Point& rLogicPos, sal_Int8 nDndAction );
     250             : 
     251             :     void            HandleMouseButtonDown( const MouseEvent& rMEvt, MouseEventState& rState );
     252             : 
     253             :     bool            DrawMouseButtonDown(const MouseEvent& rMEvt);
     254             :     bool            DrawMouseButtonUp(const MouseEvent& rMEvt);
     255             :     bool            DrawMouseMove(const MouseEvent& rMEvt);
     256             :     bool            DrawKeyInput(const KeyEvent& rKEvt);
     257             :     bool            DrawCommand(const CommandEvent& rCEvt);
     258             :     bool            DrawHasMarkedObj();
     259             :     void            DrawEndAction();
     260             :     void            DrawMarkDropObj( SdrObject* pObj );
     261             :     SdrObject*      GetEditObject();
     262             :     bool            IsMyModel(SdrEditView* pSdrView);
     263             : 
     264             :     void            DrawRedraw( ScOutputData& rOutputData, ScUpdateMode eMode, sal_uLong nLayer );
     265             :     void            DrawSdrGrid( const Rectangle& rDrawingRect, OutputDevice* pContentDev );
     266             :     void            DrawAfterScroll();
     267             :     Rectangle       GetListValButtonRect( const ScAddress& rButtonPos );
     268             : 
     269             :     void            DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, OutputDevice* pContentDev );
     270             : 
     271             :     bool            GetEditUrl( const Point& rPos,
     272             :                                 OUString* pName=0, OUString* pUrl=0, OUString* pTarget=0 );
     273             : 
     274             :     bool            HitRangeFinder( const Point& rMouse, RfCorner& rCorner, sal_uInt16* pIndex = NULL,
     275             :                                     SCsCOL* pAddX = NULL, SCsROW* pAddY = NULL );
     276             : 
     277             :     sal_uInt16          HitPageBreak( const Point& rMouse, ScRange* pSource = NULL,
     278             :                                     SCCOLROW* pBreak = NULL, SCCOLROW* pPrev = NULL );
     279             : 
     280             :     void            PasteSelection( const Point& rPosPixel );
     281             : 
     282             :     void            SelectForContextMenu( const Point& rPosPixel, SCsCOL nCellX, SCsROW nCellY );
     283             : 
     284             :     void            GetSelectionRects( ::std::vector< Rectangle >& rPixelRects );
     285             : 
     286             : protected:
     287             :     using Window::Resize;
     288             :     virtual void    Resize( const Size& rSize );
     289             :     virtual void    PrePaint() SAL_OVERRIDE;
     290             :     virtual void    Paint( const Rectangle& rRect ) SAL_OVERRIDE;
     291             :     virtual void    KeyInput(const KeyEvent& rKEvt) SAL_OVERRIDE;
     292             :     virtual void    GetFocus() SAL_OVERRIDE;
     293             :     virtual void    LoseFocus() SAL_OVERRIDE;
     294             : 
     295             :     virtual void    RequestHelp( const HelpEvent& rEvt ) SAL_OVERRIDE;
     296             :     virtual void    Command( const CommandEvent& rCEvt ) SAL_OVERRIDE;
     297             : 
     298             :     virtual sal_Int8 AcceptDrop( const AcceptDropEvent& rEvt ) SAL_OVERRIDE;
     299             :     virtual sal_Int8 ExecuteDrop( const ExecuteDropEvent& rEvt ) SAL_OVERRIDE;
     300             :     virtual void    StartDrag( sal_Int8 nAction, const Point& rPosPixel ) SAL_OVERRIDE;
     301             : 
     302             : public:
     303             :     enum AutoFilterMode { Normal, Top10, Custom, Empty, NonEmpty, SortAscending, SortDescending };
     304             : 
     305             :     ScGridWindow( Window* pParent, ScViewData* pData, ScSplitPos eWhichPos );
     306             :     virtual ~ScGridWindow();
     307             : 
     308             :     // #i70788# flush and get overlay
     309             :     rtl::Reference<sdr::overlay::OverlayManager> getOverlayManager();
     310             :     void flushOverlayManager();
     311             : 
     312             :     virtual void    DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
     313             : 
     314             :     virtual void    MouseButtonDown( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     315             :     virtual void    MouseButtonUp( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     316             :     virtual void    MouseMove( const MouseEvent& rMEvt ) SAL_OVERRIDE;
     317             :     virtual bool    PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
     318             :     virtual void    Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
     319             : 
     320             :     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
     321             : 
     322             :     void            FakeButtonUp();
     323             : 
     324             :     Point           GetMousePosPixel() const;
     325             :     void            UpdateStatusPosSize();
     326             : 
     327             :     void            ClickExtern();
     328             : 
     329             :     void            SetPointer( const Pointer& rPointer );
     330             : 
     331             :     void            MoveMouseStatus( ScGridWindow &rDestWin );
     332             : 
     333             :     void            ScrollPixel( long nDifX, long nDifY );
     334             :     void            UpdateEditViewPos();
     335             : 
     336             :     void            UpdateFormulas();
     337             : 
     338             :     void            LaunchDataSelectMenu( SCCOL nCol, SCROW nRow, bool bDataSelect );
     339             :     void            DoScenarioMenu( const ScRange& rScenRange );
     340             : 
     341             :     void            LaunchAutoFilterMenu(SCCOL nCol, SCROW nRow);
     342             :     void            RefreshAutoFilterButton(const ScAddress& rPos);
     343             :     void            UpdateAutoFilterFromMenu(AutoFilterMode eMode);
     344             : 
     345             :     void            LaunchPageFieldMenu( SCCOL nCol, SCROW nRow );
     346             :     void            LaunchDPFieldMenu( SCCOL nCol, SCROW nRow );
     347             : 
     348             :     ::com::sun::star::sheet::DataPilotFieldOrientation GetDPFieldOrientation( SCCOL nCol, SCROW nRow ) const;
     349             : 
     350             :     void DrawButtons( SCCOL nX1, SCCOL nX2, ScTableInfo& rTabInfo, OutputDevice* pContentDev);
     351             : 
     352             :     using Window::Draw;
     353             :     void            Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
     354             :                           ScUpdateMode eMode = SC_UPDATE_ALL );
     355             : 
     356             :     void            CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
     357             : 
     358             :     void            HideCursor();
     359             :     void            ShowCursor();
     360             :     void            UpdateAutoFillMark(bool bMarked, const ScRange& rMarkRange);
     361             : 
     362             :     void            UpdateListValPos( bool bVisible, const ScAddress& rPos );
     363             : 
     364             :     bool            ShowNoteMarker( SCsCOL nPosX, SCsROW nPosY, bool bKeyboard );
     365             :     void            HideNoteMarker();
     366             : 
     367             :     MapMode         GetDrawMapMode( bool bForce = false );
     368             : 
     369             :     void            ContinueDrag();
     370             : 
     371             :     void            StopMarking();
     372             :     void            UpdateInputContext();
     373             : 
     374           0 :     bool            NeedsRepaint() { return bNeedsRepaint; }
     375             : 
     376             :     void            DoInvertRect( const Rectangle& rPixel );
     377             : 
     378             :     void            CheckNeedsRepaint();
     379             :     virtual void SwitchView();
     380             : 
     381             :     void            UpdateDPFromFieldPopupMenu();
     382             :     bool            UpdateVisibleRange();
     383             : 
     384             :     void            SetInRefMode( bool bRefMode );
     385             : 
     386             :     // #114409#
     387             :     void CursorChanged();
     388             :     void DrawLayerCreated();
     389             :     bool ContinueOnlineSpelling();
     390             :     void EnableAutoSpell( bool bEnable );
     391             :     void ResetAutoSpell();
     392             :     void SetAutoSpellData( SCCOL nPosX, SCROW nPosY, const std::vector<editeng::MisspellRanges>* pRanges );
     393             : 
     394             :     void            DeleteCopySourceOverlay();
     395             :     void            UpdateCopySourceOverlay();
     396             :     void            DeleteCursorOverlay();
     397             :     void            UpdateCursorOverlay();
     398             :     void            DeleteSelectionOverlay();
     399             :     void            UpdateSelectionOverlay();
     400             :     void            DeleteAutoFillOverlay();
     401             :     void            UpdateAutoFillOverlay();
     402             :     void            DeleteDragRectOverlay();
     403             :     void            UpdateDragRectOverlay();
     404             :     void            DeleteHeaderOverlay();
     405             :     void            UpdateHeaderOverlay();
     406             :     void            DeleteShrinkOverlay();
     407             :     void            UpdateShrinkOverlay();
     408             :     void            UpdateAllOverlays();
     409             : 
     410             : protected:
     411             :     // #114409#
     412             :     void ImpCreateOverlayObjects();
     413             :     void ImpDestroyOverlayObjects();
     414             : 
     415             : };
     416             : 
     417             : #endif
     418             : 
     419             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10