LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter/xfilter - xfframestyle.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 116 0.0 %
Date: 2014-04-14 Functions: 0 9 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             :  * Frame style include position,size,rotation and so on.
      59             :  ************************************************************************/
      60             : #include "xfframestyle.hxx"
      61             : #include "xfcolumns.hxx"
      62             : #include "xfborders.hxx"
      63             : #include "xfshadow.hxx"
      64             : #include "xfbgimage.hxx"
      65             : 
      66           0 : XFFrameStyle::XFFrameStyle()
      67             : {
      68           0 :     m_eWrap = enumXFWrapNone;
      69           0 :     m_nWrapLines = 0;   //not limited.
      70           0 :     m_pBorders = NULL;
      71           0 :     m_pColumns = NULL;
      72           0 :     m_pShadow = NULL;
      73           0 :     m_pBGImage = NULL;
      74             : 
      75           0 :     m_bProtectContent = sal_False;
      76           0 :     m_bProtectSize = sal_False;
      77           0 :     m_bProtectPos = sal_False;
      78           0 :     m_bEditable = sal_False;
      79           0 :     m_bPrintable = sal_True;
      80           0 :     m_bBackground = sal_False;
      81           0 :     m_nTransparency = 0;
      82             : 
      83           0 :     m_eTextDir = enumXFTextDirNone;
      84           0 :     m_eXPos = enumXFFrameXPosCenter;
      85           0 :     m_eXRel = enumXFFrameXRelParaContent;
      86           0 :     m_eYPos = enumXFFrameYPosTop;
      87           0 :     m_eYRel = enumXFFrameYRelPage;
      88           0 : }
      89             : 
      90           0 : XFFrameStyle::~XFFrameStyle()
      91             : {
      92           0 :     if( m_pBorders )
      93           0 :         delete m_pBorders;
      94           0 :     if( m_pColumns )
      95           0 :         delete m_pColumns;
      96           0 :     if( m_pShadow )
      97           0 :         delete m_pShadow;
      98           0 :     if( m_pBGImage )
      99           0 :         delete m_pBGImage;
     100           0 : }
     101             : 
     102           0 : void    XFFrameStyle::SetBorders(XFBorders *pBorders)
     103             : {
     104           0 :     if( m_pBorders )
     105           0 :         delete m_pBorders;
     106           0 :     m_pBorders = pBorders;
     107           0 : }
     108             : 
     109           0 : void    XFFrameStyle::SetColumns(XFColumns *pColumns)
     110             : {
     111           0 :     if( m_pColumns )
     112           0 :         delete m_pColumns;
     113           0 :     m_pColumns = pColumns;
     114           0 : }
     115             : 
     116           0 : void    XFFrameStyle::SetShadow(XFShadow *pShadow)
     117             : {
     118           0 :     if( m_pShadow )
     119           0 :         delete m_pShadow;
     120           0 :     m_pShadow = pShadow;
     121           0 : }
     122             : 
     123           0 : void    XFFrameStyle::SetBackImage(XFBGImage *image)
     124             : {
     125           0 :     if( m_pBGImage )
     126           0 :         delete m_pBGImage;
     127           0 :     m_pBGImage = image;
     128           0 : }
     129             : 
     130           0 : enumXFStyle XFFrameStyle::GetStyleFamily()
     131             : {
     132           0 :     return enumXFStyleGraphics;
     133             : }
     134             : 
     135           0 : void    XFFrameStyle::ToXml(IXFStream *pStrm)
     136             : {
     137           0 :     IXFAttrList *pAttrList = pStrm->GetAttrList();
     138             : 
     139           0 :     pAttrList->Clear();
     140           0 :     pAttrList->AddAttribute( "style:name", GetStyleName() );
     141           0 :     if( GetParentStyleName().getLength() > 0 )
     142           0 :         pAttrList->AddAttribute("style:parent-style-name",GetParentStyleName());
     143           0 :     pAttrList->AddAttribute( "style:family", "graphics" );
     144             :     //parent style name ignore now.
     145           0 :     pStrm->StartElement( "style:style" );
     146             : 
     147           0 :     m_aMargins.ToXml(pStrm);
     148             : 
     149           0 :     pAttrList->Clear();
     150             : 
     151             :     /*if( m_eWrap == enumXFWrapBackground )
     152             :     {
     153             :         pAttrList->AddAttribute( "style:run-through", "background" );
     154             :     }
     155             :     else
     156             :     {*/
     157           0 :     if( m_bBackground)
     158           0 :         pAttrList->AddAttribute( "style:run-through", "background" );
     159             :     else
     160           0 :         pAttrList->AddAttribute( "style:run-through", "foreground" );
     161             : 
     162           0 :     if( m_eWrap == enumXFWrapNone )
     163           0 :         pAttrList->AddAttribute( "style:wrap", "none" );
     164           0 :     else if( m_eWrap == enumXFWrapLeft )
     165           0 :         pAttrList->AddAttribute( "style:wrap", "left" );
     166           0 :     else if( m_eWrap == enumXFWrapRight )
     167           0 :         pAttrList->AddAttribute( "style:wrap", "right" );
     168           0 :     else if( m_eWrap == enumXFWrapParallel )
     169           0 :         pAttrList->AddAttribute( "style:wrap", "parallel" );
     170           0 :     else if( m_eWrap == enumXFWrapRunThrough )
     171           0 :         pAttrList->AddAttribute( "style:wrap", "run-through" );
     172           0 :     else if( m_eWrap == enumXFWrapBest )
     173           0 :         pAttrList->AddAttribute( "style:wrap", "dynamic" );
     174             :     //}
     175             :     //background
     176           0 :     if( m_aBackColor.IsValid() )
     177             :     {
     178           0 :         pAttrList->AddAttribute( "fo:background-color", m_aBackColor.ToString() );
     179           0 :         pAttrList->AddAttribute( "style:background-transparency", OUString::number((sal_Int32)m_nTransparency) + "%");
     180             :     }
     181             : 
     182             :     //pad
     183           0 :     m_aPad.ToXml(pStrm);
     184             :     //margin:
     185           0 :     m_aMargins.ToXml(pStrm);
     186             :     //border
     187           0 :     if( m_pBorders )
     188           0 :         m_pBorders->ToXml(pStrm);
     189             :     else
     190           0 :         pAttrList->AddAttribute( "fo:border", "none" );
     191             :     //shadow
     192           0 :     if( m_pShadow )
     193           0 :         m_pShadow->ToXml(pStrm);
     194             :     //print
     195           0 :     if( m_bPrintable )
     196           0 :         pAttrList->AddAttribute( "style:print-content", "true" );
     197             :     //text directory
     198           0 :     if( m_eTextDir != enumXFTextDirNone )
     199           0 :         pAttrList->AddAttribute( "style:writing-mode", GetTextDirName(m_eTextDir) );
     200             :     //protect:
     201           0 :     if( m_bProtectContent || m_bProtectSize || m_bProtectPos )
     202             :     {
     203           0 :         OUString protect;
     204           0 :         if( m_bProtectContent )
     205           0 :             protect += "content";
     206           0 :         if( m_bProtectSize )
     207             :         {
     208           0 :             if( protect.getLength()>0 )
     209           0 :                 protect += " ";
     210           0 :             protect += "size";
     211             :         }
     212           0 :         if( m_bProtectPos )
     213             :         {
     214           0 :             if( protect.getLength()>0 )
     215           0 :                 protect += " ";
     216           0 :             protect += "position";
     217             :         }
     218           0 :         pAttrList->AddAttribute( "style:protect", protect );
     219             :     }
     220             :     //vertical pos and horizon pos:
     221           0 :     pAttrList->AddAttribute( "style:vertical-pos", GetFrameYPos(m_eYPos) );
     222           0 :     pAttrList->AddAttribute( "style:vertical-rel", GetFrameYRel(m_eYRel) );
     223           0 :     pAttrList->AddAttribute( "style:horizontal-pos", GetFrameXPos(m_eXPos) );
     224           0 :     pAttrList->AddAttribute( "style:horizontal-rel", GetFrameXRel(m_eXRel) );
     225             : 
     226           0 :     pStrm->StartElement( "style:properties" );
     227           0 :     if( m_pColumns )
     228           0 :         m_pColumns->ToXml(pStrm);
     229           0 :     if( m_pBGImage )
     230           0 :         m_pBGImage->ToXml(pStrm);
     231           0 :     pStrm->EndElement( "style:properties" );
     232             : 
     233           0 :     pStrm->EndElement( "style:style" );
     234           0 : }
     235             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10