LCOV - code coverage report
Current view: top level - svx/source/sdr/primitive2d - sdrattributecreator.cxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 300 383 78.3 %
Date: 2014-04-11 Functions: 18 19 94.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 <svx/sdr/primitive2d/sdrattributecreator.hxx>
      21             : #include <svl/itemset.hxx>
      22             : #include <svx/xdef.hxx>
      23             : #include <basegfx/polygon/b2dpolygon.hxx>
      24             : #include <svx/xlineit0.hxx>
      25             : #include <svx/xfillit0.hxx>
      26             : #include <svx/xlntrit.hxx>
      27             : #include <svx/xlnwtit.hxx>
      28             : #include <svx/xlinjoit.hxx>
      29             : #include <svx/xlncapit.hxx>
      30             : #include <svx/xlnclit.hxx>
      31             : #include <svx/xlnstwit.hxx>
      32             : #include <svx/xlnedwit.hxx>
      33             : #include <svx/xlnstit.hxx>
      34             : #include <svx/xlnstcit.hxx>
      35             : #include <svx/xlnedit.hxx>
      36             : #include <svx/xlnedcit.hxx>
      37             : #include <svx/xdash.hxx>
      38             : #include <svx/xlndsit.hxx>
      39             : #include <svx/xfltrit.hxx>
      40             : #include <svx/xflftrit.hxx>
      41             : #include <svx/xflclit.hxx>
      42             : #include <svx/xgrscit.hxx>
      43             : #include <svx/xflhtit.hxx>
      44             : #include <svx/xflbckit.hxx>
      45             : #include <svx/sdshitm.hxx>
      46             : #include <svx/sdsxyitm.hxx>
      47             : #include <svx/sdshcitm.hxx>
      48             : #include <svx/sdshtitm.hxx>
      49             : #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx>
      50             : #include <basegfx/polygon/b2dlinegeometry.hxx>
      51             : #include <svx/svdotext.hxx>
      52             : #include <drawinglayer/attribute/fillgraphicattribute.hxx>
      53             : #include <svx/sdr/attribute/sdrtextattribute.hxx>
      54             : #include <svx/xbtmpit.hxx>
      55             : #include <svl/itempool.hxx>
      56             : #include <vcl/svapp.hxx>
      57             : #include <basegfx/range/b2drange.hxx>
      58             : #include <svx/svx3ditems.hxx>
      59             : #include <com/sun/star/drawing/ProjectionMode.hpp>
      60             : #include <com/sun/star/drawing/ShadeMode.hpp>
      61             : #include <drawinglayer/attribute/sdrallattribute3d.hxx>
      62             : #include <svx/rectenum.hxx>
      63             : #include <svx/sdtfchim.hxx>
      64             : #include <svx/svdoutl.hxx>
      65             : #include <svx/svdmodel.hxx>
      66             : #include <editeng/editstat.hxx>
      67             : #include <drawinglayer/attribute/fillhatchattribute.hxx>
      68             : #include <drawinglayer/attribute/fillgradientattribute.hxx>
      69             : #include <svx/sdr/attribute/sdrshadowtextattribute.hxx>
      70             : #include <svx/sdr/attribute/sdrlineshadowtextattribute.hxx>
      71             : #include <svx/sdr/attribute/sdrformtextattribute.hxx>
      72             : #include <svx/sdr/attribute/sdrlinefillshadowtextattribute.hxx>
      73             : #include <drawinglayer/attribute/sdrsceneattribute3d.hxx>
      74             : #include <drawinglayer/attribute/sdrlightingattribute3d.hxx>
      75             : #include <drawinglayer/attribute/sdrlightattribute3d.hxx>
      76             : #include <svx/sdr/attribute/sdrfilltextattribute.hxx>
      77             : #include <com/sun/star/drawing/LineCap.hpp>
      78             : 
      79             : 
      80             : 
      81             : namespace drawinglayer
      82             : {
      83             :     namespace
      84             :     {
      85        2794 :         attribute::GradientStyle XGradientStyleToGradientStyle(XGradientStyle eStyle)
      86             :         {
      87        2794 :             switch(eStyle)
      88             :             {
      89             :                 case XGRAD_LINEAR :
      90             :                 {
      91        1645 :                     return attribute::GRADIENTSTYLE_LINEAR;
      92             :                 }
      93             :                 case XGRAD_AXIAL :
      94             :                 {
      95        1145 :                     return attribute::GRADIENTSTYLE_AXIAL;
      96             :                 }
      97             :                 case XGRAD_RADIAL :
      98             :                 {
      99           4 :                     return attribute::GRADIENTSTYLE_RADIAL;
     100             :                 }
     101             :                 case XGRAD_ELLIPTICAL :
     102             :                 {
     103           0 :                     return attribute::GRADIENTSTYLE_ELLIPTICAL;
     104             :                 }
     105             :                 case XGRAD_SQUARE :
     106             :                 {
     107           0 :                     return attribute::GRADIENTSTYLE_SQUARE;
     108             :                 }
     109             :                 default :
     110             :                 {
     111           0 :                     return attribute::GRADIENTSTYLE_RECT; // XGRAD_RECT
     112             :                 }
     113             :             }
     114             :         }
     115             : 
     116        1354 :         attribute::HatchStyle XHatchStyleToHatchStyle(XHatchStyle eStyle)
     117             :         {
     118        1354 :             switch(eStyle)
     119             :             {
     120             :                 case XHATCH_SINGLE :
     121             :                 {
     122        1330 :                     return attribute::HATCHSTYLE_SINGLE;
     123             :                 }
     124             :                 case XHATCH_DOUBLE :
     125             :                 {
     126          24 :                     return attribute::HATCHSTYLE_DOUBLE;
     127             :                 }
     128             :                 default :
     129             :                 {
     130           0 :                     return attribute::HATCHSTYLE_TRIPLE; // XHATCH_TRIPLE
     131             :                 }
     132             :             }
     133             :         }
     134             : 
     135       13034 :         basegfx::B2DLineJoin LineJointToB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)
     136             :         {
     137       13034 :             switch(eLineJoint)
     138             :             {
     139             :                 case com::sun::star::drawing::LineJoint_MIDDLE :
     140             :                 {
     141           0 :                     return basegfx::B2DLINEJOIN_MIDDLE;
     142             :                 }
     143             :                 case com::sun::star::drawing::LineJoint_BEVEL :
     144             :                 {
     145         168 :                     return basegfx::B2DLINEJOIN_BEVEL;
     146             :                 }
     147             :                 case com::sun::star::drawing::LineJoint_MITER :
     148             :                 {
     149         590 :                     return basegfx::B2DLINEJOIN_MITER;
     150             :                 }
     151             :                 case com::sun::star::drawing::LineJoint_ROUND :
     152             :                 {
     153       12276 :                     return basegfx::B2DLINEJOIN_ROUND;
     154             :                 }
     155             :                 default : // com::sun::star::drawing::LineJoint_NONE
     156             :                 {
     157           0 :                     return basegfx::B2DLINEJOIN_NONE;
     158             :                 }
     159             :             }
     160             :         }
     161             : 
     162         313 :         basegfx::B2DVector RectPointToB2DVector(RECT_POINT eRectPoint)
     163             :         {
     164         313 :             basegfx::B2DVector aRetval(0.0, 0.0);
     165             : 
     166             :             // position changes X
     167         313 :             switch(eRectPoint)
     168             :             {
     169             :                 case RP_LT: case RP_LM: case RP_LB:
     170             :                 {
     171           0 :                     aRetval.setX(-1.0);
     172           0 :                     break;
     173             :                 }
     174             : 
     175             :                 case RP_RT: case RP_RM: case RP_RB:
     176             :                 {
     177           0 :                     aRetval.setX(1.0);
     178           0 :                     break;
     179             :                 }
     180             : 
     181             :                 default :
     182             :                 {
     183         313 :                     break;
     184             :                 }
     185             :             }
     186             : 
     187             :             // position changes Y
     188         313 :             switch(eRectPoint)
     189             :             {
     190             :                 case RP_LT: case RP_MT: case RP_RT:
     191             :                 {
     192           0 :                     aRetval.setY(-1.0);
     193           0 :                     break;
     194             :                 }
     195             : 
     196             :                 case RP_LB: case RP_MB: case RP_RB:
     197             :                 {
     198           0 :                     aRetval.setY(1.0);
     199           0 :                     break;
     200             :                 }
     201             : 
     202             :                 default :
     203             :                 {
     204         313 :                     break;
     205             :                 }
     206             :             }
     207             : 
     208         313 :             return aRetval;
     209             :         }
     210             :     } // end of anonymous namespace
     211             : } // end of namespace drawinglayer
     212             : 
     213             : 
     214             : 
     215             : namespace drawinglayer
     216             : {
     217             :     namespace primitive2d
     218             :     {
     219       48368 :         attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet)
     220             :         {
     221       48368 :             const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
     222             : 
     223       48368 :             if(XLINE_NONE != eStyle)
     224             :             {
     225       13034 :                 sal_uInt16 nTransparence(((const XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue());
     226             : 
     227       13034 :                 if(nTransparence > 100)
     228             :                 {
     229           0 :                     nTransparence = 100;
     230             :                 }
     231             : 
     232       13034 :                 if(100 != nTransparence)
     233             :                 {
     234       13034 :                     const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue());
     235       13034 :                     const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
     236       13034 :                     const com::sun::star::drawing::LineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue());
     237       13034 :                     const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue());
     238       13034 :                     ::std::vector< double > aDotDashArray;
     239       13034 :                     double fFullDotDashLen(0.0);
     240             : 
     241       13034 :                     if(XLINE_DASH == eStyle)
     242             :                     {
     243          85 :                         const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
     244             : 
     245          85 :                         if(rDash.GetDots() || rDash.GetDashes())
     246             :                         {
     247          85 :                             fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nWidth);
     248             :                         }
     249             :                     }
     250             : 
     251             :                     return attribute::SdrLineAttribute(
     252             :                         LineJointToB2DLineJoin(eJoint),
     253             :                         (double)nWidth,
     254             :                         (double)nTransparence * 0.01,
     255             :                         aColor.getBColor(),
     256             :                         eCap,
     257             :                         aDotDashArray,
     258       13034 :                         fFullDotDashLen);
     259             :                 }
     260             :             }
     261             : 
     262       35334 :             return attribute::SdrLineAttribute();
     263             :         }
     264             : 
     265       13034 :         attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
     266             :             const SfxItemSet& rSet,
     267             :             double fWidth)
     268             :         {
     269       13034 :             const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue());
     270       13034 :             const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue());
     271       13034 :             basegfx::B2DPolyPolygon aStartPolyPolygon;
     272       26068 :             basegfx::B2DPolyPolygon aEndPolyPolygon;
     273       13034 :             double fStartWidth(0.0);
     274       13034 :             double fEndWidth(0.0);
     275       13034 :             bool bStartActive(false);
     276       13034 :             bool bEndActive(false);
     277       13034 :             bool bStartCentered(true);
     278       13034 :             bool bEndCentered(true);
     279             : 
     280       13034 :             if(nTempStartWidth)
     281             :             {
     282       13034 :                 if(nTempStartWidth < 0L)
     283             :                 {
     284           0 :                     fStartWidth = ((double)(-nTempStartWidth) * fWidth) * 0.01;
     285             :                 }
     286             :                 else
     287             :                 {
     288       13034 :                     fStartWidth = (double)nTempStartWidth;
     289             :                 }
     290             : 
     291       13034 :                 if(0.0 != fStartWidth)
     292             :                 {
     293       13034 :                     aStartPolyPolygon = basegfx::B2DPolyPolygon(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue());
     294             : 
     295       13034 :                     if(aStartPolyPolygon.count() && aStartPolyPolygon.getB2DPolygon(0L).count())
     296             :                     {
     297          91 :                         bStartActive = true;
     298          91 :                         bStartCentered = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
     299             :                     }
     300             :                 }
     301             :             }
     302             : 
     303       13034 :             if(nTempEndWidth)
     304             :             {
     305       13034 :                 if(nTempEndWidth < 0L)
     306             :                 {
     307           0 :                     fEndWidth = ((double)(-nTempEndWidth) * fWidth) * 0.01;
     308             :                 }
     309             :                 else
     310             :                 {
     311       13034 :                     fEndWidth = (double)nTempEndWidth;
     312             :                 }
     313             : 
     314       13034 :                 if(0.0 != fEndWidth)
     315             :                 {
     316       13034 :                     aEndPolyPolygon = basegfx::B2DPolyPolygon(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue());
     317             : 
     318       13034 :                     if(aEndPolyPolygon.count() && aEndPolyPolygon.getB2DPolygon(0L).count())
     319             :                     {
     320         168 :                         bEndActive = true;
     321         168 :                         bEndCentered = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
     322             :                     }
     323             :                 }
     324             :             }
     325             : 
     326       13034 :             if(bStartActive || bEndActive)
     327             :             {
     328             :                 return attribute::SdrLineStartEndAttribute(
     329             :                     aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth,
     330         186 :                     bStartActive, bEndActive, bStartCentered, bEndCentered);
     331             :             }
     332             : 
     333       25882 :             return attribute::SdrLineStartEndAttribute();
     334             :         }
     335             : 
     336       46320 :         attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet)
     337             :         {
     338       46320 :             const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue());
     339             : 
     340       46320 :             if(bShadow)
     341             :             {
     342          75 :                 sal_uInt16 nTransparence(((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
     343             : 
     344          75 :                 if(nTransparence > 100)
     345             :                 {
     346           0 :                     nTransparence = 100;
     347             :                 }
     348             : 
     349          75 :                 if(nTransparence)
     350             :                 {
     351          75 :                     sal_uInt16 nFillTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
     352             : 
     353          75 :                     if(nFillTransparence > 100)
     354             :                     {
     355           0 :                         nFillTransparence = 100;
     356             :                     }
     357             : 
     358          75 :                     if(nTransparence == nFillTransparence)
     359             :                     {
     360             :                         // shadow does not really have an own transparence, but the application
     361             :                         // sets the shadow transparence equal to the object transparence for
     362             :                         // convenience. This is not useful for primitive creation, so take
     363             :                         // this as no shadow transparence
     364           0 :                         nTransparence = 0;
     365             :                     }
     366             :                 }
     367             : 
     368          75 :                 if(100 != nTransparence)
     369             :                 {
     370             :                     const basegfx::B2DVector aOffset(
     371          75 :                         (double)((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(),
     372         150 :                         (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
     373          75 :                     const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
     374             : 
     375          75 :                     return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
     376             :                 }
     377             :             }
     378             : 
     379       46245 :             return attribute::SdrShadowAttribute();
     380             :         }
     381             : 
     382       49324 :         attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet)
     383             :         {
     384       49324 :             const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
     385             : 
     386       49324 :             if(XFILL_NONE != eStyle)
     387             :             {
     388       24913 :                 sal_uInt16 nTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
     389             : 
     390       24913 :                 if(nTransparence > 100)
     391             :                 {
     392           0 :                     nTransparence = 100;
     393             :                 }
     394             : 
     395       24913 :                 if(100 != nTransparence)
     396             :                 {
     397             :                     // need to check XFillFloatTransparence, object fill may still be completely transparent
     398             :                     const SfxPoolItem* pGradientItem;
     399             : 
     400       49760 :                     if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem)
     401       24880 :                         && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
     402             :                     {
     403        2552 :                         const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
     404        2552 :                         const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
     405        2552 :                         const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
     406        2552 :                         const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
     407             : 
     408        2552 :                         if(bCompletelyTransparent)
     409             :                         {
     410           0 :                             nTransparence = 100;
     411             :                         }
     412             :                     }
     413             :                 }
     414             : 
     415       24913 :                 if(100 != nTransparence)
     416             :                 {
     417       24880 :                     const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
     418       24880 :                     attribute::FillGradientAttribute aGradient;
     419       49760 :                     attribute::FillHatchAttribute aHatch;
     420       49760 :                     attribute::SdrFillGraphicAttribute aFillGraphic;
     421             : 
     422       24880 :                     switch(eStyle)
     423             :                     {
     424             :                         case XFILL_NONE : // for warnings
     425             :                         case XFILL_SOLID :
     426             :                         {
     427             :                             // nothing to do, color is defined
     428       22971 :                             break;
     429             :                         }
     430             :                         case XFILL_GRADIENT :
     431             :                         {
     432         242 :                             XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
     433             : 
     434         242 :                             const Color aStartColor(aXGradient.GetStartColor());
     435         242 :                             const sal_uInt16 nStartIntens(aXGradient.GetStartIntens());
     436         242 :                             basegfx::BColor aStart(aStartColor.getBColor());
     437             : 
     438         242 :                             if(nStartIntens != 100)
     439             :                             {
     440           0 :                                 const basegfx::BColor aBlack;
     441           0 :                                 aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
     442             :                             }
     443             : 
     444         242 :                             const Color aEndColor(aXGradient.GetEndColor());
     445         242 :                             const sal_uInt16 nEndIntens(aXGradient.GetEndIntens());
     446         484 :                             basegfx::BColor aEnd(aEndColor.getBColor());
     447             : 
     448         242 :                             if(nEndIntens != 100)
     449             :                             {
     450           0 :                                 const basegfx::BColor aBlack;
     451           0 :                                 aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
     452             :                             }
     453             : 
     454        1452 :                             aGradient = attribute::FillGradientAttribute(
     455             :                                 XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
     456         242 :                                 (double)aXGradient.GetBorder() * 0.01,
     457         242 :                                 (double)aXGradient.GetXOffset() * 0.01,
     458         242 :                                 (double)aXGradient.GetYOffset() * 0.01,
     459         242 :                                 (double)aXGradient.GetAngle() * F_PI1800,
     460             :                                 aStart,
     461             :                                 aEnd,
     462         484 :                                 ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue());
     463             : 
     464         484 :                             break;
     465             :                         }
     466             :                         case XFILL_HATCH :
     467             :                         {
     468        1354 :                             const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue());
     469        1354 :                             const Color aColorB(rHatch.GetColor());
     470             : 
     471        5416 :                             aHatch = attribute::FillHatchAttribute(
     472             :                                 XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
     473        1354 :                                 (double)rHatch.GetDistance(),
     474        1354 :                                 (double)rHatch.GetAngle() * F_PI1800,
     475             :                                 aColorB.getBColor(),
     476             :                                 3, // same default as VCL, a minimum of three discrete units (pixels) offset
     477        2708 :                                 ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue());
     478             : 
     479        1354 :                             break;
     480             :                         }
     481             :                         case XFILL_BITMAP :
     482             :                         {
     483         313 :                             aFillGraphic = createNewSdrFillGraphicAttribute(rSet);
     484         313 :                             break;
     485             :                         }
     486             :                     }
     487             : 
     488             :                     return attribute::SdrFillAttribute(
     489             :                         (double)nTransparence * 0.01,
     490             :                         aColor.getBColor(),
     491             :                         aGradient,
     492             :                         aHatch,
     493       49760 :                         aFillGraphic);
     494             :                 }
     495             :             }
     496             : 
     497       24444 :             return attribute::SdrFillAttribute();
     498             :         }
     499             : 
     500             :         // #i101508# Support handing over given text-to-border distances
     501       49334 :         attribute::SdrTextAttribute createNewSdrTextAttribute(
     502             :             const SfxItemSet& rSet,
     503             :             const SdrText& rText,
     504             :             const sal_Int32* pLeft,
     505             :             const sal_Int32* pUpper,
     506             :             const sal_Int32* pRight,
     507             :             const sal_Int32* pLower)
     508             :         {
     509       49334 :             const SdrTextObj& rTextObj = rText.GetObject();
     510             : 
     511       49334 :             if(rText.GetOutlinerParaObject() && rText.GetModel())
     512             :             {
     513             :                 // added TextEdit text suppression
     514       15548 :                 bool bInEditMode(false);
     515             : 
     516       15548 :                 if(rText.GetObject().getTextCount() > 1)
     517             :                 {
     518           0 :                     bInEditMode = rTextObj.IsInEditMode() && rText.GetObject().getActiveText() == &rText;
     519             :                 }
     520             :                 else
     521             :                 {
     522       15548 :                     bInEditMode = rTextObj.IsInEditMode();
     523             :                 }
     524             : 
     525       15548 :                 OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject());
     526             : 
     527       15548 :                 if(bInEditMode)
     528             :                 {
     529           0 :                     OutlinerParaObject* pTempObj = rTextObj.GetEditOutlinerParaObject();
     530             : 
     531           0 :                     if(pTempObj)
     532             :                     {
     533           0 :                         aOutlinerParaObject = *pTempObj;
     534           0 :                         delete pTempObj;
     535             :                     }
     536             :                     else
     537             :                     {
     538             :                         // #i100537#
     539             :                         // GetEditOutlinerParaObject() returning no object does not mean that
     540             :                         // text edit mode is not active. Do not reset the flag here
     541             :                         // bInEditMode = false;
     542             :                     }
     543             :                 }
     544             : 
     545       15548 :                 const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
     546             : 
     547             :                 // #i107346#
     548       15548 :                 const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
     549       15548 :                 const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING);
     550             : 
     551             :                 return attribute::SdrTextAttribute(
     552             :                     rText,
     553             :                     aOutlinerParaObject,
     554       15548 :                     ((const XFormTextStyleItem&)rSet.Get(XATTR_FORMTXTSTYLE)).GetValue(),
     555             :                     pLeft ? *pLeft : rTextObj.GetTextLeftDistance(),
     556             :                     pUpper ? *pUpper : rTextObj.GetTextUpperDistance(),
     557             :                     pRight ? *pRight : rTextObj.GetTextRightDistance(),
     558             :                     pLower ? *pLower : rTextObj.GetTextLowerDistance(),
     559             :                     rTextObj.GetTextHorizontalAdjust(rSet),
     560             :                     rTextObj.GetTextVerticalAdjust(rSet),
     561       15548 :                     ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
     562       15548 :                     rTextObj.IsFitToSize(),
     563       15548 :                     rTextObj.IsAutoFit(),
     564       15548 :                     ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
     565             :                     SDRTEXTANI_BLINK == eAniKind,
     566       15548 :                     SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
     567             :                     bInEditMode,
     568       15548 :                     ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(),
     569      124384 :                     bWrongSpell);
     570             :             }
     571             : 
     572       33786 :             return attribute::SdrTextAttribute();
     573             :         }
     574             : 
     575       25002 :         attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
     576             :         {
     577             :             const SfxPoolItem* pGradientItem;
     578             : 
     579       50004 :             if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, true, &pGradientItem)
     580       25002 :                 && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
     581             :             {
     582             :                 // test if float transparence is completely transparent
     583        2552 :                 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
     584        2552 :                 const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
     585        2552 :                 const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
     586        2552 :                 const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
     587        2552 :                 const bool bNotTransparent(0x00 == nStartLuminance && 0x00 == nEndLuminance);
     588             : 
     589             :                 // create nothing when completely transparent: This case is already checked for the
     590             :                 // normal fill attributes, XFILL_NONE will be used.
     591             :                 // create nothing when not transparent: use normal fill, no need t create a FillGradientAttribute.
     592             :                 // Both cases are optimizations, always creating FillGradientAttribute will work, too
     593        2552 :                 if(!bNotTransparent && !bCompletelyTransparent)
     594             :                 {
     595        2552 :                     const double fStartLum(nStartLuminance / 255.0);
     596        2552 :                     const double fEndLum(nEndLuminance / 255.0);
     597             : 
     598             :                     return attribute::FillGradientAttribute(
     599             :                         XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
     600        2552 :                         (double)rGradient.GetBorder() * 0.01,
     601        2552 :                         (double)rGradient.GetXOffset() * 0.01,
     602        2552 :                         (double)rGradient.GetYOffset() * 0.01,
     603        2552 :                         (double)rGradient.GetAngle() * F_PI1800,
     604             :                         basegfx::BColor(fStartLum, fStartLum, fStartLum),
     605             :                         basegfx::BColor(fEndLum, fEndLum, fEndLum),
     606       12760 :                         0);
     607             :                 }
     608             :             }
     609             : 
     610       22450 :             return attribute::FillGradientAttribute();
     611             :         }
     612             : 
     613         313 :         attribute::SdrFillGraphicAttribute createNewSdrFillGraphicAttribute(const SfxItemSet& rSet)
     614             :         {
     615         313 :             Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic());
     616             : 
     617         313 :             if(!(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()))
     618             :             {
     619             :                 // no content if not bitmap or metafile
     620             :                 OSL_ENSURE(false, "No fill graphic in SfxItemSet (!)");
     621           0 :                 return attribute::SdrFillGraphicAttribute();
     622             :             }
     623             : 
     624         313 :             Size aPrefSize(aGraphic.GetPrefSize());
     625             : 
     626         313 :             if(!aPrefSize.Width() || !aPrefSize.Height())
     627             :             {
     628             :                 // if there is no logical size, create a size from pixel size and set MapMode accordingly
     629           0 :                 if(GRAPHIC_BITMAP == aGraphic.GetType())
     630             :                 {
     631           0 :                     aGraphic.SetPrefSize(aGraphic.GetBitmapEx().GetSizePixel());
     632           0 :                     aGraphic.SetPrefMapMode(MAP_PIXEL);
     633             :                 }
     634             :             }
     635             : 
     636         313 :             if(!aPrefSize.Width() || !aPrefSize.Height())
     637             :             {
     638             :                 // no content if no size
     639             :                 OSL_ENSURE(false, "Graphic has no size in SfxItemSet (!)");
     640           0 :                 return attribute::SdrFillGraphicAttribute();
     641             :             }
     642             : 
     643             :             // convert size and MapMode to destination logical size and MapMode
     644         313 :             const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0));
     645         626 :             basegfx::B2DVector aGraphicLogicSize(aGraphic.GetPrefSize().Width(), aGraphic.GetPrefSize().Height());
     646             : 
     647         313 :             if(aGraphic.GetPrefMapMode() != aDestinationMapUnit)
     648             :             {
     649             :                 // #i100360# for MAP_PIXEL, LogicToLogic will not work properly,
     650             :                 // so fallback to Application::GetDefaultDevice()
     651         264 :                 Size aNewSize(0, 0);
     652             : 
     653         264 :                 if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit())
     654             :                 {
     655             :                     aNewSize = Application::GetDefaultDevice()->PixelToLogic(
     656             :                         aGraphic.GetPrefSize(),
     657         264 :                         aDestinationMapUnit);
     658             :                 }
     659             :                 else
     660             :                 {
     661             :                     aNewSize = OutputDevice::LogicToLogic(
     662             :                         aGraphic.GetPrefSize(),
     663             :                         aGraphic.GetPrefMapMode(),
     664           0 :                         aDestinationMapUnit);
     665             :                 }
     666             : 
     667             :                 // #i124002# do not set new size using SetPrefSize at the graphic, this will lead to problems.
     668             :                 // Instead, adapt the GraphicLogicSize which will be used for further decompositions
     669         264 :                 aGraphicLogicSize = basegfx::B2DVector(aNewSize.Width(), aNewSize.Height());
     670             :             }
     671             : 
     672             :             // get size
     673             :             const basegfx::B2DVector aSize(
     674         313 :                 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEX))).GetValue(),
     675         939 :                 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEY))).GetValue());
     676             :             const basegfx::B2DVector aOffset(
     677         313 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETX))).GetValue(),
     678         939 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETY))).GetValue());
     679             :             const basegfx::B2DVector aOffsetPosition(
     680         313 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(),
     681         939 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
     682             : 
     683             :             return attribute::SdrFillGraphicAttribute(
     684             :                 aGraphic,
     685             :                 aGraphicLogicSize,
     686             :                 aSize,
     687             :                 aOffset,
     688             :                 aOffsetPosition,
     689         313 :                 RectPointToB2DVector((RECT_POINT)((const SfxEnumItem&)(rSet.Get(XATTR_FILLBMP_POS))).GetValue()),
     690         313 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(),
     691         313 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(),
     692        1565 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue());
     693             :         }
     694             : 
     695        3248 :         attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
     696             :             const SfxItemSet& rSet,
     697             :             const SdrText* pText,
     698             :             bool bSuppressText)
     699             :         {
     700        3248 :             attribute::SdrTextAttribute aText;
     701             : 
     702             :             // #i98072# added option to suppress text
     703             :             // look for text first
     704        3248 :             if(!bSuppressText && pText)
     705             :             {
     706        3222 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     707             :             }
     708             : 
     709             :             // try shadow
     710        6496 :             const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
     711             : 
     712        6496 :             return attribute::SdrShadowTextAttribute(aShadow, aText);
     713             :         }
     714             : 
     715          62 :         attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
     716             :             const SfxItemSet& rSet,
     717             :             const SdrText* pText)
     718             :         {
     719          62 :             attribute::SdrLineAttribute aLine;
     720         124 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     721         124 :             attribute::SdrTextAttribute aText;
     722          62 :             bool bFontworkHideContour(false);
     723             : 
     724             :             // look for text first
     725          62 :             if(pText)
     726             :             {
     727          62 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     728             : 
     729             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
     730             :                 // line and fill style to empty
     731         124 :                 if(!aText.isDefault()
     732           1 :                     && !aText.getSdrFormTextAttribute().isDefault()
     733          62 :                     && aText.isHideContour())
     734             :                 {
     735           0 :                     bFontworkHideContour = true;
     736             :                 }
     737             :             }
     738             : 
     739             :             // try line style
     740          62 :             if(!bFontworkHideContour)
     741             :             {
     742          62 :                 aLine = createNewSdrLineAttribute(rSet);
     743             : 
     744          62 :                 if(!aLine.isDefault())
     745             :                 {
     746             :                     // try LineStartEnd
     747          62 :                     aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     748             :                 }
     749             :             }
     750             : 
     751          62 :             if(!aLine.isDefault() || !aText.isDefault())
     752             :             {
     753             :                 // try shadow
     754          62 :                 const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
     755             : 
     756          62 :                 return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText);
     757             :             }
     758             : 
     759          62 :             return attribute::SdrLineShadowTextAttribute();
     760             :         }
     761             : 
     762       46037 :         attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
     763             :             const SfxItemSet& rSet,
     764             :             const SdrText* pText,
     765             :             bool bHasContent)
     766             :         {
     767       46037 :             attribute::SdrLineAttribute aLine;
     768       92074 :             attribute::SdrFillAttribute aFill;
     769       92074 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     770       92074 :             attribute::SdrShadowAttribute aShadow;
     771       92074 :             attribute::FillGradientAttribute aFillFloatTransGradient;
     772       92074 :             attribute::SdrTextAttribute aText;
     773       46037 :             bool bFontworkHideContour(false);
     774             : 
     775             :             // look for text first
     776       46037 :             if(pText)
     777             :             {
     778       46037 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     779             : 
     780             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
     781             :                 // line and fill style to empty
     782       46037 :                 if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
     783             :                 {
     784           0 :                     bFontworkHideContour = true;
     785             :                 }
     786             :             }
     787             : 
     788       46037 :             if(!bFontworkHideContour)
     789             :             {
     790             :                 // try line style
     791       46037 :                 aLine = createNewSdrLineAttribute(rSet);
     792             : 
     793       46037 :                 if(!aLine.isDefault())
     794             :                 {
     795             :                     // try LineStartEnd
     796       11254 :                     aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     797             :                 }
     798             : 
     799             :                 // try fill style
     800       46037 :                 aFill = createNewSdrFillAttribute(rSet);
     801             : 
     802       46037 :                 if(!aFill.isDefault())
     803             :                 {
     804             :                     // try fillfloattransparence
     805       22993 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
     806             :                 }
     807             :             }
     808             : 
     809             :             // bHasContent is used from OLE and graphic objects. Normally a possible shadow
     810             :             // depends on line, fill or text to be set, but for these objects it is possible
     811             :             // to have none of these, but still content which needs to have a shadow (if set),
     812             :             // so shadow needs to be tried
     813       46037 :             if(bHasContent || !aLine.isDefault() || !aFill.isDefault() || !aText.isDefault())
     814             :             {
     815             :                 // try shadow
     816       40796 :                 aShadow = createNewSdrShadowAttribute(rSet);
     817             : 
     818             :                 return attribute::SdrLineFillShadowTextAttribute(
     819       40796 :                     aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText);
     820             :             }
     821             : 
     822       51278 :             return attribute::SdrLineFillShadowTextAttribute();
     823             :         }
     824             : 
     825        2269 :         attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
     826             :         {
     827        2269 :             attribute::SdrFillAttribute aFill;
     828        4538 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     829        4538 :             attribute::SdrShadowAttribute aShadow;
     830        4538 :             attribute::FillGradientAttribute aFillFloatTransGradient;
     831             : 
     832             :             // try line style
     833        4538 :             const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet));
     834             : 
     835        2269 :             if(!aLine.isDefault())
     836             :             {
     837             :                 // try LineStartEnd
     838        1718 :                 aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     839             :             }
     840             : 
     841             :             // try fill style
     842        2269 :             if(!bSuppressFill)
     843             :             {
     844        2215 :                 aFill = createNewSdrFillAttribute(rSet);
     845             : 
     846        2215 :                 if(!aFill.isDefault())
     847             :                 {
     848             :                     // try fillfloattransparence
     849        1714 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
     850             :                 }
     851             :             }
     852             : 
     853        2269 :             if(!aLine.isDefault() || !aFill.isDefault())
     854             :             {
     855             :                 // try shadow
     856        2214 :                 aShadow = createNewSdrShadowAttribute(rSet);
     857             : 
     858             :                 return attribute::SdrLineFillShadowAttribute3D(
     859        2214 :                     aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient);
     860             :             }
     861             : 
     862        2324 :             return attribute::SdrLineFillShadowAttribute3D();
     863             :         }
     864             : 
     865         139 :         attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet)
     866             :         {
     867             :             // get perspective
     868         139 :             ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL);
     869         139 :             const sal_uInt16 nProjectionValue(((const Svx3DPerspectiveItem&)rSet.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue());
     870             : 
     871         139 :             if(1L == nProjectionValue)
     872             :             {
     873          34 :                 aProjectionMode = ::com::sun::star::drawing::ProjectionMode_PERSPECTIVE;
     874             :             }
     875             : 
     876             :             // get distance
     877         139 :             const double fDistance(((const Svx3DDistanceItem&)rSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue());
     878             : 
     879             :             // get shadow slant
     880         139 :             const double fShadowSlant(F_PI180 * ((const Svx3DShadowSlantItem&)rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue());
     881             : 
     882             :             // get shade mode
     883         139 :             ::com::sun::star::drawing::ShadeMode aShadeMode(::com::sun::star::drawing::ShadeMode_FLAT);
     884         139 :             const sal_uInt16 nShadeValue(((const Svx3DShadeModeItem&)rSet.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue());
     885             : 
     886         139 :             if(1L == nShadeValue)
     887             :             {
     888           0 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_PHONG;
     889             :             }
     890         139 :             else if(2L == nShadeValue)
     891             :             {
     892          50 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH;
     893             :             }
     894          89 :             else if(3L == nShadeValue)
     895             :             {
     896           0 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_DRAFT;
     897             :             }
     898             : 
     899             :             // get two sided lighting
     900         139 :             const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue());
     901             : 
     902         139 :             return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
     903             :         }
     904             : 
     905          11 :         attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet)
     906             :         {
     907             :             // extract lights from given SfxItemSet (from scene)
     908          11 :             ::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
     909             : 
     910          11 :             if(((const Svx3DLightOnOff1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue())
     911             :             {
     912           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().getBColor());
     913           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
     914           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, true));
     915             :             }
     916             : 
     917          11 :             if(((const Svx3DLightOnOff2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue())
     918             :             {
     919          11 :                 const basegfx::BColor aColor(((const Svx3DLightcolor2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().getBColor());
     920          22 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
     921          22 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     922             :             }
     923             : 
     924          11 :             if(((const Svx3DLightOnOff3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue())
     925             :             {
     926           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().getBColor());
     927           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
     928           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     929             :             }
     930             : 
     931          11 :             if(((const Svx3DLightOnOff4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue())
     932             :             {
     933           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().getBColor());
     934           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
     935           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     936             :             }
     937             : 
     938          11 :             if(((const Svx3DLightOnOff5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue())
     939             :             {
     940           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().getBColor());
     941           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
     942           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     943             :             }
     944             : 
     945          11 :             if(((const Svx3DLightOnOff6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue())
     946             :             {
     947           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().getBColor());
     948           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
     949           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     950             :             }
     951             : 
     952          11 :             if(((const Svx3DLightOnOff7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue())
     953             :             {
     954           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().getBColor());
     955           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
     956           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     957             :             }
     958             : 
     959          11 :             if(((const Svx3DLightOnOff8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue())
     960             :             {
     961           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().getBColor());
     962           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
     963           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     964             :             }
     965             : 
     966             :             // get ambient color
     967          11 :             const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
     968          22 :             const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
     969             : 
     970          22 :             return attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
     971             :         }
     972             : 
     973       24664 :         void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY)
     974             :         {
     975       24664 :             rfCornerRadiusX = rfCornerRadiusY = (double)nRadius;
     976             : 
     977       24664 :             if(0.0 != rfCornerRadiusX)
     978             :             {
     979          12 :                 const double fHalfObjectWidth(rObjectRange.getWidth() * 0.5);
     980             : 
     981          12 :                 if(0.0 != fHalfObjectWidth)
     982             :                 {
     983          12 :                     if(rfCornerRadiusX < 0.0)
     984             :                     {
     985           0 :                         rfCornerRadiusX = 0.0;
     986             :                     }
     987             : 
     988          12 :                     if(rfCornerRadiusX > fHalfObjectWidth)
     989             :                     {
     990           0 :                         rfCornerRadiusX = fHalfObjectWidth;
     991             :                     }
     992             : 
     993          12 :                     rfCornerRadiusX /= fHalfObjectWidth;
     994             :                 }
     995             :                 else
     996             :                 {
     997           0 :                     rfCornerRadiusX = 0.0;
     998             :                 }
     999             :             }
    1000             : 
    1001       24664 :             if(0.0 != rfCornerRadiusY)
    1002             :             {
    1003          12 :                 const double fHalfObjectHeight(rObjectRange.getHeight() * 0.5);
    1004             : 
    1005          12 :                 if(0.0 != fHalfObjectHeight)
    1006             :                 {
    1007          12 :                     if(rfCornerRadiusY < 0.0)
    1008             :                     {
    1009           0 :                         rfCornerRadiusY = 0.0;
    1010             :                     }
    1011             : 
    1012          12 :                     if(rfCornerRadiusY > fHalfObjectHeight)
    1013             :                     {
    1014           2 :                         rfCornerRadiusY = fHalfObjectHeight;
    1015             :                     }
    1016             : 
    1017          12 :                     rfCornerRadiusY /= fHalfObjectHeight;
    1018             :                 }
    1019             :                 else
    1020             :                 {
    1021           0 :                     rfCornerRadiusY = 0.0;
    1022             :                 }
    1023             :             }
    1024       24664 :         }
    1025             : 
    1026             :         // #i101508# Support handing over given text-to-border distances
    1027           0 :         attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(
    1028             :             const SfxItemSet& rSet,
    1029             :             const SdrText* pText,
    1030             :             const sal_Int32* pLeft,
    1031             :             const sal_Int32* pUpper,
    1032             :             const sal_Int32* pRight,
    1033             :             const sal_Int32* pLower)
    1034             :         {
    1035           0 :             attribute::SdrFillAttribute aFill;
    1036           0 :             attribute::FillGradientAttribute aFillFloatTransGradient;
    1037           0 :             attribute::SdrTextAttribute aText;
    1038           0 :             bool bFontworkHideContour(false);
    1039             : 
    1040             :             // look for text first
    1041           0 :             if(pText)
    1042             :             {
    1043           0 :                 aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower);
    1044             : 
    1045             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
    1046             :                 // fill style to empty
    1047           0 :                 if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
    1048             :                 {
    1049           0 :                     bFontworkHideContour = true;
    1050             :                 }
    1051             :             }
    1052             : 
    1053           0 :             if(!bFontworkHideContour)
    1054             :             {
    1055             :                 // try fill style
    1056           0 :                 aFill = createNewSdrFillAttribute(rSet);
    1057             : 
    1058           0 :                 if(!aFill.isDefault())
    1059             :                 {
    1060             :                     // try fillfloattransparence
    1061           0 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
    1062             :                 }
    1063             :             }
    1064             : 
    1065           0 :             if(!aFill.isDefault() || !aText.isDefault())
    1066             :             {
    1067           0 :                 return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText);
    1068             :             }
    1069             : 
    1070           0 :             return attribute::SdrFillTextAttribute();
    1071             :         }
    1072             : 
    1073             :     } // end of namespace primitive2d
    1074             : } // end of namespace drawinglayer
    1075             : 
    1076             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10