LCOV - code coverage report
Current view: top level - svx/source/sdr/primitive2d - sdrcustomshapeprimitive2d.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 26 0.0 %
Date: 2014-04-14 Functions: 0 4 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/primitive2d/sdrcustomshapeprimitive2d.hxx>
      21             : #include <basegfx/polygon/b2dpolygon.hxx>
      22             : #include <basegfx/polygon/b2dpolygontools.hxx>
      23             : #include <svx/sdr/primitive2d/sdrdecompositiontools.hxx>
      24             : #include <drawinglayer/primitive2d/groupprimitive2d.hxx>
      25             : #include <svx/sdr/primitive2d/svx_primitivetypes2d.hxx>
      26             : #include <drawinglayer/attribute/sdrlineattribute.hxx>
      27             : 
      28             : 
      29             : 
      30             : using namespace com::sun::star;
      31             : 
      32             : 
      33             : 
      34             : namespace drawinglayer
      35             : {
      36             :     namespace primitive2d
      37             :     {
      38           0 :         Primitive2DSequence SdrCustomShapePrimitive2D::create2DDecomposition(const geometry::ViewInformation2D& /*aViewInformation*/) const
      39             :         {
      40           0 :             Primitive2DSequence aRetval(getSubPrimitives());
      41             : 
      42             :             // add text
      43           0 :             if(!getSdrSTAttribute().getText().isDefault())
      44             :             {
      45           0 :                 const basegfx::B2DPolygon aUnitOutline(basegfx::tools::createUnitPolygon());
      46             : 
      47             :                 appendPrimitive2DReferenceToPrimitive2DSequence(aRetval,
      48             :                     createTextPrimitive(
      49             :                         basegfx::B2DPolyPolygon(aUnitOutline),
      50           0 :                         getTextBox(),
      51           0 :                         getSdrSTAttribute().getText(),
      52             :                         attribute::SdrLineAttribute(),
      53             :                         false,
      54           0 :                         getWordWrap(),
      55           0 :                         isForceTextClipToTextRange()));
      56             :             }
      57             : 
      58             :             // add shadow
      59           0 :             if(aRetval.hasElements() && !getSdrSTAttribute().getShadow().isDefault())
      60             :             {
      61             :                 // #i105323# add generic shadow only for 2D shapes. For
      62             :                 // 3D shapes shadow will be set at the individual created
      63             :                 // visualisation objects and be visualized by the 3d renderer
      64             :                 // as a single shadow.
      65             : 
      66             :                 // The shadow for AutoShapes could be handled uniformely by not setting any
      67             :                 // shadow items at the helper model objects and only adding shadow here for
      68             :                 // 2D and 3D (and it works, too), but this would lead to two 3D scenes for
      69             :                 // the 3D object; one for the shadow aond one for the content. The one for the
      70             :                 // shadow will be correct (using ColorModifierStack), but expensive.
      71           0 :                 if(!get3DShape())
      72             :                 {
      73           0 :                     aRetval = createEmbeddedShadowPrimitive(aRetval, getSdrSTAttribute().getShadow());
      74             :                 }
      75             :             }
      76             : 
      77           0 :             return aRetval;
      78             :         }
      79             : 
      80           0 :         SdrCustomShapePrimitive2D::SdrCustomShapePrimitive2D(
      81             :             const attribute::SdrShadowTextAttribute& rSdrSTAttribute,
      82             :             const Primitive2DSequence& rSubPrimitives,
      83             :             const basegfx::B2DHomMatrix& rTextBox,
      84             :             bool bWordWrap,
      85             :             bool b3DShape,
      86             :             bool bForceTextClipToTextRange)
      87             :         :   BufferedDecompositionPrimitive2D(),
      88             :             maSdrSTAttribute(rSdrSTAttribute),
      89             :             maSubPrimitives(rSubPrimitives),
      90             :             maTextBox(rTextBox),
      91             :             mbWordWrap(bWordWrap),
      92             :             mb3DShape(b3DShape),
      93           0 :             mbForceTextClipToTextRange(bForceTextClipToTextRange)
      94             :         {
      95           0 :         }
      96             : 
      97           0 :         bool SdrCustomShapePrimitive2D::operator==(const BasePrimitive2D& rPrimitive) const
      98             :         {
      99           0 :             if(BufferedDecompositionPrimitive2D::operator==(rPrimitive))
     100             :             {
     101           0 :                 const SdrCustomShapePrimitive2D& rCompare = (SdrCustomShapePrimitive2D&)rPrimitive;
     102             : 
     103           0 :                 return (getSdrSTAttribute() == rCompare.getSdrSTAttribute()
     104           0 :                     && getSubPrimitives() == rCompare.getSubPrimitives()
     105           0 :                     && getTextBox() == rCompare.getTextBox()
     106           0 :                     && getWordWrap() == rCompare.getWordWrap()
     107           0 :                     && get3DShape() == rCompare.get3DShape()
     108           0 :                     && isForceTextClipToTextRange() == rCompare.isForceTextClipToTextRange());
     109             :             }
     110             : 
     111           0 :             return false;
     112             :         }
     113             : 
     114             :         // provide unique ID
     115           0 :         ImplPrimitive2DIDBlock(SdrCustomShapePrimitive2D, PRIMITIVE2D_ID_SDRCUSTOMSHAPEPRIMITIVE2D)
     116             : 
     117             :     } // end of namespace primitive2d
     118             : } // end of namespace drawinglayer
     119             : 
     120             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10