LCOV - code coverage report
Current view: top level - svx/inc/svx - svddrgv.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 3 29 10.3 %
Date: 2012-08-25 Functions: 3 29 10.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 2 14 14.3 %

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

Generated by: LCOV version 1.10