LCOV - code coverage report
Current view: top level - sw/source/filter/ww8 - ww8toolbar.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 134 724 18.5 %
Date: 2012-08-25 Functions: 31 105 29.5 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 75 1117 6.7 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*
       3                 :            :  * Version: MPL 1.1 / GPLv3+ / LGPLv3+
       4                 :            :  *
       5                 :            :  * The contents of this file are subject to the Mozilla Public License Version
       6                 :            :  * 1.1 (the "License"); you may not use this file except in compliance with
       7                 :            :  * the License or as specified alternatively below. You may obtain a copy of
       8                 :            :  * the License at http://www.mozilla.org/MPL/
       9                 :            :  *
      10                 :            :  * Software distributed under the License is distributed on an "AS IS" basis,
      11                 :            :  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
      12                 :            :  * for the specific language governing rights and limitations under the
      13                 :            :  * License.
      14                 :            :  *
      15                 :            :  * The Initial Developer of the Original Code is
      16                 :            :  *       Noel Power <noel.power@novell.com>
      17                 :            :  * Portions created by the Initial Developer are Copyright (C) 2010 the
      18                 :            :  * Initial Developer. All Rights Reserved.
      19                 :            :  *
      20                 :            :  * Contributor(s):
      21                 :            :  *       Noel Power <noel.power@novell.com>
      22                 :            :  *
      23                 :            :  * For minor contributions see the git repository.
      24                 :            :  *
      25                 :            :  * Alternatively, the contents of this file may be used under the terms of
      26                 :            :  * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
      27                 :            :  * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
      28                 :            :  * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
      29                 :            :  * instead of those above.
      30                 :            :  */
      31                 :            : #include "ww8toolbar.hxx"
      32                 :            : #include "ww8scan.hxx"
      33                 :            : #include <rtl/ustrbuf.hxx>
      34                 :            : #include <stdarg.h>
      35                 :            : #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
      36                 :            : #include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
      37                 :            : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
      38                 :            : #include <com/sun/star/lang/XSingleComponentFactory.hpp>
      39                 :            : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
      40                 :            : #include <com/sun/star/ui/XImageManager.hpp>
      41                 :            : #include <com/sun/star/ui/ItemType.hpp>
      42                 :            : #include <fstream>
      43                 :            : #include <comphelper/processfactory.hxx>
      44                 :            : #include <vcl/graph.hxx>
      45                 :            : #include <map>
      46                 :            : using namespace com::sun::star;
      47                 :            : 
      48                 :            : // no. of visual data elements in a CTB ( fixed )
      49                 :            : const short nVisualData = 5;
      50                 :            : 
      51                 :            : typedef std::map< sal_Int16, rtl::OUString > IdToString;
      52                 :            : 
      53         [ #  # ]:          0 : class MSOWordCommandConvertor : public MSOCommandConvertor
      54                 :            : {
      55                 :            :    IdToString msoToOOcmd;
      56                 :            :    IdToString tcidToOOcmd;
      57                 :            : public:
      58                 :            :     MSOWordCommandConvertor();
      59                 :            :     virtual rtl::OUString MSOCommandToOOCommand( sal_Int16 msoCmd );
      60                 :            :     virtual rtl::OUString MSOTCIDToOOCommand( sal_Int16 key );
      61                 :            : };
      62                 :            : 
      63 [ #  # ][ #  # ]:          0 : MSOWordCommandConvertor::MSOWordCommandConvertor()
      64                 :            : {
      65                 :            :     // mso command id to ooo command string
      66                 :            :     // #FIXME and *HUNDREDS* of id's to added here
      67         [ #  # ]:          0 :     msoToOOcmd[ 0x20b ] = ".uno:CloseDoc";
      68         [ #  # ]:          0 :     msoToOOcmd[ 0x50 ] = ".uno:Open";
      69                 :            : 
      70                 :            :    // mso tcid to ooo command string
      71                 :            :     // #FIXME and *HUNDREDS* of id's to added here
      72         [ #  # ]:          0 :    tcidToOOcmd[ 0x9d9 ] = ".uno:Print";
      73                 :          0 : }
      74                 :            : 
      75                 :          0 : rtl::OUString MSOWordCommandConvertor::MSOCommandToOOCommand( sal_Int16 key )
      76                 :            : {
      77                 :          0 :     rtl::OUString sResult;
      78         [ #  # ]:          0 :     IdToString::iterator it = msoToOOcmd.find( key );
      79         [ #  # ]:          0 :     if ( it != msoToOOcmd.end() )
      80                 :          0 :         sResult = it->second;
      81                 :          0 :     return sResult;
      82                 :            : }
      83                 :            : 
      84                 :          0 : rtl::OUString MSOWordCommandConvertor::MSOTCIDToOOCommand( sal_Int16 key )
      85                 :            : {
      86                 :          0 :     rtl::OUString sResult;
      87         [ #  # ]:          0 :     IdToString::iterator it = tcidToOOcmd.find( key );
      88         [ #  # ]:          0 :     if ( it != tcidToOOcmd.end() )
      89                 :          0 :         sResult = it->second;
      90                 :          0 :     return sResult;
      91                 :            : }
      92                 :            : 
      93                 :            : 
      94                 :          0 : CTBWrapper::CTBWrapper( bool bReadId ) : Tcg255SubStruct( bReadId )
      95                 :            : ,reserved2(0)
      96                 :            : ,reserved3(0)
      97                 :            : ,reserved4(0)
      98                 :            : ,reserved5(0)
      99                 :            : ,cbTBD(0)
     100                 :            : ,cCust(0)
     101                 :            : ,cbDTBC(0)
     102 [ #  # ][ #  # ]:          0 : ,rtbdc(0)
                 [ #  # ]
     103                 :            : {
     104                 :          0 : }
     105                 :            : 
     106                 :          0 : CTBWrapper::~CTBWrapper()
     107                 :            : {
     108         [ #  # ]:          0 : }
     109                 :            : 
     110                 :          0 : Customization* CTBWrapper::GetCustomizaton( sal_Int16 index )
     111                 :            : {
     112 [ #  # ][ #  # ]:          0 :     if ( index < 0 || index >= static_cast<sal_Int16>( rCustomizations.size() ) )
                 [ #  # ]
     113                 :          0 :         return NULL;
     114                 :          0 :     return &rCustomizations[ index ];
     115                 :            : }
     116                 :            : 
     117                 :          0 : CTB* CTBWrapper::GetCustomizationData( const rtl::OUString& sTBName )
     118                 :            : {
     119                 :          0 :     CTB* pCTB = NULL;
     120 [ #  # ][ #  # ]:          0 :     for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
     121                 :            :     {
     122 [ #  # ][ #  # ]:          0 :         if ( it->GetCustomizationData() && it->GetCustomizationData()->GetName().equals( sTBName ) )
         [ #  # ][ #  # ]
                 [ #  # ]
           [ #  #  #  # ]
     123                 :            :         {
     124         [ #  # ]:          0 :             pCTB = it->GetCustomizationData();
     125                 :          0 :             break;
     126                 :            :         }
     127                 :            :     }
     128                 :          0 :     return pCTB;
     129                 :            : }
     130                 :            : 
     131                 :          0 : bool CTBWrapper::Read( SvStream& rS )
     132                 :            : {
     133                 :            :     OSL_TRACE("CTBWrapper::Read() stream pos 0x%x", rS.Tell() );
     134                 :          0 :     nOffSet = rS.Tell();
     135         [ #  # ]:          0 :     Tcg255SubStruct::Read( rS );
     136 [ #  # ][ #  # ]:          0 :     rS >> reserved2 >> reserved3 >> reserved4 >> reserved5;
         [ #  # ][ #  # ]
     137 [ #  # ][ #  # ]:          0 :     rS >> cbTBD >> cCust >> cbDTBC;
                 [ #  # ]
     138                 :          0 :     long nExpectedPos =  rS.Tell() + cbDTBC;
     139         [ #  # ]:          0 :     if ( cbDTBC )
     140                 :            :     {
     141                 :            :         // cbDTBC is the size in bytes of the TBC array
     142                 :            :         // but the size of a TBC element is dynamic ( and this relates to TBDelta's
     143                 :          0 :         int nStart = rS.Tell();
     144                 :            : 
     145                 :          0 :         int bytesRead = 0;
     146                 :          0 :         int bytesToRead = cbDTBC - bytesRead;
     147                 :            :         // cbDTBC specifies the size ( in bytes ) taken by an array ( of unspecified size )
     148                 :            :         // of TBC records ( TBC records have dynamic length, so we need to check our position
     149                 :            :         // after each read )
     150         [ #  # ]:          0 :         do
     151                 :            :         {
     152         [ #  # ]:          0 :             TBC aTBC;
     153 [ #  # ][ #  # ]:          0 :             if ( !aTBC.Read( rS ) )
     154                 :          0 :                 return false;
     155         [ #  # ]:          0 :             rtbdc.push_back( aTBC );
     156 [ #  # ][ #  # ]:          0 :             bytesToRead = cbDTBC - ( rS.Tell() - nStart );
     157                 :            :         } while ( bytesToRead > 0 );
     158                 :            :     }
     159         [ #  # ]:          0 :     if ( static_cast< long >( rS.Tell() ) != nExpectedPos )
     160                 :            :     {
     161                 :            :         // Strange error condition, shouldn't happen ( but does in at least
     162                 :            :         // one test document ) In the case where it happens the TBC &
     163                 :            :         // TBCHeader records seem blank??? ( and incorrect )
     164                 :            :         OSL_ENSURE( static_cast< long >(rS.Tell()) == nExpectedPos, "### Error: Expected pos not equal to actual pos after reading rtbdc");
     165                 :            :         OSL_TRACE("\tPos now is 0x%x should be 0x%x", rS.Tell(), nExpectedPos );
     166                 :            :         // seek to correct position after rtbdc
     167         [ #  # ]:          0 :         rS.Seek( nExpectedPos );
     168                 :            :     }
     169         [ #  # ]:          0 :     if ( cCust )
     170                 :            :     {
     171         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < cCust; ++index )
     172                 :            :         {
     173         [ #  # ]:          0 :             Customization aCust( this );
     174 [ #  # ][ #  # ]:          0 :             if ( !aCust.Read( rS ) )
     175                 :          0 :                 return false;
     176 [ #  # ][ #  # ]:          0 :             rCustomizations.push_back( aCust );
     177         [ #  # ]:          0 :         }
     178                 :            :     }
     179                 :          0 :     std::vector< sal_Int16 >::iterator it_end = dropDownMenuIndices.end();
     180 [ #  # ][ #  # ]:          0 :     for ( std::vector< sal_Int16 >::iterator it = dropDownMenuIndices.begin(); it != it_end; ++it )
                 [ #  # ]
     181                 :            :     {
     182         [ #  # ]:          0 :         rCustomizations[ *it ].bIsDroppedMenuTB = true;
     183                 :            :     }
     184                 :          0 :     return true;
     185                 :            : }
     186                 :            : 
     187                 :          0 : TBC* CTBWrapper::GetTBCAtOffset( sal_uInt32 nStreamOffset )
     188                 :            : {
     189 [ #  # ][ #  # ]:          0 :     for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it )
     190                 :            :     {
     191         [ #  # ]:          0 :         if ( (*it).GetOffset() == nStreamOffset )
     192                 :          0 :             return &(*it);
     193                 :            :     }
     194                 :          0 :     return NULL;
     195                 :            : }
     196                 :            : 
     197                 :          0 : void CTBWrapper::Print( FILE* fp )
     198                 :            : {
     199         [ #  # ]:          0 :     Indent a;
     200         [ #  # ]:          0 :     indent_printf(fp,"[ 0x%x ] CTBWrapper - dump\n", nOffSet );
     201 [ #  # ][ #  # ]:          0 :     bool bRes = ( ch == 0x12 && reserved2 == 0x0 && reserved3 == 0x7 && reserved4 == 0x6 && reserved5 == 0xC );
         [ #  # ][ #  # ]
                 [ #  # ]
     202         [ #  # ]:          0 :     if ( bRes )
     203         [ #  # ]:          0 :         indent_printf(fp,"  sanity check ( first 8 bytes conform )\n");
     204                 :            :     else
     205                 :            :     {
     206         [ #  # ]:          0 :         indent_printf(fp,"    reserved1(0x%x)\n",ch);
     207         [ #  # ]:          0 :         indent_printf(fp,"    reserved2(0x%x)\n",reserved2);
     208         [ #  # ]:          0 :         indent_printf(fp,"    reserved3(0x%x)\n",reserved3);
     209         [ #  # ]:          0 :         indent_printf(fp,"    reserved4(0x%x)\n",reserved4);
     210         [ #  # ]:          0 :         indent_printf(fp,"    reserved5(0x%x)\n",reserved5);
     211         [ #  # ]:          0 :         indent_printf(fp,"Quiting dump");
     212                 :          0 :         return;
     213                 :            :     }
     214         [ #  # ]:          0 :     indent_printf(fp,"  size of TBDelta structures 0x%x\n", cbTBD );
     215         [ #  # ]:          0 :     indent_printf(fp,"  cCust: no. of cCust structures 0x%x\n",cCust);
     216         [ #  # ]:          0 :     indent_printf(fp,"  cbDTBC: no. of bytes in rtbdc array 0x%x\n", static_cast< unsigned int >( cbDTBC ));
     217                 :            : 
     218                 :          0 :     sal_Int32 index = 0;
     219                 :            : 
     220 [ #  # ][ #  # ]:          0 :     for ( std::vector< TBC >::iterator it = rtbdc.begin(); it != rtbdc.end(); ++it, ++index )
     221                 :            :     {
     222         [ #  # ]:          0 :         indent_printf(fp,"  Dumping rtbdc[%d]\n", static_cast< int >( index ));
     223         [ #  # ]:          0 :         Indent b;
     224         [ #  # ]:          0 :         it->Print( fp );
     225                 :          0 :     }
     226                 :            : 
     227                 :          0 :     index = 0;
     228                 :            : 
     229 [ #  # ][ #  # ]:          0 :     for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it, ++index )
     230                 :            :     {
     231         [ #  # ]:          0 :         indent_printf(fp,"  Dumping custimization [%d]\n", static_cast< int >( index ));
     232         [ #  # ]:          0 :         Indent c;
     233         [ #  # ]:          0 :         it->Print(fp);
     234         [ #  # ]:          0 :     }
     235                 :            : }
     236                 :            : 
     237                 :          0 : bool CTBWrapper::ImportCustomToolBar( SfxObjectShell& rDocSh )
     238                 :            : {
     239 [ #  # ][ #  # ]:          0 :     for ( std::vector< Customization >::iterator it = rCustomizations.begin(); it != rCustomizations.end(); ++it )
     240                 :            :     {
     241                 :            :         try
     242                 :            :         {
     243 [ #  # ][ #  # ]:          0 :             uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
     244 [ #  # ][ #  # ]:          0 :             uno::Reference< ui::XModuleUIConfigurationManagerSupplier > xAppCfgSupp( xMSF->createInstance( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     245 [ #  # ][ #  # ]:          0 :             CustomToolBarImportHelper helper( rDocSh, xAppCfgSupp->getUIConfigurationManager( "com.sun.star.text.TextDocument" ) );
                 [ #  # ]
     246 [ #  # ][ #  # ]:          0 :             helper.setMSOCommandMap( new MSOWordCommandConvertor() );
     247                 :            : 
     248 [ #  # ][ #  # ]:          0 :             if ( !(*it).ImportCustomToolBar( *this, helper ) )
     249 [ #  # ][ #  # ]:          0 :                 return false;
         [ #  # ][ #  # ]
     250                 :            :         }
     251         [ #  # ]:          0 :         catch(...)
     252                 :            :         {
     253                 :          0 :             continue;
     254                 :            :         }
     255                 :            :     }
     256                 :          0 :     return false;
     257                 :            : }
     258                 :            : 
     259                 :          0 : Customization::Customization( CTBWrapper* wrapper ) : tbidForTBD( 0 )
     260                 :            : ,reserved1( 0 )
     261                 :            : , ctbds( 0 )
     262                 :            : , pWrapper( wrapper )
     263 [ #  # ][ #  # ]:          0 : , bIsDroppedMenuTB( false )
     264                 :            : {
     265                 :          0 : }
     266                 :            : 
     267         [ #  # ]:          0 : Customization::~Customization()
     268                 :            : {
     269         [ #  # ]:          0 : }
     270                 :            : 
     271                 :          0 : bool Customization::Read( SvStream &rS)
     272                 :            : {
     273                 :            :     OSL_TRACE("Custimization::Read() stream pos 0x%x", rS.Tell() );
     274                 :          0 :     nOffSet = rS.Tell();
     275                 :          0 :     rS >> tbidForTBD >> reserved1 >> ctbds;
     276         [ #  # ]:          0 :     if ( tbidForTBD )
     277                 :            :     {
     278         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < ctbds; ++index )
     279                 :            :         {
     280                 :          0 :             TBDelta aTBDelta;
     281 [ #  # ][ #  # ]:          0 :             if (!aTBDelta.Read( rS ) )
     282                 :          0 :                 return false;
     283         [ #  # ]:          0 :             customizationDataTBDelta.push_back( aTBDelta );
     284                 :            :             // Only set the drop down for menu's associated with standard toolbar
     285 [ #  # ][ #  # ]:          0 :             if ( aTBDelta.ControlDropsToolBar() && tbidForTBD == 0x25 )
                 [ #  # ]
     286         [ #  # ]:          0 :                 pWrapper->InsertDropIndex( aTBDelta.CustomizationIndex() );
     287         [ #  # ]:          0 :         }
     288                 :            :     }
     289                 :            :     else
     290                 :            :     {
     291         [ #  # ]:          0 :         customizationDataCTB.reset( new CTB() );
     292         [ #  # ]:          0 :         if ( !customizationDataCTB->Read( rS ) )
     293                 :          0 :                 return false;
     294                 :            :     }
     295                 :          0 :     return true;
     296                 :            : }
     297                 :            : 
     298                 :          0 : void Customization::Print( FILE* fp )
     299                 :            : {
     300         [ #  # ]:          0 :     Indent a;
     301         [ #  # ]:          0 :     indent_printf( fp,"[ 0x%x ] Customization -- dump \n", nOffSet );
     302         [ #  # ]:          0 :     indent_printf( fp,"  tbidForTBD 0x%x ( should be 0 for CTBs )\n", static_cast< unsigned int >( tbidForTBD ));
     303         [ #  # ]:          0 :     indent_printf( fp,"  reserved1 0x%x \n", reserved1);
     304         [ #  # ]:          0 :     indent_printf( fp,"  ctbds - number of customisations %d(0x%x) \n", ctbds, ctbds );
     305 [ #  # ][ #  # ]:          0 :     if ( !tbidForTBD && !ctbds )
     306         [ #  # ]:          0 :         customizationDataCTB->Print( fp );
     307                 :            :     else
     308                 :            :     {
     309                 :          0 :         const char* pToolBar = NULL;
     310      [ #  #  # ]:          0 :         switch ( tbidForTBD )
     311                 :            :         {
     312                 :            :             case 0x9:
     313                 :          0 :                 pToolBar = "Standard";
     314                 :          0 :                 break;
     315                 :            :             case 0x25:
     316                 :          0 :                 pToolBar = "Builtin-Menu";
     317                 :          0 :                 break;
     318                 :            :             default:
     319                 :          0 :                 pToolBar = "Unknown toolbar";
     320                 :          0 :                 break;
     321                 :            :         }
     322                 :            : 
     323         [ #  # ]:          0 :         indent_printf( fp,"  TBDelta(s) are associated with %s toolbar.\n", pToolBar);
     324                 :          0 :         std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin();
     325         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < ctbds; ++it,++index )
     326         [ #  # ]:          0 :             it->Print( fp );
     327                 :          0 :     }
     328                 :            : 
     329                 :          0 : }
     330                 :            : 
     331                 :          0 : bool Customization::ImportMenu( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
     332                 :            : {
     333         [ #  # ]:          0 :     if ( tbidForTBD == 0x25 )  // we can handle in a limited way additions the built-in menu bar
     334                 :            :     {
     335 [ #  # ][ #  # ]:          0 :         for ( std::vector< TBDelta >::iterator it = customizationDataTBDelta.begin(); it != customizationDataTBDelta.end(); ++it )
     336                 :            :         {
     337                 :            :             // for each new menu ( control that drops a toolbar )
     338                 :            :             // import a toolbar
     339 [ #  # ][ #  # ]:          0 :             if ( it->ControlIsInserted() && it->ControlDropsToolBar() )
                 [ #  # ]
     340                 :            :             {
     341         [ #  # ]:          0 :                 Customization* pCust = pWrapper->GetCustomizaton( it->CustomizationIndex() );
     342         [ #  # ]:          0 :                 if ( pCust )
     343                 :            :                 {
     344                 :            :                     // currently only support built-in menu
     345                 :          0 :                     rtl::OUString sMenuBar( "private:resource/menubar/" );
     346                 :            : 
     347                 :          0 :                     sMenuBar = sMenuBar.concat( "menubar" );
     348                 :            :                     // Get menu name
     349         [ #  # ]:          0 :                     TBC* pTBC = pWrapper->GetTBCAtOffset( it->TBCStreamOffset() );
     350         [ #  # ]:          0 :                     if ( !pTBC )
     351                 :          0 :                         return false;
     352         [ #  # ]:          0 :                     rtl::OUString sMenuName = pTBC->GetCustomText();
     353                 :          0 :                     sMenuName = sMenuName.replace('&','~');
     354                 :            : 
     355                 :            :                     // see if the document has already setting for the menubar
     356                 :            : 
     357                 :          0 :                     uno::Reference< container::XIndexContainer > xIndexContainer;
     358                 :          0 :                     bool bHasSettings = false;
     359 [ #  # ][ #  # ]:          0 :                     if ( helper.getCfgManager()->hasSettings( sMenuBar ) )
         [ #  # ][ #  # ]
     360                 :            :                     {
     361 [ #  # ][ #  # ]:          0 :                         xIndexContainer.set( helper.getCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     362                 :          0 :                         bHasSettings = true;
     363                 :            :                     }
     364                 :            :                     else
     365                 :            :                     {
     366 [ #  # ][ #  # ]:          0 :                         if ( helper.getAppCfgManager()->hasSettings( sMenuBar ) )
         [ #  # ][ #  # ]
     367 [ #  # ][ #  # ]:          0 :                             xIndexContainer.set( helper.getAppCfgManager()->getSettings( sMenuBar, sal_True ), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     368                 :            :                         else
     369 [ #  # ][ #  # ]:          0 :                             xIndexContainer.set( helper.getAppCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     370                 :            :                     }
     371                 :            : 
     372         [ #  # ]:          0 :                     uno::Reference< lang::XSingleComponentFactory > xSCF( xIndexContainer, uno::UNO_QUERY_THROW );
     373 [ #  # ][ #  # ]:          0 :                     uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
     374 [ #  # ][ #  # ]:          0 :                     uno::Reference< uno::XComponentContext > xContext(  xProps->getPropertyValue( "DefaultContext" ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     375                 :            :                     // create the popup menu
     376         [ #  # ]:          0 :                     uno::Sequence< beans::PropertyValue > aPopupMenu( 4 );
     377         [ #  # ]:          0 :                     aPopupMenu[0].Name = "CommandURL";
     378 [ #  # ][ #  # ]:          0 :                     aPopupMenu[0].Value = uno::makeAny( rtl::OUString( "vnd.openoffice.org:" ) + sMenuName );
     379         [ #  # ]:          0 :                     aPopupMenu[1].Name = "Label";
     380 [ #  # ][ #  # ]:          0 :                     aPopupMenu[1].Value <<= sMenuName;
     381         [ #  # ]:          0 :                     aPopupMenu[2].Name = "Type";
     382 [ #  # ][ #  # ]:          0 :                     aPopupMenu[2].Value <<= sal_Int32( 0 );
     383         [ #  # ]:          0 :                     aPopupMenu[3].Name = "ItemDescriptorContainer";
     384 [ #  # ][ #  # ]:          0 :                     uno::Reference< container::XIndexContainer > xMenuContainer( xSCF->createInstanceWithContext( xContext ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     385 [ #  # ][ #  # ]:          0 :                     aPopupMenu[3].Value <<= xMenuContainer;
     386 [ #  # ][ #  # ]:          0 :                     if ( pCust->customizationDataCTB.get() && !pCust->customizationDataCTB->ImportMenuTB( rWrapper, xMenuContainer, helper ) )
         [ #  # ][ #  # ]
     387                 :          0 :                         return false;
     388                 :            :                     OSL_TRACE("** there are %d menu items on the bar, inserting after that", xIndexContainer->getCount() );
     389 [ #  # ][ #  # ]:          0 :                     xIndexContainer->insertByIndex( xIndexContainer->getCount(), uno::makeAny( aPopupMenu ) );
         [ #  # ][ #  # ]
                 [ #  # ]
     390                 :            : 
     391         [ #  # ]:          0 :                     if ( bHasSettings )
     392 [ #  # ][ #  # ]:          0 :                         helper.getCfgManager()->replaceSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
         [ #  # ][ #  # ]
     393                 :            :                     else
     394 [ #  # ][ #  # ]:          0 :                         helper.getCfgManager()->insertSettings( sMenuBar, uno::Reference< container::XIndexAccess >( xIndexContainer, uno::UNO_QUERY_THROW ) );
         [ #  # ][ #  # ]
     395 [ #  # ][ #  # ]:          0 :         uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager(), uno::UNO_QUERY_THROW );
     396 [ #  # ][ #  # ]:          0 :         xPersistence->store();
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     397                 :            :                 }
     398                 :            :             }
     399                 :            :         }
     400                 :          0 :         return true;
     401                 :            :     }
     402                 :          0 :     return true;
     403                 :            : }
     404                 :            : 
     405                 :          0 : bool Customization::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
     406                 :            : {
     407         [ #  # ]:          0 :     if ( GetTBIDForTB() == 0x25 )
     408                 :          0 :         return ImportMenu( rWrapper, helper );
     409         [ #  # ]:          0 :     if ( !customizationDataCTB.get() )
     410                 :          0 :         return false;
     411         [ #  # ]:          0 :     if ( !customizationDataCTB->IsMenuToolbar() )
     412                 :            :     {
     413         [ #  # ]:          0 :         if ( !customizationDataCTB->ImportCustomToolBar( rWrapper, helper ) )
     414                 :          0 :             return false;
     415                 :            :     }
     416                 :          0 :     return true;
     417                 :            : }
     418                 :            : 
     419                 :          0 : TBDelta::TBDelta() : doprfatendFlags(0)
     420                 :            : ,ibts(0)
     421                 :            : ,cidNext(0)
     422                 :            : ,cid(0)
     423                 :            : ,fc(0)
     424                 :          0 : ,cbTBC(0)
     425                 :            : {
     426                 :          0 : }
     427                 :            : 
     428                 :          0 : bool TBDelta::ControlIsModified()
     429                 :            : {
     430                 :          0 :     return ( ( doprfatendFlags & 0x3 ) == 0x2 );
     431                 :            : }
     432                 :            : 
     433                 :          0 : bool TBDelta::ControlIsInserted()
     434                 :            : {
     435                 :          0 :     return ( ( doprfatendFlags & 0x3 ) == 0x1 );
     436                 :            : }
     437                 :            : 
     438                 :          0 : bool TBDelta::ControlIsChanged()
     439                 :            : {
     440                 :          0 :     return ( ( doprfatendFlags & 0x3 ) == 0x1 );
     441                 :            : }
     442                 :            : 
     443                 :          0 : bool TBDelta::ControlDropsToolBar()
     444                 :            : {
     445                 :          0 :     return !( CiTBDE & 0x8000 );
     446                 :            : }
     447                 :            : 
     448                 :          0 : sal_Int32 TBDelta::TBCStreamOffset()
     449                 :            : {
     450                 :          0 :     return fc;
     451                 :            : }
     452                 :            : 
     453                 :          0 : sal_Int16 TBDelta::CustomizationIndex()
     454                 :            : {
     455                 :          0 :     sal_Int16 nIndex = CiTBDE;
     456                 :          0 :     nIndex = nIndex >> 1;
     457                 :          0 :     nIndex &= 0x1ff; // only 13 bits are relevant
     458                 :          0 :     return nIndex;
     459                 :            : }
     460                 :            : 
     461                 :          0 : bool TBDelta::Read(SvStream &rS)
     462                 :            : {
     463                 :            :     OSL_TRACE("TBDelta::Read() stream pos 0x%x", rS.Tell() );
     464                 :          0 :     nOffSet = rS.Tell();
     465                 :          0 :     rS >> doprfatendFlags >> ibts >> cidNext >> cid >> fc ;
     466                 :          0 :     rS >> CiTBDE >> cbTBC;
     467                 :          0 :     return true;
     468                 :            : }
     469                 :            : 
     470                 :          0 : void TBDelta::Print( FILE* fp )
     471                 :            : {
     472                 :            :     // Like most of the debug output, it's raw and little ( no )
     473                 :            :     // interpretation of the data is output ( e.g. flag values etc. )
     474                 :          0 :     indent_printf( fp, "[ 0x%x ] TBDelta -- dump\n", nOffSet );
     475                 :          0 :     indent_printf( fp, " doprfatendFlags 0x%x\n",doprfatendFlags );
     476                 :            : 
     477                 :          0 :     indent_printf( fp, " ibts 0x%x\n",ibts );
     478                 :          0 :     indent_printf( fp, " cidNext 0x%x\n", static_cast< unsigned int >( cidNext ) );
     479                 :          0 :     indent_printf( fp, " cid 0x%x\n", static_cast< unsigned int >( cid ) );
     480                 :          0 :     indent_printf( fp, " fc 0x%x\n", static_cast< unsigned int >( fc ) );
     481                 :          0 :     indent_printf( fp, " CiTBDE 0x%x\n",CiTBDE );
     482                 :          0 :     indent_printf( fp, " cbTBC 0x%x\n", cbTBC );
     483         [ #  # ]:          0 :     if ( ControlDropsToolBar() )
     484                 :            :     {
     485                 :          0 :         indent_printf( fp, " this delta is associated with a control that drops a menu toolbar\n", cbTBC );
     486                 :          0 :         indent_printf( fp, " the menu toolbar drops the toolbar defined at index[%d] in the rCustomizations array of the CTBWRAPPER that contains this TBDelta\n", CustomizationIndex() );
     487                 :            :     }
     488                 :          0 : }
     489                 :            : 
     490                 :          0 : CTB::CTB() : cbTBData( 0 )
     491                 :            : ,iWCTBl( 0 )
     492                 :            : ,reserved( 0 )
     493                 :            : ,unused( 0 )
     494 [ #  # ][ #  # ]:          0 : ,cCtls( 0 )
                 [ #  # ]
     495                 :            : {
     496                 :          0 : }
     497                 :            : 
     498                 :          0 : CTB::~CTB()
     499                 :            : {
     500         [ #  # ]:          0 : }
     501                 :            : 
     502                 :          0 : bool CTB::IsMenuToolbar()
     503                 :            : {
     504                 :          0 :     return tb.IsMenuToolbar();
     505                 :            : }
     506                 :            : 
     507                 :            : 
     508                 :          0 : bool CTB::Read( SvStream &rS)
     509                 :            : {
     510                 :            :     OSL_TRACE("CTB::Read() stream pos 0x%x", rS.Tell() );
     511                 :          0 :     nOffSet = rS.Tell();
     512         [ #  # ]:          0 :     if ( !name.Read( rS ) )
     513                 :          0 :         return false;
     514                 :          0 :     rS >> cbTBData;
     515         [ #  # ]:          0 :     if ( !tb.Read( rS ) )
     516                 :          0 :         return false;
     517         [ #  # ]:          0 :     for ( short index = 0; index < nVisualData; ++index )
     518                 :            :     {
     519         [ #  # ]:          0 :         TBVisualData aVisData;
     520         [ #  # ]:          0 :         aVisData.Read( rS );
     521         [ #  # ]:          0 :         rVisualData.push_back( aVisData );
     522         [ #  # ]:          0 :     }
     523                 :            : 
     524                 :          0 :     rS >> iWCTBl >> reserved >> unused >> cCtls;
     525                 :            : 
     526         [ #  # ]:          0 :     if ( cCtls )
     527                 :            :     {
     528         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < cCtls; ++index )
     529                 :            :         {
     530         [ #  # ]:          0 :             TBC aTBC;
     531 [ #  # ][ #  # ]:          0 :             if ( !aTBC.Read( rS ) )
     532                 :          0 :                 return false;
     533 [ #  # ][ #  # ]:          0 :             rTBC.push_back( aTBC );
     534         [ #  # ]:          0 :         }
     535                 :            :     }
     536                 :          0 :     return true;
     537                 :            : }
     538                 :            : 
     539                 :            : void
     540                 :          0 : CTB::Print( FILE* fp )
     541                 :            : {
     542         [ #  # ]:          0 :     Indent a;
     543         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] CTB - dump\n", nOffSet );
     544 [ #  # ][ #  # ]:          0 :     indent_printf(fp, "  name %s\n", rtl::OUStringToOString( name.getString(), RTL_TEXTENCODING_UTF8 ).getStr() );
     545         [ #  # ]:          0 :     indent_printf(fp, "  cbTBData size, in bytes, of this structure excluding the name, cCtls, and rTBC fields.  %x\n", static_cast< unsigned int >( cbTBData ) );
     546                 :            : 
     547         [ #  # ]:          0 :     tb.Print(fp);
     548         [ #  # ]:          0 :     for ( short counter = 0; counter < nVisualData; ++counter )
     549                 :            :     {
     550         [ #  # ]:          0 :         indent_printf( fp, "  TBVisualData [%d]\n", counter);
     551         [ #  # ]:          0 :         Indent b;
     552 [ #  # ][ #  # ]:          0 :         rVisualData[ counter ].Print( fp );
     553                 :          0 :     }
     554         [ #  # ]:          0 :     indent_printf(fp, "  iWCTBl 0x%x reserved 0x%x unused 0x%x cCtls( toolbar controls ) 0x%x \n", static_cast< unsigned int >( iWCTBl ), reserved, unused, static_cast< unsigned int >( cCtls ) );
     555         [ #  # ]:          0 :     if ( cCtls )
     556                 :            :     {
     557         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < cCtls; ++index )
     558                 :            :         {
     559                 :            : 
     560         [ #  # ]:          0 :             indent_printf(fp, "  dumping toolbar control 0x%x\n", static_cast< unsigned int >( index ) );
     561         [ #  # ]:          0 :             rTBC[ index ].Print( fp );
     562                 :            :         }
     563                 :          0 :     }
     564                 :          0 : }
     565                 :            : 
     566                 :          0 : bool CTB::ImportCustomToolBar( CTBWrapper& rWrapper, CustomToolBarImportHelper& helper )
     567                 :            : {
     568 [ #  # ][ #  # ]:          0 :     static rtl::OUString sToolbarPrefix( "private:resource/toolbar/custom_" );
     569                 :          0 :     bool bRes = false;
     570                 :            :     try
     571                 :            :     {
     572 [ #  # ][ #  # ]:          0 :         if ( !tb.IsEnabled() )
     573                 :          0 :             return true;  // didn't fail, just ignoring
     574                 :            :         // Create default setting
     575 [ #  # ][ #  # ]:          0 :         uno::Reference< container::XIndexContainer > xIndexContainer( helper.getCfgManager()->createSettings(), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     576         [ #  # ]:          0 :         uno::Reference< container::XIndexAccess > xIndexAccess( xIndexContainer, uno::UNO_QUERY_THROW );
     577         [ #  # ]:          0 :         uno::Reference< beans::XPropertySet > xProps( xIndexContainer, uno::UNO_QUERY_THROW );
     578                 :            : 
     579                 :            :         // set UI name for toolbar
     580 [ #  # ][ #  # ]:          0 :         xProps->setPropertyValue( "UIName", uno::makeAny( name.getString() ) );
                 [ #  # ]
     581                 :            : 
     582                 :          0 :         rtl::OUString sToolBarName = sToolbarPrefix.concat( name.getString() );
     583 [ #  # ][ #  # ]:          0 :         for ( std::vector< TBC >::iterator it =  rTBC.begin(); it != rTBC.end(); ++it )
     584                 :            :         {
     585                 :            :             // createToolBar item for control
     586 [ #  # ][ #  # ]:          0 :             if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, helper, IsMenuToolbar() ) )
     587                 :          0 :                 return false;
     588                 :            :         }
     589                 :            : 
     590                 :            :         OSL_TRACE("Name of toolbar :-/ %s", rtl::OUStringToOString( sToolBarName, RTL_TEXTENCODING_UTF8 ).getStr() );
     591                 :            : 
     592 [ #  # ][ #  # ]:          0 :         helper.getCfgManager()->insertSettings( sToolBarName, xIndexAccess );
                 [ #  # ]
     593         [ #  # ]:          0 :         helper.applyIcons();
     594                 :            : #if 1 // don't think this is necessary
     595 [ #  # ][ #  # ]:          0 :         uno::Reference< ui::XUIConfigurationPersistence > xPersistence( helper.getCfgManager()->getImageManager(), uno::UNO_QUERY_THROW );
         [ #  # ][ #  # ]
     596 [ #  # ][ #  # ]:          0 :         xPersistence->store();
     597                 :            : 
     598 [ #  # ][ #  # ]:          0 :         xPersistence.set( helper.getCfgManager(), uno::UNO_QUERY_THROW );
     599 [ #  # ][ #  # ]:          0 :         xPersistence->store();
     600                 :            : #endif
     601 [ #  # ][ #  # ]:          0 :         bRes = true;
         [ #  # ][ #  # ]
                 [ #  # ]
     602                 :            :     }
     603                 :          0 :     catch( const uno::Exception& e )
     604                 :            :     {
     605                 :            :         OSL_TRACE("***** For some reason we have an exception %s", rtl::OUStringToOString( e.Message, RTL_TEXTENCODING_UTF8 ).getStr() );
     606                 :          0 :         bRes = false;
     607                 :            :     }
     608                 :          0 :     return bRes;
     609                 :            : }
     610                 :            : 
     611                 :          0 : bool CTB::ImportMenuTB( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& xIndexContainer, CustomToolBarImportHelper& rHelper )
     612                 :            : {
     613 [ #  # ][ #  # ]:          0 :     for ( std::vector< TBC >::iterator it =  rTBC.begin(); it != rTBC.end(); ++it )
     614                 :            :     {
     615                 :            :         // createToolBar item for control
     616 [ #  # ][ #  # ]:          0 :         if ( !it->ImportToolBarControl( rWrapper, xIndexContainer, rHelper, true ) )
     617                 :          0 :             return false;
     618                 :            :     }
     619                 :          0 :     return true;
     620                 :            : }
     621                 :            : 
     622 [ #  # ][ #  # ]:          0 : TBC::TBC()
                 [ #  # ]
     623                 :            : {
     624                 :          0 : }
     625                 :            : 
     626 [ #  # ][ #  # ]:          0 : TBC::~TBC()
                 [ #  # ]
     627                 :            : {
     628         [ #  # ]:          0 : }
     629                 :            : 
     630                 :          0 : bool TBC::Read( SvStream &rS )
     631                 :            : {
     632                 :            :     OSL_TRACE("TBC::Read() stream pos 0x%x", rS.Tell() );
     633                 :          0 :     nOffSet = rS.Tell();
     634         [ #  # ]:          0 :     if ( !tbch.Read( rS ) )
     635                 :          0 :         return false;
     636 [ #  # ][ #  # ]:          0 :     if ( tbch.getTcID() != 0x1 && tbch.getTcID() != 0x1051 )
                 [ #  # ]
     637                 :            :     {
     638                 :          0 :         cid.reset( new sal_uInt32 );
     639                 :          0 :         rS >> *cid;
     640                 :            :     }
     641                 :            :     // MUST exist if tbch.tct is not equal to 0x16
     642         [ #  # ]:          0 :     if ( tbch.getTct() != 0x16 )
     643                 :            :     {
     644         [ #  # ]:          0 :         tbcd.reset(  new TBCData( tbch ) );
     645         [ #  # ]:          0 :         if ( !tbcd->Read( rS ) )
     646                 :          0 :             return false;
     647                 :            :     }
     648                 :          0 :     return true;
     649                 :            : }
     650                 :            : 
     651                 :          0 : void TBC::Print( FILE* fp )
     652                 :            : {
     653         [ #  # ]:          0 :     Indent a;
     654         [ #  # ]:          0 :     indent_printf(fp,"[ 0x%x ] TBC -- dump\n", nOffSet );
     655         [ #  # ]:          0 :     indent_printf(fp,"  dumping header ( TBCHeader )\n");
     656         [ #  # ]:          0 :     tbch.Print( fp );
     657         [ #  # ]:          0 :     if ( cid.get() )
     658         [ #  # ]:          0 :         indent_printf(fp,"  cid = 0x%x\n", static_cast< unsigned int >( *cid ) );
     659         [ #  # ]:          0 :     if ( tbcd.get() )
     660                 :            :     {
     661         [ #  # ]:          0 :         indent_printf(fp,"  dumping toolbar data TBCData \n");
     662         [ #  # ]:          0 :         tbcd->Print(fp);
     663                 :          0 :     }
     664                 :          0 : }
     665                 :            : 
     666                 :            : bool
     667                 :          0 : TBC::ImportToolBarControl( CTBWrapper& rWrapper, const css::uno::Reference< css::container::XIndexContainer >& toolbarcontainer, CustomToolBarImportHelper& helper, bool bIsMenuBar )
     668                 :            : {
     669                 :            :     // cmtFci       0x1 Command based on a built-in command. See CidFci.
     670                 :            :     // cmtMacro     0x2 Macro command. See CidMacro.
     671                 :            :     // cmtAllocated 0x3 Allocated command. See CidAllocated.
     672                 :            :     // cmtNil       0x7 No command. See Cid.
     673                 :          0 :     bool bBuiltin = false;
     674                 :          0 :     sal_uInt16 cmdId = 0;
     675         [ #  # ]:          0 :     if  ( cid.get() )
     676                 :            :     {
     677                 :          0 :         sal_uInt16 arg2 = ( *( cid.get() ) & 0xFFFF );
     678                 :            : 
     679                 :          0 :         sal_uInt8 cmt = ( arg2 & 0x7 );
     680                 :          0 :         arg2 = ( arg2 >> 3 );
     681                 :            : 
     682   [ #  #  #  #  :          0 :         switch ( cmt )
                      # ]
     683                 :            :         {
     684                 :            :             case 1:
     685                 :            :                 OSL_TRACE("cmt is cmtFci builtin command 0x%x", arg2);
     686                 :          0 :                 bBuiltin = true;
     687                 :          0 :                 cmdId = arg2;
     688                 :          0 :                 break;
     689                 :            :             case 2:
     690                 :            :                 OSL_TRACE("cmt is cmtMacro macro 0x%x", arg2);
     691                 :          0 :                 break;
     692                 :            :             case 3:
     693                 :            :                 OSL_TRACE("cmt is cmtAllocated [???] 0x%x", arg2);
     694                 :          0 :                 break;
     695                 :            :             case 7:
     696                 :            :                 OSL_TRACE("cmt is cmNill no-phing 0x%x", arg2);
     697                 :          0 :                 break;
     698                 :            :             default:
     699                 :            :                 OSL_TRACE("illegal 0x%x", cmt);
     700                 :          0 :                 break;
     701                 :            :         }
     702                 :            :     }
     703                 :            : 
     704         [ #  # ]:          0 :     if ( tbcd.get() )
     705                 :            :     {
     706         [ #  # ]:          0 :         std::vector< css::beans::PropertyValue > props;
     707         [ #  # ]:          0 :         if ( bBuiltin )
     708                 :            :         {
     709         [ #  # ]:          0 :             rtl::OUString sCommand = helper.MSOCommandToOOCommand( cmdId );
     710         [ #  # ]:          0 :             if ( !sCommand.isEmpty() )
     711                 :            :             {
     712                 :          0 :                 beans::PropertyValue aProp;
     713                 :            : 
     714                 :          0 :                 aProp.Name = "CommandURL";
     715         [ #  # ]:          0 :                 aProp.Value <<= sCommand;
     716         [ #  # ]:          0 :                 props.push_back( aProp );
     717                 :          0 :             }
     718                 :            :         }
     719                 :          0 :         bool bBeginGroup = false;
     720 [ #  # ][ #  # ]:          0 :         if ( ! tbcd->ImportToolBarControl( helper, props, bBeginGroup, bIsMenuBar ) )
     721                 :          0 :             return false;
     722                 :            : 
     723         [ #  # ]:          0 :         TBCMenuSpecific* pMenu = tbcd->getMenuSpecific();
     724         [ #  # ]:          0 :         if ( pMenu )
     725                 :            :         {
     726                 :            :             OSL_TRACE("** control has a menu, name of toolbar with menu items is %s", rtl::OUStringToOString( pMenu->Name(), RTL_TEXTENCODING_UTF8 ).getStr() );
     727                 :            :             // search for CTB with the appropriate name ( it contains the
     728                 :            :             // menu items, although we cannot import ( or create ) a menu on
     729                 :            :             // a custom toolbar we can import the menu items in a separate
     730                 :            :             // toolbar ( better than nothing )
     731 [ #  # ][ #  # ]:          0 :             CTB* pCustTB = rWrapper.GetCustomizationData( pMenu->Name() );
     732         [ #  # ]:          0 :             if ( pCustTB )
     733                 :            :             {
     734                 :          0 :                  uno::Reference< container::XIndexContainer > xMenuDesc;
     735 [ #  # ][ #  # ]:          0 :                  uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
     736 [ #  # ][ #  # ]:          0 :                  xMenuDesc.set( xMSF->createInstance( "com.sun.star.document.IndexedPropertyValues" ), uno::UNO_QUERY_THROW );
                 [ #  # ]
     737 [ #  # ][ #  # ]:          0 :                 if ( !pCustTB->ImportMenuTB( rWrapper,xMenuDesc, helper ) )
     738                 :          0 :                     return false;
     739         [ #  # ]:          0 :                 if ( !bIsMenuBar )
     740                 :            :                 {
     741 [ #  # ][ #  # ]:          0 :                     if ( !helper.createMenu( pMenu->Name(), uno::Reference< container::XIndexAccess >( xMenuDesc, uno::UNO_QUERY ), true ) )
         [ #  # ][ #  # ]
     742                 :          0 :                         return false;
     743                 :            :                 }
     744                 :            :                 else
     745                 :            :                 {
     746                 :          0 :                     beans::PropertyValue aProp;
     747                 :          0 :                     aProp.Name = "ItemDescriptorContainer";
     748         [ #  # ]:          0 :                     aProp.Value <<= xMenuDesc;
     749         [ #  # ]:          0 :                     props.push_back( aProp );
     750 [ #  # ][ #  # ]:          0 :                 }
     751                 :            :             }
     752                 :            :         }
     753                 :            : 
     754         [ #  # ]:          0 :         if ( bBeginGroup )
     755                 :            :         {
     756                 :            :             // insert spacer
     757         [ #  # ]:          0 :             uno::Sequence< beans::PropertyValue > sProps( 1 );
     758         [ #  # ]:          0 :             sProps[ 0 ].Name = "Type";
     759 [ #  # ][ #  # ]:          0 :             sProps[ 0 ].Value = uno::makeAny( ui::ItemType::SEPARATOR_LINE );
     760 [ #  # ][ #  # ]:          0 :             toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
     761                 :            :         }
     762                 :            : 
     763         [ #  # ]:          0 :         uno::Sequence< beans::PropertyValue > sProps( props.size() );
     764         [ #  # ]:          0 :         beans::PropertyValue* pProp = sProps.getArray();
     765                 :            : 
     766 [ #  # ][ #  # ]:          0 :         for ( std::vector< css::beans::PropertyValue >::iterator it = props.begin(); it != props.end(); ++it, ++pProp )
     767                 :          0 :             *pProp = *it;
     768                 :            : 
     769 [ #  # ][ #  # ]:          0 :         toolbarcontainer->insertByIndex( toolbarcontainer->getCount(), uno::makeAny( sProps ) );
         [ #  # ][ #  # ]
         [ #  # ][ #  # ]
                 [ #  # ]
     770                 :            :     }
     771                 :          0 :     return true;
     772                 :            : }
     773                 :            : 
     774                 :            : rtl::OUString
     775                 :          0 : TBC::GetCustomText()
     776                 :            : {
     777                 :          0 :     rtl::OUString sCustomText;
     778         [ #  # ]:          0 :     if ( tbcd.get() )
     779                 :          0 :         sCustomText = tbcd->getGeneralInfo().CustomText();
     780                 :          0 :     return sCustomText;
     781                 :            : 
     782                 :            : 
     783                 :            : }
     784                 :            : 
     785                 :            : bool
     786                 :          3 : Xst::Read( SvStream& rS )
     787                 :            : {
     788                 :            :     OSL_TRACE("Xst::Read() stream pos 0x%x", rS.Tell() );
     789                 :          3 :     nOffSet = rS.Tell();
     790         [ +  - ]:          3 :     sString = read_uInt16_PascalString(rS);
     791                 :          3 :     return true;
     792                 :            : }
     793                 :            : 
     794                 :            : void
     795                 :          0 : Xst::Print( FILE* fp )
     796                 :            : {
     797         [ #  # ]:          0 :     Indent a;
     798         [ #  # ]:          0 :     indent_printf( fp, "[ 0x%x ] Xst -- dump\n", nOffSet );
     799 [ #  # ][ #  # ]:          0 :     indent_printf( fp, " %s",  rtl::OUStringToOString( sString, RTL_TEXTENCODING_UTF8 ).getStr() );
     800                 :          0 : }
     801                 :            : 
     802                 :         87 : Tcg::Tcg() : nTcgVer( -1 )
     803                 :            : {
     804                 :         87 : }
     805                 :            : 
     806                 :         87 : bool Tcg::Read(SvStream &rS)
     807                 :            : {
     808                 :            :     OSL_TRACE("Tcg::Read() stream pos 0x%x", rS.Tell() );
     809                 :         87 :     nOffSet = rS.Tell();
     810                 :         87 :     rS >> nTcgVer;
     811         [ +  + ]:         87 :     if ( nTcgVer != -1 )
     812                 :          6 :         return false;
     813         [ +  - ]:         81 :     tcg.reset( new Tcg255() );
     814                 :         87 :     return tcg->Read( rS );
     815                 :            : }
     816                 :            : 
     817                 :          0 : void Tcg::Print( FILE* fp )
     818                 :            : {
     819         [ #  # ]:          0 :     Indent a(true);
     820         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] Tcg - dump %d\n", nOffSet, nTcgVer);
     821         [ #  # ]:          0 :     indent_printf(fp,"  nTcgVer %d\n", nTcgVer);
     822         [ #  # ]:          0 :     if ( tcg.get() )
     823         [ #  # ]:          0 :         tcg->Print( fp );
     824                 :          0 : }
     825                 :            : 
     826                 :         78 : bool Tcg::ImportCustomToolBar( SfxObjectShell& rDocSh )
     827                 :            : {
     828         [ +  - ]:         78 :     if ( tcg.get() )
     829                 :         78 :         return tcg->ImportCustomToolBar( rDocSh );
     830                 :         78 :     return false;
     831                 :            : }
     832                 :            : 
     833         [ +  - ]:         81 : Tcg255::Tcg255()
     834                 :            : {
     835                 :         81 : }
     836                 :            : 
     837                 :         81 : Tcg255::~Tcg255()
     838                 :            : {
     839                 :         81 :     std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
     840 [ +  - ][ +  + ]:         96 :     for ( ; it != rgtcgData.end(); ++it )
     841 [ +  - ][ +  - ]:         15 :         delete *it;
     842         [ -  + ]:        162 : }
     843                 :            : 
     844                 :         18 : bool Tcg255::processSubStruct( sal_uInt8 nId, SvStream &rS )
     845                 :            : {
     846                 :         18 :      Tcg255SubStruct* pSubStruct = NULL;
     847   [ +  -  -  +  :         18 :      switch ( nId )
                +  -  + ]
     848                 :            :      {
     849                 :            :          case 0x1:
     850                 :            :          {
     851         [ +  - ]:          6 :              pSubStruct = new PlfMcd( false ); // don't read the id
     852                 :          6 :              break;
     853                 :            :          }
     854                 :            :          case 0x2:
     855                 :            :          {
     856         [ #  # ]:          0 :              pSubStruct = new PlfAcd( false );
     857                 :          0 :              break;
     858                 :            :          }
     859                 :            :          case 0x3:
     860                 :            :          case 0x4:
     861                 :            :          {
     862         [ #  # ]:          0 :              pSubStruct = new PlfKme( false );
     863                 :          0 :              break;
     864                 :            :          }
     865                 :            :          case 0x10:
     866                 :            :          {
     867 [ +  - ][ +  - ]:          6 :              pSubStruct = new TcgSttbf( false );
     868                 :          6 :              break;
     869                 :            :          }
     870                 :            :          case 0x11:
     871                 :            :          {
     872         [ +  - ]:          3 :              pSubStruct = new MacroNames( false );
     873                 :          3 :              break;
     874                 :            :          }
     875                 :            :          case 0x12:
     876                 :            :          {
     877 [ #  # ][ #  # ]:          0 :              pSubStruct = new CTBWrapper( false );
     878                 :          0 :              break;
     879                 :            :          }
     880                 :            :          default:
     881                 :            :              OSL_TRACE("Unknown id 0x%x",nId);
     882                 :          3 :              return false;
     883                 :            :     }
     884                 :         15 :     pSubStruct->ch = nId;
     885 [ +  - ][ -  + ]:         15 :     if ( !pSubStruct->Read( rS ) )
     886                 :          0 :         return false;
     887         [ +  - ]:         15 :     rgtcgData.push_back( pSubStruct );
     888                 :         18 :     return true;
     889                 :            : }
     890                 :            : 
     891                 :         78 : bool Tcg255::ImportCustomToolBar( SfxObjectShell& rDocSh )
     892                 :            : {
     893                 :            :     // Find the CTBWrapper
     894 [ +  - ][ +  - ]:         87 :     for ( std::vector< Tcg255SubStruct* >::const_iterator it = rgtcgData.begin(); it != rgtcgData.end(); ++it )
                 [ +  + ]
     895                 :            :     {
     896 [ +  - ][ -  + ]:          9 :         if ( (*it)->id() == 0x12 )
     897                 :            :         {
     898                 :            :             // not so great, shouldn't really have to do a horror casting
     899         [ #  # ]:          0 :             CTBWrapper* pCTBWrapper =  dynamic_cast< CTBWrapper* > ( *it );
     900         [ #  # ]:          0 :             if ( pCTBWrapper )
     901                 :            :             {
     902 [ #  # ][ #  # ]:          0 :                 if ( !pCTBWrapper->ImportCustomToolBar( rDocSh ) )
     903                 :          0 :                     return false;
     904                 :            :             }
     905                 :            :         }
     906                 :            :     }
     907                 :         78 :     return true;
     908                 :            : }
     909                 :            : 
     910                 :            : 
     911                 :         81 : bool Tcg255::Read(SvStream &rS)
     912                 :            : {
     913                 :            :     OSL_TRACE("Tcg255::Read() stream pos 0x%x", rS.Tell() );
     914                 :         81 :     nOffSet = rS.Tell();
     915                 :         81 :     sal_uInt8 nId = 0x40;
     916         [ +  - ]:         81 :     rS >> nId;
     917         [ +  + ]:         96 :     while (  nId != 0x40  )
     918                 :            :     {
     919 [ +  - ][ +  + ]:         18 :         if ( !processSubStruct( nId, rS ) )
     920                 :          3 :             return false;
     921                 :         15 :         nId = 0x40;
     922         [ +  - ]:         15 :         rS >> nId;
     923                 :            :     }
     924                 :         81 :     return true;
     925                 :            :     // Peek at
     926                 :            : }
     927                 :            : 
     928                 :          0 : void Tcg255::Print( FILE* fp)
     929                 :            : {
     930         [ #  # ]:          0 :     Indent a;
     931         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] Tcg255 - dump\n", nOffSet );
     932         [ #  # ]:          0 :     indent_printf(fp, "  contains %d sub records\n", rgtcgData.size() );
     933                 :          0 :     std::vector< Tcg255SubStruct* >::iterator it = rgtcgData.begin();
     934                 :          0 :     std::vector< Tcg255SubStruct* >::iterator it_end = rgtcgData.end();
     935                 :            : 
     936 [ #  # ][ #  # ]:          0 :     for( sal_Int32 count = 1; it != it_end ; ++it, ++count )
     937                 :            :     {
     938         [ #  # ]:          0 :         Indent b;
     939         [ #  # ]:          0 :         indent_printf(fp, "  [%d] Tcg255SubStruct \n", static_cast< unsigned int >( count ) );
     940         [ #  # ]:          0 :         (*it)->Print(fp);
     941                 :          0 :     }
     942                 :          0 : }
     943                 :            : 
     944                 :            : 
     945                 :         15 : Tcg255SubStruct::Tcg255SubStruct( bool bReadId ) : mbReadId( bReadId ), ch(0)
     946                 :            : {
     947                 :         15 : }
     948                 :            : 
     949                 :         15 : bool Tcg255SubStruct::Read(SvStream &rS)
     950                 :            : {
     951                 :            :     OSL_TRACE("Tcg255SubStruct::Read() stream pos 0x%x", rS.Tell() );
     952                 :         15 :     nOffSet = rS.Tell();
     953         [ -  + ]:         15 :     if ( mbReadId )
     954                 :          0 :         rS >> ch;
     955                 :         15 :     return true;
     956                 :            : }
     957                 :            : 
     958                 :          6 : PlfMcd::PlfMcd( bool bReadId ): Tcg255SubStruct( bReadId ), iMac(0), rgmcd( NULL )
     959                 :            : {
     960                 :          6 : }
     961                 :            : 
     962                 :          6 : PlfMcd::~PlfMcd()
     963                 :            : {
     964         [ +  - ]:          6 :     if ( rgmcd )
     965 [ +  - ][ +  + ]:         12 :         delete[] rgmcd;
                 [ +  - ]
     966         [ -  + ]:         12 : }
     967                 :            : 
     968                 :          6 : bool PlfMcd::Read(SvStream &rS)
     969                 :            : {
     970                 :            :     OSL_TRACE("PffMcd::Read() stream pos 0x%x", rS.Tell() );
     971                 :          6 :     nOffSet = rS.Tell();
     972                 :          6 :     Tcg255SubStruct::Read( rS );
     973                 :          6 :     rS >> iMac;
     974         [ +  - ]:          6 :     if ( iMac )
     975                 :            :     {
     976         [ +  + ]:         12 :         rgmcd = new MCD[ iMac ];
     977         [ +  + ]:         12 :         for ( sal_Int32 index = 0; index < iMac; ++index )
     978                 :            :         {
     979         [ -  + ]:          6 :             if ( !rgmcd[ index ].Read( rS ) )
     980                 :          0 :                 return false;
     981                 :            :         }
     982                 :            :     }
     983                 :          6 :     return true;
     984                 :            : }
     985                 :            : 
     986                 :          0 : void PlfMcd::Print( FILE* fp )
     987                 :            : {
     988         [ #  # ]:          0 :     Indent a;
     989         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] PlfMcd ( Tcg255SubStruct ) - dump\n", nOffSet );
     990         [ #  # ]:          0 :     indent_printf(fp, " contains %d MCD records\n", static_cast<int>( iMac ) );
     991         [ #  # ]:          0 :     for ( sal_Int32 count=0; count < iMac; ++count )
     992                 :            :     {
     993         [ #  # ]:          0 :         Indent b;
     994         [ #  # ]:          0 :         indent_printf(fp, "[%d] MCD\n", static_cast< int >( count ) );
     995         [ #  # ]:          0 :         rgmcd[ count ].Print( fp );
     996                 :          0 :     }
     997                 :            : 
     998                 :          0 : }
     999                 :            : 
    1000                 :          0 : PlfAcd::PlfAcd( bool bReadId ) : Tcg255SubStruct( bReadId )
    1001                 :            : ,iMac(0)
    1002                 :          0 : ,rgacd(NULL)
    1003                 :            : {
    1004                 :          0 : }
    1005                 :            : 
    1006                 :            : 
    1007                 :          0 : PlfAcd::~PlfAcd()
    1008                 :            : {
    1009         [ #  # ]:          0 :     if ( rgacd )
    1010 [ #  # ][ #  # ]:          0 :         delete[] rgacd;
                 [ #  # ]
    1011         [ #  # ]:          0 : }
    1012                 :            : 
    1013                 :          0 : bool PlfAcd::Read( SvStream &rS)
    1014                 :            : {
    1015                 :            :     OSL_TRACE("PffAcd::Read() stream pos 0x%x", rS.Tell() );
    1016                 :          0 :     nOffSet = rS.Tell();
    1017                 :          0 :     Tcg255SubStruct::Read( rS );
    1018                 :          0 :     rS >> iMac;
    1019         [ #  # ]:          0 :     if ( iMac )
    1020                 :            :     {
    1021         [ #  # ]:          0 :         rgacd = new Acd[ iMac ];
    1022         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < iMac; ++index )
    1023                 :            :         {
    1024         [ #  # ]:          0 :             if ( !rgacd[ index ].Read( rS ) )
    1025                 :          0 :                 return false;
    1026                 :            :         }
    1027                 :            :     }
    1028                 :          0 :     return true;
    1029                 :            : }
    1030                 :          0 : void PlfAcd::Print( FILE* fp )
    1031                 :            : {
    1032         [ #  # ]:          0 :     Indent a;
    1033         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] PlfAcd ( Tcg255SubStruct ) - dump\n", nOffSet );
    1034         [ #  # ]:          0 :     indent_printf(fp, " contains %d ACD records\n", static_cast< int >( iMac ) );
    1035         [ #  # ]:          0 :     for ( sal_Int32 count=0; count < iMac; ++count )
    1036                 :            :     {
    1037         [ #  # ]:          0 :         Indent b;
    1038         [ #  # ]:          0 :         indent_printf(fp, "[%d] ACD\n", static_cast< int >( count ) );
    1039         [ #  # ]:          0 :         rgacd[ count ].Print( fp );
    1040                 :          0 :     }
    1041                 :            : 
    1042                 :          0 : }
    1043                 :            : 
    1044                 :          0 : PlfKme::PlfKme( bool bReadId ) : Tcg255SubStruct( bReadId )
    1045                 :            : ,iMac( 0 )
    1046                 :          0 : ,rgkme( NULL )
    1047                 :            : {
    1048                 :          0 : }
    1049                 :            : 
    1050                 :          0 : PlfKme::~PlfKme()
    1051                 :            : {
    1052         [ #  # ]:          0 :     if ( rgkme )
    1053 [ #  # ][ #  # ]:          0 :         delete[] rgkme;
                 [ #  # ]
    1054         [ #  # ]:          0 : }
    1055                 :            : 
    1056                 :          0 : bool PlfKme::Read(SvStream &rS)
    1057                 :            : {
    1058                 :            :     OSL_TRACE("PlfKme::Read() stream pos 0x%x", rS.Tell() );
    1059                 :          0 :     nOffSet = rS.Tell();
    1060                 :          0 :     Tcg255SubStruct::Read( rS );
    1061                 :          0 :     rS >> iMac;
    1062         [ #  # ]:          0 :     if ( iMac )
    1063                 :            :     {
    1064         [ #  # ]:          0 :         rgkme = new Kme[ iMac ];
    1065         [ #  # ]:          0 :         for( sal_Int32 index=0; index<iMac; ++index )
    1066                 :            :         {
    1067         [ #  # ]:          0 :             if ( !rgkme[ index ].Read( rS ) )
    1068                 :          0 :                 return false;
    1069                 :            :         }
    1070                 :            :     }
    1071                 :          0 :     return true;
    1072                 :            : }
    1073                 :            : 
    1074                 :          0 : void PlfKme::Print( FILE* fp )
    1075                 :            : {
    1076         [ #  # ]:          0 :     Indent a;
    1077         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] PlfKme ( Tcg255SubStruct ) - dump\n", nOffSet );
    1078         [ #  # ]:          0 :     indent_printf(fp, " contains %d Kme records\n", static_cast< int >( iMac ) );
    1079         [ #  # ]:          0 :     for ( sal_Int32 count=0; count < iMac; ++count )
    1080                 :            :     {
    1081         [ #  # ]:          0 :         Indent b;
    1082         [ #  # ]:          0 :         indent_printf(fp, "[%d] Kme\n", static_cast< int >( count ) );
    1083         [ #  # ]:          0 :         rgkme[ count ].Print( fp );
    1084                 :          0 :     }
    1085                 :            : 
    1086                 :          0 : }
    1087                 :            : 
    1088                 :          6 : TcgSttbf::TcgSttbf( bool bReadId ) : Tcg255SubStruct( bReadId )
    1089                 :            : {
    1090                 :          6 : }
    1091                 :            : 
    1092                 :          6 : bool TcgSttbf::Read( SvStream &rS)
    1093                 :            : {
    1094                 :            :     OSL_TRACE("TcgSttbf::Read() stream pos 0x%x", rS.Tell() );
    1095                 :          6 :     nOffSet = rS.Tell();
    1096                 :          6 :     Tcg255SubStruct::Read( rS );
    1097                 :          6 :     return sttbf.Read( rS );
    1098                 :            : }
    1099                 :            : 
    1100                 :          0 : void TcgSttbf::Print( FILE* fp )
    1101                 :            : {
    1102         [ #  # ]:          0 :     Indent a;
    1103         [ #  # ]:          0 :     indent_printf(fp,"[ 0x%x ] TcgSttbf - dump\n", nOffSet );
    1104         [ #  # ]:          0 :     sttbf.Print( fp );
    1105                 :          0 : }
    1106                 :            : 
    1107                 :          6 : TcgSttbfCore::TcgSttbfCore() : fExtend( 0 )
    1108                 :            : ,cData( 0 )
    1109                 :            : ,cbExtra( 0 )
    1110                 :          6 : ,dataItems( NULL )
    1111                 :            : {
    1112                 :          6 : }
    1113                 :            : 
    1114                 :          6 : TcgSttbfCore::~TcgSttbfCore()
    1115                 :            : {
    1116         [ +  - ]:          6 :     if ( dataItems )
    1117 [ +  - ][ +  + ]:         12 :         delete[] dataItems;
    1118         [ -  + ]:          6 : }
    1119                 :            : 
    1120                 :          6 : bool TcgSttbfCore::Read( SvStream& rS )
    1121                 :            : {
    1122                 :            :     OSL_TRACE("TcgSttbfCore::Read() stream pos 0x%x", rS.Tell() );
    1123                 :          6 :     nOffSet = rS.Tell();
    1124                 :          6 :     rS >> fExtend >> cData >> cbExtra;
    1125         [ +  - ]:          6 :     if ( cData )
    1126                 :            :     {
    1127         [ +  + ]:         12 :         dataItems = new SBBItem[ cData ];
    1128         [ +  + ]:         12 :         for ( sal_Int32 index = 0; index < cData; ++index )
    1129                 :            :         {
    1130                 :          6 :             rS >> dataItems[ index ].cchData;
    1131                 :          6 :             dataItems[ index ].data = read_uInt16s_ToOUString(rS, dataItems[index].cchData);
    1132                 :          6 :             rS >> dataItems[ index ].extraData;
    1133                 :            :         }
    1134                 :            :     }
    1135                 :          6 :     return true;
    1136                 :            : }
    1137                 :            : 
    1138                 :          0 : void TcgSttbfCore::Print( FILE* fp )
    1139                 :            : {
    1140         [ #  # ]:          0 :     Indent a;
    1141         [ #  # ]:          0 :     indent_printf( fp, "[ 0x%x ] TcgSttbfCore - dump\n");
    1142         [ #  # ]:          0 :     indent_printf( fp, " fExtend 0x%x [expected 0xFFFF ]\n", fExtend );
    1143         [ #  # ]:          0 :     indent_printf( fp, " cbExtra 0x%x [expected 0x02 ]\n", cbExtra );
    1144         [ #  # ]:          0 :     indent_printf( fp, " cData no. or string data items %d (0x%x)\n", cData, cData );
    1145                 :            : 
    1146         [ #  # ]:          0 :     if ( cData )
    1147                 :            :     {
    1148         [ #  # ]:          0 :         for ( sal_Int32 index = 0; index < cData; ++index )
    1149 [ #  # ][ #  # ]:          0 :             indent_printf(fp,"   string dataItem[ %d(0x%x) ] has name %s and if referenced %d times.\n", static_cast< int >( index ), static_cast< unsigned int >( index ), rtl::OUStringToOString( dataItems[ index ].data, RTL_TEXTENCODING_UTF8 ).getStr(), dataItems[ index ].extraData );
    1150                 :          0 :     }
    1151                 :            : 
    1152                 :          0 : }
    1153                 :          3 : MacroNames::MacroNames( bool bReadId ) : Tcg255SubStruct( bReadId )
    1154                 :            : ,iMac( 0 )
    1155                 :          3 : ,rgNames( NULL )
    1156                 :            : {
    1157                 :          3 : }
    1158                 :            : 
    1159                 :          3 : MacroNames::~MacroNames()
    1160                 :            : {
    1161         [ +  - ]:          3 :     if ( rgNames )
    1162 [ +  - ][ +  + ]:          6 :         delete[] rgNames;
                 [ +  - ]
    1163         [ -  + ]:          6 : }
    1164                 :            : 
    1165                 :          3 : bool MacroNames::Read( SvStream &rS)
    1166                 :            : {
    1167                 :            :     OSL_TRACE("MacroNames::Read() stream pos 0x%x", rS.Tell() );
    1168                 :          3 :     nOffSet = rS.Tell();
    1169                 :          3 :     Tcg255SubStruct::Read( rS );
    1170                 :          3 :     rS >> iMac;
    1171         [ +  - ]:          3 :     if ( iMac )
    1172                 :            :     {
    1173 [ +  - ][ +  +  :          6 :         rgNames = new MacroName[ iMac ];
             #  #  #  # ]
    1174         [ +  + ]:          6 :         for ( sal_Int32 index = 0; index < iMac; ++index )
    1175                 :            :         {
    1176         [ -  + ]:          3 :             if ( !rgNames[ index ].Read( rS ) )
    1177                 :          0 :                 return false;
    1178                 :            :         }
    1179                 :            :     }
    1180                 :          3 :     return true;
    1181                 :            : }
    1182                 :            : 
    1183                 :          0 : void MacroNames::Print( FILE* fp )
    1184                 :            : {
    1185         [ #  # ]:          0 :     Indent a;
    1186         [ #  # ]:          0 :     indent_printf(fp, "[ 0x%x ] MacroNames ( Tcg255SubStruct ) - dump\n");
    1187         [ #  # ]:          0 :     indent_printf(fp, " contains %d MacroName records\n", iMac );
    1188         [ #  # ]:          0 :     for ( sal_Int32 count=0; count < iMac; ++count )
    1189                 :            :     {
    1190         [ #  # ]:          0 :         Indent b;
    1191         [ #  # ]:          0 :         indent_printf(fp, "[%d] MacroName\n", static_cast<int>( count ) );
    1192         [ #  # ]:          0 :         rgNames[ count ].Print( fp );
    1193                 :          0 :     }
    1194                 :            : 
    1195                 :          0 : }
    1196                 :            : 
    1197         [ +  - ]:          3 : MacroName::MacroName():ibst(0)
    1198                 :            : {
    1199                 :          3 : }
    1200                 :            : 
    1201                 :            : 
    1202                 :          3 : bool MacroName::Read(SvStream &rS)
    1203                 :            : {
    1204                 :            :     OSL_TRACE("MacroName::Read() stream pos 0x%x", rS.Tell() );
    1205                 :          3 :     nOffSet = rS.Tell();
    1206                 :          3 :     rS >> ibst;
    1207                 :          3 :     return xstz.Read( rS );
    1208                 :            : }
    1209                 :            : 
    1210                 :          0 : void MacroName::Print( FILE* fp )
    1211                 :            : {
    1212         [ #  # ]:          0 :     Indent a;
    1213         [ #  # ]:          0 :     indent_printf( fp, "[ 0x%x ] MacroName - dump");
    1214         [ #  # ]:          0 :     indent_printf( fp,"  index - 0x%x has associated following record\n", ibst );
    1215         [ #  # ]:          0 :     xstz.Print( fp );
    1216                 :          0 : }
    1217                 :            : 
    1218                 :            : 
    1219                 :            : 
    1220                 :          3 : Xstz::Xstz():chTerm(0)
    1221                 :            : {
    1222                 :          3 : }
    1223                 :            : 
    1224                 :            : bool
    1225                 :          3 : Xstz::Read(SvStream &rS)
    1226                 :            : {
    1227                 :            :     OSL_TRACE("Xstz::Read() stream pos 0x%x", rS.Tell() );
    1228                 :          3 :     nOffSet = rS.Tell();
    1229         [ -  + ]:          3 :     if ( !xst.Read( rS ) )
    1230                 :          0 :         return false;
    1231                 :          3 :     rS >> chTerm;
    1232         [ -  + ]:          3 :     if ( chTerm != 0 ) // should be an assert
    1233                 :          0 :         return false;
    1234                 :          3 :     return true;
    1235                 :            : }
    1236                 :            : 
    1237                 :          0 : void Xstz::Print( FILE* fp )
    1238                 :            : {
    1239         [ #  # ]:          0 :     Indent a;
    1240         [ #  # ]:          0 :     indent_printf(fp,"[ 0x%x ] Xstz -- dump\n", nOffSet );
    1241         [ #  # ]:          0 :     indent_printf(fp,"  Xst\n");
    1242         [ #  # ]:          0 :     xst.Print( fp );
    1243         [ #  # ]:          0 :     indent_printf(fp,"  chterm 0x%x ( should be zero )\n", chTerm);
    1244                 :          0 : }
    1245                 :            : 
    1246                 :          0 : Kme::Kme() : reserved1(0)
    1247                 :            : ,reserved2(0)
    1248                 :            : ,kcm1(0)
    1249                 :            : ,kcm2(0)
    1250                 :            : ,kt(0)
    1251                 :          0 : ,param(0)
    1252                 :            : {
    1253                 :          0 : }
    1254                 :            : 
    1255                 :          0 : Kme::~Kme()
    1256                 :            : {
    1257         [ #  # ]:          0 : }
    1258                 :            : 
    1259                 :            : bool
    1260                 :          0 : Kme::Read(SvStream &rS)
    1261                 :            : {
    1262                 :            :     OSL_TRACE("Kme::Read() stream pos 0x%x", rS.Tell() );
    1263                 :          0 :     nOffSet = rS.Tell();
    1264                 :          0 :     rS >> reserved1 >> reserved2 >> kcm1 >> kcm2 >> kt >> param;
    1265                 :          0 :     return true;
    1266                 :            : }
    1267                 :            : 
    1268                 :          0 : void Kme::Print( FILE* fp )
    1269                 :            : {
    1270         [ #  # ]:          0 :     Indent a;
    1271                 :            : 
    1272         [ #  # ]:          0 :    indent_printf( fp, "[ 0x%x ] Kme - dump\n", nOffSet );
    1273         [ #  # ]:          0 :    indent_printf( fp, " reserved1 0x%x [expected 0x0 ]\n", reserved1 );
    1274         [ #  # ]:          0 :    indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
    1275         [ #  # ]:          0 :    indent_printf( fp, " kcm1 0x%x [shortcut key]\n", kcm1 );
    1276         [ #  # ]:          0 :    indent_printf( fp, " kcm2 0x%x [shortcut key]\n", kcm2 );
    1277         [ #  # ]:          0 :    indent_printf( fp, " kt 0x%x \n", kt );
    1278         [ #  # ]:          0 :    indent_printf( fp, " param 0x%x \n", static_cast< unsigned int >( param ) );
    1279                 :          0 : }
    1280                 :            : 
    1281                 :          0 : Acd::Acd() : ibst( 0 )
    1282                 :          0 : , fciBasedOnABC( 0 )
    1283                 :            : {
    1284                 :          0 : }
    1285                 :            : 
    1286                 :          0 : bool Acd::Read(SvStream &rS)
    1287                 :            : {
    1288                 :            :     OSL_TRACE("Acd::Read() stream pos 0x%x", rS.Tell() );
    1289                 :          0 :     nOffSet = rS.Tell();
    1290                 :          0 :     rS >> ibst >> fciBasedOnABC;
    1291                 :          0 :     return true;
    1292                 :            : }
    1293                 :            : 
    1294                 :          0 : void Acd::Print( FILE* fp )
    1295                 :            : {
    1296         [ #  # ]:          0 :     Indent a;
    1297         [ #  # ]:          0 :     indent_printf( fp,"[ 0x%x ] ACD - dump\n", nOffSet );
    1298                 :            :     // #TODO flesh out interpretation of these values
    1299         [ #  # ]:          0 :     indent_printf( fp,"  ibst 0x%x\n", ibst);
    1300         [ #  # ]:          0 :     indent_printf( fp,"  fciBaseObABC 0x%x\n", fciBasedOnABC);
    1301                 :          0 : }
    1302                 :            : 
    1303                 :          6 : MCD::MCD() :  reserved1(0x56)
    1304                 :            : ,reserved2( 0 )
    1305                 :            : ,ibst( 0 )
    1306                 :            : ,ibstName( 0 )
    1307                 :            : ,reserved3( 0xFFFF )
    1308                 :            : ,reserved4( 0 )
    1309                 :            : ,reserved5( 0 )
    1310                 :            : ,reserved6( 0 )
    1311                 :          6 : ,reserved7( 0 )
    1312                 :            : {
    1313                 :          6 : }
    1314                 :            : 
    1315                 :          6 : bool  MCD::Read(SvStream &rS)
    1316                 :            : {
    1317                 :            :     OSL_TRACE("MCD::Read() stream pos 0x%x", rS.Tell() );
    1318                 :          6 :     nOffSet = rS.Tell();
    1319                 :          6 :     rS >> reserved1 >> reserved2 >> ibst >> ibstName >> reserved3;
    1320                 :          6 :     rS >> reserved4 >> reserved5 >> reserved6 >> reserved7;
    1321                 :          6 :     return true;
    1322                 :            : }
    1323                 :            : 
    1324                 :          0 : void MCD::Print( FILE* fp )
    1325                 :            : {
    1326         [ #  # ]:          0 :     Indent a;
    1327         [ #  # ]:          0 :     indent_printf( fp, "[ 0x%x ] MCD - dump\n", nOffSet );
    1328         [ #  # ]:          0 :     indent_printf( fp, " reserved1 0x%x [expected 0x56 ]\n", reserved1 );
    1329         [ #  # ]:          0 :     indent_printf( fp, " reserved2 0x%x [expected 0x0 ]\n", reserved2 );
    1330         [ #  # ]:          0 :     indent_printf( fp, " ibst 0x%x specifies macro with MacroName.xstz = 0x%x\n", ibst, ibst );
    1331         [ #  # ]:          0 :     indent_printf( fp, " ibstName 0x%x index into command string table ( TcgSttbf.sttbf )\n", ibstName );
    1332                 :            : 
    1333         [ #  # ]:          0 :     indent_printf( fp, " reserved3 0x%x [expected 0xFFFF ]\n", reserved3 );
    1334         [ #  # ]:          0 :     indent_printf( fp, " reserved4 0x%x\n", static_cast< unsigned int >( reserved4 ) );
    1335         [ #  # ]:          0 :     indent_printf( fp, " reserved5 0x%x [expected 0x0 ]\n", static_cast< unsigned int >( reserved5 ) );
    1336         [ #  # ]:          0 :     indent_printf( fp, " reserved6 0x%x\n", static_cast< unsigned int >( reserved6 ) );
    1337         [ #  # ]:          0 :     indent_printf( fp, " reserved7 0x%x\n", static_cast< unsigned int >( reserved7 ) );
    1338                 :          0 : }
    1339                 :            : 
    1340                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10