ooo-build r11295 - trunk/patches/test



Author: kyoshida
Date: Thu Jan 17 04:37:52 2008
New Revision: 11295
URL: http://svn.gnome.org/viewvc/ooo-build?rev=11295&view=rev

Log:
updated on-going test patch.

Modified:
   trunk/patches/test/sc-book-n-sheet-protection-test.diff

Modified: trunk/patches/test/sc-book-n-sheet-protection-test.diff
==============================================================================
--- trunk/patches/test/sc-book-n-sheet-protection-test.diff	(original)
+++ trunk/patches/test/sc-book-n-sheet-protection-test.diff	Thu Jan 17 04:37:52 2008
@@ -1,3 +1,7 @@
+? sc/runtime.log
+? sc/runtime2.log
+? sc/runtime3.log
+? sc/sc.diff
 ? sc/sc.vpj
 ? sc/sc_project.sca
 Index: sc/inc/document.hxx
@@ -1043,10 +1047,18 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/excel/excdoc.cxx,v
 retrieving revision 1.67
-retrieving revision 1.67.124.3
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.67 -r1.67.124.3
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.67 excdoc.cxx
 --- sc/source/filter/excel/excdoc.cxx	22 May 2007 19:44:28 -0000	1.67
-+++ sc/source/filter/excel/excdoc.cxx	5 Jan 2008 06:16:08 -0000	1.67.124.3
++++ sc/source/filter/excel/excdoc.cxx	17 Jan 2008 04:07:06 -0000
+@@ -35,7 +35,7 @@
+ 
+ // MARKER(update_precomp.py): autogen include statement, do not remove
+ #include "precompiled_sc.hxx"
+-
++#include <stdio.h>
+ 
+ //------------------------------------------------------------------------
+ 
 @@ -111,6 +111,8 @@
  #include "XclExpChangeTrack.hxx"
  #endif
@@ -1056,7 +1068,31 @@
  
  static String lcl_GetVbaTabName( SCTAB n )
  {
-@@ -206,9 +208,14 @@
+@@ -176,7 +178,22 @@
+ 		Add( new ExcDummy_00 );
+ 	else
+ 	{
+-		Add( new ExcDummy8_00a );
++        if ( IsPasswordProtected() )
++        {
++            // TODO: Using the new encrypter class, I need to generate these
++            // three values from the password.  Right now, the user supplied
++            // password is ignored and the default pass 'VelvetSweatShop' is 
++            // used.
++
++            Add( new XclExpFilePass(GetRoot()) ); // 002F
++
++        }
++
++		Add( new ExcDummy8_00a ); // 005C
++        Add( new XclExpCodePage );
++        Add( new XclExpDSF );
++        // TODO: code page 0x0042 (2)
++        // TODO: DSF (2)
+ 		rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
+ 		Add( rR.pTabId );
+         if( HasVbaStorage() )
+@@ -206,9 +223,14 @@
          aRecList.AppendRecord( CreateRecord( EXC_ID_NAME ) );
      }
  
@@ -1074,7 +1110,7 @@
  
      if( GetBiff() == EXC_BIFF8 )
          Add( new ExcDummy8_040 );
-@@ -346,8 +353,14 @@
+@@ -346,8 +368,14 @@
      // page settings (SETUP and various other records)
      aRecList.AppendRecord( xPageSett );
  
@@ -1091,7 +1127,7 @@
  
      // local link table: EXTERNCOUNT, EXTERNSHEET
      if( eBiff <= EXC_BIFF5 )
-@@ -393,6 +406,9 @@
+@@ -393,6 +421,9 @@
  
      if( eBiff == EXC_BIFF8 )
  	{
@@ -1339,6 +1375,365 @@
                  }
              }
              break;
+Index: sc/source/filter/excel/xerecord.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/excel/xerecord.cxx,v
+retrieving revision 1.9
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.9 xerecord.cxx
+--- sc/source/filter/excel/xerecord.cxx	22 May 2007 19:48:13 -0000	1.9
++++ sc/source/filter/excel/xerecord.cxx	17 Jan 2008 04:07:06 -0000
+@@ -164,6 +164,7 @@
+     // EOF record
+     rStrm.StartRecord( EXC_ID_EOF, 0 );
+     rStrm.EndRecord();
++    rStrm.DisableEncryption();
+ }
+ 
+ // ============================================================================
+Index: sc/source/filter/excel/xeroot.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/excel/xeroot.cxx,v
+retrieving revision 1.22
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.22 xeroot.cxx
+--- sc/source/filter/excel/xeroot.cxx	23 Oct 2007 14:44:34 -0000	1.22
++++ sc/source/filter/excel/xeroot.cxx	17 Jan 2008 04:07:06 -0000
+@@ -40,9 +40,9 @@
+ #include "xeroot.hxx"
+ #endif
+ 
+-#ifndef _SFXDOCFILE_HXX
+ #include <sfx2/docfile.hxx>
+-#endif
++#include <sfx2/sfxsids.hrc>
++
+ #ifndef INCLUDED_SVTOOLS_SAVEOPT_HXX
+ #include <svtools/saveopt.hxx>
+ #endif
+@@ -251,6 +251,35 @@
+     return xRec;
+ }
+ 
++bool XclExpRoot::IsPasswordProtected() const
++{
++    String aPass = GetPassword();
++    return aPass.Len() > 0;
++}
++
++const String XclExpRoot::GetPassword() const
++{
++    do
++    {
++        SfxItemSet* pSet = GetMedium().GetItemSet();
++        if (!pSet)
++            break;
++
++        const SfxPoolItem* pItem = NULL;
++        if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
++            break;
++
++        const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
++        if (!pStrItem)
++            break;
++
++        return pStrItem->GetValue();
++    }
++    while (false);
++
++    return String();
++}
++
+ XclExpRootData::XclExpLinkMgrRef XclExpRoot::GetLocalLinkMgrRef() const
+ {
+     return IsInGlobals() ? mrExpData.mxGlobLinkMgr : mrExpData.mxLocLinkMgr;
+Index: sc/source/filter/excel/xestream.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/excel/xestream.cxx,v
+retrieving revision 1.10
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.10 xestream.cxx
+--- sc/source/filter/excel/xestream.cxx	27 Feb 2007 12:25:23 -0000	1.10
++++ sc/source/filter/excel/xestream.cxx	17 Jan 2008 04:07:06 -0000
+@@ -97,6 +97,67 @@
+     mnSliceSize = 0;
+ }
+ 
++XclExpStream& XclExpStream::operator<<( sal_Int8 nValue )
++{
++    PrepareWrite( 1 );
++    mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( sal_uInt8 nValue )
++{
++    PrepareWrite( 1 );
++    mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( sal_Int16 nValue )
++{
++    PrepareWrite( 2 );
++    mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( sal_uInt16 nValue )
++{
++    PrepareWrite( 2 );
++    if (mbUseEncrypter && HasValidEncrypter())
++    {
++        mxEncrypter->Encrypt(mrStrm, nValue);
++    }
++    else
++        mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( sal_Int32 nValue )
++{
++    PrepareWrite( 4 );
++    mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
++{
++    PrepareWrite( 4 );
++    mrStrm << nValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( float fValue )
++{
++    PrepareWrite( 4 );
++    mrStrm << fValue;
++    return *this;
++}
++
++XclExpStream& XclExpStream::operator<<( double fValue )
++{
++    PrepareWrite( 8 );
++    mrStrm << fValue;
++    return *this;
++}
++
+ sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes )
+ {
+     sal_Size nRet = 0;
+@@ -249,6 +310,26 @@
+     Write( &rBuffer[ 0 ], rBuffer.size() );
+ }
+ 
++void XclExpStream::SetEncrypter( XclExpEncrypterRef xEncrypter )
++{
++    mxEncrypter = xEncrypter;
++}
++
++bool XclExpStream::HasValidEncrypter() const
++{
++    return mxEncrypter.is() && mxEncrypter->IsValid();
++}
++
++void XclExpStream::EnableEncryption( bool bEnable )
++{
++    mbUseEncrypter = bEnable && HasValidEncrypter();
++}
++
++void XclExpStream::DisableEncryption()
++{
++    EnableEncryption(false);
++}
++
+ sal_Size XclExpStream::SetSvStreamPos( sal_Size nPos )
+ {
+     DBG_ASSERT( !mbInRec, "XclExpStream::SetSvStreamPos - not allowed inside of a record" );
+@@ -327,6 +408,7 @@
+ 
+ void XclExpStream::WriteRawZeroBytes( sal_Size nBytes )
+ {
++    fprintf(stdout, "XclExpStream::WriteRawZeroBytes: --begin\n");fflush(stdout);
+     const sal_uInt32 nData = 0;
+     sal_Size nBytesLeft = nBytes;
+     while( nBytesLeft >= sizeof( nData ) )
+@@ -340,3 +422,178 @@
+ 
+ // ============================================================================
+ 
++XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16],
++                                            const sal_uInt8 nSalt[16], const sal_uInt8 nSaltHash[16] ) :
++    mrRoot(rRoot),
++    mnOldPos(STREAM_SEEK_TO_END),
++    mnRecSize(0),
++    mbValid(false)
++{
++    fprintf(stdout, "XclExpBiff8Encrypter::XclExpBiff8Encrypter: real password is '%s', but I'm using the default password for now.\n",
++            OUStringToOString(rtl::OUString(mrRoot.GetPassword()), RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
++    Init(String::CreateFromAscii("VelvetSweatshop"), nDocId, nSalt, nSaltHash);
++}
++
++XclExpBiff8Encrypter::~XclExpBiff8Encrypter()
++{
++}
++
++bool XclExpBiff8Encrypter::IsValid() const
++{
++    return mbValid;
++}
++
++void XclExpBiff8Encrypter::Update( SvStream& rStrm, sal_uInt16 nRecSize )
++{
++    if ( IsValid() )
++    {
++        sal_Size nNewPos = rStrm.Tell();
++        if( (mnOldPos != nNewPos) || (mnRecSize != nRecSize) )
++        {
++            OnUpdate( mnOldPos, nNewPos, nRecSize );
++            mnOldPos = nNewPos;
++            mnRecSize = nRecSize;
++        }
++    }
++}
++
++void XclExpBiff8Encrypter::OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 /*nRecSize*/ )
++{
++    if( nNewStrmPos != nOldStrmPos )
++    {
++        sal_uInt32 nOldBlock = GetBlock( nOldStrmPos );
++        sal_uInt16 nOldOffset = GetOffset( nOldStrmPos );
++
++        sal_uInt32 nNewBlock = GetBlock( nNewStrmPos );
++        sal_uInt16 nNewOffset = GetOffset( nNewStrmPos );
++
++        /*  Rekey cipher, if block changed or if previous offset in same block. */
++        if( (nNewBlock != nOldBlock) || (nNewOffset < nOldOffset) )
++        {
++            maCodec.InitCipher( nNewBlock );
++            nOldOffset = 0;     // reset nOldOffset for next if() statement
++        }
++
++        /*  Seek to correct offset. */
++        if( nNewOffset > nOldOffset )
++        {
++            maCodec.Skip( nNewOffset - nOldOffset );
++        }
++    }
++}
++
++sal_uInt32 XclExpBiff8Encrypter::GetBlock( sal_Size nStrmPos ) const
++{
++    return static_cast< sal_uInt32 >( nStrmPos / EXC_ENCR_BLOCKSIZE );
++}
++
++sal_uInt16 XclExpBiff8Encrypter::GetOffset( sal_Size nStrmPos ) const
++{
++    return static_cast< sal_uInt16 >( nStrmPos % EXC_ENCR_BLOCKSIZE );
++}
++
++void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16& nData )
++{
++    fprintf(stdout, "XclExpBiff8Encrypter::Encrypt: stream pos = %ld\n", rStrm.Tell());fflush(stdout);
++    maCodec.InitCipher(0);
++    maCodec.Skip(214);
++    ::std::vector<sal_uInt8> pnBytes(2);
++    pnBytes[0] = nData & 0xFF;
++    pnBytes[1] = (nData >> 8) & 0xFF;
++    fprintf(stdout, "RAW: ");
++    for (sal_uInt16 i = 0; i < 2; ++i)
++        fprintf(stdout, "%2.2X ", pnBytes[i]);
++    fprintf(stdout, "\n");
++
++    if (!maCodec.Encode(&pnBytes[0], 2, &pnBytes[0], 2))
++    {
++        fprintf(stdout, "XclExpBiff8Encrypter::Encrypt: encoding failed\n");fflush(stdout);
++        return;
++    }
++
++    fprintf(stdout, "ENC: ");
++    for (sal_uInt16 i = 0; i < 2; ++i)
++    {
++        fprintf(stdout, "%2.2X ", pnBytes[i]);
++        rStrm << pnBytes[i];
++    }
++    fprintf(stdout, "\n");
++#if 0    
++    sal_uInt8* pnCurrData = pnData;
++    sal_uInt16 nBytesLeft = nBytes;
++    while ( nBytesLeft )
++    {
++        sal_uInt16 nBlockLeft = EXC_ENCR_BLOCKSIZE - GetOffset( rStrm.Tell() );
++        sal_uInt16 nDecBytes = ::std::min< sal_uInt16 >( nBytesLeft, nBlockLeft );
++//      fprintf(stdout, "XclImpBiff8Decrypter::OnRead:   nDecBytes = %d\n", nDecBytes);fflush(stdout);
++
++        // read the block from stream
++        nRet = nRet + static_cast< sal_uInt16 >( rStrm.Read( pnCurrData, nDecBytes ) );
++//      fprintf(stdout, "RAW: ");
++//      for (sal_uInt16 i = 0; i < nDecBytes; ++i)
++//          fprintf(stdout, "%2.2x ", pnCurrData[i]);
++//      fprintf(stdout, "\n");
++
++        // decode the block inplace
++        maCodec.Decode( pnCurrData, nDecBytes, pnCurrData, nDecBytes );
++        fprintf(stdout, "DEC: ");
++        for (sal_uInt16 i = 0; i < nDecBytes; ++i)
++            fprintf(stdout, "%2.2x ", pnCurrData[i]);
++        fprintf(stdout, "\n");
++
++//      if (nDecBytes)
++//      {
++//          ::std::vector<sal_uInt8> pnEncData(nDecBytes);
++//          bool result = maCodec2.Encode(pnCurrData, nDecBytes, &pnEncData[0], nDecBytes);
++//          if (result)
++//          {
++//              fprintf(stdout, "re-encoded bytes:\n");
++//              for (sal_uInt16 i = 0; i < nDecBytes; ++i)
++//                  fprintf(stdout, "%2.2x ", pnEncData.at(i));
++//              fprintf(stdout, "\n");
++//          }
++//          else
++//          {
++//              fprintf(stdout, "re-encoding failed\n");
++//          }
++//      }
++
++        if ( GetOffset( rStrm.Tell() ) == 0 )
++        {
++            maCodec.InitCipher( GetBlock( rStrm.Tell() ) );
++            maCodec2.InitCipher( GetBlock( rStrm.Tell() ) );
++        }
++
++        pnCurrData += nDecBytes;
++        nBytesLeft = nBytesLeft - nDecBytes;
++    }
++#endif    
++}
++
++void XclExpBiff8Encrypter::Init( const String& aPass, const sal_uInt8 nDocId[16],
++                                 const sal_uInt8 nSalt[16], const sal_uInt8 nSaltHash[16] )
++{
++    fprintf(stdout, "XclExpBiff8Encrypter::Init: TODO: implement this! (password = '%s')\n",
++            OUStringToOString(rtl::OUString(aPass), RTL_TEXTENCODING_UTF8).getStr());
++    fflush(stdout);
++
++    xub_StrLen nLen = aPass.Len();
++    bool bValid = (0 < nLen) && (nLen < 16);
++    if ( bValid )
++    {
++        // transform String to sal_uInt16 array
++        memset(mnPassw, 0, sizeof(mnPassw));
++        for (xub_StrLen nChar = 0; nChar < nLen; ++nChar)
++            mnPassw[nChar] = static_cast<sal_uInt16>(aPass.GetChar(nChar));
++
++        // copy document ID
++        memcpy(mnDocId, nDocId, sizeof(mnDocId));
++
++        // init codec
++        maCodec.InitKey(mnPassw, mnDocId);
++        bValid = maCodec.VerifyKey(nSalt, nSaltHash);
++    }
++
++    fprintf(stdout, "XclExpBiff8Encrypter::Init: is valid? (%s)\n", bValid?"yes":"no");fflush(stdout);
++    mbValid = bValid;
++}
 Index: sc/source/filter/excel/xetable.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/excel/xetable.cxx,v
@@ -1357,10 +1752,9 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/excel/xicontent.cxx,v
 retrieving revision 1.29
-retrieving revision 1.29.42.6
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.29 -r1.29.42.6
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.29 xicontent.cxx
 --- sc/source/filter/excel/xicontent.cxx	2 Aug 2007 13:31:10 -0000	1.29
-+++ sc/source/filter/excel/xicontent.cxx	5 Jan 2008 06:16:08 -0000	1.29.42.6
++++ sc/source/filter/excel/xicontent.cxx	17 Jan 2008 04:07:06 -0000
 @@ -147,6 +147,13 @@
  #endif
  
@@ -1375,23 +1769,7 @@
  
  // Shared string table ========================================================
  
-@@ -1005,6 +1012,7 @@
- 
- XclImpDecrypterRef lclReadFilepass5( XclImpStream& rStrm )
- {
-+    fprintf(stdout, "lclReadFilepass5: --begin\n");fflush(stdout);
-     XclImpDecrypterRef xDecr;
-     DBG_ASSERT( rStrm.GetRecLeft() == 4, "lclReadFilepass5 - wrong record size" );
-     if( rStrm.GetRecLeft() == 4 )
-@@ -1018,6 +1026,7 @@
- 
- XclImpDecrypterRef lclReadFilepass8_Standard( XclImpStream& rStrm )
- {
-+    fprintf(stdout, "lclReadFilepass8_Standard: \n");fflush(stdout);
-     XclImpDecrypterRef xDecr;
-     DBG_ASSERT( rStrm.GetRecLeft() == 48, "lclReadFilepass8 - wrong record size" );
-     if( rStrm.GetRecLeft() == 48 )
-@@ -1026,8 +1035,20 @@
+@@ -1026,8 +1033,20 @@
          sal_uInt8 pnSaltData[ 16 ];
          sal_uInt8 pnSaltHash[ 16 ];
          rStrm.Read( pnDocId, 16 );
@@ -1412,22 +1790,7 @@
          xDecr.reset( new XclImpBiff8Decrypter(
              rStrm.GetRoot(), pnDocId, pnSaltData, pnSaltHash ) );
      }
-@@ -1036,12 +1057,14 @@
- 
- XclImpDecrypterRef lclReadFilepass8_Strong( XclImpStream& /*rStrm*/ )
- {
-+    fprintf(stdout, "lclReadFilepass8_Strong: \n");fflush(stdout);
-     // not supported
-     return XclImpDecrypterRef();
- }
- 
- XclImpDecrypterRef lclReadFilepass8( XclImpStream& rStrm )
- {
-+    fprintf(stdout, "lclReadFilepass8: \n");fflush(stdout);
-     XclImpDecrypterRef xDecr;
- 
-     sal_uInt16 nMode;
-@@ -1084,6 +1107,7 @@
+@@ -1084,6 +1103,7 @@
  
  ErrCode XclImpDecryptHelper::ReadFilepass( XclImpStream& rStrm )
  {
@@ -1435,7 +1798,7 @@
      XclImpDecrypterRef xDecr;
      rStrm.DisableDecryption();
  
-@@ -1100,9 +1124,177 @@
+@@ -1100,9 +1120,177 @@
      rStrm.SetDecrypter( xDecr );
      // remember encryption for export
      rStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
@@ -1472,7 +1835,7 @@
 +
 +void XclImpDocProtectBuffer::Apply() const
 +{
-+    fprintf(stdout, "XclImpDocProtectBuffer::Apply: structure = %d  window = %d  passhash = %d\n",
++    fprintf(stdout, "XclImpDocProtectBuffer::Apply: structure = %d  window = %d  passhash = %4.4X\n",
 +            mbDocProtect, mbWinProtect, mnPassHash);fflush(stdout);
 +
 +    if (!mbDocProtect && !mbWinProtect)
@@ -1654,10 +2017,9 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/excel/xistream.cxx,v
 retrieving revision 1.21
-retrieving revision 1.21.164.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.21 -r1.21.164.1
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.21 xistream.cxx
 --- sc/source/filter/excel/xistream.cxx	27 Feb 2007 12:28:06 -0000	1.21
-+++ sc/source/filter/excel/xistream.cxx	3 Jan 2008 16:57:34 -0000	1.21.164.1
++++ sc/source/filter/excel/xistream.cxx	17 Jan 2008 04:07:06 -0000
 @@ -49,6 +49,9 @@
  #include "xiroot.hxx"
  #endif
@@ -1676,7 +2038,7 @@
      }
  }
  
-@@ -216,17 +220,23 @@
+@@ -216,17 +220,24 @@
          if( (nNewBlock != nOldBlock) || (nNewOffset < nOldOffset) )
          {
              maCodec.InitCipher( nNewBlock );
@@ -1695,16 +2057,17 @@
  
  sal_uInt16 XclImpBiff8Decrypter::OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes )
  {
-+    fprintf(stdout, "XclImpBiff8Decrypter::OnRead: --begin (bytes to read = %d) ------------------------------\n", nBytes);fflush(stdout);
++//  fprintf(stdout, "XclImpBiff8Decrypter::OnRead: --begin (bytes to read = %d; pos = %ld) ------------------------------\n",
++//          nBytes, rStrm.Tell());fflush(stdout);
 +
      sal_uInt16 nRet = 0;
  
      sal_uInt8* pnCurrData = pnData;
-@@ -235,13 +245,44 @@
+@@ -235,13 +246,44 @@
      {
          sal_uInt16 nBlockLeft = EXC_ENCR_BLOCKSIZE - GetOffset( rStrm.Tell() );
          sal_uInt16 nDecBytes = ::std::min< sal_uInt16 >( nBytesLeft, nBlockLeft );
-+        fprintf(stdout, "XclImpBiff8Decrypter::OnRead:   nDecBytes = %d\n", nDecBytes);fflush(stdout);
++//      fprintf(stdout, "XclImpBiff8Decrypter::OnRead:   nDecBytes = %d\n", nDecBytes);fflush(stdout);
  
          // read the block from stream
          nRet = nRet + static_cast< sal_uInt16 >( rStrm.Read( pnCurrData, nDecBytes ) );
@@ -1745,7 +2108,7 @@
  
          pnCurrData += nDecBytes;
          nBytesLeft = nBytesLeft - nDecBytes;
-@@ -254,6 +295,8 @@
+@@ -254,6 +296,8 @@
          const String& rPass, sal_uInt8 pnDocId[ 16 ],
          sal_uInt8 pnSaltData[ 16 ], sal_uInt8 pnSaltHash[ 16 ] )
  {
@@ -1754,7 +2117,7 @@
      xub_StrLen nLen = rPass.Len();
      bool bValid = (0 < nLen) && (nLen < 16);
  
-@@ -268,6 +311,8 @@
+@@ -268,6 +312,8 @@
          // init codec
          maCodec.InitKey( mpnPassw, mpnDocId );
          bValid = maCodec.VerifyKey( pnSaltData, pnSaltHash );
@@ -1763,19 +2126,7 @@
      }
  
      SetHasValidPassword( bValid );
-@@ -461,6 +506,11 @@
- void XclImpStream::EnableDecryption( bool bEnable )
- {
-     mbUseDecr = bEnable && HasValidDecrypter();
-+//  fprintf(stdout, "XclImpStream::EnableDecryption: (%s)\n", mbUseDecr?"true":"false");fflush(stdout);
-+//  if (!mbUseDecr)
-+//  {
-+//      fprintf(stdout, "XclImpStream::EnableDecryption: decryption disabled\n");fflush(stdout);
-+//  }
- }
- 
- // ----------------------------------------------------------------------------
-@@ -1007,11 +1057,33 @@
+@@ -1007,11 +1053,37 @@
  
  bool XclImpStream::ReadNextRawRecHeader()
  {
@@ -1791,9 +2142,13 @@
 +    if( bRet )
 +    {
 +        mrStrm >> mnRawRecId >> mnRawRecSize;
-+        fprintf(stdout, "---------- record (%4.4X) (size = %d) -----\n", mnRawRecId, mnRawRecSize);
++        fprintf(stdout, "---------- record (%4.4X) (size = %d; pos = %ld) -----\n", 
++                mnRawRecId, mnRawRecSize, mrStrm.Tell());
 +        for (sal_uInt16 i = 0; i < mnRawRecSize; ++i)
 +        {
++            if ((i+1) % 16 == 1)
++                printf("%4.4X: ", mnRawRecId);
++
 +            sal_uInt8 byte;
 +            mrStrm >> byte;
 +            printf("%2.2X ", byte);
@@ -1826,6 +2181,11 @@
      }
      return mrData.maPassw;
  }
+Index: sc/source/filter/inc/excdoc.hxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/inc/excdoc.hxx,v
+retrieving revision 1.17
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.17 excdoc.hxx
 Index: sc/source/filter/inc/excimp8.hxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/inc/excimp8.hxx,v
@@ -1928,11 +2288,19 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/inc/xcl97rec.hxx,v
 retrieving revision 1.47
-retrieving revision 1.47.180.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.47 -r1.47.180.1
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.47 xcl97rec.hxx
 --- sc/source/filter/inc/xcl97rec.hxx	22 Jan 2007 13:20:49 -0000	1.47
-+++ sc/source/filter/inc/xcl97rec.hxx	5 Jan 2008 06:16:08 -0000	1.47.180.1
-@@ -492,23 +492,24 @@
++++ sc/source/filter/inc/xcl97rec.hxx	17 Jan 2008 04:07:06 -0000
+@@ -43,6 +43,8 @@
+ #include "xlstyle.hxx"
+ #endif
+ 
++#include <vector>
++
+ // --- class XclMsodrawing_Base --------------------------------------
+ 
+ class XclMsodrawing_Base
+@@ -492,23 +494,24 @@
      virtual sal_Size            GetLen() const;
  };
  
@@ -1968,6 +2336,249 @@
  
  class XclCalccount : public ExcRecord
  {
+@@ -564,5 +567,43 @@
+                                 XclRefmode( const ScDocument& );
+ };
+ 
++// ============================================================================
++
++class XclExpFilePass : public XclExpRecord
++{
++public:
++    explicit XclExpFilePass( const XclExpRoot& rRoot );
++    virtual ~XclExpFilePass();
++
++private:
++    virtual void WriteBody( XclExpStream& rStrm );
++
++private:
++    const XclExpRoot& mrRoot;
++};
++
++// ============================================================================
++
++class XclExpCodePage : public XclExpRecord
++{
++public:
++    explicit XclExpCodePage();
++    virtual ~XclExpCodePage();
++
++private:
++    virtual void WriteBody( XclExpStream& rStrm );
++};
++
++// ============================================================================
++
++class XclExpDSF : public XclExpRecord
++{
++public:
++    explicit XclExpDSF();
++    virtual ~XclExpDSF();
++
++private:
++    virtual void WriteBody( XclExpStream& rStrm );
++};
+ 
+ #endif // _XCL97REC_HXX
+Index: sc/source/filter/inc/xeroot.hxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/inc/xeroot.hxx,v
+retrieving revision 1.20
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.20 xeroot.hxx
+--- sc/source/filter/inc/xeroot.hxx	19 Dec 2006 13:24:06 -0000	1.20
++++ sc/source/filter/inc/xeroot.hxx	17 Jan 2008 04:07:06 -0000
+@@ -161,6 +161,10 @@
+         @param nRecId  Identifier that specifies which record is returned. */
+     XclExpRecordRef     CreateRecord( sal_uInt16 nRecId ) const;
+ 
++    bool                IsPasswordProtected() const;
++
++    const String        GetPassword() const;
++
+ private:
+     /** Returns the local or global link manager, depending on current context. */
+     XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
+Index: sc/source/filter/inc/xestream.hxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/inc/xestream.hxx,v
+retrieving revision 1.7
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.7 xestream.hxx
+--- sc/source/filter/inc/xestream.hxx	10 Jul 2006 13:56:03 -0000	1.7
++++ sc/source/filter/inc/xestream.hxx	17 Jan 2008 04:07:06 -0000
+@@ -41,6 +41,8 @@
+ #ifndef SC_XLSTREAM_HXX
+ #include "xlstream.hxx"
+ #endif
++#include <stdio.h>
++#include <svx/mscodec.hxx>
+ 
+ /* ============================================================================
+ Output stream class for Excel export
+@@ -49,6 +51,8 @@
+ ============================================================================ */
+ 
+ class XclExpRoot;
++class XclExpBiff8Encrypter;
++typedef ScfRef< XclExpBiff8Encrypter > XclExpEncrypterRef;
+ 
+ /** This class is used to export Excel record streams.
+     @descr  An instance is constructed with an SvStream and the maximum size of Excel
+@@ -107,14 +111,14 @@
+     /** Sets data slice length. 0 = no slices. */
+     void                SetSliceSize( sal_uInt16 nSize );
+ 
+-    inline XclExpStream& operator<<( sal_Int8 nValue );
+-    inline XclExpStream& operator<<( sal_uInt8 nValue );
+-    inline XclExpStream& operator<<( sal_Int16 nValue );
+-    inline XclExpStream& operator<<( sal_uInt16 nValue );
+-    inline XclExpStream& operator<<( sal_Int32 nValue );
+-    inline XclExpStream& operator<<( sal_uInt32 nValue );
+-    inline XclExpStream& operator<<( float fValue );
+-    inline XclExpStream& operator<<( double fValue );
++    XclExpStream& operator<<( sal_Int8 nValue );
++    XclExpStream& operator<<( sal_uInt8 nValue );
++    XclExpStream& operator<<( sal_Int16 nValue );
++    XclExpStream& operator<<( sal_uInt16 nValue );
++    XclExpStream& operator<<( sal_Int32 nValue );
++    XclExpStream& operator<<( sal_uInt32 nValue );
++    XclExpStream& operator<<( float fValue );
++    XclExpStream& operator<<( double fValue );
+ 
+     /** Writes nBytes bytes from memory. */
+     sal_Size            Write( const void* pData, sal_Size nBytes );
+@@ -155,6 +159,29 @@
+     /** Returns the absolute position of the system stream. */
+     inline sal_Size     GetSvStreamPos() const { return mrStrm.Tell(); }
+ 
++//  /** Enables decryption of record contents for the rest of the stream. */
++//  void                SetDecrypter( XclImpDecrypterRef xDecrypter );
++//  /** Sets decrypter from another stream. */
++//  void                CopyDecrypterFrom( const XclImpStream& rStrm );
++//  /** Returns true, if a valid decrypter is set at the stream. */
++//  bool                HasValidDecrypter() const;
++//  /** Switches usage of current decryption algorithm on/off.
++//      @descr  Encryption is re-enabled automatically, if a new record is
++//      started using the function StartNextRecord(). */
++//  void                EnableDecryption( bool bEnable = true );
++//  /** Switches usage of current decryption algorithm off.
++//      @descr  This is a record-local setting. The function StartNextRecord()
++//      always enables decryption. */
++//  inline void         DisableDecryption() { EnableDecryption( false ); }
++
++    void                SetEncrypter( XclExpEncrypterRef xEncrypter );
++
++    bool                HasValidEncrypter() const;
++
++    void                EnableEncryption( bool bEnable = true );
++
++    void                DisableEncryption();
++
+ private:
+     /** Writes header data, internal setup. */
+     void                InitRecord( sal_uInt16 nRecId );
+@@ -177,6 +204,9 @@
+     SvStream&           mrStrm;         /// Reference to the system output stream.
+     const XclExpRoot&   mrRoot;         /// Filter root data.
+ 
++    bool                mbUseEncrypter;
++    XclExpEncrypterRef  mxEncrypter;
++
+                         // length data
+     sal_uInt16          mnMaxRecSize;   /// Maximum size of record content.
+     sal_uInt16          mnMaxContSize;  /// Maximum size of CONTINUE content.
+@@ -194,64 +224,39 @@
+ 
+ // ----------------------------------------------------------------------------
+ 
+-inline XclExpStream& XclExpStream::operator<<( sal_Int8 nValue )
+-{
+-    PrepareWrite( 1 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+-
+-inline XclExpStream& XclExpStream::operator<<( sal_uInt8 nValue )
+-{
+-    PrepareWrite( 1 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+-
+-inline XclExpStream& XclExpStream::operator<<( sal_Int16 nValue )
+-{
+-    PrepareWrite( 2 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+-
+-inline XclExpStream& XclExpStream::operator<<( sal_uInt16 nValue )
+-{
+-    PrepareWrite( 2 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+-
+-inline XclExpStream& XclExpStream::operator<<( sal_Int32 nValue )
+-{
+-    PrepareWrite( 4 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+ 
+-inline XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
+-{
+-    PrepareWrite( 4 );
+-    mrStrm << nValue;
+-    return *this;
+-}
+-
+-inline XclExpStream& XclExpStream::operator<<( float fValue )
+-{
+-    PrepareWrite( 4 );
+-    mrStrm << fValue;
+-    return *this;
+-}
++// ============================================================================
+ 
+-inline XclExpStream& XclExpStream::operator<<( double fValue )
++class XclExpBiff8Encrypter
+ {
+-    PrepareWrite( 8 );
+-    mrStrm << fValue;
+-    return *this;
+-}
++public:
++    explicit XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16], 
++                                   const sal_uInt8 nSalt[16], const sal_uInt8 nSaltHash[16] );
++    ~XclExpBiff8Encrypter();
++
++    bool IsValid() const;
++
++    void Update( SvStream& rStrm, sal_uInt16 nRecSize );
++
++    void OnUpdate( sal_Size nOldStrmPos, sal_Size nNewStrmPos, sal_uInt16 nRecSize );
++    sal_uInt32 GetBlock( sal_Size nStrmPos ) const;
++    sal_uInt16 GetOffset( sal_Size nStrmPos ) const;
++    void Encrypt( SvStream& rStrm, sal_uInt16& nData );
+ 
++private:
++    void Init( const String& aPass, const sal_uInt8 nDocId[16], 
++               const sal_uInt8 nSalt[16], const sal_uInt8 nSaltHash[16] );
+ 
+-// ============================================================================
++private:
++    ::svx::MSCodec_Std97 maCodec;       /// Crypto algorithm implementation.
++    sal_uInt16          mnPassw[16];   /// Cached password data for copy construction.
++    sal_uInt8           mnDocId[16];   /// Cached document ID for copy construction.
++
++    const XclExpRoot& mrRoot;
++    sal_Size            mnOldPos;       /// Last known stream position.
++    sal_uInt16          mnRecSize;      /// Current record size.
++    bool                mbValid;
++};
+ 
+ #endif
+ 
 Index: sc/source/filter/inc/xetable.hxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/inc/xetable.hxx,v
@@ -1988,10 +2599,9 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/inc/xicontent.hxx,v
 retrieving revision 1.14
-retrieving revision 1.14.68.4
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.14 -r1.14.68.4
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.14 xicontent.hxx
 --- sc/source/filter/inc/xicontent.hxx	6 Jul 2007 12:38:28 -0000	1.14
-+++ sc/source/filter/inc/xicontent.hxx	3 Jan 2008 22:47:28 -0000	1.14.68.4
++++ sc/source/filter/inc/xicontent.hxx	17 Jan 2008 04:07:07 -0000
 @@ -53,6 +53,8 @@
  #include "xiroot.hxx"
  #endif
@@ -2134,7 +2744,7 @@
 retrieving revision 1.21
 diff -u -b -I $Revision.*$ -I $Author.*$ -r1.21 scflt.cxx
 --- sc/source/filter/starcalc/scflt.cxx	26 Nov 2007 14:42:17 -0000	1.21
-+++ sc/source/filter/starcalc/scflt.cxx	5 Jan 2008 06:27:27 -0000
++++ sc/source/filter/starcalc/scflt.cxx	17 Jan 2008 04:07:07 -0000
 @@ -1156,9 +1156,9 @@
  	//rStream.Read(&SheetProtect, sizeof(SheetProtect));
  	lcl_ReadSheetProtect(rStream, SheetProtect);
@@ -2162,14 +2772,31 @@
  
  		rStream >> TabNo;
  
+Index: sc/source/filter/xcl97/xcl97dum.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/filter/xcl97/xcl97dum.cxx,v
+retrieving revision 1.20
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.20 xcl97dum.cxx
+--- sc/source/filter/xcl97/xcl97dum.cxx	22 Jan 2007 13:22:46 -0000	1.20
++++ sc/source/filter/xcl97/xcl97dum.cxx	17 Jan 2008 04:07:07 -0000
+@@ -64,9 +64,7 @@
+ 	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+ 	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+-	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
+-	0x42, 0x00, 0x02, 0x00, 0xb0, 0x04,						// CODEPAGE
+-	0x61, 0x01, 0x02, 0x00, 0x00, 0x00						// DSF (8+)
++	0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
+ };
+ const sal_Size ExcDummy8_00a::nMyLen = sizeof(ExcDummy8_00a::pMyData);
+ 
 Index: sc/source/filter/xcl97/xcl97rec.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/xcl97/xcl97rec.cxx,v
 retrieving revision 1.86
-retrieving revision 1.86.132.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.86 -r1.86.132.1
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.86 xcl97rec.cxx
 --- sc/source/filter/xcl97/xcl97rec.cxx	10 May 2007 16:52:00 -0000	1.86
-+++ sc/source/filter/xcl97/xcl97rec.cxx	5 Jan 2008 06:16:09 -0000	1.86.132.1
++++ sc/source/filter/xcl97/xcl97rec.cxx	17 Jan 2008 04:07:08 -0000
 @@ -134,6 +134,7 @@
  #include "scextopt.hxx"
  #include "docoptio.hxx"
@@ -2266,6 +2893,91 @@
  
  
  
+@@ -1393,3 +1434,84 @@
+     XclExpBoolRecord( 0x000F, rDoc.GetAddressConvention() != ScAddress::CONV_XL_R1C1 )
+ {
+ }
++
++// ============================================================================
++
++XclExpFilePass::XclExpFilePass( const XclExpRoot& rRoot ) :
++    XclExpRecord(0x002F, 54),
++    mrRoot(rRoot)
++{
++}
++
++XclExpFilePass::~XclExpFilePass()
++{
++}
++
++void XclExpFilePass::WriteBody( XclExpStream& rStrm )
++{
++    static const sal_uInt8 nDocId[] = {
++        0x17, 0xf7, 0x01, 0x08, 0xea, 0xad, 0x30, 0x5c,
++        0x1a, 0x95, 0xa5, 0x75, 0xd6, 0x79, 0xcd, 0x8d };
++
++
++    static const sal_uInt8 nSalt[] = {    
++        0xa4, 0x5b, 0xf7, 0xe9, 0x9f, 0x55, 0x21, 0xc5, 
++        0xc5, 0x56, 0xa8, 0x0d, 0x39, 0x05, 0x3a, 0xb4 };
++
++
++    static const sal_uInt8 nSaltHash[] = {
++        0x8a, 0x23, 0xac, 0x6b, 0x53, 0x90, 0xd2, 0x1f, 
++        0xba, 0xf3, 0xcf, 0x20, 0x56, 0x42, 0x57, 0x6b };
++
++    // 0x0000 - neither standard nor strong encryption
++    // 0x0001 - standard or strong encryption
++    rStrm << static_cast<sal_uInt16>(0x0001);
++
++    // 0x0000 - non standard encryption
++    // 0x0001 - standard encryption
++    sal_uInt16 nStdEnc = 0x0001;
++    rStrm << nStdEnc << nStdEnc;
++
++    rStrm.Write(nDocId, 16);
++    rStrm.Write(nSalt, 16);
++    rStrm.Write(nSaltHash, 16);
++
++    XclExpEncrypterRef xEnc( new XclExpBiff8Encrypter(mrRoot, nDocId, nSalt, nSaltHash) );
++    rStrm.SetEncrypter(xEnc);
++}
++
++// ============================================================================
++
++XclExpCodePage::XclExpCodePage() :
++    XclExpRecord(0x0042, 2)
++{
++}
++
++XclExpCodePage::~XclExpCodePage()
++{
++}
++
++void XclExpCodePage::WriteBody( XclExpStream& rStrm )
++{
++    // 0x04B0 : UTF-16 (BIFF8)
++    rStrm.EnableEncryption();
++    rStrm << static_cast<sal_uInt16>(0x04B0);
++}
++
++// ============================================================================
++
++XclExpDSF::XclExpDSF() :
++    XclExpRecord(0x0161, 2)
++{
++}
++
++XclExpDSF::~XclExpDSF()
++{
++}
++
++void XclExpDSF::WriteBody( XclExpStream& rStrm )
++{
++    rStrm.EnableEncryption();
++    rStrm << static_cast<sal_uInt16>(0x0000);
++}
++
 Index: sc/source/filter/xml/xmlbodyi.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/filter/xml/xmlbodyi.cxx,v
@@ -2649,6 +3361,30 @@
  }
  
  //------------------------------------------------------------------------
+Index: sc/source/ui/docshell/docsh.cxx
+===================================================================
+RCS file: /cvs/sc/sc/source/ui/docshell/docsh.cxx,v
+retrieving revision 1.93
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.93 docsh.cxx
+--- sc/source/ui/docshell/docsh.cxx	23 Oct 2007 14:45:22 -0000	1.93
++++ sc/source/ui/docshell/docsh.cxx	17 Jan 2008 04:07:08 -0000
+@@ -1809,6 +1809,8 @@
+                 aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
+             pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
+ 
++#if 0 // TODO: Disable this for now.
++
+             /*  #115980 #If the imported document contained an encrypted password -
+                 determine if we should save without it. */
+             ScExtDocSettings& rDocSett = pExtDocOpt->GetDocSettings();
+@@ -1818,6 +1820,7 @@
+                 // #i42858# warn only on time
+                 rDocSett.mbEncrypted = false;
+             }
++#endif            
+         }
+ 
+         if( bDoSave )
 Index: sc/source/ui/docshell/docsh5.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/docshell/docsh5.cxx,v
@@ -2670,11 +3406,11 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/inc/undotab.hxx,v
 retrieving revision 1.9
-retrieving revision 1.9.264.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.9 -r1.9.264.2
+retrieving revision 1.9.264.3
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.9 -r1.9.264.3
 --- sc/source/ui/inc/undotab.hxx	18 Oct 2006 12:28:14 -0000	1.9
-+++ sc/source/ui/inc/undotab.hxx	4 Jan 2008 04:27:21 -0000	1.9.264.2
-@@ -64,18 +64,21 @@
++++ sc/source/ui/inc/undotab.hxx	7 Jan 2008 21:50:08 -0000	1.9.264.3
+@@ -64,11 +64,15 @@
  #include <com/sun/star/uno/Sequence.hxx>
  #endif
  
@@ -2690,86 +3426,7 @@
  
  //----------------------------------------------------------------------------
  
- class ScUndoInsertTab : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoInsertTab(
- 							ScDocShell* pNewDocShell,
- 							SCTAB nTabNum,
-@@ -103,7 +106,6 @@
- class ScUndoInsertTables : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoInsertTables(
- 							ScDocShell* pNewDocShell,
- 							SCTAB nTabNum,
-@@ -134,7 +136,6 @@
- class ScUndoDeleteTab: public ScMoveUndo	// Draw vom Move fuer geloeschte Tabelle
- {
- public:
--					TYPEINFO();
- 					ScUndoDeleteTab(
- 							ScDocShell* pNewDocShell,
- 							const SvShorts &theTabs,		//SCTAB nNewTab,
-@@ -161,7 +162,6 @@
- class ScUndoRenameTab: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoRenameTab(
- 							ScDocShell* pNewDocShell,
- 							SCTAB nT,
-@@ -188,7 +188,6 @@
- class ScUndoMoveTab: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoMoveTab( ScDocShell* pNewDocShell,
- 								  const SvShorts &aOldTab,
- 								  const SvShorts &aNewTab);
-@@ -212,7 +211,6 @@
- class ScUndoCopyTab: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoCopyTab(ScDocShell* pNewDocShell,
- 								  const SvShorts &aOldTab,
- 								  const SvShorts &aNewTab);
-@@ -238,7 +236,6 @@
- class ScUndoMakeScenario: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoMakeScenario(
- 							ScDocShell* pNewDocShell,
- 							SCTAB nSrc, SCTAB nDest,
-@@ -270,7 +267,6 @@
- class ScUndoImportTab : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoImportTab(
- 							ScDocShell* pShell,
- 							SCTAB nNewTab, SCTAB nNewCount,
-@@ -298,7 +294,6 @@
- class ScUndoRemoveLink : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoRemoveLink(				// vor dem Loeschen aufrufen!
- 							ScDocShell* pShell,
- 							const String& rDoc );
-@@ -328,7 +323,6 @@
- class ScUndoShowHideTab : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoShowHideTab(
- 							ScDocShell* pShell,
- 							SCTAB nNewTab, BOOL bNewShow );
-@@ -348,14 +342,15 @@
+@@ -348,14 +352,15 @@
  	void DoChange( BOOL bShow ) const;
  };
  
@@ -2790,7 +3447,7 @@
  
  	virtual void	Undo();
  	virtual void	Redo();
-@@ -365,18 +360,40 @@
+@@ -365,11 +370,34 @@
  	virtual String	GetComment() const;
  
  private:
@@ -2829,62 +3486,14 @@
  };
  
  
- class ScUndoPrintRange : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoPrintRange( ScDocShell* pShell, SCTAB nNewTab,
- 										ScPrintRangeSaver* pOld, ScPrintRangeSaver* pNew );
- 	virtual			~ScUndoPrintRange();
-@@ -400,7 +417,6 @@
- class ScUndoScenarioFlags: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoScenarioFlags(
- 							ScDocShell* pNewDocShell, SCTAB nT,
- 							const String& rON, const String& rNN,
-@@ -433,7 +449,6 @@
- class ScUndoRenameObject: public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoRenameObject(
- 							ScDocShell* pNewDocShell, const String& rPN,
- 							const String& rON, const String& rNN );
-@@ -459,7 +474,6 @@
- class ScUndoLayoutRTL : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoLayoutRTL( ScDocShell* pShell, SCTAB nNewTab, BOOL bNewRTL );
- 	virtual			~ScUndoLayoutRTL();
- 
-@@ -481,7 +495,6 @@
- class ScUndoSetAddressConvention : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
- 					ScUndoSetAddressConvention( ScDocShell* pShell,
- 												ScAddress::Convention eConv );
- 	virtual			~ScUndoSetAddressConvention();
 Index: sc/source/ui/undo/undotab.cxx
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/undo/undotab.cxx,v
 retrieving revision 1.16
-retrieving revision 1.16.166.2
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.16 -r1.16.166.2
+retrieving revision 1.16.166.4
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.16 -r1.16.166.4
 --- sc/source/ui/undo/undotab.cxx	27 Feb 2007 13:39:54 -0000	1.16
-+++ sc/source/ui/undo/undotab.cxx	4 Jan 2008 04:27:22 -0000	1.16.166.2
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
- 
--
-+#include <stdio.h>
- 
- //------------------------------------------------------------------
- 
++++ sc/source/ui/undo/undotab.cxx	7 Jan 2008 21:50:08 -0000	1.16.166.4
 @@ -66,6 +66,7 @@
  #include "prnsave.hxx"
  #include "printfun.hxx"
@@ -2893,7 +3502,7 @@
  
  // for ScUndoRenameObject - might me moved to another file later
  #include <svx/svditer.hxx>
-@@ -77,26 +78,11 @@
+@@ -77,6 +78,8 @@
  extern BOOL bDrawIsInUndo;			//! irgendwo als Member !!!
  
  using namespace com::sun::star;
@@ -2902,27 +3511,15 @@
  
  // STATIC DATA -----------------------------------------------------------
  
--TYPEINIT1(ScUndoInsertTab,		SfxUndoAction);
--TYPEINIT1(ScUndoInsertTables,	SfxUndoAction);
--TYPEINIT1(ScUndoDeleteTab,		SfxUndoAction);
--TYPEINIT1(ScUndoRenameTab,		SfxUndoAction);
--TYPEINIT1(ScUndoMoveTab,		SfxUndoAction);
--TYPEINIT1(ScUndoCopyTab,		SfxUndoAction);
--TYPEINIT1(ScUndoMakeScenario,	SfxUndoAction);
--TYPEINIT1(ScUndoImportTab,		SfxUndoAction);
--TYPEINIT1(ScUndoRemoveLink,		SfxUndoAction);
--TYPEINIT1(ScUndoShowHideTab,	SfxUndoAction);
+@@ -90,7 +93,6 @@
+ TYPEINIT1(ScUndoImportTab,		SfxUndoAction);
+ TYPEINIT1(ScUndoRemoveLink,		SfxUndoAction);
+ TYPEINIT1(ScUndoShowHideTab,	SfxUndoAction);
 -TYPEINIT1(ScUndoProtect,		SfxUndoAction);
--TYPEINIT1(ScUndoPrintRange,		SfxUndoAction);
--TYPEINIT1(ScUndoScenarioFlags,	SfxUndoAction);
--TYPEINIT1(ScUndoRenameObject,	SfxUndoAction);
--TYPEINIT1(ScUndoLayoutRTL,		SfxUndoAction);
--TYPEINIT1(ScUndoSetAddressConvention,		SfxUndoAction);
--
- 
- // -----------------------------------------------------------------------
- //
-@@ -117,12 +103,12 @@
+ TYPEINIT1(ScUndoPrintRange,		SfxUndoAction);
+ TYPEINIT1(ScUndoScenarioFlags,	SfxUndoAction);
+ TYPEINIT1(ScUndoRenameObject,	SfxUndoAction);
+@@ -117,12 +119,12 @@
  	SetChangeTrack();
  }
  
@@ -2937,7 +3534,7 @@
  {
  	if (bAppend)
  		return ScGlobal::GetRscString( STR_UNDO_APPEND_TAB );
-@@ -143,7 +129,7 @@
+@@ -143,7 +145,7 @@
  		nEndChangeAction = 0;
  }
  
@@ -2946,7 +3543,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  	pViewShell->SetTabNo(nTab);
-@@ -164,7 +150,7 @@
+@@ -164,7 +166,7 @@
  	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
  }
  
@@ -2955,7 +3552,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  
-@@ -185,14 +171,14 @@
+@@ -185,14 +187,14 @@
  	SetChangeTrack();
  }
  
@@ -2972,7 +3569,7 @@
  {
  	return (rTarget.ISA(ScTabViewTarget));
  }
-@@ -216,7 +202,7 @@
+@@ -216,7 +218,7 @@
  	SetChangeTrack();
  }
  
@@ -2981,7 +3578,7 @@
  {
  	String *pStr=NULL;
  	if(pNameList!=NULL)
-@@ -232,7 +218,7 @@
+@@ -232,7 +234,7 @@
  	DeleteSdrUndoAction( pDrawUndo );
  }
  
@@ -2990,7 +3587,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
  }
-@@ -257,7 +243,7 @@
+@@ -257,7 +259,7 @@
  		nStartChangeAction = nEndChangeAction = 0;
  }
  
@@ -2999,7 +3596,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  	pViewShell->SetTabNo(nTab);
-@@ -287,7 +273,7 @@
+@@ -287,7 +289,7 @@
  	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
  }
  
@@ -3008,7 +3605,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  
-@@ -304,14 +290,14 @@
+@@ -304,14 +306,14 @@
  	SetChangeTrack();
  }
  
@@ -3025,7 +3622,7 @@
  {
  	return (rTarget.ISA(ScTabViewTarget));
  }
-@@ -332,12 +318,12 @@
+@@ -332,12 +334,12 @@
  		SetChangeTrack();
  }
  
@@ -3040,7 +3637,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_DELETE_TAB );
  }
-@@ -371,7 +357,7 @@
+@@ -371,7 +373,7 @@
  	return nTab;
  }
  
@@ -3049,17 +3646,16 @@
  {
  	BeginUndo();
  	int i=0;
-@@ -419,7 +405,8 @@
+@@ -419,7 +421,7 @@
              pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
  
              if ( pRefUndoDoc->IsTabProtected( nTab ) )
 -                pDoc->SetTabProtection( nTab, TRUE, pRefUndoDoc->GetTabPassword( nTab ) );
 +                pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
-+//              pDoc->SetTabProtection( nTab, TRUE, pRefUndoDoc->GetTabPassword( nTab ) );
  
  			//	Drawing-Layer passiert beim MoveUndo::EndUndo
  	//		pDoc->TransferDrawPage(pRefUndoDoc, nTab,nTab);
-@@ -455,7 +442,7 @@
+@@ -455,7 +457,7 @@
  //	EndUndo();
  }
  
@@ -3068,7 +3664,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  	pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs[0] ) );
-@@ -474,7 +461,7 @@
+@@ -474,7 +476,7 @@
  	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
  }
  
@@ -3077,7 +3673,7 @@
  {
  	if (rTarget.ISA(ScTabViewTarget))
  	{
-@@ -483,7 +470,7 @@
+@@ -483,7 +485,7 @@
  	}
  }
  
@@ -3086,7 +3682,7 @@
  {
  	return (rTarget.ISA(ScTabViewTarget));
  }
-@@ -505,11 +492,11 @@
+@@ -505,11 +507,11 @@
  	sNewName = rNewName;
  }
  
@@ -3100,7 +3696,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_RENAME_TAB );
  }
-@@ -531,22 +518,22 @@
+@@ -531,22 +533,22 @@
  		pViewShell->UpdateInputHandler();
  }
  
@@ -3127,7 +3723,7 @@
  {
  	return FALSE;
  }
-@@ -570,13 +557,13 @@
+@@ -570,13 +572,13 @@
          theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
  }
  
@@ -3143,7 +3739,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_MOVE_TAB );
  }
-@@ -623,22 +610,22 @@
+@@ -623,22 +625,22 @@
  	pDocShell->PostDataChanged();
  }
  
@@ -3170,7 +3766,7 @@
  {
  	return FALSE;
  }
-@@ -665,12 +652,12 @@
+@@ -665,12 +667,12 @@
          theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
  }
  
@@ -3185,7 +3781,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_COPY_TAB );
  }
-@@ -689,7 +676,7 @@
+@@ -689,7 +691,7 @@
  	pDocShell->PostDataChanged();
  }
  
@@ -3194,7 +3790,7 @@
  {
  	ScDocument* pDoc = pDocShell->GetDocument();
  
-@@ -722,7 +709,7 @@
+@@ -722,7 +724,7 @@
  	DoChange();
  }
  
@@ -3203,17 +3799,16 @@
  {
  	ScDocument* pDoc = pDocShell->GetDocument();
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-@@ -761,7 +748,8 @@
+@@ -761,7 +763,7 @@
  		}
  
  		if ( pDoc->IsTabProtected( nAdjSource ) )
 -			pDoc->SetTabProtection( nNewTab, TRUE, pDoc->GetTabPassword( nAdjSource ) );
 +            pDoc->CopyTabProtection(nAdjSource, nNewTab);
-+//          pDoc->SetTabProtection( nNewTab, TRUE, pDoc->GetTabPassword( nAdjSource ) );
  	}
  
      RedoSdrUndoAction( pDrawUndo );             // after the sheets are inserted
-@@ -772,12 +760,12 @@
+@@ -772,12 +774,12 @@
  
  }
  
@@ -3228,7 +3823,7 @@
  {
  	return FALSE;
  }
-@@ -805,17 +793,17 @@
+@@ -805,17 +807,17 @@
  {
  }
  
@@ -3249,7 +3844,7 @@
  {
  	ScDocument* pDoc = pDocShell->GetDocument();
  	pDoc->DeleteTab( nDestTab );
-@@ -829,7 +817,7 @@
+@@ -829,7 +831,7 @@
  	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
  }
  
@@ -3258,7 +3853,7 @@
  {
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
  	if (pViewShell)
-@@ -847,7 +835,7 @@
+@@ -847,7 +849,7 @@
  	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
  }
  
@@ -3267,7 +3862,7 @@
  {
  	if (rTarget.ISA(ScTabViewTarget))
  	{
-@@ -855,7 +843,7 @@
+@@ -855,7 +857,7 @@
  	}
  }
  
@@ -3276,7 +3871,7 @@
  {
  	return (rTarget.ISA(ScTabViewTarget));
  }
-@@ -878,13 +866,13 @@
+@@ -878,13 +880,13 @@
  	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
  }
  
@@ -3292,7 +3887,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
  }
-@@ -911,7 +899,7 @@
+@@ -911,7 +913,7 @@
  								PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
  }
  
@@ -3301,7 +3896,7 @@
  {
  	//!	eingefuegte Bereichsnamen etc.
  
-@@ -947,7 +935,8 @@
+@@ -947,7 +949,8 @@
  			}
  
  			if ( pDoc->IsTabProtected( nTabPos ) )
@@ -3311,7 +3906,7 @@
  		}
  
  	}
-@@ -962,7 +951,7 @@
+@@ -962,7 +965,7 @@
  	DoChange();
  }
  
@@ -3320,7 +3915,7 @@
  {
  	if (!pRedoDoc)
  	{
-@@ -1001,7 +990,8 @@
+@@ -1001,7 +1004,8 @@
  		}
  
  		if ( pRedoDoc->IsTabProtected( nTabPos ) )
@@ -3330,7 +3925,7 @@
  	}
  
      RedoSdrUndoAction( pDrawUndo );     // after the sheets are inserted
-@@ -1009,14 +999,14 @@
+@@ -1009,14 +1013,14 @@
  	DoChange();
  }
  
@@ -3347,7 +3942,7 @@
  {
  	return (rTarget.ISA(ScTabViewTarget));
  }
-@@ -1062,14 +1052,14 @@
+@@ -1062,14 +1066,14 @@
  	}
  }
  
@@ -3364,7 +3959,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_REMOVELINK );
  }
-@@ -1086,22 +1076,22 @@
+@@ -1086,22 +1090,22 @@
  	pDocShell->UpdateLinks();
  }
  
@@ -3391,7 +3986,7 @@
  {
  	return FALSE;
  }
-@@ -1119,7 +1109,7 @@
+@@ -1119,7 +1123,7 @@
  {
  }
  
@@ -3400,7 +3995,7 @@
  {
  }
  
-@@ -1136,17 +1126,17 @@
+@@ -1136,17 +1140,17 @@
  	pDocShell->SetDocumentModified();
  }
  
@@ -3421,7 +4016,7 @@
  {
  	if (rTarget.ISA(ScTabViewTarget))
  		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
-@@ -1154,53 +1144,44 @@
+@@ -1154,53 +1158,44 @@
  								SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
  }
  
@@ -3490,7 +4085,7 @@
  	}
  
  	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-@@ -1213,37 +1194,103 @@
+@@ -1213,37 +1208,103 @@
  	pDocShell->PostPaintGridAll();
  }
  
@@ -3526,7 +4121,10 @@
  
 -String __EXPORT ScUndoProtect::GetComment() const
 +String ScUndoDocProtect::GetComment() const
-+{
+ {
+-	USHORT nId;
+-	if ( nTab == TABLEID_DOC )
+-		nId = bProtect ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
 +    USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
 +    return ScGlobal::GetRscString( nId );
 +}
@@ -3541,10 +4139,7 @@
 +}
 +
 +ScUndoTabProtect::~ScUndoTabProtect()
- {
--	USHORT nId;
--	if ( nTab == TABLEID_DOC )
--		nId = bProtect ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
++{
 +}
 +
 +void ScUndoTabProtect::DoProtect(bool bProtect)
@@ -3605,7 +4200,7 @@
  	return ScGlobal::GetRscString( nId );
  }
  
-@@ -1261,7 +1308,7 @@
+@@ -1261,7 +1322,7 @@
  {
  }
  
@@ -3614,7 +4209,7 @@
  {
  	delete pOldRanges;
  	delete pNewRanges;
-@@ -1284,31 +1331,31 @@
+@@ -1284,31 +1345,31 @@
  	pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
  }
  
@@ -3651,7 +4246,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
  }
-@@ -1337,16 +1384,16 @@
+@@ -1337,16 +1398,16 @@
  {
  }
  
@@ -3671,7 +4266,7 @@
  {
  	ScDocument* pDoc = pDocShell->GetDocument();
  
-@@ -1363,7 +1410,7 @@
+@@ -1363,7 +1424,7 @@
  		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
  }
  
@@ -3680,7 +4275,7 @@
  {
  	ScDocument* pDoc = pDocShell->GetDocument();
  
-@@ -1380,12 +1427,12 @@
+@@ -1380,12 +1441,12 @@
  		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
  }
  
@@ -3695,7 +4290,7 @@
  {
  	return FALSE;
  }
-@@ -1485,7 +1532,7 @@
+@@ -1485,7 +1546,7 @@
  {
  }
  
@@ -3704,7 +4299,7 @@
  {
  }
  
-@@ -1505,29 +1552,29 @@
+@@ -1505,29 +1566,29 @@
  	pDocShell->SetInUndo( FALSE );
  }
  
@@ -3739,7 +4334,7 @@
  {
  	return ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
  }
-@@ -1547,7 +1594,7 @@
+@@ -1547,7 +1608,7 @@
  	eOldConv = pDocShell->GetDocument()->GetAddressConvention();
  }
  
@@ -3748,7 +4343,7 @@
  {
  }
  
-@@ -1560,17 +1607,17 @@
+@@ -1560,17 +1621,17 @@
  	pDocShell->SetInUndo( FALSE );
  }
  
@@ -3769,7 +4364,7 @@
  {
  #if 0
  // erAck: 2006-09-07T23:00+0200  commented out in CWS scr1c1
-@@ -1580,12 +1627,12 @@
+@@ -1580,12 +1641,12 @@
  #endif
  }
  
@@ -3788,10 +4383,10 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/view/gridwin.cxx,v
 retrieving revision 1.87
-retrieving revision 1.83.16.3
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.87 -r1.83.16.3
+retrieving revision 1.83.16.4
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.87 -r1.83.16.4
 --- sc/source/ui/view/gridwin.cxx	26 Nov 2007 15:21:16 -0000	1.87
-+++ sc/source/ui/view/gridwin.cxx	3 Jan 2008 16:57:36 -0000	1.83.16.3
++++ sc/source/ui/view/gridwin.cxx	5 Jan 2008 06:48:34 -0000	1.83.16.4
 @@ -138,6 +138,7 @@
  #include "compiler.hxx"
  #include "editable.hxx"
@@ -3847,7 +4442,7 @@
  		}
  	}
 +        return;
-+	}
++    }
  
  			//
  			//		Links in edit cells
@@ -4038,19 +4633,10 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/view/tabvwsh3.cxx,v
 retrieving revision 1.36
-retrieving revision 1.36.24.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.36 -r1.36.24.1
+retrieving revision 1.36.24.2
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.36 -r1.36.24.2
 --- sc/source/ui/view/tabvwsh3.cxx	21 Nov 2007 19:12:15 -0000	1.36
-+++ sc/source/ui/view/tabvwsh3.cxx	3 Jan 2008 16:57:36 -0000	1.36.24.1
-@@ -36,7 +36,7 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
- 
--
-+#include <stdio.h>
- 
- // INCLUDE ---------------------------------------------------------------
- 
++++ sc/source/ui/view/tabvwsh3.cxx	5 Jan 2008 06:48:34 -0000	1.36.24.2
 @@ -80,6 +80,7 @@
  #include "autofmt.hxx"
  #include "dwfunctr.hxx"
@@ -4059,15 +4645,7 @@
  
  #include <svtools/ilstitem.hxx>
  #define _SVSTDARR_ULONGS
-@@ -940,6 +941,7 @@
- 
- 		case FID_PROTECT_DOC:
- 			{
-+                fprintf(stdout, "ScTabViewShell::Execute: FID_PROTECT_DOC\n");fflush(stdout);
- 				ScDocument* 		pDoc = GetViewData()->GetDocument();
- 				SfxPasswordDialog*	pDlg;
- 
-@@ -954,12 +956,13 @@
+@@ -954,12 +955,13 @@
                      }
                  }
  
@@ -4083,23 +4661,7 @@
  					{
  						String	aText( ScResId(SCSTR_PASSWORD) );
  
-@@ -975,6 +978,7 @@
- 							bCancel = TRUE;
- 						delete pDlg;
- 					}
-+
- 					if (!bCancel)
- 					{
- 						Unprotect( TABLEID_DOC, aPassword );
-@@ -1010,6 +1014,7 @@
- 
- 		case FID_PROTECT_TABLE:
- 			{
-+                fprintf(stdout, "ScTabViewShell::Execute: FID_PROTECT_TABLE\n");fflush(stdout);
- 				ScDocument* 		pDoc = GetViewData()->GetDocument();
- 				SCTAB				nTab = GetViewData()->GetTabNo();
- 				SfxPasswordDialog*	pDlg;
-@@ -1032,7 +1037,8 @@
+@@ -1032,7 +1034,8 @@
  
                      if ( bOldProtection)
                      {
@@ -4113,27 +4675,25 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/view/viewfun2.cxx,v
 retrieving revision 1.35
-retrieving revision 1.35.42.1
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.35 -r1.35.42.1
+retrieving revision 1.35.42.2
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.35 -r1.35.42.2
 --- sc/source/ui/view/viewfun2.cxx	31 Jul 2007 16:38:18 -0000	1.35
-+++ sc/source/ui/view/viewfun2.cxx	3 Jan 2008 16:57:37 -0000	1.35.42.1
-@@ -2143,7 +2143,8 @@
++++ sc/source/ui/view/viewfun2.cxx	5 Jan 2008 06:48:34 -0000	1.35.42.2
+@@ -2143,7 +2143,7 @@
  			pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) );
  
  			if ( pDoc->IsTabProtected( nTab ) )
 -				pUndoDoc->SetTabProtection( nTab, TRUE, pDoc->GetTabPassword( nTab ) );
 +                pUndoDoc->SetTabProtection(nTab, pDoc->GetTabProtection(nTab));
-+//              pUndoDoc->SetTabProtection( nTab, TRUE, pDoc->GetTabPassword( nTab ) );
  
  			//	Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
  			//		pUndoDoc->TransferDrawPage(pDoc, nTab,nTab);
-@@ -2558,7 +2559,8 @@
+@@ -2558,7 +2558,7 @@
  				}
  
  				if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
 -					pDestDoc->SetTabProtection( nDestTab1, TRUE, pDoc->GetTabPassword( TheTabs[i] ) );
 +                    pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
-+//                  pDestDoc->SetTabProtection( nDestTab1, TRUE, pDoc->GetTabPassword( TheTabs[i] ) );
  
  				nDestTab1++;
  			}
@@ -4141,35 +4701,18 @@
 ===================================================================
 RCS file: /cvs/sc/sc/source/ui/view/viewfunc.cxx,v
 retrieving revision 1.38
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.38 viewfunc.cxx
---- sc/source/ui/view/viewfunc.cxx	2 Oct 2007 15:22:22 -0000	1.38
-+++ sc/source/ui/view/viewfunc.cxx	5 Jan 2008 06:27:30 -0000
-@@ -2393,6 +2393,7 @@
- 
- void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
- {
-+    fprintf(stdout, "ScViewFunc::Protect: table ID = %d\n", nTab);fflush(stdout);
- 	ScMarkData& rMark = GetViewData()->GetMarkData();
- 	ScDocShell* pDocSh = GetViewData()->GetDocShell();
- 	ScDocument* pDoc = pDocSh->GetDocument();
-@@ -2425,6 +2426,9 @@
- 
- BOOL ScViewFunc::Unprotect( SCTAB nTab, const String& rPassword )
- {
-+    fprintf(stdout, "ScViewFunc::Unprotect: password = %s\n",
-+            OUStringToOString(rtl::OUString(rPassword), RTL_TEXTENCODING_UTF8).getStr());fflush(stdout);
-+
- 	ScMarkData& rMark = GetViewData()->GetMarkData();
- 	ScDocShell* pDocSh = GetViewData()->GetDocShell();
- 	ScDocument* pDoc = pDocSh->GetDocument();
+retrieving revision 1.38.76.2
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.38 -r1.38.76.2
+? svx/svx.diff
 ? svx/svx.vpj
 Index: svx/inc/mscodec.hxx
 ===================================================================
 RCS file: /cvs/graphics/svx/inc/mscodec.hxx,v
 retrieving revision 1.4
-diff -u -b -I $Revision.*$ -I $Author.*$ -r1.4 mscodec.hxx
+retrieving revision 1.4.1138.1
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.4 -r1.4.1138.1
 --- svx/inc/mscodec.hxx	8 Sep 2005 18:04:23 -0000	1.4
-+++ svx/inc/mscodec.hxx	5 Jan 2008 06:27:52 -0000
++++ svx/inc/mscodec.hxx	8 Jan 2008 04:03:39 -0000	1.4.1138.1
 @@ -247,6 +247,10 @@
       */
      bool                InitCipher( sal_uInt32 nCounter );
@@ -4187,22 +4730,25 @@
 retrieving revision 1.5
 diff -u -b -I $Revision.*$ -I $Author.*$ -r1.5 mscodec.cxx
 --- svx/source/msfilter/mscodec.cxx	12 Oct 2006 12:58:20 -0000	1.5
-+++ svx/source/msfilter/mscodec.cxx	5 Jan 2008 06:27:52 -0000
-@@ -44,6 +44,8 @@
++++ svx/source/msfilter/mscodec.cxx	17 Jan 2008 04:08:08 -0000
+@@ -44,6 +44,10 @@
  #include <algorithm>
  #include <tools/solar.h>
  
 +#include <stdio.h>
 +
++#define DEBUG_MSO_ENCRYPTION_STD97 0
++
  namespace svx {
  
  // ============================================================================
-@@ -248,15 +250,36 @@
+@@ -248,15 +252,42 @@
      rtl_cipher_destroy (m_hCipher);
  }
  
 +static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg)
 +{
++#if DEBUG_MSO_ENCRYPTION_STD97    
 +    printf("pKeyData: (%s)\n", msg);
 +    for (int j = 0; j < 4; ++j)
 +    {
@@ -4210,21 +4756,26 @@
 +            printf("%2.2x ", pKeyData[j*16+i]);
 +        printf("\n");
 +    }
++#endif    
 +}
 +
 +static void lcl_PrintDigest(const sal_uInt8* pDigest)
 +{
++#if DEBUG_MSO_ENCRYPTION_STD97    
 +    printf("digest:\n");
 +    for (int i = 0; i < 16; ++i)
 +        printf("%2.2x ", pDigest[i]);
 +    printf("\n");
++#endif    
 +}
 +
  void MSCodec_Std97::InitKey (
      const sal_uInt16 pPassData[16],
      const sal_uInt8  pUnique[16])
  {
++#if DEBUG_MSO_ENCRYPTION_STD97    
 +    fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout);
++#endif    
      sal_uInt8 pKeyData[64];
      int       i, n;
  
@@ -4234,7 +4785,7 @@
      for (i = 0, n = 16; (i < n) && pPassData[i]; i++)
      {
          pKeyData[2*i    ] = sal::static_int_cast< sal_uInt8 >(
-@@ -267,12 +290,16 @@
+@@ -267,12 +298,16 @@
      pKeyData[2*i] = 0x80;
      pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4);
  
@@ -4251,7 +4802,7 @@
      // Update digest with KeyData and Unique.
      for (i = 0; i < 16; i++)
      {
-@@ -286,6 +313,8 @@
+@@ -286,6 +321,8 @@
      pKeyData[56] = 0x80;
      pKeyData[57] = 0x0a;
  
@@ -4260,7 +4811,7 @@
      rtl_digest_updateMD5 (
          m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16);
  
-@@ -293,6 +322,8 @@
+@@ -293,6 +330,8 @@
      rtl_digest_rawMD5 (
          m_hDigest, m_pDigestValue, sizeof(m_pDigestValue));
  
@@ -4269,20 +4820,23 @@
      // Erase KeyData array and leave.
      (void)memset (pKeyData, 0, sizeof(pKeyData));
  }
-@@ -301,6 +332,9 @@
+@@ -301,6 +340,11 @@
      const sal_uInt8 pSaltData[16],
      const sal_uInt8 pSaltDigest[16])
  {
 +    // both the salt data and salt digest (hash) come from the document being imported.
 +
++#if DEBUG_MSO_ENCRYPTION_STD97    
 +    fprintf(stdout, "MSCodec_Std97::VerifyKey: \n");fflush(stdout);
++#endif    
      bool result = false;
  
      if (InitCipher(0))
-@@ -312,6 +346,18 @@
+@@ -312,6 +356,20 @@
          rtl_cipher_decode (
              m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
  
++#if DEBUG_MSO_ENCRYPTION_STD97        
 +        fprintf(stdout, "salt:\n");
 +        for (int i = 0; i < 16; ++i)
 +            fprintf(stdout, "%2.2x ", pSaltData[i]);
@@ -4294,34 +4848,37 @@
 +                fprintf(stdout, "%2.2x ", pBuffer[i*16+j]);
 +            fprintf(stdout, "\n");
 +        }
++#endif        
 +
          pBuffer[16] = 0x80;
          (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
          pBuffer[56] = 0x80;
-@@ -322,6 +368,11 @@
+@@ -322,6 +380,13 @@
          rtl_digest_rawMD5 (
              m_hDigest, pDigest, sizeof(pDigest));
  
++#if DEBUG_MSO_ENCRYPTION_STD97        
 +        printf("raw digest:\n");
 +        for (int i = 0; i < 16; ++i)
 +            printf("%2.2x ", pDigest[i]);
 +        printf("\n");
++#endif        
 +
          // Decode original SaltDigest into Buffer.
          rtl_cipher_decode (
              m_hCipher, pSaltDigest, 16, pBuffer, sizeof(pBuffer));
-@@ -339,8 +390,9 @@
+@@ -339,8 +404,9 @@
  
  bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
  {
-+//  fprintf(stdout, "MSCodec_Std97::InitCipher: \n");fflush(stdout);
++//  fprintf(stdout, "MSCodec_Std97::InitCipher: counter = %ld\n", nCounter);fflush(stdout);
      rtlCipherError result;
 -    sal_uInt8      pKeyData[64];
 +    sal_uInt8      pKeyData[64]; // 512-bit message block
  
      // Initialize KeyData array.
      (void)memset (pKeyData, 0, sizeof(pKeyData));
-@@ -365,7 +417,7 @@
+@@ -365,7 +431,7 @@
  
      // Initialize Cipher with KeyData (for decoding).
      result = rtl_cipher_init (
@@ -4330,7 +4887,7 @@
          pKeyData, RTL_DIGEST_LENGTH_MD5, 0, 0);
  
      // Erase KeyData array and leave.
-@@ -374,6 +426,17 @@
+@@ -374,10 +440,22 @@
      return (result == rtl_Cipher_E_None);
  }
  
@@ -4348,11 +4905,37 @@
  bool MSCodec_Std97::Decode (
      const void *pData,   sal_Size nDatLen,
      sal_uInt8  *pBuffer, sal_Size nBufLen)
-@@ -388,6 +451,7 @@
+ {
++//  fprintf(stdout, "MSCodec_Std97::Decode: data len = %ld\n", nDatLen);fflush(stdout);
+     rtlCipherError result;
+ 
+     result = rtl_cipher_decode (
+@@ -388,6 +466,7 @@
  
  bool MSCodec_Std97::Skip( sal_Size nDatLen )
  {
-+//  fprintf(stdout, "MSCodec_Std97::Skip: \n");fflush(stdout);
++//  fprintf(stdout, "MSCodec_Std97::Skip: data len = %ld\n", nDatLen);fflush(stdout);
      sal_uInt8 pnDummy[ 1024 ];
      sal_Size nDatLeft = nDatLen;
      bool bResult = true;
+? sfx2/sfx2.vpj
+Index: sfx2/source/dialog/filedlghelper.cxx
+===================================================================
+RCS file: /cvs/framework/sfx2/source/dialog/filedlghelper.cxx,v
+retrieving revision 1.136
+retrieving revision 1.136.42.1
+diff -u -b -I $Revision.*$ -I $Author.*$ -r1.136 -r1.136.42.1
+--- sfx2/source/dialog/filedlghelper.cxx	26 Nov 2007 16:47:16 -0000	1.136
++++ sfx2/source/dialog/filedlghelper.cxx	9 Jan 2008 04:17:43 -0000	1.136.42.1
+@@ -672,6 +672,11 @@
+ {
+ 	sal_Bool operator() ( const SfxFilter* _pFilter )
+ 	{
++        if (_pFilter->GetFilterName().EqualsAscii("MS Excel 97"))
++            // temporary hack to enable password protection for Excel 97.  Is
++            // there a better way to enable password protection of a filter?
++            return true;
++
+         return  _pFilter && _pFilter->IsOwnFormat()
+ 			&&	_pFilter->UsesStorage()
+ 			&&	( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]