LCOV - code coverage report
Current view: top level - sw/source/core/draw - dflyobj.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 117 377 31.0 %
Date: 2012-08-25 Functions: 42 70 60.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 70 498 14.1 %

           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                 :            : #include "hintids.hxx"
      30                 :            : #include <svx/svdtrans.hxx>
      31                 :            : #include <editeng/protitem.hxx>
      32                 :            : #include <editeng/opaqitem.hxx>
      33                 :            : #include <svx/svdpage.hxx>
      34                 :            : 
      35                 :            : 
      36                 :            : #include <fmtclds.hxx>
      37                 :            : #include <fmtornt.hxx>
      38                 :            : #include <fmtfsize.hxx>
      39                 :            : #include <fmturl.hxx>
      40                 :            : #include "viewsh.hxx"
      41                 :            : #include "viewimp.hxx"
      42                 :            : #include "cntfrm.hxx"
      43                 :            : #include "frmatr.hxx"
      44                 :            : #include "doc.hxx"
      45                 :            : #include <IDocumentUndoRedo.hxx>
      46                 :            : #include "dview.hxx"
      47                 :            : #include "dflyobj.hxx"
      48                 :            : #include "flyfrm.hxx"
      49                 :            : #include "frmfmt.hxx"
      50                 :            : #include "viewopt.hxx"
      51                 :            : #include "frmtool.hxx"
      52                 :            : #include "flyfrms.hxx"
      53                 :            : #include "ndnotxt.hxx"
      54                 :            : #include "grfatr.hxx"
      55                 :            : #include "pagefrm.hxx"
      56                 :            : #include "rootfrm.hxx"
      57                 :            : 
      58                 :            : 
      59                 :            : using namespace ::com::sun::star;
      60                 :            : 
      61                 :            : 
      62                 :            : #include <svx/sdr/properties/defaultproperties.hxx>
      63                 :            : #include <basegfx/range/b2drange.hxx>
      64                 :            : #include <basegfx/polygon/b2dpolygontools.hxx>
      65                 :            : #include <basegfx/polygon/b2dpolygon.hxx>
      66                 :            : 
      67                 :            : // AW: For VCOfDrawVirtObj and stuff
      68                 :            : #include <svx/sdr/contact/viewcontactofvirtobj.hxx>
      69                 :            : #include <drawinglayer/primitive2d/baseprimitive2d.hxx>
      70                 :            : #include <sw_primitivetypes2d.hxx>
      71                 :            : #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
      72                 :            : 
      73                 :            : using namespace ::com::sun::star;
      74                 :            : 
      75                 :            : static sal_Bool bInResize = sal_False;
      76                 :            : 
      77 [ +  + ][ -  + ]:       8481 : TYPEINIT1( SwFlyDrawObj, SdrObject )
      78 [ +  + ][ -  + ]:      84214 : TYPEINIT1( SwVirtFlyDrawObj, SdrVirtObj )
      79                 :            : 
      80                 :            : /*************************************************************************
      81                 :            : |*
      82                 :            : |*  SwFlyDrawObj::Ctor
      83                 :            : |*
      84                 :            : *************************************************************************/
      85                 :            : 
      86                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
      87                 :            : 
      88                 :            : namespace sdr
      89                 :            : {
      90                 :            :     namespace contact
      91                 :            :     {
      92                 :            :         // #i95264# currently needed since createViewIndependentPrimitive2DSequence()
      93                 :            :         // is called when RecalcBoundRect() is used. There should currently no VOCs being
      94                 :            :         // constructed since it gets not visualized (instead the corresponding SwVirtFlyDrawObj's
      95                 :            :         // referencing this one are visualized).
      96                 :            :         class VCOfSwFlyDrawObj : public ViewContactOfSdrObj
      97                 :            :         {
      98                 :            :         protected:
      99                 :            :             // This method is responsible for creating the graphical visualisation data
     100                 :            :             // ONLY based on model data
     101                 :            :             virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
     102                 :            : 
     103                 :            :         public:
     104                 :            :             // basic constructor, used from SdrObject.
     105                 :        122 :             VCOfSwFlyDrawObj(SwFlyDrawObj& rObj)
     106                 :        122 :             :   ViewContactOfSdrObj(rObj)
     107                 :            :             {
     108                 :        122 :             }
     109                 :            :             virtual ~VCOfSwFlyDrawObj();
     110                 :            :         };
     111                 :            : 
     112                 :         63 :         drawinglayer::primitive2d::Primitive2DSequence VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence() const
     113                 :            :         {
     114                 :            :             // currently gets not visualized, return empty sequence
     115                 :         63 :             return drawinglayer::primitive2d::Primitive2DSequence();
     116                 :            :         }
     117                 :            : 
     118                 :        119 :         VCOfSwFlyDrawObj::~VCOfSwFlyDrawObj()
     119                 :            :         {
     120         [ -  + ]:        238 :         }
     121                 :            :     } // end of namespace contact
     122                 :            : } // end of namespace sdr
     123                 :            : 
     124                 :            : ////////////////////////////////////////////////////////////////////////////////////////////////////
     125                 :            : 
     126                 :          0 : sdr::properties::BaseProperties* SwFlyDrawObj::CreateObjectSpecificProperties()
     127                 :            : {
     128                 :            :     // create default properties
     129         [ #  # ]:          0 :     return new sdr::properties::DefaultProperties(*this);
     130                 :            : }
     131                 :            : 
     132                 :        122 : sdr::contact::ViewContact* SwFlyDrawObj::CreateObjectSpecificViewContact()
     133                 :            : {
     134                 :            :     // needs an own VC since createViewIndependentPrimitive2DSequence()
     135                 :            :     // is called when RecalcBoundRect() is used
     136         [ +  - ]:        122 :     return new sdr::contact::VCOfSwFlyDrawObj(*this);
     137                 :            : }
     138                 :            : 
     139                 :        662 : SwFlyDrawObj::SwFlyDrawObj()
     140                 :            : {
     141                 :        662 : }
     142                 :            : 
     143                 :        572 : SwFlyDrawObj::~SwFlyDrawObj()
     144                 :            : {
     145         [ -  + ]:       1144 : }
     146                 :            : 
     147                 :            : /*************************************************************************
     148                 :            : |*
     149                 :            : |*  SwFlyDrawObj::Factory-Methoden
     150                 :            : |*
     151                 :            : *************************************************************************/
     152                 :            : 
     153                 :       1559 : sal_uInt32 SwFlyDrawObj::GetObjInventor() const
     154                 :            : {
     155                 :       1559 :     return SWGInventor;
     156                 :            : }
     157                 :            : 
     158                 :            : 
     159                 :          0 : sal_uInt16 SwFlyDrawObj::GetObjIdentifier() const
     160                 :            : {
     161                 :          0 :     return SwFlyDrawObjIdentifier;
     162                 :            : }
     163                 :            : 
     164                 :            : 
     165                 :          0 : sal_uInt16 SwFlyDrawObj::GetObjVersion() const
     166                 :            : {
     167                 :          0 :     return SwDrawFirst;
     168                 :            : }
     169                 :            : 
     170                 :            : /*************************************************************************
     171                 :            : |*
     172                 :            : |*  SwVirtFlyDrawObj::CToren, Dtor
     173                 :            : |*
     174                 :            : *************************************************************************/
     175                 :            : 
     176                 :            : //////////////////////////////////////////////////////////////////////////////////////
     177                 :            : // AW: Need own primitive to get the FlyFrame paint working
     178                 :            : 
     179                 :            : namespace drawinglayer
     180                 :            : {
     181                 :            :     namespace primitive2d
     182                 :            :     {
     183         [ -  + ]:       1712 :         class SwVirtFlyDrawObjPrimitive : public BufferedDecompositionPrimitive2D
     184                 :            :         {
     185                 :            :         private:
     186                 :            :             const SwVirtFlyDrawObj&                 mrSwVirtFlyDrawObj;
     187                 :            :             const basegfx::B2DRange                 maOuterRange;
     188                 :            : 
     189                 :            :         protected:
     190                 :            :             // method which is to be used to implement the local decomposition of a 2D primitive
     191                 :            :             virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
     192                 :            : 
     193                 :            :         public:
     194                 :        946 :             SwVirtFlyDrawObjPrimitive(
     195                 :            :                 const SwVirtFlyDrawObj& rSwVirtFlyDrawObj,
     196                 :            :                 const basegfx::B2DRange &rOuterRange)
     197                 :            :             :   BufferedDecompositionPrimitive2D(),
     198                 :            :                 mrSwVirtFlyDrawObj(rSwVirtFlyDrawObj),
     199                 :        946 :                 maOuterRange(rOuterRange)
     200                 :            :             {
     201                 :        946 :             }
     202                 :            : 
     203                 :            :             // compare operator
     204                 :            :             virtual bool operator==(const BasePrimitive2D& rPrimitive) const;
     205                 :            : 
     206                 :            :             // get range
     207                 :            :             virtual basegfx::B2DRange getB2DRange(const geometry::ViewInformation2D& rViewInformation) const;
     208                 :            : 
     209                 :            :             // overloaded to allow callbacks to wrap_DoPaintObject
     210                 :            :             virtual Primitive2DSequence get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const;
     211                 :            : 
     212                 :            :             // data read access
     213                 :       3484 :             const SwVirtFlyDrawObj& getSwVirtFlyDrawObj() const { return mrSwVirtFlyDrawObj; }
     214                 :       5892 :             const basegfx::B2DRange& getOuterRange() const { return maOuterRange; }
     215                 :            : 
     216                 :            :             // provide unique ID
     217                 :            :             DeclPrimitrive2DIDBlock()
     218                 :            :         };
     219                 :            :     } // end of namespace primitive2d
     220                 :            : } // end of namespace drawinglayer
     221                 :            : 
     222                 :            : namespace drawinglayer
     223                 :            : {
     224                 :            :     namespace primitive2d
     225                 :            :     {
     226                 :        259 :         Primitive2DSequence SwVirtFlyDrawObjPrimitive::create2DDecomposition(const geometry::ViewInformation2D& /*rViewInformation*/) const
     227                 :            :         {
     228                 :        259 :             Primitive2DSequence aRetval;
     229                 :            : 
     230 [ +  - ][ +  - ]:        259 :             if(!getOuterRange().isEmpty())
     231                 :            :             {
     232                 :            :                 // currently this SW object has no primitive representation. As long as this is the case,
     233                 :            :                 // create invisible geometry to allow corfect HitTest and BoundRect calculations for the
     234                 :            :                 // object. Use a filled primitive to get 'inside' as default object hit. The special cases from
     235                 :            :                 // the old SwVirtFlyDrawObj::CheckHit implementation are handled now in SwDrawView::PickObj;
     236                 :            :                 // this removed the 'hack' to get a view from inside model data or to react on null-tolerance
     237                 :            :                 // as it was done in the old implementation
     238                 :            :                 const Primitive2DReference aHitTestReference(
     239                 :            :                     createHiddenGeometryPrimitives2D(
     240                 :            :                         true,
     241         [ +  - ]:        259 :                         getOuterRange()));
     242                 :            : 
     243 [ +  - ][ +  - ]:        259 :                 aRetval = Primitive2DSequence(&aHitTestReference, 1);
                 [ +  - ]
     244                 :            :             }
     245                 :            : 
     246                 :        259 :             return aRetval;
     247                 :            :         }
     248                 :            : 
     249                 :       1474 :         bool SwVirtFlyDrawObjPrimitive::operator==(const BasePrimitive2D& rPrimitive) const
     250                 :            :         {
     251         [ +  - ]:       1474 :             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
     252                 :            :             {
     253                 :       1474 :                 const SwVirtFlyDrawObjPrimitive& rCompare = (SwVirtFlyDrawObjPrimitive&)rPrimitive;
     254                 :            : 
     255                 :       1474 :                 return (&getSwVirtFlyDrawObj() == &rCompare.getSwVirtFlyDrawObj()
     256 [ +  + ][ +  - ]:       1474 :                     && getOuterRange() == rCompare.getOuterRange());
     257                 :            :             }
     258                 :            : 
     259                 :       1474 :             return false;
     260                 :            :         }
     261                 :            : 
     262                 :       2426 :         basegfx::B2DRange SwVirtFlyDrawObjPrimitive::getB2DRange(const geometry::ViewInformation2D& /*rViewInformation*/) const
     263                 :            :         {
     264                 :       2426 :             return getOuterRange();
     265                 :            :         }
     266                 :            : 
     267                 :        536 :         Primitive2DSequence SwVirtFlyDrawObjPrimitive::get2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const
     268                 :            :         {
     269                 :            :             // This is the callback to keep the FlyFrame painting in SW alive as long as it
     270                 :            :             // is not changed to primitives. This is the method which will be called by the processors
     271                 :            :             // when they do not know this primitive (and they do not). Inside wrap_DoPaintObject
     272                 :            :             // there needs to be a test that paint is only done during SW repaints (see there).
     273                 :            :             // Using this mechanism guarantees the correct Z-Order of the VirtualObject-based FlyFrames.
     274                 :        536 :             getSwVirtFlyDrawObj().wrap_DoPaintObject();
     275                 :            : 
     276                 :            :             // call parent
     277                 :        536 :             return BufferedDecompositionPrimitive2D::get2DDecomposition(rViewInformation);
     278                 :            :         }
     279                 :            : 
     280                 :            :         // provide unique ID
     281                 :       3898 :         ImplPrimitrive2DIDBlock(SwVirtFlyDrawObjPrimitive, PRIMITIVE2D_ID_SWVIRTFLYDRAWOBJPRIMITIVE2D)
     282                 :            : 
     283                 :            :     } // end of namespace primitive2d
     284                 :            : } // end of namespace drawinglayer
     285                 :            : 
     286                 :            : //////////////////////////////////////////////////////////////////////////////////////
     287                 :            : // AW: own sdr::contact::ViewContact (VC) sdr::contact::ViewObjectContact (VOC) needed
     288                 :            : // since offset is defined different from SdrVirtObj's sdr::contact::ViewContactOfVirtObj.
     289                 :            : // For paint, that offset is used by setting at the OutputDevice; for primitives this is
     290                 :            : // not possible since we have no OutputDevice, but define the geometry itself.
     291                 :            : 
     292                 :            : namespace sdr
     293                 :            : {
     294                 :            :     namespace contact
     295                 :            :     {
     296                 :            :         class VCOfSwVirtFlyDrawObj : public ViewContactOfVirtObj
     297                 :            :         {
     298                 :            :         protected:
     299                 :            :             // This method is responsible for creating the graphical visualisation data
     300                 :            :             // ONLY based on model data
     301                 :            :             virtual drawinglayer::primitive2d::Primitive2DSequence createViewIndependentPrimitive2DSequence() const;
     302                 :            : 
     303                 :            :         public:
     304                 :            :             // basic constructor, used from SdrObject.
     305                 :        611 :             VCOfSwVirtFlyDrawObj(SwVirtFlyDrawObj& rObj)
     306                 :        611 :             :   ViewContactOfVirtObj(rObj)
     307                 :            :             {
     308                 :        611 :             }
     309                 :            :             virtual ~VCOfSwVirtFlyDrawObj();
     310                 :            : 
     311                 :            :             // access to SwVirtFlyDrawObj
     312                 :       2838 :             SwVirtFlyDrawObj& GetSwVirtFlyDrawObj() const
     313                 :            :             {
     314                 :       2838 :                 return (SwVirtFlyDrawObj&)mrObject;
     315                 :            :             }
     316                 :            :         };
     317                 :            :     } // end of namespace contact
     318                 :            : } // end of namespace sdr
     319                 :            : 
     320                 :            : namespace sdr
     321                 :            : {
     322                 :            :     namespace contact
     323                 :            :     {
     324                 :        946 :         drawinglayer::primitive2d::Primitive2DSequence VCOfSwVirtFlyDrawObj::createViewIndependentPrimitive2DSequence() const
     325                 :            :         {
     326                 :        946 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     327         [ +  - ]:        946 :             const SdrObject& rReferencedObject = GetSwVirtFlyDrawObj().GetReferencedObj();
     328                 :            : 
     329 [ +  - ][ +  - ]:        946 :             if(rReferencedObject.ISA(SwFlyDrawObj))
     330                 :            :             {
     331                 :            :                 // create an own specialized primitive which is used as repaint callpoint and HitTest
     332                 :            :                 // for HitTest processor (see primitive implementation above)
     333         [ +  - ]:        946 :                 const basegfx::B2DRange aOuterRange(GetSwVirtFlyDrawObj().getOuterBound());
     334                 :            : 
     335 [ +  - ][ +  - ]:        946 :                 if(!aOuterRange.isEmpty())
     336                 :            :                 {
     337                 :            :                     const drawinglayer::primitive2d::Primitive2DReference xPrimitive(
     338                 :            :                         new drawinglayer::primitive2d::SwVirtFlyDrawObjPrimitive(
     339                 :            :                             GetSwVirtFlyDrawObj(),
     340 [ +  - ][ +  - ]:        946 :                             aOuterRange));
                 [ +  - ]
     341                 :            : 
     342 [ +  - ][ +  - ]:        946 :                     xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xPrimitive, 1);
                 [ +  - ]
     343                 :            :                 }
     344                 :            :             }
     345                 :            : 
     346                 :        946 :             return xRetval;
     347                 :            :         }
     348                 :            : 
     349                 :        521 :         VCOfSwVirtFlyDrawObj::~VCOfSwVirtFlyDrawObj()
     350                 :            :         {
     351         [ -  + ]:       1042 :         }
     352                 :            :     } // end of namespace contact
     353                 :            : } // end of namespace sdr
     354                 :            : 
     355                 :            : //////////////////////////////////////////////////////////////////////////////////////
     356                 :            : 
     357                 :        946 : basegfx::B2DRange SwVirtFlyDrawObj::getOuterBound() const
     358                 :            : {
     359                 :        946 :     basegfx::B2DRange aOuterRange;
     360                 :        946 :     const SdrObject& rReferencedObject = GetReferencedObj();
     361                 :            : 
     362         [ +  - ]:        946 :     if(rReferencedObject.ISA(SwFlyDrawObj))
     363                 :            :     {
     364                 :        946 :         const SwFlyFrm* pFlyFrame = GetFlyFrm();
     365                 :            : 
     366         [ +  - ]:        946 :         if(pFlyFrame)
     367                 :            :         {
     368         [ +  - ]:        946 :             const Rectangle aOuterRectangle(pFlyFrame->Frm().Pos(), pFlyFrame->Frm().SSize());
     369                 :            : 
     370 [ +  - ][ +  -  :       2838 :             if(!aOuterRectangle.IsEmpty()
             +  -  +  - ]
                 [ +  - ]
     371                 :        946 :                 && RECT_EMPTY != aOuterRectangle.Right()
     372                 :        946 :                 && RECT_EMPTY != aOuterRectangle.Bottom())
     373                 :            :             {
     374         [ +  - ]:        946 :                 aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Left(), aOuterRectangle.Top()));
     375         [ +  - ]:        946 :                 aOuterRange.expand(basegfx::B2DTuple(aOuterRectangle.Right(), aOuterRectangle.Bottom()));
     376                 :            :             }
     377                 :            :         }
     378                 :            :     }
     379                 :            : 
     380                 :        946 :     return aOuterRange;
     381                 :            : }
     382                 :            : 
     383                 :          0 : basegfx::B2DRange SwVirtFlyDrawObj::getInnerBound() const
     384                 :            : {
     385                 :          0 :     basegfx::B2DRange aInnerRange;
     386                 :          0 :     const SdrObject& rReferencedObject = GetReferencedObj();
     387                 :            : 
     388         [ #  # ]:          0 :     if(rReferencedObject.ISA(SwFlyDrawObj))
     389                 :            :     {
     390                 :          0 :         const SwFlyFrm* pFlyFrame = GetFlyFrm();
     391                 :            : 
     392         [ #  # ]:          0 :         if(pFlyFrame)
     393                 :            :         {
     394         [ #  # ]:          0 :             const Rectangle aInnerRectangle(pFlyFrame->Frm().Pos() + pFlyFrame->Prt().Pos(), pFlyFrame->Prt().SSize());
     395                 :            : 
     396 [ #  # ][ #  #  :          0 :             if(!aInnerRectangle.IsEmpty()
             #  #  #  # ]
                 [ #  # ]
     397                 :          0 :                 && RECT_EMPTY != aInnerRectangle.Right()
     398                 :          0 :                 && RECT_EMPTY != aInnerRectangle.Bottom())
     399                 :            :             {
     400         [ #  # ]:          0 :                 aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Left(), aInnerRectangle.Top()));
     401         [ #  # ]:          0 :                 aInnerRange.expand(basegfx::B2DTuple(aInnerRectangle.Right(), aInnerRectangle.Bottom()));
     402                 :            :             }
     403                 :            :         }
     404                 :            :     }
     405                 :            : 
     406                 :          0 :     return aInnerRange;
     407                 :            : }
     408                 :            : 
     409                 :        611 : sdr::contact::ViewContact* SwVirtFlyDrawObj::CreateObjectSpecificViewContact()
     410                 :            : {
     411                 :            :     // need an own ViewContact (VC) to allow creation of a specialized primitive
     412                 :            :     // for being able to visualize the FlyFrames in primitive renderers
     413         [ +  - ]:        611 :     return new sdr::contact::VCOfSwVirtFlyDrawObj(*this);
     414                 :            : }
     415                 :            : 
     416                 :        611 : SwVirtFlyDrawObj::SwVirtFlyDrawObj(SdrObject& rNew, SwFlyFrm* pFly) :
     417                 :            :     SdrVirtObj( rNew ),
     418                 :        611 :     pFlyFrm( pFly )
     419                 :            : {
     420                 :            :     //#110094#-1
     421                 :            :     // bNotPersistent = bNeedColorRestore = bWriterFlyFrame = sal_True;
     422 [ +  - ][ +  - ]:        611 :     const SvxProtectItem &rP = pFlyFrm->GetFmt()->GetProtect();
     423                 :        611 :     bMovProt = rP.IsPosProtected();
     424                 :        611 :     bSizProt = rP.IsSizeProtected();
     425                 :        611 : }
     426                 :            : 
     427                 :            : 
     428                 :        521 : SwVirtFlyDrawObj::~SwVirtFlyDrawObj()
     429                 :            : {
     430 [ +  - ][ +  + ]:        521 :     if ( GetPage() )    //Der SdrPage die Verantwortung entziehen.
     431 [ +  - ][ +  - ]:        489 :         GetPage()->RemoveObject( GetOrdNum() );
                 [ +  - ]
     432         [ -  + ]:       1042 : }
     433                 :            : 
     434                 :            : /*************************************************************************
     435                 :            : |*
     436                 :            : |*  SwVirtFlyDrawObj::GetFmt()
     437                 :            : |*
     438                 :            : *************************************************************************/
     439                 :            : 
     440                 :          0 : const SwFrmFmt *SwVirtFlyDrawObj::GetFmt() const
     441                 :            : {
     442                 :          0 :     return GetFlyFrm()->GetFmt();
     443                 :            : }
     444                 :            : 
     445                 :            : 
     446                 :          0 : SwFrmFmt *SwVirtFlyDrawObj::GetFmt()
     447                 :            : {
     448                 :          0 :     return GetFlyFrm()->GetFmt();
     449                 :            : }
     450                 :            : 
     451                 :            : /*************************************************************************
     452                 :            : |*
     453                 :            : |*  SwVirtFlyDrawObj::Paint()
     454                 :            : |*
     455                 :            : *************************************************************************/
     456                 :            : 
     457                 :            : // --> OD #i102707#
     458                 :            : namespace
     459                 :            : {
     460                 :            :     class RestoreMapMode
     461                 :            :     {
     462                 :            :         public:
     463                 :        301 :             explicit RestoreMapMode( ViewShell* pViewShell )
     464                 :            :                 : mbMapModeRestored( false )
     465                 :        301 :                 , mpOutDev( pViewShell->GetOut() )
     466                 :            :             {
     467         [ +  - ]:        301 :                 if ( pViewShell->getPrePostMapMode() != mpOutDev->GetMapMode() )
     468                 :            :                 {
     469                 :        301 :                     mpOutDev->Push(PUSH_MAPMODE);
     470                 :            : 
     471                 :        301 :                     GDIMetaFile* pMetaFile = mpOutDev->GetConnectMetaFile();
     472 [ -  + ][ -  +  :        301 :                     if ( pMetaFile &&
             #  #  #  # ]
     473                 :          0 :                          pMetaFile->IsRecord() && !pMetaFile->IsPause() )
     474                 :            :                     {
     475                 :            :                         OSL_FAIL( "MapMode restoration during meta file creation is somehow suspect - using <SetRelativeMapMode(..)>, but not sure, if correct." );
     476                 :          0 :                         mpOutDev->SetRelativeMapMode( pViewShell->getPrePostMapMode() );
     477                 :            :                     }
     478                 :            :                     else
     479                 :            :                     {
     480                 :        301 :                         mpOutDev->SetMapMode( pViewShell->getPrePostMapMode() );
     481                 :            :                     }
     482                 :            : 
     483                 :        301 :                     mbMapModeRestored = true;
     484                 :            :                 }
     485                 :        301 :             };
     486                 :            : 
     487                 :        301 :             ~RestoreMapMode()
     488                 :            :             {
     489         [ +  - ]:        301 :                 if ( mbMapModeRestored )
     490                 :            :                 {
     491                 :        301 :                     mpOutDev->Pop();
     492                 :            :                 }
     493                 :        301 :             };
     494                 :            : 
     495                 :            :         private:
     496                 :            :             bool mbMapModeRestored;
     497                 :            :             OutputDevice* mpOutDev;
     498                 :            :     };
     499                 :            : }
     500                 :            : // <--
     501                 :            : 
     502                 :        536 : void SwVirtFlyDrawObj::wrap_DoPaintObject() const
     503                 :            : {
     504                 :        536 :     ViewShell* pShell = pFlyFrm->getRootFrm()->GetCurrShell();
     505                 :            : 
     506                 :            :     // Only paint when we have a current shell and a DrawingLayer paint is in progress.
     507                 :            :     // This avcoids evtl. problems with renderers which do processing stuff,
     508                 :            :     // but no paints. IsPaintInProgress() depends on SW repaint, so, as long
     509                 :            :     // as SW paints self and calls DrawLayer() for Heaven and Hell, this will
     510                 :            :     // be correct
     511 [ +  + ][ +  + ]:        536 :     if ( pShell && pShell->IsDrawingLayerPaintInProgress() )
                 [ +  - ]
     512                 :            :     {
     513                 :        534 :         sal_Bool bDrawObject(sal_True);
     514                 :            : 
     515         [ -  + ]:        534 :         if ( !SwFlyFrm::IsPaint( (SdrObject*)this, pShell ) )
     516                 :            :         {
     517                 :          0 :             bDrawObject = sal_False;
     518                 :            :         }
     519                 :            : 
     520         [ +  - ]:        534 :         if ( bDrawObject )
     521                 :            :         {
     522         [ +  + ]:        534 :             if ( !pFlyFrm->IsFlyInCntFrm() )
     523                 :            :             {
     524                 :            :                 // it is also necessary to restore the VCL MapMode from ViewInformation since e.g.
     525                 :            :                 // the VCL PixelRenderer resets it at the used OutputDevice. Unfortunately, this
     526                 :            :                 // excludes shears and rotates which are not expressable in MapMode.
     527                 :            :                 // OD #i102707#
     528                 :            :                 // new helper class to restore MapMode - restoration, only if
     529                 :            :                 // needed and consideration of paint for meta file creation .
     530         [ +  - ]:        301 :                 RestoreMapMode aRestoreMapModeIfNeeded( pShell );
     531                 :            : 
     532                 :            :                 // paint the FlyFrame (use standard VCL-Paint)
     533 [ +  - ][ +  - ]:        301 :                 pFlyFrm->Paint( GetFlyFrm()->Frm() );
     534                 :            :             }
     535                 :            :         }
     536                 :            :     }
     537                 :        536 : }
     538                 :            : 
     539                 :            : /*************************************************************************
     540                 :            : |*
     541                 :            : |*  SwVirtFlyDrawObj::TakeObjInfo()
     542                 :            : |*
     543                 :            : *************************************************************************/
     544                 :            : 
     545                 :          0 : void SwVirtFlyDrawObj::TakeObjInfo( SdrObjTransformInfoRec& rInfo ) const
     546                 :            : {
     547                 :            :     rInfo.bSelectAllowed     = rInfo.bMoveAllowed =
     548                 :          0 :     rInfo.bResizeFreeAllowed = rInfo.bResizePropAllowed = sal_True;
     549                 :            : 
     550                 :            :     rInfo.bRotateFreeAllowed = rInfo.bRotate90Allowed =
     551                 :            :     rInfo.bMirrorFreeAllowed = rInfo.bMirror45Allowed =
     552                 :            :     rInfo.bMirror90Allowed   = rInfo.bShearAllowed    =
     553                 :            :     rInfo.bCanConvToPath     = rInfo.bCanConvToPoly   =
     554                 :          0 :     rInfo.bCanConvToPathLineToArea = rInfo.bCanConvToPolyLineToArea = sal_False;
     555                 :          0 : }
     556                 :            : 
     557                 :            : 
     558                 :            : /*************************************************************************
     559                 :            : |*
     560                 :            : |*  SwVirtFlyDrawObj::Groessenermittlung
     561                 :            : |*
     562                 :            : *************************************************************************/
     563                 :            : 
     564                 :       9768 : void SwVirtFlyDrawObj::SetRect() const
     565                 :            : {
     566         [ +  - ]:       9768 :     if ( GetFlyFrm()->Frm().HasArea() )
     567                 :       9768 :         ((SwVirtFlyDrawObj*)this)->aOutRect = GetFlyFrm()->Frm().SVRect();
     568                 :            :     else
     569                 :          0 :         ((SwVirtFlyDrawObj*)this)->aOutRect = Rectangle();
     570                 :       9768 : }
     571                 :            : 
     572                 :            : 
     573                 :       7361 : const Rectangle& SwVirtFlyDrawObj::GetCurrentBoundRect() const
     574                 :            : {
     575                 :       7361 :     SetRect();
     576                 :       7361 :     return aOutRect;
     577                 :            : }
     578                 :            : 
     579                 :       5503 : const Rectangle& SwVirtFlyDrawObj::GetLastBoundRect() const
     580                 :            : {
     581                 :       5503 :     return GetCurrentBoundRect();
     582                 :            : }
     583                 :            : 
     584                 :            : 
     585                 :          0 : void SwVirtFlyDrawObj::RecalcBoundRect()
     586                 :            : {
     587                 :          0 :     SetRect();
     588                 :          0 : }
     589                 :            : 
     590                 :            : 
     591                 :          0 : void SwVirtFlyDrawObj::RecalcSnapRect()
     592                 :            : {
     593                 :          0 :     SetRect();
     594                 :          0 : }
     595                 :            : 
     596                 :            : 
     597                 :        815 : const Rectangle& SwVirtFlyDrawObj::GetSnapRect()  const
     598                 :            : {
     599                 :        815 :     SetRect();
     600                 :        815 :     return aOutRect;
     601                 :            : }
     602                 :            : 
     603                 :            : 
     604                 :          0 : void SwVirtFlyDrawObj::SetSnapRect(const Rectangle& )
     605                 :            : {
     606         [ #  # ]:          0 :     Rectangle aTmp( GetLastBoundRect() );
     607         [ #  # ]:          0 :     SetRect();
     608         [ #  # ]:          0 :     SetChanged();
     609         [ #  # ]:          0 :     BroadcastObjectChange();
     610         [ #  # ]:          0 :     if (pUserCall!=NULL)
     611         [ #  # ]:          0 :         pUserCall->Changed(*this, SDRUSERCALL_RESIZE, aTmp);
     612                 :          0 : }
     613                 :            : 
     614                 :            : 
     615                 :          0 : void SwVirtFlyDrawObj::NbcSetSnapRect(const Rectangle& )
     616                 :            : {
     617                 :          0 :     SetRect();
     618                 :          0 : }
     619                 :            : 
     620                 :            : 
     621                 :          0 : const Rectangle& SwVirtFlyDrawObj::GetLogicRect() const
     622                 :            : {
     623                 :          0 :     SetRect();
     624                 :          0 :     return aOutRect;
     625                 :            : }
     626                 :            : 
     627                 :            : 
     628                 :          0 : void SwVirtFlyDrawObj::SetLogicRect(const Rectangle& )
     629                 :            : {
     630         [ #  # ]:          0 :     Rectangle aTmp( GetLastBoundRect() );
     631         [ #  # ]:          0 :     SetRect();
     632         [ #  # ]:          0 :     SetChanged();
     633         [ #  # ]:          0 :     BroadcastObjectChange();
     634         [ #  # ]:          0 :     if (pUserCall!=NULL)
     635         [ #  # ]:          0 :         pUserCall->Changed(*this, SDRUSERCALL_RESIZE, aTmp);
     636                 :          0 : }
     637                 :            : 
     638                 :            : 
     639                 :          0 : void SwVirtFlyDrawObj::NbcSetLogicRect(const Rectangle& )
     640                 :            : {
     641                 :          0 :     SetRect();
     642                 :          0 : }
     643                 :            : 
     644                 :            : 
     645                 :          0 : ::basegfx::B2DPolyPolygon SwVirtFlyDrawObj::TakeXorPoly() const
     646                 :            : {
     647         [ #  # ]:          0 :     const Rectangle aSourceRectangle(GetFlyFrm()->Frm().SVRect());
     648         [ #  # ]:          0 :     const ::basegfx::B2DRange aSourceRange(aSourceRectangle.Left(), aSourceRectangle.Top(), aSourceRectangle.Right(), aSourceRectangle.Bottom());
     649         [ #  # ]:          0 :     ::basegfx::B2DPolyPolygon aRetval;
     650                 :            : 
     651 [ #  # ][ #  # ]:          0 :     aRetval.append(::basegfx::tools::createPolygonFromRect(aSourceRange));
                 [ #  # ]
     652                 :            : 
     653                 :          0 :     return aRetval;
     654                 :            : }
     655                 :            : 
     656                 :            : /*************************************************************************
     657                 :            : |*
     658                 :            : |*  SwVirtFlyDrawObj::Move() und Resize()
     659                 :            : |*
     660                 :            : *************************************************************************/
     661                 :            : 
     662                 :          0 : void SwVirtFlyDrawObj::NbcMove(const Size& rSiz)
     663                 :            : {
     664         [ #  # ]:          0 :     MoveRect( aOutRect, rSiz );
     665                 :          0 :     const Point aOldPos( GetFlyFrm()->Frm().Pos() );
     666                 :          0 :     const Point aNewPos( aOutRect.TopLeft() );
     667         [ #  # ]:          0 :     const SwRect aFlyRect( aOutRect );
     668                 :            : 
     669                 :            :     //Wenn der Fly eine automatische Ausrichtung hat (rechts oder oben),
     670                 :            :     //so soll die Automatik erhalten bleiben
     671         [ #  # ]:          0 :     SwFrmFmt *pFmt = GetFlyFrm()->GetFmt();
     672         [ #  # ]:          0 :     const sal_Int16 eHori = pFmt->GetHoriOrient().GetHoriOrient();
     673         [ #  # ]:          0 :     const sal_Int16 eVert = pFmt->GetVertOrient().GetVertOrient();
     674         [ #  # ]:          0 :     const sal_Int16 eRelHori = pFmt->GetHoriOrient().GetRelationOrient();
     675         [ #  # ]:          0 :     const sal_Int16 eRelVert = pFmt->GetVertOrient().GetRelationOrient();
     676                 :            :     //Bei Absatzgebundenen Flys muss ausgehend von der neuen Position ein
     677                 :            :     //neuer Anker gesetzt werden. Anker und neue RelPos werden vom Fly selbst
     678                 :            :     //berechnet und gesetzt.
     679         [ #  # ]:          0 :     if( GetFlyFrm()->IsFlyAtCntFrm() )
     680         [ #  # ]:          0 :         ((SwFlyAtCntFrm*)GetFlyFrm())->SetAbsPos( aNewPos );
     681                 :            :     else
     682                 :            :     {
     683         [ #  # ]:          0 :         const SwFrmFmt *pTmpFmt = GetFmt();
     684         [ #  # ]:          0 :         const SwFmtVertOrient &rVert = pTmpFmt->GetVertOrient();
     685         [ #  # ]:          0 :         const SwFmtHoriOrient &rHori = pTmpFmt->GetHoriOrient();
     686                 :          0 :         long lXDiff = aNewPos.X() - aOldPos.X();
     687 [ #  # ][ #  # ]:          0 :         if( rHori.IsPosToggle() && text::HoriOrientation::NONE == eHori &&
         [ #  # ][ #  # ]
     688 [ #  # ][ #  # ]:          0 :             !GetFlyFrm()->FindPageFrm()->OnRightPage() )
     689                 :          0 :             lXDiff = -lXDiff;
     690                 :            : 
     691 [ #  # ][ #  # ]:          0 :         if( GetFlyFrm()->GetAnchorFrm()->IsRightToLeft() &&
         [ #  # ][ #  # ]
                 [ #  # ]
     692                 :            :             text::HoriOrientation::NONE == eHori )
     693                 :          0 :             lXDiff = -lXDiff;
     694                 :            : 
     695                 :          0 :         long lYDiff = aNewPos.Y() - aOldPos.Y();
     696 [ #  # ][ #  # ]:          0 :         if( GetFlyFrm()->GetAnchorFrm()->IsVertical() )
                 [ #  # ]
     697                 :            :         {
     698                 :            :             //lXDiff -= rVert.GetPos();
     699                 :            :             //lYDiff += rHori.GetPos();
     700                 :            :             //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
     701 [ #  # ][ #  # ]:          0 :             if ( GetFlyFrm()->GetAnchorFrm()->IsVertLR() )
     702                 :            :             {
     703                 :          0 :                 lXDiff += rVert.GetPos();
     704                 :          0 :                 lXDiff = -lXDiff;
     705                 :            :             }
     706                 :            :             else
     707                 :            :             {
     708                 :          0 :                 lXDiff -= rVert.GetPos();
     709                 :          0 :                 lYDiff += rHori.GetPos();
     710                 :            :             }
     711                 :            :         }
     712                 :            :         else
     713                 :            :         {
     714                 :          0 :             lXDiff += rHori.GetPos();
     715                 :          0 :             lYDiff += rVert.GetPos();
     716                 :            :         }
     717                 :            : 
     718 [ #  # ][ #  # ]:          0 :         if( GetFlyFrm()->GetAnchorFrm()->IsRightToLeft() &&
         [ #  # ][ #  # ]
                 [ #  # ]
     719                 :            :             text::HoriOrientation::NONE != eHori )
     720         [ #  # ]:          0 :             lXDiff = GetFlyFrm()->GetAnchorFrm()->Frm().Width() -
     721                 :          0 :                      aFlyRect.Width() - lXDiff;
     722                 :            : 
     723                 :          0 :         const Point aTmp( lXDiff, lYDiff );
     724         [ #  # ]:          0 :         GetFlyFrm()->ChgRelPos( aTmp );
     725                 :            :     }
     726                 :            : 
     727                 :          0 :     SwAttrSet aSet( pFmt->GetDoc()->GetAttrPool(),
     728         [ #  # ]:          0 :                                             RES_VERT_ORIENT, RES_HORI_ORIENT );
     729 [ #  # ][ #  # ]:          0 :     SwFmtHoriOrient aHori( pFmt->GetHoriOrient() );
     730 [ #  # ][ #  # ]:          0 :     SwFmtVertOrient aVert( pFmt->GetVertOrient() );
     731                 :          0 :     sal_Bool bPut = sal_False;
     732                 :            : 
     733 [ #  # ][ #  # ]:          0 :     if( !GetFlyFrm()->IsFlyLayFrm() &&
                 [ #  # ]
     734         [ #  # ]:          0 :         ::GetHtmlMode(pFmt->GetDoc()->GetDocShell()) )
     735                 :            :     {
     736                 :            :         //Im HTML-Modus sind nur automatische Ausrichtungen erlaubt.
     737                 :            :         //Einzig einen Snap auf Links/Rechts bzw. Linker-/Rechter-Rand koennen
     738                 :            :         //wir versuchen.
     739         [ #  # ]:          0 :         const SwFrm* pAnch = GetFlyFrm()->GetAnchorFrm();
     740                 :          0 :         sal_Bool bNextLine = sal_False;
     741                 :            : 
     742 [ #  # ][ #  # ]:          0 :         if( !GetFlyFrm()->IsAutoPos() || text::RelOrientation::PAGE_FRAME != aHori.GetRelationOrient() )
                 [ #  # ]
     743                 :            :         {
     744         [ #  # ]:          0 :             if( text::RelOrientation::CHAR == eRelHori )
     745                 :            :             {
     746                 :          0 :                 aHori.SetHoriOrient( text::HoriOrientation::LEFT );
     747                 :          0 :                 aHori.SetRelationOrient( text::RelOrientation::CHAR );
     748                 :            :             }
     749                 :            :             else
     750                 :            :             {
     751                 :          0 :                 bNextLine = sal_True;
     752                 :            :                 //Horizontale Ausrichtung:
     753                 :            :                 const sal_Bool bLeftFrm =
     754                 :          0 :                     aFlyRect.Left() < pAnch->Frm().Left() + pAnch->Prt().Left(),
     755                 :          0 :                     bLeftPrt = aFlyRect.Left() + aFlyRect.Width() <
     756                 :          0 :                                pAnch->Frm().Left() + pAnch->Prt().Width()/2;
     757 [ #  # ][ #  # ]:          0 :                 if ( bLeftFrm || bLeftPrt )
     758                 :            :                 {
     759                 :          0 :                     aHori.SetHoriOrient( text::HoriOrientation::LEFT );
     760         [ #  # ]:          0 :                     aHori.SetRelationOrient( bLeftFrm ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
     761                 :            :                 }
     762                 :            :                 else
     763                 :            :                 {
     764                 :          0 :                     const sal_Bool bRightFrm = aFlyRect.Left() >
     765                 :          0 :                                        pAnch->Frm().Left() + pAnch->Prt().Width();
     766                 :          0 :                     aHori.SetHoriOrient( text::HoriOrientation::RIGHT );
     767         [ #  # ]:          0 :                     aHori.SetRelationOrient( bRightFrm ? text::RelOrientation::FRAME : text::RelOrientation::PRINT_AREA );
     768                 :            :                 }
     769                 :            :             }
     770         [ #  # ]:          0 :             aSet.Put( aHori );
     771                 :            :         }
     772                 :            :         //Vertikale Ausrichtung bleibt grundsaetzlich schlicht erhalten,
     773                 :            :         //nur bei nicht automatischer Ausrichtung wird umgeschaltet.
     774                 :          0 :         sal_Bool bRelChar = text::RelOrientation::CHAR == eRelVert;
     775                 :            :         aVert.SetVertOrient( eVert != text::VertOrientation::NONE ? eVert :
     776                 :          0 :                 GetFlyFrm()->IsFlyInCntFrm() ? text::VertOrientation::CHAR_CENTER :
     777   [ #  #  #  # ]:          0 :                 bRelChar && bNextLine ? text::VertOrientation::CHAR_TOP : text::VertOrientation::TOP );
         [ #  # ][ #  # ]
     778         [ #  # ]:          0 :         if( bRelChar )
     779                 :          0 :             aVert.SetRelationOrient( text::RelOrientation::CHAR );
     780                 :            :         else
     781                 :          0 :             aVert.SetRelationOrient( text::RelOrientation::PRINT_AREA );
     782         [ #  # ]:          0 :         aSet.Put( aVert );
     783                 :          0 :         bPut = sal_True;
     784                 :            :     }
     785                 :            : 
     786                 :            :     //Automatische Ausrichtungen wollen wir moeglichst nicht verlieren.
     787 [ #  # ][ #  # ]:          0 :     if ( !bPut && bInResize )
     788                 :            :     {
     789         [ #  # ]:          0 :         if ( text::HoriOrientation::NONE != eHori )
     790                 :            :         {
     791                 :          0 :             aHori.SetHoriOrient( eHori );
     792                 :          0 :             aHori.SetRelationOrient( eRelHori );
     793         [ #  # ]:          0 :             aSet.Put( aHori );
     794                 :          0 :             bPut = sal_True;
     795                 :            :         }
     796         [ #  # ]:          0 :         if ( text::VertOrientation::NONE != eVert )
     797                 :            :         {
     798                 :          0 :             aVert.SetVertOrient( eVert );
     799                 :          0 :             aVert.SetRelationOrient( eRelVert );
     800         [ #  # ]:          0 :             aSet.Put( aVert );
     801                 :          0 :             bPut = sal_True;
     802                 :            :         }
     803                 :            :     }
     804         [ #  # ]:          0 :     if ( bPut )
     805 [ #  # ][ #  # ]:          0 :         pFmt->SetFmtAttr( aSet );
         [ #  # ][ #  # ]
     806                 :          0 : }
     807                 :            : 
     808                 :            : 
     809                 :          0 : void SwVirtFlyDrawObj::NbcResize(const Point& rRef,
     810                 :            :             const Fraction& xFact, const Fraction& yFact)
     811                 :            : {
     812         [ #  # ]:          0 :     ResizeRect( aOutRect, rRef, xFact, yFact );
     813                 :            : 
     814         [ #  # ]:          0 :     const SwFrm* pTmpFrm = GetFlyFrm()->GetAnchorFrm();
     815         [ #  # ]:          0 :     if( !pTmpFrm )
     816                 :          0 :         pTmpFrm = GetFlyFrm();
     817         [ #  # ]:          0 :     const bool bVertX = pTmpFrm->IsVertical();
     818                 :            : 
     819         [ #  # ]:          0 :     const sal_Bool bRTL = pTmpFrm->IsRightToLeft();
     820                 :            : 
     821                 :            :     //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
     822                 :          0 :     const bool bVertL2RX = pTmpFrm->IsVertLR();
     823                 :          0 :     const Point aNewPos( ( bVertX && !bVertL2RX ) || bRTL ?
     824                 :          0 :                          aOutRect.Right() + 1 :
     825                 :          0 :                          aOutRect.Left(),
     826 [ #  # ][ #  # ]:          0 :                          aOutRect.Top() );
                 [ #  # ]
     827                 :            : 
     828                 :          0 :     Size aSz( aOutRect.Right() - aOutRect.Left() + 1,
     829                 :          0 :               aOutRect.Bottom()- aOutRect.Top()  + 1 );
     830         [ #  # ]:          0 :     if( aSz != GetFlyFrm()->Frm().SSize() )
     831                 :            :     {
     832                 :            :         //Die Breite darf bei Spalten nicht zu schmal werden
     833 [ #  # ][ #  # ]:          0 :         if ( GetFlyFrm()->Lower() && GetFlyFrm()->Lower()->IsColumnFrm() )
                 [ #  # ]
     834                 :            :         {
     835         [ #  # ]:          0 :             SwBorderAttrAccess aAccess( SwFrm::GetCache(), GetFlyFrm() );
     836         [ #  # ]:          0 :             const SwBorderAttrs &rAttrs = *aAccess.Get();
     837 [ #  # ][ #  # ]:          0 :             long nMin = rAttrs.CalcLeftLine()+rAttrs.CalcRightLine();
     838         [ #  # ]:          0 :             const SwFmtCol& rCol = rAttrs.GetAttrSet().GetCol();
     839         [ #  # ]:          0 :             if ( rCol.GetColumns().size() > 1 )
     840                 :            :             {
     841         [ #  # ]:          0 :                 for ( sal_uInt16 i = 0; i < rCol.GetColumns().size(); ++i )
     842                 :            :                 {
     843         [ #  # ]:          0 :                     nMin += rCol.GetColumns()[i].GetLeft() +
     844         [ #  # ]:          0 :                             rCol.GetColumns()[i].GetRight() +
     845                 :          0 :                             MINFLY;
     846                 :            :                 }
     847                 :          0 :                 nMin -= MINFLY;
     848                 :            :             }
     849         [ #  # ]:          0 :             aSz.Width() = Max( aSz.Width(), nMin );
     850                 :            :         }
     851                 :            : 
     852         [ #  # ]:          0 :         SwFrmFmt *pFmt = GetFmt();
     853 [ #  # ][ #  # ]:          0 :         const SwFmtFrmSize aOldFrmSz( pFmt->GetFrmSize() );
     854         [ #  # ]:          0 :         GetFlyFrm()->ChgSize( aSz );
     855 [ #  # ][ #  # ]:          0 :         SwFmtFrmSize aFrmSz( pFmt->GetFrmSize() );
     856 [ #  # ][ #  # ]:          0 :         if ( aFrmSz.GetWidthPercent() || aFrmSz.GetHeightPercent() )
                 [ #  # ]
     857                 :            :         {
     858                 :            :             long nRelWidth, nRelHeight;
     859                 :          0 :             const SwFrm *pRel = GetFlyFrm()->IsFlyLayFrm() ?
     860                 :          0 :                                 GetFlyFrm()->GetAnchorFrm() :
     861         [ #  # ]:          0 :                                 GetFlyFrm()->GetAnchorFrm()->GetUpper();
           [ #  #  #  # ]
     862                 :          0 :             const ViewShell *pSh = GetFlyFrm()->getRootFrm()->GetCurrShell();
     863   [ #  #  #  # ]:          0 :             if ( pSh && pRel->IsBodyFrm() &&
         [ #  # ][ #  # ]
                 [ #  # ]
     864                 :          0 :                  pSh->GetViewOptions()->getBrowseMode() &&
     865         [ #  # ]:          0 :                  pSh->VisArea().HasArea() )
     866                 :            :             {
     867         [ #  # ]:          0 :                 nRelWidth  = pSh->GetBrowseWidth();
     868                 :          0 :                 nRelHeight = pSh->VisArea().Height();
     869 [ #  # ][ #  # ]:          0 :                 const Size aBorder = pSh->GetOut()->PixelToLogic( pSh->GetBrowseBorder() );
     870                 :          0 :                 nRelHeight -= 2*aBorder.Height();
     871                 :            :             }
     872                 :            :             else
     873                 :            :             {
     874                 :          0 :                 nRelWidth  = pRel->Prt().Width();
     875                 :          0 :                 nRelHeight = pRel->Prt().Height();
     876                 :            :             }
     877         [ #  # ]:          0 :             if ( aFrmSz.GetWidthPercent() && aFrmSz.GetWidthPercent() != 0xFF &&
           [ #  #  #  # ]
                 [ #  # ]
     878                 :          0 :                  aOldFrmSz.GetWidth() != aFrmSz.GetWidth() )
     879                 :          0 :                 aFrmSz.SetWidthPercent( sal_uInt8(aSz.Width() * 100L / nRelWidth + 0.5) );
     880         [ #  # ]:          0 :             if ( aFrmSz.GetHeightPercent() && aFrmSz.GetHeightPercent() != 0xFF &&
           [ #  #  #  # ]
                 [ #  # ]
     881                 :          0 :                  aOldFrmSz.GetHeight() != aFrmSz.GetHeight() )
     882                 :          0 :                 aFrmSz.SetHeightPercent( sal_uInt8(aSz.Height() * 100L / nRelHeight + 0.5) );
     883         [ #  # ]:          0 :             pFmt->GetDoc()->SetAttr( aFrmSz, *pFmt );
     884 [ #  # ][ #  # ]:          0 :         }
     885                 :            :     }
     886                 :            : 
     887                 :            :     //Position kann auch veraendert sein!
     888                 :          0 :     const Point aOldPos( ( bVertX && !bVertL2RX ) || bRTL ?
     889                 :          0 :                          GetFlyFrm()->Frm().TopRight() :
     890 [ #  # ][ #  # ]:          0 :                          GetFlyFrm()->Frm().Pos() );
           [ #  #  #  # ]
     891         [ #  # ]:          0 :     if ( aNewPos != aOldPos )
     892                 :            :     {
     893                 :            :         //Kann sich durch das ChgSize veraendert haben!
     894 [ #  # ][ #  # ]:          0 :         if( bVertX || bRTL )
     895                 :            :         {
     896 [ #  # ][ #  # ]:          0 :             if( aOutRect.TopRight() != aNewPos )
     897                 :            :             {
     898                 :            :                 //Badaa: 2008-04-18 * Support for Classical Mongolian Script (SCMS) joint with Jiayanmin
     899                 :            :                 SwTwips nDeltaX;
     900         [ #  # ]:          0 :                 if ( bVertL2RX )
     901                 :          0 :                     nDeltaX = aNewPos.X() - aOutRect.Left();
     902                 :            :                 else
     903                 :          0 :                     nDeltaX = aNewPos.X() - aOutRect.Right();
     904                 :          0 :                 SwTwips nDeltaY = aNewPos.Y() - aOutRect.Top();
     905         [ #  # ]:          0 :                 MoveRect( aOutRect, Size( nDeltaX, nDeltaY ) );
     906                 :          0 :             }
     907                 :            :         }
     908         [ #  # ]:          0 :         else if ( aOutRect.TopLeft() != aNewPos )
     909                 :          0 :             aOutRect.SetPos( aNewPos );
     910                 :          0 :         bInResize = sal_True;
     911         [ #  # ]:          0 :         NbcMove( Size( 0, 0 ) );
     912                 :          0 :         bInResize = sal_False;
     913                 :            :     }
     914                 :          0 : }
     915                 :            : 
     916                 :            : 
     917                 :          0 : void SwVirtFlyDrawObj::Move(const Size& rSiz)
     918                 :            : {
     919                 :          0 :     NbcMove( rSiz );
     920                 :          0 :     SetChanged();
     921                 :          0 :     GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
     922                 :          0 : }
     923                 :            : 
     924                 :            : 
     925                 :          0 : void SwVirtFlyDrawObj::Resize(const Point& rRef,
     926                 :            :                     const Fraction& xFact, const Fraction& yFact)
     927                 :            : {
     928                 :          0 :     NbcResize( rRef, xFact, yFact );
     929                 :          0 :     SetChanged();
     930                 :          0 :     GetFmt()->GetDoc()->GetIDocumentUndoRedo().DoDrawUndo(false);
     931                 :          0 : }
     932                 :            : 
     933                 :            : 
     934                 :          0 : Pointer  SwVirtFlyDrawObj::GetMacroPointer(
     935                 :            :     const SdrObjMacroHitRec& ) const
     936                 :            : {
     937                 :          0 :     return Pointer( POINTER_REFHAND );
     938                 :            : }
     939                 :            : 
     940                 :            : 
     941                 :          0 : bool SwVirtFlyDrawObj::HasMacro() const
     942                 :            : {
     943                 :          0 :     const SwFmtURL &rURL = pFlyFrm->GetFmt()->GetURL();
     944 [ #  # ][ #  # ]:          0 :     return rURL.GetMap() || rURL.GetURL().Len();
     945                 :            : }
     946                 :            : 
     947                 :            : 
     948                 :          0 : SdrObject* SwVirtFlyDrawObj::CheckMacroHit( const SdrObjMacroHitRec& rRec ) const
     949                 :            : {
     950                 :          0 :     const SwFmtURL &rURL = pFlyFrm->GetFmt()->GetURL();
     951 [ #  # ][ #  # ]:          0 :     if( rURL.GetMap() || rURL.GetURL().Len() )
                 [ #  # ]
     952                 :            :     {
     953                 :          0 :         SwRect aRect;
     954 [ #  # ][ #  # ]:          0 :         if ( pFlyFrm->Lower() && pFlyFrm->Lower()->IsNoTxtFrm() )
                 [ #  # ]
     955                 :            :         {
     956                 :          0 :             aRect = pFlyFrm->Prt();
     957                 :          0 :             aRect += pFlyFrm->Frm().Pos();
     958                 :            :         }
     959                 :            :         else
     960                 :          0 :             aRect = pFlyFrm->Frm();
     961                 :            : 
     962 [ #  # ][ #  # ]:          0 :         if( aRect.IsInside( rRec.aPos ) )
     963                 :            :         {
     964                 :          0 :             SwRect aActRect( aRect );
     965                 :          0 :             aRect.Pos().X() += rRec.nTol;
     966                 :          0 :             aRect.Pos().Y() += rRec.nTol;
     967                 :          0 :             aRect.SSize().Height()-= 2 * rRec.nTol;
     968                 :          0 :             aRect.SSize().Width() -= 2 * rRec.nTol;
     969                 :            : 
     970 [ #  # ][ #  # ]:          0 :             if( aRect.IsInside( rRec.aPos ) )
     971                 :            :             {
     972 [ #  # ][ #  # ]:          0 :                 if( !rURL.GetMap() ||
                 [ #  # ]
     973 [ #  # ][ #  # ]:          0 :                     pFlyFrm->GetFmt()->GetIMapObject( rRec.aPos, pFlyFrm ))
     974                 :          0 :                     return (SdrObject*)this;
     975                 :            : 
     976                 :          0 :                 return 0;
     977                 :            :             }
     978                 :            :         }
     979                 :            :     }
     980                 :          0 :     return SdrObject::CheckMacroHit( rRec );
     981                 :            : }
     982                 :            : 
     983                 :          0 : bool SwVirtFlyDrawObj::supportsFullDrag() const
     984                 :            : {
     985                 :            :     // call parent
     986                 :          0 :     return SdrVirtObj::supportsFullDrag();
     987                 :            : }
     988                 :            : 
     989                 :          0 : SdrObject* SwVirtFlyDrawObj::getFullDragClone() const
     990                 :            : {
     991                 :            :     // call parent
     992                 :          0 :     return SdrVirtObj::getFullDragClone();
     993                 :            : }
     994                 :            : 
     995                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10