LCOV - code coverage report
Current view: top level - include/svx - svdview.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 5 9 55.6 %
Date: 2014-04-11 Functions: 5 9 55.6 %
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             : //  Klassenhierarchie der 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             : #define SDRMOUSEBUTTONDOWN 1
      86             : #define SDRMOUSEMOVE       2
      87             : #define SDRMOUSEBUTTONUP   3
      88             : 
      89             : // helper class SdrViewEvent
      90             : struct SVX_DLLPUBLIC SdrViewEvent
      91             : {
      92             :     SdrHdl*                     pHdl;
      93             :     SdrObject*                  pObj;
      94             :     SdrObject*                  pRootObj;        // Dieses Markieren bei SdrBeginTextEdit
      95             :     SdrPageView*                pPV;
      96             :     const SvxURLField*          pURLField;
      97             : 
      98             :     Point                       aLogicPos;
      99             :     SdrHitKind                  eHit;
     100             :     SdrEventKind                eEvent;
     101             :     SdrHdlKind                  eHdlKind;
     102             :     SdrCreateCmd                eEndCreateCmd;   // auch fuer EndInsPoint
     103             : 
     104             :     sal_uInt16                      nMouseClicks;
     105             :     sal_uInt16                      nMouseMode;
     106             :     sal_uInt16                      nMouseCode;
     107             :     sal_uInt16                      nHlplIdx;
     108             :     sal_uInt16                      nGlueId;
     109             : 
     110             :     bool                        bMouseDown : 1;
     111             :     bool                        bMouseUp : 1;
     112             :     bool                        bDoubleHdlSize : 1;  // Doppelte Handlegroesse wg. TextEdit
     113             :     bool                        bIsAction : 1;       // Action ist aktiv
     114             :     bool                        bIsTextEdit : 1;     // TextEdit laeuft zur Zeit
     115             :     bool                        bTextEditHit : 1;    // offene OutlinerView getroffen
     116             :     bool                        bAddMark : 1;
     117             :     bool                        bUnmark : 1;
     118             :     bool                        bPrevNextMark : 1;
     119             :     bool                        bMarkPrev : 1;
     120             :     bool                        bInsPointNewObj : 1;
     121             :     bool                        bDragWithCopy : 1;
     122             :     bool                        bCaptureMouse : 1;
     123             :     bool                        bReleaseMouse : 1;
     124             : 
     125             : public:
     126             :     SdrViewEvent();
     127             :     ~SdrViewEvent();
     128             : 
     129             :     // nEventKind ist SDRMOUSEBUTTONDOWN, SDRMOUSEMOVE oder SDRMOUSEBUTTONUP
     130             :     void SetMouseEvent(const MouseEvent& rMEvt, sal_uInt16 nEventKind);
     131             : };
     132             : 
     133             : // helper class for all D&D overlays
     134             : class SVX_DLLPUBLIC SdrDropMarkerOverlay
     135             : {
     136             :     // The OverlayObjects
     137             :     ::sdr::overlay::OverlayObjectList               maObjects;
     138             : 
     139             :     void ImplCreateOverlays(
     140             :         const SdrView& rView,
     141             :         const basegfx::B2DPolyPolygon& rLinePolyPolygon);
     142             : 
     143             : public:
     144             :     SdrDropMarkerOverlay(const SdrView& rView, const SdrObject& rObject);
     145             :     SdrDropMarkerOverlay(const SdrView& rView, const Rectangle& rRectangle);
     146             :     SdrDropMarkerOverlay(const SdrView& rView, const Point& rStart, const Point& rEnd);
     147             :     ~SdrDropMarkerOverlay();
     148             : };
     149             : 
     150             : 
     151             : /*
     152             :  * View
     153             :  */
     154             : class SVX_DLLPUBLIC SdrView: public SdrCreateView, public tools::WeakBase< SdrView >
     155             : {
     156             :     friend class                SdrPageView;
     157             : 
     158             :     bool                        bNoExtendedMouseDispatcher : 1;
     159             :     bool                        bNoExtendedKeyDispatcher : 1;
     160             :     bool                        bNoExtendedCommandDispatcher : 1;
     161             :     bool                        bTextEditOnObjectsWithoutTextIfTextTool : 1;
     162             :     bool                        mbMasterPagePaintCaching : 1;
     163             : 
     164             : protected:
     165             :     SvtAccessibilityOptions maAccessibilityOptions;
     166             : 
     167             : public:
     168             :     TYPEINFO_OVERRIDE();
     169             :     explicit SdrView(SdrModel* pModel1, OutputDevice* pOut = 0L);
     170             :     virtual ~SdrView();
     171             : 
     172             :     // Default sind alle Dispatcher aktiviert. Will die App z.B. fuer
     173             :     // Sonderbehandlungen im MouseDispatcher eingreifen, so muss sie
     174             :     // den erweiterten MouseDispather mit unten stehender Methode deaktivieren
     175             :     // und selbst nachimplementieren. Beispiel fuer MouseButtonDown:
     176             :     //      SdrViewEvent aVEvt;
     177             :     //      SdrHitKind eHit=pSdrView->PickAnything(rMEvt,SDRMOUSEBUTTONDOWN,aVEvt);
     178             :     //      ... hier Applikationsspezifischer Eingriff ...
     179             :     //      pSdrView->DoMouseEvent(aVEvt);
     180             :     //      SetPointer(GetPreferredPointer(...))
     181             :     //      CaptureMouse(...)
     182        2549 :     void EnableExtendedMouseEventDispatcher(bool bOn) { bNoExtendedMouseDispatcher = !bOn; }
     183           0 :     bool IsExtendedMouseEventDispatcherEnabled() const { return bNoExtendedMouseDispatcher; }
     184             : 
     185        2549 :     void EnableExtendedKeyInputDispatcher(bool bOn) { bNoExtendedKeyDispatcher=!bOn; }
     186           0 :     bool IsExtendedKeyInputDispatcherEnabled() const { return bNoExtendedKeyDispatcher; }
     187             : 
     188        2549 :     void EnableExtendedCommandEventDispatcher(bool bOn) { bNoExtendedCommandDispatcher=!bOn; }
     189             :     bool IsExtendedCommandEventDispatcherEnabled() const { return bNoExtendedCommandDispatcher; }
     190             : 
     191         420 :     void EnableTextEditOnObjectsWithoutTextIfTextTool(bool bOn) { bTextEditOnObjectsWithoutTextIfTextTool=bOn; }
     192             :     bool IsEnableTextEditOnObjectsWithoutTextIfTextToolEnabled() const { return bTextEditOnObjectsWithoutTextIfTextTool; }
     193             : 
     194             :     void SetMasterPagePaintCaching(bool bOn);
     195         622 :     bool IsMasterPagePaintCaching() const { return mbMasterPagePaintCaching; }
     196             : 
     197             :     bool KeyInput(const KeyEvent& rKEvt, Window* pWin) SAL_OVERRIDE;
     198             :     virtual bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
     199             :     virtual bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
     200             :     virtual bool MouseMove(const MouseEvent& rMEvt, Window* pWin) SAL_OVERRIDE;
     201             :     virtual bool Command(const CommandEvent& rCEvt, Window* pWin) SAL_OVERRIDE;
     202             : 
     203             :     virtual void ConfigurationChanged( utl::ConfigurationBroadcaster*, sal_uInt32 ) SAL_OVERRIDE;
     204             : 
     205           0 :     bool SetAttributes(const SfxItemSet& rSet, bool bReplaceAll=false) { return SdrCreateView::SetAttributes(rSet,bReplaceAll); }
     206           0 :     bool SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHardAttr=false) { return SdrCreateView::SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); }
     207             : 
     208             :     /* new interface src537 */
     209             :     bool GetAttributes(SfxItemSet& rTargetSet, bool bOnlyHardAttr=false) const;
     210             : 
     211             :     SfxStyleSheet* GetStyleSheet() const;
     212             : 
     213             :     // unvollstaendige Implementation:
     214             :     // Das OutputDevice ist notwendig, damit ich die HandleSize ermitteln kann.
     215             :     // Bei NULL wird das 1. angemeldete Win verwendet.
     216             :     Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nModifier=0, bool bLeftDown=false) const;
     217             :     SdrHitKind PickAnything(const MouseEvent& rMEvt, sal_uInt16 nMouseDownOrMoveOrUp, SdrViewEvent& rVEvt) const;
     218             :     SdrHitKind PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) const;
     219             :     bool DoMouseEvent(const SdrViewEvent& rVEvt);
     220             :     virtual SdrViewContext GetContext() const;
     221             : 
     222             :     // Die Methoden beruecksichtigen den jeweiligen Kontex:
     223             :     // - Einfaches Zeichnen
     224             :     // - Punktbearbeitungs-Mode
     225             :     // - Klebepunkt-Editmode
     226             :     // - TextEdit
     227             :     // - ... to be continued
     228             :     void MarkAll();
     229             :     void UnmarkAll();
     230             : 
     231             :     const Rectangle& GetMarkedRect() const;
     232             : 
     233             :     virtual void DeleteMarked();
     234             : 
     235             :     // Markieren von Objekten, Polygonpunkten oder Klebepunkten (je nach View-
     236             :     // Kontext) durch Aufziehen eines Selektionsrahmens.
     237             :     //   bAddMark=TRUE: zur bestehenden Selektion hinzumarkieren (->Shift)
     238             :     //   bUnmark=TRUE: Bereits selektierte Objekte/Punkte/Klebepunkte die innerhalb
     239             :     //                 des aufgezogenen Rahmens liegen werden deselektiert.
     240             :     bool BegMark(const Point& rPnt, bool bAddMark=false, bool bUnmark=false);
     241             : 
     242             :     // Folgende Actions sind moeglich:
     243             :     //   - ObjectCreating
     244             :     //   - ObjectMarking
     245             :     //   - Object-specific dragging
     246             :     //   - General dragging
     247             :     // und mehr...
     248             :     OUString GetStatusText();
     249             : 
     250             :     SvtAccessibilityOptions& getAccessibilityOptions();
     251             : 
     252             :     virtual void onAccessibilityOptionsChanged();
     253             : };
     254             : 
     255             : #endif // INCLUDED_SVX_SVDVIEW_HXX
     256             : 
     257             : // Die App macht sich zunaechst ein SdrModel.
     258             : // Anschliessend oeffnet sie ein Win und erzeugt dann eine SdrView.
     259             : // An der SdrView meldet sie dann mit der Methode ShowSdrPage() eine Seite an.
     260             : // Eine SdrView kann in beliebig vielen Fenstern gleichzeitig angezeigt werden.
     261             : // Intern:
     262             : // Eine SdrView kann beliebig viele Seiten gleichzeitig anzeigen. Seiten
     263             : // werden an- und abgemeldet mit ShowSdrPage()/HideSdrPage(). Fuer jede angemeldete
     264             : // Seite wird eine SdrPageView-Instanz im Container aPages angelegt. Bei
     265             : // gleichzeitiger Anzeige mehrerer Seiten ist darauf zu achten, dass der Offset-
     266             : // Parameter von ShowSdrPage() der Seitengroesse angepasst ist, da sich sonst die
     267             : // Seiten ueberlappen koennten.
     268             : //
     269             : // Elementare Methoden:
     270             : // ~~~~~~~~~~~~~~~~~~~~
     271             : //   Einfache Events:
     272             : //   ~~~~~~~~~~~~~~~~
     273             : //     sal_Bool KeyInput(const KeyEvent& rKEvt, Window* pWin);
     274             : //     sal_Bool MouseButtonDown(const MouseEvent& rMEvt, Window* pWin);
     275             : //     sal_Bool MouseButtonUp(const MouseEvent& rMEvt, Window* pWin);
     276             : //     sal_Bool MouseMove(const MouseEvent& rMEvt, Window* pWin);
     277             : //     sal_Bool Command(const CommandEvent& rCEvt, Window* pWin);
     278             : //
     279             : //   Exchange (Clipboard derzeit noch ohne SdrPrivateData):
     280             : //   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     281             : //     sal_Bool Cut(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     282             : //     sal_Bool Yank(sal_uIntPtr nFormat=SDR_ANYFORMAT);
     283             : //     sal_Bool Paste(Window* pWin=NULL, sal_uIntPtr nFormat=SDR_ANYFORMAT);
     284             : //
     285             : //   SfxItems:
     286             : //   ~~~~~~~~~
     287             : //     sal_Bool GetAttributes(SfxItemSet& rTargetSet, sal_Bool bOnlyHardAttr=sal_False) const;
     288             : //     sal_Bool SetAttributes(const SfxItemSet& rSet, sal_Bool bReplaceAll);
     289             : //     SfxStyleSheet* GetStyleSheet() const;
     290             : //     sal_Bool SetStyleSheet(SfxStyleSheet* pStyleSheet, sal_Bool bDontRemoveHardAttr);
     291             : //
     292             : //   Sonstiges:
     293             : //   ~~~~~~~~~~
     294             : //     Pointer GetPreferredPointer(const Point& rMousePos, const OutputDevice* pOut, sal_uInt16 nTol=0) const;
     295             : //     OUString GetStatusText();
     296             : 
     297             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10