LCOV - code coverage report
Current view: top level - usr/local/src/libreoffice/sc/source/filter/oox - drawingmanager.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 138 0.7 %
Date: 2013-07-09 Functions: 2 18 11.1 %
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 "drawingmanager.hxx"
      21             : 
      22             : #include <com/sun/star/awt/Rectangle.hpp>
      23             : #include <com/sun/star/drawing/CircleKind.hpp>
      24             : #include <com/sun/star/drawing/PointSequenceSequence.hpp>
      25             : #include <com/sun/star/drawing/PolygonKind.hpp>
      26             : #include <com/sun/star/drawing/XShapes.hpp>
      27             : #include "oox/core/filterbase.hxx"
      28             : #include "oox/drawingml/fillproperties.hxx"
      29             : #include "oox/drawingml/lineproperties.hxx"
      30             : #include "oox/drawingml/shapepropertymap.hxx"
      31             : #include "oox/helper/containerhelper.hxx"
      32             : #include "oox/token/tokens.hxx"
      33             : #include "biffinputstream.hxx"
      34             : #include "unitconverter.hxx"
      35             : 
      36             : namespace oox {
      37             : namespace xls {
      38             : 
      39             : // ============================================================================
      40             : 
      41             : using namespace ::com::sun::star::awt;
      42             : using namespace ::com::sun::star::drawing;
      43             : using namespace ::com::sun::star::lang;
      44             : using namespace ::com::sun::star::uno;
      45             : using namespace ::oox::drawingml;
      46             : 
      47             : 
      48             : // ============================================================================
      49             : 
      50             : namespace {
      51             : 
      52             : // OBJ record -----------------------------------------------------------------
      53             : 
      54             : const sal_uInt16 BIFF_OBJTYPE_GROUP         = 0;
      55             : const sal_uInt16 BIFF_OBJTYPE_LINE          = 1;
      56             : const sal_uInt16 BIFF_OBJTYPE_RECTANGLE     = 2;
      57             : const sal_uInt16 BIFF_OBJTYPE_OVAL          = 3;
      58             : const sal_uInt16 BIFF_OBJTYPE_ARC           = 4;
      59             : const sal_uInt16 BIFF_OBJTYPE_CHART         = 5;
      60             : const sal_uInt16 BIFF_OBJTYPE_TEXT          = 6;
      61             : const sal_uInt16 BIFF_OBJTYPE_BUTTON        = 7;
      62             : const sal_uInt16 BIFF_OBJTYPE_PICTURE       = 8;
      63             : const sal_uInt16 BIFF_OBJTYPE_POLYGON       = 9;        // new in BIFF4
      64             : const sal_uInt16 BIFF_OBJTYPE_CHECKBOX      = 11;       // new in BIFF5
      65             : const sal_uInt16 BIFF_OBJTYPE_OPTIONBUTTON  = 12;
      66             : const sal_uInt16 BIFF_OBJTYPE_EDIT          = 13;
      67             : const sal_uInt16 BIFF_OBJTYPE_LABEL         = 14;
      68             : const sal_uInt16 BIFF_OBJTYPE_DIALOG        = 15;
      69             : const sal_uInt16 BIFF_OBJTYPE_SPIN          = 16;
      70             : const sal_uInt16 BIFF_OBJTYPE_SCROLLBAR     = 17;
      71             : const sal_uInt16 BIFF_OBJTYPE_LISTBOX       = 18;
      72             : const sal_uInt16 BIFF_OBJTYPE_GROUPBOX      = 19;
      73             : const sal_uInt16 BIFF_OBJTYPE_DROPDOWN      = 20;
      74             : const sal_uInt16 BIFF_OBJTYPE_NOTE          = 25;       // new in BIFF8
      75             : const sal_uInt16 BIFF_OBJTYPE_DRAWING       = 30;
      76             : const sal_uInt16 BIFF_OBJTYPE_UNKNOWN       = 0xFFFF;   // for internal use only
      77             : 
      78             : const sal_uInt16 BIFF_OBJ_HIDDEN            = 0x0100;
      79             : const sal_uInt16 BIFF_OBJ_VISIBLE           = 0x0200;
      80             : const sal_uInt16 BIFF_OBJ_PRINTABLE         = 0x0400;
      81             : 
      82             : // line formatting ------------------------------------------------------------
      83             : 
      84             : const sal_uInt8 BIFF_OBJ_LINE_AUTOCOLOR     = 64;
      85             : 
      86             : const sal_uInt8 BIFF_OBJ_LINE_SOLID         = 0;
      87             : const sal_uInt8 BIFF_OBJ_LINE_DASH          = 1;
      88             : const sal_uInt8 BIFF_OBJ_LINE_DOT           = 2;
      89             : const sal_uInt8 BIFF_OBJ_LINE_DASHDOT       = 3;
      90             : const sal_uInt8 BIFF_OBJ_LINE_DASHDOTDOT    = 4;
      91             : const sal_uInt8 BIFF_OBJ_LINE_MEDTRANS      = 5;
      92             : const sal_uInt8 BIFF_OBJ_LINE_DARKTRANS     = 6;
      93             : const sal_uInt8 BIFF_OBJ_LINE_LIGHTTRANS    = 7;
      94             : const sal_uInt8 BIFF_OBJ_LINE_NONE          = 255;
      95             : 
      96             : const sal_uInt8 BIFF_OBJ_LINE_HAIR          = 0;
      97             : const sal_uInt8 BIFF_OBJ_LINE_THIN          = 1;
      98             : const sal_uInt8 BIFF_OBJ_LINE_MEDIUM        = 2;
      99             : const sal_uInt8 BIFF_OBJ_LINE_THICK         = 3;
     100             : 
     101             : const sal_uInt8 BIFF_OBJ_LINE_AUTO          = 0x01;
     102             : 
     103             : const sal_uInt8 BIFF_OBJ_ARROW_NONE         = 0;
     104             : const sal_uInt8 BIFF_OBJ_ARROW_OPEN         = 1;
     105             : const sal_uInt8 BIFF_OBJ_ARROW_FILLED       = 2;
     106             : const sal_uInt8 BIFF_OBJ_ARROW_OPENBOTH     = 3;
     107             : const sal_uInt8 BIFF_OBJ_ARROW_FILLEDBOTH   = 4;
     108             : 
     109             : const sal_uInt8 BIFF_OBJ_ARROW_NARROW       = 0;
     110             : const sal_uInt8 BIFF_OBJ_ARROW_MEDIUM       = 1;
     111             : const sal_uInt8 BIFF_OBJ_ARROW_WIDE         = 2;
     112             : 
     113             : const sal_uInt8 BIFF_OBJ_LINE_TL            = 0;
     114             : const sal_uInt8 BIFF_OBJ_LINE_TR            = 1;
     115             : const sal_uInt8 BIFF_OBJ_LINE_BR            = 2;
     116             : const sal_uInt8 BIFF_OBJ_LINE_BL            = 3;
     117             : 
     118             : const sal_uInt8 BIFF_OBJ_ARC_TR             = 0;
     119             : const sal_uInt8 BIFF_OBJ_ARC_TL             = 1;
     120             : const sal_uInt8 BIFF_OBJ_ARC_BL             = 2;
     121             : const sal_uInt8 BIFF_OBJ_ARC_BR             = 3;
     122             : 
     123             : const sal_uInt16 BIFF_OBJ_POLY_CLOSED       = 0x0100;
     124             : 
     125             : // fill formatting ------------------------------------------------------------
     126             : 
     127             : const sal_uInt8 BIFF_OBJ_FILL_AUTOCOLOR     = 65;
     128             : 
     129             : const sal_uInt8 BIFF_OBJ_PATT_NONE          = 0;
     130             : const sal_uInt8 BIFF_OBJ_PATT_SOLID         = 1;
     131             : 
     132             : const sal_uInt8 BIFF_OBJ_FILL_AUTO          = 0x01;
     133             : 
     134             : // text formatting ------------------------------------------------------------
     135             : 
     136             : const sal_uInt8 BIFF_OBJ_HOR_LEFT           = 1;
     137             : const sal_uInt8 BIFF_OBJ_HOR_CENTER         = 2;
     138             : const sal_uInt8 BIFF_OBJ_HOR_RIGHT          = 3;
     139             : const sal_uInt8 BIFF_OBJ_HOR_JUSTIFY        = 4;
     140             : 
     141             : const sal_uInt8 BIFF_OBJ_VER_TOP            = 1;
     142             : const sal_uInt8 BIFF_OBJ_VER_CENTER         = 2;
     143             : const sal_uInt8 BIFF_OBJ_VER_BOTTOM         = 3;
     144             : const sal_uInt8 BIFF_OBJ_VER_JUSTIFY        = 4;
     145             : 
     146             : const sal_uInt16 BIFF_OBJ_ORIENT_NONE       = 0;
     147             : const sal_uInt16 BIFF_OBJ_ORIENT_STACKED    = 1;        /// Stacked top to bottom.
     148             : const sal_uInt16 BIFF_OBJ_ORIENT_90CCW      = 2;        /// 90 degr. counterclockwise.
     149             : const sal_uInt16 BIFF_OBJ_ORIENT_90CW       = 3;        /// 90 degr. clockwise.
     150             : 
     151             : const sal_uInt16 BIFF_OBJ_TEXT_AUTOSIZE     = 0x0080;
     152             : const sal_uInt16 BIFF_OBJ_TEXT_LOCKED       = 0x0200;
     153             : 
     154             : const sal_Int32 BIFF_OBJ_TEXT_MARGIN        = 20000;    /// Automatic text margin (EMUs).
     155             : 
     156             : // BIFF8 OBJ sub records ------------------------------------------------------
     157             : 
     158             : const sal_uInt16 BIFF_OBJCMO_PRINTABLE      = 0x0010;   /// Object printable.
     159             : const sal_uInt16 BIFF_OBJCMO_AUTOLINE       = 0x2000;   /// Automatic line formatting.
     160             : const sal_uInt16 BIFF_OBJCMO_AUTOFILL       = 0x4000;   /// Automatic fill formatting.
     161             : 
     162             : // ----------------------------------------------------------------------------
     163             : 
     164             : } // namespace
     165             : 
     166             : // ============================================================================
     167             : // Model structures for BIFF OBJ record data
     168             : // ============================================================================
     169             : 
     170           0 : BiffObjLineModel::BiffObjLineModel() :
     171             :     mnColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ),
     172             :     mnStyle( BIFF_OBJ_LINE_SOLID ),
     173             :     mnWidth( BIFF_OBJ_LINE_HAIR ),
     174           0 :     mbAuto( true )
     175             : {
     176           0 : }
     177             : 
     178           0 : BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjLineModel& rModel )
     179             : {
     180             :     sal_uInt8 nFlags;
     181           0 :     rStrm >> rModel.mnColorIdx >> rModel.mnStyle >> rModel.mnWidth >> nFlags;
     182           0 :     rModel.mbAuto = getFlag( nFlags, BIFF_OBJ_LINE_AUTO );
     183           0 :     return rStrm;
     184             : }
     185             : 
     186             : // ============================================================================
     187             : 
     188           0 : BiffObjFillModel::BiffObjFillModel() :
     189             :     mnBackColorIdx( BIFF_OBJ_LINE_AUTOCOLOR ),
     190             :     mnPattColorIdx( BIFF_OBJ_FILL_AUTOCOLOR ),
     191             :     mnPattern( BIFF_OBJ_PATT_SOLID ),
     192           0 :     mbAuto( true )
     193             : {
     194           0 : }
     195             : 
     196           0 : BiffInputStream& operator>>( BiffInputStream& rStrm, BiffObjFillModel& rModel )
     197             : {
     198             :     sal_uInt8 nFlags;
     199           0 :     rStrm >> rModel.mnBackColorIdx >> rModel.mnPattColorIdx >> rModel.mnPattern >> nFlags;
     200           0 :     rModel.mbAuto = getFlag( nFlags, BIFF_OBJ_FILL_AUTO );
     201           0 :     return rStrm;
     202             : }
     203             : 
     204             : // ============================================================================
     205             : // BIFF drawing objects
     206             : // ============================================================================
     207             : 
     208           0 : BiffDrawingObjectContainer::BiffDrawingObjectContainer()
     209             : {
     210           0 : }
     211             : 
     212           0 : void BiffDrawingObjectContainer::convertAndInsert( BiffDrawingBase& rDrawing, const Reference< XShapes >& rxShapes, const Rectangle* pParentRect ) const
     213             : {
     214           0 :     maObjects.forEachMem( &BiffDrawingObjectBase::convertAndInsert, ::boost::ref( rDrawing ), ::boost::cref( rxShapes ), pParentRect );
     215           0 : }
     216             : 
     217             : // ============================================================================
     218             : 
     219           0 : BiffDrawingObjectBase::BiffDrawingObjectBase( const WorksheetHelper& rHelper ) :
     220             :     WorksheetHelper( rHelper ),
     221             :     maAnchor( rHelper ),
     222             :     mnObjId( BIFF_OBJ_INVALID_ID ),
     223             :     mnObjType( BIFF_OBJTYPE_UNKNOWN ),
     224             :     mbHidden( false ),
     225             :     mbVisible( true ),
     226             :     mbPrintable( true ),
     227             :     mbAreaObj( false ),
     228             :     mbSimpleMacro( true ),
     229             :     mbProcessShape( true ),
     230             :     mbInsertShape( true ),
     231           0 :     mbCustomDff( false )
     232             : {
     233           0 : }
     234             : 
     235           0 : BiffDrawingObjectBase::~BiffDrawingObjectBase()
     236             : {
     237           0 : }
     238             : 
     239           0 : Reference< XShape > BiffDrawingObjectBase::convertAndInsert( BiffDrawingBase& rDrawing,
     240             :         const Reference< XShapes >& rxShapes, const Rectangle* pParentRect ) const
     241             : {
     242           0 :     Reference< XShape > xShape;
     243           0 :     if( rxShapes.is() && mbProcessShape && !mbHidden )  // TODO: support for hidden objects?
     244             :     {
     245             :         // base class 'ShapeAnchor' calculates the shape rectangle in 1/100 mm
     246             :         // in BIFF3-BIFF5, all shapes have absolute anchor (also children of group shapes)
     247           0 :         Rectangle aShapeRect = maAnchor.calcAnchorRectHmm( getDrawPageSize() );
     248             : 
     249             :         // convert the shape, if the calculated rectangle is not empty
     250           0 :         bool bHasWidth = aShapeRect.Width > 0;
     251           0 :         bool bHasHeight = aShapeRect.Height > 0;
     252           0 :         if( mbAreaObj ? (bHasWidth && bHasHeight) : (bHasWidth || bHasHeight) )
     253             :         {
     254           0 :             xShape = implConvertAndInsert( rDrawing, rxShapes, aShapeRect );
     255             :             /*  Notify the drawing that a new shape has been inserted (but not
     256             :                 for children of group shapes). For convenience, pass the
     257             :                 rectangle that contains position and size of the shape. */
     258           0 :             if( !pParentRect && xShape.is() )
     259           0 :                 rDrawing.notifyShapeInserted( xShape, aShapeRect );
     260             :         }
     261             :     }
     262           0 :     return xShape;
     263             : }
     264             : 
     265           0 : void BiffDrawingObjectBase::convertLineProperties( ShapePropertyMap& rPropMap, const BiffObjLineModel& rLineModel, sal_uInt16 nArrows ) const
     266             : {
     267           0 :     if( rLineModel.mbAuto )
     268             :     {
     269           0 :         BiffObjLineModel aAutoModel;
     270           0 :         aAutoModel.mbAuto = false;
     271           0 :         convertLineProperties( rPropMap, aAutoModel, nArrows );
     272           0 :         return;
     273             :     }
     274             : 
     275             :     /*  Convert line formatting to DrawingML line formatting and let the
     276             :         DrawingML code do the hard work. */
     277           0 :     LineProperties aLineProps;
     278             : 
     279           0 :     if( rLineModel.mnStyle == BIFF_OBJ_LINE_NONE )
     280             :     {
     281           0 :         aLineProps.maLineFill.moFillType = XML_noFill;
     282             :     }
     283             :     else
     284             :     {
     285           0 :         aLineProps.maLineFill.moFillType = XML_solidFill;
     286           0 :         aLineProps.maLineFill.maFillColor.setPaletteClr( rLineModel.mnColorIdx );
     287           0 :         aLineProps.moLineCompound = XML_sng;
     288           0 :         aLineProps.moLineCap = XML_flat;
     289           0 :         aLineProps.moLineJoint = XML_round;
     290             : 
     291             :         // line width: use 0.35 mm per BIFF line width step
     292           0 :         sal_Int32 nLineWidth = 0;
     293           0 :         switch( rLineModel.mnWidth )
     294             :         {
     295             :             default:
     296           0 :             case BIFF_OBJ_LINE_HAIR:    nLineWidth = 0;     break;
     297           0 :             case BIFF_OBJ_LINE_THIN:    nLineWidth = 20;    break;
     298           0 :             case BIFF_OBJ_LINE_MEDIUM:  nLineWidth = 40;    break;
     299           0 :             case BIFF_OBJ_LINE_THICK:   nLineWidth = 60;    break;
     300             :         }
     301           0 :         aLineProps.moLineWidth = getLimitedValue< sal_Int32, sal_Int64 >( convertHmmToEmu( nLineWidth ), 0, SAL_MAX_INT32 );
     302             : 
     303             :         // dash style and transparency
     304           0 :         switch( rLineModel.mnStyle )
     305             :         {
     306             :             default:
     307             :             case BIFF_OBJ_LINE_SOLID:
     308           0 :                 aLineProps.moPresetDash = XML_solid;
     309           0 :             break;
     310             :             case BIFF_OBJ_LINE_DASH:
     311           0 :                 aLineProps.moPresetDash = XML_lgDash;
     312           0 :             break;
     313             :             case BIFF_OBJ_LINE_DOT:
     314           0 :                 aLineProps.moPresetDash = XML_dot;
     315           0 :             break;
     316             :             case BIFF_OBJ_LINE_DASHDOT:
     317           0 :                 aLineProps.moPresetDash = XML_lgDashDot;
     318           0 :             break;
     319             :             case BIFF_OBJ_LINE_DASHDOTDOT:
     320           0 :                 aLineProps.moPresetDash = XML_lgDashDotDot;
     321           0 :             break;
     322             :             case BIFF_OBJ_LINE_MEDTRANS:
     323           0 :                 aLineProps.moPresetDash = XML_solid;
     324           0 :                 aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 50 * PER_PERCENT );
     325           0 :             break;
     326             :             case BIFF_OBJ_LINE_DARKTRANS:
     327           0 :                 aLineProps.moPresetDash = XML_solid;
     328           0 :                 aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 75 * PER_PERCENT );
     329           0 :             break;
     330             :             case BIFF_OBJ_LINE_LIGHTTRANS:
     331           0 :                 aLineProps.moPresetDash = XML_solid;
     332           0 :                 aLineProps.maLineFill.maFillColor.addTransformation( XML_alpha, 25 * PER_PERCENT );
     333           0 :             break;
     334             :         }
     335             : 
     336             :         // line ends
     337           0 :         bool bLineStart = false;
     338           0 :         bool bLineEnd = false;
     339           0 :         bool bFilled = false;
     340           0 :         switch( extractValue< sal_uInt8 >( nArrows, 0, 4 ) )
     341             :         {
     342           0 :             case BIFF_OBJ_ARROW_OPEN:       bLineStart = false; bLineEnd = true;  bFilled = false;  break;
     343           0 :             case BIFF_OBJ_ARROW_OPENBOTH:   bLineStart = true;  bLineEnd = true;  bFilled = false;  break;
     344           0 :             case BIFF_OBJ_ARROW_FILLED:     bLineStart = false; bLineEnd = true;  bFilled = true;   break;
     345           0 :             case BIFF_OBJ_ARROW_FILLEDBOTH: bLineStart = true;  bLineEnd = true;  bFilled = true;   break;
     346             :         }
     347           0 :         if( bLineStart || bLineEnd )
     348             :         {
     349             :             // arrow type (open or closed)
     350           0 :             sal_Int32 nArrowType = bFilled ? XML_triangle : XML_arrow;
     351           0 :             aLineProps.maStartArrow.moArrowType = bLineStart ? nArrowType : XML_none;
     352           0 :             aLineProps.maEndArrow.moArrowType   = bLineEnd   ? nArrowType : XML_none;
     353             : 
     354             :             // arrow width
     355           0 :             sal_Int32 nArrowWidth = XML_med;
     356           0 :             switch( extractValue< sal_uInt8 >( nArrows, 4, 4 ) )
     357             :             {
     358           0 :                 case BIFF_OBJ_ARROW_NARROW: nArrowWidth = XML_sm;   break;
     359           0 :                 case BIFF_OBJ_ARROW_MEDIUM: nArrowWidth = XML_med;  break;
     360           0 :                 case BIFF_OBJ_ARROW_WIDE:   nArrowWidth = XML_lg;   break;
     361             :             }
     362           0 :             aLineProps.maStartArrow.moArrowWidth = aLineProps.maEndArrow.moArrowWidth = nArrowWidth;
     363             : 
     364             :             // arrow length
     365           0 :             sal_Int32 nArrowLength = XML_med;
     366           0 :             switch( extractValue< sal_uInt8 >( nArrows, 8, 4 ) )
     367             :             {
     368           0 :                 case BIFF_OBJ_ARROW_NARROW: nArrowLength = XML_sm;  break;
     369           0 :                 case BIFF_OBJ_ARROW_MEDIUM: nArrowLength = XML_med; break;
     370           0 :                 case BIFF_OBJ_ARROW_WIDE:   nArrowLength = XML_lg;  break;
     371             :             }
     372           0 :             aLineProps.maStartArrow.moArrowLength = aLineProps.maEndArrow.moArrowLength = nArrowLength;
     373             :         }
     374             :     }
     375             : 
     376           0 :     aLineProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() );
     377             : }
     378             : 
     379           0 : void BiffDrawingObjectBase::convertFillProperties( ShapePropertyMap& rPropMap, const BiffObjFillModel& rFillModel ) const
     380             : {
     381           0 :     if( rFillModel.mbAuto )
     382             :     {
     383           0 :         BiffObjFillModel aAutoModel;
     384           0 :         aAutoModel.mbAuto = false;
     385           0 :         convertFillProperties( rPropMap, aAutoModel );
     386           0 :         return;
     387             :     }
     388             : 
     389             :     /*  Convert fill formatting to DrawingML fill formatting and let the
     390             :         DrawingML code do the hard work. */
     391           0 :     FillProperties aFillProps;
     392             : 
     393           0 :     if( rFillModel.mnPattern == BIFF_OBJ_PATT_NONE )
     394             :     {
     395           0 :         aFillProps.moFillType = XML_noFill;
     396             :     }
     397             :     else
     398             :     {
     399             :         const sal_Int32 spnPatternPresets[] = {
     400             :             XML_TOKEN_INVALID, XML_TOKEN_INVALID, XML_pct50, XML_pct50, XML_pct25,
     401             :             XML_dkHorz, XML_dkVert, XML_dkDnDiag, XML_dkUpDiag, XML_smCheck, XML_trellis,
     402             :             XML_ltHorz, XML_ltVert, XML_ltDnDiag, XML_ltUpDiag, XML_smGrid, XML_diagCross,
     403           0 :             XML_pct20, XML_pct10 };
     404           0 :         sal_Int32 nPatternPreset = STATIC_ARRAY_SELECT( spnPatternPresets, rFillModel.mnPattern, XML_TOKEN_INVALID );
     405           0 :         if( nPatternPreset == XML_TOKEN_INVALID )
     406             :         {
     407           0 :             aFillProps.moFillType = XML_solidFill;
     408           0 :             aFillProps.maFillColor.setPaletteClr( rFillModel.mnPattColorIdx );
     409             :         }
     410             :         else
     411             :         {
     412           0 :             aFillProps.moFillType = XML_pattFill;
     413           0 :             aFillProps.maPatternProps.maPattFgColor.setPaletteClr( rFillModel.mnPattColorIdx );
     414           0 :             aFillProps.maPatternProps.maPattBgColor.setPaletteClr( rFillModel.mnBackColorIdx );
     415           0 :             aFillProps.maPatternProps.moPattPreset = nPatternPreset;
     416             :         }
     417             : #if 0
     418             :         static const sal_uInt8 sppnPatterns[][ 8 ] =
     419             :         {
     420             :             { 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55 },
     421             :             { 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD, 0x77, 0xDD },
     422             :             { 0x88, 0x22, 0x88, 0x22, 0x88, 0x22, 0x88, 0x22 },
     423             :             { 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00 },
     424             :             { 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC, 0xCC },
     425             :             { 0x33, 0x66, 0xCC, 0x99, 0x33, 0x66, 0xCC, 0x99 },
     426             :             { 0xCC, 0x66, 0x33, 0x99, 0xCC, 0x66, 0x33, 0x99 },
     427             :             { 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33 },
     428             :             { 0xCC, 0xFF, 0x33, 0xFF, 0xCC, 0xFF, 0x33, 0xFF },
     429             :             { 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00 },
     430             :             { 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88 },
     431             :             { 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88 },
     432             :             { 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11 },
     433             :             { 0xFF, 0x11, 0x11, 0x11, 0xFF, 0x11, 0x11, 0x11 },
     434             :             { 0xAA, 0x44, 0xAA, 0x11, 0xAA, 0x44, 0xAA, 0x11 },
     435             :             { 0x88, 0x00, 0x22, 0x00, 0x88, 0x00, 0x22, 0x00 },
     436             :             { 0x80, 0x00, 0x08, 0x00, 0x80, 0x00, 0x08, 0x00 }
     437             :         };
     438             :         const sal_uInt8* const pnPattern = sppnPatterns[ ::std::min< size_t >( rFillData.mnPattern - 2, STATIC_ARRAY_SIZE( sppnPatterns ) ) ];
     439             :         // create 2-colored 8x8 DIB
     440             :         SvMemoryStream aMemStrm;
     441             : //      { 0x0C, 0x00, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00 }
     442             :         aMemStrm << sal_uInt32( 12 ) << sal_Int16( 8 ) << sal_Int16( 8 ) << sal_uInt16( 1 ) << sal_uInt16( 1 );
     443             :         aMemStrm << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF ) << sal_uInt8( 0xFF );
     444             :         aMemStrm << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 ) << sal_uInt8( 0x00 );
     445             :         for( size_t nIdx = 0; nIdx < 8; ++nIdx )
     446             :             aMemStrm << sal_uInt32( pnPattern[ nIdx ] ); // 32-bit little-endian
     447             :         aMemStrm.Seek( STREAM_SEEK_TO_BEGIN );
     448             :         Bitmap aBitmap;
     449             :         aBitmap.Read( aMemStrm, FALSE );
     450             :         XOBitmap aXOBitmap( aBitmap );
     451             :         aXOBitmap.Bitmap2Array();
     452             :         aXOBitmap.SetBitmapType( XBITMAP_8X8 );
     453             :         if( aXOBitmap.GetBackgroundColor().GetColor() == COL_BLACK )
     454             :             ::std::swap( aPattColor, aBackColor );
     455             :         aXOBitmap.SetPixelColor( aPattColor );
     456             :         aXOBitmap.SetBackgroundColor( aBackColor );
     457             :         rSdrObj.SetMergedItem( XFillStyleItem( XFILL_BITMAP ) );
     458             :         rSdrObj.SetMergedItem( XFillBitmapItem( EMPTY_STRING, aXOBitmap ) );
     459             : #endif
     460             :     }
     461             : 
     462           0 :     aFillProps.pushToPropMap( rPropMap, getBaseFilter().getGraphicHelper() );
     463             : }
     464             : 
     465             : // ============================================================================
     466             : // BIFF drawing page
     467             : // ============================================================================
     468             : 
     469           0 : BiffDrawingBase::BiffDrawingBase( const WorksheetHelper& rHelper, const Reference< XDrawPage >& rxDrawPage ) :
     470             :     WorksheetHelper( rHelper ),
     471           0 :     mxDrawPage( rxDrawPage )
     472             : {
     473           0 : }
     474             : 
     475           0 : void BiffDrawingBase::finalizeImport()
     476             : {
     477           0 :     Reference< XShapes > xShapes( mxDrawPage, UNO_QUERY );
     478             :     OSL_ENSURE( xShapes.is(), "BiffDrawingBase::finalizeImport - no shapes container" );
     479           0 :     if( !xShapes.is() )
     480           0 :         return;
     481             : 
     482             :     // process list of objects to be skipped
     483           0 :     for( BiffObjIdVector::const_iterator aIt = maSkipObjs.begin(), aEnd = maSkipObjs.end(); aIt != aEnd; ++aIt )
     484           0 :         if( BiffDrawingObjectBase* pDrawingObj = maObjMapId.get( *aIt ).get() )
     485           0 :             pDrawingObj->setProcessShape( false );
     486             : 
     487             :     // process drawing objects without DFF data
     488           0 :     maRawObjs.convertAndInsert( *this, xShapes );
     489             : }
     490             : 
     491             : // ============================================================================
     492             : 
     493           0 : BiffSheetDrawing::BiffSheetDrawing( const WorksheetHelper& rHelper ) :
     494           0 :     BiffDrawingBase( rHelper, rHelper.getDrawPage() )
     495             : {
     496           0 : }
     497             : 
     498           0 : void BiffSheetDrawing::notifyShapeInserted( const Reference< XShape >& /*rxShape*/, const Rectangle& rShapeRect )
     499             : {
     500             :     // collect all shape positions in the WorksheetHelper base class
     501           0 :     extendShapeBoundingBox( rShapeRect );
     502           0 : }
     503             : 
     504             : // ============================================================================
     505             : 
     506             : } // namespace xls
     507          15 : } // namespace oox
     508             : 
     509             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10