LCOV - code coverage report
Current view: top level - svx/source/sdr/contact - viewcontactofgraphic.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 146 0.0 %
Date: 2014-04-14 Functions: 0 10 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  * This file incorporates work covered by the following license notice:
      10             :  *
      11             :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12             :  *   contributor license agreements. See the NOTICE file distributed
      13             :  *   with this work for additional information regarding copyright
      14             :  *   ownership. The ASF licenses this file to you under the Apache
      15             :  *   License, Version 2.0 (the "License"); you may not use this file
      16             :  *   except in compliance with the License. You may obtain a copy of
      17             :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18             :  */
      19             : 
      20             : #include <svx/sdr/contact/viewcontactofgraphic.hxx>
      21             : #include <svx/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 <svx/sdr/primitive2d/sdrgrafprimitive2d.hxx>
      32             : #include "svx/svdstr.hrc"
      33             : #include <svx/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 <svx/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           0 :         ViewObjectContact& ViewContactOfGraphic::CreateObjectSpecificViewObjectContact(ObjectContact& rObjectContact)
      57             :         {
      58           0 :             ViewObjectContact* pRetval = new ViewObjectContactOfGraphic(rObjectContact, *this);
      59             :             DBG_ASSERT(pRetval, "ViewContact::CreateObjectSpecificViewObjectContact() failed (!)");
      60             : 
      61           0 :             return *pRetval;
      62             :         }
      63             : 
      64           0 :         ViewContactOfGraphic::ViewContactOfGraphic(SdrGrafObj& rGrafObj)
      65           0 :         :   ViewContactOfTextObj(rGrafObj)
      66             :         {
      67           0 :         }
      68             : 
      69           0 :         ViewContactOfGraphic::~ViewContactOfGraphic()
      70             :         {
      71           0 :         }
      72             : 
      73           0 :         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           0 :             flushViewIndependentPrimitive2DSequence();
      82           0 :         }
      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 = Application::GetDefaultDevice()->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           0 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createVIP2DSForDraft(
     149             :             const basegfx::B2DHomMatrix& rObjectMatrix,
     150             :             const drawinglayer::attribute::SdrLineFillShadowTextAttribute& rAttribute) const
     151             :         {
     152           0 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     153           0 :             GraphicObject aEmptyGraphicObject;
     154           0 :             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           0 :                 aEmptyGraphicAttr));
     162           0 :             xRetval = drawinglayer::primitive2d::Primitive2DSequence(&xReferenceA, 1);
     163             : 
     164           0 :             if(rAttribute.getLine().isDefault())
     165             :             {
     166             :                 // create a surrounding frame when no linestyle given
     167           0 :                 const Color aColor(Application::GetSettings().GetStyleSettings().GetShadowColor());
     168           0 :                 const basegfx::BColor aBColor(aColor.getBColor());
     169           0 :                 basegfx::B2DPolygon aOutline(basegfx::tools::createUnitPolygon());
     170           0 :                 aOutline.transform(rObjectMatrix);
     171             : 
     172             :                 drawinglayer::primitive2d::appendPrimitive2DReferenceToPrimitive2DSequence(xRetval,
     173             :                     drawinglayer::primitive2d::Primitive2DReference(
     174             :                         new drawinglayer::primitive2d::PolygonHairlinePrimitive2D(
     175             :                             aOutline,
     176           0 :                             aBColor)));
     177             :             }
     178             : 
     179             :             // decompose object matrix to get single values
     180           0 :             basegfx::B2DVector aScale, aTranslate;
     181             :             double fRotate, fShearX;
     182           0 :             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           0 :             const double fDistance(200.0);
     187             : 
     188             :             // consume borders from values
     189           0 :             aScale.setX(std::max(0.0, aScale.getX() - (2.0 * fDistance)));
     190           0 :             aScale.setY(std::max(0.0, aScale.getY() - (2.0 * fDistance)));
     191           0 :             aTranslate.setX(aTranslate.getX() + fDistance);
     192           0 :             aTranslate.setY(aTranslate.getY() + fDistance);
     193             : 
     194             :             // draw a draft bitmap
     195           0 :             const Bitmap aDraftBitmap(ResId(BMAP_GrafikEi, *ImpGetResMgr()));
     196             : 
     197           0 :             if(!aDraftBitmap.IsEmpty())
     198             :             {
     199           0 :                 Size aPrefSize(aDraftBitmap.GetPrefSize());
     200             : 
     201           0 :                 if(MAP_PIXEL == aDraftBitmap.GetPrefMapMode().GetMapUnit())
     202             :                 {
     203           0 :                     aPrefSize = Application::GetDefaultDevice()->PixelToLogic(aDraftBitmap.GetSizePixel(), MAP_100TH_MM);
     204             :                 }
     205             :                 else
     206             :                 {
     207           0 :                     aPrefSize = Application::GetDefaultDevice()->LogicToLogic(aPrefSize, aDraftBitmap.GetPrefMapMode(), MAP_100TH_MM);
     208             :                 }
     209             : 
     210           0 :                 const double fBitmapScaling(2.0);
     211           0 :                 const double fWidth(aPrefSize.getWidth() * fBitmapScaling);
     212           0 :                 const double fHeight(aPrefSize.getHeight() * fBitmapScaling);
     213             : 
     214           0 :                 if(basegfx::fTools::more(fWidth, 1.0)
     215           0 :                     && basegfx::fTools::more(fHeight, 1.0)
     216           0 :                     && basegfx::fTools::lessOrEqual(fWidth, aScale.getX())
     217           0 :                     && basegfx::fTools::lessOrEqual(fHeight, aScale.getY()))
     218             :                 {
     219             :                     const basegfx::B2DHomMatrix aBitmapMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     220           0 :                         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           0 :                                 aBitmapMatrix)));
     227             : 
     228             :                     // consume bitmap size in X
     229           0 :                     aScale.setX(std::max(0.0, aScale.getX() - (fWidth + fDistance)));
     230           0 :                     aTranslate.setX(aTranslate.getX() + fWidth + fDistance);
     231             :                 }
     232             :             }
     233             : 
     234             :             // Build the text for the draft object
     235           0 :             OUString aDraftText = GetGrafObject().GetFileName();
     236             : 
     237           0 :             if (aDraftText.isEmpty())
     238             :             {
     239           0 :                 aDraftText = GetGrafObject().GetName();
     240           0 :                 aDraftText += " ...";
     241             :             }
     242             : 
     243           0 :             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           0 :                 SdrRectObj aRectObj(OBJ_TEXT);
     256           0 :                 aRectObj.SetModel(GetGrafObject().GetModel());
     257           0 :                 aRectObj.NbcSetText(aDraftText);
     258           0 :                 aRectObj.SetMergedItem(SvxColorItem(Color(COL_LIGHTRED), EE_CHAR_COLOR));
     259             : 
     260             :                 // get SdrText and OPO
     261           0 :                 SdrText* pSdrText = aRectObj.getText(0);
     262           0 :                 OutlinerParaObject* pOPO = aRectObj.GetOutlinerParaObject();
     263             : 
     264           0 :                 if(pSdrText && pOPO)
     265             :                 {
     266             :                     // directly use the remaining space as TextRangeTransform
     267             :                     const basegfx::B2DHomMatrix aTextRangeTransform(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     268           0 :                         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           0 :                         false);
     282             : 
     283             :                     // decompose immediately with neutral ViewInformation. This will
     284             :                     // layout the text to more simple TextPrimitives from drawinglayer
     285           0 :                     const drawinglayer::geometry::ViewInformation2D aViewInformation2D;
     286             : 
     287             :                     drawinglayer::primitive2d::appendPrimitive2DSequenceToPrimitive2DSequence(
     288             :                         xRetval,
     289           0 :                         aBlockTextPrimitive.get2DDecomposition(aViewInformation2D));
     290           0 :                 }
     291             :             }
     292             : 
     293           0 :             return xRetval;
     294             :         }
     295             : 
     296           0 :         drawinglayer::primitive2d::Primitive2DSequence ViewContactOfGraphic::createViewIndependentPrimitive2DSequence() const
     297             :         {
     298           0 :             drawinglayer::primitive2d::Primitive2DSequence xRetval;
     299           0 :             const SfxItemSet& rItemSet = GetGrafObject().GetMergedItemSet();
     300             : 
     301             :             // create and fill GraphicAttr
     302           0 :             GraphicAttr aLocalGrafInfo;
     303           0 :             const sal_uInt16 nTrans(((SdrGrafTransparenceItem&)rItemSet.Get(SDRATTR_GRAFTRANSPARENCE)).GetValue());
     304           0 :             const SdrGrafCropItem& rCrop((const SdrGrafCropItem&)rItemSet.Get(SDRATTR_GRAFCROP));
     305           0 :             aLocalGrafInfo.SetLuminance(((SdrGrafLuminanceItem&)rItemSet.Get(SDRATTR_GRAFLUMINANCE)).GetValue());
     306           0 :             aLocalGrafInfo.SetContrast(((SdrGrafContrastItem&)rItemSet.Get(SDRATTR_GRAFCONTRAST)).GetValue());
     307           0 :             aLocalGrafInfo.SetChannelR(((SdrGrafRedItem&)rItemSet.Get(SDRATTR_GRAFRED)).GetValue());
     308           0 :             aLocalGrafInfo.SetChannelG(((SdrGrafGreenItem&)rItemSet.Get(SDRATTR_GRAFGREEN)).GetValue());
     309           0 :             aLocalGrafInfo.SetChannelB(((SdrGrafBlueItem&)rItemSet.Get(SDRATTR_GRAFBLUE)).GetValue());
     310           0 :             aLocalGrafInfo.SetGamma(((SdrGrafGamma100Item&)rItemSet.Get(SDRATTR_GRAFGAMMA)).GetValue() * 0.01);
     311           0 :             aLocalGrafInfo.SetTransparency((sal_uInt8)::basegfx::fround(std::min(nTrans, (sal_uInt16)100) * 2.55));
     312           0 :             aLocalGrafInfo.SetInvert(((SdrGrafInvertItem&)rItemSet.Get(SDRATTR_GRAFINVERT)).GetValue());
     313           0 :             aLocalGrafInfo.SetDrawMode(((SdrGrafModeItem&)rItemSet.Get(SDRATTR_GRAFMODE)).GetValue());
     314           0 :             aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom());
     315             : 
     316             :             // we have content if graphic is not completely transparent
     317           0 :             const bool bHasContent(255L != aLocalGrafInfo.GetTransparency());
     318             :             drawinglayer::attribute::SdrLineFillShadowTextAttribute aAttribute(
     319             :                 drawinglayer::primitive2d::createNewSdrLineFillShadowTextAttribute(
     320             :                     rItemSet,
     321           0 :                     GetGrafObject().getText(0),
     322           0 :                     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           0 :             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           0 :             rRectangle += GetGrafObject().GetGridOffset();
     331             :             const ::basegfx::B2DRange aObjectRange(
     332           0 :                 rRectangle.Left(), rRectangle.Top(),
     333           0 :                 rRectangle.Right(), rRectangle.Bottom());
     334             : 
     335             :             // look for mirroring
     336           0 :             const GeoStat& rGeoStat(GetGrafObject().GetGeoStat());
     337           0 :             const sal_Int32 nDrehWink(rGeoStat.nDrehWink);
     338           0 :             const bool bRota180(18000 == nDrehWink);
     339           0 :             const bool bMirrored(GetGrafObject().IsMirrored());
     340           0 :             const sal_uInt16 nMirrorCase(bRota180 ? (bMirrored ? 3 : 4) : (bMirrored ? 2 : 1));
     341           0 :             bool bHMirr((2 == nMirrorCase ) || (4 == nMirrorCase));
     342           0 :             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           0 :             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           0 :             if(bHMirr || bVMirr)
     357             :             {
     358           0 :                 aLocalGrafInfo.SetMirrorFlags((bHMirr ? BMP_MIRROR_HORZ : 0)|(bVMirr ? BMP_MIRROR_VERT : 0));
     359             :             }
     360             : 
     361             :             // fill object matrix
     362           0 :             const double fShearX(rGeoStat.nShearWink ? tan((36000 - rGeoStat.nShearWink) * F_PI18000) : 0.0);
     363           0 :             const double fRotate(nDrehWink ? (36000 - nDrehWink) * F_PI18000 : 0.0);
     364             :             const basegfx::B2DHomMatrix aObjectMatrix(basegfx::tools::createScaleShearXRotateTranslateB2DHomMatrix(
     365             :                 aObjectRange.getWidth(), aObjectRange.getHeight(),
     366             :                 fShearX, fRotate,
     367           0 :                 aObjectRange.getMinX(), aObjectRange.getMinY()));
     368             : 
     369             :             // get the current, unchenged graphic obect from SdrGrafObj
     370           0 :             const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
     371             : 
     372           0 :             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           0 :             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           0 :                 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           0 :                         aLocalGrafInfo));
     399             : 
     400           0 :                 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           0 :                     false, aObjectMatrix));
     407             : 
     408           0 :             return xRetval;
     409             :         }
     410             : 
     411           0 :         bool ViewContactOfGraphic::visualisationUsesPresObj() const
     412             :         {
     413           0 :             return GetGrafObject().IsEmptyPresObj();
     414             :         }
     415             : 
     416           0 :         bool ViewContactOfGraphic::visualisationUsesDraft() const
     417             :         {
     418             :             // no draft when already PresObj
     419           0 :             if(visualisationUsesPresObj())
     420           0 :                 return false;
     421             : 
     422             :             // draft when swapped out
     423           0 :             const GraphicObject& rGraphicObject = GetGrafObject().GetGraphicObject(false);
     424             :             static bool bAllowReplacements(true);
     425             : 
     426           0 :             if(rGraphicObject.IsSwappedOut() && bAllowReplacements)
     427           0 :                 return true;
     428             : 
     429             :             // draft when no graphic
     430           0 :             if(GRAPHIC_NONE == rGraphicObject.GetType() || GRAPHIC_DEFAULT == rGraphicObject.GetType())
     431           0 :                return true;
     432             : 
     433           0 :             return false;
     434             :         }
     435             : 
     436             :     } // end of namespace contact
     437             : } // end of namespace sdr
     438             : 
     439             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10