LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - svddrgv.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 29 10.3 %
Date: 2012-12-27 Functions: 3 29 10.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             : 
      20             : #ifndef _SVDDRGV_HXX
      21             : #define _SVDDRGV_HXX
      22             : 
      23             : #include "svx/svxdllapi.h"
      24             : #include <svx/svdxcgv.hxx>
      25             : 
      26             : //************************************************************
      27             : //   Vorausdeklarationen
      28             : //************************************************************
      29             : 
      30             : class SdrUndoGeoObj;
      31             : 
      32             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      33             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      34             : //
      35             : //  @@@@@  @@@@@   @@@@   @@@@   @@ @@ @@ @@@@@ @@   @@
      36             : //  @@  @@ @@  @@ @@  @@ @@  @@  @@ @@ @@ @@    @@   @@
      37             : //  @@  @@ @@  @@ @@  @@ @@      @@ @@ @@ @@    @@ @ @@
      38             : //  @@  @@ @@@@@  @@@@@@ @@ @@@  @@@@@ @@ @@@@  @@@@@@@
      39             : //  @@  @@ @@  @@ @@  @@ @@  @@   @@@  @@ @@    @@@@@@@
      40             : //  @@  @@ @@  @@ @@  @@ @@  @@   @@@  @@ @@    @@@ @@@
      41             : //  @@@@@  @@  @@ @@  @@  @@@@@    @   @@ @@@@@ @@   @@
      42             : //
      43             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      44             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      45             : 
      46             : class SVX_DLLPUBLIC SdrDragView: public SdrExchangeView
      47             : {
      48             :     friend class                SdrPageView;
      49             :     friend class                SdrDragMethod;
      50             : 
      51             : protected:
      52             :     SdrHdl*                     pDragHdl;
      53             :     SdrDragMethod*              mpCurrentSdrDragMethod;
      54             :     SdrUndoGeoObj*              pInsPointUndo;
      55             :     Rectangle                   aDragLimit;
      56             :     rtl::OUString               aInsPointUndoStr;
      57             :     SdrMarkList                 aFollowingEdges; // If nodes are dragged, all edges should follow as Xor
      58             :     SdrHdlKind                  eDragHdl;
      59             : 
      60             :     sal_uIntPtr                     nDragXorPolyLimit;
      61             :     sal_uIntPtr                     nDragXorPointLimit;
      62             :     sal_uInt16                      nDetailedEdgeDraggingLimit;
      63             : 
      64             :     unsigned                    bFramDrag : 1;        // currently frame dragging
      65             :     unsigned                    bDragSpecial : 1;     // currently Special Obj-dragging
      66             :     unsigned                    bMarkedHitMovesAlways : 1; // Persistent
      67             :     unsigned                    bDragLimit : 1;      // Limit on SnapRect instead of BoundRect
      68             :     unsigned                    bDragHdl : 1;        // TRUE: RefPt is slid
      69             :     unsigned                    bDragStripes : 1;    // Persistent
      70             :     unsigned                    bMirrRefDragObj : 1; // Persistent - During the drag, show the mirror axis of the mirrored objects as Xor
      71             :     unsigned                    mbSolidDragging : 1;  // allow solid create/drag of objects
      72             :     unsigned                    bMouseHideWhileDraggingPoints : 1;
      73             :     unsigned                    bResizeAtCenter : 1;
      74             :     unsigned                    bCrookAtCenter : 1;
      75             :     unsigned                    bDragWithCopy : 1;
      76             :     unsigned                    bInsGluePoint : 1;
      77             :     unsigned                    bInsObjPointMode : 1;
      78             :     unsigned                    bInsGluePointMode : 1;
      79             :     unsigned                    bNoDragXorPolys : 1;
      80             :     unsigned                    bAutoVertexCon : 1;  // Automatische Konnektorgenerierung an den Scheitelpunkten
      81             :     unsigned                    bAutoCornerCon : 1;  // Automatische Konnektorgenerierung an den Eckpunkten
      82             :     unsigned                    bRubberEdgeDragging : 1;
      83             :     unsigned                    bDetailedEdgeDragging : 1;
      84             : 
      85             : private:
      86             :     SVX_DLLPRIVATE void ImpClearVars();
      87             : 
      88             : protected:
      89             :     virtual void SetMarkHandles();
      90             :     void ShowDragObj();
      91             :     void HideDragObj();
      92             :     sal_Bool ImpBegInsObjPoint(sal_Bool bIdxZwang, sal_uInt32 nIdx, const Point& rPnt, sal_Bool bNewObj, OutputDevice* pOut);
      93             : 
      94             : protected:
      95             :     // #i71538# make constructors of SdrView sub-components protected to avoid incomplete incarnations which may get casted to SdrView
      96             :     SdrDragView(SdrModel* pModel1, OutputDevice* pOut = 0L);
      97             :     virtual ~SdrDragView();
      98             : 
      99             : public:
     100             :     virtual sal_Bool IsAction() const;
     101             :     virtual void MovAction(const Point& rPnt);
     102             :     virtual void EndAction();
     103             :     virtual void BckAction();
     104             :     virtual void BrkAction();
     105             :     virtual void TakeActionRect(Rectangle& rRect) const;
     106             : 
     107             :     // Spezialimplementation fuer den Writer:
     108             :     // TakeDragObjAnchorPos() liefert die Position an der ein Objekt
     109             :     // beim Draggen einer Einfachselektion ungefaehr landet wenn es
     110             :     // "losgelassen" wird (EndDrag).
     111             :     // In der Regel ist das die linke obere Ecke des zu erwartenden neuen
     112             :     // SnapRects. Ausnahme: CaptionObj. Dort ist es die Position des
     113             :     // "Schwanzendes".
     114             :     // Bei Returncode sal_False konnte ich die Position nicht bestimmen
     115             :     // (z.B. Punktverschiebung, Mehrfachselektion, Schieben der
     116             :     // Spiegelschse, ...)
     117             :     sal_Bool TakeDragObjAnchorPos(Point& rPos, sal_Bool bTopRight = sal_False ) const;
     118             : 
     119             :     // Wird pForcedMeth uebergeben, so wird pHdl, ... nicht ausgewerten, sondern diese
     120             :     // Drag-Methode verwendet. Die Instanz geht dabei ins Eigentum der View ueber und
     121             :     // wird zum Ende des Draggings destruiert.
     122             :     virtual sal_Bool BegDragObj(const Point& rPnt, OutputDevice* pOut=NULL, SdrHdl* pHdl=NULL, short nMinMov=-3, SdrDragMethod* pForcedMeth=NULL);
     123             :     void MovDragObj(const Point& rPnt);
     124             :     sal_Bool EndDragObj(sal_Bool bCopy=sal_False);
     125             :     void BrkDragObj();
     126         182 :     sal_Bool IsDragObj() const { return mpCurrentSdrDragMethod && !bInsPolyPoint && !bInsGluePoint; }
     127           0 :     SdrHdl* GetDragHdl() const { return pDragHdl; }
     128             :     SdrDragMethod* GetDragMethod() const { return mpCurrentSdrDragMethod; }
     129           0 :     sal_Bool IsDraggingPoints() const { return eDragHdl==HDL_POLY; }
     130           0 :     sal_Bool IsDraggingGluePoints() const { return eDragHdl==HDL_GLUE; }
     131             : 
     132             :     // Wer das beim BegDrag oder mittendrin schon festlegen will.
     133             :     // (Wird bei jedem BegDrag auf sal_False zurueckgesetzt, also nach
     134             :     // BegDrag setzen.)
     135           0 :     void SetDragWithCopy(sal_Bool bOn) { bDragWithCopy = bOn; }
     136           0 :     sal_Bool IsDragWithCopy() const { return bDragWithCopy; }
     137             : 
     138           0 :     void SetInsertGluePoint(sal_Bool bOn) { bInsGluePoint = bOn; }
     139           0 :     sal_Bool IsInsertGluePoint() const { return bInsGluePoint; }
     140             : 
     141             :     // Interaktives einfuegen eines neuen Punktes. nIdx=0 => vor dem ersten Punkt.
     142             :     sal_Bool IsInsObjPointPossible() const;
     143             :     sal_Bool IsInsPointPossible() const { return IsInsObjPointPossible(); }
     144           0 :     sal_Bool BegInsObjPoint(const Point& rPnt, sal_Bool bNewObj) { return ImpBegInsObjPoint(sal_False, 0L, rPnt, bNewObj, 0L); }
     145             :     void MovInsObjPoint(const Point& rPnt) { MovDragObj(rPnt); }
     146             :     sal_Bool EndInsObjPoint(SdrCreateCmd eCmd);
     147             :     void BrkInsObjPoint() { BrkDragObj(); }
     148         182 :     sal_Bool IsInsObjPoint() const { return mpCurrentSdrDragMethod && bInsPolyPoint; }
     149             : 
     150             :     // Fuer die App zum Verwalten des Status. GetPreferedPointer() wird
     151             :     // spaeter vielleicht einen passenden Pointer dafuer liefern
     152             :     void SetInsObjPointMode(sal_Bool bOn) { bInsObjPointMode = bOn; }
     153           0 :     sal_Bool IsInsObjPointMode() const { return bInsObjPointMode; }
     154             : 
     155             :     sal_Bool IsInsGluePointPossible() const;
     156             :     sal_Bool BegInsGluePoint(const Point& rPnt);
     157             :     void MovInsGluePoint(const Point& rPnt) { MovDragObj(rPnt); }
     158             :     sal_Bool EndInsGluePoint() { return EndDragObj(); }
     159             :     void BrkInsGluePoint() { BrkDragObj(); }
     160           0 :     sal_Bool IsInsGluePoint() const { return mpCurrentSdrDragMethod && bInsGluePoint; }
     161             : 
     162             :     // Fuer die App zum Verwalten des Status. GetPreferedPointer() wird
     163             :     // spaeter vielleicht einen passenden Pointer dafuer liefern
     164             :     void SetInsGluePointMode(sal_Bool bOn) { bInsGluePointMode = bOn; }
     165           0 :     sal_Bool IsInsGluePointMode() const { return bInsGluePointMode; }
     166             : 
     167             :     // Begrenzungslinien ueber's gesamte Win waehrend des Draggens
     168             :     // Persistent. Default=FALSE.
     169             :     void SetDragStripes(sal_Bool bOn);
     170           0 :     sal_Bool IsDragStripes() const { return bDragStripes; }
     171             : 
     172             :     // Handles waehrend des Draggens verstecken
     173             :     //HMHvoid SetDragHdlHide(sal_Bool bOn);
     174             :     //HMHBOOL IsDragHdlHide() const { return bNoDragHdl; }
     175             : 
     176             :     // Beim Draggen von Polygonpunkten und Klebepunkten
     177             :     // die Maus verstecken. Default=FALSE
     178             :     void SetMouseHideWhileDraggingPoints(sal_Bool bOn) { bMouseHideWhileDraggingPoints = bOn; }
     179           0 :     sal_Bool IsMouseHideWhileDraggingPoints() const { return bMouseHideWhileDraggingPoints; }
     180             : 
     181             :     // Beim Draggen werden i.d.R. die Konturen der markierten Objekte
     182             :     // als Xor-Polygone dargestellt. Wird dieses Flag hier gesetzt,
     183             :     // wird (z.B. bei Mehrfachselektion) nur ein Xor-Frame gezeichnet.
     184             :     // Bei objektspeziefischem Dragging (Polygonpunkte,Eckenradius,...
     185             :     // hat diese Einstellung keine Auswirkung.
     186             :     // Auch waerend des Draggens umschaltbar.
     187             :     // Default=Off
     188             :     void SetNoDragXorPolys(sal_Bool bOn);
     189           7 :     sal_Bool IsNoDragXorPolys() const { return bNoDragXorPolys; }
     190             : 
     191             :     // Uebersteigt die Anzahl der markierten Objekte den hier eingestellten
     192             :     // Wert, wird implizit (temporaer) auf NoDragPolys geschaltet.
     193             :     // PolyPolygone etc werden entsprechend als mehrere Objekte gewertet.
     194             :     // Default=100
     195             :     void  SetDragXorPolyLimit(sal_uIntPtr nObjAnz) { nDragXorPolyLimit=nObjAnz; }
     196           0 :     sal_uIntPtr GetDragXorPolyLimit() const { return nDragXorPolyLimit; }
     197             : 
     198             :     // Wie DragXorPolyLimit, jedoch bezogen auf die Gesamtpunktanzahl
     199             :     // aller Polygone. Default=500.
     200             :     // Auf NoDragPolys wird (temporaer) geschaltet, wenn eins der Limits
     201             :     // ueberstiegen wird.
     202             :     void  SetDragXorPointLimit(sal_uIntPtr nPntAnz) { nDragXorPointLimit=nPntAnz; }
     203           0 :     sal_uIntPtr GetDragXorPointLimit() const { return nDragXorPointLimit; }
     204             : 
     205             :     void SetSolidDragging(bool bOn);
     206             :     bool IsSolidDragging() const;
     207             : 
     208             :     // Dragging/Creating von Verbindern:
     209             :     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     210             :     // Verbinder an Objektscheitelpunkte ankleben
     211             :     // Default=sal_True=Ja
     212             :     void SetAutoVertexConnectors(sal_Bool bOn) { bAutoVertexCon = bOn; }
     213           0 :     sal_Bool IsAutoVertexConnectors() const { return bAutoVertexCon; }
     214             : 
     215             :     // Verbinder an Objektecken ankleben
     216             :     // Default=sal_False=Nein
     217             :     void SetAutoCornerConnectors(sal_Bool bOn) { bAutoCornerCon = bOn; }
     218           0 :     sal_Bool IsAutoCornerConnectors() const { return bAutoCornerCon; }
     219             : 
     220             :     // Dragging von verbundenen Objekten (Nodes):
     221             :     // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     222             :     // DetailedEdgeDraggingLimit: Wie RubberEdgeDraggingLimit, jedoch bezieht
     223             :     // sich dieses Limit auf die detalierte Darstellung, d.h. nicht nur
     224             :     // Gummibaender sondern komplette Neuberechnunen sind beim Draggen sichtbar.
     225             :     // Diese detalierte Darstellung ist eh nur beim MoveDrag moeglich.
     226             :     // Defaultwert ist 10
     227           0 :     sal_Bool IsDetailedEdgeDragging() const { return bDetailedEdgeDragging; }
     228             : 
     229             :     sal_uInt16 GetDetailedEdgeDraggingLimit() const { return nDetailedEdgeDraggingLimit; }
     230             : 
     231             :     // EdgeDraggingLimit: Sind mehr als nEdgeObjAnz Kanten betroffen, werden
     232             :     // diese beim interaktiven Draggen nicht mit angezeigt.
     233             :     // Gemeint sind hier die "Gummibaender", die weniger Rechenzeit benoetigen
     234             :     // als die kompletten Neuberechnungen beim DetailedEdgeDragging.
     235             :     // Defaultwert ist 100
     236           0 :     sal_Bool IsRubberEdgeDragging() const { return bRubberEdgeDragging; }
     237             : 
     238             :     // Verbinderhandling also zu deutsch wie folgt (bei Defaulteinstellungen):
     239             :     // - Sind bis max 10 Verbinder betroffen werden diese bei jedem
     240             :     //   MouseMove neu berechnet
     241             :     // - Sind zwischen 11 und 100 Verbinder betroffen werden die
     242             :     //   Verbindungen beim Draggen als gerade Linien dargestellt.
     243             :     // - Bei mehr als 100 betroffenen Verbindern wird beim Draggen nichts
     244             :     //   mehr gezeichnet was auf Verbinder hinweist.
     245             : 
     246             :     // Ist ein spezieller Dragmode eingeschaltet, wie Rotate, Mirror oder Crook,
     247             :     // dann leitet ein Hit auf das markierte Objekt genau dieses Dragging ein.
     248             :     // Setzt man MarkedHitMovesAlways auf sal_True, so leitet ein Hit auf das
     249             :     // markierte Objekt immer ein Moven ein, unabhaengig vom gesetzten DragMode.
     250             :     // Dieses Flag ist persistent und sollte von der App fuer den Anwender
     251             :     // konfigurierbar sein!
     252             :     void SetMarkedHitMovesAlways(sal_Bool bOn) { bMarkedHitMovesAlways = bOn; }
     253           0 :     sal_Bool IsMarkedHitMovesAlways() const { return bMarkedHitMovesAlways; }
     254             : 
     255             :     // Beim Draggen der Spiegelachse das Spiegelbild der markierten Objekte
     256             :     // als Xor darstellen? Persistent. Noch nicht implementiert. Default TRUE.
     257             :     void SetMirrRefDragObj(sal_Bool bOn) { bMirrRefDragObj = bOn; }
     258             :     sal_Bool IsMirrRefDragObj() const { return bMirrRefDragObj; }
     259             : 
     260             :     sal_Bool IsOrthoDesired() const;
     261             : 
     262             :     // Beim Resize die Mitte als Referenz
     263             :     // Default=FALSE.
     264           0 :     sal_Bool IsResizeAtCenter() const { return bResizeAtCenter; }
     265           0 :     void SetResizeAtCenter(sal_Bool bOn) { bResizeAtCenter = bOn; }
     266             : 
     267             :     // Symmetrisches Crook
     268             :     // Default=FALSE.
     269           0 :     sal_Bool IsCrookAtCenter() const { return bCrookAtCenter; }
     270           0 :     void SetCrookAtCenter(sal_Bool bOn) { bCrookAtCenter = bOn; }
     271             : 
     272             :     // Begrenzung des Arbeitsbereichs. Die Begrenzung bezieht sich auf die
     273             :     // View, nicht auf die einzelnen PageViews. Von der View wird diese
     274             :     // Begrenzung nur bei Interaktionen wie Dragging und Create ausgewertet.
     275             :     // Bei von der App algorithmisch oder UI-gesteuerte Aktionen (SetGeoAttr,
     276             :     // MoveMarkedObj, ...) muss die App dieses Limit selbst beruecksichtigen.
     277             :     // Ferner ist dieses Limit als Grob-Limit zu sehen. U.U. koennen Objekte
     278             :     // (z.B. beim Drehen) nicht exakt bis an dieses Limit herangedraggt werden,
     279             :     // koennen Objekte durch Rundungsfehler doch etwas ueberstehen, ... .
     280             :     // Default=EmptyRect=keine Begrenzung.
     281             :     // erst z.T. impl.
     282             :     // (besser in die DragView?)
     283           0 :     void SetWorkArea(const Rectangle& rRect) { aMaxWorkArea=rRect; }
     284           0 :     const Rectangle& GetWorkArea() const { return aMaxWorkArea; }
     285             : 
     286             : 
     287             :     // Das DragLimit ist bezogen auf die Page des Objekts.
     288             :     // (Oder auf die View??? Muss ich mal^^^^recherchieren. Joe.)
     289             :     // sal_False=Kein Limit.
     290             :     // Das Rueckgabe-Rect muss absolute Koordinaten enthalten. Der Maximale
     291             :     // Dragbereich wird von der View dann so gewaehlt, dass das SnapRect des
     292             :     // Objekts bis Maximal auf die Kante des LimitRects gemoved bzw. gesized
     293             :     // wird. Bei Objekten wie Bezierkurven, gedrehten Rechtecken ist zu beachten
     294             :     // das durch anschliessende Neuberechnung des SnapRects (bei Resize)
     295             :     // Rundungsfehler auftreten koennen, wodurch das LimitRect minnimal
     296             :     // ueberschritten werden koennte...
     297             :     // Implementiert fuer Move und Resize.
     298             :     virtual sal_Bool TakeDragLimit(SdrDragMode eMode, Rectangle& rRect) const;
     299             : };
     300             : 
     301             : #endif //_SVDDRGV_HXX
     302             : 
     303             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10