LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpfribframe.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 46 89 51.7 %
Date: 2015-06-13 12:38:46 Functions: 5 9 55.6 %
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             :  *  For LWP filter architecture prototype - footnote
      59             :  */
      60             : /*************************************************************************
      61             :  * Change History
      62             :  Mar 2005       Created
      63             :  ************************************************************************/
      64             : #include "lwpfribframe.hxx"
      65             : #include "xfilter/xfstylemanager.hxx"
      66             : #include "lwpglobalmgr.hxx"
      67             : #include "xfilter/xfchange.hxx"
      68             : /**
      69             :  * @short:   Read frame frib
      70             :  * @param:
      71             :  * @param:
      72             :  */
      73             : 
      74          26 : void LwpFribFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
      75             : {
      76          26 :     m_objLayout.ReadIndexed(pObjStrm);
      77          26 : }
      78             : 
      79             : /**
      80             : *  @descr:  Get the layout object which the frib points to
      81             : *
      82             : */
      83          26 : rtl::Reference<LwpObject> LwpFribFrame::GetLayout()
      84             : {
      85          26 :     return m_objLayout.obj();
      86             : }
      87             : 
      88             : /**
      89             : *  @descr:  register frame style
      90             : *  @param:   pFoundry - current foundry pointer
      91             : *
      92             : */
      93          26 : void LwpFribFrame::RegisterStyle(LwpFoundry* pFoundry)
      94             : {
      95          26 :     rtl::Reference<LwpObject> pObject = m_objLayout.obj();
      96             : 
      97          26 :     if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
      98             :     {
      99           0 :         LwpDropcapLayout *pLayout = dynamic_cast<LwpDropcapLayout*>(pObject.get());
     100           0 :         if (!pLayout)
     101           0 :             return;
     102           0 :         pLayout->RegisterStyle(pFoundry);
     103             :     }
     104             :     else
     105             :     {
     106             :         //register frame style
     107          26 :         LwpPlacableLayout* pLayout = dynamic_cast<LwpPlacableLayout*>(pObject.get());
     108          26 :         if (!pLayout)
     109           0 :             return;
     110          26 :         pLayout->SetFoundry(pFoundry);
     111          26 :         pLayout->RegisterStyle();
     112             : 
     113             :         //register next frib text style
     114          25 :         sal_uInt8 nType = pLayout->GetRelativeType();
     115          25 :         if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
     116          25 :             && HasNextFrib())
     117             :         {
     118           2 :             XFParaStyle* pOldStyle = m_pPara->GetXFParaStyle();
     119           2 :             if (pOldStyle->GetMasterPage().isEmpty())
     120           2 :                 m_StyleName = pOldStyle->GetStyleName();
     121             :             else
     122             :             {
     123           0 :                 XFParaStyle* pParaStyle = new XFParaStyle;
     124           0 :                 *pParaStyle = *(pOldStyle);
     125           0 :                 XFStyleManager* pXFStyleManager = LwpGlobalMgr::GetInstance()->GetXFStyleManager();
     126           0 :                 m_StyleName = pXFStyleManager->AddStyle(pParaStyle).m_pStyle->GetStyleName();
     127             :             }
     128             :         }
     129             :         //remember the current paragraph font size which will be used in parsing frame
     130          25 :         pLayout->SetFont(GetFont());
     131          26 :     }
     132             : }
     133          26 : void LwpFribFrame::SetParaDropcap(LwpPara* pPara)
     134             : {
     135          26 :     rtl::Reference<LwpObject> pObject = m_objLayout.obj();
     136             : 
     137          26 :     if (pObject.is() && pObject->GetTag() == VO_DROPCAPLAYOUT)
     138             :     {
     139           0 :         pPara->SetParaDropcap(true);
     140           0 :         pPara->SetDropcapLayout(dynamic_cast<LwpDropcapLayout*>(pObject.get()));
     141             :     }
     142             :     else
     143          26 :         pPara->SetParaDropcap(false);
     144          26 : }
     145             : 
     146             : /**
     147             : *  @descr:  convert frame
     148             : *
     149             : */
     150          13 : void LwpFribFrame::XFConvert(XFContentContainer* pCont)
     151             : {
     152          13 :     XFContentContainer* pXFContentContainer = pCont;
     153          13 :     LwpVirtualLayout* pLayout = dynamic_cast<LwpVirtualLayout*>(GetLayout().get());
     154          13 :     if (!pLayout)
     155          13 :         return;
     156          13 :     sal_uInt8 nType = pLayout->GetRelativeType();
     157          13 :     if( LwpLayoutRelativityGuts::LAY_PARA_RELATIVE == nType)
     158             :     {
     159           5 :         LwpVirtualLayout* pContainerLayout = pLayout->GetContainerLayout();
     160           5 :         if(pContainerLayout && pContainerLayout->IsFrame())
     161             :         {
     162             :             //same page as text and in frame
     163           0 :             pXFContentContainer = m_pPara->GetXFContainer();
     164             :         }
     165           5 :         else if(pContainerLayout && pContainerLayout->IsCell())
     166             :         {
     167             :             //same page as text and in cell, get the first xfpara
     168             :             rtl::Reference<XFContent> first(
     169           0 :                 pCont->FindFirstContent(enumXFContentPara));
     170           0 :             XFContentContainer* pXFFirtPara = static_cast<XFContentContainer*>(first.get());
     171           0 :             if(pXFFirtPara)
     172           0 :                 pXFContentContainer = pXFFirtPara;
     173             :         }
     174             :     }
     175          13 :     OUString sChangeID;
     176          13 :     if(m_bRevisionFlag)
     177             :     {
     178           0 :         LwpGlobalMgr* pGlobal = LwpGlobalMgr::GetInstance();
     179           0 :         LwpChangeMgr* pChangeMgr = pGlobal->GetLwpChangeMgr();
     180           0 :         sChangeID = pChangeMgr->GetChangeID(this);
     181           0 :         if (!sChangeID.isEmpty())
     182             :         {
     183           0 :             XFChangeStart* pChangeStart = new XFChangeStart;
     184           0 :             pChangeStart->SetChangeID(sChangeID);
     185           0 :             pXFContentContainer->Add(pChangeStart);
     186             :         }
     187             :     }
     188             : 
     189          13 :     pLayout->XFConvert(pXFContentContainer);
     190             : 
     191          13 :     if(m_bRevisionFlag)
     192             :     {
     193           0 :         if (!sChangeID.isEmpty())
     194             :         {
     195           0 :             XFChangeEnd* pChangeEnd = new XFChangeEnd;
     196           0 :             pChangeEnd->SetChangeID(sChangeID);
     197           0 :             pXFContentContainer->Add(pChangeEnd);
     198             :         }
     199             :     }
     200             : 
     201          13 :     if(LwpLayoutRelativityGuts::LAY_INLINE_NEWLINE == nType
     202          13 :         && HasNextFrib())
     203             :     {
     204           1 :         XFParagraph* pXFPara = new XFParagraph();
     205           1 :         pXFPara->SetStyleName(m_StyleName);
     206           1 :         m_pPara->AddXFContent(pXFPara);
     207           1 :         m_pPara->GetFribs().SetXFPara(pXFPara);
     208          13 :     }
     209             : 
     210             : }
     211             : 
     212             : /**
     213             :  *  @descr:  Read Ruby frame
     214             :  *
     215             :  */
     216           0 : void LwpFribRubyFrame::Read(LwpObjectStream* pObjStrm, sal_uInt16 /*len*/)
     217             : {
     218           0 :     m_objLayout.ReadIndexed(pObjStrm);
     219           0 : }
     220             : /**
     221             :  *  @descr:  Register Ruby frame style
     222             :  *
     223             :  */
     224           0 : void LwpFribRubyFrame::RegisterStyle(LwpFoundry* pFoundry)
     225             : {
     226           0 :     LwpRubyLayout* pLayout = GetLayout();
     227           0 :     if (pLayout)
     228             :     {
     229           0 :         pLayout->SetFoundry(pFoundry);
     230           0 :         pLayout->RegisterStyle();
     231             :     }
     232           0 : }
     233             : /**
     234             :  *  @descr:  convert Ruby frame
     235             :  *
     236             :  */
     237           0 : void LwpFribRubyFrame::XFConvert(XFContentContainer* /*pCont*/)
     238             : {
     239           0 :     LwpRubyLayout* pLayout = GetLayout();
     240           0 :     if (pLayout)
     241             :     {
     242           0 :         pLayout->ConvertContentText();
     243             :     }
     244           0 : }
     245             : 
     246           0 : LwpRubyLayout* LwpFribRubyFrame::GetLayout()
     247             : {
     248           0 :     return dynamic_cast<LwpRubyLayout*>(m_objLayout.obj().get());
     249             : }
     250             : 
     251             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11