LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofgraphic.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 118 147 80.3 %
Date: 2015-06-13 12:38:46 Functions: 11 12 91.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <sdr/contact/viewcontactofgraphic.hxx>
      21             : #include <sdr/contact/viewobjectcontactofgraphic.hxx>
      22             : #include <svx/svdograf.hxx>
      23             : #include <svx/sdr/primitive2d/sdrattributecreator.hxx>
      24             : #include <svl/itemset.hxx>
      25             : 
      26             : #include <svx/sdgcpitm.hxx>
      27             : #include <svx/sdr/contact/displayinfo.hxx>
      28             : #include <svx/sdr/contact/viewobjectcontact.hxx>
      29             : #include <svx/sdr/contact/objectcontact.hxx>
      30             : #include <basegfx/matrix/b2dhommatrix.hxx>
      31             : #include <sdr/primitive2d/sdrgrafprimitive2d.hxx>
      32             : #include "svx/svdstr.hrc"
      33             : #include <svdglob.hxx>
      34             : #include <vcl/svapp.hxx>
      35             : #include <vcl/settings.hxx>
      36             : #include <basegfx/polygon/b2dpolygontools.hxx>
      37             : #include <drawinglayer/primitive2d/polygonprimitive2d.hxx>
      38             : #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx>
      39             : #include <drawinglayer/primitive2d/textprimitive2d.hxx>
      40             : #include <drawinglayer/primitive2d/textlayoutdevice.hxx>
      41             : #include <drawinglayer/primitive2d/maskprimitive2d.hxx>
      42             : #include <sdr/primitive2d/sdrtextprimitive2d.hxx>
      43             : #include <editeng/eeitem.hxx>
      44             : #include <editeng/colritem.hxx>
      45             : #include <basegfx/matrix/b2dhommatrixtools.hxx>
      46             : #include <drawinglayer/primitive2d/sdrdecompositiontools2d.hxx>
      47             : 
      48             : #include "eventhandler.hxx"
      49             : 
      50             : namespace sdr
      51             : {
      52             :     namespace contact
      53             :     {
      54             :         // Create a Object-Specific ViewObjectContact, set ViewContact and
      55             :         // ObjectContact. Always needs to return something.
      56         181 :         ViewObjectContact& ViewContactOfGraphic::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      57             :         {
      58         181 :             ViewObjectContact* pRetval = new ViewObjectContactOfGraphic(rObjectContact, *this);
      59             :             DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      60             : 
      61         181 :             return *pRetval;
      62             :         }
      63             : 
      64         825 :         ViewContactOfGraphic::ViewContactOfGraphic(SdrGrafObj& rGrafObj)
      65         825 :         :   ViewContactOfTextObj(rGrafObj)
      66             :         {
      67         825 :         }
      68             : 
      69        1646 :         ViewContactOfGraphic::~ViewContactOfGraphic()
      70             :         {
      71        1646 :         }
      72             : 
      73         111 :         void ViewContactOfGraphic::flushGraphicObjects()
      74             :         {
      75             :             // #i102380# The graphic is swapped out. To let that have an effect ist is necessary to
      76             :             // delete copies of the GraphicObject which are not swapped out and have no SwapHandler set
      77             :             // (this is what happnes when the GraphicObject gets copied to a SdrGrafPrimitive2D). This
      78             :             // is best achieved for the VC by clearing the local decomposition cache. It would be possible
      79             :             // to also do this for the VOC cache, but that VOCs exist exactly expresss that the object
      80             :             // gets visualised, so this would be wrong.
      81         111 :             flushViewIndependentPrimitive2DSequence();
      82         111 :         }
      83             : 
      84           0 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForPresObj(
      85             :             const basegfx::B2DHomMatrix& rObjectMatrix,
      86             :             const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
      87             :         {
      88           0 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
      89           0 :             GraphicObject aEmptyGraphicObject;
      90           0 :             GraphicAttr aEmptyGraphicAttr;
      91             : 
      92             :             // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
      93             :             const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
      94             :                 rObjectMatrix,
      95             :                 rAttribute,
      96             :                 aEmptyGraphicObject,
      97           0 :                 aEmptyGraphicAttr));
      98           0 :             xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
      99             : 
     100             :             // SdrGrafPrimitive2D with content (which is the preview graphic) scaled to smaller size and
     101             :             // without attributes
     102           0 :             basegfx::B2DHomMatrix aSmallerMatrix;
     103             : 
     104             :             // #i94431# for some reason, i forgot to take the PrefMapMode of the graphic
     105             :             // into account. Since EmptyPresObj's are only used in Draw/Impress, it is
     106             :             // safe to assume 100th mm as target.
     107           0 :             Size aPrefSize(GetGrafObject().GetGrafPrefSize());
     108             : 
     109           0 :             if(MAP_PIXEL == GetGrafObject().GetGrafPrefMapMode().GetMapUnit())
     110             :             {
     111           0 :                 aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aPrefSize, MAP_100TH_MM);
     112             :             }
     113             :             else
     114             :             {
     115           0 :                 aPrefSize = OutputDevice::LogicToLogic(aPrefSize, GetGrafObject().GetGrafPrefMapMode(), MAP_100TH_MM);
     116             :             }
     117             : 
     118             :             // decompose object matrix to get single values
     119           0 :             basegfx::B2DVector aScale, aTranslate;
     120             :             double fRotate, fShearX;
     121           0 :             rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
     122             : 
     123           0 :             const double fOffsetX((aScale.getX() - aPrefSize.getWidth()) / 2.0);
     124           0 :             const double fOffsetY((aScale.getY() - aPrefSize.getHeight()) / 2.0);
     125             : 
     126           0 :             if(basegfx::fTools::moreOrEqual(fOffsetX, 0.0) && basegfx::fTools::moreOrEqual(fOffsetY, 0.0))
     127             :             {
     128             :                 // create the EmptyPresObj fallback visualisation. The fallback graphic
     129             :                 // is already provided in rGraphicObject in this case, use it
     130           0 :                 aSmallerMatrix = basegfx::tools::createScaleTranslateB2DHomMatrix(aPrefSize.getWidth(), aPrefSize.getHeight(), fOffsetX, fOffsetY);
     131             :                 aSmallerMatrix = basegfx::tools::createShearXRotateTranslateB2DHomMatrix(fShearX, fRotate, aTranslate)
     132           0 :                     * aSmallerMatrix;
     133             : 
     134           0 :                 const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
     135           0 :                 const GraphicAttr aLocalGrafInfo;
     136             :                 const drawinglayer::primitive2d::Primitive2DReference xReferenceB(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
     137             :                     aSmallerMatrix,
     138             :                     drawinglayer::attribute::SdrLineFillShadowTextAttribute(),
     139             :                     rGraphicObject,
     140           0 :                     aLocalGrafInfo));
     141             : 
     142           0 :                 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval, xReferenceB);
     143             :             }
     144             : 
     145           0 :             return xRetval;
     146             :         }
     147             : 
     148         346 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft(
     149             :             const basegfx::B2DHomMatrix& rObjectMatrix,
     150             :             const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
     151             :         {
     152         346 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     153         692 :             GraphicObject aEmptyGraphicObject;
     154         692 :             GraphicAttr aEmptyGraphicAttr;
     155             : 
     156             :             // SdrGrafPrimitive2D without content in original size which carries all eventual attributes and texts
     157             :             const drawinglayer::primitive2d::Primitive2DReference xReferenceA(new drawinglayer::primitive2d::SdrGrafPrimitive2D(
     158             :                 rObjectMatrix,
     159             :                 rAttribute,
     160             :                 aEmptyGraphicObject,
     161         692 :                 aEmptyGraphicAttr));
     162         346 :             xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
     163             : 
     164         346 :             if(rAttribute.getLine().isDefault())
     165             :             {
     166             :                 // create a surrounding frame when no linestyle given
     167         346 :                 const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
     168         346 :                 const basegfx::BColor aBColor(aColor.getBColor());
     169         692 :                 basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
     170         346 :                 aOutline.transform(rObjectMatrix);
     171             : 
     172             :                 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
     173             :                     drawinglayer::primitive2d::Primitive2DReference(
     174             :                         new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
     175             :                             aOutline,
     176         692 :                             aBColor)));
     177             :             }
     178             : 
     179             :             // decompose object matrix to get single values
     180         692 :             basegfx::B2DVector aScale, aTranslate;
     181             :             double fRotate, fShearX;
     182         346 :             rObjectMatrix.decompose(aScale, aTranslate, fRotate, fShearX);
     183             : 
     184             :             // define a distance value, used for distance from bitmap to borders and from bitmap
     185             :             // to text, too (2 mm)
     186         346 :             const double fDistance(200.0);
     187             : 
     188             :             // consume borders from values
     189         346 :             aScale.setX(std::max(0.0, aScale.getX() - (2.0 * fDistance)));
     190         346 :             aScale.setY(std::max(0.0, aScale.getY() - (2.0 * fDistance)));
     191         346 :             aTranslate.setX(aTranslate.getX() + fDistance);
     192         346 :             aTranslate.setY(aTranslate.getY() + fDistance);
     193             : 
     194             :             // draw a draft bitmap
     195         692 :             const Bitmap aDraftBitmap(ResId(BMAP_GrafikEi, *ImpGetResMgr()));
     196             : 
     197         346 :             if(!aDraftBitmap.IsEmpty())
     198             :             {
     199         346 :                 Size aPrefSize(aDraftBitmap.GetPrefSize());
     200             : 
     201         346 :                 if(MAP_PIXEL == aDraftBitmap.GetPrefMapMode().GetMapUnit())
     202             :                 {
     203         346 :                     aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aDraftBitmap.GetSizePixel(), MAP_100TH_MM);
     204             :                 }
     205             :                 else
     206             :                 {
     207           0 :                     aPrefSize = OutputDevice::LogicToLogic(aPrefSize, aDraftBitmap.GetPrefMapMode(), MAP_100TH_MM);
     208             :                 }
     209             : 
     210         346 :                 const double fBitmapScaling(2.0);
     211         346 :                 const double fWidth(aPrefSize.getWidth() * fBitmapScaling);
     212         346 :                 const double fHeight(aPrefSize.getHeight() * fBitmapScaling);
     213             : 
     214        1384 :                 if(basegfx::fTools::more(fWidth, 1.0)
     215         692 :                     && basegfx::fTools::more(fHeight, 1.0)
     216         692 :                     && basegfx::fTools::lessOrEqual(fWidth, aScale.getX())
     217        1424 :                     && basegfx::fTools::lessOrEqual(fHeight, aScale.getY()))
     218             :                 {
     219             :                     const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     220          18 :                         fWidth, fHeight, fShearX, fRotate, aTranslate.getX(), aTranslate.getY()));
     221             : 
     222             :                     drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
     223             :                         drawinglayer::primitive2d::Primitive2DReference(
     224             :                             new drawinglayer::primitive2d::BitmapPrimitive2D(
     225             :                                 BitmapEx(aDraftBitmap),
     226          18 :                                 aBitmapMatrix)));
     227             : 
     228             :                     // consume bitmap size in X
     229          18 :                     aScale.setX(std::max(0.0, aScale.getX() - (fWidth + fDistance)));
     230          18 :                     aTranslate.setX(aTranslate.getX() + fWidth + fDistance);
     231             :                 }
     232             :             }
     233             : 
     234             :             // Build the text for the draft object
     235         692 :             OUString aDraftText = GetGrafObject().GetFileName();
     236             : 
     237         346 :             if (aDraftText.isEmpty())
     238             :             {
     239         341 :                 aDraftText = GetGrafObject().GetName();
     240         341 :                 aDraftText += " ...";
     241             :             }
     242             : 
     243         346 :             if (!aDraftText.isEmpty() && GetGrafObject().GetModel())
     244             :             {
     245             :                 // #i103255# Goal is to produce TextPrimitives which hold the given text as
     246             :                 // BlockText in the available space. It would be very tricky to do
     247             :                 // an own word wrap/line layout here.
     248             :                 // Using SdrBlockTextPrimitive2D OTOH is critical since it internally
     249             :                 // uses the SdrObject it references. To solve this, create a temp
     250             :                 // SdrObject with Attributes and Text, generate a SdrBlockTextPrimitive2D
     251             :                 // directly and immediately decompose it. After that, it is no longer
     252             :                 // needed and can be deleted.
     253             : 
     254             :                 // create temp RectObj as TextObj and set needed attributes
     255         346 :                 SdrRectObj aRectObj(OBJ_TEXT);
     256         346 :                 aRectObj.SetModel(GetGrafObject().GetModel());
     257         346 :                 aRectObj.NbcSetText(aDraftText);
     258         346 :                 aRectObj.SetMergedItem(SvxColorItem(Color(COL_LIGHTRED), EE_CHAR_COLOR));
     259             : 
     260             :                 // get SdrText and OPO
     261         346 :                 SdrText* pSdrText = aRectObj.getText(0);
     262         346 :                 OutlinerParaObject* pOPO = aRectObj.GetOutlinerParaObject();
     263             : 
     264         346 :                 if(pSdrText && pOPO)
     265             :                 {
     266             :                     // directly use the remaining space as TextRangeTransform
     267             :                     const basegfx::B2DHomMatrix aTextRangeTransform(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     268         346 :                         aScale, fShearX, fRotate, aTranslate));
     269             : 
     270             :                     // directly create temp SdrBlockTextPrimitive2D
     271             :                     drawinglayer::primitive2d::SdrBlockTextPrimitive2D aBlockTextPrimitive(
     272             :                         pSdrText,
     273             :                         *pOPO,
     274             :                         aTextRangeTransform,
     275             :                         SDRTEXTHORZADJUST_LEFT,
     276             :                         SDRTEXTVERTADJUST_TOP,
     277             :                         false,
     278             :                         false,
     279             :                         false,
     280             :                         false,
     281         692 :                         false);
     282             : 
     283             :                     // decompose immediately with neutral ViewInformation. This will
     284             :                     // layout the text to more simple TextPrimitives from drawinglayer
     285         692 :                     const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
     286             : 
     287             :                     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
     288             :                         xRetval,
     289         692 :                         aBlockTextPrimitive.get2DDecomposition(aViewInformation2D));
     290         346 :                 }
     291             :             }
     292             : 
     293         692 :             return xRetval;
     294             :         }
     295             : 
     296        1182 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
     297             :         {
     298        1182 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     299        1182 :             const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
     300             : 
     301             :             // create and fill GraphicAttr
     302        2364 :             GraphicAttr aLocalGrafInfo;
     303        1182 :             const sal_uInt16 nTrans(static_cast<const SdrGrafTransparenceItem&>(rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue());
     304        1182 :             const SdrGrafCropItem& rCrop(static_cast<const SdrGrafCropItem&>(rItemSet.Get(SDRATTR_GRAFCROP)));
     305        1182 :             aLocalGrafInfo.SetLuminance(static_cast<const SdrGrafLuminanceItem&>(rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue());
     306        1182 :             aLocalGrafInfo.SetContrast(static_cast<const SdrGrafContrastItem&>(rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue());
     307        1182 :             aLocalGrafInfo.SetChannelR(static_cast<const SdrGrafRedItem&>(rItemSet.Get(SDRATTR_GRAFRED)).GetValue());
     308        1182 :             aLocalGrafInfo.SetChannelG(static_cast<const SdrGrafGreenItem&>(rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue());
     309        1182 :             aLocalGrafInfo.SetChannelB(static_cast<const SdrGrafBlueItem&>(rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue());
     310        1182 :             aLocalGrafInfo.SetGamma(static_cast<const SdrGrafGamma100Item&>(rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01);
     311        1182 :             aLocalGrafInfo.SetTransparency((sal_uInt8)::basegfx::fround(std::min(nTrans, (sal_uInt16)100) * 2.55));
     312        1182 :             aLocalGrafInfo.SetInvert(static_cast<const SdrGrafInvertItem&>(rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue());
     313        1182 :             aLocalGrafInfo.SetDrawMode(static_cast<const SdrGrafModeItem&>(rItemSet.Get(SDRATTR_GRAFMODE)).GetValue());
     314        1182 :             aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom());
     315             : 
     316             :             // we have content if graphic is not completely transparent
     317        1182 :             const bool bHasContent(255L != aLocalGrafInfo.GetTransparency());
     318             :             drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
     319             :                 drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
     320             :                     rItemSet,
     321        2364 :                     GetGrafObject().getText(0),
     322        4728 :                     bHasContent));
     323             : 
     324             :             // take unrotated snap rect for position and size. Directly use model data, not getBoundRect() or getSnapRect()
     325             :             // which will use the primitive data we just create in the near future
     326        1182 :             Rectangle rRectangle = GetGrafObject().GetGeoRect();
     327             :             // Hack for calc, transform position of object according
     328             :             // to current zoom so as objects relative position to grid
     329             :             // appears stable
     330        1182 :             rRectangle += GetGrafObject().GetGridOffset();
     331             :             const ::basegfx::B2DRange aObjectRange(
     332        2364 :                 rRectangle.Left(), rRectangle.Top(),
     333        3546 :                 rRectangle.Right(), rRectangle.Bottom());
     334             : 
     335             :             // look for mirroring
     336        1182 :             const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
     337        1182 :             const sal_Int32 nRotationAngle(rGeoStat.nRotationAngle);
     338        1182 :             const bool bRota180(18000 == nRotationAngle);
     339        1182 :             const bool bMirrored(GetGrafObject().IsMirrored());
     340        1182 :             const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
     341        1182 :             bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
     342        1182 :             bool bVMirr((3 == nMirrorCase ) || (4 == nMirrorCase));
     343             : 
     344             :             // set mirror flags at LocalGrafInfo. Take into account that the geometry in
     345             :             // aObjectRange is already changed and rotated when bRota180 is used. To rebuild
     346             :             // that old behaviour (as long as part of the model data), correct the H/V flags
     347             :             // accordingly. The created bitmapPrimitive WILL use the rotation, too.
     348        1182 :             if(bRota180)
     349             :             {
     350             :                 // if bRota180 which is used for vertical mirroring, the graphic will already be rotated
     351             :                 // by 180 degrees. To correct, switch off VMirror and invert HMirroring.
     352           0 :                 bHMirr = !bHMirr;
     353           0 :                 bVMirr = false;
     354             :             }
     355             : 
     356        1182 :             if(bHMirr || bVMirr)
     357             :             {
     358           0 :                 aLocalGrafInfo.SetMirrorFlags((bHMirr ? BmpMirrorFlags::Horizontal : BmpMirrorFlags::NONE)|(bVMirr ? BmpMirrorFlags::Vertical : BmpMirrorFlags::NONE));
     359             :             }
     360             : 
     361             :             // fill object matrix
     362        1182 :             const double fShearX(rGeoStat.nShearAngle ? tan((36000 - rGeoStat.nShearAngle) * F_PI18000) : 0.0);
     363        1182 :             const double fRotate(nRotationAngle ? (36000 - nRotationAngle) * F_PI18000 : 0.0);
     364             :             const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     365             :                 aObjectRange.getWidth(), aObjectRange.getHeight(),
     366             :                 fShearX, fRotate,
     367        2364 :                 aObjectRange.getMinX(), aObjectRange.getMinY()));
     368             : 
     369             :             // get the current, unchenged graphic obect from SdrGrafObj
     370        1182 :             const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
     371             : 
     372        1182 :             if(visualisationUsesPresObj())
     373             :             {
     374             :                 // it's an EmptyPresObj, create the SdrGrafPrimitive2D without content and another scaled one
     375             :                 // with the content which is the placeholder graphic
     376           0 :                 xRetval = createVIP2DSForPresObj(aObjectMatrix, aAttribute);
     377             :             }
     378             : #ifndef IOS // Enforce swap-in for tiled rendering for now, while we have no delayed updating mechanism
     379        1182 :             else if(visualisationUsesDraft())
     380             :             {
     381             :                 // #i102380# The graphic is swapped out. To not force a swap-in here, there is a mechanism
     382             :                 // which shows a swapped-out-visualisation (which gets created here now) and an asynchronious
     383             :                 // visual update mechanism for swapped-out grapgics when they were loaded (see AsynchGraphicLoadingEvent
     384             :                 // and ViewObjectContactOfGraphic implementation). Not forcing the swap-in here allows faster
     385             :                 // (non-blocking) processing here and thus in the effect e.g. fast scrolling through pages
     386         346 :                 xRetval = createVIP2DSForDraft(aObjectMatrix, aAttribute);
     387             :             }
     388             : #endif
     389             :             else
     390             :             {
     391             :                 // create primitive. Info: Calling the copy-constructor of GraphicObject in this
     392             :                 // SdrGrafPrimitive2D constructor will force a full swap-in of the graphic
     393             :                 const drawinglayer::primitive2d::Primitive2DReference xReference(
     394             :                     new drawinglayer::primitive2d::SdrGrafPrimitive2D(
     395             :                         aObjectMatrix,
     396             :                         aAttribute,
     397             :                         rGraphicObject,
     398         836 :                         aLocalGrafInfo));
     399             : 
     400         836 :                 xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReference, 1);
     401             :             }
     402             : 
     403             :             // always append an invisible outline for the cases where no visible content exists
     404             :             drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
     405             :                 drawinglayer::primitive2d::createHiddenGeometryPrimitives2D(
     406        1182 :                     false, aObjectMatrix));
     407             : 
     408        2364 :             return xRetval;
     409             :         }
     410             : 
     411        2564 :         bool ViewContactOfGraphic::visualisationUsesPresObj() const
     412             :         {
     413        2564 :             return GetGrafObject().IsEmptyPresObj();
     414             :         }
     415             : 
     416        1382 :         bool ViewContactOfGraphic::visualisationUsesDraft() const
     417             :         {
     418             :             // no draft when already PresObj
     419        1382 :             if(visualisationUsesPresObj())
     420           0 :                 return false;
     421             : 
     422             :             // draft when swapped out
     423        1382 :             const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
     424             :             static bool bAllowReplacements(true);
     425             : 
     426        1382 :             if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
     427          56 :                 return true;
     428             : 
     429             :             // draft when no graphic
     430        1326 :             if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
     431         296 :                return true;
     432             : 
     433        1030 :             return false;
     434             :         }
     435             : 
     436             :     } // end of namespace contact
     437         435 : } // end of namespace sdr
     438             : 
     439             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11