LCOV - code coverage report
Current view: top level - svx/source/svdraw - svdovirt.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 30 306 9.8 %
Date: 2012-08-25 Functions: 11 86 12.8 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 7 258 2.7 %

           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                 :            : 
      30                 :            : #include <svx/svdovirt.hxx>
      31                 :            : #include <svx/xpool.hxx>
      32                 :            : #include <svx/svdtrans.hxx>
      33                 :            : #include <svx/svdetc.hxx>
      34                 :            : #include <svx/svdhdl.hxx>
      35                 :            : #include <svx/sdr/contact/viewcontactofvirtobj.hxx>
      36                 :            : #include <basegfx/matrix/b2dhommatrix.hxx>
      37                 :            : #include <svx/svdograf.hxx>
      38                 :            : #include <svx/svddrgv.hxx>
      39                 :            : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      40                 :            : 
      41                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      42                 :            : 
      43                 :          0 : sdr::properties::BaseProperties& SdrVirtObj::GetProperties() const
      44                 :            : {
      45                 :          0 :     return rRefObj.GetProperties();
      46                 :            : }
      47                 :            : 
      48                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      49                 :            : // #i27224#
      50                 :          0 : sdr::contact::ViewContact* SdrVirtObj::CreateObjectSpecificViewContact()
      51                 :            : {
      52         [ #  # ]:          0 :     return new sdr::contact::ViewContactOfVirtObj(*this);
      53                 :            : }
      54                 :            : 
      55                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      56                 :            : 
      57 [ -  + ][ -  + ]:      21751 : TYPEINIT1(SdrVirtObj,SdrObject);
      58                 :            : 
      59                 :        611 : SdrVirtObj::SdrVirtObj(SdrObject& rNewObj):
      60         [ +  - ]:        611 :     rRefObj(rNewObj)
      61                 :            : {
      62                 :        611 :     bVirtObj=sal_True; // this is only a virtual object
      63         [ +  - ]:        611 :     rRefObj.AddReference(*this);
      64         [ +  - ]:        611 :     bClosedObj=rRefObj.IsClosedObj();
      65                 :        611 : }
      66                 :            : 
      67                 :        521 : SdrVirtObj::~SdrVirtObj()
      68                 :            : {
      69         [ +  - ]:        521 :     rRefObj.DelReference(*this);
      70         [ -  + ]:        521 : }
      71                 :            : 
      72                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      73                 :            : 
      74                 :       1892 : const SdrObject& SdrVirtObj::GetReferencedObj() const
      75                 :            : {
      76                 :       1892 :     return rRefObj;
      77                 :            : }
      78                 :            : 
      79                 :         32 : SdrObject& SdrVirtObj::ReferencedObj()
      80                 :            : {
      81                 :         32 :     return rRefObj;
      82                 :            : }
      83                 :            : 
      84                 :         59 : void SdrVirtObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& /*rHint*/)
      85                 :            : {
      86                 :         59 :     bClosedObj=rRefObj.IsClosedObj();
      87                 :         59 :     SetRectsDirty(); // TODO: Optimize this.
      88                 :            : 
      89                 :            :     // Only a repaint here, rRefObj may have changed and broadcasts
      90                 :         59 :     ActionChanged();
      91                 :         59 : }
      92                 :            : 
      93                 :          0 : void SdrVirtObj::NbcSetAnchorPos(const Point& rAnchorPos)
      94                 :            : {
      95                 :          0 :     aAnchor=rAnchorPos;
      96                 :          0 : }
      97                 :            : 
      98                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      99                 :            : 
     100                 :       1151 : void SdrVirtObj::SetModel(SdrModel* pNewModel)
     101                 :            : {
     102                 :       1151 :     SdrObject::SetModel(pNewModel);
     103                 :       1151 :     rRefObj.SetModel(pNewModel);
     104                 :       1151 : }
     105                 :            : 
     106                 :          0 : void SdrVirtObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const
     107                 :            : {
     108                 :          0 :     rRefObj.TakeObjInfo(rInfo);
     109                 :          0 : }
     110                 :            : 
     111                 :       1163 : sal_uInt32 SdrVirtObj::GetObjInventor() const
     112                 :            : {
     113                 :       1163 :     return rRefObj.GetObjInventor();
     114                 :            : }
     115                 :            : 
     116                 :          0 : sal_uInt16 SdrVirtObj::GetObjIdentifier() const
     117                 :            : {
     118                 :          0 :     return rRefObj.GetObjIdentifier();
     119                 :            : }
     120                 :            : 
     121                 :       1583 : SdrObjList* SdrVirtObj::GetSubList() const
     122                 :            : {
     123                 :       1583 :     return rRefObj.GetSubList();
     124                 :            : }
     125                 :            : 
     126                 :          0 : const Rectangle& SdrVirtObj::GetCurrentBoundRect() const
     127                 :            : {
     128                 :          0 :     ((SdrVirtObj*)this)->aOutRect=rRefObj.GetCurrentBoundRect(); // TODO: Optimize this.
     129                 :          0 :     ((SdrVirtObj*)this)->aOutRect+=aAnchor;
     130                 :          0 :     return aOutRect;
     131                 :            : }
     132                 :            : 
     133                 :          0 : const Rectangle& SdrVirtObj::GetLastBoundRect() const
     134                 :            : {
     135                 :          0 :     ((SdrVirtObj*)this)->aOutRect=rRefObj.GetLastBoundRect(); // TODO: Optimize this.
     136                 :          0 :     ((SdrVirtObj*)this)->aOutRect+=aAnchor;
     137                 :          0 :     return aOutRect;
     138                 :            : }
     139                 :            : 
     140                 :          0 : void SdrVirtObj::RecalcBoundRect()
     141                 :            : {
     142                 :          0 :     aOutRect=rRefObj.GetCurrentBoundRect();
     143                 :          0 :     aOutRect+=aAnchor;
     144                 :          0 : }
     145                 :            : 
     146                 :       2239 : void SdrVirtObj::SetChanged()
     147                 :            : {
     148                 :       2239 :     SdrObject::SetChanged();
     149                 :       2239 : }
     150                 :            : 
     151                 :          0 : SdrVirtObj* SdrVirtObj::Clone() const
     152                 :            : {
     153         [ #  # ]:          0 :     return new SdrVirtObj(this->rRefObj); // only a further reference
     154                 :            : }
     155                 :            : 
     156                 :          0 : SdrVirtObj& SdrVirtObj::operator=(const SdrVirtObj& rObj)
     157                 :            : {   // reference different object??
     158                 :          0 :     SdrObject::operator=(rObj);
     159                 :          0 :     aAnchor=rObj.aAnchor;
     160                 :          0 :     return *this;
     161                 :            : }
     162                 :            : 
     163                 :          0 : void SdrVirtObj::TakeObjNameSingul(XubString& rName) const
     164                 :            : {
     165         [ #  # ]:          0 :     rRefObj.TakeObjNameSingul(rName);
     166         [ #  # ]:          0 :     rName.Insert(sal_Unicode('['), 0);
     167         [ #  # ]:          0 :     rName += sal_Unicode(']');
     168                 :            : 
     169 [ #  # ][ #  # ]:          0 :     String aName( GetName() );
     170         [ #  # ]:          0 :     if(aName.Len())
     171                 :            :     {
     172         [ #  # ]:          0 :         rName += sal_Unicode(' ');
     173         [ #  # ]:          0 :         rName += sal_Unicode('\'');
     174         [ #  # ]:          0 :         rName += aName;
     175         [ #  # ]:          0 :         rName += sal_Unicode('\'');
     176         [ #  # ]:          0 :     }
     177                 :          0 : }
     178                 :            : 
     179                 :          0 : void SdrVirtObj::TakeObjNamePlural(XubString& rName) const
     180                 :            : {
     181                 :          0 :     rRefObj.TakeObjNamePlural(rName);
     182                 :          0 :     rName.Insert(sal_Unicode('['), 0);
     183                 :          0 :     rName += sal_Unicode(']');
     184                 :          0 : }
     185                 :            : 
     186                 :          0 : void operator +=(PolyPolygon& rPoly, const Point& rOfs)
     187                 :            : {
     188 [ #  # ][ #  # ]:          0 :     if (rOfs.X()!=0 || rOfs.Y()!=0) {
                 [ #  # ]
     189                 :            :         sal_uInt16 i,j;
     190         [ #  # ]:          0 :         for (j=0; j<rPoly.Count(); j++) {
     191 [ #  # ][ #  # ]:          0 :             Polygon aP1(rPoly.GetObject(j));
     192 [ #  # ][ #  # ]:          0 :             for (i=0; i<aP1.GetSize(); i++) {
     193         [ #  # ]:          0 :                  aP1[i]+=rOfs;
     194                 :            :             }
     195         [ #  # ]:          0 :             rPoly.Replace(aP1,j);
     196         [ #  # ]:          0 :         }
     197                 :            :     }
     198                 :          0 : }
     199                 :            : 
     200                 :          0 : basegfx::B2DPolyPolygon SdrVirtObj::TakeXorPoly() const
     201                 :            : {
     202                 :          0 :     basegfx::B2DPolyPolygon aPolyPolygon(rRefObj.TakeXorPoly());
     203                 :            : 
     204 [ #  # ][ #  # ]:          0 :     if(aAnchor.X() || aAnchor.Y())
                 [ #  # ]
     205                 :            :     {
     206 [ #  # ][ #  # ]:          0 :         aPolyPolygon.transform(basegfx::tools::createTranslateB2DHomMatrix(aAnchor.X(), aAnchor.Y()));
                 [ #  # ]
     207                 :            :     }
     208                 :            : 
     209                 :          0 :     return aPolyPolygon;
     210                 :            : }
     211                 :            : 
     212                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     213                 :            : 
     214                 :          0 : sal_uInt32 SdrVirtObj::GetHdlCount() const
     215                 :            : {
     216                 :          0 :     return rRefObj.GetHdlCount();
     217                 :            : }
     218                 :            : 
     219                 :          0 : SdrHdl* SdrVirtObj::GetHdl(sal_uInt32 nHdlNum) const
     220                 :            : {
     221                 :          0 :     SdrHdl* pHdl=rRefObj.GetHdl(nHdlNum);
     222                 :            : 
     223                 :            :     // #i73248#
     224                 :            :     // GetHdl() at SdrObject is not guaranteed to return an object
     225         [ #  # ]:          0 :     if(pHdl)
     226                 :            :     {
     227                 :          0 :         Point aP(pHdl->GetPos()+aAnchor);
     228         [ #  # ]:          0 :         pHdl->SetPos(aP);
     229                 :            :     }
     230                 :            : 
     231                 :          0 :     return pHdl;
     232                 :            : }
     233                 :            : 
     234                 :          0 : sal_uInt32 SdrVirtObj::GetPlusHdlCount(const SdrHdl& rHdl) const
     235                 :            : {
     236                 :          0 :     return rRefObj.GetPlusHdlCount(rHdl);
     237                 :            : }
     238                 :            : 
     239                 :          0 : SdrHdl* SdrVirtObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlNum) const
     240                 :            : {
     241                 :          0 :     SdrHdl* pHdl=rRefObj.GetPlusHdl(rHdl,nPlNum);
     242         [ #  # ]:          0 :     pHdl->SetPos(pHdl->GetPos() + aAnchor);
     243                 :          0 :     return pHdl;
     244                 :            : }
     245                 :            : 
     246                 :          0 : void SdrVirtObj::AddToHdlList(SdrHdlList& rHdlList) const
     247                 :            : {
     248                 :            :     // #i73248#
     249                 :            :     // SdrObject::AddToHdlList(rHdlList) is not a good thing to call
     250                 :            :     // since at SdrPathObj, only AddToHdlList may be used and the call
     251                 :            :     // will instead use the standard implementation which uses GetHdlCount()
     252                 :            :     // and GetHdl instead. This is not wrong, but may be much less effective
     253                 :            :     // and may not be prepared to GetHdl returning NULL
     254                 :            : 
     255                 :            :     // get handles using AddToHdlList from ref object
     256         [ #  # ]:          0 :     SdrHdlList aLocalList(0);
     257         [ #  # ]:          0 :     rRefObj.AddToHdlList(aLocalList);
     258                 :          0 :     const sal_uInt32 nHdlCount(aLocalList.GetHdlCount());
     259                 :            : 
     260         [ #  # ]:          0 :     if(nHdlCount)
     261                 :            :     {
     262                 :            :         // translate handles and add them to dest list. They are temporarily part of
     263                 :            :         // two lists then
     264         [ #  # ]:          0 :         const Point aOffset(GetOffset());
     265                 :            : 
     266         [ #  # ]:          0 :         for(sal_uInt32 a(0L); a < nHdlCount; a++)
     267                 :            :         {
     268         [ #  # ]:          0 :             SdrHdl* pCandidate = aLocalList.GetHdl(a);
     269         [ #  # ]:          0 :             pCandidate->SetPos(pCandidate->GetPos() + aOffset);
     270         [ #  # ]:          0 :             rHdlList.AddHdl(pCandidate);
     271                 :            :         }
     272                 :            : 
     273                 :            :         // remove them from source list, else they will be deleted when
     274                 :            :         // source list is deleted
     275         [ #  # ]:          0 :         while(aLocalList.GetHdlCount())
     276                 :            :         {
     277         [ #  # ]:          0 :             aLocalList.RemoveHdl(aLocalList.GetHdlCount() - 1L);
     278                 :            :         }
     279         [ #  # ]:          0 :     }
     280                 :          0 : }
     281                 :            : 
     282                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     283                 :            : 
     284                 :          0 : bool SdrVirtObj::hasSpecialDrag() const
     285                 :            : {
     286                 :          0 :     return rRefObj.hasSpecialDrag();
     287                 :            : }
     288                 :            : 
     289                 :          0 : bool SdrVirtObj::supportsFullDrag() const
     290                 :            : {
     291                 :          0 :     return false;
     292                 :            : }
     293                 :            : 
     294                 :          0 : SdrObject* SdrVirtObj::getFullDragClone() const
     295                 :            : {
     296                 :            :     static bool bSpecialHandling(false);
     297                 :          0 :     SdrObject* pRetval = 0;
     298                 :            : 
     299         [ #  # ]:          0 :     if(bSpecialHandling)
     300                 :            :     {
     301                 :            :         // special handling for VirtObj. Do not create another
     302                 :            :         // reference to rRefObj, this would allow to change that
     303                 :            :         // one on drag. Instead, create a SdrGrafObj for drag containing
     304                 :            :         // the graphical representation
     305 [ #  # ][ #  # ]:          0 :         pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), this), GetLogicRect());
                 [ #  # ]
     306                 :            :     }
     307                 :            :     else
     308                 :            :     {
     309                 :          0 :         SdrObject& rReferencedObject = ((SdrVirtObj*)this)->ReferencedObj();
     310 [ #  # ][ #  # ]:          0 :         pRetval = new SdrGrafObj(SdrDragView::GetObjGraphic(GetModel(), &rReferencedObject), GetLogicRect());
                 [ #  # ]
     311                 :            :     }
     312                 :            : 
     313                 :          0 :     return pRetval;
     314                 :            : }
     315                 :            : 
     316                 :          0 : bool SdrVirtObj::beginSpecialDrag(SdrDragStat& rDrag) const
     317                 :            : {
     318                 :          0 :     return rRefObj.beginSpecialDrag(rDrag);
     319                 :            : }
     320                 :            : 
     321                 :          0 : bool SdrVirtObj::applySpecialDrag(SdrDragStat& rDrag)
     322                 :            : {
     323                 :          0 :     return rRefObj.applySpecialDrag(rDrag);
     324                 :            : }
     325                 :            : 
     326                 :          0 : basegfx::B2DPolyPolygon SdrVirtObj::getSpecialDragPoly(const SdrDragStat& rDrag) const
     327                 :            : {
     328                 :          0 :     return rRefObj.getSpecialDragPoly(rDrag);
     329                 :            :     // TODO: we don't handle offsets yet!
     330                 :            : }
     331                 :            : 
     332                 :          0 : String SdrVirtObj::getSpecialDragComment(const SdrDragStat& rDrag) const
     333                 :            : {
     334                 :          0 :     return rRefObj.getSpecialDragComment(rDrag);
     335                 :            : }
     336                 :            : 
     337                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     338                 :            : 
     339                 :          0 : bool SdrVirtObj::BegCreate(SdrDragStat& rStat)
     340                 :            : {
     341                 :          0 :     return rRefObj.BegCreate(rStat);
     342                 :            : }
     343                 :            : 
     344                 :          0 : bool SdrVirtObj::MovCreate(SdrDragStat& rStat)
     345                 :            : {
     346                 :          0 :     return rRefObj.MovCreate(rStat);
     347                 :            : }
     348                 :            : 
     349                 :          0 : bool SdrVirtObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd)
     350                 :            : {
     351                 :          0 :     return rRefObj.EndCreate(rStat,eCmd);
     352                 :            : }
     353                 :            : 
     354                 :          0 : bool SdrVirtObj::BckCreate(SdrDragStat& rStat)
     355                 :            : {
     356                 :          0 :     return rRefObj.BckCreate(rStat);
     357                 :            : }
     358                 :            : 
     359                 :          0 : void SdrVirtObj::BrkCreate(SdrDragStat& rStat)
     360                 :            : {
     361                 :          0 :     rRefObj.BrkCreate(rStat);
     362                 :          0 : }
     363                 :            : 
     364                 :          0 : basegfx::B2DPolyPolygon SdrVirtObj::TakeCreatePoly(const SdrDragStat& rDrag) const
     365                 :            : {
     366                 :          0 :     return rRefObj.TakeCreatePoly(rDrag);
     367                 :            :     // TODO: we don't handle offsets yet!
     368                 :            : }
     369                 :            : 
     370                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     371                 :            : 
     372                 :          0 : void SdrVirtObj::NbcMove(const Size& rSiz)
     373                 :            : {
     374                 :          0 :     MovePoint(aAnchor,rSiz);
     375                 :          0 :     SetRectsDirty();
     376                 :          0 : }
     377                 :            : 
     378                 :          0 : void SdrVirtObj::NbcResize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
     379                 :            : {
     380         [ #  # ]:          0 :     rRefObj.NbcResize(rRef-aAnchor,xFact,yFact);
     381                 :          0 :     SetRectsDirty();
     382                 :          0 : }
     383                 :            : 
     384                 :          0 : void SdrVirtObj::NbcRotate(const Point& rRef, long nWink, double sn, double cs)
     385                 :            : {
     386         [ #  # ]:          0 :     rRefObj.NbcRotate(rRef-aAnchor,nWink,sn,cs);
     387                 :          0 :     SetRectsDirty();
     388                 :          0 : }
     389                 :            : 
     390                 :          0 : void SdrVirtObj::NbcMirror(const Point& rRef1, const Point& rRef2)
     391                 :            : {
     392         [ #  # ]:          0 :     rRefObj.NbcMirror(rRef1-aAnchor,rRef2-aAnchor);
     393                 :          0 :     SetRectsDirty();
     394                 :          0 : }
     395                 :            : 
     396                 :          0 : void SdrVirtObj::NbcShear(const Point& rRef, long nWink, double tn, bool bVShear)
     397                 :            : {
     398         [ #  # ]:          0 :     rRefObj.NbcShear(rRef-aAnchor,nWink,tn,bVShear);
     399                 :          0 :     SetRectsDirty();
     400                 :          0 : }
     401                 :            : 
     402                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     403                 :            : 
     404                 :          0 : void SdrVirtObj::Move(const Size& rSiz)
     405                 :            : {
     406 [ #  # ][ #  # ]:          0 :     if (rSiz.Width()!=0 || rSiz.Height()!=0) {
                 [ #  # ]
     407 [ #  # ][ #  # ]:          0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     408         [ #  # ]:          0 :         NbcMove(rSiz);
     409         [ #  # ]:          0 :         SetChanged();
     410         [ #  # ]:          0 :         BroadcastObjectChange();
     411         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_MOVEONLY,aBoundRect0);
     412                 :            :     }
     413                 :          0 : }
     414                 :            : 
     415                 :          0 : void SdrVirtObj::Resize(const Point& rRef, const Fraction& xFact, const Fraction& yFact)
     416                 :            : {
     417 [ #  # ][ #  # ]:          0 :     if (xFact.GetNumerator()!=xFact.GetDenominator() || yFact.GetNumerator()!=yFact.GetDenominator()) {
                 [ #  # ]
     418 [ #  # ][ #  # ]:          0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     419         [ #  # ]:          0 :         rRefObj.Resize(rRef-aAnchor,xFact,yFact);
     420         [ #  # ]:          0 :         SetRectsDirty();
     421         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     422                 :            :     }
     423                 :          0 : }
     424                 :            : 
     425                 :          0 : void SdrVirtObj::Rotate(const Point& rRef, long nWink, double sn, double cs)
     426                 :            : {
     427         [ #  # ]:          0 :     if (nWink!=0) {
     428 [ #  # ][ #  # ]:          0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     429         [ #  # ]:          0 :         rRefObj.Rotate(rRef-aAnchor,nWink,sn,cs);
     430         [ #  # ]:          0 :         SetRectsDirty();
     431         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     432                 :            :     }
     433                 :          0 : }
     434                 :            : 
     435                 :          0 : void SdrVirtObj::Mirror(const Point& rRef1, const Point& rRef2)
     436                 :            : {
     437 [ #  # ][ #  # ]:          0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     438         [ #  # ]:          0 :     rRefObj.Mirror(rRef1-aAnchor,rRef2-aAnchor);
     439         [ #  # ]:          0 :     SetRectsDirty();
     440         [ #  # ]:          0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     441                 :          0 : }
     442                 :            : 
     443                 :          0 : void SdrVirtObj::Shear(const Point& rRef, long nWink, double tn, bool bVShear)
     444                 :            : {
     445         [ #  # ]:          0 :     if (nWink!=0) {
     446 [ #  # ][ #  # ]:          0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     447         [ #  # ]:          0 :         rRefObj.Shear(rRef-aAnchor,nWink,tn,bVShear);
     448         [ #  # ]:          0 :         SetRectsDirty();
     449         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     450                 :            :     }
     451                 :          0 : }
     452                 :            : 
     453                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     454                 :            : 
     455                 :          0 : void SdrVirtObj::RecalcSnapRect()
     456                 :            : {
     457                 :          0 :     aSnapRect=rRefObj.GetSnapRect();
     458                 :          0 :     aSnapRect+=aAnchor;
     459                 :          0 : }
     460                 :            : 
     461                 :          0 : const Rectangle& SdrVirtObj::GetSnapRect() const
     462                 :            : {
     463                 :          0 :     ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetSnapRect();
     464                 :          0 :     ((SdrVirtObj*)this)->aSnapRect+=aAnchor;
     465                 :          0 :     return aSnapRect;
     466                 :            : }
     467                 :            : 
     468                 :          0 : void SdrVirtObj::SetSnapRect(const Rectangle& rRect)
     469                 :            : {
     470                 :            :     {
     471 [ #  # ][ #  # ]:          0 :         Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     472                 :          0 :         Rectangle aR(rRect);
     473         [ #  # ]:          0 :         aR-=aAnchor;
     474         [ #  # ]:          0 :         rRefObj.SetSnapRect(aR);
     475         [ #  # ]:          0 :         SetRectsDirty();
     476         [ #  # ]:          0 :         SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     477                 :            :     }
     478                 :          0 : }
     479                 :            : 
     480                 :          0 : void SdrVirtObj::NbcSetSnapRect(const Rectangle& rRect)
     481                 :            : {
     482                 :          0 :     Rectangle aR(rRect);
     483         [ #  # ]:          0 :     aR-=aAnchor;
     484         [ #  # ]:          0 :     SetRectsDirty();
     485         [ #  # ]:          0 :     rRefObj.NbcSetSnapRect(aR);
     486                 :          0 : }
     487                 :            : 
     488                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     489                 :            : 
     490                 :          0 : const Rectangle& SdrVirtObj::GetLogicRect() const
     491                 :            : {
     492                 :          0 :     ((SdrVirtObj*)this)->aSnapRect=rRefObj.GetLogicRect();  // An abuse of aSnapRect!
     493                 :          0 :     ((SdrVirtObj*)this)->aSnapRect+=aAnchor;                // If there's trouble, we need another Rectangle Member (or a Heap).
     494                 :          0 :     return aSnapRect;
     495                 :            : }
     496                 :            : 
     497                 :          0 : void SdrVirtObj::SetLogicRect(const Rectangle& rRect)
     498                 :            : {
     499 [ #  # ][ #  # ]:          0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     500                 :          0 :     Rectangle aR(rRect);
     501         [ #  # ]:          0 :     aR-=aAnchor;
     502         [ #  # ]:          0 :     rRefObj.SetLogicRect(aR);
     503         [ #  # ]:          0 :     SetRectsDirty();
     504         [ #  # ]:          0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     505                 :          0 : }
     506                 :            : 
     507                 :          0 : void SdrVirtObj::NbcSetLogicRect(const Rectangle& rRect)
     508                 :            : {
     509                 :          0 :     Rectangle aR(rRect);
     510         [ #  # ]:          0 :     aR-=aAnchor;
     511         [ #  # ]:          0 :     SetRectsDirty();
     512         [ #  # ]:          0 :     rRefObj.NbcSetLogicRect(aR);
     513                 :          0 : }
     514                 :            : 
     515                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     516                 :            : 
     517                 :          0 : long SdrVirtObj::GetRotateAngle() const
     518                 :            : {
     519                 :          0 :     return rRefObj.GetRotateAngle();
     520                 :            : }
     521                 :            : 
     522                 :          0 : long SdrVirtObj::GetShearAngle(bool bVertical) const
     523                 :            : {
     524                 :          0 :     return rRefObj.GetShearAngle(bVertical);
     525                 :            : }
     526                 :            : 
     527                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     528                 :            : 
     529                 :          0 : sal_uInt32 SdrVirtObj::GetSnapPointCount() const
     530                 :            : {
     531                 :          0 :     return rRefObj.GetSnapPointCount();
     532                 :            : }
     533                 :            : 
     534                 :          0 : Point SdrVirtObj::GetSnapPoint(sal_uInt32 i) const
     535                 :            : {
     536                 :          0 :     Point aP(rRefObj.GetSnapPoint(i));
     537                 :          0 :     aP+=aAnchor;
     538                 :          0 :     return aP;
     539                 :            : }
     540                 :            : 
     541                 :          0 : sal_Bool SdrVirtObj::IsPolyObj() const
     542                 :            : {
     543                 :          0 :     return rRefObj.IsPolyObj();
     544                 :            : }
     545                 :            : 
     546                 :          0 : sal_uInt32 SdrVirtObj::GetPointCount() const
     547                 :            : {
     548                 :          0 :     return rRefObj.GetPointCount();
     549                 :            : }
     550                 :            : 
     551                 :          0 : Point SdrVirtObj::GetPoint(sal_uInt32 i) const
     552                 :            : {
     553                 :          0 :     return Point(rRefObj.GetPoint(i) + aAnchor);
     554                 :            : }
     555                 :            : 
     556                 :          0 : void SdrVirtObj::NbcSetPoint(const Point& rPnt, sal_uInt32 i)
     557                 :            : {
     558                 :          0 :     Point aP(rPnt);
     559                 :          0 :     aP-=aAnchor;
     560         [ #  # ]:          0 :     rRefObj.SetPoint(aP,i);
     561         [ #  # ]:          0 :     SetRectsDirty();
     562                 :          0 : }
     563                 :            : 
     564                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     565                 :            : 
     566                 :          0 : SdrObjGeoData* SdrVirtObj::NewGeoData() const
     567                 :            : {
     568                 :          0 :     return rRefObj.NewGeoData();
     569                 :            : }
     570                 :            : 
     571                 :          0 : void SdrVirtObj::SaveGeoData(SdrObjGeoData& rGeo) const
     572                 :            : {
     573                 :          0 :     rRefObj.SaveGeoData(rGeo);
     574                 :          0 : }
     575                 :            : 
     576                 :          0 : void SdrVirtObj::RestGeoData(const SdrObjGeoData& rGeo)
     577                 :            : {
     578                 :          0 :     rRefObj.RestGeoData(rGeo);
     579                 :          0 :     SetRectsDirty();
     580                 :          0 : }
     581                 :            : 
     582                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     583                 :            : 
     584                 :          0 : SdrObjGeoData* SdrVirtObj::GetGeoData() const
     585                 :            : {
     586                 :          0 :     return rRefObj.GetGeoData();
     587                 :            : }
     588                 :            : 
     589                 :          0 : void SdrVirtObj::SetGeoData(const SdrObjGeoData& rGeo)
     590                 :            : {
     591 [ #  # ][ #  # ]:          0 :     Rectangle aBoundRect0; if (pUserCall!=NULL) aBoundRect0=GetLastBoundRect();
                 [ #  # ]
     592         [ #  # ]:          0 :     rRefObj.SetGeoData(rGeo);
     593         [ #  # ]:          0 :     SetRectsDirty();
     594         [ #  # ]:          0 :     SendUserCall(SDRUSERCALL_RESIZE,aBoundRect0);
     595                 :          0 : }
     596                 :            : 
     597                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     598                 :            : 
     599                 :          0 : void SdrVirtObj::NbcReformatText()
     600                 :            : {
     601                 :          0 :     rRefObj.NbcReformatText();
     602                 :          0 : }
     603                 :            : 
     604                 :          0 : void SdrVirtObj::ReformatText()
     605                 :            : {
     606                 :          0 :     rRefObj.ReformatText();
     607                 :          0 : }
     608                 :            : 
     609                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     610                 :            : 
     611                 :          0 : bool SdrVirtObj::HasMacro() const
     612                 :            : {
     613                 :          0 :     return rRefObj.HasMacro();
     614                 :            : }
     615                 :            : 
     616                 :          0 : SdrObject* SdrVirtObj::CheckMacroHit(const SdrObjMacroHitRec& rRec) const
     617                 :            : {
     618                 :          0 :     return rRefObj.CheckMacroHit(rRec); // TODO: positioning offset
     619                 :            : }
     620                 :            : 
     621                 :          0 : Pointer SdrVirtObj::GetMacroPointer(const SdrObjMacroHitRec& rRec) const
     622                 :            : {
     623                 :          0 :     return rRefObj.GetMacroPointer(rRec); // TODO: positioning offset
     624                 :            : }
     625                 :            : 
     626                 :          0 : void SdrVirtObj::PaintMacro(OutputDevice& rOut, const Rectangle& rDirtyRect, const SdrObjMacroHitRec& rRec) const
     627                 :            : {
     628                 :          0 :     rRefObj.PaintMacro(rOut,rDirtyRect,rRec); // TODO: positioning offset
     629                 :          0 : }
     630                 :            : 
     631                 :          0 : bool SdrVirtObj::DoMacro(const SdrObjMacroHitRec& rRec)
     632                 :            : {
     633                 :          0 :     return rRefObj.DoMacro(rRec); // TODO: positioning offset
     634                 :            : }
     635                 :            : 
     636                 :          0 : rtl::OUString SdrVirtObj::GetMacroPopupComment(const SdrObjMacroHitRec& rRec) const
     637                 :            : {
     638                 :          0 :     return rRefObj.GetMacroPopupComment(rRec); // TODO: positioning offset
     639                 :            : }
     640                 :            : 
     641                 :          0 : const Point SdrVirtObj::GetOffset() const
     642                 :            : {
     643                 :            :     // #i73248# default offset of SdrVirtObj is aAnchor
     644                 :          0 :     return aAnchor;
     645                 :            : }
     646                 :            : 
     647                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10