LCOV - code coverage report
Current view: top level - lotuswordpro/source/filter - lwpnotes.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 118 0.0 %
Date: 2012-08-25 Functions: 0 30 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 84 0.0 %

           Branch data     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 :     LwpObject* pLayout = m_Layout.obj();
      89         [ #  # ]:          0 :     if(pLayout)
      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                 :            :     }
      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());
     105         [ #  # ]:          0 :     if(pLayout)
     106                 :            :     {
     107 [ #  # ][ #  # ]:          0 :         XFAnnotation* pXFNote = new XFAnnotation;
     108         [ #  # ]:          0 :         pXFNote->SetAuthor(pLayout->GetAuthor());
     109                 :            :         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                 :            : 
     133                 :          0 : LwpNoteLayout::LwpNoteLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     134         [ #  # ]:          0 :     : LwpFrameLayout(objHdr, pStrm)
     135                 :            : {
     136                 :            : 
     137                 :          0 : }
     138                 :            : 
     139         [ #  # ]:          0 : LwpNoteLayout::~LwpNoteLayout()
     140                 :            : {
     141                 :            : 
     142         [ #  # ]:          0 : }
     143                 :            : 
     144                 :            : /**
     145                 :            :  * @descr read note layout object
     146                 :            :  *
     147                 :            :  */
     148                 :          0 : void LwpNoteLayout::Read()
     149                 :            : {
     150         [ #  # ]:          0 :     LwpFrameLayout::Read();
     151                 :            : 
     152         [ #  # ]:          0 :     m_nTime = m_pObjStrm->QuickReaduInt32();
     153         [ #  # ]:          0 :     m_UserName.Read(m_pObjStrm);
     154                 :            : 
     155         [ #  # ]:          0 :     LwpAtomHolder aUserInitials;
     156         [ #  # ]:          0 :     aUserInitials.Read(m_pObjStrm);
     157                 :            : 
     158                 :          0 :     LwpColor aColor;
     159         [ #  # ]:          0 :     aColor.Read(m_pObjStrm);
     160                 :            : 
     161                 :            :     // vacant note sequence
     162         [ #  # ]:          0 :     m_pObjStrm->QuickReadInt32();
     163                 :            : 
     164 [ #  # ][ #  # ]:          0 :     m_pObjStrm->SkipExtra();
     165                 :          0 : }
     166                 :            : 
     167                 :            : /**
     168                 :            :  * @descr  Register style
     169                 :            :  */
     170                 :          0 : void LwpNoteLayout::RegisterStyle()
     171                 :            : {
     172                 :          0 :     LwpVirtualLayout* pTextLayout = GetTextLayout();
     173         [ #  # ]:          0 :     if(pTextLayout)
     174                 :            :     {
     175                 :          0 :         pTextLayout->SetFoundry(GetFoundry());
     176                 :          0 :         pTextLayout->RegisterStyle();
     177                 :            :     }
     178                 :          0 : }
     179                 :            : 
     180                 :            : /**
     181                 :            :  * @descr  convert note
     182                 :            :  */
     183                 :          0 : void LwpNoteLayout::XFConvert(XFContentContainer * pCont)
     184                 :            : {
     185                 :          0 :     LwpVirtualLayout* pTextLayout = GetTextLayout();
     186         [ #  # ]:          0 :     if(pTextLayout)
     187                 :            :     {
     188                 :          0 :         pTextLayout->XFConvert(pCont);
     189                 :            :     }
     190                 :          0 : }
     191                 :            : 
     192                 :            : /**
     193                 :            :  * @descr  Get layout that contains note text.
     194                 :            :  */
     195                 :          0 : LwpVirtualLayout* LwpNoteLayout::GetTextLayout()
     196                 :            : {
     197                 :          0 :     LwpVirtualLayout* pLayout = FindChildByType(LWP_VIEWPORT_LAYOUT);
     198         [ #  # ]:          0 :     if(pLayout)
     199                 :            :     {
     200                 :          0 :         return pLayout->FindChildByType(LWP_NOTETEXT_LAYOUT);
     201                 :            :     }
     202                 :            : 
     203                 :          0 :     return NULL;
     204                 :            : }
     205                 :            : /**
     206                 :            :  * @descr  Get author.
     207                 :            :  */
     208                 :          0 : OUString LwpNoteLayout::GetAuthor()
     209                 :            : {
     210         [ #  # ]:          0 :     if(m_UserName.HasValue())
     211                 :            :     {
     212         [ #  # ]:          0 :         if(m_UserName.str() != A2OUSTR(" "))
     213                 :            :         {
     214                 :          0 :             return m_UserName.str();
     215                 :            :         }
     216                 :            :     }
     217                 :            :     //if username is null or writerspace, get username from noteheaderlayout
     218                 :          0 :     LwpNoteHeaderLayout* pTextLayout = static_cast<LwpNoteHeaderLayout*>(FindChildByType(LWP_NOTEHEADER_LAYOUT));
     219         [ #  # ]:          0 :     if(pTextLayout)
     220                 :            :     {
     221                 :          0 :         LwpStory* pStory = static_cast<LwpStory*>(pTextLayout->GetContent()->obj());
     222         [ #  # ]:          0 :         if(pStory)
     223                 :            :         {
     224                 :          0 :             LwpPara* pFirst = static_cast<LwpPara*>(pStory->GetFirstPara()->obj());
     225         [ #  # ]:          0 :             if(pFirst)
     226                 :          0 :                 return pFirst->GetContentText(sal_True);
     227                 :            :         }
     228                 :            :     }
     229                 :            : 
     230                 :          0 :     return m_UserName.str();
     231                 :            : }
     232                 :            : 
     233                 :          0 : LwpNoteHeaderLayout::LwpNoteHeaderLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     234                 :          0 :     : LwpFrameLayout(objHdr, pStrm)
     235                 :            : {
     236                 :          0 : }
     237                 :            : 
     238                 :          0 : LwpNoteHeaderLayout::~LwpNoteHeaderLayout()
     239                 :            : {
     240         [ #  # ]:          0 : }
     241                 :            : 
     242                 :            : /**
     243                 :            :  * @descr read note layout object
     244                 :            :  *
     245                 :            :  */
     246                 :          0 : void LwpNoteHeaderLayout::Read()
     247                 :            : {
     248                 :          0 :     LwpFrameLayout::Read();
     249                 :          0 :     m_pObjStrm->SkipExtra();
     250                 :          0 : }
     251                 :            : 
     252                 :          0 : void LwpNoteHeaderLayout::RegisterStyle()
     253                 :            : {
     254                 :          0 : }
     255                 :            : 
     256                 :          0 : void LwpNoteHeaderLayout::XFConvert(XFContentContainer * /*pCont*/)
     257                 :            : {
     258                 :          0 : }
     259                 :            : 
     260                 :          0 : LwpNoteTextLayout::LwpNoteTextLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     261                 :          0 :     : LwpFrameLayout(objHdr, pStrm)
     262                 :            : {
     263                 :          0 : }
     264                 :            : 
     265                 :          0 : LwpNoteTextLayout::~LwpNoteTextLayout()
     266                 :            : {
     267         [ #  # ]:          0 : }
     268                 :            : 
     269                 :            : /**
     270                 :            :  * @descr read note layout object
     271                 :            :  *
     272                 :            :  */
     273                 :          0 : void LwpNoteTextLayout::Read()
     274                 :            : {
     275                 :          0 :     LwpFrameLayout::Read();
     276                 :          0 :     m_pObjStrm->SkipExtra();
     277                 :          0 : }
     278                 :            : 
     279                 :            : /**
     280                 :            :  * @descr  Register style, SODC doesn't support text style in note
     281                 :            :  */
     282                 :          0 : void LwpNoteTextLayout::RegisterStyle()
     283                 :            : {
     284                 :          0 :     LwpObject* pContent = m_Content.obj();
     285         [ #  # ]:          0 :     if(pContent)
     286                 :            :     {
     287                 :          0 :         pContent->SetFoundry(GetFoundry());
     288                 :          0 :         pContent->RegisterStyle();
     289                 :            :     }
     290                 :          0 : }
     291                 :            : 
     292                 :          0 : void LwpNoteTextLayout::XFConvert(XFContentContainer * pCont)
     293                 :            : {
     294                 :          0 :     LwpObject* pContent = m_Content.obj();
     295         [ #  # ]:          0 :     if(pContent)
     296                 :            :     {
     297                 :          0 :         pContent->XFConvert(pCont);
     298                 :            :     }
     299                 :          0 : }
     300                 :            : 
     301                 :            : 
     302                 :          0 : LwpViewportLayout::LwpViewportLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm)
     303                 :          0 :     : LwpPlacableLayout(objHdr, pStrm)
     304                 :            : {
     305                 :          0 : }
     306                 :            : 
     307                 :          0 : LwpViewportLayout::~LwpViewportLayout()
     308                 :            : {
     309         [ #  # ]:          0 : }
     310                 :            : 
     311                 :            : /**
     312                 :            :  * @descr read note layout object
     313                 :            :  *
     314                 :            :  */
     315                 :          0 : void LwpViewportLayout::Read()
     316                 :            : {
     317                 :          0 :     LwpPlacableLayout::Read();
     318                 :          0 :     m_pObjStrm->SkipExtra();
     319                 :          0 : }
     320                 :            : 
     321                 :          0 : void LwpViewportLayout::RegisterStyle()
     322                 :            : {
     323                 :          0 : }
     324                 :            : 
     325                 :          0 : void LwpViewportLayout::XFConvert(XFContentContainer * /*pCont*/)
     326                 :            : {
     327                 :          0 : }
     328                 :            : 
     329                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10