LCOV - code coverage report
Current view: top level - include/svx - svdview.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 8 10 80.0 %
Date: 2015-06-13 12:38:46 Functions: 8 10 80.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 INCLUDED_SVX_SVDVIEW_HXX
      21             : #define INCLUDED_SVX_SVDVIEW_HXX
      22             : 
      23             : // HACK to avoid too deep includes and to have some
      24             : // levels free in svdmark itself (MS compiler include depth limit)
      25             : #include <svx/svdhdl.hxx>
      26             : #include <tools/weakbase.hxx>
      27             : #include <svtools/accessibilityoptions.hxx>
      28             : #include <svx/svxdllapi.h>
      29             : #include <svx/svdcrtv.hxx>
      30             : #include <unotools/options.hxx>
      31             : #include <basegfx/polygon/b2dpolypolygon.hxx>
      32             : #include <basegfx/polygon/b2dpolygon.hxx>
      33             : 
      34             : //  class hierarchy of View:
      35             : //         SfxListener
      36             : //         SdrPaintView    PntV   Action            ModChg   Attr   Notify
      37             : //         SdrSnapView     SnpV   Action
      38             : //
      39             : //         SdrMarkView     MrkV   Action   MrkChg   ModChg          Notify
      40             : //
      41             : //         SdrEditView     EdtV            MrkChg   ModChg   Attr
      42             : //         SdrPolyEditView PoEV
      43             : //         SdrGlueEditView GlEV
      44             : //         SdrObjEditView  EdxV   Action            ModChg   Attr   Notify
      45             : //
      46             : //         SdrExchangeView XcgV
      47             : //         SdrDragView     DrgV   Action
      48             : //
      49             : //         SdrCreateView   CrtV   Action
      50             : //         SdrView         View
      51             : 
      52             : class SvxURLField;
      53             : 
      54             : enum SdrViewContext {SDRCONTEXT_STANDARD,
      55             :                      SDRCONTEXT_POINTEDIT,
      56             :                      SDRCONTEXT_GLUEPOINTEDIT,
      57             :                      SDRCONTEXT_GRAPHIC,
      58             :                      SDRCONTEXT_MEDIA,
      59             :                      SDRCONTEXT_TABLE};
      60             : 
      61             : enum SdrEventKind  {SDREVENT_NONE,
      62             :                     SDREVENT_TEXTEDIT,
      63             :                     SDREVENT_MOVACTION,
      64             :                     SDREVENT_ENDACTION,
      65             :                     SDREVENT_BCKACTION,
      66             :                     SDREVENT_BRKACTION,
      67             :                     SDREVENT_ENDCREATE,
      68             :                     SDREVENT_ENDDRAG,
      69             :                     SDREVENT_MARKOBJ,
      70             :                     SDREVENT_MARKPOINT,
      71             :                     SDREVENT_MARKGLUEPOINT,
      72             :                     SDREVENT_BEGMARK,
      73             :                     SDREVENT_BEGINSOBJPOINT,
      74             :                     SDREVENT_ENDINSOBJPOINT,
      75             :                     SDREVENT_BEGINSGLUEPOINT,
      76             :                     SDREVENT_BEGDRAGHELPLINE,
      77             :                     SDREVENT_BEGDRAGOBJ,
      78             :                     SDREVENT_BEGCREATEOBJ,
      79             :                     SDREVENT_BEGMACROOBJ,
      80             :                     SDREVENT_BEGTEXTEDIT,
      81             :                     SDREVENT_ENDMARK,
      82             :                     SDREVENT_BRKMARK,
      83             :                     SDREVENT_EXECUTEURL};
      84             : 
      85             : /* for PickAnything() */
      86             : enum class SdrMouseEventKind
      87             : {
      88             :     BUTTONDOWN = 1,
      89             :     MOVE       = 2,
      90             :     BUTTONUP   = 3,
      91             : };
      92             : 
      93             : // helper class SdrViewEvent
      94             : struct SVX_DLLPUBLIC SdrViewEvent
      95             : {
      96             :     SdrHdl*                     pHdl;
      97             :     SdrObject*                  pObj;
      98             :     SdrObject*                  pRootObj;        // mark this when SdrBeginTextEdit is executed
      99             :     SdrPageView*                pPV;
     100             :     const SvxURLField*          pURLField;
     101             : 
     102             :     Point                       aLogicPos;
     103             :     SdrHitKind                  eHit;
     104             :     SdrEventKind                eEvent;
     105             :     SdrHdlKind                  eHdlKind;
     106             :     SdrCreateCmd                eEndCreateCmd;   // for EndInsPoint too
     107             : 
     108             :     sal_uInt16                  nMouseClicks;
     109             :     MouseEventModifiers         nMouseMode;
     110             :     sal_uInt16                  nMouseCode;
     111             :     sal_uInt16                  nHlplIdx;
     112             :     sal_uInt16                  nGlueId;
     113             : 
     114             :     bool                        bMouseDown : 1;
     115             :     bool                        bMouseUp : 1;
     116             :     bool                        bDoubleHdlSize : 1;  // Double Handlesize because of TextEdit
     117             :     bool                        bIsAction : 1;       // Action is active
     118             :     bool                        bIsTextEdit : 1;     // TextEdit runs currently
     119             :     bool                        bTextEditHit : 1;    // hit open OutlinerView?
     120             :     bool                        bAddMark : 1;
     121             :     bool                        bUnmark : 1;
     122             :     bool                        bPrevNextMark : 1;
     123             :     bool                        bMarkPrev : 1;
     124             :     bool                        bInsPointNewObj : 1;
     125             :     bool                        bDragWithCopy : 1;
     126             :     bool                        bCaptureMouse : 1;
     127             :     bool                        bReleaseMouse : 1;
     128             : 
     129             : public:
     130             :     SdrViewEvent();
     131             :     ~SdrViewEvent();
     132             : 
     133             :     // nEventKind is SdrMouseEventKind::BUTTONDOWN, SdrMouseEventKind::MOVE or SdrMouseEventKind::BUTTONUP
     134             :     void SetMouseEvent(const MouseEvent& rMEvt, SdrMouseEventKind nEventKind);
     135             : };
     136             : 
     137             : // helper class for all D&D overlays
     138             : class SVX_DLLPUBLIC SdrDropMarkerOverlay
     139             : {
     140             :     // The OverlayObjects
     141             :     sdr::overlay::OverlayObjectList               maObjects;
     142             : 
     143             :     void ImplCreateOverlays(
     144             :         const SdrView& rView,
     145             :         const basegfx::B2DPolyPolygon& rLinePolyPolygon);
     146             : 
     147             : public:
     148             :     SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
     149             :     SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
     150             :     SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
     151             :     ~SdrDropMarkerOverlay();
     152             : };
     153             : 
     154             : 
     155             : /*
     156             :  * View
     157             :  */
     158             : class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
     159             : {
     160             :     friend class                SdrPageView;
     161             : 
     162             :     bool                        bNoExtendedMouseDispatcher : 1;
     163             :     bool                        bNoExtendedKeyDispatcher : 1;
     164             :     bool                        bNoExtendedCommandDispatcher : 1;
     165             :     bool                        bTextEditOnObjectsWithoutTextIfTextTool : 1;
     166             :     bool                        mbMasterPagePaintCaching : 1;
     167             : 
     168             : protected:
     169             :     SvtAccessibilityOptions maAccessibilityOptions;
     170             : 
     171             : public:
     172             :     TYPEINFO_OVERRIDE();
     173             :     explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
     174             :     virtual ~SdrView();
     175             : 
     176             :     // The default value for all dispatchers is activated. If the app for example
     177             :     // wants to intervene in MouseDispatcher for special treatment, you have to
     178             :     // deactivate the MouseDispatcher with the help of the methode below and you have
     179             :     // to implement it yourself. Example for MouseButtonDown:
     180             :     //      SdrViewEvent aVEvt;
     181             :     //      SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SdrMouseEventKind::BUTTONDOWN,aVEvt);
     182             :     //      ... hier Applikationsspezifischer Eingriff ...
     183             :     //      pSdrView->DoMouseEvent(aVEvt);
     184             :     //      SetPointer(GetPreferredPointer(...))
     185             :     //      CaptureMouse(...)
     186        4014 :     void EnableExtendedMouseEventDispatcher(bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
     187           8 :     bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
     188             : 
     189        4014 :     void EnableExtendedKeyInputDispatcher(bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
     190           1 :     bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
     191             : 
     192        4014 :     void EnableExtendedCommandEventDispatcher(bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
     193             :     bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
     194             : 
     195         323 :     void EnableTextEditOnObjectsWithoutTextIfTextTool(bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
     196             :     bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
     197             : 
     198             :     void SetMasterPagePaintCaching(bool bOn);
     199        1056 :     bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
     200             : 
     201             :     bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) SAL_OVERRIDE;
     202             :     virtual bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
     203             :     virtual bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
     204             :     virtual bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin) SAL_OVERRIDE;
     205             :     virtual bool Command(const CommandEvent& rCEvt, vcl::Window* pWin) SAL_OVERRIDE;
     206             : 
     207             :     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
     208             : 
     209           0 :     bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll=false) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
     210           0 :     bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr=false) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
     211             : 
     212             :     /* new interface src537 */
     213             :     bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
     214             : 
     215             :     SfxStyleSheet* GetStyleSheet() const;
     216             : 
     217             :     // incomplete implementation:
     218             :     // OutputDevice is necessary to determine HandleSize.
     219             :     // If NULL the first signed on Win is used.
     220             :     Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const;
     221             :     SdrHitKind PickAnything(const MouseEvent& rMEvt, SdrMouseEventKind nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
     222             :     SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
     223             :     bool DoMouseEvent(const SdrViewEvent& rVEvt);
     224             :     virtual SdrViewContext GetContext() const;
     225             : 
     226             :     // The methods consider the particular context:
     227             :     // - simple drawing
     228             :     // - mode for editing points
     229             :     // - mode for editing glue points
     230             :     // - TextEdit
     231             :     // - ... to be continued
     232             :     void MarkAll();
     233             :     void UnmarkAll();
     234             : 
     235             :     const Rectangle& GetMarkedRect() const;
     236             : 
     237             :     virtual void DeleteMarked();
     238             : 
     239             :     // Marking objects, traverse stations or glue points (depending on view-
     240             :     // context) by enveloping the selection frame.
     241             :     //   bAddMark=TRUE: add to existing selection (->Shift)
     242             :     //   bUnmark=TRUE: remove objects from selection which are inside of
     243             :     //                 the enveloped frame.
     244             :     bool BegMark(const Point& rPnt, bool bAddMark=false, bool bUnmark=false);
     245             : 
     246             :     // The following actions are possible:
     247             :     //   - ObjectCreating
     248             :     //   - ObjectMarking
     249             :     //   - Object-specific dragging
     250             :     //   - General dragging
     251             :     // and more...
     252             :     OUString GetStatusText();
     253             : 
     254       82410 :     SvtAccessibilityOptions& getAccessibilityOptions() { return maAccessibilityOptions;}
     255             : 
     256             :     virtual void onAccessibilityOptionsChanged();
     257             : };
     258             : 
     259             : #endif // INCLUDED_SVX_SVDVIEW_HXX
     260             : 
     261             : // First of all the app creates a SdrModel.
     262             : // Then it opens a Win and creates a SdrView.
     263             : // ShowSdrPage() announces a page at SdrView.
     264             : // It's possible to show SdrView in any Wins at once.
     265             : // internal:
     266             : // SdrView can show as many Wins as it wants at once. Pages are announced
     267             : // or checked out with the help of ShowSdrPage()/HideSdrPage(). For every announced
     268             : // page there is a SdrPageView instance in container aPages. If more than one page
     269             : // is showed, you have to pay attention that the offset parameter of ShowSdrPage()
     270             : // is conformed to the size of the page (to prevent overlapping of two pages).
     271             : //
     272             : // elementary methods:
     273             : // ~~~~~~~~~~~~~~~~~~~~
     274             : //   simple events:
     275             : //   ~~~~~~~~~~~~~~~~
     276             : //     sal_Bool KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin);
     277             : //     sal_Bool MouseButtonDown(const MouseEvent& rMEvt, vcl::Window* pWin);
     278             : //     sal_Bool MouseButtonUp(const MouseEvent& rMEvt, vcl::Window* pWin);
     279             : //     sal_Bool MouseMove(const MouseEvent& rMEvt, vcl::Window* pWin);
     280             : //     sal_Bool Command(const CommandEvent& rCEvt, vcl::Window* pWin);
     281             : //
     282             : //   Exchange (Clipboard derzeit noch ohne SdrPrivateData):
     283             : //   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     284             : //     sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     285             : //     sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     286             : //     sal_Bool Paste(vcl::Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
     287             : //
     288             : //   SfxItems:
     289             : //   ~~~~~~~~~
     290             : //     sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
     291             : //     sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
     292             : //     SfxStyleSheet* GetStyleSheet() const;
     293             : //     sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
     294             : //
     295             : //   others:
     296             : //   ~~~~~~~~~~
     297             : //     Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
     298             : //     OUString GetStatusText();
     299             : 
     300             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11