LCOV - code coverage report
Current view: top level - idl/source/objects - basobj.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 194 312 62.2 %
Date: 2012-08-25 Functions: 35 74 47.3 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 107 332 32.2 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * This file is part of the LibreOffice project.
       4                 :            :  *
       5                 :            :  * This Source Code Form is subject to the terms of the Mozilla Public
       6                 :            :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7                 :            :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8                 :            :  *
       9                 :            :  * This file incorporates work covered by the following license notice:
      10                 :            :  *
      11                 :            :  *   Licensed to the Apache Software Foundation (ASF) under one or more
      12                 :            :  *   contributor license agreements. See the NOTICE file distributed
      13                 :            :  *   with this work for additional information regarding copyright
      14                 :            :  *   ownership. The ASF licenses this file to you under the Apache
      15                 :            :  *   License, Version 2.0 (the "License"); you may not use this file
      16                 :            :  *   except in compliance with the License. You may obtain a copy of
      17                 :            :  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
      18                 :            :  */
      19                 :            : 
      20                 :            : 
      21                 :            : #include <ctype.h>
      22                 :            : #include <stdio.h>
      23                 :            : 
      24                 :            : #include <tools/debug.hxx>
      25                 :            : 
      26                 :            : #include <basobj.hxx>
      27                 :            : #include <module.hxx>
      28                 :            : #include <globals.hxx>
      29                 :            : #include <database.hxx>
      30                 :            : 
      31 [ #  # ][ #  # ]:      68944 : SV_IMPL_META_FACTORY1( SvMetaObject, SvRttiBase )
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
                 [ -  + ]
      32                 :      59056 : SvMetaObject::SvMetaObject()
      33                 :            : {
      34                 :      59056 : }
      35                 :            : 
      36                 :          0 : void SvMetaObject::Load( SvPersistStream & )
      37                 :            : {
      38                 :          0 : }
      39                 :            : 
      40                 :      48606 : void SvMetaObject::Save( SvPersistStream & )
      41                 :            : {
      42                 :      48606 : }
      43                 :            : 
      44                 :     285992 : void SvMetaObject::WriteTab( SvStream & rOutStm, sal_uInt16 nTab )
      45                 :            : {
      46         [ +  + ]:     918180 :     while( nTab-- )
      47                 :     632188 :         rOutStm << "    ";
      48                 :     285992 : }
      49                 :            : 
      50                 :       1192 : void SvMetaObject::WriteStars( SvStream & rOutStm )
      51                 :            : {
      52                 :       1192 :     rOutStm << '/';
      53         [ +  + ]:       8344 :     for( int i = 6; i > 0; i-- )
      54                 :       7152 :         rOutStm << "**********";
      55                 :       1192 :     rOutStm << '/' << endl;
      56                 :       1192 : }
      57                 :            : 
      58                 :     118462 : sal_Bool SvMetaObject::TestAndSeekSpaceOnly( SvStream & rOutStm, sal_uLong nBegPos )
      59                 :            : {
      60                 :            :     // write no empty brackets
      61                 :     118462 :     sal_uLong nPos = rOutStm.Tell();
      62                 :     118462 :     rOutStm.Seek( nBegPos );
      63                 :     118462 :     sal_Bool bOnlySpace = sal_True;
      64 [ +  + ][ +  + ]:     567808 :     while( bOnlySpace && rOutStm.Tell() < nPos )
                 [ +  + ]
      65                 :            :     {
      66                 :            :         char c;
      67         [ +  - ]:     449346 :         rOutStm >> c;
      68         [ +  + ]:     449346 :         if( !isspace( c ) )
      69                 :     449346 :             bOnlySpace = sal_False;
      70                 :            :     }
      71         [ +  + ]:     118462 :     if( bOnlySpace )
      72                 :            :         // nothing written
      73                 :      69086 :         rOutStm.Seek( nBegPos );
      74                 :            :     else
      75                 :      49376 :         rOutStm.Seek( nPos );
      76                 :     118462 :     return bOnlySpace;
      77                 :            : }
      78                 :            : 
      79                 :        278 : void SvMetaObject::Back2Delemitter( SvStream & rOutStm )
      80                 :            : {
      81                 :            :     // write no empty brackets
      82                 :        278 :     sal_uLong nPos = rOutStm.Tell();
      83         [ +  - ]:        278 :     rOutStm.SeekRel( -1 );
      84                 :        278 :     char c = 0;
      85         [ +  - ]:        278 :     rOutStm >> c;
      86                 :            : 
      87 [ +  + ][ +  - ]:        556 :     while( isspace( c ) && rOutStm.Tell() != 1 )
                 [ +  + ]
      88                 :            :     {
      89         [ +  - ]:        278 :         rOutStm.SeekRel( -2 );
      90         [ +  - ]:        278 :         rOutStm >> c;
      91                 :            :     }
      92                 :            : 
      93 [ +  - ][ +  - ]:        278 :     if( c == ';' || c == ',' )
      94         [ +  - ]:        278 :         rOutStm.SeekRel( -1 );
      95                 :            :     else
      96         [ #  # ]:          0 :         rOutStm.Seek( nPos );
      97                 :        278 : }
      98                 :            : 
      99                 :          0 : sal_Bool SvMetaObject::ReadSvIdl( SvIdlDataBase &, SvTokenStream & )
     100                 :            : {
     101                 :          0 :     return sal_False;
     102                 :            : }
     103                 :            : 
     104                 :          0 : void SvMetaObject::WriteSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */ )
     105                 :            : {
     106                 :          0 : }
     107                 :            : 
     108                 :          0 : void SvMetaObject::Write( SvIdlDataBase &, SvStream &, sal_uInt16 /*nTab */,
     109                 :            :                              WriteType, WriteAttribute )
     110                 :            : {
     111                 :          0 : }
     112                 :            : 
     113 [ #  # ][ #  # ]:      68944 : SV_IMPL_META_FACTORY1( SvMetaName, SvMetaObject );
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
                 [ -  + ]
     114                 :      59056 : SvMetaName::SvMetaName()
     115                 :            : {
     116                 :      59056 : }
     117                 :            : 
     118                 :          0 : void SvMetaName::Load( SvPersistStream & rStm )
     119                 :            : {
     120                 :          0 :     SvMetaObject::Load( rStm );
     121                 :            :     sal_uInt8 nMask;
     122         [ #  # ]:          0 :     rStm >> nMask;
     123                 :            : 
     124         [ #  # ]:          0 :     if( nMask >= 0x20 )
     125                 :            :     {
     126         [ #  # ]:          0 :         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
     127                 :            :         OSL_FAIL( "wrong format" );
     128                 :          0 :         return;
     129                 :            :     }
     130 [ #  # ][ #  # ]:          0 :     if( nMask & 0x01 )  rStm >> aName;
     131 [ #  # ][ #  # ]:          0 :     if( nMask & 0x02 )  rStm >> aHelpContext;
     132 [ #  # ][ #  # ]:          0 :     if( nMask & 0x04 )  rStm >> aHelpText;
     133 [ #  # ][ #  # ]:          0 :     if( nMask & 0x08 )  rStm >> aConfigName;
     134 [ #  # ][ #  # ]:          0 :     if( nMask & 0x10 )  rStm >> aDescription;
     135                 :            : }
     136                 :            : 
     137                 :      48606 : void SvMetaName::Save( SvPersistStream & rStm )
     138                 :            : {
     139                 :      48606 :     SvMetaObject::Save( rStm );
     140                 :      48606 :     sal_uInt8 nMask = 0;
     141         [ +  + ]:      48606 :     if( aName.IsSet() )         nMask |= 0x01;
     142         [ -  + ]:      48606 :     if( aHelpContext.IsSet() )  nMask |= 0x02;
     143         [ +  + ]:      48606 :     if( aHelpText.IsSet() )     nMask |= 0x04;
     144         [ -  + ]:      48606 :     if( aConfigName.IsSet() )   nMask |= 0x08;
     145         [ -  + ]:      48606 :     if( aDescription.IsSet() )  nMask |= 0x10;
     146                 :            : 
     147                 :      48606 :     rStm << nMask;
     148         [ +  + ]:      48606 :     if( nMask & 0x01 ) rStm << aName;
     149         [ -  + ]:      48606 :     if( nMask & 0x02 ) rStm << aHelpContext;
     150         [ +  + ]:      48606 :     if( nMask & 0x04 ) rStm << aHelpText;
     151         [ -  + ]:      48606 :     if( nMask & 0x08 ) rStm << aConfigName;
     152         [ -  + ]:      48606 :     if( nMask & 0x10 ) rStm << aDescription;
     153                 :      48606 : }
     154                 :            : 
     155                 :      39930 : sal_Bool SvMetaName::SetName( const rtl::OString& rName, SvIdlDataBase * )
     156                 :            : {
     157                 :      39930 :     aName.setString(rName);
     158                 :      39930 :     return sal_True;
     159                 :            : }
     160                 :            : 
     161                 :      32506 : sal_Bool SvMetaName::ReadNameSvIdl( SvIdlDataBase & rBase,
     162                 :            :                                 SvTokenStream & rInStm )
     163                 :            : {
     164                 :      32506 :     sal_uInt32 nTokPos = rInStm.Tell();
     165                 :      32506 :     SvToken * pTok = rInStm.GetToken_Next();
     166                 :            : 
     167                 :            :     // read module name
     168         [ +  + ]:      32506 :     if( pTok->IsIdentifier() )
     169         [ +  - ]:      32096 :         if( SetName( pTok->GetString(), &rBase ) )
     170                 :      32096 :             return sal_True;
     171                 :            : 
     172                 :        410 :     rInStm.Seek( nTokPos );
     173                 :      32506 :     return sal_False;
     174                 :            : }
     175                 :            : 
     176                 :     320966 : void SvMetaName::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     177                 :            :                                       SvTokenStream & rInStm )
     178                 :            : {
     179                 :     320966 :     sal_uInt32 nTokPos = rInStm.Tell();
     180         [ -  + ]:     320966 :     if( aName.ReadSvIdl( SvHash_Name(), rInStm ) )
     181                 :            :     {
     182         [ #  # ]:          0 :         if( !SetName( aName.getString(), &rBase ) )
     183                 :          0 :             rInStm.Seek( nTokPos );
     184                 :            :     }
     185                 :     320966 :     aHelpContext.ReadSvIdl( rBase, SvHash_HelpContext(), rInStm );
     186                 :     320966 :     aHelpText.ReadSvIdl( rBase, rInStm );
     187                 :     320966 :     aConfigName.ReadSvIdl( SvHash_ConfigName(), rInStm );
     188                 :     320966 :     aDescription.ReadSvIdl( SvHash_Description(), rInStm );
     189                 :     320966 : }
     190                 :            : 
     191                 :      10184 : void SvMetaName::DoReadContextSvIdl( SvIdlDataBase & rBase,
     192                 :            :                                    SvTokenStream & rInStm, char cDel )
     193                 :            : {
     194                 :      10184 :     sal_uInt32 nBeginPos = 0; // can not happen with Tell
     195         [ +  + ]:      40776 :     while( nBeginPos != rInStm.Tell() )
     196                 :            :     {
     197                 :      30592 :         nBeginPos = rInStm.Tell();
     198                 :      30592 :         ReadContextSvIdl( rBase, rInStm );
     199         [ +  - ]:      30592 :         if( cDel == '\0' )
     200                 :      30592 :             rInStm.ReadDelemiter();
     201                 :            :         else
     202                 :          0 :             rInStm.Read( cDel );
     203                 :            :     }
     204                 :      10184 : }
     205                 :            : 
     206                 :          0 : void SvMetaName::ReadContextSvIdl( SvIdlDataBase &, SvTokenStream & )
     207                 :            : {
     208                 :          0 : }
     209                 :            : 
     210                 :          0 : sal_Bool SvMetaName::Test( SvIdlDataBase &, SvTokenStream & )
     211                 :            : {
     212                 :          0 :     return sal_True;
     213                 :            : }
     214                 :            : 
     215                 :      36058 : void SvMetaName::WriteContextSvIdl( SvIdlDataBase &, SvStream &, sal_uInt16 )
     216                 :            : {
     217                 :      36058 : }
     218                 :            : 
     219                 :          0 : void SvMetaName::WriteDescription( SvStream & rOutStm )
     220                 :            : {
     221 [ #  # ][ #  # ]:          0 :     rOutStm << "<DESCRIPTION>" << endl;
     222                 :            : 
     223         [ #  # ]:          0 :     rtl::OString aDesc( GetDescription().getString() );
     224                 :          0 :     sal_Int32 nPos = aDesc.indexOf('\n');
     225         [ #  # ]:          0 :     while ( nPos != -1 )
     226                 :            :     {
     227 [ #  # ][ #  # ]:          0 :         rOutStm << aDesc.copy( 0, nPos ).getStr() << endl;
     228                 :          0 :         aDesc = aDesc.copy(nPos+1);
     229                 :          0 :         nPos = aDesc.indexOf('\n');
     230                 :            :     }
     231                 :            : 
     232 [ #  # ][ #  # ]:          0 :     rOutStm << aDesc.getStr() << endl << "</DESCRIPTION>" << endl;
         [ #  # ][ #  # ]
     233                 :          0 : }
     234                 :            : 
     235                 :      39758 : void SvMetaName::WriteAttributesSvIdl( SvIdlDataBase & rBase,
     236                 :            :                                        SvStream & rOutStm,
     237                 :            :                                        sal_uInt16 nTab )
     238                 :            : {
     239 [ +  - ][ +  + ]:      39758 :     if( aHelpContext.IsSet() || aHelpText.IsSet() || aConfigName.IsSet() )
         [ -  + ][ +  + ]
     240                 :            :     {
     241                 :         16 :         WriteTab( rOutStm, nTab );
     242                 :         16 :         rOutStm << "// class SvMetaName" << endl;
     243                 :            :     }
     244         [ -  + ]:      39758 :     if( aHelpContext.IsSet() )
     245                 :            :     {
     246                 :          0 :         WriteTab( rOutStm, nTab );
     247                 :          0 :         aHelpContext.WriteSvIdl( SvHash_HelpContext(), rOutStm, nTab );
     248                 :          0 :         rOutStm << ';' << endl;
     249                 :            :     }
     250         [ +  + ]:      39758 :     if( aHelpText.IsSet() )
     251                 :            :     {
     252                 :         16 :         WriteTab( rOutStm, nTab );
     253                 :         16 :         aHelpText.WriteSvIdl( rBase, rOutStm, nTab );
     254                 :         16 :         rOutStm << ';' << endl;
     255                 :            :     }
     256         [ -  + ]:      39758 :     if( aConfigName.IsSet() )
     257                 :            :     {
     258                 :          0 :         WriteTab( rOutStm, nTab );
     259                 :          0 :         aConfigName.WriteSvIdl( SvHash_ConfigName(), rOutStm, nTab );
     260                 :          0 :         rOutStm << ';' << endl;
     261                 :            :     }
     262                 :      39758 : }
     263                 :            : 
     264                 :      36792 : sal_Bool SvMetaName::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     265                 :            : {
     266                 :      36792 :     sal_uInt32 nTokPos = rInStm.Tell();
     267                 :      36792 :     sal_Bool bOk = sal_True;
     268         [ +  + ]:      36792 :     if( rInStm.Read( '[' ) )
     269                 :            :     {
     270                 :      23832 :         sal_uInt32 nBeginPos = 0; // can not happen with Tell
     271         [ +  + ]:     344798 :         while( nBeginPos != rInStm.Tell() )
     272                 :            :         {
     273                 :     320966 :             nBeginPos = rInStm.Tell();
     274                 :     320966 :             ReadAttributesSvIdl( rBase, rInStm );
     275                 :     320966 :             rInStm.ReadDelemiter();
     276                 :            :         }
     277                 :      23832 :         bOk = rInStm.Read( ']' );
     278                 :            :     }
     279                 :            : 
     280         [ +  - ]:      36792 :     if( bOk )
     281                 :            :     {
     282         [ +  + ]:      36792 :         if( rInStm.Read( '{' ) )
     283                 :            :         {
     284                 :       1426 :             DoReadContextSvIdl( rBase, rInStm );
     285                 :       1426 :             bOk = rInStm.Read( '}' );
     286                 :            :         }
     287                 :            :     }
     288                 :            : 
     289         [ -  + ]:      36792 :     if( !bOk )
     290                 :          0 :         rInStm.Seek( nTokPos );
     291                 :      36792 :     return bOk;
     292                 :            : }
     293                 :            : 
     294                 :      39758 : void SvMetaName::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
     295                 :            :                              sal_uInt16 nTab )
     296                 :            : {
     297                 :      39758 :     sal_uLong nBeginPos = rOutStm.Tell();
     298                 :      39758 :     WriteTab( rOutStm, nTab );
     299                 :      39758 :     rOutStm << '[' << endl;
     300                 :      39758 :     sal_uLong nOldPos = rOutStm.Tell();
     301                 :      39758 :     WriteAttributesSvIdl( rBase, rOutStm, nTab +1 );
     302                 :            : 
     303                 :            :     // write no empty brackets
     304         [ +  + ]:      39758 :     if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
     305                 :            :         // nothing written
     306                 :      15770 :         rOutStm.Seek( nBeginPos );
     307                 :            :     else
     308                 :            :     {
     309                 :      23988 :         WriteTab( rOutStm, nTab );
     310                 :      23988 :         rOutStm << ']';
     311                 :      23988 :         nBeginPos = rOutStm.Tell();
     312                 :      23988 :           rOutStm << endl;
     313                 :            :     }
     314                 :            : 
     315                 :      39758 :     WriteTab( rOutStm, nTab );
     316                 :      39758 :     rOutStm << '{' << endl;
     317                 :      39758 :     nOldPos = rOutStm.Tell();
     318                 :      39758 :     WriteContextSvIdl( rBase, rOutStm, nTab +1 );
     319                 :            : 
     320                 :            :     // write no empty brackets
     321         [ +  + ]:      39758 :     if( TestAndSeekSpaceOnly( rOutStm, nOldPos ) )
     322                 :            :         // nothing written
     323                 :      38364 :         rOutStm.Seek( nBeginPos );
     324                 :            :     else
     325                 :            :     {
     326                 :       1394 :         WriteTab( rOutStm, nTab );
     327                 :       1394 :         rOutStm << '}';
     328                 :            :     }
     329                 :      39758 : }
     330                 :            : 
     331                 :          0 : void SvMetaName::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
     332                 :            :                            sal_uInt16 nTab,
     333                 :            :                          WriteType nT, WriteAttribute nA )
     334                 :            : {
     335                 :          0 :     sal_uLong nBeginPos = rOutStm.Tell();
     336                 :          0 :     WriteTab( rOutStm, nTab );
     337                 :          0 :     rOutStm << '[' << endl;
     338                 :          0 :     sal_uLong nOldPos = rOutStm.Tell();
     339                 :          0 :     WriteAttributes( rBase, rOutStm, nTab +1, nT, nA );
     340                 :            : 
     341                 :            :     // write no empty brackets
     342                 :          0 :     sal_uLong nPos = rOutStm.Tell();
     343                 :          0 :     rOutStm.Seek( nOldPos );
     344                 :          0 :     sal_Bool bOnlySpace = sal_True;
     345 [ #  # ][ #  # ]:          0 :     while( bOnlySpace && rOutStm.Tell() < nPos )
                 [ #  # ]
     346                 :            :     {
     347                 :            :         char c;
     348         [ #  # ]:          0 :         rOutStm >> c;
     349         [ #  # ]:          0 :         if( !isspace( c ) )
     350                 :          0 :             bOnlySpace = sal_False;
     351                 :            :     }
     352         [ #  # ]:          0 :     if( bOnlySpace )
     353                 :            :         // nothing written
     354                 :          0 :         rOutStm.Seek( nBeginPos );
     355                 :            :     else
     356                 :            :     {
     357                 :          0 :         rOutStm.Seek( nPos );
     358                 :          0 :         WriteTab( rOutStm, nTab );
     359                 :          0 :         rOutStm << ']' << endl;
     360                 :            :     }
     361                 :          0 : }
     362                 :            : 
     363                 :          0 : void SvMetaName::WriteAttributes( SvIdlDataBase &, SvStream & rOutStm,
     364                 :            :                                 sal_uInt16 nTab,
     365                 :            :                                  WriteType, WriteAttribute )
     366                 :            : {
     367 [ #  # ][ #  # ]:          0 :     if( GetHelpText().IsSet() || GetHelpContext().IsSet() )
                 [ #  # ]
     368                 :            :     {
     369                 :          0 :         WriteTab( rOutStm, nTab );
     370                 :          0 :         rOutStm << "// class SvMetaName" << endl;
     371                 :            :     }
     372         [ #  # ]:          0 :     if( GetHelpText().IsSet() )
     373                 :            :     {
     374                 :          0 :         WriteTab( rOutStm, nTab );
     375                 :          0 :         rOutStm << "helpstring(\"" << GetHelpText().getString().getStr() << "\")," << endl;
     376                 :            :     }
     377         [ #  # ]:          0 :     if( GetHelpContext().IsSet() )
     378                 :            :     {
     379                 :          0 :         WriteTab( rOutStm, nTab );
     380         [ #  # ]:          0 :         rOutStm << "helpcontext("
     381                 :            :                 << rtl::OString::valueOf(static_cast<sal_Int64>(
     382         [ #  # ]:          0 :                     GetHelpContext().GetValue())).getStr()
     383 [ #  # ][ #  # ]:          0 :                 << ")," << endl;
     384                 :            :     }
     385                 :          0 : }
     386                 :            : 
     387                 :          0 : void SvMetaName::WriteContext( SvIdlDataBase &, SvStream &,
     388                 :            :                                 sal_uInt16,
     389                 :            :                                  WriteType, WriteAttribute )
     390                 :            : {
     391                 :          0 : }
     392                 :            : 
     393 [ #  # ][ #  # ]:      68944 : SV_IMPL_META_FACTORY1( SvMetaReference, SvMetaName );
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
                 [ -  + ]
     394                 :            : 
     395                 :      55798 : SvMetaReference::SvMetaReference()
     396                 :            : {
     397                 :      55798 : }
     398                 :            : 
     399                 :          0 : void SvMetaReference::Load( SvPersistStream & rStm )
     400                 :            : {
     401         [ #  # ]:          0 :     SvMetaName::Load( rStm );
     402                 :            : 
     403                 :            :     sal_uInt8 nMask;
     404         [ #  # ]:          0 :     rStm >> nMask;
     405         [ #  # ]:          0 :     if( nMask >= 0x2 )
     406                 :            :     {
     407         [ #  # ]:          0 :         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
     408                 :            :         OSL_FAIL( "wrong format" );
     409                 :          0 :         return;
     410                 :            :     }
     411         [ #  # ]:          0 :     if( nMask & 0x01 )
     412                 :            :     {
     413                 :            :         SvMetaReference * pRef;
     414         [ #  # ]:          0 :         rStm >> pRef;
     415         [ #  # ]:          0 :         aRef = pRef;
     416                 :            :     }
     417                 :            : }
     418                 :            : 
     419                 :      45758 : void SvMetaReference::Save( SvPersistStream & rStm )
     420                 :            : {
     421                 :      45758 :     SvMetaName::Save( rStm );
     422                 :            : 
     423                 :            :     // create mask
     424                 :      45758 :     sal_uInt8 nMask = 0;
     425         [ +  + ]:      45758 :     if( aRef.Is() )
     426                 :      18674 :         nMask |= 0x01;
     427                 :            : 
     428                 :            :     // write data
     429                 :      45758 :     rStm << nMask;
     430         [ +  + ]:      45758 :     if( nMask & 0x01 ) rStm << aRef;
     431                 :      45758 : }
     432                 :            : 
     433 [ #  # ][ #  # ]:      68880 : SV_IMPL_META_FACTORY1( SvMetaExtern, SvMetaReference );
         [ #  # ][ #  # ]
         [ #  # ][ -  + ]
                 [ -  + ]
     434                 :            : 
     435                 :      12682 : SvMetaExtern::SvMetaExtern()
     436                 :            :     : pModule( NULL )
     437                 :            :     , bReadUUId( sal_False )
     438         [ +  - ]:      12682 :     , bReadVersion( sal_False )
     439                 :            : {
     440                 :      12682 : }
     441                 :            : 
     442                 :          0 : void SvMetaExtern::Load( SvPersistStream & rStm )
     443                 :            : {
     444         [ #  # ]:          0 :     SvMetaReference::Load( rStm );
     445                 :            : 
     446                 :            :     sal_uInt8 nMask;
     447         [ #  # ]:          0 :     rStm >> nMask;
     448         [ #  # ]:          0 :     if( nMask >= 0x20 )
     449                 :            :     {
     450         [ #  # ]:          0 :         rStm.SetError( SVSTREAM_FILEFORMAT_ERROR );
     451                 :            :         OSL_FAIL( "wrong format" );
     452                 :          0 :         return;
     453                 :            :     }
     454 [ #  # ][ #  # ]:          0 :     if( nMask & 0x01 ) rStm >> pModule;
     455 [ #  # ][ #  # ]:          0 :     if( nMask & 0x02 ) rStm >> aUUId;
     456 [ #  # ][ #  # ]:          0 :     if( nMask & 0x04 ) rStm >> aVersion;
     457         [ #  # ]:          0 :     if( nMask & 0x08 ) bReadUUId = sal_True;
     458         [ #  # ]:          0 :     if( nMask & 0x10 ) bReadVersion = sal_True;
     459                 :            : }
     460                 :            : 
     461                 :      12682 : void SvMetaExtern::Save( SvPersistStream & rStm )
     462                 :            : {
     463                 :      12682 :     SvMetaReference::Save( rStm );
     464                 :            : 
     465                 :            :     // create mask
     466                 :      12682 :     sal_uInt8 nMask = 0;
     467         [ +  + ]:      12682 :     if( pModule )                   nMask |= 0x01;
     468 [ +  - ][ +  + ]:      12682 :     if( aUUId != SvGlobalName() )   nMask |= 0x02;
     469         [ -  + ]:      12682 :     if( aVersion != SvVersion() )   nMask |= 0x04;
     470         [ +  + ]:      12682 :     if( bReadUUId )                 nMask |= 0x08;
     471         [ -  + ]:      12682 :     if( bReadVersion )              nMask |= 0x10;
     472                 :            : 
     473                 :            :     // write data
     474                 :      12682 :     rStm << nMask;
     475         [ +  + ]:      12682 :     if( nMask & 0x01 ) rStm << pModule;
     476         [ +  + ]:      12682 :     if( nMask & 0x02 ) rStm << aUUId;
     477         [ -  + ]:      12682 :     if( nMask & 0x04 ) rStm << aVersion;
     478                 :      12682 : }
     479                 :            : 
     480                 :       2904 : SvMetaModule * SvMetaExtern::GetModule() const
     481                 :            : {
     482                 :            :     DBG_ASSERT( pModule != NULL, "module not set" );
     483                 :       2904 :     return pModule;
     484                 :            : }
     485                 :            : 
     486                 :       2904 : const SvGlobalName & SvMetaExtern::GetUUId() const
     487                 :            : {
     488 [ +  - ][ +  - ]:       2904 :     if( aUUId == SvGlobalName() )
     489                 :       2904 :         GetModule()->FillNextName( &((SvMetaExtern *)this)->aUUId );
     490                 :       2904 :     return aUUId;
     491                 :            : }
     492                 :            : 
     493                 :       6620 : void SvMetaExtern::SetModule( SvIdlDataBase & rBase )
     494                 :            : {
     495                 :       6620 :     pModule = (SvMetaModule *)rBase.GetStack().Get( TYPE( SvMetaModule ) );
     496                 :       6620 : }
     497                 :            : 
     498                 :        406 : void SvMetaExtern::ReadAttributesSvIdl( SvIdlDataBase & rBase,
     499                 :            :                                         SvTokenStream & rInStm )
     500                 :            : {
     501                 :        406 :     SvMetaReference::ReadAttributesSvIdl( rBase, rInStm );
     502         [ +  + ]:        406 :     if( aUUId.ReadSvIdl( rBase, rInStm ) )
     503                 :        136 :         bReadUUId = sal_True;
     504         [ -  + ]:        406 :     if( aVersion.ReadSvIdl( rInStm ) )
     505                 :          0 :         bReadVersion = sal_True;
     506                 :        406 : }
     507                 :            : 
     508                 :       3716 : void SvMetaExtern::WriteAttributesSvIdl( SvIdlDataBase & rBase,
     509                 :            :                                          SvStream & rOutStm, sal_uInt16 nTab )
     510                 :            : {
     511                 :       3716 :     SvMetaReference::WriteAttributesSvIdl( rBase, rOutStm, nTab );
     512 [ -  + ][ +  + ]:       3716 :     if( bReadUUId || bReadVersion )
     513                 :            :     {
     514                 :        136 :         WriteTab( rOutStm, nTab );
     515                 :        136 :         rOutStm << "// class SvMetaExtern" << endl;
     516                 :            : 
     517         [ +  - ]:        136 :         if( bReadUUId )
     518                 :            :         {
     519                 :        136 :             WriteTab( rOutStm, nTab );
     520                 :        136 :             aUUId.WriteSvIdl( rOutStm );
     521                 :        136 :             rOutStm << ';' << endl;
     522                 :            :         }
     523         [ -  + ]:        136 :         if( bReadVersion )
     524                 :            :         {
     525                 :          0 :             WriteTab( rOutStm, nTab );
     526                 :          0 :             aVersion.WriteSvIdl( rOutStm );
     527                 :          0 :             rOutStm << ';' << endl;
     528                 :            :         }
     529                 :            :     }
     530                 :       3716 : }
     531                 :            : 
     532                 :       2904 : sal_Bool SvMetaExtern::ReadSvIdl( SvIdlDataBase & rBase, SvTokenStream & rInStm )
     533                 :            : {
     534                 :       2904 :     SetModule( rBase );
     535                 :       2904 :     GetUUId(); // id gets created
     536                 :       2904 :     return SvMetaReference::ReadSvIdl( rBase, rInStm );
     537                 :            : }
     538                 :            : 
     539                 :       2920 : void SvMetaExtern::WriteSvIdl( SvIdlDataBase & rBase, SvStream & rOutStm,
     540                 :            :                                sal_uInt16 nTab )
     541                 :            : {
     542                 :       2920 :     SvMetaReference::WriteSvIdl( rBase, rOutStm, nTab );
     543                 :       2920 : }
     544                 :            : 
     545                 :          0 : void SvMetaExtern::Write( SvIdlDataBase & rBase, SvStream & rOutStm,
     546                 :            :                         sal_uInt16 nTab,
     547                 :            :                          WriteType nT, WriteAttribute nA )
     548                 :            : {
     549                 :          0 :     SvMetaReference::Write( rBase, rOutStm, nTab, nT, nA );
     550                 :          0 : }
     551                 :            : 
     552                 :          0 : void SvMetaExtern::WriteAttributes( SvIdlDataBase & rBase, SvStream & rOutStm,
     553                 :            :                                      sal_uInt16 nTab,
     554                 :            :                                      WriteType nT, WriteAttribute nA )
     555                 :            : {
     556                 :          0 :     SvMetaReference::WriteAttributes( rBase, rOutStm, nTab, nT, nA );
     557                 :            : 
     558                 :          0 :     WriteTab( rOutStm, nTab );
     559                 :          0 :     rOutStm << "// class SvMetaExtern" << endl;
     560                 :          0 :     WriteTab( rOutStm, nTab );
     561 [ #  # ][ #  # ]:          0 :     rOutStm << "uuid(" << rtl::OUStringToOString(GetUUId().GetHexName(), RTL_TEXTENCODING_UTF8).getStr() << ")," << endl;
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     562                 :          0 :     WriteTab( rOutStm, nTab );
     563         [ #  # ]:          0 :     rOutStm << "version("
     564         [ #  # ]:          0 :         << rtl::OString::valueOf(static_cast<sal_Int32>(aVersion.GetMajorVersion())).getStr()
     565         [ #  # ]:          0 :         << '.'
     566         [ #  # ]:          0 :         << rtl::OString::valueOf(static_cast<sal_Int32>(aVersion.GetMinorVersion())).getStr()
     567 [ #  # ][ #  # ]:          0 :         << ")," << endl;
     568                 :          0 : }
     569                 :            : 
     570                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10