LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpdrawobj.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 708 0.0 %
Date: 2014-04-14 Functions: 0 69 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*************************************************************************
       3             :  *
       4             :  *  The Contents of this file are made available subject to the terms of
       5             :  *  either of the following licenses
       6             :  *
       7             :  *         - GNU Lesser General Public License Version 2.1
       8             :  *         - Sun Industry Standards Source License Version 1.1
       9             :  *
      10             :  *  Sun Microsystems Inc., October, 2000
      11             :  *
      12             :  *  GNU Lesser General Public License Version 2.1
      13             :  *  =============================================
      14             :  *  Copyright 2000 by Sun Microsystems, Inc.
      15             :  *  901 San Antonio Road, Palo Alto, CA 94303, USA
      16             :  *
      17             :  *  This library is free software; you can redistribute it and/or
      18             :  *  modify it under the terms of the GNU Lesser General Public
      19             :  *  License version 2.1, as published by the Free Software Foundation.
      20             :  *
      21             :  *  This library is distributed in the hope that it will be useful,
      22             :  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
      23             :  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      24             :  *  Lesser General Public License for more details.
      25             :  *
      26             :  *  You should have received a copy of the GNU Lesser General Public
      27             :  *  License along with this library; if not, write to the Free Software
      28             :  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
      29             :  *  MA  02111-1307  USA
      30             :  *
      31             :  *
      32             :  *  Sun Industry Standards Source License Version 1.1
      33             :  *  =================================================
      34             :  *  The contents of this file are subject to the Sun Industry Standards
      35             :  *  Source License Version 1.1 (the "License"); You may not use this file
      36             :  *  except in compliance with the License. You may obtain a copy of the
      37             :  *  License at http://www.openoffice.org/license.html.
      38             :  *
      39             :  *  Software provided under this License is provided on an "AS IS" basis,
      40             :  *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
      41             :  *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
      42             :  *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
      43             :  *  See the License for the specific provisions governing your rights and
      44             :  *  obligations concerning the Software.
      45             :  *
      46             :  *  The Initial Developer of the Original Code is: IBM Corporation
      47             :  *
      48             :  *  Copyright: 2008 by IBM Corporation
      49             :  *
      50             :  *  All Rights Reserved.
      51             :  *
      52             :  *  Contributor(s): _______________________________________
      53             :  *
      54             :  *
      55             :  ************************************************************************/
      56             : /**
      57             :  * @file
      58             :  * Implementation file of LwpDrawObjcts and associated class like LwpDrawGroup, LwpDrawRectange
      59             :  *  and so on.
      60             :  */
      61             : #include <osl/thread.h>
      62             : #include "lwpglobalmgr.hxx"
      63             : #include "lwpdrawobj.hxx"
      64             : #include "lwptools.hxx"
      65             : #include <tools/stream.hxx>
      66             : 
      67             : #include "xfilter/xfframe.hxx"
      68             : 
      69             : #include "xfilter/xfstylemanager.hxx"
      70             : #include "xfilter/xfdrawstyle.hxx"
      71             : #include "xfilter/xftextstyle.hxx"
      72             : #include "xfilter/xfparastyle.hxx"
      73             : #include "xfilter/xfimagestyle.hxx"
      74             : #include "xfilter/xftextboxstyle.hxx"
      75             : #include "xfilter/xfparagraph.hxx"
      76             : #include "xfilter/xftextspan.hxx"
      77             : #include "xfilter/xffont.hxx"
      78             : 
      79             : #include "xfilter/xfdrawrect.hxx"
      80             : #include "xfilter/xfdrawpath.hxx"
      81             : #include "xfilter/xfdrawline.hxx"
      82             : #include "xfilter/xfdrawpolygon.hxx"
      83             : #include "xfilter/xfimage.hxx"
      84             : 
      85             : #include "lwpcharsetmgr.hxx"
      86             : #include "lwpsdwrect.hxx"
      87             : 
      88             : /**
      89             :  * @descr   Constructor of class LwpDrawObj
      90             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
      91             :  */
      92           0 : LwpDrawObj::LwpDrawObj(SvStream * pStream, DrawingOffsetAndScale* pTransData)
      93             :     : m_eType(OT_UNDEFINED)
      94             :     , m_pStream(pStream)
      95           0 :     , m_pTransData(pTransData)
      96             : {
      97           0 :     this->ReadObjHeaderRecord();
      98           0 : }
      99             : 
     100             : /**
     101             :  * @descr   read the header record data of lwp-sdw-object
     102             :  */
     103           0 : void LwpDrawObj::ReadObjHeaderRecord()
     104             : {
     105             :     //flags
     106           0 :     m_pStream->SeekRel(1);
     107             : 
     108             :     //record Length
     109           0 :     m_pStream->ReadUInt16( m_aObjHeader.nRecLen );
     110             : 
     111             :     //boundrect
     112           0 :     m_pStream->ReadInt16( m_aObjHeader.nLeft );
     113           0 :     m_pStream->ReadInt16( m_aObjHeader.nTop );
     114           0 :     m_pStream->ReadInt16( m_aObjHeader.nRight );
     115           0 :     m_pStream->ReadInt16( m_aObjHeader.nBottom );
     116             : 
     117             :     //nextObj, prevObj
     118           0 :     m_pStream->SeekRel(4);
     119           0 : }
     120             : 
     121             : /**
     122             :  * @descr   read the style of closed lwp-sdw-object like: rectangle, ellipse and so on.
     123             :  */
     124           0 : void LwpDrawObj::ReadClosedObjStyle()
     125             : {
     126           0 :     if ((m_eType != OT_POLYGON) && (m_eType != OT_TEXTART))
     127             :     {
     128           0 :         m_pStream->SeekRel(8);
     129             :     }
     130             : 
     131           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.nLineWidth );
     132           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.nLineStyle );
     133             : 
     134             :     // pen color
     135           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nR );
     136           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nG );
     137           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.nB );
     138           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aPenColor.unused );
     139             : 
     140             :     // foreground color
     141           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nR );
     142           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nG );
     143           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.nB );
     144           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aForeColor.unused );
     145             : 
     146             :     // background color
     147           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nR );
     148           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nG );
     149           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.nB );
     150           0 :     m_pStream->ReadUChar( m_aClosedObjStyleRec.aBackColor.unused );
     151             : 
     152             :     // fill style
     153           0 :     m_pStream->ReadUInt16( m_aClosedObjStyleRec.nFillType );
     154             :     m_pStream->Read(m_aClosedObjStyleRec.pFillPattern,
     155           0 :         sizeof(m_aClosedObjStyleRec.pFillPattern));
     156           0 : }
     157             : 
     158             : /**
     159             :  * @descr   set fill style of drawing objects
     160             :  * @param   pStyle   pointer of the drawing xfstyle.
     161             :  */
     162           0 : void LwpDrawObj::SetFillStyle(XFDrawStyle* pStyle)
     163             : {
     164           0 :     if (!pStyle)
     165             :     {
     166             :         assert(false);
     167           0 :         return;
     168             :     }
     169             : 
     170             :     XFColor aForeColor(m_aClosedObjStyleRec.aForeColor.nR,
     171           0 :         m_aClosedObjStyleRec.aForeColor.nG, m_aClosedObjStyleRec.aForeColor.nB);
     172             :     XFColor aBackColor(m_aClosedObjStyleRec.aBackColor.nR,
     173           0 :         m_aClosedObjStyleRec.aBackColor.nG, m_aClosedObjStyleRec.aBackColor.nB);
     174             : 
     175           0 :     switch (m_aClosedObjStyleRec.nFillType)
     176             :     {
     177             :     default: //fall through!
     178             :     case FT_TRANSPARENT:
     179             :         {
     180             :             // set fill style : none
     181           0 :             break;
     182             :         }
     183             :     case FT_SOLID:
     184             :         {
     185           0 :             pStyle->SetAreaColor(aForeColor);
     186           0 :             break;
     187             :         }
     188             :     case FT_HORZHATCH:
     189             :         {
     190           0 :             pStyle->SetAreaColor(aBackColor);
     191           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 0, 0.12, aForeColor);
     192           0 :             break;
     193             :         }
     194             :     case FT_VERTHATCH:
     195             :         {
     196           0 :             pStyle->SetAreaColor(aBackColor);
     197           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 90, 0.12, aForeColor);
     198           0 :             break;
     199             :         }
     200             :     case FT_FDIAGHATCH:
     201             :         {
     202           0 :             pStyle->SetAreaColor(aBackColor);
     203           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 135, 0.09, aForeColor);
     204           0 :             break;
     205             :         }
     206             :     case FT_BDIAGHATCH:
     207             :         {
     208           0 :             pStyle->SetAreaColor(aBackColor);
     209           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineSingle, 45, 0.09, aForeColor);
     210           0 :             break;
     211             :         }
     212             :     case FT_CROSSHATCH:
     213             :         {
     214           0 :             pStyle->SetAreaColor(aBackColor);
     215           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineCrossed, 0, 0.12, aForeColor);
     216           0 :             break;
     217             :         }
     218             :     case FT_DIAGCROSSHATCH:
     219             :         {
     220           0 :             pStyle->SetAreaColor(aBackColor);
     221           0 :             pStyle->SetAreaLineStyle(enumXFAreaLineCrossed, 45, 0.095, aForeColor);
     222           0 :             break;
     223             :         }
     224             :     }
     225             : }
     226             : 
     227             : /**
     228             :  * @descr   set line/border style of drawing objects.
     229             :  * @param   pStyle   pointer of the drawing xfstyle.
     230             :  * @param   nWidth   width of line/border.
     231             :  * @param   nLineStyle   flag of line/border style: none, dot or solid.
     232             :  * @param   rColor   color of line/border.
     233             :  */
     234           0 : void LwpDrawObj::SetLineStyle(XFDrawStyle* pStyle, sal_uInt8 nWidth, sal_uInt8 nLineStyle,
     235             :     const SdwColor& rColor)
     236             : {
     237           0 :     if (!pStyle)
     238             :     {
     239             :         assert(false);
     240           0 :         return;
     241             :     }
     242           0 :     if (nWidth == 0)
     243             :     {
     244           0 :         nLineStyle = LS_NULL;
     245             :     }
     246             : 
     247           0 :     if (nLineStyle == LS_NULL)
     248             :     {
     249             :         // set stroke:none
     250           0 :         return;
     251             :     }
     252             : 
     253           0 :     if (nLineStyle == LS_DOT)
     254             :     {
     255           0 :         pStyle->SetLineDashStyle(enumXFLineDash, 1, 1, 0.05, 0.05, 0.05);
     256             :     }
     257             : 
     258             :     // line width
     259           0 :     double fWidth = (double)nWidth/TWIPS_PER_CM;
     260             : 
     261             :     // line color
     262           0 :     XFColor aXFColor(rColor.nR, rColor.nG, rColor.nB);
     263             : 
     264           0 :     pStyle->SetLineStyle(fWidth, aXFColor);
     265             : }
     266             : 
     267             : /**
     268             :  * @descr   set position of a drawing object in the frame.
     269             :  * @param   pObj   pointer of the xf-drawing object
     270             :  */
     271           0 : void LwpDrawObj::SetPosition(XFFrame* pObj)
     272             : {
     273           0 :     double fOffsetX = 0.00, fOffsetY = 0.00;
     274           0 :     double fScaleX = 1.00, fScaleY = 1.00;
     275           0 :     if (m_pTransData)
     276             :     {
     277           0 :         fOffsetX = m_pTransData->fOffsetX;
     278           0 :         fOffsetY = m_pTransData->fOffsetY;
     279           0 :         fScaleX = m_pTransData->fScaleX;
     280           0 :         fScaleY = m_pTransData->fScaleY;
     281             :     }
     282             : 
     283           0 :     pObj->SetPosition((double)m_aObjHeader.nLeft/TWIPS_PER_CM * fScaleX+ fOffsetX,
     284           0 :         (double)m_aObjHeader.nTop/TWIPS_PER_CM * fScaleY + fOffsetY,
     285           0 :         (double)(m_aObjHeader.nRight-m_aObjHeader.nLeft)/TWIPS_PER_CM * fScaleX,
     286           0 :         (double)(m_aObjHeader.nBottom-m_aObjHeader.nTop)/TWIPS_PER_CM * fScaleY);
     287           0 : }
     288             : 
     289             : /**
     290             :  * @descr   set arrowhead of a xf-drawing object. only opened drawing objects can be assigned arrowheads
     291             :  * @param   pOpenedObjStyle   the xf-drawing object which will be set arrowhead.
     292             :  * @param   nArrowFlag   arrowhead flags of the object.
     293             :  */
     294           0 : void LwpDrawObj::SetArrowHead(XFDrawStyle* pOpenedObjStyle, sal_uInt8 nArrowFlag, sal_uInt8 nLineWidth)
     295             : {
     296             :     // no arrowhead
     297           0 :     if (!nArrowFlag)
     298             :     {
     299           0 :         return;
     300             :     }
     301             : 
     302           0 :     if (!pOpenedObjStyle)
     303             :     {
     304             :         assert(false);
     305           0 :         return;
     306             :     }
     307             : 
     308             :     // arrowhead flag of an object's start side
     309           0 :     sal_uInt8 nLeftArrow = nArrowFlag & 0x0F;
     310             : 
     311             :     // arrowhead flag of an object's end side
     312           0 :     sal_uInt8 nRightArrow = (nArrowFlag & 0xF0) >> 4;
     313             : 
     314           0 :     double fWidth_inch = (double)nLineWidth/TWIPS_PER_CM;
     315           0 :     double fArrowSize_inch = fWidth_inch + 0.08;
     316           0 :     double fArrowSize = fArrowSize_inch * CM_PER_INCH;
     317             : 
     318           0 :     if (nLeftArrow)
     319             :     {
     320           0 :         pOpenedObjStyle->SetArrowStart( this->GetArrowName(nLeftArrow), fArrowSize, sal_True);
     321             :     }
     322           0 :     if (nRightArrow)
     323             :     {
     324           0 :         pOpenedObjStyle->SetArrowEnd( this->GetArrowName(nRightArrow), fArrowSize, sal_True);
     325             :     }
     326             : 
     327             : }
     328             : 
     329             : /**
     330             :  * @descr   get arrow style name according to the flag.
     331             :  * @param   nArrowStyle   style of the arrowhead.
     332             :  * @return   nWhichSide   style name of the arrowhead.
     333             :  */
     334           0 : OUString LwpDrawObj::GetArrowName(sal_uInt8 nArrowStyle)
     335             : {
     336             :     // style name of arrowhead
     337           0 :     OUString aArrowName;
     338             : 
     339           0 :     switch(nArrowStyle)
     340             :     {
     341             :     default:
     342             :     case AH_ARROW_FULLARROW:
     343           0 :         aArrowName = "Symmetric arrow";
     344           0 :         break;
     345             :     case AH_ARROW_HALFARROW:
     346           0 :         aArrowName = "Arrow concave";
     347           0 :         break;
     348             :     case AH_ARROW_LINEARROW:
     349           0 :         aArrowName = "arrow100";
     350           0 :         break;
     351             :     case AH_ARROW_INVFULLARROW:
     352           0 :         aArrowName = "reverse arrow";
     353           0 :         break;
     354             :     case AH_ARROW_INVHALFARROW:
     355           0 :         aArrowName = "reverse concave arrow";
     356           0 :         break;
     357             :     case AH_ARROW_INVLINEARROW:
     358           0 :         aArrowName = "reverse line arrow";
     359           0 :         break;
     360             :     case AH_ARROW_TEE:
     361           0 :         aArrowName = "Dimension lines";
     362           0 :         break;
     363             :     case AH_ARROW_SQUARE:
     364           0 :         aArrowName = "Square";
     365           0 :         break;
     366             :     case AH_ARROW_CIRCLE:
     367           0 :         aArrowName = "Circle";
     368           0 :         break;
     369             :     }
     370             : 
     371           0 :     return aArrowName;
     372             : }
     373             : 
     374             : /**
     375             :  * @descr   template method of creating drawing object from Lwp-Model to XF-Model
     376             :  * @return   pointer of the drawing object of XF-Model.
     377             :  */
     378           0 : XFFrame* LwpDrawObj::CreateXFDrawObject()
     379             : {
     380             :     // read records
     381           0 :     this->Read();
     382             : 
     383             :     // register style
     384           0 :     OUString aStyleName = this->RegisterStyle();
     385             : 
     386             :     // create XF-Objects
     387           0 :     XFFrame* pXFObj = NULL;
     388           0 :     if (m_pTransData
     389           0 :         && FABS(m_pTransData->fOffsetX - m_pTransData->fLeftMargin) < THRESHOLD
     390           0 :         && FABS(m_pTransData->fOffsetY - m_pTransData->fTopMargin) < THRESHOLD
     391           0 :         && FABS(m_pTransData->fScaleX - 1.0) < THRESHOLD
     392           0 :         && FABS(m_pTransData->fScaleY - 1.0) < THRESHOLD)
     393             :     {
     394           0 :         pXFObj = this->CreateStandardDrawObj(aStyleName);
     395             :     }
     396             :     else
     397             :     {
     398           0 :         pXFObj = this->CreateDrawObj(aStyleName);
     399             :     }
     400             : 
     401             :     // set anchor type
     402           0 :     if (pXFObj)
     403             :     {
     404           0 :         pXFObj->SetAnchorType(enumXFAnchorFrame);
     405             :     }
     406             : 
     407           0 :     return pXFObj;
     408             : }
     409             : 
     410             : /**
     411             :  * @descr   Constructor of class LwpDrawLine
     412             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     413             :  */
     414           0 : LwpDrawLine::LwpDrawLine(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     415           0 : : LwpDrawObj(pStream, pTransData)
     416             : {
     417           0 : }
     418             : 
     419             : /**
     420             :  * @descr   reading function of class LwpDrawLine
     421             :  */
     422           0 : void LwpDrawLine::Read()
     423             : {
     424           0 :     m_pStream->ReadInt16( m_aLineRec.nStartX );
     425           0 :     m_pStream->ReadInt16( m_aLineRec.nStartY );
     426           0 :     m_pStream->ReadInt16( m_aLineRec.nEndX );
     427           0 :     m_pStream->ReadInt16( m_aLineRec.nEndY );
     428           0 :     m_pStream->ReadUChar( m_aLineRec.nLineWidth );
     429           0 :     m_pStream->ReadUChar( m_aLineRec.nLineEnd );
     430           0 :     m_pStream->ReadUChar( m_aLineRec.nLineStyle );
     431             : 
     432           0 :     m_pStream->ReadUChar( m_aLineRec.aPenColor.nR );
     433           0 :     m_pStream->ReadUChar( m_aLineRec.aPenColor.nG );
     434           0 :     m_pStream->ReadUChar( m_aLineRec.aPenColor.nB );
     435           0 :     m_pStream->ReadUChar( m_aLineRec.aPenColor.unused );
     436           0 : }
     437             : 
     438           0 : OUString LwpDrawLine::RegisterStyle()
     439             : {
     440           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     441             : 
     442             :     // set line style
     443           0 :     this->SetLineStyle(pStyle, m_aLineRec.nLineWidth, m_aLineRec.nLineStyle, m_aLineRec.aPenColor);
     444             : 
     445             :     // set arrow head
     446           0 :     this->SetArrowHead(pStyle, m_aLineRec.nLineEnd, m_aLineRec.nLineWidth);
     447             : 
     448           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     449           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     450             : 
     451             : }
     452             : 
     453           0 : XFFrame* LwpDrawLine::CreateDrawObj(const OUString& rStyleName )
     454             : {
     455           0 :     XFDrawPath* pLine = new XFDrawPath();
     456           0 :     pLine->MoveTo(XFPoint((double)(m_aLineRec.nStartX)/TWIPS_PER_CM * m_pTransData->fScaleX,
     457           0 :         (double)(m_aLineRec.nStartY)/TWIPS_PER_CM * m_pTransData->fScaleY));
     458           0 :     pLine->LineTo(XFPoint((double)(m_aLineRec.nEndX)/TWIPS_PER_CM * m_pTransData->fScaleX,
     459           0 :         (double)(m_aLineRec.nEndY)/TWIPS_PER_CM * m_pTransData->fScaleY));
     460           0 :     this->SetPosition(pLine);
     461             : 
     462           0 :     pLine->SetStyleName(rStyleName);
     463             : 
     464           0 :     return pLine;
     465             : }
     466             : 
     467           0 : XFFrame* LwpDrawLine::CreateStandardDrawObj(const  OUString& rStyleName)
     468             : {
     469           0 :     XFDrawLine* pLine = new XFDrawLine();
     470           0 :     pLine->SetStartPoint((double)(m_aLineRec.nStartX)/TWIPS_PER_CM,(double)(m_aLineRec.nStartY)/TWIPS_PER_CM);
     471           0 :     pLine->SetEndPoint((double)(m_aLineRec.nEndX)/TWIPS_PER_CM,(double)(m_aLineRec.nEndY)/TWIPS_PER_CM);
     472             : 
     473           0 :     pLine->SetStyleName(rStyleName);
     474           0 :     return pLine;
     475             : }
     476             : 
     477             : /**
     478             :  * @descr   Constructor of class LwpDrawPolyLine
     479             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     480             :  */
     481           0 : LwpDrawPolyLine::LwpDrawPolyLine(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     482           0 : : LwpDrawObj(pStream, pTransData), m_pVector(NULL)
     483             : {
     484           0 : }
     485           0 : LwpDrawPolyLine::~LwpDrawPolyLine()
     486             : {
     487           0 :     if (m_pVector)
     488             :     {
     489           0 :         delete [] m_pVector;
     490           0 :         m_pVector = NULL;
     491             :     }
     492           0 : }
     493             : 
     494             : /**
     495             :  * @descr   reading function of class LwpDrawPolyLine
     496             :  */
     497           0 : void LwpDrawPolyLine::Read()
     498             : {
     499           0 :     m_pStream->ReadUChar( m_aPolyLineRec.nLineWidth );
     500           0 :     m_pStream->ReadUChar( m_aPolyLineRec.nLineEnd );
     501           0 :     m_pStream->ReadUChar( m_aPolyLineRec.nLineStyle );
     502           0 :     m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nR );
     503           0 :     m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nG );
     504           0 :     m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.nB );
     505           0 :     m_pStream->ReadUChar( m_aPolyLineRec.aPenColor.unused );
     506           0 :     m_pStream->ReadUInt16( m_aPolyLineRec.nNumPoints );
     507             : 
     508           0 :     m_pVector= new SdwPoint [m_aPolyLineRec.nNumPoints];
     509             : 
     510           0 :     for (sal_uInt16 nC = 0; nC < m_aPolyLineRec.nNumPoints; nC++)
     511             :     {
     512           0 :         m_pStream->ReadInt16( m_pVector[nC].x );
     513           0 :         m_pStream->ReadInt16( m_pVector[nC].y );
     514             :     }
     515           0 : }
     516             : 
     517           0 : OUString LwpDrawPolyLine::RegisterStyle()
     518             : {
     519           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     520             : 
     521             :     // set line style
     522             :     this->SetLineStyle(pStyle, m_aPolyLineRec.nLineWidth, m_aPolyLineRec.nLineStyle,
     523           0 :         m_aPolyLineRec.aPenColor);
     524             : 
     525             :     // set arrow head
     526           0 :     this->SetArrowHead(pStyle, m_aPolyLineRec.nLineEnd, m_aPolyLineRec.nLineWidth);
     527             : 
     528           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     529           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     530             : }
     531             : 
     532           0 : XFFrame* LwpDrawPolyLine::CreateDrawObj(const OUString& rStyleName )
     533             : {
     534           0 :     XFDrawPath* pPolyline = new XFDrawPath();
     535           0 :     pPolyline->MoveTo(XFPoint((double)m_pVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     536           0 :             (double)m_pVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     537           0 :     for (sal_uInt8 nC = 1; nC < m_aPolyLineRec.nNumPoints; nC++)
     538             :     {
     539           0 :         pPolyline->LineTo(XFPoint((double)m_pVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     540           0 :             (double)m_pVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     541             :     }
     542           0 :     this->SetPosition(pPolyline);
     543             : 
     544           0 :     pPolyline->SetStyleName(rStyleName);
     545             : 
     546           0 :     return pPolyline;
     547             : }
     548             : 
     549           0 : XFFrame* LwpDrawPolyLine::CreateStandardDrawObj(const  OUString& rStyleName)
     550             : {
     551           0 :     XFDrawPolyline* pPolyline = new XFDrawPolyline();
     552           0 :     for (sal_uInt8 nC = 0; nC < m_aPolyLineRec.nNumPoints; nC++)
     553             :     {
     554           0 :         pPolyline->AddPoint((double)m_pVector[nC].x/TWIPS_PER_CM,
     555           0 :             (double)m_pVector[nC].y/TWIPS_PER_CM);
     556             :     }
     557             : 
     558           0 :     pPolyline->SetStyleName(rStyleName);
     559             : 
     560           0 :     return pPolyline;
     561             : }
     562             : 
     563             : /**
     564             :  * @descr   Constructor of class LwpDrawPolygon
     565             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     566             :  */
     567           0 : LwpDrawPolygon::LwpDrawPolygon(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     568             :     : LwpDrawObj(pStream, pTransData)
     569             :     , m_nNumPoints(0)
     570           0 :     , m_pVector(NULL)
     571             : {
     572           0 : }
     573             : 
     574           0 : LwpDrawPolygon::~LwpDrawPolygon()
     575             : {
     576           0 :     if (m_pVector)
     577             :     {
     578           0 :         delete [] m_pVector;
     579           0 :         m_pVector = NULL;
     580             :     }
     581           0 : }
     582             : 
     583             : /**
     584             :  * @descr   reading function of class LwpDrawPolygon
     585             :  */
     586           0 : void LwpDrawPolygon::Read()
     587             : {
     588           0 :     this->ReadClosedObjStyle();
     589           0 :     m_pStream->ReadUInt16( m_nNumPoints );
     590             : 
     591           0 :     m_pVector = new SdwPoint [m_nNumPoints];
     592             : 
     593           0 :     for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++)
     594             :     {
     595           0 :         m_pStream->ReadInt16( m_pVector[nC].x );
     596           0 :         m_pStream->ReadInt16( m_pVector[nC].y );
     597             :     }
     598           0 : }
     599             : 
     600           0 : OUString LwpDrawPolygon::RegisterStyle()
     601             : {
     602           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     603             : 
     604             :     // set line style
     605             :     this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
     606           0 :         m_aClosedObjStyleRec.aPenColor);
     607             : 
     608             :     // set fill style
     609           0 :     this->SetFillStyle(pStyle);
     610             : 
     611           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     612           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     613             : }
     614             : 
     615           0 : XFFrame* LwpDrawPolygon::CreateDrawObj(const OUString& rStyleName)
     616             : {
     617           0 :     XFDrawPath* pPolygon = new XFDrawPath();
     618           0 :     pPolygon->MoveTo(XFPoint((double)m_pVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     619           0 :             (double)m_pVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     620           0 :     for (sal_uInt16 nC = 1; nC < m_nNumPoints; nC++)
     621             :     {
     622           0 :         pPolygon->LineTo(XFPoint((double)m_pVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     623           0 :             (double)m_pVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     624             :     }
     625           0 :     pPolygon->ClosePath();
     626           0 :     this->SetPosition(pPolygon);
     627           0 :     pPolygon->SetStyleName(rStyleName);
     628             : 
     629           0 :     return pPolygon;
     630             : }
     631             : 
     632           0 : XFFrame* LwpDrawPolygon::CreateStandardDrawObj(const  OUString& rStyleName)
     633             : {
     634           0 :     XFDrawPolygon* pPolygon = new XFDrawPolygon();
     635           0 :     for (sal_uInt16 nC = 0; nC < m_nNumPoints; nC++)
     636             :     {
     637           0 :         pPolygon->AddPoint((double)m_pVector[nC].x/TWIPS_PER_CM,
     638           0 :             (double)m_pVector[nC].y/TWIPS_PER_CM);
     639             :     }
     640             : 
     641           0 :     pPolygon->SetStyleName(rStyleName);
     642             : 
     643           0 :     return pPolygon;
     644             : }
     645             : 
     646             : /**
     647             :  * @descr   Constructor of class LwpDrawRectangle
     648             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     649             :  */
     650           0 : LwpDrawRectangle::LwpDrawRectangle(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     651           0 :     : LwpDrawObj(pStream, pTransData)
     652             : {
     653           0 : }
     654             : 
     655             : /**
     656             :  * @descr   reading function of class LwpDrawRectangle
     657             :  */
     658           0 : void LwpDrawRectangle::Read()
     659             : {
     660           0 :     this->ReadClosedObjStyle();
     661             : 
     662             :     sal_uInt8 nPointsCount;
     663           0 :     if (m_eType == OT_RNDRECT)
     664             :     {
     665           0 :         nPointsCount = 16;
     666           0 :         m_pStream->SeekRel(4); // corner points
     667             :     }
     668             :     else
     669             :     {
     670           0 :         nPointsCount = 4;
     671             :     }
     672             : 
     673           0 :     for (sal_uInt8 nC = 0; nC < nPointsCount; nC++)
     674             :     {
     675           0 :         m_pStream->ReadInt16( m_aVector[nC].x );
     676           0 :         m_pStream->ReadInt16( m_aVector[nC].y );
     677             :     }
     678           0 : }
     679             : 
     680           0 : OUString LwpDrawRectangle::RegisterStyle()
     681             : {
     682           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     683             : 
     684             :     // set line style
     685             :     this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
     686           0 :         m_aClosedObjStyleRec.aPenColor);
     687             : 
     688             :     // set fill style
     689           0 :     this->SetFillStyle(pStyle);
     690             : 
     691           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     692           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     693             : }
     694             : 
     695           0 : XFFrame* LwpDrawRectangle::CreateDrawObj(const OUString& rStyleName)
     696             : {
     697           0 :     if (m_eType == OT_RNDRECT)
     698             :     {
     699           0 :         return this->CreateRoundedRect(rStyleName);
     700             :     }
     701             :     else
     702             :     {
     703           0 :         XFDrawPath* pRect = new XFDrawPath();
     704           0 :         pRect->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     705           0 :             (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     706           0 :         for (sal_uInt8 nC = 1; nC < 4; nC++)
     707             :         {
     708           0 :             pRect->LineTo(XFPoint((double)m_aVector[nC].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     709           0 :                 (double)m_aVector[nC].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     710             :         }
     711           0 :         pRect->LineTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     712           0 :                 (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     713           0 :         pRect->ClosePath(sal_True);
     714           0 :         this->SetPosition(pRect);
     715             : 
     716           0 :         pRect->SetStyleName(rStyleName);
     717             : 
     718           0 :         return pRect;
     719             :     }
     720             : }
     721             : 
     722           0 : XFFrame* LwpDrawRectangle::CreateRoundedRect(const OUString& rStyleName)
     723             : {
     724           0 :     XFDrawPath* pRoundedRect = new XFDrawPath();
     725           0 :     pRoundedRect->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     726           0 :     (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     727             : 
     728           0 :     sal_uInt8 nPtIndex = 1;
     729           0 :     for (sal_uInt8 nC = 0; nC < 7; nC++)
     730             :     {
     731           0 :         if (nC%2 == 0)
     732             :         {
     733           0 :             XFPoint aCtrl1((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     734           0 :                 (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     735           0 :             nPtIndex++;
     736           0 :             XFPoint aCtrl2((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     737           0 :                 (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     738           0 :             nPtIndex++;
     739           0 :             XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     740           0 :                 (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     741           0 :             nPtIndex++;
     742             : 
     743           0 :             pRoundedRect->CurveTo(aDest, aCtrl1, aCtrl2);
     744             :         }
     745             :         else
     746             :         {
     747           0 :             XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     748           0 :                 (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     749           0 :             nPtIndex++;
     750             : 
     751           0 :             pRoundedRect->LineTo(aDest);
     752             :         }
     753             :     }
     754             : 
     755           0 :     pRoundedRect->LineTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     756           0 :                 (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     757           0 :     pRoundedRect->ClosePath(sal_True);
     758           0 :     this->SetPosition(pRoundedRect);
     759             : 
     760           0 :     pRoundedRect->SetStyleName(rStyleName);
     761             : 
     762           0 :     return pRoundedRect;
     763             : }
     764             : 
     765           0 : XFFrame* LwpDrawRectangle::CreateStandardDrawObj(const  OUString& rStyleName)
     766             : {
     767           0 :     if (m_eType == OT_RNDRECT)
     768             :     {
     769           0 :         return this->CreateRoundedRect(rStyleName);
     770             :     }
     771             :     else
     772             :     {
     773           0 :         XFDrawRect* pRect = new XFDrawRect();
     774             :         double fStartX, fStartY, fWidth, fHeight;
     775           0 :         double fRotAngle = 0.0;
     776           0 :         SdwRectangle aSdwRect;
     777           0 :         Rectangle aOriginalRect;
     778           0 :         Point aPt0, aPt1, aPt2, aPt3;
     779             : 
     780           0 :         aPt0.setX(m_aVector[0].x); aPt0.setY(m_aVector[0].y);
     781           0 :         aPt1.setX(m_aVector[1].x); aPt1.setY(m_aVector[1].y);
     782           0 :         aPt2.setX(m_aVector[2].x); aPt2.setY(m_aVector[2].y);
     783           0 :         aPt3.setX(m_aVector[3].x); aPt3.setY(m_aVector[3].y);
     784             : 
     785           0 :         aSdwRect = SdwRectangle(aPt0, aPt1, aPt2, aPt3);
     786           0 :         if (aSdwRect.IsRectRotated())
     787             :         {
     788           0 :             aOriginalRect = aSdwRect.GetOriginalRect();
     789           0 :             fRotAngle = aSdwRect.GetRotationAngle();
     790             :         }
     791             :         else
     792             :         {
     793           0 :             aOriginalRect = Rectangle(aPt0, aPt2);
     794             :         }
     795             : 
     796           0 :         fStartX = aOriginalRect.TopLeft().X();
     797           0 :         fStartY = aOriginalRect.TopLeft().Y();
     798           0 :         fWidth = aOriginalRect.GetWidth();
     799           0 :         fHeight = aOriginalRect.GetHeight();
     800             : 
     801           0 :         pRect->SetStartPoint(XFPoint(fStartX/TWIPS_PER_CM + m_pTransData->fOffsetX,
     802           0 :             fStartY/TWIPS_PER_CM + m_pTransData->fOffsetY));
     803           0 :         pRect->SetSize(fWidth/TWIPS_PER_CM, fHeight/TWIPS_PER_CM);
     804             : 
     805           0 :         if (aSdwRect.IsRectRotated())
     806             :         {
     807           0 :             pRect->SetRotate( fRotAngle / PI * 180);// aXFCenter);
     808             :         }
     809             : 
     810           0 :         pRect->SetStyleName(rStyleName);
     811             : 
     812           0 :         return pRect;
     813             :     }
     814             : }
     815             : 
     816             : /**
     817             :  * @descr   Constructor of class LwpDrawEllipse
     818             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     819             :  */
     820           0 : LwpDrawEllipse::LwpDrawEllipse(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     821           0 : : LwpDrawObj(pStream, pTransData)
     822             : {
     823           0 : }
     824             : 
     825             : /**
     826             :  * @descr   reading function of class LwpDrawEllipse
     827             :  */
     828           0 : void LwpDrawEllipse::Read()
     829             : {
     830           0 :     this->ReadClosedObjStyle();
     831             : 
     832           0 :     for (sal_uInt8 nC = 0; nC < 13; nC++)
     833             :     {
     834           0 :         m_pStream->ReadInt16( m_aVector[nC].x );
     835           0 :         m_pStream->ReadInt16( m_aVector[nC].y );
     836             :     }
     837           0 : }
     838             : 
     839           0 : OUString LwpDrawEllipse::RegisterStyle()
     840             : {
     841           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     842             : 
     843             :     // set line style
     844             :     this->SetLineStyle(pStyle, m_aClosedObjStyleRec.nLineWidth, m_aClosedObjStyleRec.nLineStyle,
     845           0 :         m_aClosedObjStyleRec.aPenColor);
     846             : 
     847             :     // set fill style
     848           0 :     this->SetFillStyle(pStyle);
     849             : 
     850           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     851           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     852             : }
     853             : 
     854           0 : XFFrame* LwpDrawEllipse::CreateDrawObj(const OUString& rStyleName )
     855             : {
     856           0 :     XFDrawPath* pEllipse = new XFDrawPath();
     857           0 :     pEllipse->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     858           0 :         (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     859           0 :     sal_uInt8 nPtIndex = 1;
     860           0 :     for (sal_uInt8 nC = 0; nC < 4; nC++)
     861             :     {
     862           0 :         XFPoint aCtrl1((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     863           0 :         (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     864           0 :         nPtIndex++;
     865           0 :         XFPoint aCtrl2((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     866           0 :         (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     867           0 :         nPtIndex++;
     868           0 :         XFPoint aDest((double)m_aVector[nPtIndex].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     869           0 :         (double)m_aVector[nPtIndex].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     870           0 :         nPtIndex++;
     871             : 
     872           0 :         pEllipse->CurveTo(aDest, aCtrl1, aCtrl2);
     873             :     }
     874           0 :     pEllipse->ClosePath(sal_True);
     875           0 :     this->SetPosition(pEllipse);
     876             : 
     877           0 :     pEllipse->SetStyleName(rStyleName);
     878             : 
     879           0 :     return pEllipse;
     880             : }
     881             : 
     882           0 : XFFrame* LwpDrawEllipse::CreateStandardDrawObj(const  OUString& rStyleName)
     883             : {
     884           0 :     return this->CreateDrawObj(rStyleName);
     885             : }
     886             : 
     887             : /**
     888             :  * @descr   Constructor of class LwpDrawArc
     889             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     890             :  */
     891           0 : LwpDrawArc::LwpDrawArc(SvStream * pStream, DrawingOffsetAndScale* pTransData)
     892           0 : : LwpDrawObj(pStream, pTransData)
     893             : {
     894           0 : }
     895             : 
     896             : /**
     897             :  * @descr   reading function of class LwpDrawArc
     898             :  */
     899           0 : void LwpDrawArc::Read()
     900             : {
     901           0 :     m_pStream->SeekRel(16);// arcRect, startPt, endPt
     902             : 
     903           0 :     m_pStream->ReadUChar( m_aArcRec.nLineWidth );
     904           0 :     m_pStream->ReadUChar( m_aArcRec.nLineStyle );
     905           0 :     m_pStream->ReadUChar( m_aArcRec.aPenColor.nR );
     906           0 :     m_pStream->ReadUChar( m_aArcRec.aPenColor.nG );
     907           0 :     m_pStream->ReadUChar( m_aArcRec.aPenColor.nB );
     908           0 :     m_pStream->ReadUChar( m_aArcRec.aPenColor.unused );
     909           0 :     m_pStream->ReadUChar( m_aArcRec.nLineEnd );
     910             : 
     911           0 :     for (sal_uInt8 nC = 0; nC < 4; nC++)
     912             :     {
     913           0 :         m_pStream->ReadInt16( m_aVector[nC].x );
     914           0 :         m_pStream->ReadInt16( m_aVector[nC].y );
     915             :     }
     916           0 : }
     917             : 
     918           0 : OUString LwpDrawArc::RegisterStyle()
     919             : {
     920           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
     921             : 
     922             :     // set line style
     923             :     this->SetLineStyle(pStyle, m_aArcRec.nLineWidth, m_aArcRec.nLineStyle,
     924           0 :         m_aArcRec.aPenColor);
     925             : 
     926             :     // set arrow head
     927           0 :     this->SetArrowHead(pStyle, m_aArcRec.nLineEnd, m_aArcRec.nLineWidth);
     928             : 
     929           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     930           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
     931             : }
     932             : 
     933           0 : XFFrame* LwpDrawArc::CreateDrawObj(const OUString& rStyleName )
     934             : {
     935           0 :     XFDrawPath* pArc = new XFDrawPath();
     936           0 :     pArc->MoveTo(XFPoint((double)m_aVector[0].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     937           0 :         (double)m_aVector[0].y/TWIPS_PER_CM * m_pTransData->fScaleY));
     938           0 :     XFPoint aDest((double)m_aVector[3].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     939           0 :         (double)m_aVector[3].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     940           0 :     XFPoint aCtl1((double)m_aVector[1].x/TWIPS_PER_CM * m_pTransData->fScaleX,
     941           0 :         (double)m_aVector[1].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     942           0 :     XFPoint aCtl2((double)m_aVector[2].x/TWIPS_PER_CM* m_pTransData->fScaleX,
     943           0 :         (double)m_aVector[2].y/TWIPS_PER_CM * m_pTransData->fScaleY);
     944           0 :     pArc->CurveTo(aDest, aCtl1, aCtl2);
     945             : 
     946           0 :     this->SetPosition(pArc);
     947             : 
     948           0 :     pArc->SetStyleName(rStyleName);
     949             : 
     950           0 :     return pArc;
     951             : }
     952             : 
     953           0 : XFFrame* LwpDrawArc::CreateStandardDrawObj(const  OUString& rStyleName)
     954             : {
     955           0 :     return this->CreateDrawObj(rStyleName);
     956             : }
     957             : 
     958             : /**
     959             :  * @descr   Constructor of class LwpDrawTextBox
     960             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
     961             :  */
     962           0 : LwpDrawTextBox::LwpDrawTextBox(SvStream* pStream) : LwpDrawObj(pStream)
     963             : {
     964           0 : }
     965             : 
     966           0 : LwpDrawTextBox::~LwpDrawTextBox()
     967             : {
     968           0 :     if (m_aTextRec.pTextString)
     969             :     {
     970           0 :         delete [] m_aTextRec.pTextString;
     971           0 :         m_aTextRec.pTextString = NULL;
     972             :     }
     973           0 : }
     974             : 
     975           0 : void LwpDrawTextBox::SetFontStyle(XFFont* pFont, SdwTextBoxRecord* pRec)
     976             : {
     977             :     // color
     978             :     XFColor aXFColor(pRec->aTextColor.nR, pRec->aTextColor.nG,
     979           0 :             pRec->aTextColor.nB);
     980           0 :     pFont->SetColor(aXFColor);
     981             :     //size
     982           0 :     pFont->SetFontSize(pRec->nTextSize/20);
     983             :     // bold
     984           0 :     pFont->SetBold((sal_Bool)((pRec->nTextAttrs & TA_BOLD) != 0));
     985             :     // italic
     986           0 :     pFont->SetItalic((sal_Bool)((pRec->nTextAttrs & TA_ITALIC) != 0));
     987             :     // strike-through
     988           0 :     if (pRec->nTextAttrs & TA_STRIKETHRU)
     989             :     {
     990           0 :         pFont->SetCrossout(enumXFCrossoutSignel);
     991             :     }
     992             :     else
     993             :     {
     994           0 :         pFont->SetCrossout(enumXFCrossoutNone);
     995             :     }
     996             :     // underline
     997           0 :     if (pRec->nTextAttrs & TA_UNDERLINE)
     998             :     {
     999           0 :         pFont->SetUnderline(enumXFUnderlineSingle);
    1000             :     }
    1001           0 :     else if (pRec->nTextAttrs & TA_WORDUNDERLINE)
    1002             :     {
    1003           0 :         pFont->SetUnderline(enumXFUnderlineSingle, sal_True);
    1004             :     }
    1005           0 :     else if (pRec->nTextAttrs & TA_DOUBLEUNDER)
    1006             :     {
    1007           0 :         pFont->SetUnderline(enumXFUnderlineDouble);
    1008             :     }
    1009             :     else
    1010             :     {
    1011           0 :         pFont->SetUnderline(enumXFUnderlineNone);
    1012             :     }
    1013             :     // small-caps
    1014           0 :     if (pRec->nTextAttrs & TA_SMALLCAPS)
    1015             :     {
    1016           0 :         pFont->SetTransform(enumXFTransformSmallCaps);
    1017             :     }
    1018           0 : }
    1019             : 
    1020             : /**
    1021             :  * @descr   reading function of class LwpDrawTextBox
    1022             :  */
    1023           0 : void LwpDrawTextBox::Read()
    1024             : {
    1025           0 :     m_pStream->ReadInt16( m_aVector.x );
    1026           0 :     m_pStream->ReadInt16( m_aVector.y );
    1027           0 :     m_pStream->ReadInt16( m_aTextRec.nTextWidth );
    1028             : 
    1029           0 :     if (m_aTextRec.nTextWidth == 0)
    1030           0 :         m_aTextRec.nTextWidth = 1;
    1031             : 
    1032           0 :     m_pStream->ReadInt16( m_aTextRec.nTextHeight );
    1033           0 :     m_pStream->Read(m_aTextRec.tmpTextFaceName, DRAW_FACESIZE);
    1034           0 :     m_pStream->SeekRel(1);// PitchAndFamily
    1035             : 
    1036           0 :     m_pStream->ReadInt16( m_aTextRec.nTextSize );
    1037             : 
    1038           0 :     if (m_aTextRec.nTextSize < 0)
    1039           0 :         m_aTextRec.nTextSize = -m_aTextRec.nTextSize;
    1040             : 
    1041             :     //color
    1042           0 :     m_pStream->ReadUChar( m_aTextRec.aTextColor.nR );
    1043           0 :     m_pStream->ReadUChar( m_aTextRec.aTextColor.nG );
    1044           0 :     m_pStream->ReadUChar( m_aTextRec.aTextColor.nB );
    1045           0 :     m_pStream->ReadUChar( m_aTextRec.aTextColor.unused );
    1046             : 
    1047           0 :     m_pStream->ReadUInt16( m_aTextRec.nTextAttrs );
    1048           0 :     m_pStream->ReadUInt16( m_aTextRec.nTextCharacterSet );
    1049           0 :     m_pStream->ReadInt16( m_aTextRec.nTextRotation );
    1050           0 :     m_pStream->ReadInt16( m_aTextRec.nTextExtraSpacing );
    1051             : 
    1052             :     // some draw files in version 1.2 have an extra byte following '\0'.
    1053             :     // can't rely on that, so read in the whole string into memory.
    1054             : 
    1055             :     // the 71 is the fixed length before text content in textbox record
    1056           0 :     sal_Int16 TextLength = m_aObjHeader.nRecLen - 71;
    1057           0 :     m_aTextRec.pTextString = new sal_uInt8 [TextLength];
    1058             : 
    1059           0 :     m_pStream->Read(m_aTextRec.pTextString, TextLength);
    1060           0 : }
    1061             : 
    1062           0 : OUString LwpDrawTextBox::RegisterStyle()
    1063             : {
    1064           0 :     XFParaStyle* pStyle = new XFParaStyle();
    1065             : 
    1066             :     // font style
    1067             :     // the pFont need to be deleted myself?
    1068           0 :     XFFont* pFont = new XFFont();
    1069             : 
    1070           0 :     rtl_TextEncoding aEncoding =  RTL_TEXTENCODING_MS_1252;
    1071             :     OUString aFontName = OUString((sal_Char*)m_aTextRec.tmpTextFaceName,
    1072           0 :         strlen((char*)m_aTextRec.tmpTextFaceName), aEncoding);
    1073           0 :     pFont->SetFontName(aFontName);
    1074             : 
    1075           0 :     this->SetFontStyle(pFont, &m_aTextRec);
    1076             : 
    1077           0 :     pStyle->SetFont(pFont);
    1078             : 
    1079           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1080           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
    1081             : }
    1082             : 
    1083           0 : XFFrame* LwpDrawTextBox::CreateDrawObj(const OUString& rStyleName )
    1084             : {
    1085           0 :     XFFrame* pTextBox = new XFFrame(sal_True);
    1086             : 
    1087           0 :     sal_Int16 TextLength = m_aObjHeader.nRecLen - 71;
    1088             :     rtl_TextEncoding aEncoding;
    1089           0 :     if (!m_aTextRec.nTextCharacterSet)
    1090             :     {
    1091           0 :         aEncoding = osl_getThreadTextEncoding();
    1092             :     }
    1093             :     else
    1094             :     {
    1095             :         // temporary code, need to create Encoding from the value of nTextCharacterSet
    1096           0 :         aEncoding = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
    1097             :     }
    1098             : 
    1099           0 :     XFParagraph* pXFPara = new XFParagraph();
    1100           0 :     pXFPara->Add(OUString((sal_Char*)m_aTextRec.pTextString, (TextLength-2), aEncoding));
    1101           0 :     pXFPara->SetStyleName(rStyleName);
    1102             : 
    1103           0 :     pTextBox->Add(pXFPara);
    1104           0 :     this->SetPosition(pTextBox);
    1105             : 
    1106           0 :     XFTextBoxStyle* pBoxStyle = new XFTextBoxStyle();
    1107             : 
    1108           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1109           0 :     OUString sName = pXFStyleManager->AddStyle(pBoxStyle)->GetStyleName();
    1110           0 :     pTextBox->SetStyleName(sName);
    1111             : 
    1112             :     //todo: add the interface for rotating textbox
    1113             : //  if (m_aTextRec.nTextRotation)
    1114             : //  {
    1115             : //      double fAngle = double(3600-m_aTextRec.nTextRotation)/10;
    1116             : //      pTextBox->SetRotate(fAngle);
    1117             : //  }
    1118             : 
    1119           0 :     return pTextBox;
    1120             : }
    1121             : 
    1122           0 : XFFrame* LwpDrawTextBox::CreateStandardDrawObj(const  OUString& rStyleName)
    1123             : {
    1124           0 :     return this->CreateDrawObj(rStyleName);
    1125             : }
    1126             : 
    1127             : /**
    1128             :  * @descr   Constructor of class LwpDrawTextBox
    1129             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
    1130             :  */
    1131           0 : LwpDrawTextArt::LwpDrawTextArt(SvStream* pStream, DrawingOffsetAndScale* pTransData)
    1132           0 : : LwpDrawObj(pStream, pTransData)
    1133             : {
    1134           0 : }
    1135             : 
    1136           0 : LwpDrawTextArt::~LwpDrawTextArt()
    1137             : {
    1138           0 :     if (m_aTextArtRec.aPath[0].pPts)
    1139             :     {
    1140           0 :         delete [] m_aTextArtRec.aPath[0].pPts;
    1141           0 :         m_aTextArtRec.aPath[0].pPts = NULL;
    1142             :     }
    1143           0 :     if (m_aTextArtRec.aPath[1].pPts)
    1144             :     {
    1145           0 :         delete [] m_aTextArtRec.aPath[1].pPts;
    1146           0 :         m_aTextArtRec.aPath[1].pPts = NULL;
    1147             :     }
    1148           0 :     if (m_aTextArtRec.pTextString)
    1149             :     {
    1150           0 :         delete [] m_aTextArtRec.pTextString;
    1151           0 :         m_aTextArtRec.pTextString = NULL;
    1152             :     }
    1153             : 
    1154           0 : }
    1155             : 
    1156           0 : void LwpDrawTextArt::CreateFWPath(XFDrawPath* pPath)
    1157             : {
    1158             :     sal_Int16 nX, nY;
    1159           0 :     nX = (m_aTextArtRec.aPath[0].pPts[0].x + m_aTextArtRec.aPath[1].pPts[0].x) / 2;
    1160           0 :     nY = (m_aTextArtRec.aPath[0].pPts[0].y + m_aTextArtRec.aPath[1].pPts[0].y) / 2;
    1161           0 :     XFPoint aStart((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX,
    1162           0 :         (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY);
    1163           0 :     pPath->MoveTo(aStart);
    1164             : 
    1165           0 :     sal_uInt8 nPtIndex = 1;
    1166           0 :     for (sal_uInt8 nC = 1; nC <= m_aTextArtRec.aPath[0].n; nC++)
    1167             :     {
    1168           0 :         nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
    1169           0 :         nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
    1170           0 :         XFPoint aCtrl1((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX,
    1171           0 :             (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY);
    1172             : 
    1173           0 :         nPtIndex++;
    1174           0 :         nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
    1175           0 :         nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
    1176           0 :         XFPoint aCtrl2((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX,
    1177           0 :             (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY);
    1178             : 
    1179           0 :         nPtIndex++;
    1180           0 :         nX = (m_aTextArtRec.aPath[0].pPts[nPtIndex].x + m_aTextArtRec.aPath[1].pPts[nPtIndex].x) / 2;
    1181           0 :         nY = (m_aTextArtRec.aPath[0].pPts[nPtIndex].y + m_aTextArtRec.aPath[1].pPts[nPtIndex].y) / 2;
    1182           0 :         XFPoint aDest((double)nX/TWIPS_PER_CM * m_pTransData->fScaleX,
    1183           0 :             (double)nY/TWIPS_PER_CM * m_pTransData->fScaleY);
    1184             : 
    1185           0 :         pPath->CurveTo(aDest, aCtrl1, aCtrl2);
    1186             :     }
    1187           0 : }
    1188             : 
    1189           0 : void LwpDrawTextArt::Read()
    1190             : {
    1191           0 :     for (sal_uInt8 nC = 0; nC < 4; nC++)
    1192             :     {
    1193           0 :         m_pStream->ReadInt16( m_aVector[nC].x );
    1194           0 :         m_pStream->ReadInt16( m_aVector[nC].y );
    1195             :     }
    1196             : 
    1197           0 :     this->ReadClosedObjStyle();
    1198           0 :     m_aTextArtRec.aTextColor = m_aClosedObjStyleRec.aForeColor;
    1199             : 
    1200           0 :     m_pStream->ReadUChar( m_aTextArtRec.nIndex );
    1201           0 :     m_pStream->ReadInt16( m_aTextArtRec.nRotation );
    1202             : 
    1203             :     sal_uInt16 nPointNumber;
    1204             :     sal_Int16 nX, nY;
    1205           0 :     m_pStream->ReadUInt16( nPointNumber );
    1206           0 :     m_aTextArtRec.aPath[0].n = nPointNumber;
    1207           0 :     m_aTextArtRec.aPath[0].pPts = new SdwPoint [nPointNumber*3+1];
    1208           0 :     sal_uInt16 nPt = 0;
    1209           0 :     for ( nPt = 0; nPt <= nPointNumber*3; nPt++)
    1210             :     {
    1211           0 :         m_pStream->ReadInt16( nX );
    1212           0 :         m_pStream->ReadInt16( nY );
    1213           0 :         m_aTextArtRec.aPath[0].pPts[nPt].x = nX;
    1214           0 :         m_aTextArtRec.aPath[0].pPts[nPt].y = nY;
    1215             :     }
    1216             : 
    1217           0 :     m_pStream->ReadUInt16( nPointNumber );
    1218           0 :     m_aTextArtRec.aPath[1].n = nPointNumber;
    1219           0 :     m_aTextArtRec.aPath[1].pPts = new SdwPoint [nPointNumber*3+1];
    1220           0 :     for (nPt = 0; nPt <= nPointNumber*3; nPt++)
    1221             :     {
    1222           0 :         m_pStream->ReadInt16( nX );
    1223           0 :         m_pStream->ReadInt16( nY );
    1224           0 :         m_aTextArtRec.aPath[1].pPts[nPt].x = nX;
    1225           0 :         m_aTextArtRec.aPath[1].pPts[nPt].y = nY;
    1226             :     }
    1227             : 
    1228           0 :     m_pStream->SeekRel(1);
    1229             : 
    1230           0 :     m_pStream->Read(m_aTextArtRec.tmpTextFaceName, DRAW_FACESIZE);
    1231           0 :     m_pStream->SeekRel(1);// PitchAndFamily
    1232             : 
    1233           0 :     m_pStream->ReadInt16( m_aTextArtRec.nTextSize );
    1234             : 
    1235           0 :     if (m_aTextArtRec.nTextSize < 0)
    1236           0 :         m_aTextArtRec.nTextSize = -m_aTextArtRec.nTextSize;
    1237             : 
    1238           0 :     m_pStream->ReadUInt16( m_aTextArtRec.nTextAttrs );
    1239           0 :     m_pStream->ReadUInt16( m_aTextArtRec.nTextCharacterSet );
    1240           0 :     m_aTextArtRec.nTextRotation = 0;
    1241           0 :     m_pStream->ReadInt16( m_aTextArtRec.nTextExtraSpacing );
    1242             : 
    1243           0 :     const sal_uInt16 nTextArtFixedLength = 105;
    1244             :     m_aTextArtRec.nTextLen = m_aObjHeader.nRecLen - nTextArtFixedLength
    1245             :                                                     - (m_aTextArtRec.aPath[0].n*3 + 1)*4
    1246           0 :                                                     - (m_aTextArtRec.aPath[1].n*3 + 1)*4;
    1247             : 
    1248           0 :     m_aTextArtRec.pTextString = new sal_uInt8 [m_aTextArtRec.nTextLen];
    1249           0 :     m_pStream->Read(m_aTextArtRec.pTextString, m_aTextArtRec.nTextLen);
    1250           0 :     m_aTextArtRec.pTextString[m_aTextArtRec.nTextLen-1] = 0;
    1251             : 
    1252           0 : }
    1253             : 
    1254           0 : OUString LwpDrawTextArt::RegisterStyle()
    1255             : {
    1256           0 :     XFParaStyle* pStyle = new XFParaStyle();
    1257             : 
    1258             :     // font style
    1259             :     // the pFont need to be deleted myself?
    1260           0 :     XFFont* pFont = new XFFont();
    1261             : 
    1262           0 :     rtl_TextEncoding aEncoding =  RTL_TEXTENCODING_MS_1252;
    1263             :     OUString aFontName = OUString((sal_Char*)m_aTextArtRec.tmpTextFaceName,
    1264           0 :         strlen((char*)m_aTextArtRec.tmpTextFaceName), aEncoding);
    1265           0 :     pFont->SetFontName(aFontName);
    1266             : 
    1267           0 :     LwpDrawTextBox::SetFontStyle(pFont, &m_aTextArtRec);
    1268             : 
    1269           0 :     pStyle->SetFont(pFont);
    1270             : 
    1271           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1272           0 :     return pXFStyleManager->AddStyle(pStyle)->GetStyleName();
    1273             : }
    1274             : 
    1275           0 : XFFrame* LwpDrawTextArt::CreateDrawObj(const OUString& rStyleName)
    1276             : {
    1277           0 :     XFFrame* pRetObj = NULL;
    1278           0 :     XFDrawStyle* pStyle = new XFDrawStyle();
    1279             : 
    1280           0 :     pRetObj = new XFDrawPath();
    1281           0 :     XFDrawPath* pFWPath = static_cast<XFDrawPath*>(pRetObj);
    1282           0 :     this->CreateFWPath(pFWPath);
    1283           0 :     pStyle->SetFontWorkStyle(0, enumXFFWSlantY, enumXFFWAdjustAutosize);
    1284             : 
    1285           0 :     this->SetPosition(pRetObj);
    1286             : 
    1287             :     rtl_TextEncoding aEncoding;
    1288           0 :     if (!m_aTextArtRec.nTextCharacterSet)
    1289             :     {
    1290           0 :         aEncoding = osl_getThreadTextEncoding();
    1291             :     }
    1292             :     else
    1293             :     {
    1294             :         // temporary code, need to create Encoding from the value of nTextCharacterSet
    1295           0 :         aEncoding = LwpCharSetMgr::GetInstance()->GetTextCharEncoding();
    1296             :     }
    1297             : 
    1298           0 :     XFParagraph* pXFPara = new XFParagraph();
    1299           0 :     pXFPara->Add(OUString((sal_Char*)m_aTextArtRec.pTextString, (m_aTextArtRec.nTextLen-1), aEncoding));
    1300           0 :     pXFPara->SetStyleName(rStyleName);
    1301           0 :     pRetObj->Add(pXFPara);
    1302             : 
    1303           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1304           0 :     pRetObj->SetStyleName(pXFStyleManager->AddStyle(pStyle)->GetStyleName());
    1305             : 
    1306           0 :     return pRetObj;
    1307             : }
    1308             : 
    1309           0 : XFFrame* LwpDrawTextArt::CreateStandardDrawObj(const OUString& rStyleName )
    1310             : {
    1311           0 :     return this->CreateDrawObj(rStyleName);
    1312             : }
    1313             : 
    1314             : /**
    1315             :  * @descr   Constructor of class LwpDrawMetafile
    1316             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
    1317             :  */
    1318           0 : LwpDrawMetafile::LwpDrawMetafile(SvStream* pStream) : LwpDrawObj(pStream)
    1319             : {
    1320           0 : }
    1321             : 
    1322             : /**
    1323             :  * @descr   reading function of class LwpDrawMetafile
    1324             :  */
    1325           0 : void LwpDrawMetafile::Read()
    1326             : {
    1327           0 :     m_pStream->SeekRel(m_aObjHeader.nRecLen -16);
    1328           0 : }
    1329             : 
    1330             : /**
    1331             :  * @descr   Constructor of class LwpDrawBitmap
    1332             :  * @param   pStream   The memory stream which contains the lwp-sdw draw objects
    1333             :  */
    1334           0 : LwpDrawBitmap::LwpDrawBitmap(SvStream* pStream) : LwpDrawObj(pStream), m_pImageData(NULL)
    1335             : {
    1336           0 : }
    1337             : 
    1338           0 : LwpDrawBitmap::~LwpDrawBitmap()
    1339             : {
    1340           0 :     if (m_pImageData)
    1341             :     {
    1342           0 :         delete [] m_pImageData;
    1343           0 :         m_pImageData = NULL;
    1344             :     }
    1345           0 : }
    1346             : 
    1347             : /**
    1348             :  * @descr   reading function of class LwpDrawBitmap
    1349             :  */
    1350           0 : void LwpDrawBitmap::Read()
    1351             : {
    1352           0 :     m_pStream->ReadUInt16( m_aBmpRec.nTranslation );
    1353           0 :     m_pStream->ReadUInt16( m_aBmpRec.nRotation );
    1354             : 
    1355             :     // 20 == length of draw-specific fields.
    1356             :     // 14 == length of bmp file header.
    1357           0 :     m_aBmpRec.nFileSize = m_aObjHeader.nRecLen - 20 + 14;
    1358           0 :     m_pImageData = new sal_uInt8 [m_aBmpRec.nFileSize];
    1359             : 
    1360             :     BmpInfoHeader2 aInfoHeader2;
    1361           0 :     m_pStream->ReadUInt32( aInfoHeader2.nHeaderLen );
    1362             : 
    1363             :     sal_uInt32 N;
    1364             :     sal_uInt32 rgbTableSize;
    1365             : 
    1366           0 :     if (aInfoHeader2.nHeaderLen == sizeof(BmpInfoHeader))
    1367             :     {
    1368           0 :         m_pStream->ReadUInt32( aInfoHeader2.nWidth );
    1369           0 :         m_pStream->ReadUInt32( aInfoHeader2.nHeight );
    1370           0 :         m_pStream->ReadUInt16( aInfoHeader2.nPlanes );
    1371           0 :         m_pStream->ReadUInt16( aInfoHeader2.nBitCount );
    1372             : 
    1373           0 :         N = aInfoHeader2.nPlanes * aInfoHeader2.nBitCount;
    1374           0 :         if (N == 24)
    1375             :         {
    1376           0 :             rgbTableSize = 0;
    1377             :         }
    1378             :         else
    1379             :         {
    1380           0 :             rgbTableSize = 3 * (1 << N);
    1381             :         }
    1382             :     }
    1383             :     else
    1384             :     {
    1385           0 :         m_pStream->ReadUInt32( aInfoHeader2.nWidth );
    1386           0 :         m_pStream->ReadUInt32( aInfoHeader2.nHeight );
    1387           0 :         m_pStream->ReadUInt16( aInfoHeader2.nPlanes );
    1388           0 :         m_pStream->ReadUInt16( aInfoHeader2.nBitCount );
    1389           0 :         N = aInfoHeader2.nPlanes * aInfoHeader2.nBitCount;
    1390           0 :         if (N == 24)
    1391             :         {
    1392           0 :             rgbTableSize = 0;
    1393             :         }
    1394             :         else
    1395             :         {
    1396           0 :             rgbTableSize = 4 * (1 << N);
    1397             :         }
    1398             : 
    1399             :     }
    1400             : 
    1401           0 :     sal_uInt32 nOffBits = 14 + aInfoHeader2.nHeaderLen + rgbTableSize;
    1402           0 :     m_pImageData[0] = 'B';
    1403           0 :     m_pImageData[1] = 'M';
    1404           0 :     m_pImageData[2] = (sal_uInt8)m_aBmpRec.nFileSize;
    1405           0 :     m_pImageData[3] = (sal_uInt8)(m_aBmpRec.nFileSize >> 8);
    1406           0 :     m_pImageData[4] = (sal_uInt8)(m_aBmpRec.nFileSize >> 16);
    1407           0 :     m_pImageData[5] = (sal_uInt8)(m_aBmpRec.nFileSize >> 24);
    1408           0 :     m_pImageData[6] = 0;
    1409           0 :     m_pImageData[7] = 0;
    1410           0 :     m_pImageData[8] = 0;
    1411           0 :     m_pImageData[9] = 0;
    1412           0 :     m_pImageData[10] = (sal_uInt8)nOffBits;
    1413           0 :     m_pImageData[11] = (sal_uInt8)(nOffBits >> 8);
    1414           0 :     m_pImageData[12] = (sal_uInt8)(nOffBits >> 16);
    1415           0 :     m_pImageData[13] = (sal_uInt8)(nOffBits >> 24);
    1416             : 
    1417             :     sal_uInt32 nDIBRemaining;
    1418           0 :     sal_uInt8* pPicData = m_pImageData;
    1419           0 :     if (aInfoHeader2.nHeaderLen== sizeof(BmpInfoHeader))
    1420             :     {
    1421           0 :         m_pImageData[14] = (sal_uInt8)aInfoHeader2.nHeaderLen;
    1422           0 :         m_pImageData[15] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 8);
    1423           0 :         m_pImageData[16] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 16);
    1424           0 :         m_pImageData[17] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 24);
    1425           0 :         m_pImageData[18] = (sal_uInt8)aInfoHeader2.nWidth;
    1426           0 :         m_pImageData[19] = (sal_uInt8)(aInfoHeader2.nWidth >> 8);
    1427           0 :         m_pImageData[20] = (sal_uInt8)aInfoHeader2.nHeight;
    1428           0 :         m_pImageData[21] = (sal_uInt8)(aInfoHeader2.nHeight >> 8);
    1429           0 :         m_pImageData[22] = (sal_uInt8)aInfoHeader2.nPlanes;
    1430           0 :         m_pImageData[23] = (sal_uInt8)(aInfoHeader2.nPlanes >> 8);
    1431           0 :         m_pImageData[24] = (sal_uInt8)aInfoHeader2.nBitCount;
    1432           0 :         m_pImageData[25] = (sal_uInt8)(aInfoHeader2.nBitCount >> 8);
    1433             : 
    1434           0 :         nDIBRemaining = m_aBmpRec.nFileSize - 26;
    1435           0 :         pPicData += 26*sizeof(sal_uInt8);
    1436             :     }
    1437             :     else
    1438             :     {
    1439           0 :         m_pImageData[14] = (sal_uInt8)aInfoHeader2.nHeaderLen;
    1440           0 :         m_pImageData[15] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 8);
    1441           0 :         m_pImageData[16] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 16);
    1442           0 :         m_pImageData[17] = (sal_uInt8)(aInfoHeader2.nHeaderLen >> 24);
    1443           0 :         m_pImageData[18] = (sal_uInt8)aInfoHeader2.nWidth;
    1444           0 :         m_pImageData[19] = (sal_uInt8)(aInfoHeader2.nWidth >> 8);
    1445           0 :         m_pImageData[20] = (sal_uInt8)(aInfoHeader2.nWidth >> 16);
    1446           0 :         m_pImageData[21] = (sal_uInt8)(aInfoHeader2.nWidth >> 24);
    1447           0 :         m_pImageData[22] = (sal_uInt8)aInfoHeader2.nHeight;
    1448           0 :         m_pImageData[23] = (sal_uInt8)(aInfoHeader2.nHeight >> 8);
    1449           0 :         m_pImageData[24] = (sal_uInt8)(aInfoHeader2.nHeight >> 16);
    1450           0 :         m_pImageData[25] = (sal_uInt8)(aInfoHeader2.nHeight >> 24);
    1451           0 :         m_pImageData[26] = (sal_uInt8)aInfoHeader2.nPlanes;
    1452           0 :         m_pImageData[27] = (sal_uInt8)(aInfoHeader2.nPlanes >> 8);
    1453           0 :         m_pImageData[28] = (sal_uInt8)aInfoHeader2.nBitCount;
    1454           0 :         m_pImageData[29] = (sal_uInt8)(aInfoHeader2.nBitCount >> 8);
    1455             : 
    1456           0 :         nDIBRemaining = m_aBmpRec.nFileSize - 30;
    1457           0 :         pPicData += 30*sizeof(sal_uInt8);
    1458             :     }
    1459             : 
    1460           0 :     m_pStream->Read(pPicData, nDIBRemaining);
    1461           0 : }
    1462             : 
    1463           0 : OUString LwpDrawBitmap::RegisterStyle()
    1464             : {
    1465           0 :     XFImageStyle* pBmpStyle = new XFImageStyle();
    1466           0 :     pBmpStyle->SetYPosType(enumXFFrameYPosFromTop, enumXFFrameYRelFrame);
    1467           0 :     pBmpStyle->SetXPosType(enumXFFrameXPosFromLeft, enumXFFrameXRelFrame);
    1468             : 
    1469           0 :     XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
    1470           0 :     return pXFStyleManager->AddStyle(pBmpStyle)->GetStyleName();
    1471             : }
    1472             : 
    1473           0 : XFFrame* LwpDrawBitmap::CreateDrawObj(const OUString& rStyleName)
    1474             : {
    1475           0 :     XFImage* pImage = new XFImage();
    1476           0 :     pImage->SetImageData(m_pImageData, m_aBmpRec.nFileSize);
    1477           0 :     this->SetPosition(pImage);
    1478             : 
    1479           0 :     pImage->SetStyleName(rStyleName);
    1480             : 
    1481           0 :     return pImage;
    1482             : }
    1483             : 
    1484           0 : XFFrame* LwpDrawBitmap::CreateStandardDrawObj(const  OUString& rStyleName)
    1485             : {
    1486           0 :     return this->CreateDrawObj(rStyleName);
    1487             : }
    1488             : 
    1489             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10