LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpnotes.cxx (source / functions) Hit Total Coverage
Test: commit 10e77ab3ff6f4314137acd6e2702a6e5c1ce1fae Lines: 0 122 0.0 %
Date: 2014-11-03 Functions: 0 30 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             :  *  For LWP filter architecture prototype - notes
      59             :  */
      60             : /*************************************************************************
      61             :  * Change History
      62             :  May 2005       Created
      63             :  ************************************************************************/
      64             : #include "lwpnotes.hxx"
      65             : #include "lwppara.hxx"
      66             : #include "xfilter/xfannotation.hxx"
      67             : #include "xfilter/xftextspan.hxx"
      68             : #include "localtime.hxx"
      69             : #include "lwptools.hxx"
      70             : 
      71           0 :  LwpFribNote::LwpFribNote(LwpPara* pPara ):LwpFrib(pPara)
      72             : {
      73           0 : }
      74             : 
      75             : /**
      76             :  * @descr  read  frib information
      77             :  */
      78           0 : void LwpFribNote::Read(LwpObjectStream *pObjStrm, sal_uInt16 /*len*/)
      79             : {
      80           0 :     m_Layout.ReadIndexed(pObjStrm);
      81           0 : }
      82             : 
      83             : /**
      84             :  * @descr  Register style
      85             :  */
      86           0 : void LwpFribNote::RegisterNewStyle()
      87             : {
      88           0 :     rtl::Reference<LwpObject> pLayout = m_Layout.obj();
      89           0 :     if(pLayout.is())
      90             :     {
      91             :         //register font style
      92           0 :         LwpFrib::RegisterStyle(m_pPara->GetFoundry());
      93             :         //register foonote style
      94           0 :         pLayout->SetFoundry(m_pPara->GetFoundry());
      95           0 :         pLayout->RegisterStyle();
      96           0 :     }
      97           0 : }
      98             : 
      99             : /**
     100             :  * @descr  convert note
     101             :  */
     102           0 : void LwpFribNote::XFConvert(XFContentContainer* pCont)
     103             : {
     104           0 :     LwpNoteLayout* pLayout =static_cast<LwpNoteLayout*>(m_Layout.obj().get());
     105           0 :     if(pLayout)
     106             :     {
     107           0 :         XFAnnotation* pXFNote = new XFAnnotation;
     108           0 :         pXFNote->SetAuthor(pLayout->GetAuthor());
     109           0 :         LtTm aTm;
     110           0 :         long nTime = pLayout->GetTime();
     111           0 :         if(LtgLocalTime(nTime, aTm))
     112             :         {
     113           0 :             pXFNote->SetDate(LwpTools::DateTimeToOUString(aTm));
     114             :         }
     115             : 
     116           0 :         pLayout->XFConvert(pXFNote);
     117           0 :         if(m_pModifiers)
     118             :         {
     119           0 :             XFTextSpan *pSpan = new XFTextSpan();
     120           0 :             pSpan->SetStyleName(GetStyleName());
     121           0 :             pSpan->Add(pXFNote);
     122           0 :             pCont->Add(pSpan);
     123             :         }
     124             :         else
     125             :         {
     126           0 :             pCont->Add(pXFNote);
     127             :         }
     128             :     }
     129             : 
     130           0 : }
     131             : 
     132           0 : LwpNoteLayout::LwpNoteLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     133             :     : LwpFrameLayout(objHdr, pStrm)
     134           0 :     , m_nTime(0)
     135             : {
     136           0 : }
     137             : 
     138           0 : LwpNoteLayout::~LwpNoteLayout()
     139             : {
     140             : 
     141           0 : }
     142             : 
     143             : /**
     144             :  * @descr read note layout object
     145             :  *
     146             :  */
     147           0 : void LwpNoteLayout::Read()
     148             : {
     149           0 :     LwpFrameLayout::Read();
     150             : 
     151           0 :     m_nTime = m_pObjStrm->QuickReaduInt32();
     152           0 :     m_UserName.Read(m_pObjStrm);
     153             : 
     154           0 :     LwpAtomHolder aUserInitials;
     155           0 :     aUserInitials.Read(m_pObjStrm);
     156             : 
     157           0 :     LwpColor aColor;
     158           0 :     aColor.Read(m_pObjStrm);
     159             : 
     160             :     // vacant note sequence
     161           0 :     m_pObjStrm->QuickReadInt32();
     162             : 
     163           0 :     m_pObjStrm->SkipExtra();
     164           0 : }
     165             : 
     166             : /**
     167             :  * @descr  Register style
     168             :  */
     169           0 : void LwpNoteLayout::RegisterStyle()
     170             : {
     171           0 :     LwpVirtualLayout* pTextLayout = GetTextLayout();
     172           0 :     if(pTextLayout)
     173             :     {
     174           0 :         pTextLayout->SetFoundry(GetFoundry());
     175           0 :         pTextLayout->RegisterStyle();
     176             :     }
     177           0 : }
     178             : 
     179             : /**
     180             :  * @descr  convert note
     181             :  */
     182           0 : void LwpNoteLayout::XFConvert(XFContentContainer * pCont)
     183             : {
     184           0 :     LwpVirtualLayout* pTextLayout = GetTextLayout();
     185           0 :     if(pTextLayout)
     186             :     {
     187           0 :         pTextLayout->XFConvert(pCont);
     188             :     }
     189           0 : }
     190             : 
     191             : /**
     192             :  * @descr  Get layout that contains note text.
     193             :  */
     194           0 : LwpVirtualLayout* LwpNoteLayout::GetTextLayout()
     195             : {
     196           0 :     LwpVirtualLayout* pLayout = FindChildByType(LWP_VIEWPORT_LAYOUT);
     197           0 :     if(pLayout)
     198             :     {
     199           0 :         return pLayout->FindChildByType(LWP_NOTETEXT_LAYOUT);
     200             :     }
     201             : 
     202           0 :     return NULL;
     203             : }
     204             : /**
     205             :  * @descr  Get author.
     206             :  */
     207           0 : OUString LwpNoteLayout::GetAuthor()
     208             : {
     209           0 :     if(m_UserName.HasValue())
     210             :     {
     211           0 :         if(m_UserName.str() != OUString(" "))
     212             :         {
     213           0 :             return m_UserName.str();
     214             :         }
     215             :     }
     216             :     //if username is null or writerspace, get username from noteheaderlayout
     217           0 :     LwpNoteHeaderLayout* pTextLayout = static_cast<LwpNoteHeaderLayout*>(FindChildByType(LWP_NOTEHEADER_LAYOUT));
     218           0 :     if(pTextLayout)
     219             :     {
     220           0 :         LwpStory* pStory = static_cast<LwpStory*>(pTextLayout->GetContent().obj().get());
     221           0 :         if(pStory)
     222             :         {
     223           0 :             LwpPara* pFirst = static_cast<LwpPara*>(pStory->GetFirstPara().obj().get());
     224           0 :             if(pFirst)
     225           0 :                 return pFirst->GetContentText(true);
     226             :         }
     227             :     }
     228             : 
     229           0 :     return m_UserName.str();
     230             : }
     231             : 
     232           0 : LwpNoteHeaderLayout::LwpNoteHeaderLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     233           0 :     : LwpFrameLayout(objHdr, pStrm)
     234             : {
     235           0 : }
     236             : 
     237           0 : LwpNoteHeaderLayout::~LwpNoteHeaderLayout()
     238             : {
     239           0 : }
     240             : 
     241             : /**
     242             :  * @descr read note layout object
     243             :  *
     244             :  */
     245           0 : void LwpNoteHeaderLayout::Read()
     246             : {
     247           0 :     LwpFrameLayout::Read();
     248           0 :     m_pObjStrm->SkipExtra();
     249           0 : }
     250             : 
     251           0 : void LwpNoteHeaderLayout::RegisterStyle()
     252             : {
     253           0 : }
     254             : 
     255           0 : void LwpNoteHeaderLayout::XFConvert(XFContentContainer * /*pCont*/)
     256             : {
     257           0 : }
     258             : 
     259           0 : LwpNoteTextLayout::LwpNoteTextLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     260           0 :     : LwpFrameLayout(objHdr, pStrm)
     261             : {
     262           0 : }
     263             : 
     264           0 : LwpNoteTextLayout::~LwpNoteTextLayout()
     265             : {
     266           0 : }
     267             : 
     268             : /**
     269             :  * @descr read note layout object
     270             :  *
     271             :  */
     272           0 : void LwpNoteTextLayout::Read()
     273             : {
     274           0 :     LwpFrameLayout::Read();
     275           0 :     m_pObjStrm->SkipExtra();
     276           0 : }
     277             : 
     278             : /**
     279             :  * @descr  Register style, SODC doesn't support text style in note
     280             :  */
     281           0 : void LwpNoteTextLayout::RegisterStyle()
     282             : {
     283           0 :     rtl::Reference<LwpObject> pContent = m_Content.obj();
     284           0 :     if(pContent.is())
     285             :     {
     286           0 :         pContent->SetFoundry(GetFoundry());
     287           0 :         pContent->RegisterStyle();
     288           0 :     }
     289           0 : }
     290             : 
     291           0 : void LwpNoteTextLayout::XFConvert(XFContentContainer * pCont)
     292             : {
     293           0 :     rtl::Reference<LwpObject> pContent = m_Content.obj();
     294           0 :     if(pContent.is())
     295             :     {
     296           0 :         pContent->XFConvert(pCont);
     297           0 :     }
     298           0 : }
     299             : 
     300           0 : LwpViewportLayout::LwpViewportLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     301           0 :     : LwpPlacableLayout(objHdr, pStrm)
     302             : {
     303           0 : }
     304             : 
     305           0 : LwpViewportLayout::~LwpViewportLayout()
     306             : {
     307           0 : }
     308             : 
     309             : /**
     310             :  * @descr read note layout object
     311             :  *
     312             :  */
     313           0 : void LwpViewportLayout::Read()
     314             : {
     315           0 :     LwpPlacableLayout::Read();
     316           0 :     m_pObjStrm->SkipExtra();
     317           0 : }
     318             : 
     319           0 : void LwpViewportLayout::RegisterStyle()
     320             : {
     321           0 : }
     322             : 
     323           0 : void LwpViewportLayout::XFConvert(XFContentContainer * /*pCont*/)
     324             : {
     325           0 : }
     326             : 
     327             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10