LCOV - code coverage report
Current view: top level - libreoffice/svx/inc/svx - svddrgmt.hxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 34 0.0 %
Date: 2012-12-17 Functions: 0 33 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 _SVDDRGMT_HXX
      21             : #define _SVDDRGMT_HXX
      22             : 
      23             : #include <svx/svddrgv.hxx>
      24             : #include "svx/svxdllapi.h"
      25             : #include <svx/sdr/contact/objectcontact.hxx>
      26             : 
      27             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      28             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      29             : //
      30             : //  @@@@@  @@@@@   @@@@   @@@@   @@   @@ @@@@@ @@@@@@ @@  @@  @@@@  @@@@@   @@@@
      31             : //  @@  @@ @@  @@ @@  @@ @@  @@  @@@ @@@ @@      @@   @@  @@ @@  @@ @@  @@ @@  @@
      32             : //  @@  @@ @@  @@ @@  @@ @@      @@@@@@@ @@      @@   @@  @@ @@  @@ @@  @@ @@
      33             : //  @@  @@ @@@@@  @@@@@@ @@ @@@  @@@@@@@ @@@@    @@   @@@@@@ @@  @@ @@  @@  @@@@
      34             : //  @@  @@ @@  @@ @@  @@ @@  @@  @@ @ @@ @@      @@   @@  @@ @@  @@ @@  @@     @@
      35             : //  @@  @@ @@  @@ @@  @@ @@  @@  @@   @@ @@      @@   @@  @@ @@  @@ @@  @@ @@  @@
      36             : //  @@@@@  @@  @@ @@  @@  @@@@@  @@   @@ @@@@@   @@   @@  @@  @@@@  @@@@@   @@@@
      37             : //
      38             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      39             : ////////////////////////////////////////////////////////////////////////////////////////////////////
      40             : 
      41             : class SdrDragView;
      42             : class SdrDragStat;
      43             : 
      44             : //////////////////////////////////////////////////////////////////////////////
      45             : 
      46             : class SVX_DLLPUBLIC SdrDragEntry
      47             : {
      48             : private:
      49             :     // bitfield
      50             :     unsigned                    mbAddToTransparent : 1;
      51             : 
      52             : protected:
      53             :     // access for derived classes
      54           0 :     void setAddToTransparent(bool bNew) { mbAddToTransparent = bNew; }
      55             : 
      56             : public:
      57             :     SdrDragEntry();
      58             :     virtual ~SdrDragEntry();
      59             : 
      60             :     virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod) = 0;
      61             : 
      62             :     // data read access
      63           0 :     bool getAddToTransparent() const { return mbAddToTransparent; }
      64             : };
      65             : 
      66             : //////////////////////////////////////////////////////////////////////////////
      67             : 
      68             : class SVX_DLLPUBLIC SdrDragEntryPolyPolygon : public SdrDragEntry
      69             : {
      70             : private:
      71             :     basegfx::B2DPolyPolygon             maOriginalPolyPolygon;
      72             : 
      73             : public:
      74             :     SdrDragEntryPolyPolygon(const basegfx::B2DPolyPolygon& rOriginalPolyPolygon);
      75             :     virtual ~SdrDragEntryPolyPolygon();
      76             : 
      77             :     virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
      78             : };
      79             : 
      80             : //////////////////////////////////////////////////////////////////////////////
      81             : 
      82             : class SdrDragEntrySdrObject : public SdrDragEntry
      83             : {
      84             : private:
      85             :     const SdrObject&                                maOriginal;
      86             :     SdrObject*                                      mpClone;
      87             :     sdr::contact::ObjectContact&                    mrObjectContact;
      88             :     bool                                            mbModify;
      89             : 
      90             : public:
      91             :     SdrDragEntrySdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
      92             :     virtual ~SdrDragEntrySdrObject();
      93             : 
      94             :     virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
      95             : };
      96             : 
      97             : //////////////////////////////////////////////////////////////////////////////
      98             : 
      99             : class SdrDragEntryPrimitive2DSequence : public SdrDragEntry
     100             : {
     101             : private:
     102             :     drawinglayer::primitive2d::Primitive2DSequence  maPrimitive2DSequence;
     103             : 
     104             : public:
     105             :     SdrDragEntryPrimitive2DSequence(
     106             :         const drawinglayer::primitive2d::Primitive2DSequence& rSequence,
     107             :         bool bAddToTransparent);
     108             :     virtual ~SdrDragEntryPrimitive2DSequence();
     109             : 
     110             :     virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
     111             : };
     112             : 
     113             : //////////////////////////////////////////////////////////////////////////////
     114             : 
     115             : class SdrDragEntryPointGlueDrag : public SdrDragEntry
     116             : {
     117             : private:
     118             :     std::vector< basegfx::B2DPoint >                maPositions;
     119             :     bool                                            mbIsPointDrag;
     120             : 
     121             : public:
     122             :     SdrDragEntryPointGlueDrag(const std::vector< basegfx::B2DPoint >& rPositions, bool bIsPointDrag);
     123             :     virtual ~SdrDragEntryPointGlueDrag();
     124             : 
     125             :     virtual drawinglayer::primitive2d::Primitive2DSequence createPrimitive2DSequenceInCurrentState(SdrDragMethod& rDragMethod);
     126             : };
     127             : 
     128             : //////////////////////////////////////////////////////////////////////////////
     129             : 
     130             : class SVX_DLLPUBLIC SdrDragMethod
     131             : {
     132             : private:
     133             :     std::vector< SdrDragEntry* >            maSdrDragEntries;
     134             :     sdr::overlay::OverlayObjectList         maOverlayObjectList;
     135             :     SdrDragView&                            mrSdrDragView;
     136             : 
     137             :     // bitfield
     138             :     unsigned                                mbMoveOnly : 1;
     139             :     unsigned                                mbSolidDraggingActive : 1;
     140             : 
     141             : protected:
     142             :     // access for derivated classes to maSdrDragEntries
     143           0 :     void clearSdrDragEntries() { for(sal_uInt32 a(0); a < maSdrDragEntries.size(); a++) { delete maSdrDragEntries[a]; } maSdrDragEntries.clear(); }
     144           0 :     void addSdrDragEntry(SdrDragEntry* pNew) { if(pNew) { maSdrDragEntries.push_back(pNew); }}
     145             :     virtual void createSdrDragEntries();
     146             :     virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
     147             : 
     148             :     // access for derivated classes to maOverlayObjectList
     149           0 :     void clearOverlayObjectList() { maOverlayObjectList.clear(); }
     150           0 :     void addToOverlayObjectList(sdr::overlay::OverlayObject& rNew) { maOverlayObjectList.append(rNew); }
     151           0 :     basegfx::B2DRange getB2DRangeFromOverlayObjectList() const { return maOverlayObjectList.getBaseRange(); }
     152             : 
     153             :     // access for derivated classes to mrSdrDragView
     154           0 :     SdrDragView& getSdrDragView() { return mrSdrDragView; }
     155           0 :     const SdrDragView& getSdrDragView() const { return mrSdrDragView; }
     156             : 
     157             :     // access for derivated classes for bools
     158           0 :     void setMoveOnly(bool bNew) { mbMoveOnly = bNew; }
     159           0 :     void setSolidDraggingActive(bool bNew) { mbSolidDraggingActive = bNew; }
     160             : 
     161             :     // internal helpers for creation of standard drag entries
     162             :     void createSdrDragEntries_SolidDrag();
     163             :     void createSdrDragEntries_PolygonDrag();
     164             :     void createSdrDragEntries_PointDrag();
     165             :     void createSdrDragEntries_GlueDrag();
     166             : 
     167             :     // old call forwarders to the SdrDragView
     168             :     void               ImpTakeDescriptionStr(sal_uInt16 nStrCacheID, String& rStr, sal_uInt16 nVal=0) const;
     169           0 :     SdrHdl*            GetDragHdl() const              { return getSdrDragView().pDragHdl; }
     170           0 :     SdrHdlKind         GetDragHdlKind() const          { return getSdrDragView().eDragHdl; }
     171           0 :     SdrDragStat&       DragStat()                      { return getSdrDragView().aDragStat; }
     172           0 :     const SdrDragStat& DragStat() const                { return getSdrDragView().aDragStat; }
     173           0 :     Point&             Ref1() const                    { return mrSdrDragView.aRef1; }
     174           0 :     Point&             Ref2() const                    { return mrSdrDragView.aRef2; }
     175           0 :     const SdrHdlList&  GetHdlList() const              { return getSdrDragView().aHdl; }
     176           0 :     void               AddUndo(SdrUndoAction* pUndo)   { getSdrDragView().AddUndo(pUndo); }
     177           0 :     bool               IsDragLimit()                   { return getSdrDragView().bDragLimit; }
     178           0 :     const Rectangle&   GetDragLimitRect()              { return getSdrDragView().aDragLimit; }
     179           0 :     const SdrMarkList& GetMarkedObjectList()                   { return getSdrDragView().GetMarkedObjectList(); }
     180           0 :     Point              GetSnapPos(const Point& rPt) const { return getSdrDragView().GetSnapPos(rPt,getSdrDragView().pMarkedPV); }
     181           0 :     sal_uInt16         SnapPos(Point& rPt) const       { return getSdrDragView().SnapPos(rPt,getSdrDragView().pMarkedPV); }
     182             :     inline const Rectangle& GetMarkedRect() const;
     183             :     SdrPageView*       GetDragPV() const;
     184             :     SdrObject*         GetDragObj() const;
     185             :     OutputDevice*      GetDragWin() const              { return getSdrDragView().pDragWin; }
     186           0 :     bool               IsDraggingPoints() const        { return getSdrDragView().IsDraggingPoints(); }
     187           0 :     bool               IsDraggingGluePoints() const    { return getSdrDragView().IsDraggingGluePoints(); }
     188             : 
     189             :     bool DoAddConnectorOverlays();
     190             :     drawinglayer::primitive2d::Primitive2DSequence AddConnectorOverlays();
     191             : 
     192             : public:
     193             :     TYPEINFO();
     194             : 
     195             :     void resetSdrDragEntries();
     196             :     basegfx::B2DRange getCurrentRange() const;
     197             : 
     198             :     // #i58950# also moved constructor implementation to cxx
     199             :     SdrDragMethod(SdrDragView& rNewView);
     200             : 
     201             :     // #i58950# virtual destructor was missing
     202             :     virtual ~SdrDragMethod();
     203             : 
     204             :     void Show();
     205             :     void Hide();
     206             :     virtual void TakeSdrDragComment(String& rStr) const=0;
     207             :     virtual bool BeginSdrDrag()=0;
     208             :     virtual void MoveSdrDrag(const Point& rPnt)=0;
     209             :     virtual bool EndSdrDrag(bool bCopy)=0;
     210             :     virtual void CancelSdrDrag();
     211             :     virtual Pointer GetSdrDragPointer() const=0;
     212             : 
     213             :     virtual void CreateOverlayGeometry(sdr::overlay::OverlayManager& rOverlayManager);
     214             :     void destroyOverlayGeometry();
     215             : 
     216             :     virtual basegfx::B2DHomMatrix getCurrentTransformation();
     217             :     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
     218             :     virtual void applyCurrentTransformationToPolyPolygon(basegfx::B2DPolyPolygon& rTarget);
     219             : 
     220             :     // data read access
     221           0 :     bool getMoveOnly() const { return mbMoveOnly; }
     222           0 :     bool getSolidDraggingActive() const { return mbSolidDraggingActive; }
     223             : };
     224             : 
     225           0 : inline const Rectangle& SdrDragMethod::GetMarkedRect() const
     226             : {
     227           0 :     return getSdrDragView().eDragHdl==HDL_POLY ? getSdrDragView().GetMarkedPointsRect() :
     228           0 :            getSdrDragView().eDragHdl==HDL_GLUE ? getSdrDragView().GetMarkedGluePointsRect() :
     229           0 :            getSdrDragView().GetMarkedObjRect();
     230             : }
     231             : 
     232             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     233             : //   SdrDragMove
     234             : 
     235           0 : class SVX_DLLPUBLIC SdrDragMove : public SdrDragMethod
     236             : {
     237             : private:
     238             :     long                        nBestXSnap;
     239             :     long                        nBestYSnap;
     240             :     bool                        bXSnapped;
     241             :     bool                        bYSnapped;
     242             : 
     243             :     void ImpCheckSnap(const Point& rPt);
     244             : 
     245             : protected:
     246             :     virtual void createSdrDragEntryForSdrObject(const SdrObject& rOriginal, sdr::contact::ObjectContact& rObjectContact, bool bModify);
     247             : 
     248             : public:
     249             :     TYPEINFO();
     250             :     SdrDragMove(SdrDragView& rNewView);
     251             : 
     252             :     virtual void TakeSdrDragComment(String& rStr) const;
     253             :     virtual bool BeginSdrDrag();
     254             :     virtual void MoveSdrDrag(const Point& rPnt);
     255             :     virtual bool EndSdrDrag(bool bCopy);
     256             :     virtual Pointer GetSdrDragPointer() const;
     257             : 
     258             :     virtual basegfx::B2DHomMatrix getCurrentTransformation();
     259             :     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
     260             : };
     261             : 
     262             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     263             : //   SdrDragResize
     264             : 
     265           0 : class SVX_DLLPUBLIC SdrDragResize : public SdrDragMethod
     266             : {
     267             : protected:
     268             :     Fraction                    aXFact;
     269             :     Fraction                    aYFact;
     270             : 
     271             : public:
     272             :     TYPEINFO();
     273             :     SdrDragResize(SdrDragView& rNewView);
     274             : 
     275             :     virtual void TakeSdrDragComment(String& rStr) const;
     276             :     virtual bool BeginSdrDrag();
     277             :     virtual void MoveSdrDrag(const Point& rPnt);
     278             :     virtual bool EndSdrDrag(bool bCopy);
     279             :     virtual Pointer GetSdrDragPointer() const;
     280             : 
     281             :     virtual basegfx::B2DHomMatrix getCurrentTransformation();
     282             :     virtual void applyCurrentTransformationToSdrObject(SdrObject& rTarget);
     283             : };
     284             : 
     285             : ////////////////////////////////////////////////////////////////////////////////////////////////////
     286             : //   SdrDragObjOwn
     287             : 
     288             : class SVX_DLLPUBLIC SdrDragObjOwn : public SdrDragMethod
     289             : {
     290             : private:
     291             :     // SdrDragObjOwn always works on a clone since it has no transformation
     292             :     // mechanism to modify wireframe visualisations, but uses the
     293             :     // SdrObject::applySpecialDrag() method to change a clone of the
     294             :     // SdrObject
     295             :     SdrObject*                  mpClone;
     296             : 
     297             : protected:
     298             :     virtual void createSdrDragEntries();
     299             : 
     300             : public:
     301             :     TYPEINFO();
     302             :     SdrDragObjOwn(SdrDragView& rNewView);
     303             :     virtual ~SdrDragObjOwn();
     304             : 
     305             :     virtual void TakeSdrDragComment(String& rStr) const;
     306             :     virtual bool BeginSdrDrag();
     307             :     virtual void MoveSdrDrag(const Point& rPnt);
     308             :     virtual bool EndSdrDrag(bool bCopy);
     309             :     virtual Pointer GetSdrDragPointer() const;
     310             : };
     311             : 
     312             : #endif //_SVDDRGMT_HXX
     313             : 
     314             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10