LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/svx/source/sdr/primitive2d - sdrattributecreator.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 295 381 77.4 %
Date: 2013-07-09 Functions: 20 21 95.2 %
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        2625 :         attribute::GradientStyle XGradientStyleToGradientStyle(XGradientStyle eStyle)
      86             :         {
      87        2625 :             switch(eStyle)
      88             :             {
      89             :                 case XGRAD_LINEAR :
      90             :                 {
      91        1543 :                     return attribute::GRADIENTSTYLE_LINEAR;
      92             :                 }
      93             :                 case XGRAD_AXIAL :
      94             :                 {
      95        1080 :                     return attribute::GRADIENTSTYLE_AXIAL;
      96             :                 }
      97             :                 case XGRAD_RADIAL :
      98             :                 {
      99           2 :                     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        1218 :         attribute::HatchStyle XHatchStyleToHatchStyle(XHatchStyle eStyle)
     117             :         {
     118        1218 :             switch(eStyle)
     119             :             {
     120             :                 case XHATCH_SINGLE :
     121             :                 {
     122        1218 :                     return attribute::HATCHSTYLE_SINGLE;
     123             :                 }
     124             :                 case XHATCH_DOUBLE :
     125             :                 {
     126           0 :                     return attribute::HATCHSTYLE_DOUBLE;
     127             :                 }
     128             :                 default :
     129             :                 {
     130           0 :                     return attribute::HATCHSTYLE_TRIPLE; // XHATCH_TRIPLE
     131             :                 }
     132             :             }
     133             :         }
     134             : 
     135       11205 :         basegfx::B2DLineJoin LineJointToB2DLineJoin(com::sun::star::drawing::LineJoint eLineJoint)
     136             :         {
     137       11205 :             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          14 :                     return basegfx::B2DLINEJOIN_BEVEL;
     146             :                 }
     147             :                 case com::sun::star::drawing::LineJoint_MITER :
     148             :                 {
     149         149 :                     return basegfx::B2DLINEJOIN_MITER;
     150             :                 }
     151             :                 case com::sun::star::drawing::LineJoint_ROUND :
     152             :                 {
     153       11042 :                     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         243 :         basegfx::B2DVector RectPointToB2DVector(RECT_POINT eRectPoint)
     163             :         {
     164         243 :             basegfx::B2DVector aRetval(0.0, 0.0);
     165             : 
     166             :             // position changes X
     167         243 :             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         243 :                     break;
     184             :                 }
     185             :             }
     186             : 
     187             :             // position changes Y
     188         243 :             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         243 :                     break;
     205             :                 }
     206             :             }
     207             : 
     208         243 :             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       46476 :         attribute::SdrLineAttribute createNewSdrLineAttribute(const SfxItemSet& rSet)
     220             :         {
     221       46476 :             const XLineStyle eStyle(((XLineStyleItem&)(rSet.Get(XATTR_LINESTYLE))).GetValue());
     222             : 
     223       46476 :             if(XLINE_NONE != eStyle)
     224             :             {
     225       11205 :                 sal_uInt16 nTransparence(((const XLineTransparenceItem&)(rSet.Get(XATTR_LINETRANSPARENCE))).GetValue());
     226             : 
     227       11205 :                 if(nTransparence > 100)
     228             :                 {
     229           0 :                     nTransparence = 100;
     230             :                 }
     231             : 
     232       11205 :                 if(100 != nTransparence)
     233             :                 {
     234       11205 :                     const sal_uInt32 nWidth(((const XLineWidthItem&)(rSet.Get(XATTR_LINEWIDTH))).GetValue());
     235       11205 :                     const Color aColor(((const XLineColorItem&)(rSet.Get(XATTR_LINECOLOR))).GetColorValue());
     236       11205 :                     const com::sun::star::drawing::LineJoint eJoint(((const XLineJointItem&)(rSet.Get(XATTR_LINEJOINT))).GetValue());
     237       11205 :                     const com::sun::star::drawing::LineCap eCap(((const XLineCapItem&)(rSet.Get(XATTR_LINECAP))).GetValue());
     238       11205 :                     ::std::vector< double > aDotDashArray;
     239       11205 :                     double fFullDotDashLen(0.0);
     240             : 
     241       11205 :                     if(XLINE_DASH == eStyle)
     242             :                     {
     243          24 :                         const XDash& rDash = ((const XLineDashItem&)(rSet.Get(XATTR_LINEDASH))).GetDashValue();
     244             : 
     245          24 :                         if(rDash.GetDots() || rDash.GetDashes())
     246             :                         {
     247          24 :                             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       11205 :                         fFullDotDashLen);
     259             :                 }
     260             :             }
     261             : 
     262       35271 :             return attribute::SdrLineAttribute();
     263             :         }
     264             : 
     265       11205 :         attribute::SdrLineStartEndAttribute createNewSdrLineStartEndAttribute(
     266             :             const SfxItemSet& rSet,
     267             :             double fWidth)
     268             :         {
     269       11205 :             const sal_Int32 nTempStartWidth(((const XLineStartWidthItem&)(rSet.Get(XATTR_LINESTARTWIDTH))).GetValue());
     270       11205 :             const sal_Int32 nTempEndWidth(((const XLineEndWidthItem&)(rSet.Get(XATTR_LINEENDWIDTH))).GetValue());
     271       11205 :             basegfx::B2DPolyPolygon aStartPolyPolygon;
     272       22410 :             basegfx::B2DPolyPolygon aEndPolyPolygon;
     273       11205 :             double fStartWidth(0.0);
     274       11205 :             double fEndWidth(0.0);
     275       11205 :             bool bStartActive(false);
     276       11205 :             bool bEndActive(false);
     277       11205 :             bool bStartCentered(true);
     278       11205 :             bool bEndCentered(true);
     279             : 
     280       11205 :             if(nTempStartWidth)
     281             :             {
     282       11205 :                 if(nTempStartWidth < 0L)
     283             :                 {
     284           0 :                     fStartWidth = ((double)(-nTempStartWidth) * fWidth) * 0.01;
     285             :                 }
     286             :                 else
     287             :                 {
     288       11205 :                     fStartWidth = (double)nTempStartWidth;
     289             :                 }
     290             : 
     291       11205 :                 if(0.0 != fStartWidth)
     292             :                 {
     293       11205 :                     aStartPolyPolygon = basegfx::B2DPolyPolygon(((const XLineStartItem&)(rSet.Get(XATTR_LINESTART))).GetLineStartValue());
     294             : 
     295       11205 :                     if(aStartPolyPolygon.count() && aStartPolyPolygon.getB2DPolygon(0L).count())
     296             :                     {
     297          17 :                         bStartActive = true;
     298          17 :                         bStartCentered = ((const XLineStartCenterItem&)(rSet.Get(XATTR_LINESTARTCENTER))).GetValue();
     299             :                     }
     300             :                 }
     301             :             }
     302             : 
     303       11205 :             if(nTempEndWidth)
     304             :             {
     305       11205 :                 if(nTempEndWidth < 0L)
     306             :                 {
     307           0 :                     fEndWidth = ((double)(-nTempEndWidth) * fWidth) * 0.01;
     308             :                 }
     309             :                 else
     310             :                 {
     311       11205 :                     fEndWidth = (double)nTempEndWidth;
     312             :                 }
     313             : 
     314       11205 :                 if(0.0 != fEndWidth)
     315             :                 {
     316       11205 :                     aEndPolyPolygon = basegfx::B2DPolyPolygon(((const XLineEndItem&)(rSet.Get(XATTR_LINEEND))).GetLineEndValue());
     317             : 
     318       11205 :                     if(aEndPolyPolygon.count() && aEndPolyPolygon.getB2DPolygon(0L).count())
     319             :                     {
     320           8 :                         bEndActive = true;
     321           8 :                         bEndCentered = ((const XLineEndCenterItem&)(rSet.Get(XATTR_LINEENDCENTER))).GetValue();
     322             :                     }
     323             :                 }
     324             :             }
     325             : 
     326       11205 :             if(bStartActive || bEndActive)
     327             :             {
     328             :                 return attribute::SdrLineStartEndAttribute(
     329             :                     aStartPolyPolygon, aEndPolyPolygon, fStartWidth, fEndWidth,
     330          24 :                     bStartActive, bEndActive, bStartCentered, bEndCentered);
     331             :             }
     332             : 
     333       22386 :             return attribute::SdrLineStartEndAttribute();
     334             :         }
     335             : 
     336       41961 :         attribute::SdrShadowAttribute createNewSdrShadowAttribute(const SfxItemSet& rSet)
     337             :         {
     338       41961 :             const bool bShadow(((SdrShadowItem&)rSet.Get(SDRATTR_SHADOW)).GetValue());
     339             : 
     340       41961 :             if(bShadow)
     341             :             {
     342           9 :                 sal_uInt16 nTransparence(((SdrShadowTransparenceItem&)(rSet.Get(SDRATTR_SHADOWTRANSPARENCE))).GetValue());
     343             : 
     344           9 :                 if(nTransparence > 100)
     345             :                 {
     346           0 :                     nTransparence = 100;
     347             :                 }
     348             : 
     349           9 :                 if(nTransparence)
     350             :                 {
     351           9 :                     sal_uInt16 nFillTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
     352             : 
     353           9 :                     if(nFillTransparence > 100)
     354             :                     {
     355           0 :                         nFillTransparence = 100;
     356             :                     }
     357             : 
     358           9 :                     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           9 :                 if(100 != nTransparence)
     369             :                 {
     370             :                     const basegfx::B2DVector aOffset(
     371           9 :                         (double)((SdrShadowXDistItem&)(rSet.Get(SDRATTR_SHADOWXDIST))).GetValue(),
     372          18 :                         (double)((SdrShadowYDistItem&)(rSet.Get(SDRATTR_SHADOWYDIST))).GetValue());
     373           9 :                     const Color aColor(((SdrShadowColorItem&)(rSet.Get(SDRATTR_SHADOWCOLOR))).GetColorValue());
     374             : 
     375           9 :                     return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor());
     376             :                 }
     377             :             }
     378             : 
     379       41952 :             return attribute::SdrShadowAttribute();
     380             :         }
     381             : 
     382       47382 :         attribute::SdrFillAttribute createNewSdrFillAttribute(const SfxItemSet& rSet)
     383             :         {
     384       47382 :             const XFillStyle eStyle(((XFillStyleItem&)(rSet.Get(XATTR_FILLSTYLE))).GetValue());
     385             : 
     386       47382 :             if(XFILL_NONE != eStyle)
     387             :             {
     388       26908 :                 sal_uInt16 nTransparence(((const XFillTransparenceItem&)(rSet.Get(XATTR_FILLTRANSPARENCE))).GetValue());
     389             : 
     390       26908 :                 if(nTransparence > 100)
     391             :                 {
     392           0 :                     nTransparence = 100;
     393             :                 }
     394             : 
     395       26908 :                 if(100 != nTransparence)
     396             :                 {
     397             :                     // need to check XFillFloatTransparence, object fill may still be completely transparent
     398             :                     const SfxPoolItem* pGradientItem;
     399             : 
     400       53800 :                     if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)
     401       26900 :                         && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
     402             :                     {
     403        2434 :                         const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
     404        2434 :                         const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
     405        2434 :                         const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
     406        2434 :                         const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
     407             : 
     408        2434 :                         if(bCompletelyTransparent)
     409             :                         {
     410           0 :                             nTransparence = 100;
     411             :                         }
     412             :                     }
     413             :                 }
     414             : 
     415       26908 :                 if(100 != nTransparence)
     416             :                 {
     417       26900 :                     const Color aColor(((const XFillColorItem&)(rSet.Get(XATTR_FILLCOLOR))).GetColorValue());
     418       26900 :                     attribute::FillGradientAttribute aGradient;
     419       53800 :                     attribute::FillHatchAttribute aHatch;
     420       53800 :                     attribute::SdrFillGraphicAttribute aFillGraphic;
     421             : 
     422       26900 :                     switch(eStyle)
     423             :                     {
     424             :                         case XFILL_NONE : // for warnings
     425             :                         case XFILL_SOLID :
     426             :                         {
     427             :                             // nothing to do, color is defined
     428       25248 :                             break;
     429             :                         }
     430             :                         case XFILL_GRADIENT :
     431             :                         {
     432         191 :                             XGradient aXGradient(((XFillGradientItem&)(rSet.Get(XATTR_FILLGRADIENT))).GetGradientValue());
     433             : 
     434         191 :                             const Color aStartColor(aXGradient.GetStartColor());
     435         191 :                             const sal_uInt16 nStartIntens(aXGradient.GetStartIntens());
     436         191 :                             basegfx::BColor aStart(aStartColor.getBColor());
     437             : 
     438         191 :                             if(nStartIntens != 100)
     439             :                             {
     440           0 :                                 const basegfx::BColor aBlack;
     441           0 :                                 aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01);
     442             :                             }
     443             : 
     444         191 :                             const Color aEndColor(aXGradient.GetEndColor());
     445         191 :                             const sal_uInt16 nEndIntens(aXGradient.GetEndIntens());
     446         382 :                             basegfx::BColor aEnd(aEndColor.getBColor());
     447             : 
     448         191 :                             if(nEndIntens != 100)
     449             :                             {
     450           0 :                                 const basegfx::BColor aBlack;
     451           0 :                                 aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01);
     452             :                             }
     453             : 
     454        1146 :                             aGradient = attribute::FillGradientAttribute(
     455             :                                 XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()),
     456         191 :                                 (double)aXGradient.GetBorder() * 0.01,
     457         191 :                                 (double)aXGradient.GetXOffset() * 0.01,
     458         191 :                                 (double)aXGradient.GetYOffset() * 0.01,
     459         191 :                                 (double)aXGradient.GetAngle() * F_PI1800,
     460             :                                 aStart,
     461             :                                 aEnd,
     462         382 :                                 ((const XGradientStepCountItem&)rSet.Get(XATTR_GRADIENTSTEPCOUNT)).GetValue());
     463             : 
     464         382 :                             break;
     465             :                         }
     466             :                         case XFILL_HATCH :
     467             :                         {
     468        1218 :                             const XHatch& rHatch(((XFillHatchItem&)(rSet.Get(XATTR_FILLHATCH))).GetHatchValue());
     469        1218 :                             const Color aColorB(rHatch.GetColor());
     470             : 
     471        4872 :                             aHatch = attribute::FillHatchAttribute(
     472             :                                 XHatchStyleToHatchStyle(rHatch.GetHatchStyle()),
     473        1218 :                                 (double)rHatch.GetDistance(),
     474        1218 :                                 (double)rHatch.GetAngle() * F_PI1800,
     475             :                                 aColorB.getBColor(),
     476             :                                 3, // same default as VCL, a minimum of three discrete units (pixels) offset
     477        2436 :                                 ((const XFillBackgroundItem&)(rSet.Get(XATTR_FILLBACKGROUND))).GetValue());
     478             : 
     479        1218 :                             break;
     480             :                         }
     481             :                         case XFILL_BITMAP :
     482             :                         {
     483         243 :                             aFillGraphic = createNewSdrFillGraphicAttribute(rSet);
     484         243 :                             break;
     485             :                         }
     486             :                     }
     487             : 
     488             :                     return attribute::SdrFillAttribute(
     489             :                         (double)nTransparence * 0.01,
     490             :                         aColor.getBColor(),
     491             :                         aGradient,
     492             :                         aHatch,
     493       53800 :                         aFillGraphic);
     494             :                 }
     495             :             }
     496             : 
     497       20482 :             return attribute::SdrFillAttribute();
     498             :         }
     499             : 
     500             :         // #i101508# Support handing over given text-to-border distances
     501       39359 :         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       39359 :             const SdrTextObj& rTextObj = rText.GetObject();
     510             : 
     511       39359 :             if(rText.GetOutlinerParaObject() && rText.GetModel())
     512             :             {
     513             :                 // added TextEdit text suppression
     514       13688 :                 bool bInEditMode(false);
     515             : 
     516       13688 :                 if(rText.GetObject().getTextCount() > 1)
     517             :                 {
     518           0 :                     bInEditMode = rTextObj.IsInEditMode() && rText.GetObject().getActiveText() == &rText;
     519             :                 }
     520             :                 else
     521             :                 {
     522       13688 :                     bInEditMode = rTextObj.IsInEditMode();
     523             :                 }
     524             : 
     525       13688 :                 OutlinerParaObject aOutlinerParaObject(*rText.GetOutlinerParaObject());
     526             : 
     527       13688 :                 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       13688 :                 const SdrTextAniKind eAniKind(rTextObj.GetTextAniKind());
     546             : 
     547             :                 // #i107346#
     548       13688 :                 const SdrOutliner& rDrawTextOutliner = rText.GetModel()->GetDrawOutliner(&rTextObj);
     549       13688 :                 const bool bWrongSpell(rDrawTextOutliner.GetControlWord() & EE_CNTRL_ONLINESPELLING);
     550             : 
     551             :                 return attribute::SdrTextAttribute(
     552             :                     rText,
     553             :                     aOutlinerParaObject,
     554       13688 :                     ((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       13688 :                     ((const SdrTextContourFrameItem&)rSet.Get(SDRATTR_TEXT_CONTOURFRAME)).GetValue(),
     562       13688 :                     rTextObj.IsFitToSize(),
     563       13688 :                     rTextObj.IsAutoFit(),
     564       13688 :                     ((const XFormTextHideFormItem&)rSet.Get(XATTR_FORMTXTHIDEFORM)).GetValue(),
     565             :                     SDRTEXTANI_BLINK == eAniKind,
     566       13688 :                     SDRTEXTANI_SCROLL == eAniKind || SDRTEXTANI_ALTERNATE == eAniKind || SDRTEXTANI_SLIDE == eAniKind,
     567             :                     bInEditMode,
     568       13688 :                     ((const SdrTextFixedCellHeightItem&)rSet.Get(SDRATTR_TEXT_USEFIXEDCELLHEIGHT)).GetValue(),
     569      109504 :                     bWrongSpell);
     570             :             }
     571             : 
     572       25671 :             return attribute::SdrTextAttribute();
     573             :         }
     574             : 
     575       26882 :         attribute::FillGradientAttribute createNewTransparenceGradientAttribute(const SfxItemSet& rSet)
     576             :         {
     577             :             const SfxPoolItem* pGradientItem;
     578             : 
     579       53764 :             if(SFX_ITEM_SET == rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, sal_True, &pGradientItem)
     580       26882 :                 && ((XFillFloatTransparenceItem*)pGradientItem)->IsEnabled())
     581             :             {
     582             :                 // test if float transparence is completely transparent
     583        2434 :                 const XGradient& rGradient = ((XFillFloatTransparenceItem*)pGradientItem)->GetGradientValue();
     584        2434 :                 const sal_uInt8 nStartLuminance(rGradient.GetStartColor().GetLuminance());
     585        2434 :                 const sal_uInt8 nEndLuminance(rGradient.GetEndColor().GetLuminance());
     586        2434 :                 const bool bCompletelyTransparent(0xff == nStartLuminance && 0xff == nEndLuminance);
     587        2434 :                 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        2434 :                 if(!bNotTransparent && !bCompletelyTransparent)
     594             :                 {
     595        2434 :                     const double fStartLum(nStartLuminance / 255.0);
     596        2434 :                     const double fEndLum(nEndLuminance / 255.0);
     597             : 
     598             :                     return attribute::FillGradientAttribute(
     599             :                         XGradientStyleToGradientStyle(rGradient.GetGradientStyle()),
     600        2434 :                         (double)rGradient.GetBorder() * 0.01,
     601        2434 :                         (double)rGradient.GetXOffset() * 0.01,
     602        2434 :                         (double)rGradient.GetYOffset() * 0.01,
     603        2434 :                         (double)rGradient.GetAngle() * F_PI1800,
     604             :                         basegfx::BColor(fStartLum, fStartLum, fStartLum),
     605             :                         basegfx::BColor(fEndLum, fEndLum, fEndLum),
     606       12170 :                         0);
     607             :                 }
     608             :             }
     609             : 
     610       24448 :             return attribute::FillGradientAttribute();
     611             :         }
     612             : 
     613         243 :         attribute::SdrFillGraphicAttribute createNewSdrFillGraphicAttribute(const SfxItemSet& rSet)
     614             :         {
     615         243 :             Graphic aGraphic(((const XFillBitmapItem&)(rSet.Get(XATTR_FILLBITMAP))).GetGraphicObject().GetGraphic());
     616             : 
     617         243 :             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         243 :             Size aPrefSize(aGraphic.GetPrefSize());
     625             : 
     626         243 :             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         243 :             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         243 :             const MapUnit aDestinationMapUnit((MapUnit)rSet.GetPool()->GetMetric(0));
     645             : 
     646         243 :             if(aGraphic.GetPrefMapMode() != aDestinationMapUnit)
     647             :             {
     648             :                 // #i100360# for MAP_PIXEL, LogicToLogic will not work properly,
     649             :                 // so fallback to Application::GetDefaultDevice()
     650         243 :                 if(MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit())
     651             :                 {
     652             :                     aGraphic.SetPrefSize(
     653             :                         Application::GetDefaultDevice()->PixelToLogic(
     654             :                             aGraphic.GetPrefSize(),
     655         243 :                             aDestinationMapUnit));
     656             :                 }
     657             :                 else
     658             :                 {
     659             :                     aGraphic.SetPrefSize(
     660             :                         OutputDevice::LogicToLogic(
     661             :                             aGraphic.GetPrefSize(),
     662             :                             aGraphic.GetPrefMapMode(),
     663           0 :                             aDestinationMapUnit));
     664             :                 }
     665             :             }
     666             : 
     667             :             // get size
     668             :             const basegfx::B2DVector aSize(
     669         243 :                 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEX))).GetValue(),
     670         729 :                 (double)((const SfxMetricItem&)(rSet.Get(XATTR_FILLBMP_SIZEY))).GetValue());
     671             :             const basegfx::B2DVector aOffset(
     672         243 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETX))).GetValue(),
     673         729 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_TILEOFFSETY))).GetValue());
     674             :             const basegfx::B2DVector aOffsetPosition(
     675         243 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETX))).GetValue(),
     676         729 :                 (double)((const SfxUInt16Item&) (rSet.Get(XATTR_FILLBMP_POSOFFSETY))).GetValue());
     677             : 
     678             :             return attribute::SdrFillGraphicAttribute(
     679             :                 aGraphic,
     680             :                 aSize,
     681             :                 aOffset,
     682             :                 aOffsetPosition,
     683         243 :                 RectPointToB2DVector((RECT_POINT)((const SfxEnumItem&)(rSet.Get(XATTR_FILLBMP_POS))).GetValue()),
     684         243 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_TILE))).GetValue(),
     685         243 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_STRETCH))).GetValue(),
     686        1215 :                 ((const SfxBoolItem&) (rSet.Get(XATTR_FILLBMP_SIZELOG))).GetValue());
     687             :         }
     688             : 
     689         428 :         attribute::SdrShadowTextAttribute createNewSdrShadowTextAttribute(
     690             :             const SfxItemSet& rSet,
     691             :             const SdrText* pText,
     692             :             bool bSuppressText)
     693             :         {
     694         428 :             attribute::SdrTextAttribute aText;
     695             : 
     696             :             // #i98072# added option to suppress text
     697             :             // look for text first
     698         428 :             if(!bSuppressText && pText)
     699             :             {
     700         394 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     701             :             }
     702             : 
     703             :             // try shadow
     704         856 :             const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
     705             : 
     706         856 :             return attribute::SdrShadowTextAttribute(aShadow, aText);
     707             :         }
     708             : 
     709           8 :         attribute::SdrLineShadowTextAttribute createNewSdrLineShadowTextAttribute(
     710             :             const SfxItemSet& rSet,
     711             :             const SdrText* pText)
     712             :         {
     713           8 :             attribute::SdrLineAttribute aLine;
     714          16 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     715          16 :             attribute::SdrTextAttribute aText;
     716           8 :             bool bFontworkHideContour(false);
     717             : 
     718             :             // look for text first
     719           8 :             if(pText)
     720             :             {
     721           8 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     722             : 
     723             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
     724             :                 // line and fill style to empty
     725          16 :                 if(!aText.isDefault()
     726           1 :                     && !aText.getSdrFormTextAttribute().isDefault()
     727           8 :                     && aText.isHideContour())
     728             :                 {
     729           0 :                     bFontworkHideContour = true;
     730             :                 }
     731             :             }
     732             : 
     733             :             // try line style
     734           8 :             if(!bFontworkHideContour)
     735             :             {
     736           8 :                 aLine = createNewSdrLineAttribute(rSet);
     737             : 
     738           8 :                 if(!aLine.isDefault())
     739             :                 {
     740             :                     // try LineStartEnd
     741           8 :                     aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     742             :                 }
     743             :             }
     744             : 
     745           8 :             if(!aLine.isDefault() || !aText.isDefault())
     746             :             {
     747             :                 // try shadow
     748           8 :                 const attribute::SdrShadowAttribute aShadow(createNewSdrShadowAttribute(rSet));
     749             : 
     750           8 :                 return attribute::SdrLineShadowTextAttribute(aLine, aLineStartEnd, aShadow, aText);
     751             :             }
     752             : 
     753           8 :             return attribute::SdrLineShadowTextAttribute();
     754             :         }
     755             : 
     756       38944 :         attribute::SdrLineFillShadowTextAttribute createNewSdrLineFillShadowTextAttribute(
     757             :             const SfxItemSet& rSet,
     758             :             const SdrText* pText,
     759             :             bool bHasContent)
     760             :         {
     761       38944 :             attribute::SdrLineAttribute aLine;
     762       77888 :             attribute::SdrFillAttribute aFill;
     763       77888 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     764       77888 :             attribute::SdrShadowAttribute aShadow;
     765       77888 :             attribute::FillGradientAttribute aFillFloatTransGradient;
     766       77888 :             attribute::SdrTextAttribute aText;
     767       38944 :             bool bFontworkHideContour(false);
     768             : 
     769             :             // look for text first
     770       38944 :             if(pText)
     771             :             {
     772       38944 :                 aText = createNewSdrTextAttribute(rSet, *pText);
     773             : 
     774             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
     775             :                 // line and fill style to empty
     776       38944 :                 if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
     777             :                 {
     778           0 :                     bFontworkHideContour = true;
     779             :                 }
     780             :             }
     781             : 
     782       38944 :             if(!bFontworkHideContour)
     783             :             {
     784             :                 // try line style
     785       38944 :                 aLine = createNewSdrLineAttribute(rSet);
     786             : 
     787       38944 :                 if(!aLine.isDefault())
     788             :                 {
     789             :                     // try LineStartEnd
     790        8301 :                     aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     791             :                 }
     792             : 
     793             :                 // try fill style
     794       38944 :                 aFill = createNewSdrFillAttribute(rSet);
     795             : 
     796       38944 :                 if(!aFill.isDefault())
     797             :                 {
     798             :                     // try fillfloattransparence
     799       19996 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
     800             :                 }
     801             :             }
     802             : 
     803             :             // bHasContent is used from OLE and graphic objects. Normally a possible shadow
     804             :             // depends on line, fill or text to be set, but for these objects it is possible
     805             :             // to have none of these, but still content which needs to have a shadow (if set),
     806             :             // so shadow needs to be tried
     807       38944 :             if(bHasContent || !aLine.isDefault() || !aFill.isDefault() || !aText.isDefault())
     808             :             {
     809             :                 // try shadow
     810       34001 :                 aShadow = createNewSdrShadowAttribute(rSet);
     811             : 
     812             :                 return attribute::SdrLineFillShadowTextAttribute(
     813       34001 :                     aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient, aText);
     814             :             }
     815             : 
     816       43887 :             return attribute::SdrLineFillShadowTextAttribute();
     817             :         }
     818             : 
     819        7524 :         attribute::SdrLineFillShadowAttribute3D createNewSdrLineFillShadowAttribute(const SfxItemSet& rSet, bool bSuppressFill)
     820             :         {
     821        7524 :             attribute::SdrFillAttribute aFill;
     822       15048 :             attribute::SdrLineStartEndAttribute aLineStartEnd;
     823       15048 :             attribute::SdrShadowAttribute aShadow;
     824       15048 :             attribute::FillGradientAttribute aFillFloatTransGradient;
     825             : 
     826             :             // try line style
     827       15048 :             const attribute::SdrLineAttribute aLine(createNewSdrLineAttribute(rSet));
     828             : 
     829        7524 :             if(!aLine.isDefault())
     830             :             {
     831             :                 // try LineStartEnd
     832        2896 :                 aLineStartEnd = createNewSdrLineStartEndAttribute(rSet, aLine.getWidth());
     833             :             }
     834             : 
     835             :             // try fill style
     836        7524 :             if(!bSuppressFill)
     837             :             {
     838        7524 :                 aFill = createNewSdrFillAttribute(rSet);
     839             : 
     840        7524 :                 if(!aFill.isDefault())
     841             :                 {
     842             :                     // try fillfloattransparence
     843        6886 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
     844             :                 }
     845             :             }
     846             : 
     847        7524 :             if(!aLine.isDefault() || !aFill.isDefault())
     848             :             {
     849             :                 // try shadow
     850        7524 :                 aShadow = createNewSdrShadowAttribute(rSet);
     851             : 
     852             :                 return attribute::SdrLineFillShadowAttribute3D(
     853        7524 :                     aLine, aFill, aLineStartEnd, aShadow, aFillFloatTransGradient);
     854             :             }
     855             : 
     856        7524 :             return attribute::SdrLineFillShadowAttribute3D();
     857             :         }
     858             : 
     859         311 :         attribute::SdrSceneAttribute createNewSdrSceneAttribute(const SfxItemSet& rSet)
     860             :         {
     861             :             // get perspective
     862         311 :             ::com::sun::star::drawing::ProjectionMode aProjectionMode(::com::sun::star::drawing::ProjectionMode_PARALLEL);
     863         311 :             const sal_uInt16 nProjectionValue(((const Svx3DPerspectiveItem&)rSet.Get(SDRATTR_3DSCENE_PERSPECTIVE)).GetValue());
     864             : 
     865         311 :             if(1L == nProjectionValue)
     866             :             {
     867          48 :                 aProjectionMode = ::com::sun::star::drawing::ProjectionMode_PERSPECTIVE;
     868             :             }
     869             : 
     870             :             // get distance
     871         311 :             const double fDistance(((const Svx3DDistanceItem&)rSet.Get(SDRATTR_3DSCENE_DISTANCE)).GetValue());
     872             : 
     873             :             // get shadow slant
     874         311 :             const double fShadowSlant(F_PI180 * ((const Svx3DShadowSlantItem&)rSet.Get(SDRATTR_3DSCENE_SHADOW_SLANT)).GetValue());
     875             : 
     876             :             // get shade mode
     877         311 :             ::com::sun::star::drawing::ShadeMode aShadeMode(::com::sun::star::drawing::ShadeMode_FLAT);
     878         311 :             const sal_uInt16 nShadeValue(((const Svx3DShadeModeItem&)rSet.Get(SDRATTR_3DSCENE_SHADE_MODE)).GetValue());
     879             : 
     880         311 :             if(1L == nShadeValue)
     881             :             {
     882           0 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_PHONG;
     883             :             }
     884         311 :             else if(2L == nShadeValue)
     885             :             {
     886         311 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_SMOOTH;
     887             :             }
     888           0 :             else if(3L == nShadeValue)
     889             :             {
     890           0 :                 aShadeMode = ::com::sun::star::drawing::ShadeMode_DRAFT;
     891             :             }
     892             : 
     893             :             // get two sided lighting
     894         311 :             const bool bTwoSidedLighting(((const Svx3DTwoSidedLightingItem&)rSet.Get(SDRATTR_3DSCENE_TWO_SIDED_LIGHTING)).GetValue());
     895             : 
     896         311 :             return attribute::SdrSceneAttribute(fDistance, fShadowSlant, aProjectionMode, aShadeMode, bTwoSidedLighting);
     897             :         }
     898             : 
     899           7 :         attribute::SdrLightingAttribute createNewSdrLightingAttribute(const SfxItemSet& rSet)
     900             :         {
     901             :             // extract lights from given SfxItemSet (from scene)
     902           7 :             ::std::vector< attribute::Sdr3DLightAttribute > aLightVector;
     903             : 
     904           7 :             if(((const Svx3DLightOnOff1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_1)).GetValue())
     905             :             {
     906           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_1)).GetValue().getBColor());
     907           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection1Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_1)).GetValue());
     908           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, true));
     909             :             }
     910             : 
     911           7 :             if(((const Svx3DLightOnOff2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_2)).GetValue())
     912             :             {
     913           7 :                 const basegfx::BColor aColor(((const Svx3DLightcolor2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_2)).GetValue().getBColor());
     914          14 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection2Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_2)).GetValue());
     915          14 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     916             :             }
     917             : 
     918           7 :             if(((const Svx3DLightOnOff3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_3)).GetValue())
     919             :             {
     920           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_3)).GetValue().getBColor());
     921           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection3Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_3)).GetValue());
     922           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     923             :             }
     924             : 
     925           7 :             if(((const Svx3DLightOnOff4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_4)).GetValue())
     926             :             {
     927           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_4)).GetValue().getBColor());
     928           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection4Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_4)).GetValue());
     929           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     930             :             }
     931             : 
     932           7 :             if(((const Svx3DLightOnOff5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_5)).GetValue())
     933             :             {
     934           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_5)).GetValue().getBColor());
     935           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection5Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_5)).GetValue());
     936           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     937             :             }
     938             : 
     939           7 :             if(((const Svx3DLightOnOff6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_6)).GetValue())
     940             :             {
     941           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_6)).GetValue().getBColor());
     942           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection6Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_6)).GetValue());
     943           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     944             :             }
     945             : 
     946           7 :             if(((const Svx3DLightOnOff7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_7)).GetValue())
     947             :             {
     948           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_7)).GetValue().getBColor());
     949           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection7Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_7)).GetValue());
     950           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     951             :             }
     952             : 
     953           7 :             if(((const Svx3DLightOnOff8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTON_8)).GetValue())
     954             :             {
     955           0 :                 const basegfx::BColor aColor(((const Svx3DLightcolor8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTCOLOR_8)).GetValue().getBColor());
     956           0 :                 const basegfx::B3DVector aDirection(((const Svx3DLightDirection8Item&)rSet.Get(SDRATTR_3DSCENE_LIGHTDIRECTION_8)).GetValue());
     957           0 :                 aLightVector.push_back(attribute::Sdr3DLightAttribute(aColor, aDirection, false));
     958             :             }
     959             : 
     960             :             // get ambient color
     961           7 :             const Color aAmbientValue(((const Svx3DAmbientcolorItem&)rSet.Get(SDRATTR_3DSCENE_AMBIENTCOLOR)).GetValue());
     962          14 :             const basegfx::BColor aAmbientLight(aAmbientValue.getBColor());
     963             : 
     964          14 :             return attribute::SdrLightingAttribute(aAmbientLight, aLightVector);
     965             :         }
     966             : 
     967       22954 :         void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY)
     968             :         {
     969       22954 :             rfCornerRadiusX = rfCornerRadiusY = (double)nRadius;
     970             : 
     971       22954 :             if(0.0 != rfCornerRadiusX)
     972             :             {
     973           4 :                 const double fHalfObjectWidth(rObjectRange.getWidth() * 0.5);
     974             : 
     975           4 :                 if(0.0 != fHalfObjectWidth)
     976             :                 {
     977           4 :                     if(rfCornerRadiusX < 0.0)
     978             :                     {
     979           0 :                         rfCornerRadiusX = 0.0;
     980             :                     }
     981             : 
     982           4 :                     if(rfCornerRadiusX > fHalfObjectWidth)
     983             :                     {
     984           0 :                         rfCornerRadiusX = fHalfObjectWidth;
     985             :                     }
     986             : 
     987           4 :                     rfCornerRadiusX /= fHalfObjectWidth;
     988             :                 }
     989             :                 else
     990             :                 {
     991           0 :                     rfCornerRadiusX = 0.0;
     992             :                 }
     993             :             }
     994             : 
     995       22954 :             if(0.0 != rfCornerRadiusY)
     996             :             {
     997           4 :                 const double fHalfObjectHeight(rObjectRange.getHeight() * 0.5);
     998             : 
     999           4 :                 if(0.0 != fHalfObjectHeight)
    1000             :                 {
    1001           4 :                     if(rfCornerRadiusY < 0.0)
    1002             :                     {
    1003           0 :                         rfCornerRadiusY = 0.0;
    1004             :                     }
    1005             : 
    1006           4 :                     if(rfCornerRadiusY > fHalfObjectHeight)
    1007             :                     {
    1008           0 :                         rfCornerRadiusY = fHalfObjectHeight;
    1009             :                     }
    1010             : 
    1011           4 :                     rfCornerRadiusY /= fHalfObjectHeight;
    1012             :                 }
    1013             :                 else
    1014             :                 {
    1015           0 :                     rfCornerRadiusY = 0.0;
    1016             :                 }
    1017             :             }
    1018       22954 :         }
    1019             : 
    1020             :         // #i101508# Support handing over given text-to-border distances
    1021           0 :         attribute::SdrFillTextAttribute createNewSdrFillTextAttribute(
    1022             :             const SfxItemSet& rSet,
    1023             :             const SdrText* pText,
    1024             :             const sal_Int32* pLeft,
    1025             :             const sal_Int32* pUpper,
    1026             :             const sal_Int32* pRight,
    1027             :             const sal_Int32* pLower)
    1028             :         {
    1029           0 :             attribute::SdrFillAttribute aFill;
    1030           0 :             attribute::FillGradientAttribute aFillFloatTransGradient;
    1031           0 :             attribute::SdrTextAttribute aText;
    1032           0 :             bool bFontworkHideContour(false);
    1033             : 
    1034             :             // look for text first
    1035           0 :             if(pText)
    1036             :             {
    1037           0 :                 aText = createNewSdrTextAttribute(rSet, *pText, pLeft, pUpper, pRight, pLower);
    1038             : 
    1039             :                 // when object has text and text is fontwork and hide contour is set for fontwork, force
    1040             :                 // fill style to empty
    1041           0 :                 if(!aText.getSdrFormTextAttribute().isDefault() && aText.isHideContour())
    1042             :                 {
    1043           0 :                     bFontworkHideContour = true;
    1044             :                 }
    1045             :             }
    1046             : 
    1047           0 :             if(!bFontworkHideContour)
    1048             :             {
    1049             :                 // try fill style
    1050           0 :                 aFill = createNewSdrFillAttribute(rSet);
    1051             : 
    1052           0 :                 if(!aFill.isDefault())
    1053             :                 {
    1054             :                     // try fillfloattransparence
    1055           0 :                     aFillFloatTransGradient = createNewTransparenceGradientAttribute(rSet);
    1056             :                 }
    1057             :             }
    1058             : 
    1059           0 :             if(!aFill.isDefault() || !aText.isDefault())
    1060             :             {
    1061           0 :                 return attribute::SdrFillTextAttribute(aFill, aFillFloatTransGradient, aText);
    1062             :             }
    1063             : 
    1064           0 :             return attribute::SdrFillTextAttribute();
    1065             :         }
    1066             : 
    1067             :     } // end of namespace primitive2d
    1068         258 : } // end of namespace drawinglayer
    1069             : 
    1070             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10