[ooo-build-commit] 3 commits - bin/localize-ooo configure.in patches/dev300

René Engelhard rene at kemper.freedesktop.org
Fri Aug 7 03:58:18 PDT 2009


 bin/localize-ooo                                                 |    4 
 configure.in                                                     |   10 
 patches/dev300/apply                                             |   60 
 patches/dev300/calc-dde-always-ooo-conv.diff                     |   23 
 patches/dev300/calc-dp-disable-autofilter.diff                   |   17 
 patches/dev300/calc-formula-variable-separators-ref-display.diff |  227 
 patches/dev300/calc-named-range-excel-syntax-fix.diff            |   13 
 patches/dev300/calc-remove-merge-flags-on-row-insert.diff        |   16 
 patches/dev300/calc-xls-import-maxcol.diff                       |   17 
 patches/dev300/chart-formula-syntax.diff                         |  186 
 patches/dev300/cws-impress162-canvas.diff                        |   17 
 patches/dev300/cws-impress162-sd.diff                            |   22 
 patches/dev300/cws-impress162-slideshow.diff                     |  368 
 patches/dev300/cws-moz2seamonkey01-configure.diff                |  109 
 patches/dev300/cws-moz2seamonkey01-connectivity.diff             | 2851 ---
 patches/dev300/cws-moz2seamonkey01-moz.diff                      | 7529 ----------
 patches/dev300/cws-scsheetprotection02-sc.diff                   | 7194 ---------
 patches/dev300/cws-scsheetprotection02-sfx2.diff                 |   74 
 patches/dev300/cws-scsheetprotection02-svx.diff                  |  261 
 patches/dev300/cws-sdk311.diff                                   |  187 
 20 files changed, 5 insertions(+), 19180 deletions(-)

New commits:
commit d287adfc90ffcc013732fa218910296d5f559523
Author: Rene Engelhard <rene at debian.org>
Date:   Fri Aug 7 12:57:32 2009 +0200

    remove obsolete find . over the full tree

diff --git a/bin/localize-ooo b/bin/localize-ooo
index f63c138..8592e58 100755
--- a/bin/localize-ooo
+++ b/bin/localize-ooo
@@ -65,9 +65,7 @@ if test "$split_build" != "yes" && ! which localize >/dev/null 2>&1 ; then
     echo "Fixing localize.sdf permissions..."
     if [ -d $OOBUILDDIR/l10n ]; then
 	find $OOBUILDDIR/l10n -type f -name "localize.sdf" -exec chmod 644 {} \;
-    else
-        find $OOBUILDDIR -type f -name "localize.sdf" -exec chmod 644 {} \;
-   fi
+    fi
 fi
 
 # will filter the sdf files in the split-build
commit 37c9dfc8e005581b412f18b193af4422ad8bb7b4
Author: Rene Engelhard <rene at debian.org>
Date:   Fri Aug 7 12:12:27 2009 +0200

    remove obsolete patches
    
    * configure.in: only handle seamonkey 1.1.14
    * patches/dev300/apply: remove obsolete patches
    * patches/dev300/calc-dde-always-ooo-conv.diff: remove
    * patches/dev300/calc-dp-disable-autofilter.diff: remove
    * patches/dev300/calc-formula-variable-separators-ref-display.diff: remove
    * patches/dev300/calc-named-range-excel-syntax-fix.diff: remove
    * patches/dev300/calc-remove-merge-flags-on-row-insert.diff: remove
    * patches/dev300/calc-xls-import-maxcol.diff: remove
    * patches/dev300/chart-formula-syntax.diff: remove
    * patches/dev300/cws-impress162-canvas.diff: remove
    * patches/dev300/cws-impress162-sd.diff: remove
    * patches/dev300/cws-impress162-slideshow.diff: remove
    * patches/dev300/cws-moz2seamonkey01-configure.diff: remove
    * patches/dev300/cws-moz2seamonkey01-connectivity.diff: remove
    * patches/dev300/cws-moz2seamonkey01-moz.diff: remove
    * patches/dev300/cws-scsheetprotection02-sc.diff: remove
    * patches/dev300/cws-scsheetprotection02-sfx2.diff: remove
    * patches/dev300/cws-scsheetprotection02-svx.diff: remove
    * patches/dev300/cws-sdk311.diff: remove

diff --git a/configure.in b/configure.in
index a563b06..1445898 100644
--- a/configure.in
+++ b/configure.in
@@ -821,11 +821,7 @@ AC_SUBST(PREBUILT_WRITINGAIDS_TIMESTAMP)
 PREBUILT_EXTENSIONAIDS_TIMESTAMP=20090523
 AC_SUBST(PREBUILT_EXTENSIONAIDS_TIMESTAMP)
 
-if echo "$with_tag" | $GREP -E ['^(dev300-m5[3-9])'] >/dev/null 2>/dev/null ; then
-  BUILD_MOZILLA_SOURCE='seamonkey-1.1.14.source.tar.gz'
-else
-  BUILD_MOZILLA_SOURCE='seamonkey-1.1.13.source.tar.gz'
-fi
+BUILD_MOZILLA_SOURCE='seamonkey-1.1.14.source.tar.gz'
 AC_SUBST(BUILD_MOZILLA_SOURCE)
 
 AGFA_MONOTYPE_FONTS_SOURCE='agfa-monotype-fonts.tar.gz'
diff --git a/patches/dev300/apply b/patches/dev300/apply
index 73914a7..01efded 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -8,7 +8,7 @@
 PATCHPATH=.:../evo2:../vba:../mono:../64bit:../cairo:../gstreamer:../ooxml:../postgresql:../emf+:../unittesting:../lwp
 
 # might be space separated list to support more MWS
-OLDEST_SUPPORTED=ooo310-m11
+OLDEST_SUPPORTED=dev300-m54
 
 # -------- Functional sub-sets --------
 Common : PreprocessPatches, BuildBits, TemporaryHacks, FixesNotForUpstream, \
@@ -742,14 +742,6 @@ vba-sc-autoshapes-hyperlinks.diff, i#66550, noelpwer
 #TODO: we need to re-implement this as a separate menu option. (n#500985)
 #sc-delete-rows-columns-remembers-content.diff, i#71921, jholesov
 
-[ CalcFixes < dev300-m52 ]
-# load, store and save the sheet protection options from and to an Excel file,
-# and use that information to constrain cell cursor movement when the sheet is
-# protected.  Also to support encryption on Excel file export.
-cws-scsheetprotection02-sfx2.diff, i#97515, kohei
-cws-scsheetprotection02-svx.diff,  i#97515, kohei
-cws-scsheetprotection02-sc.diff,   i#97515, kohei
-
 [ CalcFixes ]
 # fix a crasher when loading xls doc with unsupported encryption.
 calc-xls-decryption-crash-fix.diff, i#102906, kohei
@@ -857,11 +849,6 @@ calc-dp-custom-names-sc-group-fix.diff, n#491637, kohei
 # default output to new sheet, instead of current sheet.
 calc-dp-default-new-sheet.diff, i#50886, kohei
 
-[ CalcFixes < dev300-m52 ]
-# always use OOo address convention when parsing address in DDE function.
-calc-dde-always-ooo-conv.diff, n#442143, i#101041, kohei
-
-[ CalcFixes ]
 # Replace 'Manual Break' with 'Page Break' in menu texts.
 calc-menu-manual-page-break.diff, kohei
 
@@ -890,14 +877,6 @@ speed-local-link.diff, i#63927, michael
 # fix: this breaks win32
 fpicker-kde-gcc4-visibility.diff, pmladek
 
-[ LinuxOnly < dev300-m53 ]
-#Backport a more recent mozilla building. For the while not for win32, since
-#there are not yet precompiled packages for mozilla based on this CWS.
-cws-moz2seamonkey01-moz.diff
-cws-moz2seamonkey01-configure.diff
-cws-moz2seamonkey01-connectivity.diff
-
-
 [ Misc ]
 # Insert symbol defaults to the Symbol font - not a random one
 gui-sw-insert-symbol.diff, i#15512, michael
@@ -1013,9 +992,6 @@ odk-build-force-openjdks-javadoc.diff
 # add JDK paths for MySQL, PostgreSQL, JTDS
 jdbc-driver-classpaths-debian.diff
 
-[ SdkFixes < ooo310-m14 < dev300-m52 ]
-cws-sdk311.diff, i#101883
-
 [ GoOoSplash ]
 # move progress bar for go-oo splash
 go-oo-splash.diff
@@ -2017,14 +1993,6 @@ calc-formula-variable-separators-sc.diff,        n#447164, i#92056, kohei
 calc-formula-variable-separators-svx.diff,       n#447164, i#92056, kohei
 calc-formula-variable-separators-officecfg.diff, n#447164, i#92056, kohei
 
-[ CalcFixes < dev300-m52 ]
-# Display references when entering input mode, even when the separators are not ';'.
-calc-formula-variable-separators-ref-display.diff, n#469395, i#101090, kohei
-
-# Fix chart breakage for non-default formula syntax (Excel A1 and R1C1).
-chart-formula-syntax.diff, n#487350, i#101091, kohei
-
-[ CalcFixes ]
 # Squeeze chart's subtitle into the 2nd line of the main title when exporting
 # to xls.
 chart-subtitle-xls-export.diff, i#92357, kohei
@@ -2059,10 +2027,6 @@ calc-find-replace-empty-cells-svx.diff i#49380, n#415352, kohei
 calc-enhanced-merge-cells-sc.diff,        n#213205, i#67243, i#101042, jholesov/kohei
 calc-enhanced-merge-cells-officecfg.diff, n#213205, i#67243, i#101042, jholesov/kohei
 
-[ CalcFixes < dev300-m52 ]
-calc-named-range-excel-syntax-fix.diff, n#481200, i#101043, kohei
-
-[ CalcFixes ]
 # import/export precision of value cells correctly.
 calc-filter-dbf-precision.diff, n#479025, i#101045, kohei
 
@@ -2078,22 +2042,11 @@ calc-html-import-custom-lang-sc.diff,      i#102141, n#484272, kohei
 calc-csv-import-custom-lang-sc.diff,        n#510168, i#97416, kohei
 calc-csv-import-custom-lang-officecfg.diff, n#510168, i#97416, kohei
 
-[ CalcFixes < dev300-m52 ]
-# Don't duplicate merge flags when inserting a new row, to avoid merge flag 
-# corruption.
-calc-remove-merge-flags-on-row-insert.diff, n#484599, i#101047, kohei
-
-[ CalcFixes ]
 # quick editing of field member visibilities via popup window.
 calc-dp-hide-list-menu.diff,        n#483379, i#100619, kohei
 calc-dp-hide-list-menu-bugfix.diff, n#483379, i#100619, kohei
 calc-dp-hide-list-menu-crash-fix.diff, n#520556, i#103512, kohei
 
-[ CalcFixes < dev300-m52 ]
-# disable autofilter within datapilot output.
-calc-dp-disable-autofilter.diff, n#484600, i#101048, kohei
-
-[ CalcFixes ]
 # allow ctrl-[ and ctrl-] to jump to references used in a formula expression.
 calc-jump-on-formula-ref-offapi.diff,    n#464359, i#101018, kohei
 calc-jump-on-formula-ref-officecfg.diff, n#464359, i#101018, kohei
@@ -2101,11 +2054,6 @@ calc-jump-on-formula-ref-sc.diff,        n#464359, i#101018, kohei
 calc-jump-on-formula-ref-sfx2.diff,      n#464359, i#101018, kohei
 calc-jump-on-formula-ref-vcl.diff,       n#464359, i#101018, kohei
 
-[ CalcFixes < dev300-m52 ]
-# extend column range to Calc's max column when the range ends with 256.
-calc-xls-import-maxcol.diff, n#495140, i#101330, kohei
-
-[ CalcFixes ]
 # support custom sort in datapilot tables.
 calc-dp-custom-sort.diff, n#443361, kohei
 
@@ -2986,12 +2934,6 @@ instset-macos-langpacks.diff, i#64937, cloph
 sal-disable-backtrace.diff, thorsten
 sw-invert-border-spacing.diff, n#391591, flr
 
-[ Fixes < dev300-m48 ]
-cws-impress162-sd.diff, i#94193, thorsten
-cws-impress162-canvas.diff, i#94193, thorsten
-cws-impress162-slideshow.diff, i#94193, thorsten
-
-[ Fixes ]
 canvas-directx-lostdevice-fix.diff, n#445628, thorsten
 sw-table-join-fix-i99267.diff, n#417814, flr
 svtools-svrtf-token-ignore-case.diff, n#417818, flr
diff --git a/patches/dev300/calc-dde-always-ooo-conv.diff b/patches/dev300/calc-dde-always-ooo-conv.diff
deleted file mode 100644
index d1f75d5..0000000
--- a/patches/dev300/calc-dde-always-ooo-conv.diff
+++ /dev/null
@@ -1,23 +0,0 @@
-diff --git sc/source/ui/docshell/docsh4.cxx sc/source/ui/docshell/docsh4.cxx
-index 783c7f9..a9a5820 100644
---- sc/source/ui/docshell/docsh4.cxx
-+++ sc/source/ui/docshell/docsh4.cxx
-@@ -2473,10 +2473,14 @@ long __EXPORT ScDocShell::DdeSetData( const String& rItem,
- 				pData->GetSymbol( aPos );			// continue with the name's contents
- 		}
- 	}
--	ScRange aRange;
--    formula::FormulaGrammar::AddressConvention eConv = aDocument.GetAddressConvention();
--	BOOL bValid = ( ( aRange.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) ||
--					( aRange.aStart.Parse( aPos, &aDocument, eConv ) & SCA_VALID ) );
-+
-+    // Address in DDE function must be always parsed as CONV_OOO so that it 
-+    // would always work regardless of current address convension.  We do this
-+    // because the address item in a DDE entry is *not* normalized when saved
-+    // into ODF.
-+    ScRange aRange;
-+    bool bValid = ( (aRange.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO ) & SCA_VALID) ||
-+                    (aRange.aStart.Parse(aPos, &aDocument, formula::FormulaGrammar::CONV_OOO) & SCA_VALID) );
- 
- 	ScServerObject* pObj = NULL;			// NULL = error
- 	if ( bValid )
diff --git a/patches/dev300/calc-dp-disable-autofilter.diff b/patches/dev300/calc-dp-disable-autofilter.diff
deleted file mode 100644
index 75cc2f7..0000000
--- a/patches/dev300/calc-dp-disable-autofilter.diff
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git sc/source/ui/view/cellsh2.cxx sc/source/ui/view/cellsh2.cxx
-index 365a2c7..832de0c 100644
---- sc/source/ui/view/cellsh2.cxx
-+++ sc/source/ui/view/cellsh2.cxx
-@@ -1239,7 +1239,11 @@ void __EXPORT ScCellShell::GetDBState( SfxItemSet& rSet )
- 						{
- 							rSet.DisableItem( nWhich );
- 						}
--						else
-+						else if (pDoc->GetDPAtBlock(aDummy))
-+                        {    
-+                            rSet.DisableItem( nWhich );
-+                        }
-+                        else
- 							rSet.Put( SfxBoolItem( nWhich, bAutoFilter ) );
- 					}
- 					else
diff --git a/patches/dev300/calc-formula-variable-separators-ref-display.diff b/patches/dev300/calc-formula-variable-separators-ref-display.diff
deleted file mode 100644
index 0db16fd..0000000
--- a/patches/dev300/calc-formula-variable-separators-ref-display.diff
+++ /dev/null
@@ -1,227 +0,0 @@
-diff --git sc/inc/compiler.hxx sc/inc/compiler.hxx
-index c96da1f..a8bbe7c 100644
---- sc/inc/compiler.hxx
-+++ sc/inc/compiler.hxx
-@@ -353,6 +353,7 @@ public:
- 
-     static BOOL EnQuote( String& rStr );
-     
-+    sal_Unicode GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const;
- 
-     // Check if it is a valid english function name
-     bool IsEnglishSymbol( const String& rName ); 
-diff --git sc/source/core/tool/compiler.cxx sc/source/core/tool/compiler.cxx
-index ad87394..5d088b3 100644
---- sc/source/core/tool/compiler.cxx
-+++ sc/source/core/tool/compiler.cxx
-@@ -4984,6 +4984,11 @@ BOOL ScCompiler::EnQuote( String& rStr )
-     return TRUE;
- }
- 
-+sal_Unicode ScCompiler::GetNativeAddressSymbol( Convention::SpecialSymbolType eType ) const
-+{
-+    return pConv->getSpecialSymbol(eType);
-+}
-+
- void ScCompiler::fillAddInToken(::std::vector< ::com::sun::star::sheet::FormulaOpCodeMapEntry >& _rVec,bool _bIsEnglish) const
- {
-     // All known AddIn functions.
-diff --git sc/source/core/tool/editutil.cxx sc/source/core/tool/editutil.cxx
-index 31dc996..f6eb148 100644
---- sc/source/core/tool/editutil.cxx
-+++ sc/source/core/tool/editutil.cxx
-@@ -64,12 +64,13 @@
- #include "patattr.hxx"
- #include "scmod.hxx"
- #include "inputopt.hxx"
-+#include "compiler.hxx"
- 
- // STATIC DATA -----------------------------------------------------------
- 
- //	Delimiters zusaetzlich zu EditEngine-Default:
- 
--const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=();+-*/^&<>";
-+const sal_Char __FAR_DATA ScEditUtil::pCalcDelimiters[] = "=()+-*/^&<>";
- 
- 
- //------------------------------------------------------------------------
-@@ -79,6 +80,7 @@ String ScEditUtil::ModifyDelimiters( const String& rOld )
- 	String aRet = rOld;
- 	aRet.EraseAllChars( '_' );	// underscore is used in function argument names
- 	aRet.AppendAscii( RTL_CONSTASCII_STRINGPARAM( pCalcDelimiters ) );
-+    aRet.Append(ScCompiler::GetNativeSymbol(ocSep)); // argument separator is localized.
- 	return aRet;
- }
- 
-diff --git sc/source/ui/app/inputhdl.cxx sc/source/ui/app/inputhdl.cxx
-index 8e4bb2a..2740091 100644
---- sc/source/ui/app/inputhdl.cxx
-+++ sc/source/ui/app/inputhdl.cxx
-@@ -113,14 +113,22 @@ extern USHORT nEditAdjust;		//! Member an ViewData
- 
- //==================================================================
- 
-+static sal_Unicode lcl_getSheetSeparator(ScDocument* pDoc)
-+{
-+    ScCompiler aComp(pDoc, ScAddress());
-+    aComp.SetGrammar(pDoc->GetGrammar());
-+    return aComp.GetNativeAddressSymbol(ScCompiler::Convention::SHEET_SEPARATOR);
-+}
-+
- void ScInputHandler::InitRangeFinder( const String& rFormula )
- {
- 	DeleteRangeFinder();
-+    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
-+    ScDocument* pDoc = pDocSh->GetDocument();
-+    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDoc);
- 
- 	if ( !pActiveViewSh || !SC_MOD()->GetInputOptions().GetRangeFinder() )
- 		return;
--	ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
--	ScDocument* pDoc = pDocSh->GetDocument();
- 
- //	String aDelimiters = pEngine->GetWordDelimiters();
- 	String aDelimiters = ScEditUtil::ModifyDelimiters(
-@@ -129,7 +137,7 @@ void ScInputHandler::InitRangeFinder( const String& rFormula )
- 	xub_StrLen nColon = aDelimiters.Search(':');
- 	if ( nColon != STRING_NOTFOUND )
- 		aDelimiters.Erase( nColon, 1 );				// Delimiter ohne Doppelpunkt
--	xub_StrLen nDot = aDelimiters.Search('.');
-+	xub_StrLen nDot = aDelimiters.Search(cSheetSep);
- 	if ( nDot != STRING_NOTFOUND )
- 		aDelimiters.Erase( nDot, 1 );				// Delimiter ohne Punkt
- 
-@@ -702,6 +710,9 @@ void ScInputHandler::ShowTipCursor()
-     HideTip();
-     HideTipBelow();
-     EditView* pActiveView = pTopView ? pTopView : pTableView;
-+    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
-+    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
-+    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
- 
-     if ( bFormulaMode && pActiveView && pFormulaDataPara && pEngine->GetParagraphCount() == 1 )
-     {
-@@ -731,7 +742,7 @@ void ScInputHandler::ShowTipCursor()
-                 if( nLeftParentPos != STRING_NOTFOUND )
-                 {
-                     sal_Unicode c = aSelText.GetChar( nLeftParentPos-1 );
--                    if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
-+                    if( !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ) )
-                         continue;
-                     nNextFStart = aHelper.GetFunctionStart( aSelText, nLeftParentPos, TRUE);
-                     if( aHelper.GetNextFunc( aSelText, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
-@@ -764,8 +775,8 @@ void ScInputHandler::ShowTipCursor()
-                                 }
-                                 if( bFlag )
-                                 {
--                                    nCountSemicolon = aNew.GetTokenCount(';')-1;
--                                    nCountDot = aNew.GetTokenCount('.')-1;
-+                                    nCountSemicolon = aNew.GetTokenCount(cSep)-1;
-+                                    nCountDot = aNew.GetTokenCount(cSheetSep)-1;
- 
-                                     if( !nCountSemicolon )
-                                     {
-@@ -787,7 +798,7 @@ void ScInputHandler::ShowTipCursor()
-                                             {
-                                                 nStartPosition = i+1;
-                                             }
--                                            else if( cNext == ';' )
-+                                            else if( cNext == cSep )
-                                             {
-                                                 nCount ++;
-                                                 nEndPosition = i;
-@@ -808,7 +819,7 @@ void ScInputHandler::ShowTipCursor()
-                                             {
-                                                 nStartPosition = i+1;
-                                             }
--                                            else if( cNext == ';' )
-+                                            else if( cNext == cSep )
-                                             {
-                                                 nCount ++;
-                                                 nEndPosition = i;
-@@ -818,7 +829,7 @@ void ScInputHandler::ShowTipCursor()
-                                                 }
-                                                 nStartPosition = nEndPosition+1;
-                                             }
--                                            else if( cNext == '.' )
-+                                            else if( cNext == cSheetSep )
-                                             {
-                                                 continue;
-                                             }
-@@ -919,6 +930,9 @@ void ScInputHandler::ShowTipBelow( const String& rText )
- void ScInputHandler::UseFormulaData()
- {
- 	EditView* pActiveView = pTopView ? pTopView : pTableView;
-+    ScDocShell* pDocSh = pActiveViewSh->GetViewData()->GetDocShell();
-+    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
-+    const sal_Unicode cSheetSep = lcl_getSheetSeparator(pDocSh->GetDocument());
- 
- 	//	Formeln duerfen nur 1 Absatz haben
- 	if ( pActiveView && pFormulaData && pEngine->GetParagraphCount() == 1 )
-@@ -970,7 +984,7 @@ void ScInputHandler::UseFormulaData()
-                     break;
- 
-                 sal_Unicode c = aFormula.GetChar( nLeftParentPos-1 );
--                if( !(c >= 'A' && c<= 'Z' || c>= 'a' && c<= 'z' ) )
-+                if( !((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') ) )
-                     continue;
-                 nNextFStart = aHelper.GetFunctionStart( aFormula, nLeftParentPos, TRUE);
-                 if( aHelper.GetNextFunc( aFormula, FALSE, nNextFStart, &nNextFEnd, &ppFDesc, &aArgs ) )
-@@ -1002,8 +1016,8 @@ void ScInputHandler::UseFormulaData()
-                             }
-                             if( bFlag )
-                             {
--                                nCountSemicolon = aNew.GetTokenCount(';')-1;
--                                nCountDot = aNew.GetTokenCount('.')-1;
-+                                nCountSemicolon = aNew.GetTokenCount(cSep)-1;
-+                                nCountDot = aNew.GetTokenCount(cSheetSep)-1;
-                                 
-                                if( !nCountSemicolon )
-                                {
-@@ -1025,7 +1039,7 @@ void ScInputHandler::UseFormulaData()
-                                         {
-                                             nStartPosition = i+1;
-                                         }
--                                        else if( cNext == ';' )
-+                                        else if( cNext == cSep )
-                                         {
-                                             nCount ++;
-                                             nEndPosition = i;
-@@ -1046,7 +1060,7 @@ void ScInputHandler::UseFormulaData()
-                                         {
-                                             nStartPosition = i+1;
-                                         }
--                                        else if( cNext == ';' )
-+                                        else if( cNext == cSep )
-                                         {
-                                             nCount ++;
-                                             nEndPosition = i;
-@@ -1056,7 +1070,7 @@ void ScInputHandler::UseFormulaData()
-                                             }
-                                             nStartPosition = nEndPosition+1;
-                                         }
--                                        else if( cNext == '.' )
-+                                        else if( cNext == cSheetSep )
-                                         {
-                                             continue;
-                                         }
-@@ -2759,6 +2773,7 @@ BOOL ScInputHandler::IsModalMode( SfxObjectShell* pDocSh )
- 
- void ScInputHandler::AddRefEntry()
- {
-+    const sal_Unicode cSep = ScCompiler::GetNativeSymbol(ocSep).GetChar(0);
- 	UpdateActiveView();
- 	if (!pTableView && !pTopView)
- 		return; 							// z.B. FillMode
-@@ -2767,9 +2782,9 @@ void ScInputHandler::AddRefEntry()
- 
- 	RemoveSelection();
- 	if (pTableView)
--		pTableView->InsertText( ';', FALSE );
-+        pTableView->InsertText( cSep, FALSE );
- 	if (pTopView)
--		pTopView->InsertText( ';', FALSE );
-+        pTopView->InsertText( cSep, FALSE );
- 
- 	DataChanged();
- }
diff --git a/patches/dev300/calc-named-range-excel-syntax-fix.diff b/patches/dev300/calc-named-range-excel-syntax-fix.diff
deleted file mode 100644
index f01395f..0000000
--- a/patches/dev300/calc-named-range-excel-syntax-fix.diff
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git sc/source/ui/app/inputwin.cxx sc/source/ui/app/inputwin.cxx
-index 580e3be..5273634 100644
---- sc/source/ui/app/inputwin.cxx
-+++ sc/source/ui/app/inputwin.cxx
-@@ -1699,7 +1699,7 @@ void ScPosWnd::DoEnter()
-                         ScRangeName aNewRanges( *pNames );
-                         ScAddress aCursor( pViewData->GetCurX(), pViewData->GetCurY(), pViewData->GetTabNo() );
-                         String aContent;
--                        aSelection.Format( aContent, SCR_ABS_3D, pDoc );
-+                        aSelection.Format( aContent, SCR_ABS_3D, pDoc, pDoc->GetAddressConvention() );
-                         ScRangeData* pNew = new ScRangeData( pDoc, aText, aContent, aCursor );
-                         if ( aNewRanges.Insert(pNew) )
-                         {
diff --git a/patches/dev300/calc-remove-merge-flags-on-row-insert.diff b/patches/dev300/calc-remove-merge-flags-on-row-insert.diff
deleted file mode 100644
index 7d51505..0000000
--- a/patches/dev300/calc-remove-merge-flags-on-row-insert.diff
+++ /dev/null
@@ -1,16 +0,0 @@
-diff --git sc/source/core/data/attarray.cxx sc/source/core/data/attarray.cxx
-index 3d0e5de..c02d595 100644
---- sc/source/core/data/attarray.cxx
-+++ sc/source/core/data/attarray.cxx
-@@ -2135,9 +2135,8 @@ void ScAttrArray::InsertRow( SCROW nStartRow, SCSIZE nSize )
- 		//	im eingefuegten Bereich ist nichts zusammengefasst
- 	}
- 
--	//	Flags nicht duplizieren
--	//!	direkt am Pattern testen ??
--	RemoveFlags( nStartRow, nStartRow+nSize-1, SC_MF_HOR | SC_MF_VER | SC_MF_AUTO );
-+    // Don't duplicate the merge flags in the inserted row.
-+    RemoveFlags( nStartRow, nStartRow+nSize-1, SC_MF_ALL );
- }
- 
- 
diff --git a/patches/dev300/calc-xls-import-maxcol.diff b/patches/dev300/calc-xls-import-maxcol.diff
deleted file mode 100644
index e1ebf47..0000000
--- a/patches/dev300/calc-xls-import-maxcol.diff
+++ /dev/null
@@ -1,17 +0,0 @@
-diff --git sc/source/filter/excel/colrowst.cxx sc/source/filter/excel/colrowst.cxx
-index af8d5d9..43df0d2 100644
---- sc/source/filter/excel/colrowst.cxx
-+++ sc/source/filter/excel/colrowst.cxx
-@@ -95,6 +95,12 @@ void XclImpColRowSettings::SetWidthRange( SCCOL nScCol1, SCCOL nScCol2, sal_uInt
- {
-     DBG_ASSERT( (nScCol1 <= nScCol2) && ValidCol( nScCol2 ), "XclImpColRowSettings::SetColWidthRange - invalid column range" );
-     nScCol2 = ::std::min( nScCol2, MAXCOL );
-+    if (nScCol2 == 256)
-+        // In BIFF8, the column range is 0-255, and the use of 256 probably
-+        // means the range should extend to the max column if the loading app
-+        // support columns beyond 255.
-+        nScCol2 = MAXCOL;
-+
-     nScCol1 = ::std::min( nScCol1, nScCol2 );
-     ::std::fill( maWidths.begin() + nScCol1, maWidths.begin() + nScCol2 + 1, nWidth );
-     for( ScfUInt8Vec::iterator aIt = maColFlags.begin() + nScCol1, aEnd = maColFlags.begin() + nScCol2 + 1; aIt != aEnd; ++aIt )
diff --git a/patches/dev300/chart-formula-syntax.diff b/patches/dev300/chart-formula-syntax.diff
deleted file mode 100644
index 3ea27fc..0000000
--- a/patches/dev300/chart-formula-syntax.diff
+++ /dev/null
@@ -1,186 +0,0 @@
-diff --git sc/inc/reftokenhelper.hxx sc/inc/reftokenhelper.hxx
-index b1159cc..d7b335f 100644
---- sc/inc/reftokenhelper.hxx
-+++ sc/inc/reftokenhelper.hxx
-@@ -56,7 +56,8 @@ public:
-      * The source range may consist of multiple ranges separated by ';'s. 
-      */
-     static void compileRangeRepresentation(
--        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc);
-+        ::std::vector<ScSharedTokenRef>& rRefTokens, const ::rtl::OUString& rRangeStr, ScDocument* pDoc,
-+        ::formula::FormulaGrammar::Grammar eGrammar = ::formula::FormulaGrammar::GRAM_ENGLISH);
- 
-     static bool getRangeFromToken(ScRange& rRange, const ScSharedTokenRef& pToken, bool bExternal = false);
- 
-diff --git sc/source/core/data/documen5.cxx sc/source/core/data/documen5.cxx
-index 19f6b09..a921945 100644
---- sc/source/core/data/documen5.cxx
-+++ sc/source/core/data/documen5.cxx
-@@ -130,6 +130,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
- 
-             if( xLabel.is())
-             {
-+                // the range string must be in Calc A1 format.
-                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
-                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
-                 
-@@ -145,6 +146,7 @@ void lcl_SetChartRanges( const uno::Reference< chart2::XChartDocument >& xChartD
- 
-             if( xValues.is())
-             {
-+                // the range string must be in Calc A1 format.
-                 uno::Reference< chart2::data::XDataSequence > xNewSeq(
-                     xDataProvider->createDataSequenceByRangeRepresentation( rRanges[nRange++] ));
-                 
-@@ -391,7 +393,7 @@ void ScDocument::GetChartRanges( const String& rChartName, ::std::vector< ScRang
-         for( sal_Int32 nN=0; nN<aRangeStrings.getLength(); nN++ )
-         {
-             ScRangeList aRanges;
--            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc );
-+            aRanges.Parse( aRangeStrings[nN], pSheetNameDoc, SCA_VALID, pSheetNameDoc->GetAddressConvention() );
-             rRangesVector.push_back(aRanges);
-         }
-     }
-@@ -407,8 +409,8 @@ void ScDocument::SetChartRanges( const String& rChartName, const ::std::vector<
-         for( sal_Int32 nN=0; nN<nCount; nN++ )
-         {
-             ScRangeList aScRangeList( rRangesVector[nN] );
--            String sRangeStr;
--            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this, GetAddressConvention() );
-+            String sRangeStr; // This range must be in Calc A1 format.
-+            aScRangeList.Format( sRangeStr, SCR_ABS_3D, this );
-             aRangeStrings[nN]=sRangeStr;
-         }
-         lcl_SetChartRanges( xChartDoc, aRangeStrings );
-diff --git sc/source/core/tool/reftokenhelper.cxx sc/source/core/tool/reftokenhelper.cxx
-index 8ecb44a..0e07819 100644
---- sc/source/core/tool/reftokenhelper.cxx
-+++ sc/source/core/tool/reftokenhelper.cxx
-@@ -49,7 +49,7 @@ using ::std::auto_ptr;
- using ::rtl::OUString;
- 
- void ScRefTokenHelper::compileRangeRepresentation(
--    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc)
-+    vector<ScSharedTokenRef>& rRefTokens, const OUString& rRangeStr, ScDocument* pDoc, FormulaGrammar::Grammar eGrammar)
- {
-     const sal_Unicode cSep = ';';
-     const sal_Unicode cQuote = '\'';
-@@ -63,7 +63,7 @@ void ScRefTokenHelper::compileRangeRepresentation(
-             break;
-         
-         ScCompiler aCompiler(pDoc, ScAddress(0,0,0));
--        aCompiler.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
-+        aCompiler.SetGrammar(eGrammar);
-         auto_ptr<ScTokenArray> pArray(aCompiler.CompileString(aToken));
- 
-         // There should only be one reference per range token.
-diff --git sc/source/ui/drawfunc/fuins2.cxx sc/source/ui/drawfunc/fuins2.cxx
-index f2562a3..22b46b9 100644
---- sc/source/ui/drawfunc/fuins2.cxx
-+++ sc/source/ui/drawfunc/fuins2.cxx
-@@ -167,8 +167,10 @@ void lcl_ChartInit( const uno::Reference < embed::XEmbeddedObject >& xObj, ScVie
-             if ( aRangeListRef->Count() )
-             {
-                 pScDoc->LimitChartIfAll( aRangeListRef );               // limit whole columns/rows to used area
-+
-+                // update string from modified ranges.  The ranges must be in the current formula syntax.
-                 String aTmpStr;                            
--                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );   // update string from changed ranges
-+                aRangeListRef->Format( aTmpStr, SCR_ABS_3D, pScDoc, pScDoc->GetAddressConvention() );
-                 aRangeString = aTmpStr;
- 
-                 ScChartPositioner aChartPositioner( pScDoc, aRangeListRef );
-diff --git sc/source/ui/unoobj/chart2uno.cxx sc/source/ui/unoobj/chart2uno.cxx
-index 8bbd382..d9c2698 100644
---- sc/source/ui/unoobj/chart2uno.cxx
-+++ sc/source/ui/unoobj/chart2uno.cxx
-@@ -1057,7 +1057,7 @@ void lcl_SeperateOneRowRange(ScRange aR, const ScAddress& rPos, ScRangeListRef&
-     }
- 
-     vector<ScSharedTokenRef> aTokens;
--    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
-+    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
-     return !aTokens.empty();
- }
- 
-@@ -1451,7 +1451,7 @@ ScChart2DataProvider::createDataSource(
-     }
- 
-     vector<ScSharedTokenRef> aRefTokens;
--    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
-+    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
-     if (aRefTokens.empty())
-         // Invalid range representation.  Bail out.
-         throw lang::IllegalArgumentException();
-@@ -2184,7 +2184,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum
-         return false;
- 
-     vector<ScSharedTokenRef> aTokens;
--    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument);
-+    ScRefTokenHelper::compileRangeRepresentation(aTokens, aRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
-     return !aTokens.empty();
- }
- 
-@@ -2201,6 +2201,12 @@ uno::Reference< chart2::data::XDataSequence > SAL_CALL
-     if(!m_pDocument || (aRangeRepresentation.getLength() == 0))
-         return xResult;
- 
-+    // Note: the range representation must be in Calc A1 format.  The import 
-+    // filters use this method to pass data ranges, and they have no idea what
-+    // the current formula syntax is.  In the future we should add another
-+    // method to allow the client code to directly pass tokens representing
-+    // ranges.
-+
-     vector<ScSharedTokenRef> aRefTokens;
-     ScRefTokenHelper::compileRangeRepresentation(aRefTokens, aRangeRepresentation, m_pDocument);
-     if (aRefTokens.empty())
-@@ -2246,7 +2252,7 @@ rtl::OUString SAL_CALL ScChart2DataProvider::convertRangeToXML( const rtl::OUStr
-         return aRet;
- 
-     vector<ScSharedTokenRef> aRefTokens;
--    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument);
-+    ScRefTokenHelper::compileRangeRepresentation(aRefTokens, sRangeRepresentation, m_pDocument, m_pDocument->GetGrammar());
-     if (aRefTokens.empty())
-         throw lang::IllegalArgumentException();
- 
-@@ -2405,7 +2411,7 @@ void ScChart2DataProvider::detectRangesFromDataSource(vector<ScSharedTokenRef>&
-     {
-         const OUString& rRangeRep = *itr;
-         vector<ScSharedTokenRef> aTokens;
--        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument);
-+        ScRefTokenHelper::compileRangeRepresentation(aTokens, rRangeRep, m_pDocument, m_pDocument->GetGrammar());
- 
-         CollectRefTokens func;
-         func = for_each(aTokens.begin(), aTokens.end(), func);
-diff --git sc/inc/document.hxx sc/inc/document.hxx
-index 810f215..1be2397 100644
---- sc/inc/document.hxx
-+++ sc/inc/document.hxx
-@@ -607,7 +607,7 @@ public:
- 	SC_DLLPUBLIC BOOL			IsActiveScenario( SCTAB nTab ) const;
- 	SC_DLLPUBLIC void			SetActiveScenario( SCTAB nTab, BOOL bActive );		// nur fuer Undo etc.
- 	SC_DLLPUBLIC formula::FormulaGrammar::AddressConvention GetAddressConvention() const;
--    formula::FormulaGrammar::Grammar GetGrammar() const;
-+    SC_DLLPUBLIC formula::FormulaGrammar::Grammar GetGrammar() const;
-     void            SetGrammar( formula::FormulaGrammar::Grammar eGram );
- 	SC_DLLPUBLIC BYTE			GetLinkMode( SCTAB nTab ) const;
- 	BOOL			IsLinked( SCTAB nTab ) const;
-diff --git sc/source/filter/excel/xechart.cxx sc/source/filter/excel/xechart.cxx
-index b01bdc6..cf3f218 100644
---- sc/source/filter/excel/xechart.cxx
-+++ sc/source/filter/excel/xechart.cxx
-@@ -717,11 +717,12 @@ sal_uInt16 XclExpChSourceLink::ConvertDataSequence( Reference< XDataSequence > x
-     if (!xDataSeq.is())
-         return nValueCount;
- 
--    // Compile the range representation string into token array.
-+    // Compile the range representation string into token array.  Note that the 
-+    // source range text depends on the current grammar.
-     OUString aRangeRepr = xDataSeq->getSourceRangeRepresentation();
-     ScRangeList aScRanges;
-     ScCompiler aComp(GetDocPtr(), ScAddress());
--    aComp.SetGrammar(FormulaGrammar::GRAM_ENGLISH);
-+    aComp.SetGrammar(GetDocPtr()->GetGrammar());
-     ScTokenArray* pArray = aComp.CompileString(aRangeRepr);
-     if (!pArray)
-         return nValueCount;
diff --git a/patches/dev300/cws-impress162-canvas.diff b/patches/dev300/cws-impress162-canvas.diff
deleted file mode 100644
index c0b376b..0000000
--- a/patches/dev300/cws-impress162-canvas.diff
+++ /dev/null
@@ -1,17 +0,0 @@
-Index: source/tools/surface.cxx
-===================================================================
-RCS file: /cvs/gsl/canvas/source/tools/surface.cxx,v
-retrieving revision 1.6
-retrieving revision 1.6.16.1
-diff -u -p -r1.6 -r1.6.16.1
---- canvas/source/tools/surface.cxx	9 Jun 2008 15:03:59 -0000	1.6
-+++ canvas/source/tools/surface.cxx	7 Oct 2008 15:02:20 -0000	1.6.16.1
-@@ -262,7 +262,7 @@ namespace canvas
- 
-         ::basegfx::B2IPoint aDestOffset;
-         if( mpFragment )
--            mpFragment->getPos();
-+            aDestOffset = mpFragment->getPos();
- 
- 		// convert size to normalized device coordinates
- 		const ::basegfx::B2DRectangle& rUV( 
diff --git a/patches/dev300/cws-impress162-sd.diff b/patches/dev300/cws-impress162-sd.diff
deleted file mode 100644
index 17671fb..0000000
--- a/patches/dev300/cws-impress162-sd.diff
+++ /dev/null
@@ -1,22 +0,0 @@
-Index: source/ui/slideshow/slideshowimpl.cxx
-===================================================================
-RCS file: /cvs/graphics/sd/source/ui/slideshow/slideshowimpl.cxx,v
-retrieving revision 1.57
-retrieving revision 1.57.10.1
-diff -u -p -r1.57 -r1.57.10.1
---- sd/source/ui/slideshow/slideshowimpl.cxx	28 Aug 2008 06:50:23 -0000	1.57
-+++ sd/source/ui/slideshow/slideshowimpl.cxx	8 Oct 2008 08:48:53 -0000	1.57.10.1
-@@ -1855,7 +1855,12 @@ IMPL_LINK( SlideshowImpl, updateHdl, Tim
- 			else
- */
- 			{
--                const float MIN_UPDATE = 0.05f; // do not wait less than 50 ms
-+                // Avoid busy loop when the previous call to update()
-+                // returns 0.  The minimum value is small enough to allow
-+                // high frame rates.  Values larger than 0 are typically
-+                // also larger then the small minimum value and thus are
-+                // used to determine the frame rate.
-+                const float MIN_UPDATE = 0.01f; // 10ms corresponds to 100 frames per second.
-                 if( fUpdate < MIN_UPDATE )
-                     fUpdate = MIN_UPDATE;
-                 else
diff --git a/patches/dev300/cws-impress162-slideshow.diff b/patches/dev300/cws-impress162-slideshow.diff
deleted file mode 100644
index 2bb5e58..0000000
--- a/patches/dev300/cws-impress162-slideshow.diff
+++ /dev/null
@@ -1,368 +0,0 @@
-? unxlngx6
-Index: source/engine/shapeattributelayer.cxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/engine/shapeattributelayer.cxx,v
-retrieving revision 1.10
-retrieving revision 1.10.16.1
-diff -u -p -r1.10 -r1.10.16.1
---- slideshow/source/engine/shapeattributelayer.cxx	24 Jun 2008 12:02:30 -0000	1.10
-+++ slideshow/source/engine/shapeattributelayer.cxx	20 Oct 2008 11:53:44 -0000	1.10.16.1
-@@ -46,6 +46,7 @@
- #include <com/sun/star/animations/AnimationAdditiveMode.hpp>
- 
- #include <basegfx/numeric/ftools.hxx>
-+#include <basegfx/polygon/b2dpolygon.hxx>
- #include <rtl/math.hxx>
- 
- 
-@@ -76,6 +77,8 @@ namespace slideshow
-                     ++mnPositionState;
-                 if( mnContentState != mpChild->getContentState() )
-                     ++mnContentState;
-+                if( mnVisibilityState != mpChild->getVisibilityState() )
-+                    ++mnVisibilityState;
-             }
-         }
- 
-@@ -172,6 +175,7 @@ namespace slideshow
-             mnAlphaState( rChildLayer ? rChildLayer->getAlphaState() : 0),
-             mnPositionState( rChildLayer ? rChildLayer->getPositionState() : 0 ),
-             mnContentState( rChildLayer ? rChildLayer->getContentState() : 0 ),
-+            mnVisibilityState( rChildLayer ? rChildLayer->getVisibilityState() : 0 ),
- 
-             mnAdditiveMode( animations::AnimationAdditiveMode::BASE ),
- 
-@@ -205,7 +209,7 @@ namespace slideshow
-             mbUnderlineModeValid( false ),	
-             mbCharPostureValid( false ),		
-             mbVisibilityValid( false )
--        {            
-+        {
-         }
- 
-         bool ShapeAttributeLayer::revokeChildLayer( const ShapeAttributeLayerSharedPtr& rChildLayer )
-@@ -233,6 +237,7 @@ namespace slideshow
-                     ++mnAlphaState;
-                     ++mnPositionState;
-                     ++mnContentState;                    
-+                    ++mnVisibilityState;                    
-                 }
-             }
-             else
-@@ -267,6 +272,7 @@ namespace slideshow
-                 ++mnAlphaState;
-                 ++mnPositionState;
-                 ++mnContentState;   
-+                ++mnVisibilityState;   
-             }                 
- 
-             mnAdditiveMode = nMode;
-@@ -633,7 +639,7 @@ namespace slideshow
-         {
-             mbVisibility = bVisible;
-             mbVisibilityValid = true;
--            ++mnContentState;
-+            ++mnVisibilityState;
-         }
- 
-         bool ShapeAttributeLayer::isCharColorValid() const
-@@ -841,5 +847,13 @@ namespace slideshow
-                 mnContentState; 
-         }
-         
-+        State::StateId ShapeAttributeLayer::getVisibilityState() const
-+        { 
-+            return haveChild() ? 
-+                ::std::max( mnVisibilityState,
-+                            mpChild->getVisibilityState() ) : 
-+                mnVisibilityState; 
-+        }
-+        
-     }
- }
-Index: source/engine/slideshowimpl.cxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/engine/slideshowimpl.cxx,v
-retrieving revision 1.10
-retrieving revision 1.10.16.2
-diff -u -p -r1.10 -r1.10.16.2
---- slideshow/source/engine/slideshowimpl.cxx	24 Jun 2008 12:03:06 -0000	1.10
-+++ slideshow/source/engine/slideshowimpl.cxx	16 Oct 2008 14:48:04 -0000	1.10.16.2
-@@ -92,6 +92,7 @@
- #include "slidebitmap.hxx"
- #include "rehearsetimingsactivity.hxx"
- #include "waitsymbol.hxx"
-+#include "framerate.hxx"
- 
- #include <boost/noncopyable.hpp>
- #include <boost/bind.hpp>
-@@ -1522,8 +1523,9 @@ sal_Bool SlideShowImpl::update( double &
-             // calc nNextTimeout value:
-             if (bActivitiesLeft) 
-             {
--                // activities left: requires immediate updates
--                nNextTimeout = 0.0; // come back ASAP
-+                // Activity queue is not empty.  Tell caller that we would
-+                // like to render another frame.
-+                nNextTimeout = 1.0 / FrameRate::PreferredFramesPerSecond;
-             }
-             else 
-             {
-Index: source/engine/animationnodes/animationbasenode.cxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/engine/animationnodes/animationbasenode.cxx,v
-retrieving revision 1.16
-retrieving revision 1.16.16.2
-diff -u -p -r1.16 -r1.16.16.2
---- slideshow/source/engine/animationnodes/animationbasenode.cxx	24 Jun 2008 12:06:45 -0000	1.16
-+++ slideshow/source/engine/animationnodes/animationbasenode.cxx	16 Oct 2008 14:48:04 -0000	1.16.16.2
-@@ -34,6 +34,7 @@
- // must be first
- #include <canvas/debug.hxx>
- #include <canvas/verbosetrace.hxx>
-+#include <canvas/canvastools.hxx>
- #include <cppuhelper/exc_hlp.hxx>
- #include <comphelper/anytostring.hxx>
- #include <com/sun/star/presentation/ParagraphTarget.hpp>
-@@ -45,6 +45,7 @@
- #include "doctreenode.hxx"
- #include "animationbasenode.hxx"
- #include "delayevent.hxx"
-+#include "framerate.hxx"
- 
- #include <boost/bind.hpp>
- #include <boost/optional.hpp>
-@@ -457,19 +458,24 @@ AnimationBaseNode::fillCommonParameters(
-         pEndEvent = makeEvent(
-             boost::bind( &AnimationNode::deactivate, pSelf ) );
-     }
--    
-+
-+    // Calculate the minimum frame count that depends on the duration and
-+    // the minimum frame count.
-+    const sal_Int32 nMinFrameCount (basegfx::clamp<sal_Int32>(
-+        basegfx::fround(nDuration * FrameRate::MinimumFramesPerSecond), 1, 10));
-+
-     return ActivitiesFactory::CommonParameters(
-         pEndEvent,
-         getContext().mrEventQueue,
-         getContext().mrActivitiesQueue,
-         nDuration,
--        10, // always display at least 10 frames
-+        nMinFrameCount,
-         bAutoReverse,
-         aRepeats,
-         nAcceleration,
-         nDeceleration,
-         getShape(),
--        getSlideSize() );
-+        getSlideSize());
- }
- 
- AttributableShapeSharedPtr AnimationBaseNode::getShape() const
-Index: source/engine/shapes/drawshape.cxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/engine/shapes/drawshape.cxx,v
-retrieving revision 1.7
-retrieving revision 1.7.12.1
-diff -u -p -r1.7 -r1.7.12.1
---- slideshow/source/engine/shapes/drawshape.cxx	11 Jul 2008 07:08:56 -0000	1.7
-+++ slideshow/source/engine/shapes/drawshape.cxx	20 Oct 2008 11:55:33 -0000	1.7.12.1
-@@ -270,6 +270,7 @@ namespace slideshow
-                 mnAttributeAlphaState = mpAttributeLayer->getAlphaState();
-                 mnAttributePositionState = mpAttributeLayer->getPositionState();
-                 mnAttributeContentState = mpAttributeLayer->getContentState();
-+                mnAttributeVisibilityState = mpAttributeLayer->getVisibilityState();
-             }
-         }
- 
-@@ -383,27 +384,42 @@ namespace slideshow
-             // do we have an attribute layer?
-             if( mpAttributeLayer )
-             {
--                // TODO(P1): This can be done without conditional branching. 
--                // See HAKMEM.
--                if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
-+                // Prevent nUpdateFlags to be modified when the shape is not
-+                // visible, except when it just was hidden.
-+                if (mpAttributeLayer->getVisibility()
-+                    || mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
-                 {
--                    nUpdateFlags |= ViewShape::POSITION;
--                }
--                if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
--                {
--                    nUpdateFlags |= ViewShape::ALPHA;
--                }
--                if( mpAttributeLayer->getClipState() != mnAttributeClipState )
--                {
--                    nUpdateFlags |= ViewShape::CLIP;
--                }
--                if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
--                {                
--                    nUpdateFlags |= ViewShape::TRANSFORMATION;
--                }
--                if( mpAttributeLayer->getContentState() != mnAttributeContentState )
--                {                
--                    nUpdateFlags |= ViewShape::CONTENT;
-+                    if (mpAttributeLayer->getVisibilityState() != mnAttributeVisibilityState )
-+                    {
-+                        // Change of the visibility state is mapped to
-+                        // content change because when the visibility
-+                        // changes then usually a sprite is shown or hidden
-+                        // and the background under has to be painted once.
-+                        nUpdateFlags |= ViewShape::CONTENT;
-+                    }
-+
-+                    // TODO(P1): This can be done without conditional branching. 
-+                    // See HAKMEM.
-+                    if( mpAttributeLayer->getPositionState() != mnAttributePositionState )
-+                    {
-+                        nUpdateFlags |= ViewShape::POSITION;
-+                    }
-+                    if( mpAttributeLayer->getAlphaState() != mnAttributeAlphaState )
-+                    {
-+                        nUpdateFlags |= ViewShape::ALPHA;
-+                    }
-+                    if( mpAttributeLayer->getClipState() != mnAttributeClipState )
-+                    {
-+                        nUpdateFlags |= ViewShape::CLIP;
-+                    }
-+                    if( mpAttributeLayer->getTransformationState() != mnAttributeTransformationState )
-+                    {                
-+                        nUpdateFlags |= ViewShape::TRANSFORMATION;
-+                    }
-+                    if( mpAttributeLayer->getContentState() != mnAttributeContentState )
-+                    {                
-+                        nUpdateFlags |= ViewShape::CONTENT;
-+                    }
-                 }
-             }
- 
-@@ -543,6 +559,7 @@ namespace slideshow
-             mnAttributeAlphaState(0),
-             mnAttributePositionState(0),
-             mnAttributeContentState(0),
-+            mnAttributeVisibilityState(0),
-             maViewShapes(),
-             mxComponentContext( rContext.mxComponentContext ),
-             maHyperlinkIndices(),
-@@ -603,6 +620,7 @@ namespace slideshow
-             mnAttributeAlphaState(0),
-             mnAttributePositionState(0),
-             mnAttributeContentState(0),
-+            mnAttributeVisibilityState(0),
-             maViewShapes(),
-             mxComponentContext( rContext.mxComponentContext ),
-             maHyperlinkIndices(),
-@@ -654,6 +672,7 @@ namespace slideshow
-             mnAttributeAlphaState(0),
-             mnAttributePositionState(0),
-             mnAttributeContentState(0),
-+            mnAttributeVisibilityState(0),
-             maViewShapes(),
-             mxComponentContext( rSrc.mxComponentContext ),
-             maHyperlinkIndices(),
-Index: source/engine/shapes/drawshape.hxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/engine/shapes/drawshape.hxx,v
-retrieving revision 1.4
-retrieving revision 1.4.12.1
-diff -u -p -r1.4 -r1.4.12.1
---- slideshow/source/engine/shapes/drawshape.hxx	11 Jul 2008 07:09:10 -0000	1.4
-+++ slideshow/source/engine/shapes/drawshape.hxx	24 Oct 2008 13:24:21 -0000	1.4.12.1
-@@ -338,6 +338,7 @@ namespace slideshow
-             mutable State::StateId                                                  mnAttributeAlphaState;
-             mutable State::StateId                                                  mnAttributePositionState;
-             mutable State::StateId                                                  mnAttributeContentState;
-+            mutable State::StateId                                                  mnAttributeVisibilityState;
- 
-             /// the list of active view shapes (one for each registered view layer)
-             typedef ::std::vector< ViewShapeSharedPtr > ViewShapeVector;
-Index: source/inc/framerate.hxx
-===================================================================
-RCS file: source/inc/framerate.hxx
-diff -N source/inc/framerate.hxx
---- /dev/null	1 Jan 1970 00:00:00 -0000
-+++ slideshow/source/inc/framerate.hxx	16 Oct 2008 14:48:05 -0000	1.1.2.1
-@@ -0,0 +1,56 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile$
-+ * $Revision$
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef INCLUDED_SLIDESHOW_FRAMERATE_HXX
-+#define INCLUDED_SLIDESHOW_FRAMERATE_HXX
-+
-+#include <sal/types.h>
-+
-+namespace slideshow { namespace internal {
-+
-+/** Some frame rate related data.
-+*/
-+class FrameRate
-+{
-+public:
-+    /** The minimum number of frames per second is used to calculate the
-+        minimum number of frames that is to be shown for active activities.
-+    */
-+    static const sal_Int32 MinimumFramesPerSecond = 10;
-+
-+    /** Aim high with the number of preferred number of frames per second.
-+        This number is the maximum as well and the true number will be lower.
-+    */
-+    static const sal_Int32 PreferredFramesPerSecond = 50;
-+};
-+
-+} } // end of namespace slideshow::internal
-+
-+#endif
-Index: source/inc/shapeattributelayer.hxx
-===================================================================
-RCS file: /cvs/graphics/slideshow/source/inc/shapeattributelayer.hxx,v
-retrieving revision 1.8
-retrieving revision 1.8.30.1
-diff -u -p -r1.8 -r1.8.30.1
---- slideshow/source/inc/shapeattributelayer.hxx	11 Apr 2008 01:29:17 -0000	1.8
-+++ slideshow/source/inc/shapeattributelayer.hxx	20 Oct 2008 11:52:16 -0000	1.8.30.1
-@@ -471,6 +471,7 @@ namespace slideshow
-             State::StateId getAlphaState() const;
-             State::StateId getPositionState() const;
-             State::StateId getContentState() const;
-+            State::StateId getVisibilityState() const;
- 
-         private:
-             // default copy/assignment operator is okay
-@@ -516,6 +517,7 @@ namespace slideshow
-             State::StateId 								mnAlphaState;
-             State::StateId 								mnPositionState;
-             State::StateId 								mnContentState;
-+            State::StateId 								mnVisibilityState;
- 
-             sal_Int16									mnAdditiveMode;
- 
diff --git a/patches/dev300/cws-moz2seamonkey01-configure.diff b/patches/dev300/cws-moz2seamonkey01-configure.diff
deleted file mode 100644
index cd9203b..0000000
--- a/patches/dev300/cws-moz2seamonkey01-configure.diff
+++ /dev/null
@@ -1,109 +0,0 @@
-Index: configure.in
-===================================================================
---- configure.in	(.../tags/DEV300_m41/configure.in)	(revision 269003)
-+++ configure.in	(.../cws/moz2seamonkey01/configure.in)	(revision 269003)
-@@ -1733,12 +1733,15 @@
- 			AC_MSG_RESULT([found Compiler version $CCNUMVER.])
- 			if test "$CCNUMVER" -ge "001500000000"; then
- 				COMEX=12
-+				MSVSVER=2008
- 				AC_MSG_RESULT([found .NET 2008 / VS 9.0.])
- 			elif test "$CCNUMVER" -ge "001400000000"; then
- 				COMEX=11
-+				MSVSVER=2005
- 				AC_MSG_RESULT([found .NET 2005.])
- 			elif test "$CCNUMVER" -ge "001300102240"; then
- 				COMEX=10
-+				MSVSVER=2003
- 				AC_MSG_RESULT([found .NET 2003.])
- 			else
- 				AC_MSG_ERROR([Compiler too old. Use Microsoft C/C++ .NET 2003/2005 compiler.])
-@@ -4097,9 +4100,14 @@
- 
- AC_MSG_CHECKING([for toolkit mozilla should use])
- if test -z "$with_mozilla_toolkit"; then
--   if test "$_os" != "WINNT"; then
--      MOZILLA_TOOLKIT=gtk2
--      AC_MSG_RESULT([gtk2])
-+   if test "$_os" != "WINNT" ; then
-+      if test "$_os" = "Darwin" ; then
-+         MOZILLA_TOOLKIT=mac  
-+         AC_MSG_RESULT([mac])
-+      else
-+         MOZILLA_TOOLKIT=gtk2
-+         AC_MSG_RESULT([gtk2])
-+      fi
-    fi
- else
-    MOZILLA_TOOLKIT=$with_mozilla_toolkit
-@@ -4121,7 +4129,7 @@
-       enable_build_mozilla=
- fi
- 
--AC_MSG_CHECKING([whether to build Mozilla])
-+AC_MSG_CHECKING([whether to build Mozilla/SeaMonkey])
- if test -n "$enable_build_mozilla"; then
-    BUILD_MOZAB="TRUE"
-    AC_MSG_RESULT([yes])
-@@ -4131,17 +4139,25 @@
- fi
- 
- if test "$BUILD_MOZAB" = "TRUE"; then
-+  if test "$_os" = "WINNT"; then
-+    if test "$WITH_MINGWIN" != "yes"; then
-+      # compiling with MSVC. Only supported platform here is MSVS2005 at the moment.
-+      if test "$MSVSVER" != "2005"; then
-+        AC_MSG_ERROR([Building SeaMonkey is supported with Microsoft Visual Studio .NET 2005 only.])
-+      fi
-+    else
-+      AC_MSG_WARN([Building SeaMonkey with mingwin is not tested, and likely to break.])
-+      echo "Building SeaMonkey with mingwin is not tested, and likely to break." >> warn
-+    fi
-+  fi
-+
-    if test -z "$MOZILLA_VERSION"; then
--      MOZILLA_VERSION=1.7.5
-+      MOZILLA_VERSION=1.1.13
-    fi
--   if test "$MOZILLA_VERSION" = "1.7b" ; then
--      MOZILLA_SOURCE_VERSION="mozilla-source-1.7b-source"
--   else
--      MOZILLA_SOURCE_VERSION="mozilla-source-${MOZILLA_VERSION}"
--   fi
-+   MOZILLA_SOURCE_VERSION="seamonkey-${MOZILLA_VERSION}.source"
-    for e in gz bz2; do
-       AC_MSG_CHECKING([for $MOZILLA_SOURCE_VERSION.tar.$e])
--      if test ! -e "./moz/download/$MOZILLA_SOURCE_VERSION.tar.$e" && test "$HAVE_MOZILLA_TARBALL" != "y"; then
-+      if test ! -e "moz/download/$MOZILLA_SOURCE_VERSION.tar.$e" && test "$HAVE_MOZILLA_TARBALL" != "y"; then
-          AC_MSG_RESULT([not found])
-          HAVE_MOZILLA_TARBALL=n
-       else
-@@ -4150,22 +4166,16 @@
-       fi
-    done
-    if test "$HAVE_MOZILLA_TARBALL" != "y"; then
--         AC_MSG_ERROR([Mozilla source archive not found.
-+         AC_MSG_ERROR([Mozilla/SeaMonkey source archive not found.
- Please copy $MOZILLA_SOURCE_VERSION.tar.bz2 or $MOZILLA_SOURCE_VERSION.tar.gz to moz/download/.
- The archives can be found here:
--http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla$MOZILLA_VERSION/source/])
-+http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/$MOZILLA_VERSION/])
-    fi
-    if test "$_os" = "WINNT"; then
--      AC_MSG_CHECKING([for glib and libIDL binaries])
--      if test ! -e "./moz/download/vc71-glib-1.2.10-bin.zip" \
--           -o ! -e "./moz/download/vc71-libIDL-0.6.8-bin.zip" \
--           -o ! -e "./moz/download/wintools.zip" ; then
--AC_MSG_ERROR([One or more of the following archives is missing in moz/download/
--  vc71-glib-1.2.10-bin.zip
--  vc71-libIDL-0.6.8-bin.zip
--(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc71/)
--  wintools.zip
--(from http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip)])
-+      AC_MSG_CHECKING([for moztools binaries])
-+      if test ! -e "moz/download/vc8-moztools.zip" ; then
-+        AC_MSG_ERROR([The following file is missing in moz/download: vc8-moztools.zip
-+(from ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/)])
-       else
-          AC_MSG_RESULT([ok])
-       fi
diff --git a/patches/dev300/cws-moz2seamonkey01-connectivity.diff b/patches/dev300/cws-moz2seamonkey01-connectivity.diff
deleted file mode 100644
index 7566c3c..0000000
--- a/patches/dev300/cws-moz2seamonkey01-connectivity.diff
+++ /dev/null
@@ -1,2851 +0,0 @@
---- connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx	(.../tags/DEV300_m41/connectivity)	(revision 0)
-+++ connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -0,0 +1,452 @@
-+/*************************************************************************
-+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+* 
-+* Copyright 2008 by Sun Microsystems, Inc.
-+*
-+* OpenOffice.org - a multi-platform office productivity suite
-+*
-+* $RCSfile: code,v $
-+*
-+* $Revision: 1.3 $
-+*
-+* This file is part of OpenOffice.org.
-+*
-+* OpenOffice.org is free software: you can redistribute it and/or modify
-+* it under the terms of the GNU Lesser General Public License version 3
-+* only, as published by the Free Software Foundation.
-+*
-+* OpenOffice.org is distributed in the hope that it will be useful,
-+* but WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+* GNU Lesser General Public License version 3 for more details
-+* (a copy is included in the LICENSE file that accompanied this code).
-+*
-+* You should have received a copy of the GNU Lesser General Public License
-+* version 3 along with OpenOffice.org.  If not, see
-+* <http://www.openoffice.org/license.html>
-+* for a copy of the LGPLv3 License.
-+************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_connectivity.hxx"
-+
-+#include <rtl/strbuf.hxx>
-+    // keep this include at the beginning. Some of the other includes seems to inject a symbol "l" into the
-+    // global namespace, which leads to a compiler warning in strbuf.hxx, about some parameters named "l"
-+    // hiding objects "in an outer scope".
-+
-+#include "MLdapAttributeMap.hxx"
-+#include "MTypeConverter.hxx"
-+#include "MQueryHelper.hxx"
-+
-+#include <tools/diagnose_ex.h>
-+
-+#include <hash_map>
-+
-+//........................................................................
-+namespace connectivity { namespace mozab {
-+//........................................................................
-+
-+	//====================================================================
-+	//= helper
-+	//====================================================================
-+    namespace
-+    {
-+        typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertyGetter)( PRUnichar** aFirstName );
-+        typedef nsresult (NS_STDCALL nsIAbCard::*CardPropertySetter)( const PRUnichar* aFirstName );
-+        struct CardPropertyData
-+        {
-+            const sal_Char*     pLDAPAttributeList;
-+            CardPropertyGetter  PropGetter;
-+            CardPropertySetter  PropSetter;
-+
-+            CardPropertyData()
-+                :pLDAPAttributeList( NULL )
-+                ,PropGetter( NULL )
-+                ,PropSetter( NULL )
-+            {
-+            }
-+            CardPropertyData( const sal_Char* _pLDAPAttributeList, CardPropertyGetter _PropGetter, CardPropertySetter _PropSetter )
-+                :pLDAPAttributeList( _pLDAPAttributeList )
-+                ,PropGetter( _PropGetter )
-+                ,PropSetter( _PropSetter )
-+            {
-+            }
-+        };
-+
-+        typedef ::std::hash_map< ::rtl::OString, CardPropertyData, ::rtl::OStringHash > MapPropertiesToAttributes;
-+
-+        #define DEF_CARD_ACCESS( PropertyName ) \
-+            &nsIAbCard::Get##PropertyName, &nsIAbCard::Set##PropertyName
-+
-+        static const MapPropertiesToAttributes& lcl_getPropertyMap()
-+        {
-+            static MapPropertiesToAttributes aMap;
-+            if ( aMap.empty() )
-+            {
-+                struct MapEntry
-+                {
-+                    const sal_Char*     pAsciiPropertyName;
-+                    const sal_Char*     pAsciiAttrributeList;
-+                    CardPropertyGetter  PropGetter;
-+                    CardPropertySetter  PropSetter;
-+                };
-+                const MapEntry aEntries[] = {
-+                    { "FirstName",          "givenname",                                    DEF_CARD_ACCESS( FirstName ) },
-+                    { "LastName",           "sn,surnname",                                  DEF_CARD_ACCESS( LastName ) },
-+                    { "DisplayName",        "cn,commonname,displayname",                    DEF_CARD_ACCESS( DisplayName ) },
-+                    { "NickName",           "xmozillanickname",                             DEF_CARD_ACCESS( NickName ) },
-+                    { "PrimaryEmail",       "mail",                                         DEF_CARD_ACCESS( PrimaryEmail ) },
-+                    { "SecondEmail",        "xmozillasecondemail",                          DEF_CARD_ACCESS( SecondEmail ) },
-+                    { "WorkPhone",          "telephonenumber",                              DEF_CARD_ACCESS( WorkPhone ) },
-+                    { "HomePhone",          "homephone",                                    DEF_CARD_ACCESS( HomePhone ) },
-+                    { "FaxNumber",          "fax,facsimiletelephonenumber",                 DEF_CARD_ACCESS( FaxNumber ) },
-+                    { "PagerNumber",        "pager,pagerphone",                             DEF_CARD_ACCESS( PagerNumber ) },
-+                    { "CellularNumber",     "mobile,cellphone,carphone",                    DEF_CARD_ACCESS( CellularNumber ) },
-+                    { "HomeAddress",        "homepostaladdress,mozillaHomeStreet",          DEF_CARD_ACCESS( HomeAddress ) },
-+                    { "HomeAddress2",       "mozillaHomeStreet2",                           DEF_CARD_ACCESS( HomeAddress2 ) },
-+                    { "HomeCity",           "homelocality,mozillaHomeLocalityName",         DEF_CARD_ACCESS( HomeCity ) },
-+                    { "HomeState",          "homeregion,mozillaHomeState",                  DEF_CARD_ACCESS( HomeState ) },
-+                    { "HomeZipCode",        "homepostalcode,mozillaHomePostalCode",         DEF_CARD_ACCESS( HomeZipCode ) },
-+                    { "HomeCountry",        "homecountryname,mozillaHomeCountryName",       DEF_CARD_ACCESS( HomeCountry ) },
-+                    { "WorkAddress",        "postofficebox,streetaddress,streetaddress1",   DEF_CARD_ACCESS( WorkAddress ) },
-+                    { "WorkAddress2",       "streetaddress2",                               DEF_CARD_ACCESS( WorkAddress2 ) },
-+                    { "WorkCity",           "l,locality",                                   DEF_CARD_ACCESS( WorkCity ) },
-+                    { "WorkState",          "st,region",                                    DEF_CARD_ACCESS( WorkState ) },
-+                    { "WorkZipCode",        "postalcode,zip",                               DEF_CARD_ACCESS( WorkZipCode ) },
-+                    { "WorkCountry",        "countryname",                                  DEF_CARD_ACCESS( WorkCountry ) },
-+                    { "JobTitle",           "title",                                        DEF_CARD_ACCESS( JobTitle ) },
-+                    { "Department",         "ou,orgunit,department,departmentnumber",       DEF_CARD_ACCESS( Department ) },
-+                    { "Company",            "o,company",                                    DEF_CARD_ACCESS( Company ) },
-+                    { "WebPage1",           "workurl",                                      DEF_CARD_ACCESS( WebPage1 ) },
-+                    { "WebPage2",           "homeurl",                                      DEF_CARD_ACCESS( WebPage2 ) },
-+                    { "BirthYear",          "birthyear",                                    DEF_CARD_ACCESS( BirthYear ) },
-+                    { "BirthMonth",         "birthmonth",                                   DEF_CARD_ACCESS( BirthMonth ) },
-+                    { "BirthYear",          "birthday",                                     DEF_CARD_ACCESS( BirthDay ) },
-+                    { "Custom1",            "custom1",                                      DEF_CARD_ACCESS( Custom1 ) },
-+                    { "Custom2",            "custom2",                                      DEF_CARD_ACCESS( Custom2 ) },
-+                    { "Custom3",            "custom3",                                      DEF_CARD_ACCESS( Custom3 ) },
-+                    { "Custom4",            "custom4",                                      DEF_CARD_ACCESS( Custom4 ) },
-+                    { "Notes",              "notes,description",                            DEF_CARD_ACCESS( Notes ) },
-+                    { "PreferMailFormat",   "xmozillausehtmlmail",                          NULL, NULL },
-+                    { NULL, NULL, NULL, NULL }
-+                };
-+                const MapEntry* loop = aEntries;
-+                while ( loop->pAsciiPropertyName )
-+                {
-+                    aMap[ ::rtl::OString( loop->pAsciiPropertyName ) ] =
-+                        CardPropertyData( loop->pAsciiAttrributeList, loop->PropGetter, loop->PropSetter );
-+                    ++loop;
-+                }
-+            }
-+            return aMap;
-+        }
-+    }
-+
-+	//====================================================================
-+	//= AttributeMap_Data
-+	//====================================================================
-+    struct AttributeMap_Data
-+    {
-+    };
-+
-+	//====================================================================
-+	//= MLdapAttributeMap
-+	//====================================================================
-+    // -------------------------------------------------------------------
-+    MLdapAttributeMap::MLdapAttributeMap()
-+        :m_pData( new AttributeMap_Data )
-+    {
-+    }
-+
-+    // -------------------------------------------------------------------
-+    MLdapAttributeMap::~MLdapAttributeMap()
-+    {
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMPL_THREADSAFE_ISUPPORTS1( MLdapAttributeMap, nsIAbLDAPAttributeMap )
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::GetAttributeList(const nsACString & aProperty, nsACString & _retval)
-+    {
-+        ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-+
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+        MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-+
-+        if ( pos == rPropertyMap.end() )
-+        {
-+            _retval.SetIsVoid( PR_TRUE );
-+        }
-+        else
-+        {
-+            MTypeConverter::asciiToNsACString( pos->second.pLDAPAttributeList, _retval );
-+        }
-+
-+        return NS_OK;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::GetAttributes(const nsACString & aProperty, PRUint32* aCount, char*** aAttrs)
-+    {
-+        OSL_ENSURE( false, "MLdapAttributeMap::GetAttributes: not implemented!" );
-+        (void)aProperty;
-+        (void)aCount;
-+        (void)aAttrs;
-+        return NS_ERROR_NOT_IMPLEMENTED;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::GetFirstAttribute(const nsACString & aProperty, nsACString & _retval)
-+    {
-+        ::rtl::OString sProperty( MTypeConverter::nsACStringToOString( aProperty ) );
-+
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+        MapPropertiesToAttributes::const_iterator pos = rPropertyMap.find( sProperty );
-+
-+        if ( pos == rPropertyMap.end() )
-+        {
-+            _retval.SetIsVoid( PR_TRUE );
-+        }
-+        else
-+        {
-+            sal_Int32 tokenPos(0);
-+            ::rtl::OString sAttributeList( pos->second.pLDAPAttributeList );
-+            MTypeConverter::asciiToNsACString( sAttributeList.getToken( 0, ',', tokenPos ).getStr(), _retval );
-+        }
-+
-+        return NS_OK;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::SetAttributeList(const nsACString & aProperty, const nsACString & aAttributeList, PRBool allowInconsistencies)
-+    {
-+        OSL_ENSURE( false, "MLdapAttributeMap::SetAttributeList: not implemented!" );
-+        (void)aProperty;
-+        (void)aAttributeList;
-+        (void)allowInconsistencies;
-+        return NS_ERROR_NOT_IMPLEMENTED;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::GetProperty(const nsACString & aAttribute, nsACString & _retval)
-+    {
-+        OSL_ENSURE( false, "MLdapAttributeMap::GetProperty: not implemented!" );
-+        (void)aAttribute;
-+        (void)_retval;
-+        return NS_ERROR_NOT_IMPLEMENTED;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::GetAllCardAttributes(nsACString & _retval)
-+    {
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+
-+        ::rtl::OStringBuffer aAllAttributes;
-+        for (   MapPropertiesToAttributes::const_iterator loop = rPropertyMap.begin();
-+                loop != rPropertyMap.end();
-+                ++loop
-+            )
-+        {
-+            aAllAttributes.append( loop->second.pLDAPAttributeList );
-+            if ( loop != rPropertyMap.end() )
-+                aAllAttributes.append( ',' );
-+        }
-+
-+        MTypeConverter::asciiToNsACString( aAllAttributes.getStr(), _retval );
-+        return NS_OK;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::CheckState(void)
-+    {
-+        // we do not allow modifying the map, so we're always in a valid state
-+        return NS_OK;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::SetFromPrefs(const nsACString & aPrefBranchName)
-+    {
-+        OSL_ENSURE( false, "MLdapAttributeMap::SetFromPrefs: not implemented!" );
-+        (void)aPrefBranchName;
-+        return NS_ERROR_NOT_IMPLEMENTED;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    NS_IMETHODIMP MLdapAttributeMap::SetCardPropertiesFromLDAPMessage(nsILDAPMessage* aMessage, nsIAbCard* aCard)
-+    {
-+        NS_ENSURE_ARG_POINTER( aMessage );
-+        NS_ENSURE_ARG_POINTER( aCard );
-+
-+        // in case that's not present in the LDAP message: set the "preferred mail format" to "none"
-+        aCard->SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-+
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
-+                prop != rPropertyMap.end();
-+                ++prop
-+            )
-+        {
-+            // split the list of attributes for the current property
-+            ::rtl::OString sAttributeList( prop->second.pLDAPAttributeList );
-+            ::rtl::OString sAttribute;
-+
-+            sal_Int32 tokenPos = 0;
-+            while ( tokenPos != -1 )
-+            {
-+                sAttribute = sAttributeList.getToken( 0, ',', tokenPos );
-+
-+                // retrieve the values for the current attribute
-+                PRUint32 valueCount = 0;
-+                PRUnichar** values = NULL;
-+                nsresult rv = aMessage->GetValues( sAttribute.getStr(), &valueCount, &values );
-+                if ( NS_FAILED( rv ) )
-+                    // try the next attribute
-+                    continue;
-+
-+                if ( valueCount )
-+                {
-+                    CardPropertySetter propSetter = prop->second.PropSetter;
-+                    OSL_ENSURE( propSetter,
-+                        "MLdapAttributeMap::SetCardPropertiesFromLDAPMessage: "
-+                        "unexpected: could retrieve an attribute value, but have no setter for it!" );
-+                    if ( propSetter )
-+                    {
-+                        (aCard->*propSetter)( values[0] );
-+                    }
-+
-+                    // we're done with this property - no need to handle the remaining attributes which
-+                    // map to it
-+                    break;
-+                }
-+            }
-+        }
-+        return NS_OK;
-+    }
-+
-+    // -------------------------------------------------------------------
-+    namespace
-+    {
-+        struct PreferMailFormatType
-+        {
-+            const sal_Char* description;
-+            PRUint32        formatType;
-+
-+            PreferMailFormatType()
-+                :description( NULL )
-+                ,formatType( nsIAbPreferMailFormat::unknown )
-+            {
-+            }
-+
-+            PreferMailFormatType( const sal_Char* _description, PRUint32 _formatType )
-+                :description( _description )
-+                ,formatType( _formatType )
-+            {
-+            }
-+        };
-+
-+        static const PreferMailFormatType* lcl_getMailFormatTypes()
-+        {
-+            static const PreferMailFormatType aMailFormatTypes[] =
-+            {
-+                PreferMailFormatType( "text/plain", nsIAbPreferMailFormat::plaintext ),
-+                PreferMailFormatType( "text/html",  nsIAbPreferMailFormat::html      ),
-+                PreferMailFormatType( "unknown",    nsIAbPreferMailFormat::unknown   ),
-+                PreferMailFormatType()
-+            };
-+            return aMailFormatTypes;
-+        }
-+    }
-+
-+    // -------------------------------------------------------------------
-+    void MLdapAttributeMap::fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result )
-+    {
-+        _card.SetPreferMailFormat( nsIAbPreferMailFormat::unknown );
-+
-+        ::rtl::OUString resultValue;
-+
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
-+                prop != rPropertyMap.end();
-+                ++prop
-+            )
-+        {
-+            resultValue = _result.getValue( prop->first );
-+
-+            CardPropertySetter propSetter = prop->second.PropSetter;
-+            if ( propSetter )
-+            {
-+                (_card.*propSetter)( resultValue.getStr() );
-+            }
-+            else
-+            {
-+                if ( prop->first.equals( "PreferMailFormat" ) )
-+                {
-+                    unsigned int format = nsIAbPreferMailFormat::unknown;
-+                    const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
-+                    while ( pMailFormatType->description )
-+                    {
-+                        if ( resultValue.equalsAscii( pMailFormatType->description ) )
-+                        {
-+                            format = pMailFormatType->formatType;
-+                            break;
-+                        }
-+                        ++pMailFormatType;
-+                    }
-+                    _card.SetPreferMailFormat(format);
-+                }
-+                else
-+                    OSL_ENSURE( false, "MLdapAttributeMap::fillCardFromResult: unexpected property without default setters!" );
-+            }
-+        }
-+    }
-+
-+    // -------------------------------------------------------------------
-+    void MLdapAttributeMap::fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card )
-+    {
-+        nsXPIDLString value;
-+        ::rtl::OUString resultValue;
-+
-+        const MapPropertiesToAttributes& rPropertyMap( lcl_getPropertyMap() );
-+        for (   MapPropertiesToAttributes::const_iterator prop = rPropertyMap.begin();
-+                prop != rPropertyMap.end();
-+                ++prop
-+            )
-+        {
-+            CardPropertyGetter propGetter = prop->second.PropGetter;
-+            if ( propGetter )
-+            {
-+                (_card.*propGetter)( getter_Copies( value ) );
-+
-+                nsAutoString temp( value );
-+                MTypeConverter::nsStringToOUString( temp, resultValue );
-+            }
-+            else
-+            {
-+                if ( prop->first.equals( "PreferMailFormat" ) )
-+                {
-+                    unsigned int format = nsIAbPreferMailFormat::unknown;
-+                    _card.GetPreferMailFormat( &format );
-+                    const PreferMailFormatType* pMailFormatType = lcl_getMailFormatTypes();
-+                    while ( pMailFormatType->description )
-+                    {
-+                        if ( format == pMailFormatType->formatType )
-+                        {
-+                            resultValue = ::rtl::OUString::createFromAscii( pMailFormatType->description );
-+                            break;
-+                        }
-+                        ++pMailFormatType;
-+                    }
-+                }
-+                else
-+                    OSL_ENSURE( false, "MLdapAttributeMap::fillResultFromCard: unexpected property without default getters!" );
-+            }
-+
-+            _result.insert( prop->first, resultValue );
-+        }
-+    }
-+
-+//........................................................................
-+} } // namespace connectivity::mozab
-+//........................................................................
---- connectivity/source/drivers/mozab/mozillasrc/makefile.mk	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/makefile.mk	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -71,10 +71,13 @@
- 	$(SLO)$/MQuery.obj			            \
- 	$(SLO)$/MTypeConverter.obj              \
- 	$(SLO)$/MNameMapper.obj					\
--	$(SLO)$/MNSMozabProxy.obj	\
--	$(SLO)$/MNSTerminateListener.obj
-+	$(SLO)$/MNSMozabProxy.obj	            \
-+	$(SLO)$/MNSTerminateListener.obj        \
-+	$(SLO)$/MLdapAttributeMap.obj           \
- 	
- 
-+CDEFS     += -DMOZILLA_INTERNAL_API
-+
- .IF "$(GUI)"=="UNX"
- .IF "$(COMNAME)"=="sunpro5"
- CFLAGS += -features=tmplife
-@@ -154,7 +157,7 @@
- CFLAGSCXX += \
-             -fno-rtti -Wconversion -Wpointer-arith \
-             -Wcast-align -Woverloaded-virtual -Wsynth \
--            -Wno-long-long
-+            -Wno-long-long -Wno-deprecated
- CDEFS     += -DTRACING
- .ENDIF
- .ENDIF
---- connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MDatabaseMetaDataHelper.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -48,10 +48,12 @@
- #include <osl/mutex.hxx>
- #include <osl/conditn.hxx>
- 
-+#include <nsIAbDirFactoryService.h>
- #include <MNSInit.hxx>
- #include <MNameMapper.hxx>
- #include "MNSMozabProxy.hxx"
- #include <MNSDeclares.hxx>
-+
- static ::osl::Mutex	m_aMetaMutex;
- 
- #include <osl/diagnose.h>
---- connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MQuery.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -30,14 +30,14 @@
- 
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_connectivity.hxx"
-+
- #include <MQueryHelper.hxx>
- #include <MNameMapper.hxx>
- #include <MConnection.hxx>
- #include <connectivity/dbexception.hxx>
- #include "MQuery.hxx"
--#ifndef _CONNECTIVITY_MAB_CONVERSIONS_HXX_
-+#include "MLdapAttributeMap.hxx"
- #include "MTypeConverter.hxx"
--#endif
- #include "MNSMozabProxy.hxx"
- #include <com/sun/star/uno/Reference.hxx>
- #include <unotools/processfactory.hxx>
-@@ -54,6 +54,7 @@
- static NS_DEFINE_CID(kBooleanConditionStringCID, NS_BOOLEANCONDITIONSTRING_CID);
- static NS_DEFINE_CID(kBooleanExpressionCID, NS_BOOLEANEXPRESSION_CID);
- static NS_DEFINE_CID(kAbDirectoryQueryProxyCID, NS_ABDIRECTORYQUERYPROXY_CID);
-+static NS_DEFINE_CID(kAbLDAPAttributeMap, NS_IABLDAPATTRIBUTEMAP_IID);
- 
- using namespace connectivity::mozab;
- using namespace connectivity;
-@@ -139,31 +140,6 @@
-     NS_IF_ADDREF( m_aQueryHelper);
- }
- // -------------------------------------------------------------------------
--void MQuery::setAttributes(::std::vector< ::rtl::OUString> &attrs)
--{
--    OSL_TRACE("IN MQuery::setAttributes()\n");
--    ::osl::MutexGuard aGuard( m_aMutex );
--
--    m_aAttributes.clear();
--	m_aAttributes.reserve(attrs.size());
--    ::std::vector< ::rtl::OUString>::iterator aIterAttr = attrs.begin();
--    ::std::map< ::rtl::OUString, ::rtl::OUString>::iterator aIterMap;
--
--	for ( aIterAttr = attrs.begin(); aIterAttr != attrs.end();++aIterAttr )
--        m_aAttributes.push_back( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( *aIterAttr ) );
--
--    OSL_TRACE("\tOUT MQuery::setAttributes()\n");
--}
--// -------------------------------------------------------------------------
--const ::std::vector< ::rtl::OUString> &MQuery::getAttributes() const
--{
--    OSL_TRACE("IN MQuery::getAttributes()\n");
--
--    OSL_TRACE("\tOUT MQuery::getAttributes()\n");
--
--    return(m_aAttributes);
--}
--// -------------------------------------------------------------------------
- void MQuery::setAddressbook(::rtl::OUString &ab)
- {
-     OSL_TRACE("IN MQuery::setAddressbook()\n");
-@@ -253,12 +229,9 @@
- 
-             // Set the 'name' property of the boolString.
-             // Check if it's an alias first...
--            rtl::OUString attrName;
--            ::std::map< ::rtl::OUString, ::rtl::OUString>::const_iterator aIterMap;
--            attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToAlias( evStr->getName() );
--            ::std::string aMiName = MTypeConverter::ouStringToStlString(attrName);
--            boolString->SetName(strdup(aMiName.c_str()));
--            OSL_TRACE("Name = %s ;", aMiName.c_str() );
-+            rtl::OString attrName = _aQuery->getColumnAlias().getProgrammaticNameOrFallbackToUTF8Alias( evStr->getName() );
-+            boolString->SetName( strdup( attrName.getStr() ) );
-+            OSL_TRACE("Name = %s ;", attrName.getStr() );
-             // Set the 'matchType' property of the boolString. Check for equal length.
-             sal_Bool requiresValue = sal_True;
-             switch(evStr->getCond()) {
-@@ -609,8 +582,8 @@
-     PRInt32   count=1;
- 
-     nsCOMPtr< nsIAbDirectoryQueryArguments > arguments = do_CreateInstance( kAbDirectoryQueryArgumentsCID, &rv);
--
-     NS_ENSURE_SUCCESS( rv, rv );
-+
-     rv = arguments->SetExpression(queryExpression);
-     NS_ENSURE_SUCCESS( rv, rv );
- 
-@@ -620,6 +593,10 @@
-     rv = arguments->SetQuerySubDirectories(m_bQuerySubDirs);
-     NS_ENSURE_SUCCESS( rv, rv );
- 
-+    nsCOMPtr< nsIAbLDAPAttributeMap > attributeMap( new MLdapAttributeMap );
-+    rv = arguments->SetTypeSpecificArg( attributeMap );
-+    NS_ENSURE_SUCCESS( rv, rv );
-+
-     // Execute the query.
-     OSL_TRACE( "****** calling DoQuery\n");
- 
-@@ -722,7 +699,7 @@
-     switch ( nType )
- 	{
-         case DataType::VARCHAR:
--			xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ), rValue.getString() );
-+			xResEntry->setValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ), rValue.getString() );
-             break;
-         default:
- 			OSL_ENSURE( sal_False, "invalid data type!" );
-@@ -749,7 +726,7 @@
-     switch ( nType )
- 	{
-         case DataType::VARCHAR:
--			rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToAlias( aDBColumnName ) );
-+			rValue = xResEntry->getValue( m_rColumnAlias.getProgrammaticNameOrFallbackToUTF8Alias( aDBColumnName ) );
-             break;
- 
-         default:
-@@ -834,8 +811,7 @@
-     delete _ptr;
- }
- // -------------------------------------------------------------------------
--sal_Bool MQuery::
--isWritable(OConnection* _pCon)
-+sal_Bool MQuery::isWritable(OConnection* _pCon)
- {
- 	if ( !m_aQueryDirectory )
- 		return sal_False;
---- connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -30,62 +30,20 @@
- 
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_connectivity.hxx"
--#include <MQueryHelper.hxx>
- 
-+#include "MQueryHelper.hxx"
- #include "MTypeConverter.hxx"
-+#include "MConnection.hxx"
-+#include "MNSDeclares.hxx"
-+#include "MLdapAttributeMap.hxx"
-+
- #include <connectivity/dbexception.hxx>
--#ifndef _CONNECTIVITY_MOZAB_BCONNECTION_HXX_
--#include <MConnection.hxx>
--#endif
- 
- #include "resource/mozab_res.hrc"
--#include "MNSDeclares.hxx"
- 
- using namespace connectivity::mozab;
- 
- 
--enum
--{
--        index_FirstName=0,
--        index_LastName,
--        index_DisplayName,
--        index_NickName,
--        index_PrimaryEmail,
--        index_SecondEmail,
--        index_PreferMailFormat,
--        index_WorkPhone,
--        index_HomePhone,
--        index_FaxNumber,
--        index_PagerNumber,
--        index_CellularNumber,
--        index_HomeAddress,
--        index_HomeAddress2,
--        index_HomeCity,
--        index_HomeState,
--        index_HomeZipCode,
--        index_HomeCountry,
--        index_WorkAddress,
--        index_WorkAddress2,
--        index_WorkCity,
--        index_WorkState,
--        index_WorkZipCode,
--        index_WorkCountry,
--        index_JobTitle,
--        index_Department,
--        index_Company,
--        index_WebPage1,
--        index_WebPage2,
--        index_BirthYear,
--        index_BirthMonth,
--        index_BirthDay,
--        index_Custom1,
--        index_Custom2,
--        index_Custom3,
--        index_Custom4,
--        index_Notes
--};
--
--
- NS_IMPL_THREADSAFE_ISUPPORTS1(connectivity::mozab::MQueryHelper,nsIAbDirectoryQueryResultListener)
- 
- //
-@@ -101,8 +59,6 @@
- 
- MQueryHelperResultEntry::~MQueryHelperResultEntry()
- {
--
--
-     OSL_TRACE("IN MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
- 	OSL_TRACE("OUT MQueryHelperResultEntry::~MQueryHelperResultEntry()\n");
- 
-@@ -117,39 +73,31 @@
- {
- 	return m_Card;
- }
--void
--MQueryHelperResultEntry::insert( const rtl::OUString &key, rtl::OUString &value )
-+void MQueryHelperResultEntry::insert( const rtl::OString &key, rtl::OUString &value )
- {
--    m_Fields.insert( fieldMap::value_type( key, value ) );
-+    m_Fields[ key ] = value;
- }
- 
--rtl::OUString
--MQueryHelperResultEntry::getValue( const rtl::OUString &key ) const
-+rtl::OUString MQueryHelperResultEntry::getValue( const rtl::OString &key ) const
- {
--    fieldMap::const_iterator  iter;
--
--    iter = m_Fields.find( key );
--
--    if ( iter == m_Fields.end() ) {
-+    FieldMap::const_iterator iter = m_Fields.find( key );
-+    if ( iter == m_Fields.end() )
-+    {
-         return rtl::OUString();
--    } else {
--        return (*iter).second;
-     }
-+    else
-+    {
-+        return iter->second;
-+    }
- }
- 
--rtl::OUString
--MQueryHelperResultEntry::setValue( const rtl::OUString &key, const rtl::OUString & rValue)
-+void MQueryHelperResultEntry::setValue( const rtl::OString &key, const rtl::OUString & rValue)
- {
--    m_Fields.erase(key);
--    m_Fields.insert( fieldMap::value_type( key, rValue ) );
--    return rValue;
-+    m_Fields[ key ] = rValue;
- }
- //
- // class MQueryHelper
- //
--// MIME-types.
--static char PreferMailFormatTypes[2][11] = {"text/plain",
--                        "text/html"};
- MQueryHelper::MQueryHelper()
-     :m_nIndex( 0 )
-     ,m_bHasMore( sal_True )
-@@ -473,7 +421,7 @@
-         nsCOMPtr<nsIAbCard> card(do_QueryInterface(cardSupports, &rv));
-         NS_ENSURE_SUCCESS(rv, rv);
- 
--            getCardValues(card);
-+        getCardValues(card);
-     }
-     nsMemory::Free(name);
- 
-@@ -484,56 +432,13 @@
-     return(NS_OK);
- }
- 
-+// -----------------------------------------------------------------------------
- void MQueryHelper::notifyQueryError()
- {
-     m_bQueryComplete = sal_True ;
-     notifyResultOrComplete() ;
- }
- 
--static const ::rtl::OUString& getAttribute(PRUint32 index)
--{
--    static const ::rtl::OUString sAttributeNames[] =
--    {
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
--	    ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
--    };
--    return sAttributeNames[index];
--}
- const char * getAddrURI(const nsIAbDirectory*  directory)
- {
- 	nsresult retCode;
-@@ -687,127 +592,7 @@
- 		return sal_False;
- 	}
- 
--	::rtl::OUString	sValue;
--
--    getCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
--    card->SetFirstName(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
--    card->SetLastName(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
--    card->SetDisplayName(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
--    card->SetNickName(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
--    card->SetPrimaryEmail(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
--    card->SetSecondEmail(sValue.getStr());
--
--    unsigned int format;
--    ::rtl::OUString prefMailValue;
--    getCardAttributeAndValue(getAttribute(index_WorkPhone),prefMailValue,resEntry);
--    for(format=2;format >0;format--)
--    {
--         if (! prefMailValue.compareTo(
--         	 ::rtl::OUString::createFromAscii(PreferMailFormatTypes[format-1]) ) )
--            break;
--    }
--    card->SetPreferMailFormat(format);
--
--    getCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
--    card->SetWorkPhone(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
--    card->SetHomePhone(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
--    card->SetFaxNumber(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
--    card->SetPagerNumber(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
--    card->SetCellularNumber(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
--    card->SetHomeAddress(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
--    card->SetHomeAddress2(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
--    card->SetHomeCity(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
--    card->SetHomeState(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
--    card->SetHomeZipCode(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
--    card->SetHomeCountry(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
--    card->SetWorkAddress(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
--    card->SetWorkAddress2(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
--    card->SetWorkCity(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
--    card->SetWorkState(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
--    card->SetWorkZipCode(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
--    card->SetWorkCountry(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
--    card->SetJobTitle(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
--    card->SetDepartment(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
--    card->SetCompany(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
--    card->SetWebPage1(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
--    card->SetWebPage2(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
--    card->SetBirthYear(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
--    card->SetBirthMonth(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
--    card->SetBirthDay(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
--    card->SetCustom1(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
--    card->SetCustom2(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
--    card->SetCustom3(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
--    card->SetCustom4(sValue.getStr());
--
--    getCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
--    card->SetNotes(sValue.getStr());
--
-+    MLdapAttributeMap::fillCardFromResult( *card, *resEntry );
- 	return sal_True;
- }
- 
-@@ -821,143 +606,8 @@
- 	else
- 	    resEntry = new MQueryHelperResultEntry();
- 
--    nsXPIDLString sValue;
--
--    card->GetFirstName(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_FirstName),sValue,resEntry);
--
--    card->GetLastName(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_LastName),sValue,resEntry);
--
--    card->GetDisplayName(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_DisplayName),sValue,resEntry);
--
--    card->GetNickName(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_NickName),sValue,resEntry);
--
--    card->GetPrimaryEmail(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_PrimaryEmail),sValue,resEntry);
--
--    card->GetSecondEmail(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_SecondEmail),sValue,resEntry);
--
--    unsigned int format = 0;
--    card->GetPreferMailFormat(&format);
--    ::rtl::OUString prefMailValue;
--    switch(format)
--    {
--        case nsIAbPreferMailFormat::html:
--            prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[1]);
--            break;
--         case nsIAbPreferMailFormat::plaintext:
--            prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
--            break;
--         case nsIAbPreferMailFormat::unknown:
--         default:
--            prefMailValue = ::rtl::OUString::createFromAscii(PreferMailFormatTypes[0]);
--            break;
--
--    }
--    resEntry->insert( getAttribute(index_PreferMailFormat), prefMailValue );
--
--    card->GetWorkPhone(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkPhone),sValue,resEntry);
--
--    card->GetHomePhone(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomePhone),sValue,resEntry);
--
--    card->GetFaxNumber(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_FaxNumber),sValue,resEntry);
--
--    card->GetPagerNumber(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_PagerNumber),sValue,resEntry);
--
--    card->GetCellularNumber(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_CellularNumber),sValue,resEntry);
--
--    card->GetHomeAddress(getter_Copies(sValue));
--    PRInt32 offset;
--    nsXPIDLString space;
--    space.Assign(NS_LITERAL_STRING(" "));
--    while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
--    while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
--    addCardAttributeAndValue(getAttribute(index_HomeAddress),sValue,resEntry);
--
--    card->GetHomeAddress2(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomeAddress2),sValue,resEntry);
--
--    card->GetHomeCity(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomeCity),sValue,resEntry);
--
--    card->GetHomeState(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomeState),sValue,resEntry);
--
--    card->GetHomeZipCode(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomeZipCode),sValue,resEntry);
--
--    card->GetHomeCountry(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_HomeCountry),sValue,resEntry);
--
--    card->GetWorkAddress(getter_Copies(sValue));
--    while ((offset = sValue.FindChar('\r')) >= 0) sValue.Replace(offset, 1, space);
--    while ((offset = sValue.FindChar('\n')) >= 0) sValue.Replace(offset, 1, space);
--    addCardAttributeAndValue(getAttribute(index_WorkAddress),sValue,resEntry);
--
--    card->GetWorkAddress2(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkAddress2),sValue,resEntry);
--
--    card->GetWorkCity(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkCity),sValue,resEntry);
--
--    card->GetWorkState(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkState),sValue,resEntry);
--
--    card->GetWorkZipCode(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkZipCode),sValue,resEntry);
--
--    card->GetWorkCountry(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WorkCountry),sValue,resEntry);
--
--    card->GetJobTitle(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_JobTitle),sValue,resEntry);
--
--    card->GetDepartment(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Department),sValue,resEntry);
--
--    card->GetCompany(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Company),sValue,resEntry);
--
--    card->GetWebPage1(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WebPage1),sValue,resEntry);
--
--    card->GetWebPage2(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_WebPage2),sValue,resEntry);
--
--    card->GetBirthYear(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_BirthYear),sValue,resEntry);
--
--    card->GetBirthMonth(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_BirthMonth),sValue,resEntry);
--
--    card->GetBirthDay(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_BirthDay),sValue,resEntry);
--
--    card->GetCustom1(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Custom1),sValue,resEntry);
--
--    card->GetCustom2(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Custom2),sValue,resEntry);
--
--    card->GetCustom3(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Custom3),sValue,resEntry);
--
--    card->GetCustom4(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Custom4),sValue,resEntry);
--
--    card->GetNotes(getter_Copies(sValue));
--    addCardAttributeAndValue(getAttribute(index_Notes),sValue,resEntry);
--
--	resEntry->setCard(card);
-+    MLdapAttributeMap::fillResultFromCard( *resEntry, *card );
-+    resEntry->setCard(card);
- 	if (!rowIndex)
- 		append( resEntry );
- }
-@@ -975,21 +625,8 @@
- 	getCardValues(card,rowIndex);
- 	return sal_True;
- }
--void MQueryHelper::addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString Value, MQueryHelperResultEntry *resEntry)
--{
--    nsAutoString temp(Value) ;
--    ::rtl::OUString attrValue;
--    MTypeConverter::nsStringToOUString( temp, attrValue );
--    resEntry->insert( sName, attrValue );
--}
--
--void MQueryHelper::getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry)
--{
--    ouValue = resEntry->getValue( sName);
--}
--
- // -------------------------------------------------------------------------
--sal_Int32			MQueryHelper::createNewCard()
-+sal_Int32 MQueryHelper::createNewCard()
- {
-     ::osl::MutexGuard aGuard( m_aMutex );
-     nsresult rv;
---- connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx	(.../tags/DEV300_m41/connectivity)	(revision 0)
-+++ connectivity/source/drivers/mozab/mozillasrc/MLdapAttributeMap.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -0,0 +1,78 @@
-+/*************************************************************************
-+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+* 
-+* Copyright 2008 by Sun Microsystems, Inc.
-+*
-+* OpenOffice.org - a multi-platform office productivity suite
-+*
-+* $RCSfile: code,v $
-+*
-+* $Revision: 1.3 $
-+*
-+* This file is part of OpenOffice.org.
-+*
-+* OpenOffice.org is free software: you can redistribute it and/or modify
-+* it under the terms of the GNU Lesser General Public License version 3
-+* only, as published by the Free Software Foundation.
-+*
-+* OpenOffice.org is distributed in the hope that it will be useful,
-+* but WITHOUT ANY WARRANTY; without even the implied warranty of
-+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+* GNU Lesser General Public License version 3 for more details
-+* (a copy is included in the LICENSE file that accompanied this code).
-+*
-+* You should have received a copy of the GNU Lesser General Public License
-+* version 3 along with OpenOffice.org.  If not, see
-+* <http://www.openoffice.org/license.html>
-+* for a copy of the LGPLv3 License.
-+************************************************************************/
-+
-+#ifndef CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-+#define CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
-+
-+#include <MNSInclude.hxx>
-+
-+#include <memory>
-+
-+//........................................................................
-+namespace connectivity { namespace mozab {
-+//........................................................................
-+
-+    struct AttributeMap_Data;
-+    class MQueryHelperResultEntry;
-+
-+	//====================================================================
-+	//= class MLdapAttributeMap
-+	//====================================================================
-+    /** implements the nsIAbLDAPAttributeMap interface
-+
-+        Somewhere between Mozilla 1.7.5 and SeaMonkey 1.1.12, the LDAP address book
-+        implementation was changed to take the attribute mapping (from LDAP attributes
-+        to address book properties) not directly from the preferences. Instead, this mapping
-+        is now delivered by a dedicated implementation (supporting the nsIAbLDAPAttributeMap
-+        interface).
-+
-+    */
-+    class MLdapAttributeMap : public nsIAbLDAPAttributeMap
-+	{
-+    public:
-+        MLdapAttributeMap();
-+
-+        NS_DECL_ISUPPORTS
-+        NS_DECL_NSIABLDAPATTRIBUTEMAP
-+
-+        static void fillCardFromResult( nsIAbCard& _card, const MQueryHelperResultEntry& _result );
-+        static void fillResultFromCard( MQueryHelperResultEntry& _result, nsIAbCard& _card );
-+
-+    protected:
-+        virtual ~MLdapAttributeMap();
-+
-+    private:
-+        ::std::auto_ptr< AttributeMap_Data >    m_pData;
-+	};
-+
-+//........................................................................
-+} } // namespace connectivity::mozab
-+//........................................................................
-+
-+#endif // CONNECTIVITY_MLDAPATTRIBUTEMAP_HXX
---- connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -51,6 +51,32 @@
-     nss = mozString; // temp.
- }
- // -------------------------------------------------------------------------
-+::rtl::OUString MTypeConverter::nsACStringToOUString( const nsACString& _source )
-+{
-+    const char* buffer = _source.BeginReading();
-+    const char* bufferEnd = _source.EndReading();
-+    return ::rtl::OUString( buffer, bufferEnd - buffer, RTL_TEXTENCODING_ASCII_US );
-+}
-+// -------------------------------------------------------------------------
-+::rtl::OString MTypeConverter::nsACStringToOString( const nsACString& _source )
-+{
-+    const char* buffer = _source.BeginReading();
-+    const char* bufferEnd = _source.EndReading();
-+    return ::rtl::OString( buffer, bufferEnd - buffer );
-+}
-+// -------------------------------------------------------------------------
-+void MTypeConverter::asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest )
-+{
-+    ::rtl::OString sAsciiVersion( _asciiString.getStr(), _asciiString.getLength(), RTL_TEXTENCODING_ASCII_US );
-+    asciiToNsACString( sAsciiVersion.getStr(), _dest );
-+}
-+// -------------------------------------------------------------------------
-+void MTypeConverter::asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest )
-+{
-+    _dest.Truncate();
-+    _dest.AppendASCII( _asciiString );
-+}
-+// -------------------------------------------------------------------------
- void MTypeConverter::nsStringToOUString(nsString const &nss, ::rtl::OUString &ous)
- {
-     // Get clone of buffer.
---- connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MQueryHelper.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -40,6 +40,8 @@
- #include <comphelper/stl_types.hxx>
- #include <osl/thread.hxx>
- 
-+#include <hash_map>
-+
- namespace connectivity
- {
- 	namespace mozab
-@@ -47,20 +49,20 @@
-         class MQueryHelperResultEntry
- 		{
-         private:
--            mutable ::osl::Mutex        m_aMutex;
-+            typedef ::std::hash_map< ::rtl::OString, ::rtl::OUString, ::rtl::OStringHash >  FieldMap;
- 
--			DECLARE_STL_USTRINGACCESS_MAP(::rtl::OUString,fieldMap);
-+            mutable ::osl::Mutex    m_aMutex;
-+            FieldMap                m_Fields;
-+            nsCOMPtr<nsIAbCard>     m_Card;
-+            sal_Int32	            m_RowStates;
- 
--            fieldMap    m_Fields;
--			nsCOMPtr<nsIAbCard> m_Card;
--			sal_Int32	m_RowStates;
-         public:
-             MQueryHelperResultEntry();
-             ~MQueryHelperResultEntry();
- 
--            void insert( const rtl::OUString &key, rtl::OUString &value );
--            rtl::OUString getValue( const rtl::OUString &key ) const;
--            rtl::OUString setValue( const rtl::OUString &key, const rtl::OUString & rValue);
-+            void            insert( const rtl::OString &key, rtl::OUString &value );
-+            rtl::OUString   getValue( const rtl::OString &key ) const;
-+            void            setValue( const rtl::OString &key, const rtl::OUString & rValue);
- 
-             void setCard(nsIAbCard *card);
-             nsIAbCard *getCard();
-@@ -68,7 +70,8 @@
-             sal_Int32 getRowStates()  { return m_RowStates;};
-         };
- 
--        class MQueryHelper : public nsIAbDirectoryQueryResultListener, public ErrorResourceAccess
-+        class MQueryHelper  :public nsIAbDirectoryQueryResultListener
-+                            ,public ErrorResourceAccess
- 		{
-         private:
-             typedef std::vector< MQueryHelperResultEntry* > resultsArray;
-@@ -89,8 +92,6 @@
-             void            clearResultOrComplete();
-             void            notifyResultOrComplete();
-             sal_Bool        waitForResultOrComplete( );
--            void            addCardAttributeAndValue(const ::rtl::OUString& sName, nsXPIDLString sValue,MQueryHelperResultEntry *resEntry);
--			void 			getCardAttributeAndValue(const ::rtl::OUString& sName, ::rtl::OUString &ouValue, MQueryHelperResultEntry *resEntry)	;
-             void            getCardValues(nsIAbCard  *card,sal_Int32 rowIndex=0);
- #if OSL_DEBUG_LEVEL > 0
-             oslThreadIdentifier m_oThreadID;
---- connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MQuery.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -205,7 +205,6 @@
- 		private:
-             MQueryDirectory                *m_aQueryDirectory;
-             MQueryHelper                   *m_aQueryHelper;
--			::std::vector< ::rtl::OUString> m_aAttributes;
- 			::rtl::OUString                 m_aAddressbook;
- 			sal_Int32                       m_nMaxNrOfReturns;
- 			sal_Bool                        m_bQuerySubDirs;
-@@ -238,9 +237,6 @@
- 
- 			sal_uInt32						InsertLoginInfo(OConnection* _pCon);
- 
--			void                            setAttributes( ::std::vector< ::rtl::OUString>&);
--			const							::std::vector< ::rtl::OUString> &getAttributes(void) const;
--
- 			void                            setAddressbook( ::rtl::OUString&);
- 			::rtl::OUString                 getAddressbook(void) const;
- 
---- connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MTypeConverter.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -54,6 +54,11 @@
-             static ::std::string ouStringToStlString(const ::rtl::OUString&);
-             static ::std::string nsStringToStlString(const nsString&);
- 
-+            static ::rtl::OUString nsACStringToOUString( const nsACString& _source );
-+            static ::rtl::OString nsACStringToOString( const nsACString& _source );
-+            static void asciiOUStringToNsACString( const ::rtl::OUString& _asciiString, nsACString& _dest );
-+            static void asciiToNsACString( const sal_Char* _asciiString, nsACString& _dest );
-+
-         private:
- 			MTypeConverter() {};
- 		};
---- connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/mozillasrc/MNSInclude.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -44,6 +44,7 @@
- #include <nsCOMPtr.h>
- #include <nsISupportsArray.h>
- #include <nsString.h>
-+
- #if defined __SUNPRO_CC
- #pragma disable_warn
-     // somewhere in the files included directly or indirectly in nsString.h, warnings are enabled, again
-@@ -70,6 +71,8 @@
- #include <nsIAbDirectoryQueryProxy.h>
- #include <nsIAbDirFactory.h>
- #include <nsIRunnable.h>
-+#include <nsIAbLDAPAttributeMap.h>
-+#include <nsILDAPMessage.h>
- 
- #include <prerr.h>
- 
---- connectivity/source/drivers/mozab/MStatement.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MStatement.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -36,6 +36,7 @@
- #include <comphelper/property.hxx>
- #include <comphelper/uno3.hxx>
- #include <osl/thread.h>
-+#include <tools/diagnose_ex.h>
- #include <com/sun/star/sdbc/ResultSetConcurrency.hpp>
- #include <com/sun/star/sdbc/ResultSetType.hpp>
- #include <com/sun/star/sdbc/FetchDirection.hpp>
-@@ -78,39 +79,33 @@
- using namespace com::sun::star::io;
- using namespace com::sun::star::util;
- //------------------------------------------------------------------------------
--OStatement_Base::OStatement_Base(OConnection* _pConnection )
--    :OStatement_BASE(m_aMutex)
--    ,OPropertySetHelper(OStatement_BASE::rBHelper)
-+OCommonStatement::OCommonStatement(OConnection* _pConnection )
-+    :OCommonStatement_IBASE(m_aMutex)
-+    ,OPropertySetHelper(OCommonStatement_IBASE::rBHelper)
-+    ,OCommonStatement_SBASE((::cppu::OWeakObject*)_pConnection, this)
-     ,m_xDBMetaData(_pConnection->getMetaData())
-     ,m_pTable(NULL)
-     ,m_pConnection(_pConnection)
-     ,m_aParser(_pConnection->getDriver()->getMSFactory())
-     ,m_pSQLIterator( new OSQLParseTreeIterator( _pConnection, _pConnection->createCatalog()->getTables(), m_aParser, NULL ) )
-     ,m_pParseTree(NULL)
--    ,rBHelper(OStatement_BASE::rBHelper)
-+    ,rBHelper(OCommonStatement_IBASE::rBHelper)
- {
- 	m_pConnection->acquire();
--    OSL_TRACE("In/Out: OStatement_Base::OStatement_Base" );
-+    OSL_TRACE("In/Out: OCommonStatement::OCommonStatement" );
- }
- // -----------------------------------------------------------------------------
--OStatement_Base::~OStatement_Base()
-+OCommonStatement::~OCommonStatement()
- {
- }
-+
- //------------------------------------------------------------------------------
--void OStatement_Base::disposeResultSet()
-+void OCommonStatement::disposing()
- {
--	// free the cursor if alive
--	Reference< XComponent > xComp(m_xResultSet.get(), UNO_QUERY);
--	if (xComp.is())
--		xComp->dispose();
--	m_xResultSet = Reference< XResultSet>();
--}
--//------------------------------------------------------------------------------
--void OStatement_BASE2::disposing()
--{
- 	::osl::MutexGuard aGuard(m_aMutex);
- 
--	disposeResultSet();
-+    clearWarnings();
-+	clearCachedResultSet();
- 
- 	if (m_pConnection)
- 		m_pConnection->release();
-@@ -119,77 +114,39 @@
-     m_pSQLIterator->dispose();
- 
-     dispose_ChildImpl();
--    OStatement_Base::disposing();
-+    OCommonStatement_IBASE::disposing();
- }
- //-----------------------------------------------------------------------------
--void SAL_CALL OStatement_BASE2::release() throw()
-+Any SAL_CALL OCommonStatement::queryInterface( const Type & rType ) throw(RuntimeException)
- {
--	relase_ChildImpl();
--}
--//-----------------------------------------------------------------------------
--Any SAL_CALL OStatement_Base::queryInterface( const Type & rType ) throw(RuntimeException)
--{
--	Any aRet = OStatement_BASE::queryInterface(rType);
-+	Any aRet = OCommonStatement_IBASE::queryInterface(rType);
- 	if(!aRet.hasValue())
- 		aRet = OPropertySetHelper::queryInterface(rType);
- 	return aRet;
- }
- // -------------------------------------------------------------------------
--Sequence< Type > SAL_CALL OStatement_Base::getTypes(  ) throw(RuntimeException)
-+Sequence< Type > SAL_CALL OCommonStatement::getTypes(  ) throw(RuntimeException)
- {
- 	::cppu::OTypeCollection aTypes(	::getCppuType( (const Reference< XMultiPropertySet > *)0 ),
- 									::getCppuType( (const Reference< XFastPropertySet > *)0 ),
- 									::getCppuType( (const Reference< XPropertySet > *)0 ));
- 
--	return ::comphelper::concatSequences(aTypes.getTypes(),OStatement_BASE::getTypes());
-+	return ::comphelper::concatSequences(aTypes.getTypes(),OCommonStatement_IBASE::getTypes());
- }
- // -------------------------------------------------------------------------
--void SAL_CALL OStatement_Base::close(  ) throw(SQLException, RuntimeException)
-+void SAL_CALL OCommonStatement::close(  ) throw(SQLException, RuntimeException)
- {
- 	{
- 		::osl::MutexGuard aGuard( m_aMutex );
--		checkDisposed(OStatement_BASE::rBHelper.bDisposed);
--
-+		checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 	}
- 	dispose();
- }
--// -------------------------------------------------------------------------
- 
--void OStatement_Base::reset() throw (SQLException)
--{
--	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
- 
--
--	clearWarnings ();
--
--	if (m_xResultSet.get().is())
--		clearMyResultSet();
--}
--//--------------------------------------------------------------------
--// clearMyResultSet
--// If a ResultSet was created for this Statement, close it
--//--------------------------------------------------------------------
--
--void OStatement_Base::clearMyResultSet () throw (SQLException)
-+// -------------------------------------------------------------------------
-+void OCommonStatement::createTable( ) throw ( SQLException, RuntimeException )
- {
--	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
--
--    try
--    {
--	    Reference<XCloseable> xCloseable;
--	    if ( ::comphelper::query_interface( m_xResultSet.get(), xCloseable ) )
--		    xCloseable->close();
--    }
--    catch( const DisposedException& ) { }
--
--    m_xResultSet = Reference< XResultSet >();
--}
--
--void OStatement_Base::createTable( )
--    throw ( SQLException, RuntimeException )
--{
-     if(m_pParseTree)
-     {
-         ::vos::ORef<connectivity::OSQLColumns> xCreateColumn;
-@@ -233,13 +190,11 @@
-         getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
- }
- // -------------------------------------------------------------------------
--sal_Bool OStatement_Base::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
-+OCommonStatement::StatementType OCommonStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted)
-     throw ( SQLException, RuntimeException )
- {
-     ::rtl::OUString aErr;
- 
--    OSL_TRACE("In/Out :: OStatement::parseSql(%s)\n", OUtoCStr( sql ) );
--
-     m_pParseTree = m_aParser.parseTree(aErr,sql);
- 
- #if OSL_DEBUG_LEVEL > 0
-@@ -285,12 +240,14 @@
-             createColumnMapping();
- 
-             analyseSQL();
--            break;
-+            return eSelect;
-+
-         case SQL_STATEMENT_CREATE_TABLE:
-             createTable();
--			return sal_False;
-+			return eCreateTable;
-+
-         default:
--            getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
-+            break;
-         }
-     }
-     else if(!bAdjusted) //Our sql parser does not support a statement like "create table foo"
-@@ -298,35 +255,71 @@
-     {
-         return parseSql(sql + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("(""E-mail"" caracter)")),sal_True);
-     }
--    else
--        getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX ,*this);
--	return sal_True;
- 
-+    getOwnConnection()->throwGenericSQLException( STR_QUERY_TOO_COMPLEX, *this );
-+    OSL_ENSURE( false, "OCommonStatement::parseSql: unreachable!" );
-+    return eSelect;
-+
- }
- // -------------------------------------------------------------------------
--
--OResultSet* OStatement_Base::createResultSet()
-+Reference< XResultSet > OCommonStatement::impl_executeCurrentQuery()
- {
--    return new OResultSet( this, m_pSQLIterator );
-+    clearCachedResultSet();
-+
-+    ::rtl::Reference< OResultSet > pResult( new OResultSet( this, m_pSQLIterator ) );
-+    initializeResultSet( pResult.get() );
-+
-+    pResult->executeQuery();
-+    cacheResultSet( pResult );  // only cache if we survived the execution
-+
-+    return pResult.get();
-+
- }
--// -------------------------------------------------------------------------
- 
--void OStatement_Base::initializeResultSet( OResultSet* _pResult )
-+// -------------------------------------------------------------------------
-+void OCommonStatement::initializeResultSet( OResultSet* _pResult )
- {
--	OSL_TRACE("In : initializeResultSet");
-+    ENSURE_OR_THROW( _pResult, "invalid result set" );
-+
-     _pResult->setColumnMapping(m_aColMapping);
-     _pResult->setOrderByColumns(m_aOrderbyColumnNumber);
-     _pResult->setOrderByAscending(m_aOrderbyAscending);
-     _pResult->setBindingRow(m_aRow);
-     _pResult->setTable(m_pTable);
--	OSL_TRACE("Out : initializeResultSet");
- }
- 
- // -------------------------------------------------------------------------
--sal_Bool SAL_CALL OStatement_Base::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-+void OCommonStatement::clearCachedResultSet()
- {
-+    Reference< XResultSet > xResultSet( m_xResultSet.get(), UNO_QUERY );
-+    if ( !xResultSet.is() )
-+        return;
-+
-+    try
-+    {
-+	    Reference< XCloseable > xCloseable( xResultSet, UNO_QUERY_THROW );
-+	    xCloseable->close();
-+    }
-+    catch( const DisposedException& )
-+    {
-+        DBG_UNHANDLED_EXCEPTION();
-+    }
-+
-+    m_xResultSet = Reference< XResultSet >();
-+}
-+
-+// -------------------------------------------------------------------------
-+void OCommonStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-+{
-+    ENSURE_OR_THROW( _pResult.is(), "invalid result set" );
-+    m_xResultSet = Reference< XResultSet >( _pResult.get() );
-+}
-+
-+// -------------------------------------------------------------------------
-+sal_Bool SAL_CALL OCommonStatement::execute( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-+{
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
-     OSL_TRACE("Statement::execute( %s )", OUtoCStr( sql ) );
- 
-@@ -336,31 +329,26 @@
- }
- // -------------------------------------------------------------------------
- 
--Reference< XResultSet > SAL_CALL OStatement_Base::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
-+Reference< XResultSet > SAL_CALL OCommonStatement::executeQuery( const ::rtl::OUString& sql ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_ThreadMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
-     OSL_TRACE("Statement::executeQuery( %s )", OUtoCStr( sql ) );
- 
--    if (!parseSql( sql )) //parseSql return false means this sql is a create table statement
-+    // parse the statement
-+    StatementType eStatementType = parseSql( sql );
-+    if ( eStatementType != eSelect )
- 		return NULL;
- 
--    OResultSet* pResult = createResultSet();
--	Reference< XResultSet > xRS = pResult;
--    initializeResultSet( pResult );
--
--    pResult->executeQuery();
--	m_xResultSet = xRS; // we need a reference to it for later use
--
--	return xRS;
-+    return impl_executeCurrentQuery();
- }
- // -------------------------------------------------------------------------
- 
--Reference< XConnection > SAL_CALL OStatement_Base::getConnection(  ) throw(SQLException, RuntimeException)
-+Reference< XConnection > SAL_CALL OCommonStatement::getConnection(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
- 	// just return our connection here
- 	return (Reference< XConnection >)m_pConnection;
-@@ -370,37 +358,37 @@
- {
- 	Any aRet = ::cppu::queryInterface(rType,static_cast< XServiceInfo*> (this));
- 	if(!aRet.hasValue())
--		aRet = OStatement_Base::queryInterface(rType);
-+		aRet = OCommonStatement::queryInterface(rType);
- 	return aRet;
- }
- // -------------------------------------------------------------------------
--sal_Int32 SAL_CALL OStatement_Base::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
-+sal_Int32 SAL_CALL OCommonStatement::executeUpdate( const ::rtl::OUString& /*sql*/ ) throw(SQLException, RuntimeException)
- {
--    ::dbtools::throwFeatureNotImplementedException( "XPreparedStatement::executeUpdate", *this );
-+    ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
- 	return 0;
- 
- }
- // -------------------------------------------------------------------------
--Any SAL_CALL OStatement_Base::getWarnings(  ) throw(SQLException, RuntimeException)
-+Any SAL_CALL OCommonStatement::getWarnings(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
- 	return makeAny(m_aLastWarning);
- }
- // -------------------------------------------------------------------------
- 
- // -------------------------------------------------------------------------
--void SAL_CALL OStatement_Base::clearWarnings(  ) throw(SQLException, RuntimeException)
-+void SAL_CALL OCommonStatement::clearWarnings(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
- 
- 	m_aLastWarning = SQLWarning();
- }
- // -------------------------------------------------------------------------
--::cppu::IPropertyArrayHelper* OStatement_Base::createArrayHelper( ) const
-+::cppu::IPropertyArrayHelper* OCommonStatement::createArrayHelper( ) const
- {
- 	// this properties are define by the service resultset
- 	// they must in alphabetic order
-@@ -421,12 +409,12 @@
- }
- 
- // -------------------------------------------------------------------------
--::cppu::IPropertyArrayHelper & OStatement_Base::getInfoHelper()
-+::cppu::IPropertyArrayHelper & OCommonStatement::getInfoHelper()
- {
--	return *const_cast<OStatement_Base*>(this)->getArrayHelper();
-+	return *const_cast<OCommonStatement*>(this)->getArrayHelper();
- }
- // -------------------------------------------------------------------------
--sal_Bool OStatement_Base::convertFastPropertyValue(
-+sal_Bool OCommonStatement::convertFastPropertyValue(
- 							Any & /*rConvertedValue*/,
- 							Any & /*rOldValue*/,
- 							sal_Int32 /*nHandle*/,
-@@ -438,7 +426,7 @@
- 	return bConverted;
- }
- // -------------------------------------------------------------------------
--void OStatement_Base::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
-+void OCommonStatement::setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,const Any& /*rValue*/) throw (Exception)
- {
- 	// set the value to what ever is nescessary
- 	switch(nHandle)
-@@ -456,7 +444,7 @@
- 	}
- }
- // -------------------------------------------------------------------------
--void OStatement_Base::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
-+void OCommonStatement::getFastPropertyValue(Any& /*rValue*/,sal_Int32 nHandle) const
- {
- 	switch(nHandle)
- 	{
-@@ -475,32 +463,32 @@
- // -------------------------------------------------------------------------
- IMPLEMENT_SERVICE_INFO(OStatement,"com.sun.star.sdbcx.OStatement","com.sun.star.sdbc.Statement");
- // -----------------------------------------------------------------------------
--void SAL_CALL OStatement_Base::acquire() throw()
-+void SAL_CALL OCommonStatement::acquire() throw()
- {
--	OStatement_BASE::acquire();
-+	OCommonStatement_IBASE::acquire();
- }
- // -----------------------------------------------------------------------------
--void SAL_CALL OStatement_Base::release() throw()
-+void SAL_CALL OCommonStatement::release() throw()
- {
--	OStatement_BASE::release();
-+	relase_ChildImpl();
- }
- // -----------------------------------------------------------------------------
- void SAL_CALL OStatement::acquire() throw()
- {
--	OStatement_BASE2::acquire();
-+	OCommonStatement::acquire();
- }
- // -----------------------------------------------------------------------------
- void SAL_CALL OStatement::release() throw()
- {
--	OStatement_BASE2::release();
-+	OCommonStatement::release();
- }
- // -----------------------------------------------------------------------------
--Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OStatement_Base::getPropertySetInfo(  ) throw(RuntimeException)
-+Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL OCommonStatement::getPropertySetInfo(  ) throw(RuntimeException)
- {
- 	return ::cppu::OPropertySetHelper::createPropertySetInfo(getInfoHelper());
- }
- // -----------------------------------------------------------------------------
--void OStatement_Base::createColumnMapping()
-+void OCommonStatement::createColumnMapping()
- {
-     size_t i;
- 
-@@ -524,7 +512,7 @@
- }
- // -----------------------------------------------------------------------------
- 
--void OStatement_Base::analyseSQL()
-+void OCommonStatement::analyseSQL()
- {
- 	const OSQLParseNode* pOrderbyClause = m_pSQLIterator->getOrderTree();
- 	if(pOrderbyClause)
-@@ -549,7 +537,7 @@
- 	}
- }
- //------------------------------------------------------------------
--void OStatement_Base::setOrderbyColumn(	OSQLParseNode* pColumnRef,
-+void OCommonStatement::setOrderbyColumn(	OSQLParseNode* pColumnRef,
- 										OSQLParseNode* pAscendingDescending)
- {
- 	::rtl::OUString aColumnName;
---- connectivity/source/drivers/mozab/MConnection.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MConnection.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -55,7 +55,6 @@
- 	namespace mozab
- 	{
- 
--		class OStatement_Base;
- 		class MozabDriver;
- 		class ODatabaseMetaData;
- 		class MNameMapper;
---- connectivity/source/drivers/mozab/MStatement.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MStatement.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -64,21 +64,28 @@
- 
-         typedef ::cppu::WeakComponentImplHelper3<	::com::sun::star::sdbc::XStatement,
-                                                     ::com::sun::star::sdbc::XWarningsSupplier,
--                                                    ::com::sun::star::sdbc::XCloseable> OStatement_BASE;
-+                                                    ::com::sun::star::sdbc::XCloseable> OCommonStatement_IBASE;
- 
- 		//**************************************************************
--		//************ Class: OStatement_Base
-+		//************ Class: OCommonStatement
- 		// is a base class for the normal statement and for the prepared statement
- 		//**************************************************************
--		class OStatement_Base		:	public comphelper::OBaseMutex,
--										public	OStatement_BASE,
--										public	::cppu::OPropertySetHelper,
--										public	::comphelper::OPropertyArrayUsageHelper<OStatement_Base>
-+        class OCommonStatement;
-+		typedef ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >  OCommonStatement_SBASE;
- 
-+		class OCommonStatement  :public comphelper::OBaseMutex
-+								,public	OCommonStatement_IBASE
-+								,public	::cppu::OPropertySetHelper
-+								,public	::comphelper::OPropertyArrayUsageHelper< OCommonStatement >
-+                                ,public OCommonStatement_SBASE
- 		{
--        ::com::sun::star::sdbc::SQLWarning                            m_aLastWarning;
--		protected:
--			::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet>    m_xResultSet;   // The last ResultSet created
-+			friend class ::connectivity::OSubComponent< OCommonStatement, OCommonStatement_IBASE >;
-+
-+        private:
-+            ::com::sun::star::sdbc::SQLWarning                            m_aLastWarning;
-+
-+        protected:
-+			::com::sun::star::uno::WeakReference< ::com::sun::star::sdbc::XResultSet >   m_xResultSet;
-             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XDatabaseMetaData> m_xDBMetaData;
-             ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameAccess>  m_xColNames; // table columns
- 
-@@ -105,8 +112,6 @@
- 
- 		protected:
- 
--			void disposeResultSet();
--
- 			// OPropertyArrayUsageHelper
- 			virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const;
- 			// OPropertySetHelper
-@@ -123,23 +128,37 @@
- 			virtual void SAL_CALL getFastPropertyValue(
- 																::com::sun::star::uno::Any& rValue,
- 																sal_Int32 nHandle) const;
--			virtual ~OStatement_Base();
-+			virtual ~OCommonStatement();
- 
-         protected:
-             //
-             // Driver Internal Methods
-             //
--            virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( 
--                        ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-+            enum StatementType { eSelect, eCreateTable };
-+            /** called to do the parsing of a to-be-executed SQL statement, and set all members as needed
-+            */
-+            virtual StatementType
-+                            parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-+            /** called to initialize a result set, according to a previously parsed SQL statement
-+            */
-+            virtual void    initializeResultSet( OResultSet* _pResult );
-+            /** called when a possible cached instance of our last result set should be cleared
-+            */
-+            virtual void    clearCachedResultSet();
-+            /** caches a result set which has just been created by an execution of an SQL statement
-+            */
-+            virtual void    cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
- 
--            OResultSet*  createResultSet();
--            virtual void initializeResultSet( OResultSet* _pResult );
-+
-+            /** executes the current query (the one which has been passed to the last parseSql call)
-+            */
-+            ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet >
-+                            impl_executeCurrentQuery();
-+
-             void         createColumnMapping();
-             void         analyseSQL();
-             void         setOrderbyColumn( connectivity::OSQLParseNode* pColumnRef,
-                                            connectivity::OSQLParseNode* pAscendingDescending);
--            void         reset () throw( ::com::sun::star::sdbc::SQLException);
--            void         clearMyResultSet () throw( ::com::sun::star::sdbc::SQLException);
-             virtual void createTable(  ) throw ( 
-                         ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- 
-@@ -147,11 +166,12 @@
- 			// other methods
- 			OConnection* getOwnConnection() const { return m_pConnection;}
- 
--			OStatement_Base(OConnection* _pConnection );
--			using OStatement_BASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
-+			OCommonStatement(OConnection* _pConnection );
-+			using OCommonStatement_IBASE::operator ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >;
- 
- 			// OComponentHelper
--			virtual void SAL_CALL disposing(void){OStatement_BASE::disposing();}
-+            virtual void SAL_CALL disposing(void);
-+
- 			// XInterface
-             virtual void SAL_CALL release() throw();
- 			virtual void SAL_CALL acquire() throw();
-@@ -177,28 +197,14 @@
-             using OPropertySetHelper::getFastPropertyValue;
- 		};
- 
--		class OStatement_BASE2	:public OStatement_Base
--								,public ::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>
--
--		{
--			friend class OSubComponent<OStatement_BASE2, OStatement_BASE>;
--		public:
--			OStatement_BASE2(OConnection* _pConnection ) :  OStatement_Base(_pConnection ),
--									::connectivity::OSubComponent<OStatement_BASE2, OStatement_BASE>((::cppu::OWeakObject*)_pConnection, this){}
--			// OComponentHelper
--			virtual void SAL_CALL disposing(void);
--			// XInterface
--            virtual void SAL_CALL release() throw();
--		};
--
--		class OStatement :	public OStatement_BASE2,
-+		class OStatement :	public OCommonStatement,
-                             public ::com::sun::star::lang::XServiceInfo
- 		{
- 		protected:
- 			~OStatement(){}
- 		public:
- 			// ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
--			OStatement( OConnection* _pConnection) : OStatement_BASE2( _pConnection){}
-+			OStatement( OConnection* _pConnection) : OCommonStatement( _pConnection){}
- 			DECLARE_SERVICE_INFO();
- 
-             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
---- connectivity/source/drivers/mozab/post_include_mozilla.h	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/post_include_mozilla.h	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -46,4 +46,3 @@
- #ifdef _DEBUG_WAS_DEFINED
-     #define _DEBUG _DEBUG_WAS_DEFINED
- #endif
--
---- connectivity/source/drivers/mozab/MResultSetMetaData.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MResultSetMetaData.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -184,12 +184,7 @@
-     if ( m_pTable->getConnection()->isLDAP() )
-     {
-         const OColumnAlias& aAliases( m_pTable->getConnection()->getColumnAlias() );
--        OColumnAlias::ProgrammaticName eProgrammatic( aAliases.getProgrammaticNameIndex( sColumnName ) );
--        if  (   ( eProgrammatic == OColumnAlias::HOMECOUNTRY )
--            ||  ( eProgrammatic == OColumnAlias::WORKCOUNTRY )
--            )
--            // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
--            // There might be more ...
-+        if ( !aAliases.isColumnSearchable( sColumnName ) )
-             return sal_False;
-     }
- 
---- connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/bootstrap/MNSInit.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -34,12 +34,13 @@
- 
- #include "mozilla_nsinit.h"
- 
-+#include <MNSInit.hxx>
-+
- #include <sal/types.h>
- #include <osl/diagnose.h>
- #include <osl/conditn.hxx>
- #include <osl/file.hxx>
- #include <rtl/bootstrap.hxx>
--#include <MNSInit.hxx>
- 
- #ifndef CONNECTIVITY_MOZAB_MCONFIGACCESS_HXX
- #include "MConfigAccess.hxx"
---- connectivity/source/drivers/mozab/bootstrap/makefile.mk	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/bootstrap/makefile.mk	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -88,6 +88,8 @@
- 	$(SLO)$/MNSProfileDirServiceProvider.obj
- .ENDIF
- 
-+CDEFS     += -DMOZILLA_INTERNAL_API
-+
- .IF "$(GUI)"=="UNX"
- .IF "$(COMNAME)"=="sunpro5"
- CFLAGS += -features=tmplife
-@@ -167,7 +169,7 @@
- CFLAGSCXX += \
-             -fno-rtti -Wconversion -Wpointer-arith \
-             -Wcast-align -Woverloaded-virtual -Wsynth \
--            -Wno-long-long
-+            -Wno-long-long -Wno-deprecated
- CDEFS     += -DTRACING
- .ENDIF
- 
---- connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/bootstrap/MMozillaBootstrap.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -30,6 +30,7 @@
- 
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_connectivity.hxx"
-+
- #include "MMozillaBootstrap.hxx"
- 
- using namespace com::sun::star::uno;
---- connectivity/source/drivers/mozab/MDatabaseMetaData.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MDatabaseMetaData.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -157,7 +157,7 @@
-                     // COLUMN_NAME
-                     aRow[4] = new ORowSetValueDecorator( compare->first );
-                     // ORDINAL_POSITION
--                    aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.eProgrammaticNameIndex ) + 1 );
-+                    aRow[17] = new ORowSetValueDecorator( static_cast< sal_Int32 >( compare->second.columnPosition ) + 1 );
-                     aRows.push_back(aRow);
-                 }
-             }
---- connectivity/source/drivers/mozab/makefile.mk	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/makefile.mk	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -64,13 +64,13 @@
- 
- .IF "$(OS)"=="WNT" 
- .IF "$(COM)"=="GCC"
--MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
-+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom -lxpcom_core
- .ELSE
- LIB += $(MOZ_LIB)
--MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib
-+MOZ_LIB_XPCOM= $(MOZ_EMBED_LIB) $(MOZ_LIB)$/nspr4.lib $(MOZ_REG_LIB) $(MOZ_LIB)$/xpcom.lib $(MOZ_LIB)$/xpcom_core.lib
- .ENDIF
- .ELSE "$(OS)"=="WNT" 
--MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lembed_base_s -lnspr4 -lmozreg_s -lxpcom
-+MOZ_LIB_XPCOM= -L$(MOZ_LIB) -lnspr4 -lxpcom_core -lmozreg_s -lembed_base_s
- .ENDIF
- #End of mozilla specific stuff.
- 
-@@ -141,7 +141,8 @@
- 	$(SLO)$/MNSINIParser.obj	\
- 	$(SLO)$/MNSRunnable.obj	\
- 	$(SLO)$/MNSProfile.obj					\
--	$(SLO)$/MNSProfileDirServiceProvider.obj
-+	$(SLO)$/MNSProfileDirServiceProvider.obj    \
-+	$(SLO)$/MLdapAttributeMap.obj
- 
- 
- SLO2FILES=\
---- connectivity/source/drivers/mozab/MColumnAlias.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MColumnAlias.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -32,13 +32,16 @@
- #include "precompiled_connectivity.hxx"
- #include "MColumnAlias.hxx"
- #include "MConnection.hxx"
-+#include "MExtConfigAccess.hxx"
-+
- #include <com/sun/star/beans/XPropertySet.hpp>
- #include <com/sun/star/container/XNameAccess.hpp>
--#ifndef CONNECTIVITY_MOZAB_MEXTCONFIGACCESS_HXX
--#include "MExtConfigAccess.hxx"
--#endif
- 
-+#include <tools/diagnose_ex.h>
- 
-+#include <algorithm>
-+#include <functional>
-+
- using namespace ::connectivity;
- using namespace ::connectivity::mozab;
- using namespace ::com::sun::star::uno;
-@@ -46,56 +49,57 @@
- using namespace ::com::sun::star::beans;
- using namespace ::com::sun::star::container;
- 
--static const ::rtl::OUString sProgrammaticNames[] =
--{
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FirstName")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LastName")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("DisplayName")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("NickName")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PrimaryEmail")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("SecondEmail")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PreferMailFormat")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkPhone")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomePhone")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("FaxNumber")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("PagerNumber")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("CellularNumber")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeAddress2")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCity")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeState")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeZipCode")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("HomeCountry")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkAddress2")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCity")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkState")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkZipCode")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WorkCountry")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("JobTitle")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Department")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Company")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage1")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("WebPage2")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthYear")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthMonth")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BirthDay")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom1")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom2")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom3")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Custom4")),
--	::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Notes"))
--};
- //------------------------------------------------------------------------------
- OColumnAlias::OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
- {
--    for ( size_t i = 0; i < END - BEGIN; ++i )
--        m_aAliasMap[ sProgrammaticNames[i] ] = AliasDescription( sProgrammaticNames[i], static_cast< ProgrammaticName>( i ) );
-+    static const sal_Char* s_pProgrammaticNames[] =
-+    {
-+        "FirstName",
-+        "LastName",
-+        "DisplayName",
-+        "NickName",
-+        "PrimaryEmail",
-+        "SecondEmail",
-+        "PreferMailFormat",
-+        "WorkPhone",
-+        "HomePhone",
-+        "FaxNumber",
-+        "PagerNumber",
-+        "CellularNumber",
-+        "HomeAddress",
-+        "HomeAddress2",
-+        "HomeCity",
-+        "HomeState",
-+        "HomeZipCode",
-+        "HomeCountry",
-+        "WorkAddress",
-+        "WorkAddress2",
-+        "WorkCity",
-+        "WorkState",
-+        "WorkZipCode",
-+        "WorkCountry",
-+        "JobTitle",
-+        "Department",
-+        "Company",
-+        "WebPage1",
-+        "WebPage2",
-+        "BirthYear",
-+        "BirthMonth",
-+        "BirthDay",
-+        "Custom1",
-+        "Custom2",
-+        "Custom3",
-+        "Custom4",
-+        "Notes",
-+    };
- 
-+    for ( size_t i = 0; i < sizeof( s_pProgrammaticNames ) / sizeof( s_pProgrammaticNames[0] ); ++i )
-+        m_aAliasMap[ ::rtl::OUString::createFromAscii( s_pProgrammaticNames[i] ) ] = AliasEntry( s_pProgrammaticNames[i], i );
-+
-     initialize( _rxORB );
- }
- 
--//------------------------------------------------------------------
-+//------------------------------------------------------------------------------
- void OColumnAlias::initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB )
- {
-     // open our driver settings config node
-@@ -112,34 +116,26 @@
- 			OSL_ENSURE( xAliasesNode.is(), "OColumnAlias::setAlias: missing the aliases node!" );
- 
- 			// this is a set of string nodes
--			Sequence< ::rtl::OUString > aColumnProgrammaticNames;
-+			Sequence< ::rtl::OUString > aProgrammaticNames;
- 			if ( xAliasesNode.is() )
--				aColumnProgrammaticNames = xAliasesNode->getElementNames();
-+                aProgrammaticNames = xAliasesNode->getElementNames();
- 
- 			//.............................................................
- 			// travel through all the set elements
--			const ::rtl::OUString* pProgrammaticNames = aColumnProgrammaticNames.getConstArray();
--			const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aColumnProgrammaticNames.getLength();
-+			const ::rtl::OUString* pProgrammaticNames = aProgrammaticNames.getConstArray();
-+			const ::rtl::OUString* pProgrammaticNamesEnd = pProgrammaticNames + aProgrammaticNames.getLength();
- 			::rtl::OUString sAssignedAlias;
- 
- 			for ( ; pProgrammaticNames < pProgrammaticNamesEnd; ++pProgrammaticNames )
- 			{
--				OSL_ENSURE( m_aAliasMap.end() != m_aAliasMap.find( *pProgrammaticNames ),
--					"OColumnAlias::setAlias: found an invalid programmtic name!" );
--					// if this asserts, somebody stored a programmatic name in the configuration
--					// which is not allowed (i.e. not in the list of known programmatics).
-+				OSL_VERIFY( xAliasesNode->getByName( *pProgrammaticNames ) >>= sAssignedAlias );
- 
--#if OSL_DEBUG_LEVEL > 0
--				sal_Bool bExtractionSuccess =
--#endif
--				xAliasesNode->getByName( *pProgrammaticNames) >>= sAssignedAlias;
--				OSL_ENSURE( bExtractionSuccess, "OColumnAlias::setAlias: invalid config data!" );
--
- 				// normalize in case the config data is corrupted
- 				// (what we really don't need is an empty alias ...)
- 				if ( 0 == sAssignedAlias.getLength() )
- 					  sAssignedAlias = *pProgrammaticNames;
- 
-+                ::rtl::OString sAsciiProgrammaticName( ::rtl::OUStringToOString( *pProgrammaticNames, RTL_TEXTENCODING_ASCII_US ) );
- 				//.............................................................
-             #if OSL_DEBUG_LEVEL > 0
-                 bool bFound = false;
-@@ -149,16 +145,12 @@
-                         ++search
-                     )
-                 {
--                    if ( search->second.sProgrammaticName == *pProgrammaticNames )
-+                    if ( search->second.programmaticAsciiName.equals( sAsciiProgrammaticName ) )
-                     {
--                        AliasDescription aDescription( search->second );
--
--                        // delete this old entry for this programmatic name
-+                        AliasEntry entry( search->second );
-                         m_aAliasMap.erase( search );
-+                        m_aAliasMap[ sAssignedAlias ] = entry;
- 
--                        // insert the same AliasDescription under a new name - its alias
--                        m_aAliasMap[ sAssignedAlias ] = aDescription;
--
-                     #if OSL_DEBUG_LEVEL > 0
-                         bFound = true;
-                     #endif
-@@ -172,29 +164,31 @@
- 		}
- 		catch( const Exception& )
- 		{
--			OSL_ENSURE( sal_False, "OColumnAlias::setAlias: could not read my driver's configuration data!" );
-+            DBG_UNHANDLED_EXCEPTION();
- 		}
- 	}
- }
- 
- //------------------------------------------------------------------
--OColumnAlias::ProgrammaticName OColumnAlias::getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const
-+::rtl::OString OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const
- {
--    AliasMap::const_iterator pos = m_aAliasMap.find( _rAliasName );
-+    AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
-     if ( pos == m_aAliasMap.end() )
-     {
--        OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameIndex: unknown column alias!" );
--        return END;
-+        OSL_ENSURE( false, "OColumnAlias::getProgrammaticNameOrFallbackToUTF8Alias: no programmatic name for this alias!" );
-+        return ::rtl::OUStringToOString( _rAlias, RTL_TEXTENCODING_UTF8 );
-     }
--
--    return pos->second.eProgrammaticNameIndex;
-+    return pos->second.programmaticAsciiName;
- }
- 
- //------------------------------------------------------------------
--::rtl::OUString OColumnAlias::getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const
-+bool OColumnAlias::isColumnSearchable( const ::rtl::OUString _alias ) const
- {
--    AliasMap::const_iterator pos = m_aAliasMap.find( _rAlias );
--    if ( pos == m_aAliasMap.end() )
--        return _rAlias;
--    return pos->second.sProgrammaticName;
-+    ::rtl::OString sProgrammatic = getProgrammaticNameOrFallbackToUTF8Alias( _alias );
-+
-+    return  (   !sProgrammatic.equals( "HomeCountry" )
-+            &&  !sProgrammatic.equals( "WorkCountry" )
-+            );
-+    // for those, we know that they're not searchable in the Mozilla/LDAP implementation.
-+    // There might be more ...
- }
---- connectivity/source/drivers/mozab/MColumnAlias.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MColumnAlias.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -36,7 +36,7 @@
- 
- #include <osl/mutex.hxx>
- #include <vector>
--#include <map>
-+#include <hash_map>
- 
- namespace connectivity
- {
-@@ -45,88 +45,41 @@
- 		class OColumnAlias
- 		{
-         public:
--		    typedef enum {
--                BEGIN = 0,
--
--			    FIRSTNAME = BEGIN,
--			    LASTNAME,
--			    DISPLAYNAME,
--			    NICKNAME,
--			    PRIMARYEMAIL,
--			    SECONDEMAIL,
--			    PREFERMAILFORMAT,
--			    WORKPHONE,
--			    HOMEPHONE,
--			    FAXNUMBER,
--			    PAGERNUMBER,
--			    CELLULARNUMBER,
--			    HOMEADDRESS,
--			    HOMEADDRESS2,
--			    HOMECITY,
--			    HOMESTATE,
--			    HOMEZIPCODE,
--			    HOMECOUNTRY,
--			    WORKADDRESS,
--			    WORKADDRESS2,
--			    WORKCITY,
--			    WORKSTATE,
--			    WORKZIPCODE,
--			    WORKCOUNTRY,
--			    JOBTITLE,
--			    DEPARTMENT,
--			    COMPANY,
--			    WEBPAGE1,
--			    WEBPAGE2,
--			    BIRTHYEAR,
--			    BIRTHMONTH,
--			    BIRTHDAY,
--			    CUSTOM1,
--			    CUSTOM2,
--			    CUSTOM3,
--			    CUSTOM4,
--			    NOTES,
--
--                END
--		    } ProgrammaticName;
--
--            struct AliasDescription
-+            struct AliasEntry
-             {
--                ::rtl::OUString     sProgrammaticName;
--                ProgrammaticName    eProgrammaticNameIndex;
-+                ::rtl::OString  programmaticAsciiName;
-+                sal_Int32       columnPosition;
- 
--                AliasDescription()
--                    :eProgrammaticNameIndex( END )
-+                AliasEntry()
-+                    :programmaticAsciiName()
-+                    ,columnPosition( 0 )
-                 {
-                 }
--
--                AliasDescription( const ::rtl::OUString& _rName, ProgrammaticName _eIndex )
--                    :sProgrammaticName( _rName ), eProgrammaticNameIndex( _eIndex )
-+                AliasEntry( const sal_Char* _programmaticAsciiName, sal_Int32 _columnPosition )
-+                    :programmaticAsciiName( _programmaticAsciiName )
-+                    ,columnPosition( _columnPosition )
-                 {
-                 }
-             };
-+            typedef ::std::hash_map< ::rtl::OUString, AliasEntry, ::rtl::OUStringHash > AliasMap;
- 
--            typedef ::std::map< ::rtl::OUString, AliasDescription > AliasMap;
--
-         private:
- 			AliasMap    m_aAliasMap;
- 
--        protected:
--			::osl::Mutex  m_aMutex;
--
-         public:
--			OColumnAlias(
--                const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
-+			OColumnAlias( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & );
- 
--            ProgrammaticName getProgrammaticNameIndex( const ::rtl::OUString& _rAliasName ) const;
-             inline bool hasAlias( const ::rtl::OUString& _rAlias ) const
-             {
-                 return m_aAliasMap.find( _rAlias ) != m_aAliasMap.end();
-             }
--            ::rtl::OUString getProgrammaticNameOrFallbackToAlias( const ::rtl::OUString& _rAlias ) const;
-+            ::rtl::OString getProgrammaticNameOrFallbackToUTF8Alias( const ::rtl::OUString& _rAlias ) const;
- 
-             inline AliasMap::const_iterator begin() const { return m_aAliasMap.begin(); }
-             inline AliasMap::const_iterator end() const { return m_aAliasMap.end(); }
- 
-+            bool isColumnSearchable( const ::rtl::OUString _alias ) const;
-+
- 		private:
-             void initialize( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB );
- 		};
---- connectivity/source/drivers/mozab/MPreparedStatement.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MPreparedStatement.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -67,11 +67,11 @@
- 
- 
- OPreparedStatement::OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql)
--	:OStatement_BASE2(_pConnection)
-+	:OCommonStatement(_pConnection)
-     ,m_nNumParams(0)
-     ,m_sSqlStatement(sql)
- 	,m_bPrepared(sal_False)
--    ,m_pResultSet( NULL )
-+    ,m_pResultSet()
- {
- }
- // -----------------------------------------------------------------------------
-@@ -79,22 +79,18 @@
- {
- }
- // -----------------------------------------------------------------------------
--sal_Bool OPreparedStatement::lateInit()
-+void OPreparedStatement::lateInit()
- {
--    return parseSql( m_sSqlStatement );
-+    if ( eSelect != parseSql( m_sSqlStatement ) )
-+        throw SQLException();
- }
- // -------------------------------------------------------------------------
- void SAL_CALL OPreparedStatement::disposing()
- {
- 	::osl::MutexGuard aGuard(m_aMutex);
- 
--	if(m_pResultSet)
--		m_pResultSet->release();
-+	OCommonStatement::disposing();
- 
--	clearMyResultSet();
--
--	OStatement_BASE2::disposing();
--
- 	m_xMetaData = NULL;
- 	if(m_aParameterRow.isValid())
- 	{
-@@ -105,63 +101,61 @@
- }
- // -----------------------------------------------------------------------------
- 
--sal_Bool OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted ) throw (
--     ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
-+OCommonStatement::StatementType OPreparedStatement::parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted )
-+    throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException )
- {
--    OSL_TRACE("in :: OPreparedStatement::parseSql()");
--    if (!OStatement_Base::parseSql( sql, bAdjusted ))
--		return sal_False;
-+    StatementType eStatementType = OCommonStatement::parseSql( sql, bAdjusted );
-+    if ( eStatementType != eSelect )
-+		return eStatementType;
- 
-     m_xParamColumns = new OSQLColumns();
- 
--    Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
--
-     // describe all parameters need for the resultset
-     describeParameter();
- 
--    OResultSet::setBoundedColumns(m_aRow,m_xParamColumns,xNames,sal_False,m_xDBMetaData,m_aColMapping);
-+    Reference<XIndexAccess> xNames(m_xColNames,UNO_QUERY);
-+    OResultSet::setBoundedColumns( m_aRow, m_xParamColumns, xNames, sal_False, m_xDBMetaData, m_aColMapping );
- 
--    m_pResultSet = createResultSet();
--	m_pResultSet->acquire();
--    m_xResultSet = Reference<XResultSet>(m_pResultSet);
--    initializeResultSet(m_pResultSet);
--    OSL_TRACE("Out :: OPreparedStatement::parseSql()");
--	return sal_True;
-+    return eStatementType;
- }
- 
- // -----------------------------------------------------------------------------
--
--OResultSet* OPreparedStatement::createResultSet( )
-+void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
- {
--    OSL_TRACE("In/Out : OPreparedStatement::createResultSet( )");
--    return new OResultSet( this, m_pSQLIterator );
-+    OCommonStatement::initializeResultSet( _pResult );
-+    _pResult->setParameterColumns( m_xParamColumns );
-+    _pResult->setParameterRow( m_aParameterRow );
- }
- 
- // -----------------------------------------------------------------------------
--void OPreparedStatement::initializeResultSet( OResultSet* _pResult )
-+void OPreparedStatement::clearCachedResultSet()
- {
--    OSL_TRACE("In : OPreparedStatement::initializeResultSet( )");
--    OStatement_Base::initializeResultSet( _pResult );
--
--    _pResult->setParameterColumns(m_xParamColumns);
--    _pResult->setParameterRow(m_aParameterRow);
--    OSL_TRACE("Out : OPreparedStatement::initializeResultSet( )");
-+    OCommonStatement::clearCachedResultSet();
-+    m_pResultSet.clear();
-+    m_xMetaData.clear();
- }
-+// -----------------------------------------------------------------------------
-+void OPreparedStatement::cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult )
-+{
-+    OCommonStatement::cacheResultSet( _pResult );
-+    OSL_PRECOND( m_pResultSet == NULL, "OPreparedStatement::parseSql: you should call clearCachedResultSet before!" );
-+    m_pResultSet = _pResult;
-+}
- 
- // -----------------------------------------------------------------------------
- void SAL_CALL OPreparedStatement::acquire() throw()
- {
--	OStatement_BASE2::acquire();
-+	OCommonStatement::acquire();
- }
- // -----------------------------------------------------------------------------
- void SAL_CALL OPreparedStatement::release() throw()
- {
--	OStatement_BASE2::release();
-+	OCommonStatement::release();
- }
- // -----------------------------------------------------------------------------
- Any SAL_CALL OPreparedStatement::queryInterface( const Type & rType ) throw(RuntimeException)
- {
--	Any aRet = OStatement_BASE2::queryInterface(rType);
-+	Any aRet = OCommonStatement::queryInterface(rType);
- 	if(!aRet.hasValue())
- 		aRet = OPreparedStatement_BASE::queryInterface(rType);
- 	return aRet;
-@@ -169,69 +163,49 @@
- // -------------------------------------------------------------------------
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL OPreparedStatement::getTypes(  ) throw(::com::sun::star::uno::RuntimeException)
- {
--	return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OStatement_BASE2::getTypes());
-+	return ::comphelper::concatSequences(OPreparedStatement_BASE::getTypes(),OCommonStatement::getTypes());
- }
- // -------------------------------------------------------------------------
- 
- Reference< XResultSetMetaData > SAL_CALL OPreparedStatement::getMetaData(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
--    sal_Bool bReadOnly= sal_True;
--    if (m_pResultSet)
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
-+
-+    sal_Bool bReadOnly = sal_True;
-+    if ( m_pResultSet.is() )
-         bReadOnly = m_pResultSet->determineReadOnly();
--	if(!m_xMetaData.is())
-+    // if we do not have a result set, then we have not been executed, yet. In this case, assuming readonly=true is
-+    // okay, /me thinks.
-+
-+	if ( !m_xMetaData.is() )
-         m_xMetaData = new OResultSetMetaData( m_pSQLIterator->getSelectColumns(), m_pSQLIterator->getTables().begin()->first ,m_pTable,bReadOnly );
-+
- 	return m_xMetaData;
- }
--// -------------------------------------------------------------------------
- 
--void SAL_CALL OPreparedStatement::close(  ) throw(SQLException, RuntimeException)
--{
--	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
--
--
--	// Reset last warning message
--
--	try {
--		clearWarnings ();
--        clearMyResultSet();
--		// OStatement_BASE2::close();
--	}
--	catch (SQLException &) {
--		// If we get an error, ignore
--	}
--
--	// Remove this Statement object from the Connection object's
--	// list
--}
- // -------------------------------------------------------------------------
--
- sal_Bool SAL_CALL OPreparedStatement::execute(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
--
--    Reference< XResultSet> xRS = OStatement_Base::executeQuery( m_sSqlStatement );
--	// same as in statement with the difference that this statement also can contain parameter
--
--    OSL_TRACE("In/Out: OPreparedStatement::execute" );
--	return xRS.is();
-+    Reference< XResultSet> xResult = executeQuery();
-+	return xResult.is();
- }
- // -------------------------------------------------------------------------
- 
- sal_Int32 SAL_CALL OPreparedStatement::executeUpdate(  ) throw(SQLException, RuntimeException)
- {
--	return 0;
-+    ::dbtools::throwFeatureNotImplementedException( "XStatement::executeUpdate", *this );
-+    return 0;
- }
- // -------------------------------------------------------------------------
- 
- void SAL_CALL OPreparedStatement::setString( sal_Int32 parameterIndex, const ::rtl::OUString& x ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
-     OSL_TRACE("prepStmt::setString( %s )", OUtoCStr( x ) );
-     setParameter( parameterIndex, x );
-@@ -241,7 +215,7 @@
- Reference< XConnection > SAL_CALL OPreparedStatement::getConnection(  ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
- 	return (Reference< XConnection >)m_pConnection;
- }
-@@ -251,12 +225,11 @@
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
-     OSL_TRACE("In: OPreparedStatement::executeQuery" );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
--	Reference< XResultSet > rs = OStatement_Base::executeQuery( m_sSqlStatement );
--
--    OSL_TRACE("Out: OPreparedStatement::executeQuery" );
--	return rs;
-+    // our statement has already been parsed in lateInit, no need to do all this (potentially expensive)
-+    // stuff again. Just execute.
-+    return impl_executeCurrentQuery();
- }
- // -------------------------------------------------------------------------
- 
-@@ -318,7 +291,7 @@
- void SAL_CALL OPreparedStatement::setNull( sal_Int32 parameterIndex, sal_Int32 /*sqlType*/ ) throw(SQLException, RuntimeException)
- {
- 	::osl::MutexGuard aGuard( m_aMutex );
--	checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+	checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
-     checkAndResizeParameters(parameterIndex);
- 
-@@ -410,7 +383,7 @@
- 		case PROPERTY_ID_USEBOOKMARKS:
- 			break;
- 		default:
--			OStatement_Base::setFastPropertyValue_NoBroadcast(nHandle,rValue);
-+			OCommonStatement::setFastPropertyValue_NoBroadcast(nHandle,rValue);
- 	}
- }
- // -----------------------------------------------------------------------------
-@@ -422,7 +395,7 @@
- // -----------------------------------------------------------------------------
- void OPreparedStatement::checkAndResizeParameters(sal_Int32 parameterIndex)
- {
--    ::connectivity::checkDisposed(OStatement_BASE::rBHelper.bDisposed);
-+    ::connectivity::checkDisposed(OCommonStatement_IBASE::rBHelper.bDisposed);
- 
-     if ( !m_aParameterRow.isValid() ) {
-         m_aParameterRow = new OValueVector();
---- connectivity/source/drivers/mozab/pre_include_mozilla.h	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/pre_include_mozilla.h	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -38,18 +38,28 @@
- // Turn off DEBUG Assertions
- #ifdef _DEBUG
-     #define _DEBUG_WAS_DEFINED _DEBUG
--    #undef _DEBUG
-+    #ifndef MOZILLA_ENABLE_DEBUG
-+        #undef _DEBUG
-+    #endif
- #else
-     #undef _DEBUG_WAS_DEFINED
-+    #ifdef MOZILLA_ENABLE_DEBUG
-+        #define _DEBUG 1
-+    #endif
- #endif
- 
- // and turn off the additional virtual methods which are part of some interfaces when compiled
- // with debug
- #ifdef DEBUG
-     #define DEBUG_WAS_DEFINED DEBUG
--    #undef DEBUG
-+    #ifndef MOZILLA_ENABLE_DEBUG
-+        #undef DEBUG
-+    #endif
- #else
-     #undef DEBUG_WAS_DEFINED
-+    #ifdef MOZILLA_ENABLE_DEBUG
-+        #define DEBUG 1
-+    #endif
- #endif
- 
- #if defined __GNUC__
---- connectivity/source/drivers/mozab/MResultSet.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MResultSet.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -99,7 +99,7 @@
- }
- 
- // -------------------------------------------------------------------------
--OResultSet::OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
-+OResultSet::OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< connectivity::OSQLParseTreeIterator >& _pSQLIterator )
- 	: OResultSet_BASE(m_aMutex)
- 	,OPropertySetHelper(OResultSet_BASE::rBHelper)
-     ,m_pStatement(pStmt)
-@@ -510,7 +510,7 @@
- {
-     ResultSetEntryGuard aGuard( *this );
-     OSL_TRACE("In/Out: OResultSet::close" );
--	// dispose();
-+	dispose();
- }
- // -------------------------------------------------------------------------
- 
-@@ -1123,9 +1123,6 @@
- 
-     m_aQuery.setExpression( queryExpression );
- 
--    // We need a unique id for caching mechanism so should fetch card:URI
--    m_aQuery.setAttributes( m_aAttributeStrings );
--
-     rtl::OUString aStr(  m_pTable->getName() );
-     m_aQuery.setAddressbook( aStr );
- 
---- connectivity/source/drivers/mozab/MDriver.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MDriver.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -306,7 +306,7 @@
- 
- 	// load the dbtools library
- 	m_hModule = osl_loadModuleRelative(&thisModule, sModuleName.pData, 0);
--	OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the dbtools library!");
-+	OSL_ENSURE(NULL != m_hModule, "MozabDriver::ensureInit: could not load the mozabdrv library!");
- 	if ( !m_hModule )
-         return false;
- 
---- connectivity/source/drivers/mozab/MPreparedStatement.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MPreparedStatement.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -53,7 +53,7 @@
- 										::com::sun::star::sdbc::XMultipleResults,
-                                         ::com::sun::star::lang::XServiceInfo> OPreparedStatement_BASE;
- 
--        class OPreparedStatement :  public  OStatement_BASE2,
-+        class OPreparedStatement :  public  OCommonStatement,
-                                     public  OPreparedStatement_BASE
-         {
-         protected:
-@@ -79,7 +79,7 @@
-             ::rtl::OUString                             m_sSqlStatement;
-             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData >  m_xMetaData;
-             sal_Bool                                    m_bPrepared;
--            OResultSet*                                 m_pResultSet;
-+            ::rtl::Reference< OResultSet >              m_pResultSet;
-             ::vos::ORef<connectivity::OSQLColumns>      m_xParamColumns;    // the parameter columns
-             OValueRow                                   m_aParameterRow;
- 
-@@ -93,29 +93,29 @@
-             virtual ~OPreparedStatement();
- 
-             virtual void SAL_CALL disposing();
--            virtual sal_Bool parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( 
--                           ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
- 
--			virtual OResultSet* createResultSet();
--			::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSet> initResultSet();
-+            // OCommonStatement overridables
-+            virtual StatementType
-+                            parseSql( const ::rtl::OUString& sql , sal_Bool bAdjusted = sal_False) throw ( ::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException );
-+            virtual void    initializeResultSet( OResultSet* _pResult );
-+            virtual void    clearCachedResultSet();
-+            virtual void    cacheResultSet( const ::rtl::Reference< OResultSet >& _pResult );
- 
--			void checkAndResizeParameters(sal_Int32 parameterIndex);
-+
-+            void checkAndResizeParameters(sal_Int32 parameterIndex);
- 			void setParameter(sal_Int32 parameterIndex, const ORowSetValue& x);
- 
--
- 			sal_uInt32 AddParameter(connectivity::OSQLParseNode * pParameter, 
- 								const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet>& _xCol);
- 			void scanParameter(OSQLParseNode* pParseNode,::std::vector< OSQLParseNode*>& _rParaNodes);
- 			void describeColumn(OSQLParseNode* _pParameter,OSQLParseNode* _pNode,const OSQLTable& _xTable);
- 			void describeParameter();
- 
--            virtual void initializeResultSet( OResultSet* _pResult );
--
-         public:
-             DECLARE_SERVICE_INFO();
-             // ein Konstruktor, der fuer das Returnen des Objektes benoetigt wird:
-             OPreparedStatement( OConnection* _pConnection,const ::rtl::OUString& sql);
--            sal_Bool lateInit();
-+            void lateInit();
- 
-             //XInterface
-             virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException);
-@@ -153,8 +153,6 @@
-             virtual void SAL_CALL setClob( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XClob >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-             virtual void SAL_CALL setArray( sal_Int32 parameterIndex, const ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XArray >& x ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-             virtual void SAL_CALL clearParameters(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
--            // XCloseable
--            virtual void SAL_CALL close(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
-             // XResultSetMetaDataSupplier
-             virtual ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData > SAL_CALL getMetaData(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- 			// XMultipleResults
-@@ -163,9 +161,9 @@
-             virtual sal_Bool SAL_CALL getMoreResults(  ) throw(::com::sun::star::sdbc::SQLException, ::com::sun::star::uno::RuntimeException);
- 
-         public:
--            using OStatement_Base::executeQuery;
--            using OStatement_Base::executeUpdate;
--            using OStatement_Base::execute;
-+            using OCommonStatement::executeQuery;
-+            using OCommonStatement::executeUpdate;
-+            using OCommonStatement::execute;
-         protected:
-             using OPropertySetHelper::getFastPropertyValue;
-         };
---- connectivity/source/drivers/mozab/MResultSet.hxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MResultSet.hxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -83,7 +83,7 @@
- 							public	::comphelper::OPropertyArrayUsageHelper<OResultSet>
- 		{
- 		protected:
--			OStatement_Base*							m_pStatement;
-+			OCommonStatement*							m_pStatement;
-             ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>			m_xStatement;
-             ::com::sun::star::uno::Reference< ::com::sun::star::sdbc::XResultSetMetaData>   m_xMetaData;
- 			sal_uInt32									m_nRowPos;
-@@ -126,7 +126,7 @@
- 		public:
- 			DECLARE_SERVICE_INFO();
- 			
--            OResultSet(OStatement_Base* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
-+            OResultSet(OCommonStatement* pStmt, const ::boost::shared_ptr< ::connectivity::OSQLParseTreeIterator >& _pSQLIterator );
- 			
- 
- 			::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > operator *()
---- connectivity/source/drivers/mozab/MConnection.cxx	(.../tags/DEV300_m41/connectivity)	(revision 269329)
-+++ connectivity/source/drivers/mozab/MConnection.cxx	(.../cws/moz2seamonkey01/connectivity)	(revision 269329)
-@@ -370,8 +370,7 @@
- 	// the statement can only be executed more than once
-     OPreparedStatement* pPrepared = new OPreparedStatement(this,_sSql);
- 	Reference< XPreparedStatement > xReturn = pPrepared;
--    if ( !pPrepared->lateInit() )
--        throw SQLException();
-+    pPrepared->lateInit();
-     
- 	m_aStatements.push_back(WeakReferenceHelper(xReturn));
- 	return xReturn;
diff --git a/patches/dev300/cws-moz2seamonkey01-moz.diff b/patches/dev300/cws-moz2seamonkey01-moz.diff
deleted file mode 100644
index a959919..0000000
--- a/patches/dev300/cws-moz2seamonkey01-moz.diff
+++ /dev/null
@@ -1,7529 +0,0 @@
---- moz/extractfiles.mk	(.../tags/DEV300_m41/moz)	(revision 268999)
-+++ moz/extractfiles.mk	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -41,6 +41,7 @@
- 	plc4	\
- 	plds4	\
- 	xpcom	\
-+	xpcom_core	\
- 	xpcom_compat	\
- 	nss3	\
- 	ssl3	\
-@@ -61,13 +62,7 @@
- 	msgbaseutil	\
- 	ldap50	\
- 	prldap50
--.IF	"$(OS)"=="SOLARIS"
--.IF	"$(CPU)"=="S"
--BIN_RUNTIMELIST+=	\
--	freebl_hybrid_3
- .ENDIF
--.ENDIF #"$(OS)"=="SOLARIS"
--.ENDIF
- 
- COMPONENT_RUNTIMELIST=	\
- 	addrbook	\
-@@ -101,7 +96,8 @@
- 	xpcom_io.xpt	\
- 	xpcom_xpti.xpt	\
- 	addrbook.xpt	\
--	mozldap.xpt
-+	mozldap.xpt \
-+	pref.xpt
- 
- .IF "$(GUI)"=="WNT"
- COMREGISTRY_FILELIST+=	xpcom_thread.xpt
-@@ -127,6 +123,7 @@
- 	libnslber32v50.a	\
- 	libnsldap32v50.a	\
- 	libnspr4.a 	\
-+	libxpcom_core.dll.a	\
- 	libxpcom.dll.a	\
- 	libnss3.a	\
- 	libsmime3.a
-@@ -137,6 +134,7 @@
- 	nslber32v50.lib	\
- 	nsldap32v50.lib	\
- 	nspr4.lib 	\
-+	xpcom_core.lib	\
- 	xpcom.lib	\
- 	plc4.lib	\
- 	plds4.lib	\
-@@ -150,6 +148,7 @@
- 	libmozreg_s.a	\
- 	liblber50.a	\
- 	libnspr4$(DLLPOST)	\
-+	libxpcom_core$(DLLPOST)	\
- 	libxpcom$(DLLPOST)	\
- 	libmsgbaseutil$(DLLPOST)	\
- 	libldap50$(DLLPOST) \
-@@ -266,8 +265,14 @@
- .ENDIF
- 
- # zip runtime files to mozruntime.zip
-+.IF "$(OS)"=="MACOSX" || "$(OS)"=="LINUX"
-+	cd $(RUNTIME_DIR) && sh ..$/..$/..$/$(MOZ_BIN_DIR)$/run-mozilla.sh .$/regxpcom$(REG_SUBFIX)
-+.ELSE
-+.IF "$(OS)"!="WNT"
- 	cd $(RUNTIME_DIR) && .$/regxpcom$(REG_SUBFIX)
- 	$(COPY) $(RUNTIME_DIR)$/components$/xpti.dat $(RUNTIME_DIR)$/components$/xptitemp.dat
-+.ENDIF
-+.ENDIF
- 	$(RM) $(RUNTIME_DIR)$/regxpcom$(REG_SUBFIX)
- 	cd $(RUNTIME_DIR) && zip -r ..$/..$/bin$/mozruntime.zip *
- 	
---- moz/makefile.mk	(.../tags/DEV300_m41/moz)	(revision 268999)
-+++ moz/makefile.mk	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -41,7 +41,6 @@
- # --- Files --------------------------------------------------------
- # ----- pkg-config start -------
- .INCLUDE .IGNORE : pkgroot.mk
--
- .IF "$(PKGCONFIG_ROOT)"!=""
- PKG_CONFIG:=$(PKGCONFIG_ROOT)$/bin$/pkg-config
- PKG_CONFIG_PATH:=$(PKGCONFIG_ROOT)$/lib$/pkgconfig
-@@ -58,32 +57,32 @@
- .IF "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
- # hmm... rather gcc specific switches...
- CFLAGS:=-isystem $(SYSBASE)/usr/include -B$(SYSBASE)/usr/lib
--LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -LX11
-+LDFLAGS:=-L$(SYSBASE)/lib -L$(SYSBASE)/usr/lib -L$(SYSBASE)/usr/X11R6/lib
- SYSBASE_X11:=--x-includes=$(SYSBASE)/usr/include/X11 --x-libraries=$(SYSBASE)/usr/X11R6/lib
- .EXPORT : CFLAGS LDFLAGS
- .ENDIF			# "$(SYSBASE)"!="" && "$(OS)" == "LINUX"
- 
- # ----- pkg-config end -------
- 
--MOZILLA_VERSION*=1.7.5
--.IF "$(MOZILLA_VERSION)"=="1.7b"
--TARFILE_NAME=mozilla-source-1.7b-source
--.ELSE
--TARFILE_NAME=mozilla-source-$(MOZILLA_VERSION)
--.ENDIF
-+MOZILLA_VERSION*=1.1.13
-+TARFILE_NAME=seamonkey-$(MOZILLA_VERSION).source
-+
- TARFILE_ROOTDIR=mozilla
-+PATCH_FILE_NAME=seamonkey-source-$(MOZILLA_VERSION).patch 
- 
--PATCH_FILE_NAME=mozilla-source-$(MOZILLA_VERSION).patch 
-+# This file is needed for the W32 build when BUILD_MOZAB is set
-+# (currently only vc8/vs2005 is supported when BUILD_MOZAB is set)
-+MOZTOOLS_ZIPFILE_NAME*=vc8-moztools.zip
- 
--# These files are needed for the W32 build when BUILD_MOZAB is set
--LIBIDL_VC71_ZIPFILE_NAME*=vc71-libIDL-0.6.8-bin.zip
--LIBGLIB_VC71_ZIPFILE_NAME*=vc71-glib-1.2.10-bin.zip
--WINTOOLS_ZIPFILE_NAME*=wintools.zip
--
- ADDITIONAL_FILES=mailnews$/addrbook$/src$/nsAbMD5sum.cpp
- 
- CONFIGURE_DIR=
--MOZILLA_CONFIGURE_FLAGS= $(SYSBASE_X11) --disable-tests \
-+.IF "$(GUIBASE)"!="aqua"
-+MOZILLA_CONFIGURE_FLAGS += $(SYSBASE_X11)
-+.ENDIF
-+
-+MOZILLA_CONFIGURE_FLAGS +=  --disable-tests \
-+				--enable-application=suite \
- 				--enable-ldap \
- 				--enable-crypto \
- 				--enable-optimize \
-@@ -95,7 +94,6 @@
- 				--disable-debug \
- 				--disable-xprint \
- 				--disable-postscript \
--				--disable-freetype2 \
- 				--without-system-zlib \
- 				--disable-installer \
- 				--disable-accessibility \
-@@ -104,20 +102,40 @@
- 				--disable-oji \
- 				--disable-profilesharing \
- 				--disable-boehm \
--				--disable-jsloader
-+				--disable-jsloader \
-+				--disable-canvas \
-+				--disable-xft \
-+				--disable-freetype2 \
-+				--disable-gnomeui \
-+				--disable-image-encoders \
-+				--disable-plugins \
-+				--disable-printing \
-+				--enable-extensions="pref"
- 
-+#.IF "$(GUI)"!="WNT"
-+#MOZILLA_CONFIGURE_FLAGS += --enable-system-cairo
-+#.ENDIF
-+
- #disable profilelocking to share profile with mozilla
- #disable activex and activex-scripting to remove the dependence of Microsoft_SDK\src\mfc\atlbase.h
- #disable gnomevfs to remove the needed of gnome develop files
- #disable others to save build times
- 
- .IF "$(GUI)"=="UNX"
-+.IF "$(GUIBASE)"=="aqua"
-+MACDEVSDK*=/Developer/SDKs/MacOSX10.4u.sdk
-+MOZILLA_CONFIGURE_FLAGS+= \
-+	--with-macos-sdk=$(MACDEVSDK) \
-+	--disable-glibtest \
-+	--enable-macos-target=10.4 \
-+	--disable-libxul
-+DEFAULT_MOZILLA_TOOLKIT=mac
-+.ELSE
- #We do not need mozilla ui, but libIDL version are decided by default toolkit.
- #default-toolkit=xlib need libIDL < 0.68
- #default-toolkit=gtk2 need libIDL > 0.8 (know as libIDL2)
--.IF "x$(DEFAULT_MOZILLA_TOOLKIT)"=="x"
--DEFAULT_MOZILLA_TOOLKIT=gtk2
--.ENDIF
-+DEFAULT_MOZILLA_TOOLKIT*=gtk2
-+.ENDIF # "$(GUIBASE)"=="aqua"
- MOZILLA_CONFIGURE_FLAGS+= --enable-default-toolkit=$(DEFAULT_MOZILLA_TOOLKIT)
- .ENDIF
- 
-@@ -145,6 +163,10 @@
- .IF "$(OS)"=="SOLARIS" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
- PKG_CONFIG_PATH=/usr/lib/64/pkgconfig
- .EXPORT: PKG_CONFIG_PATH
-+MAKE=/usr/sfw/bin/gmake
-+.EXPORT: MAKE
-+CFLAGS=-I/usr/sfw/include
-+.EXPORT: CFLAGS
- .ENDIF
- .IF "$(COM)"=="C52" && "$(CPUNAME)"=="SPARC" && "$(CPU)"=="U"
- CFLAGS=-m64
-@@ -152,7 +174,7 @@
- .EXPORT: CFLAGS ASFLAGS
- .ENDIF
- 
--MOZDIR=$(MISC)$/build$/mozilla
-+MOZDIR=$(MISC)$/build$/seamonkey
- MOZTARGET=$(OS)$(COM)$(CPU)
- 
- .IF "$(GUI)"=="WNT"
-@@ -186,33 +208,23 @@
- .ENDIF
- 
- # Variables to install/use our own wintools
--MOZTOOLSUNPACK:=$(MISC)$/build$/moztoolsunpack
--MOZTOOLSINST:=$(MISC)$/build$/moztoolsinst
-+MOZTOOLS_EXTRACT:=$(MISC)$/build$/moztools
- .IF "$(USE_SHELL)"!="4nt"
--MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztoolsinst
-+MOZ_TOOLS_DOS:=$(shell @cygpath -ad "$(MISC)")\build\moztools\vc8-moztools
- .IF "$(COM)"=="GCC"
--PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin
-+PATH!:=$(PATH):$(shell @cygpath $(MOZ_TOOLS_DOS))/bin
- .ELSE
--PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/vc71/bin:$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
-+PATH!:=$(shell @cygpath $(MOZ_TOOLS_DOS))/bin:$(PATH)
- .ENDIF
--.IF "$(USE_SHELL)"=="tcsh"
--SET_MOZ_TOOLS_INSTALL_BAT:=setenv MOZ_TOOLS "$(MOZ_TOOLS_DOS)"
--.ELIF "$(USE_SHELL)"=="bash"
--SET_MOZ_TOOLS_INSTALL_BAT:=export "MOZ_TOOLS=$(MOZ_TOOLS_DOS)"
--.ELSE
--SET_MOZ_TOOLS_INSTALL_BAT:=MOZ_TOOLS="$(MOZ_TOOLS_DOS)"; export MOZ_TOOLS
--.ENDIF
- .ELSE # "$(USE_SHELL)"!="4nt"
- # MOZ_TOOLS must contain an absolute path
--MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztoolsinst
--PATH!:=$(MOZ_TOOLS_DOS)\vc71\bin;$(MOZ_TOOLS_DOS)\bin;$(PATH)
--SET_MOZ_TOOLS_INSTALL_BAT:=set MOZ_TOOLS=$(MOZ_TOOLS_DOS)
-+MOZ_TOOLS_DOS:=$(shell @echo %@SFN[$(MISC)])\build\moztools\vc8-moztools
-+PATH!:=$(MOZ_TOOLS_DOS)\bin;$(PATH)
- .ENDIF # "$(USE_SHELL)"!="4nt"
-+
- MOZ_TOOLS:=$(subst,\,/ $(MOZ_TOOLS_DOS))
--GLIB_PREFIX:=$(MOZ_TOOLS)/vc71
--LIBIDL_PREFIX:=$(MOZ_TOOLS)/vc71
- 
--.EXPORT : PATH MOZ_TOOLS GLIB_PREFIX LIBIDL_PREFIX
-+.EXPORT : PATH MOZ_TOOLS
- .ENDIF # "$(GUI)"=="WNT"
- 
- # --- Targets ------------------------------------------------------
-@@ -227,7 +239,7 @@
- .INCLUDE : tg_ext.mk
- 
- .IF "$(GUI)"=="WNT"
--NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/wintools.complete
-+NEEDWINTOOLSFLAGFILE:=$(MISC)$/build$/moztools.complete
- .ENDIF # "$(GUI)"=="WNT"
- 
- ALLTAR: $(NEEDWINTOOLSFLAGFILE) \
-@@ -245,29 +257,19 @@
- 
- # Unpack/setup Windows build tools
- .IF "$(GUI)"=="WNT"
--$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/wintools.complete
-+$(PACKAGE_DIR)$/$(UNTAR_FLAG_FILE) : $(MISC)$/build$/moztools.complete
- 
--$(MISC)$/build$/wintools.unpack : $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME)
--	-$(RENAME) $(MOZTOOLSUNPACK) $(MOZTOOLSUNPACK)_removeme
--	-$(RENAME) $(MOZTOOLSINST) $(MOZTOOLSINST)_removeme
--	-rm -rf $(MOZTOOLSUNPACK)_removeme $(MOZTOOLSINST)_removeme
--	@-$(MKDIRHIER) $(MOZTOOLSUNPACK)
--	unzip $(PRJ)$/download$/$(WINTOOLS_ZIPFILE_NAME) -d $(MOZTOOLSUNPACK)
--	$(TOUCH) $(MISC)$/build$/wintools.unpack
-+$(MISC)$/build$/moztools.unpack : $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME)
-+	-$(RENAME) $(MOZTOOLS_EXTRACT) $(MOZTOOLS_EXTRACT)_removeme
-+	-rm -rf $(MOZTOOLS_EXTRACT)_removeme
-+	@-$(MKDIRHIER) $(MOZTOOLS_EXTRACT)
-+	unzip $(PRJ)$/download$/$(MOZTOOLS_ZIPFILE_NAME) -d $(MOZTOOLS_EXTRACT)
-+# chmod is also needed for W32-4nt build (when cygwin unzip is used)
-+	-chmod -R +x $(MOZTOOLS_EXTRACT)$/vc8-moztools$/bin
-+	$(TOUCH) $(MISC)$/build$/moztools.unpack
- 
--$(MISC)$/build$/wintools.install : $(MISC)$/build$/wintools.unpack
--	cd $(MOZTOOLSUNPACK)$/buildtools$/windows && $(SET_MOZ_TOOLS_INSTALL_BAT) && cmd /c install.bat
--	$(TOUCH) $(MISC)$/build$/wintools.install
--
--$(MISC)$/build$/wintools.complete : \
--  $(MISC)$/build$/wintools.install \
--  $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) \
--  $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME)
--	unzip $(PRJ)$/download$/$(LIBIDL_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
--	unzip $(PRJ)$/download$/$(LIBGLIB_VC71_ZIPFILE_NAME) -d $(MOZTOOLSINST)
--# chmod is also needed for W32-4nt build (when cygwin unzip is used)
--	-chmod -R +x $(MOZTOOLSINST)$/vc71$/bin
--	$(TOUCH) $(MISC)$/build$/wintools.complete
-+$(MISC)$/build$/moztools.complete : $(MISC)$/build$/moztools.unpack
-+	$(TOUCH) $(MISC)$/build$/moztools.complete
- .ENDIF # "$(GUI)"=="WNT"
- 
- zip:	\
---- moz/seamonkey-source-1.1.13.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/seamonkey-source-1.1.13.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,6880 @@
-+--- misc/mozilla/build/autoconf/mozconfig-find	2007-02-16 03:19:06.000000000 +0100
-++++ misc/build/mozilla/build/autoconf/mozconfig-find	2008-08-19 10:12:04.000000000 +0200
-+@@ -51,10 +51,7 @@
-+                "$topsrcdir/.mozconfig" \
-+                "$topsrcdir/mozconfig" \
-+                "$topsrcdir/mozconfig.sh" \
-+-               "$topsrcdir/myconfig.sh" \
-+-               "$HOME/.mozconfig" \
-+-               "$HOME/.mozconfig.sh" \
-+-               "$HOME/.mozmyconfig.sh"
-++               "$topsrcdir/myconfig.sh"
-+ do
-+   if test -f "$_config"; then
-+     echo "$_config";
-+--- misc/mozilla/build/cygwin-wrapper	2004-08-19 01:18:55.000000000 +0200
-++++ misc/build/mozilla/build/cygwin-wrapper	2008-08-14 16:22:21.000000000 +0200
-+@@ -1,4 +1,4 @@
-+-#!/bin/sh
-++#!/bin/bash
-+ #
-+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
-+ # Try not to spawn programs from within this file. If the stuff in here looks royally 
-+@@ -57,12 +57,36 @@
-+                         i=-I${mountpoint}/${driveletter}/${pathname}
-+                     fi
-+                 else
-+-                    eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-+-                    if ! test "${leader}" = "${i}"; then
-+-                        eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
-+-                        eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
-+-                        driveletter=${no_mountpoint%%/*}
-+-                        i=${leader}${driveletter}:/${pathname}
-++      # The original version missed mounted paths, the new version below
-++      # doesn't transform /para as this is most likely a parameter.
-++      eval 'notinpath=${i%%'${mountpoint}'/[a-zA-Z]/*}'
-++      if ! test "$notinpath" = "$i"; then
-++         # found  $mountpoint
-++         eval 'restpath=${i#'${notinpath}${mountpoint}'/[a-zA-Z]/}'
-++         eval 'withdrive=${i#'${notinpath}${mountpoint}'/}'
-++         driveletter=${withdrive%%/*}
-++         i=${notinpath}${driveletter}:/${restpath}
-++      else
-++         # check for potential path. Precheck using shell methods
-++         doconvert=""
-++         # Shortcut -X<path> when path does not begin with '/'
-++         noswitch=${i#-[a-zA-Z]}
-++         if test "$noswitch" != "$i"; then
-++            test "${noswitch#/}" != "$noswitch" && doconvert="1"
-++         fi
-++         # Precheck for possible path. Consider only absolute paths that contain at least
-++         # a second / to prevent converting of /abc parameters.
-++         test -z "$doconvert" -a "${i#/[a-zA-Z0-9_.-]*/}" != "$i" && doconvert="1"
-++         if test -n "$doconvert"; then
-++            # Can be a path. If forking grep would be faster or we could require bash 3
-++            # this regexp would be all that's needed to find pathnames that need converting
-++            pathname=`echo $i | grep -oE '^(-[a-zA-Z])?/[a-zA-Z0-9_.-]+/[a-zA-Z0-9_./-]+$'`
-++            eval 'notinpath=${i%'${pathname}'}'
-++            if test "$notinpath" != "$i" -a "$pathname" != "${pathname#/}"; then
-++               pathname=`cygpath -am "$pathname"`
-++               i=${notinpath}${pathname}
-++            fi
-++         fi
-+                     fi
-+                 fi
-+             fi
-+--- misc/mozilla/config/Makefile.in	2006-12-22 14:50:41.000000000 +0100
-++++ misc/build/mozilla/config/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -166,7 +166,7 @@
-+ 
-+ ifdef MOZ_ENABLE_GTK2
-+   GLIB_CFLAGS = $(MOZ_GTK2_CFLAGS)
-+-  GLIB_LIBS = $(MOZ_GTK2_LIBS)
-++  GLIB_LIBS = $(filter -lglib% -L%,$(MOZ_GTK2_LIBS))
-+ endif
-+ 
-+ build_number: FORCE
-+--- misc/mozilla/config/autoconf.mk.in	2006-09-14 20:07:03.000000000 +0200
-++++ misc/build/mozilla/config/autoconf.mk.in	2008-11-07 16:08:52.937500000 +0100
-+@@ -543,6 +543,7 @@
-+ MOZ_TOOLS_DIR	= @MOZ_TOOLS_DIR@
-+ MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
-+ MOZ_QUANTIFY	= @MOZ_QUANTIFY@
-++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
-+ 
-+ #python options
-+ PYTHON = @MOZ_PYTHON@
-+--- misc/mozilla/config/config.mk	2008-01-29 20:30:22.000000000 +0100
-++++ misc/build/mozilla/config/config.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -758,6 +758,23 @@
-+ endif
-+ 
-+ #
-++# Shared library RUNPATH linker option(s)
-++#
-++ifeq ($(OS_ARCH),Linux)
-++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-++ifdef IS_COMPONENT
-++EXTRA_DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN/..:\$$ORIGIN/../../ure-link/lib
-++endif # IS_COMPONENT
-++endif # Linux
-++
-++ifeq ($(OS_ARCH),SunOS)
-++EXTRA_DSO_LDOPTS += -R '$$ORIGIN'
-++ifdef IS_COMPONENT
-++EXTRA_DSO_LDOPTS += -R '$$ORIGIN/..'
-++endif # IS_COMPONENT
-++endif # SunOS
-++
-++#
-+ # Include any personal overrides the user might think are needed.
-+ #
-+ -include $(MY_CONFIG)
-+--- misc/mozilla/config/rules.mk	2008-01-29 20:30:22.000000000 +0100
-++++ misc/build/mozilla/config/rules.mk	2009-02-16 14:05:23.000000000 +0100
-+@@ -529,8 +529,9 @@
-+ ifeq ($(OS_ARCH),WINNT)
-+ ifdef GNU_CC
-+ ifndef IS_COMPONENT
-+-DSO_LDOPTS += -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
-++DSO_LDOPTS += -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY)
-+ endif
-++DSO_LDOPTS += -Wl,--enable-runtime-pseudo-reloc -Wl,-Map -Wl,$(LIB_PREFIX)$(LIBRARY_NAME).map
-+ endif
-+ endif
-+ 
-+@@ -811,6 +810,12 @@
-+ 
-+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-+ 	$(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ ifeq ($(CPP_PROG_LINK),1)
-+ 	$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
-+@@ -843,6 +848,12 @@
-+ else
-+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
-+ 	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ 	$(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
-+ endif
-+@@ -866,6 +877,12 @@
-+ else
-+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-+ 	$(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ ifeq ($(CPP_PROG_LINK),1)
-+ 	$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
-+@@ -1019,6 +1036,14 @@
-+ endif # SHARED_LIBRARY_LIBS
-+ endif # NO_LD_ARCHIVE_FLAGS
-+ 	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
-++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-++endif	# WINNT && !GCC
-+ 	@rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
-+ else # os2 vacpp
-+ 	$(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
-+@@ -1043,7 +1070,7 @@
-+ if test -d $(@D); then \
-+ 	echo "Building deps for $<"; \
-+ 	touch $(_MDDEPFILE) && \
-+-	$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
-++	$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
-+ 	mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
-+ 	cat $(_MDDEPFILE).old | sed -e "s|^$(srcdir)/||" -e "s|^$(win_srcdir)/||" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
-+ fi
-+@@ -1053,7 +1080,7 @@
-+ if test -d $(@D); then \
-+ 	echo "Building deps for $<"; \
-+ 	touch $(_MDDEPFILE) && \
-+-	$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
-++	$(MKDEPEND) -o'.$(OBJ_SUFFIX)' -f$(_MDDEPFILE) $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
-+ 	mv $(_MDDEPFILE) $(_MDDEPFILE).old && \
-+ 	cat $(_MDDEPFILE).old | sed -e "s|^$(<D)/||g" > $(_MDDEPFILE) && rm -f $(_MDDEPFILE).old ; \
-+ fi
-+@@ -1325,6 +1352,7 @@
-+ 
-+ $(XPIDL_GEN_DIR)/%.h: %.idl $(XPIDL_COMPILE) $(XPIDL_GEN_DIR)/.done
-+ 	$(REPORT_BUILD)
-++	echo "PATH=" $(PATH)
-+ 	$(ELOG) $(XPIDL_COMPILE) -m header -w -I$(srcdir) -I$(IDL_DIR) -o $(XPIDL_GEN_DIR)/$* $(_VPATH_SRCS)
-+ 	@if test -n "$(findstring $*.h, $(EXPORTS) $(SDK_HEADERS))"; \
-+ 	  then echo "*** WARNING: file $*.h generated from $*.idl overrides $(srcdir)/$*.h"; else true; fi
-+@@ -1696,14 +1724,14 @@
-+ define MAKE_DEPS_NOAUTO
-+ 	set -e ; \
-+ 	touch $@ && \
-+-	$(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $(srcdir)/$(<F) >/dev/null 2>&1 && \
-++	$(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $(srcdir)/$(<F) >/dev/null 2>&1 && \
-+ 	mv $@ $@.old && cat $@.old | sed "s|^$(srcdir)/||g" > $@ && rm -f $@.old
-+ endef
-+ else
-+ define MAKE_DEPS_NOAUTO
-+ 	set -e ; \
-+ 	touch $@ && \
-+-	$(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(INCLUDES) $< >/dev/null 2>&1 && \
-++	$(MKDEPEND) -w1024 -o'.$(OBJ_SUFFIX)' -f$@ $(DEFINES) $(ACDEFINES) $(filter-out -I/so/env% ,$(INCLUDES)) $< >/dev/null 2>&1 && \
-+ 	mv $@ $@.old && cat $@.old | sed "s|^$(<D)/||g" > $@ && rm -f $@.old
-+ endef
-+ endif # WINNT
-+--- misc/mozilla/configure	2008-10-30 23:05:30.000000000 +0100
-++++ misc/build/mozilla/configure	2009-02-12 15:20:18.597579000 +0100
-+@@ -1068,6 +1068,8 @@
-+ GCONF_VERSION=1.2.1
-+ LIBGNOME_VERSION=2.0
-+ 
-++MSMANIFEST_TOOL=
-++
-+ MISSING_X=
-+ for ac_prog in gawk mawk nawk awk
-+ do
-+@@ -3022,9 +3024,26 @@
-+             _CC_SUITE=7
-+         elif test "$_CC_MAJOR_VERSION" = "14"; then
-+             _CC_SUITE=8
-++            CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
-+         else
-+             { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
-+         fi
-++	
-++	# bug #249782
-++	# ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
-++	if test "$_CC_SUITE" -ge "8"; then
-++		MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
-++		if test -n "MSMT_TOOL"; then
-++			MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
-++			if test -z "MSMANIFEST_TOOL_VERSION"; then
-++				echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
-++			fi
-++			MSMANIFEST_TOOL=1
-++			unset MSMT_TOOL
-++		else
-++			{ echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
-++		fi
-++	fi
-+ 
-+         # Check linker version
-+         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
-+@@ -5726,6 +5745,7 @@
-+         if test "`echo ${srcdir} | grep -c ^/ 2>/dev/null`" = 0; then
-+             _pwd=`pwd`
-+             CYGWIN_WRAPPER="${_pwd}/${srcdir}/build/cygwin-wrapper"
-++	    CYGWIN_WRAPPER=`cygpath -u $CYGWIN_WRAPPER`
-+         fi
-+         if test "`${PERL} -v | grep -c cygwin  2>/dev/null`" = 0; then
-+             AS_PERL=1
-+@@ -6036,7 +6056,7 @@
-+     CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
-+     DLL_SUFFIX=".dylib"
-+     DSO_LDOPTS=''
-+-    STRIP="$STRIP -x -S"
-++    STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
-+     _PLATFORM_DEFAULT_TOOLKIT='mac'
-+     MOZ_ENABLE_POSTSCRIPT=
-+     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
-+@@ -6075,7 +6095,7 @@
-+     ;;
-+ 
-+ *-freebsd*)
-+-    if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
-++    if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
-+ 	DLL_SUFFIX=".so.1.0"
-+ 	DSO_LDOPTS="-shared"
-+     fi
-+@@ -6718,7 +6738,7 @@
-+     MOZ_USER_DIR="Mozilla"
-+ 
-+     if test "$MOZTOOLS"; then
-+-        MOZ_TOOLS_DIR=`echo $MOZTOOLS | sed -e 's|\\\\|/|g'`
-++        MOZ_TOOLS_DIR=`echo $MOZTOOLS`
-+     else
-+         { echo "configure: error: MOZTOOLS is not set" 1>&2; exit 1; }
-+     fi
-+@@ -8614,6 +8634,8 @@
-+ case $target in
-+ *-hpux11.*)
-+ 	;;
-++*-freebsd*)
-++	;;
-+ *)
-+ 	echo $ac_n "checking for gethostbyname_r in -lc_r""... $ac_c" 1>&6
-+ echo "configure:8620: checking for gethostbyname_r in -lc_r" >&5
-+@@ -12259,7 +12281,7 @@
-+ gtk2)
-+     MOZ_ENABLE_GTK2=1
-+     MOZ_ENABLE_XREMOTE=1
-+-    MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-}
-++    MOZ_ENABLE_COREXFONTS=${MOZ_ENABLE_COREXFONTS-1}
-+     TK_CFLAGS='$(MOZ_GTK2_CFLAGS)'
-+     TK_LIBS='$(MOZ_GTK2_LIBS)'
-+     cat >> confdefs.h <<\EOF
-+@@ -19233,7 +19255,8 @@
-+            MOZ_CAIRO_LIBS="-lmozcairo -lmozlibpixman $CAIRO_FT_LIBS"
-+ 
-+            if test "$MOZ_X11"; then
-+-               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
-++#               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS -lXrender $XLIBS -lfontconfig -lfreetype"
-++               MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $XLIBS -lfontconfig -lfreetype"
-+            fi
-+            if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
-+                MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS -lgdi32"
-+@@ -20076,8 +20099,12 @@
-+     WIN_TOP_SRC=`cd $srcdir; pwd -W`
-+     ;;
-+ cygwin*|msvc*|mks*)
-+-    HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
-+-    HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-++# Don't add the wrapper for the HOST_* versions as they contain an
-++# unexpanded $CC and therfore wil get the wrapper below.
-++    if test -n "$GNU_CC"; then
-++     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
-++     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-++    fi
-+     CC="\$(CYGWIN_WRAPPER) $CC"
-+     CXX="\$(CYGWIN_WRAPPER) $CXX"
-+     CPP="\$(CYGWIN_WRAPPER) $CPP"
-+--- misc/mozilla/configure.in	2008-10-30 23:05:31.000000000 +0100
-++++ misc/build/mozilla/configure.in	2009-02-05 20:12:45.456777753 +0100
-+@@ -126,6 +126,8 @@
-+ GCONF_VERSION=1.2.1
-+ LIBGNOME_VERSION=2.0
-+ 
-++MSMANIFEST_TOOL=
-++
-+ dnl Set various checks
-+ dnl ========================================================
-+ MISSING_X=
-+@@ -425,9 +427,26 @@
-+             _CC_SUITE=7
-+         elif test "$_CC_MAJOR_VERSION" = "14"; then
-+             _CC_SUITE=8
-++            CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
-+         else
-+             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
-+         fi
-++	
-++	# bug #249782
-++	# ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
-++	if test "$_CC_SUITE" -ge "8"; then
-++		MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
-++		if test -n "MSMT_TOOL"; then
-++			MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
-++			if test -z "MSMANIFEST_TOOL_VERSION"; then
-++				AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
-++			fi
-++			MSMANIFEST_TOOL=1
-++			unset MSMT_TOOL
-++		else
-++			AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
-++		fi
-++	fi
-+ 
-+         # Check linker version
-+         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
-+@@ -1530,7 +1549,7 @@
-+     CXXFLAGS="$CXXFLAGS -fpascal-strings -no-cpp-precomp -fno-common"
-+     DLL_SUFFIX=".dylib"
-+     DSO_LDOPTS=''
-+-    STRIP="$STRIP -x -S"
-++    STRIP="$STRIP -X -S" # MACOSX 10.5 strip -x sometimes fails
-+     _PLATFORM_DEFAULT_TOOLKIT='mac'
-+     MOZ_ENABLE_POSTSCRIPT=
-+     TARGET_NSPR_MDCPUCFG='\"md/_darwin.cfg\"'
-+@@ -1552,7 +1571,7 @@
-+     ;;
-+ 
-+ *-freebsd*)
-+-    if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo aout` != "elf"; then
-++    if test `test -x /usr/bin/objformat && /usr/bin/objformat || echo elf` != "elf"; then
-+ 	DLL_SUFFIX=".so.1.0"
-+ 	DSO_LDOPTS="-shared"
-+     fi
-+@@ -2749,6 +2768,8 @@
-+ case $target in
-+ *-hpux11.*)
-+ 	;;
-++*-freebsd*)
-++	;;
-+ *)
-+ 	AC_CHECK_LIB(c_r, gethostbyname_r)
-+ 	;;
-+@@ -7321,6 +7342,7 @@
-+ AC_SUBST(USE_N32)
-+ AC_SUBST(CC_VERSION)
-+ AC_SUBST(CXX_VERSION)
-++AC_SUBST(MSMANIFEST_TOOL)
-+ 
-+ if test "$USING_HCC"; then
-+    CC='${topsrcdir}/build/hcc'
-+@@ -7416,8 +7438,12 @@
-+     WIN_TOP_SRC=`cd $srcdir; pwd -W`
-+     ;;
-+ cygwin*|msvc*|mks*)
-+-    HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
-+-    HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-++# Don't add the wrapper for the HOST_* versions as they contain an
-++# unexpanded $CC and therfore wil get the wrapper below.
-++    if test -n "$GNU_CC"; then
-++     HOST_CC="\$(CYGWIN_WRAPPER) $HOST_CC"
-++     HOST_CXX="\$(CYGWIN_WRAPPER) $HOST_CXX"
-++    fi 
-+     CC="\$(CYGWIN_WRAPPER) $CC"
-+     CXX="\$(CYGWIN_WRAPPER) $CXX"
-+     CPP="\$(CYGWIN_WRAPPER) $CPP"
-+--- misc/mozilla/directory/c-sdk/build.mk	2006-02-03 15:44:29.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/build.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -384,7 +384,7 @@
-+ ifdef NS_USE_GCC
-+ LINK_EXE	= $(CC) -o $@ $(LDFLAGS) $(LCFLAGS) $(DEPLIBS) $(OBJS) $(EXTRA_LIBS) $(PLATFORMLIBS)
-+ LINK_LIB	= $(AR) cr $@ $(OBJS)
-+-LINK_DLL	= $(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
-++LINK_DLL	= $(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(LIB_PREFIX)$(@:.$(DLL_SUFFIX)=.$(LIB_SUFFIX)) $(LLFLAGS) $(DLL_LDFLAGS) -o $@ $(OBJS) $(EXTRA_LIBS) $(EXTRA_DLL_LIBS)
-+ else
-+ DEBUG_LINK_OPT=-DEBUG
-+ ifeq ($(BUILD_OPT), 1)
-+--- misc/mozilla/directory/c-sdk/config/FreeBSD.mk	2006-02-03 15:41:11.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/config/FreeBSD.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -70,7 +70,7 @@
-+ 
-+ ARCH			= freebsd
-+ 
-+-MOZ_OBJFORMAT          := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
-++MOZ_OBJFORMAT          := $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
-+ 
-+ ifeq ($(MOZ_OBJFORMAT),elf)
-+ DLL_SUFFIX		= so
-+--- misc/mozilla/directory/c-sdk/config/autoconf.mk.in	2006-02-23 00:58:25.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/config/autoconf.mk.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -25,6 +25,7 @@
-+ LIB_SUFFIX	= @LIB_SUFFIX@
-+ LIB_PREFIX	= @LIB_PREFIX@
-+ DLL_SUFFIX	= @DLL_SUFFIX@
-++DLL_PREFIX	= @DLL_PREFIX@
-+ ASM_SUFFIX	= @ASM_SUFFIX@
-+ PROG_SUFFIX	= @PROG_SUFFIX@
-+ MOD_NAME	= @NSPR_MODNAME@
-+--- misc/mozilla/directory/c-sdk/config/cygwin-wrapper	2004-08-19 01:18:55.000000000 +0200
-++++ misc/build/mozilla/directory/c-sdk/config/cygwin-wrapper	2008-08-14 16:22:21.000000000 +0200
-+@@ -1,4 +1,4 @@
-+-#!/bin/sh
-++#!/bin/bash
-+ #
-+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
-+ # Try not to spawn programs from within this file. If the stuff in here looks royally 
-+--- misc/mozilla/directory/c-sdk/configure	2006-02-23 01:58:13.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/configure	2008-08-14 16:22:21.000000000 +0200
-+@@ -2738,6 +2738,7 @@
-+ LIB_SUFFIX=a
-+ LIB_PREFIX=lib
-+ DLL_SUFFIX=so
-++DLL_PREFIX=lib
-+ ASM_SUFFIX=s
-+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
-+ PR_MD_ASFILES=
-+@@ -3444,7 +3445,7 @@
-+ EOF
-+ 
-+     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-+-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
-++    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
-+     if test "$MOZ_OBJFORMAT" = "elf"; then
-+         DLL_SUFFIX=so
-+     else
-+@@ -3811,6 +3812,7 @@
-+     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
-+     DSO_CFLAGS=-fPIC
-+     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
-++    DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
-+     OS_LIBS="$OS_LIBS -lc"
-+     _OPTIMIZE_FLAGS=-O2
-+     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
-+@@ -3880,7 +3882,8 @@
-+         CC="$CC -mno-cygwin"
-+         CXX="$CXX -mno-cygwin"
-+         DLL_SUFFIX=dll
-+-        MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
-++	DLL_PREFIX=
-++        MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
-+         # Use temp file for windres (bug 213281)
-+         RC="$WINDRES -O coff --use-temp-file"
-+     else
-+@@ -3897,6 +3900,7 @@
-+ 	    LIB_SUFFIX=lib
-+ 	    LIB_PREFIX=
-+ 	    DLL_SUFFIX=dll
-++	    DLL_PREFIX=
-+         
-+         CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
-+         DLLFLAGS='-OUT:"$@"'
-+@@ -4293,6 +4297,7 @@
-+     NSINSTALL=nsinstall
-+     LIB_PREFIX=
-+     LIB_SUFFIX=lib
-++    DLL_PREFIX=
-+     DLL_SUFFIX=dll
-+     DLLTOOL=''
-+     RC=rc.exe
-+@@ -4660,6 +4665,7 @@
-+     LD=/usr/ccs/bin/ld
-+     RANLIB=/usr/ccs/bin/ranlib
-+     DSO_LDOPTS='-G -h $(notdir $@)'
-++    DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
-+     if test -n "$GNU_CC"; then
-+         DSO_CFLAGS=-fPIC
-+     else
-+@@ -5844,6 +5850,7 @@
-+ s%@LIB_SUFFIX@%$LIB_SUFFIX%g
-+ s%@LIB_PREFIX@%$LIB_PREFIX%g
-+ s%@DLL_SUFFIX@%$DLL_SUFFIX%g
-++s%@DLL_PREFIX@%$DLL_PREFIX%g
-+ s%@ASM_SUFFIX@%$ASM_SUFFIX%g
-+ s%@PROG_SUFFIX@%$PROG_SUFFIX%g
-+ s%@MKSHLIB@%$MKSHLIB%g
-+--- misc/mozilla/directory/c-sdk/configure.in	2007-07-15 16:41:07.000000000 +0200
-++++ misc/build/mozilla/directory/c-sdk/configure.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -549,6 +549,7 @@
-+ LIB_SUFFIX=a
-+ LIB_PREFIX=lib
-+ DLL_SUFFIX=so
-++DLL_PREFIX=lib
-+ ASM_SUFFIX=s
-+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
-+ PR_MD_ASFILES=
-+@@ -1037,7 +1038,7 @@
-+     AC_DEFINE(FREEBSD)
-+     AC_DEFINE(HAVE_BSD_FLOCK)
-+     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-+-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
-++    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
-+     if test "$MOZ_OBJFORMAT" = "elf"; then
-+         DLL_SUFFIX=so
-+     else
-+@@ -1285,6 +1286,7 @@
-+     MKSHLIB='$(CC) $(DSO_LDOPTS) -o $@'
-+     DSO_CFLAGS=-fPIC
-+     DSO_LDOPTS='-shared -Wl,-soname -Wl,$(notdir $@)'
-++    DSO_LDOPTS="$DSO_LDOPTS -Wl,-rpath,'$\$ORIGIN:$\$ORIGIN/../ure-link/lib'"
-+     OS_LIBS="$OS_LIBS -lc"
-+     _OPTIMIZE_FLAGS=-O2
-+     _DEBUG_FLAGS="-g -fno-inline"  # most people on linux use gcc/gdb, and that
-+@@ -1336,6 +1338,8 @@
-+         CC="$CC -mno-cygwin"
-+         CXX="$CXX -mno-cygwin"
-+         DLL_SUFFIX=dll
-++        DLL_SUFFIX=dll
-++	DLL_PREFIX=
-+         MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) -o $@'
-+         # Use temp file for windres (bug 213281)
-+         RC="$WINDRES -O coff --use-temp-file"
-+@@ -1353,6 +1357,7 @@
-+ 	    LIB_SUFFIX=lib
-+ 	    LIB_PREFIX=
-+ 	    DLL_SUFFIX=dll
-++	    DLL_PREFIX=
-+         
-+         CFLAGS="$CFLAGS -W3 -nologo -GF -Gy"
-+         DLLFLAGS='-OUT:"$@"'
-+@@ -1820,6 +1825,7 @@
-+     LD=/usr/ccs/bin/ld
-+     RANLIB=/usr/ccs/bin/ranlib
-+     DSO_LDOPTS='-G -h $(notdir $@)'
-++    DSO_LDOPTS="$DSO_LDOPTS -R '$\$ORIGIN'"
-+     if test -n "$GNU_CC"; then
-+         DSO_CFLAGS=-fPIC
-+     else
-+@@ -2410,6 +2416,7 @@
-+ AC_SUBST(LIB_SUFFIX)
-+ AC_SUBST(LIB_PREFIX)
-+ AC_SUBST(DLL_SUFFIX)
-++AC_SUBST(DLL_PREFIX)
-+ AC_SUBST(ASM_SUFFIX)
-+ AC_SUBST(PROG_SUFFIX)
-+ AC_SUBST(MKSHLIB)
-+--- misc/mozilla/directory/c-sdk/ldap/include/Makefile.in	2006-02-03 15:44:33.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/ldap/include/Makefile.in	2008-11-02 21:55:34.929250000 +0100
-+@@ -85,6 +85,11 @@
-+ 
-+ ###########################################################################
-+ 
-++ifeq ($(TERM),cygwin)
-++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
-++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
-++endif
-++
-+ all export::	$(INCLUDEDIR) $(GENHEADERS)
-+ 	$(NSINSTALL) -D $(PRIVATEINCDIR)
-+ 	$(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
-+--- misc/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2006-02-03 15:44:42.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libldap/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -109,7 +109,7 @@
-+ HDIR		= $(topsrcdir)/ldap/include
-+ 
-+ LIBLDAP		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(LIB_SUFFIX))
-+-DLLLDAP		= $(addprefix $(OBJDIR_NAME)/, $(LIB_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
-++DLLLDAP		= $(addprefix $(OBJDIR_NAME)/, $(DLL_PREFIX)$(LDAP_LIBNAME).$(DLL_SUFFIX))
-+ 
-+ INSTALLDIR	= $(DIST)/$(OBJDIR_NAME)
-+ 
-+@@ -320,6 +320,10 @@
-+ 	-$(RM) $(SO_FILES_TO_REMOVE)
-+ endif
-+ 	$(LINK_DLL) $(LDAP_EXPORT_FLAGS) $(EXTRA_LIBS)
-++	if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
-++		rm -f $@.manifest; \
-++	fi
-+ 
-+ veryclean:: clean
-+ 
-+--- misc/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2006-02-03 15:44:49.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libprldap/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -62,7 +62,7 @@
-+ LIBPRLDAP =
-+ endif
-+ DLLPRLDAP	= $(addprefix $(OBJDIR_NAME)/, \
-+-			$(LIB_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
-++			$(DLL_PREFIX)$(PRLDAP_LIBNAME).$(DLL_SUFFIX))
-+ 
-+ INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-+ 
-+--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile	2004-08-26 01:02:30.000000000 +0200
-++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile	2008-08-14 16:22:21.000000000 +0200
-+@@ -41,7 +41,7 @@
-+ HDIR		= $(topsrcdir)/ldap/include
-+ 
-+ LIBSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-+-DLLSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-++DLLSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-+ 
-+ INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-+ 
-+@@ -76,7 +92,7 @@
-+ 
-+ # variable definitions for exported symbols
-+ ifeq ($(OS_ARCH), WINNT)
-+-        SSLDAP_EXPORT_DEFS= $(srcdir)/../msdos/winsock/nsldapssl32.def
-++        SSLDAP_EXPORT_DEFS= $(win_srcdir)/../msdos/winsock/nsldapssl32.def
-+ else
-+         SSLDAP_EXPORT_DEFS= $(SSLOBJDEST)/libldap_ssl.exp
-+ endif
-+--- misc/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in	2006-02-03 15:44:49.000000000 +0100
-++++ misc/build/mozilla/directory/c-sdk/ldap/libraries/libssldap/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -56,7 +56,7 @@
-+ HDIR		= $(topsrcdir)/ldap/include
-+ 
-+ LIBSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(LIB_SUFFIX))
-+-DLLSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(LIB_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-++DLLSSLDAP	= $(addprefix $(SSLOBJDEST)/, $(DLL_PREFIX)$(SSLDAP_LIBNAME).$(DLL_SUFFIX))
-+ 
-+ INSTALLDIR      = $(DIST)/$(OBJDIR_NAME)
-+ 
-+--- misc/mozilla/embedding/browser/gtk/src/Makefile.in	2006-03-22 19:22:41.000000000 +0100
-++++ misc/build/mozilla/embedding/browser/gtk/src/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -112,14 +112,14 @@
-+ 		gtkmozembed_internal.h
-+ 
-+ ifdef MOZ_ENABLE_GTK
-+-EXTRA_DSO_LDOPTS = \
-++EXTRA_DSO_LDOPTS += \
-+ 		$(MOZ_COMPONENT_LIBS) \
-+ 		-lgtksuperwin \
-+ 		$(NULL)
-+ endif
-+ 
-+ ifdef MOZ_ENABLE_GTK2
-+-EXTRA_DSO_LDOPTS = \
-++EXTRA_DSO_LDOPTS += \
-+ 		$(MOZ_COMPONENT_LIBS) \
-+ 		$(NULL)
-+ endif
-+--- misc/mozilla/embedding/browser/gtk/tests/Makefile.in	2006-03-24 17:10:37.000000000 +0100
-++++ misc/build/mozilla/embedding/browser/gtk/tests/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -63,10 +63,11 @@
-+ 		TestGtkEmbedNotebook.cpp \
-+ 		TestGtkEmbedSocket.cpp \
-+ 		TestGtkEmbedChild.cpp
-+-endif
-+ 
-+ SIMPLE_PROGRAMS = $(CPPSRCS:.cpp=)
-+ 
-++endif
-++
-+ # ENABLE_GNOME=1
-+ 
-+ ifdef ENABLE_GNOME
-+--- misc/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in	2005-06-20 21:24:51.000000000 +0200
-++++ misc/build/mozilla/embedding/components/printingui/src/mac/printpde/Makefile.in	2009-02-19 13:11:39.000000000 +0100
-+@@ -68,25 +68,15 @@
-+ 
-+ unexport CC CXX
-+ 
-+-ABS_topsrcdir   := $(shell cd $(topsrcdir); pwd)
-+-ifneq ($(ABS_topsrcdir),$(MOZ_BUILD_ROOT))
-+-export::
-+-	rsync -a --exclude .DS_Store --exclude "CVS/" $(srcdir)/$(PROJECT) .
-+-	ln -fs $(srcdir)/src
-+-	ln -fs $(srcdir)/res
-+-	ln -fs $(srcdir)/public
-+-	ln -fs $(srcdir)/Info-*.plist .
-+-endif
-+-
-+ libs::
-+ # Bug 297227: The next line doesn't need to stay around forever, only
-+ # long enough to clean up existing depend builds from when xcodebuild
-+ # was being instructed to "install"
-+ 	if test -e build/UninstalledProducts ; then $(MAKE) clean ; rm -rf $(DIST)/package/PrintPDE.plugin ; fi
-+ 
-+-	$(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
-+-	mkdir -p $(DIST)/package
-+-	$(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
-++#	$(PBBUILD) $(PROJECT_ARG) -target PrintPDE -buildstyle $(BUILDSTYLE) $(PBBUILD_ARG)
-++#	mkdir -p $(DIST)/package
-++#	$(INSTALL) $(XCODE_PRODUCT_DIR)/PrintPDE.plugin $(DIST)/package
-+ 
-+ clean clobber::
-+ 	rm -rf build
-+--- misc/mozilla/embedding/config/Makefile.in	2007-10-08 21:08:15.000000000 +0200
-++++ misc/build/mozilla/embedding/config/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -110,7 +110,7 @@
-+ 	$(NSINSTALL) -t $(srcdir)/installed-chrome.txt $(DIST)/Embed/chrome
-+ 	$(NSINSTALL) -t $(srcdir)/readme.html $(DIST)/Embed
-+ ifndef MINIMO
-+-	-$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(LIB_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
-++	-$(NSINSTALL) -t $(DEPTH)/embedding/lite/$(DLL_PREFIX)embed_lite$(DLL_SUFFIX) $(DIST)/Embed/components
-+ endif
-+ ifeq ($(OS_ARCH),WINNT)
-+ ifeq ($(WINAPP),mfcembed)
-+--- misc/mozilla/extensions/pref/autoconfig/src/Makefile.in	2006-02-03 15:41:09.000000000 +0100
-++++ misc/build/mozilla/extensions/pref/autoconfig/src/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -85,7 +85,7 @@
-+ endif
-+ 
-+ 
-+-EXTRA_DSO_LDOPTS = \
-++EXTRA_DSO_LDOPTS += \
-+                    $(LIBS_DIR) \
-+                    $(MOZ_JS_LIBS) \
-+                    $(MOZ_COMPONENT_LIBS) \
-+--- misc/mozilla/extensions/sql/build/Makefile.in	2004-11-29 18:39:08.000000000 +0100
-++++ misc/build/mozilla/extensions/sql/build/Makefile.in	2008-08-18 14:03:04.000000000 +0200
-+@@ -55,5 +55,5 @@
-+ 	bin/components/sqlpgsql.xpt \
-+ 	bin/components/sqlsqlite.xpt \
-+ 	bin/components/sqlmysql.xpt \
-+-	bin/components/$(LIB_PREFIX)sql$(DLL_SUFFIX) \
-++	bin/components/$(DLL_PREFIX)sql$(DLL_SUFFIX) \
-+ 	bin/chrome/sql.jar
-+--- misc/mozilla/gfx/idl/nsIFreeType2.idl	2004-04-16 01:30:02.000000000 +0200
-++++ misc/build/mozilla/gfx/idl/nsIFreeType2.idl	2008-08-14 16:22:21.000000000 +0200
-+@@ -76,10 +76,11 @@
-+ native FT_Sfnt_Tag(FT_Sfnt_Tag);
-+ native FT_Size(FT_Size);
-+ 
-+-[ptr] native FTC_Image_Desc_p(FTC_Image_Desc);
-++[ptr] native FTC_ImageType_p(FTC_ImageType);
-+ native FTC_Face_Requester(FTC_Face_Requester);
-+ native FTC_Font(FTC_Font);
-+-native FTC_Image_Cache(FTC_Image_Cache);
-++native FTC_FaceID(FTC_FaceID);
-++native FTC_ImageCache(FTC_ImageCache);
-+ native FTC_Manager(FTC_Manager);
-+ 
-+ // #ifdef MOZ_SVG
-+@@ -99,7 +100,7 @@
-+ 
-+     readonly attribute FT_Library library;
-+     readonly attribute FTC_Manager FTCacheManager;
-+-    readonly attribute FTC_Image_Cache ImageCache;
-++    readonly attribute FTC_ImageCache ImageCache;
-+ 
-+     void    doneFace(in FT_Face face);
-+     void    doneFreeType(in FT_Library lib);
-+@@ -115,16 +116,16 @@
-+     void    outlineDecompose(in FT_Outline_p outline,
-+                              in const_FT_Outline_Funcs_p funcs, in voidPtr p);
-+     void    setCharmap(in FT_Face face, in FT_CharMap charmap);
-+-    void    imageCacheLookup(in FTC_Image_Cache cache, in FTC_Image_Desc_p desc,
-++    void    imageCacheLookup(in FTC_ImageCache cache, in FTC_ImageType_p desc,
-+                              in FT_UInt gindex, out FT_Glyph glyph);
-+-    void    managerLookupSize(in FTC_Manager manager, in FTC_Font font,
-+-                              out FT_Face face, out FT_Size size);
-++    void    managerLookupFace(in FTC_Manager manager, in FTC_FaceID face_id,
-++                              out FT_Face face);
-+     void    managerDone(in FTC_Manager manager);
-+     void    managerNew(in FT_Library lib, in FT_UInt max_faces,
-+                        in FT_UInt max_sizes, in FT_ULong max_bytes,
-+                        in FTC_Face_Requester requester, in FT_Pointer req_data,
-+                        out FTC_Manager manager);
-+-    void    imageCacheNew(in FTC_Manager manager, out FTC_Image_Cache cache);
-++    void    imageCacheNew(in FTC_Manager manager, out FTC_ImageCache cache);
-+ /* #ifdef MOZ_SVG */
-+     void glyphTransform(in FT_Glyph glyph, in FT_Matrix_p matrix,
-+                         in FT_Vector_p delta);
-+--- misc/mozilla/gfx/src/freetype/nsFreeType.cpp	2005-07-13 20:21:10.000000000 +0200
-++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -111,7 +111,7 @@
-+   {"FT_Outline_Decompose",    NS_FT2_OFFSET(nsFT_Outline_Decompose),    PR_TRUE},
-+   {"FT_Set_Charmap",          NS_FT2_OFFSET(nsFT_Set_Charmap),          PR_TRUE},
-+   {"FTC_Image_Cache_Lookup",  NS_FT2_OFFSET(nsFTC_Image_Cache_Lookup),  PR_TRUE},
-+-  {"FTC_Manager_Lookup_Size", NS_FT2_OFFSET(nsFTC_Manager_Lookup_Size), PR_TRUE},
-++  {"FTC_Manager_LookupFace",  NS_FT2_OFFSET(nsFTC_Manager_LookupFace),  PR_TRUE},
-+   {"FTC_Manager_Done",        NS_FT2_OFFSET(nsFTC_Manager_Done),        PR_TRUE},
-+   {"FTC_Manager_New",         NS_FT2_OFFSET(nsFTC_Manager_New),         PR_TRUE},
-+   {"FTC_Image_Cache_New",     NS_FT2_OFFSET(nsFTC_Image_Cache_New),     PR_TRUE},
-+@@ -288,7 +288,7 @@
-+ } 
-+  
-+ NS_IMETHODIMP
-+-nsFreeType2::ImageCacheLookup(FTC_Image_Cache cache, FTC_Image_Desc *desc,
-++nsFreeType2::ImageCacheLookup(FTC_ImageCache cache, FTC_ImageType *desc,
-+                               FT_UInt glyphID, FT_Glyph *glyph)
-+ { 
-+   // call the FreeType2 function via the function pointer
-+@@ -297,11 +297,11 @@
-+ } 
-+  
-+ NS_IMETHODIMP
-+-nsFreeType2::ManagerLookupSize(FTC_Manager manager, FTC_Font font,
-+-                               FT_Face *face, FT_Size *size)
-++nsFreeType2::ManagerLookupFace(FTC_Manager manager, FTC_FaceID font,
-++                               FT_Face *face)
-+ { 
-+   // call the FreeType2 function via the function pointer
-+-  FT_Error error = nsFTC_Manager_Lookup_Size(manager, font, face, size);
-++  FT_Error error = nsFTC_Manager_LookupFace(manager, font, face);
-+   return error ? NS_ERROR_FAILURE : NS_OK;
-+ } 
-+  
-+@@ -326,7 +326,7 @@
-+ } 
-+  
-+ NS_IMETHODIMP
-+-nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_Image_Cache *cache)
-++nsFreeType2::ImageCacheNew(FTC_Manager manager, FTC_ImageCache *cache)
-+ { 
-+   // call the FreeType2 function via the function pointer
-+   FT_Error error = nsFTC_Image_Cache_New(manager, cache);
-+@@ -395,7 +395,7 @@
-+ } 
-+  
-+ NS_IMETHODIMP
-+-nsFreeType2::GetImageCache(FTC_Image_Cache *aCache)
-++nsFreeType2::GetImageCache(FTC_ImageCache *aCache)
-+ {
-+   *aCache = mImageCache;
-+   return NS_OK;
-+--- misc/mozilla/gfx/src/freetype/nsFreeType.h	2005-05-01 19:36:19.000000000 +0200
-++++ misc/build/mozilla/gfx/src/freetype/nsFreeType.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -120,13 +120,13 @@
-+ typedef FT_Error (*FT_New_Face_t)(FT_Library, const char*, FT_Long, FT_Face*);
-+ typedef FT_Error (*FT_Set_Charmap_t)(FT_Face face, FT_CharMap  charmap);
-+ typedef FT_Error (*FTC_Image_Cache_Lookup_t)
-+-                      (FTC_Image_Cache, FTC_Image_Desc*, FT_UInt, FT_Glyph*);
-+-typedef FT_Error (*FTC_Manager_Lookup_Size_t)
-+-                      (FTC_Manager, FTC_Font, FT_Face*, FT_Size*);
-++                       (FTC_ImageCache, FTC_ImageType*, FT_UInt, FT_Glyph*);
-++typedef FT_Error (*FTC_Manager_LookupFace_t)
-++                       (FTC_Manager, FTC_FaceID, FT_Face*);
-+ typedef FT_Error (*FTC_Manager_Done_t)(FTC_Manager);
-+ typedef FT_Error (*FTC_Manager_New_t)(FT_Library, FT_UInt, FT_UInt, FT_ULong,
-+                        FTC_Face_Requester, FT_Pointer, FTC_Manager*);
-+-typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_Image_Cache*);
-++typedef FT_Error (*FTC_Image_Cache_New_t)(FTC_Manager, FTC_ImageCache*);
-+ // #ifdef MOZ_SVG
-+ typedef FT_Error (*FT_Glyph_Transform_t)(FT_Glyph, FT_Matrix*, FT_Vector*);
-+ typedef FT_Error (*FT_Get_Kerning_t)
-+@@ -181,7 +181,7 @@
-+   FT_Outline_Decompose_t    nsFT_Outline_Decompose;
-+   FT_Set_Charmap_t          nsFT_Set_Charmap;
-+   FTC_Image_Cache_Lookup_t  nsFTC_Image_Cache_Lookup;
-+-  FTC_Manager_Lookup_Size_t nsFTC_Manager_Lookup_Size;
-++  FTC_Manager_LookupFace_t  nsFTC_Manager_LookupFace;
-+   FTC_Manager_Done_t        nsFTC_Manager_Done;
-+   FTC_Manager_New_t         nsFTC_Manager_New;
-+   FTC_Image_Cache_New_t     nsFTC_Image_Cache_New;
-+@@ -229,7 +229,7 @@
-+   PRLibrary      *mSharedLib;
-+   FT_Library      mFreeTypeLibrary;
-+   FTC_Manager     mFTCacheManager;
-+-  FTC_Image_Cache mImageCache;
-++  FTC_ImageCache  mImageCache;
-+ 
-+   static nsHashtable   *sFontFamilies;
-+   static nsHashtable   *sRange1CharSetNames;
-+--- misc/mozilla/gfx/src/gtk/Makefile.in	2006-07-20 07:12:33.000000000 +0200
-++++ misc/build/mozilla/gfx/src/gtk/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -211,6 +211,10 @@
-+ CXXFLAGS	+= $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
-+ CFLAGS		+= $(MOZ_GTK_CFLAGS) $(MOZ_GTK2_CFLAGS)
-+ 
-++ifeq ($(OS_ARCH), Darwin)
-++EXTRA_DSO_LDOPTS += $(XLDFLAGS) $(XLIBS)
-++endif
-++
-+ ifeq ($(OS_ARCH), SunOS)
-+ ifndef GNU_CC
-+ # When using Sun's WorkShop compiler, including
-+--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.cpp	2006-12-22 14:51:16.000000000 +0100
-++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -1870,10 +1870,10 @@
-+   
-+   mPixelSize = NSToIntRound(app2dev * mFont->size);
-+ 
-+-  mImageDesc.font.face_id    = (void*)mEntry;
-+-  mImageDesc.font.pix_width  = mPixelSize;
-+-  mImageDesc.font.pix_height = mPixelSize;
-+-  mImageDesc.image_type = 0;
-++  mImageDesc->face_id = (FTC_FaceID)&mEntry;
-++  mImageDesc->width  = mPixelSize;
-++  mImageDesc->height = mPixelSize;
-++  mImageDesc->flags = 0;
-+ 
-+   nsresult rv;
-+   mFt2 = do_GetService(NS_FREETYPE2_CONTRACTID, &rv);
-+@@ -1907,7 +1907,7 @@
-+   if (!face)
-+     return 0;
-+ 
-+-  FTC_Image_Cache iCache;
-++  FTC_ImageCache iCache;
-+   nsresult rv = mFt2->GetImageCache(&iCache);
-+   if (NS_FAILED(rv)) {
-+     NS_ERROR("Failed to get Image Cache");
-+@@ -1945,8 +1945,8 @@
-+   
-+   FTC_Manager cManager;
-+   mFt2->GetFTCacheManager(&cManager);
-+-  nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
-+-                                        &face, nsnull);
-++  nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
-++                                        &face);
-+   NS_ASSERTION(rv==0, "failed to get face/size");
-+   if (rv)
-+     return nsnull;
-+@@ -2392,16 +2392,16 @@
-+   mEntry->GetFamilyName(fontName);
-+   mEntry->GetStyleName(styleName);
-+   
-+-  mImageDesc.font.face_id    = (void*)mEntry;
-++  mImageDesc->face_id = (FTC_FaceID)&mEntry;
-+   // TT glyph has no relation to size
-+-  mImageDesc.font.pix_width  = 16;
-+-  mImageDesc.font.pix_height = 16;
-+-  mImageDesc.image_type = 0;
-++  mImageDesc->width  = 16;
-++  mImageDesc->height = 16;
-++  mImageDesc->flags = 0;
-+   FT_Face face = nsnull;
-+   FTC_Manager cManager;
-+   mFt2->GetFTCacheManager(&cManager);
-+-  nsresult rv = mFt2->ManagerLookupSize(cManager, &mImageDesc.font,
-+-                                        &face, nsnull);
-++  nsresult rv = mFt2->ManagerLookupFace(cManager, mImageDesc->face_id,
-++                                        &face);
-+   if (NS_FAILED(rv))
-+     return;
-+  
-+--- misc/mozilla/gfx/src/ps/nsFontMetricsPS.h	2005-06-28 20:29:10.000000000 +0200
-++++ misc/build/mozilla/gfx/src/ps/nsFontMetricsPS.h	2008-08-20 15:42:50.000000000 +0200
-+@@ -424,7 +424,7 @@
-+   nsCOMPtr<nsITrueTypeFontCatalogEntry> mFaceID;
-+   nsCOMPtr<nsIFreeType2> mFt2;
-+   PRUint16        mPixelSize;
-+-  FTC_Image_Desc  mImageDesc;
-++  FTC_ImageType   mImageDesc;
-+   nsCString       mFontNameBase;   // the base name of type 1 (sub) fonts
-+   nscoord         mHeight; 
-+ 
-+@@ -493,7 +493,7 @@
-+ protected:
-+   nsCOMPtr<nsITrueTypeFontCatalogEntry> mEntry;
-+   nsCOMPtr<nsIFreeType2> mFt2;
-+-  FTC_Image_Desc  mImageDesc;
-++  FTC_ImageType   mImageDesc;
-+ };
-+ #endif   // MOZ_ENABLE_FREETYPE2
-+ #endif   // MOZ_ENABLE_XFT
-+--- misc/mozilla/gfx/src/windows/nsDeviceContextWin.cpp	2006-01-29 17:51:00.000000000 +0100
-++++ misc/build/mozilla/gfx/src/windows/nsDeviceContextWin.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -330,7 +330,11 @@
-+     memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
-+   else {
-+     MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
-++#ifdef __MINGW32__
-++      strlen(ptrLogFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
-++#else
-+       strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
-++#endif
-+   }
-+   aFont->name = name;
-+ 
-+@@ -577,7 +581,11 @@
-+   LOGFONT logFont;
-+   logFont.lfCharSet = DEFAULT_CHARSET;
-+   logFont.lfPitchAndFamily = 0;
-++#ifdef __MINGW32__
-++  int outlen = WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aFontName.get()), aFontName.Length() + 1,
-++#else
-+   int outlen = WideCharToMultiByte(CP_ACP, 0, aFontName.get(), aFontName.Length() + 1,
-++#endif
-+                                    logFont.lfFaceName, sizeof(logFont.lfFaceName), nsnull, nsnull);
-+ 
-+   // somehow the WideCharToMultiByte failed, let's try the old code
-+@@ -894,7 +902,11 @@
-+    if(acp)
-+    {
-+       int outlen = ::WideCharToMultiByte( CP_ACP, 0, 
-++#ifdef __MINGW32__
-++                      NS_REINTERPRET_CAST(LPCWSTR, PromiseFlatString(aStr).get()), aStr.Length(),
-++#else
-+                       PromiseFlatString(aStr).get(), aStr.Length(),
-++#endif
-+                       acp, acplen, NULL, NULL);
-+       if ( outlen > 0)
-+          acp[outlen] = '\0';  // null terminate
-+--- misc/mozilla/gfx/src/windows/nsFontMetricsWin.cpp	2007-07-15 16:43:45.000000000 +0200
-++++ misc/build/mozilla/gfx/src/windows/nsFontMetricsWin.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -1363,7 +1363,11 @@
-+     PRUnichar fname[LF_FACESIZE];
-+     fname[0] = 0;
-+     MultiByteToWideChar(CP_ACP, 0, aFontName,
-++#ifdef __MINGW32__
-++    strlen(aFontName) + 1, NS_REINTERPRET_CAST(LPWSTR, fname), sizeof(fname)/sizeof(fname[0]));
-++#else
-+     strlen(aFontName) + 1, fname, sizeof(fname)/sizeof(fname[0]));
-++#endif
-+     name.Assign(NS_LITERAL_CSTRING("encoding.") + NS_ConvertUCS2toUTF8(fname) + NS_LITERAL_CSTRING(".ttf"));
-+   }
-+ 
-+@@ -2236,7 +2240,11 @@
-+     }
-+     // get the final rightBearing and width. Possible kerning is taken into account.
-+     SIZE size;
-++#ifdef __MIGW32__
-++    ::GetTextExtentPointW(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-++#else
-+     ::GetTextExtentPointW(aDC, aString, aLength, &size);
-++#endif
-+     size.cx -= aOverhangCorrection;
-+     aBoundingMetrics.width = size.cx;
-+     aBoundingMetrics.rightBearing = size.cx - gm.gmCellIncX + gm.gmptGlyphOrigin.x + gm.gmBlackBoxX;
-+@@ -2630,7 +2638,11 @@
-+   PRUnichar name[LF_FACESIZE];
-+   name[0] = 0;
-+   MultiByteToWideChar(CP_ACP, 0, logFont->lfFaceName,
-++#ifdef __MINGW32__
-++    strlen(logFont->lfFaceName) + 1, NS_REINTERPRET_CAST(LPWSTR, name), sizeof(name)/sizeof(name[0]));
-++#else
-+     strlen(logFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
-++#endif
-+ 
-+   nsGlobalFont* font = new nsGlobalFont;
-+   if (!font) {
-+@@ -4286,14 +4298,22 @@
-+ 
-+ static PRBool
-+ NS_ExtTextOutW(HDC aDC, nsFontWin* aFont, PRInt32 aX, PRInt32 aY, UINT uOptions,
-++#ifdef __MINGW32__
-++  LPCRECT lprc, const PRUnichar* aString, UINT aLength, INT *lpDx)
-++#else
-+   LPCRECT lprc, LPCWSTR aString, UINT aLength, INT *lpDx)
-++#endif
-+ {
-+   RECT clipRect;
-+   if (!lpDx && !lprc && aFont->FillClipRect(aX, aY, aLength, uOptions, clipRect)) {
-+     lprc = &clipRect;
-+     uOptions |= ETO_CLIPPED;
-+   }
-++#ifdef __MINGW32__
-++  return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, lpDx);
-++#else
-+   return ::ExtTextOutW(aDC, aX, aY, uOptions, lprc, aString, aLength, lpDx);
-++#endif
-+ }
-+ 
-+ void
-+@@ -4359,7 +4379,11 @@
-+ {
-+   DEBUG_VERIFY_FONT_HASGLYPH(this, aString, aLength);
-+   SIZE size;
-++#ifdef __MINGW32__
-++  ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-++#else
-+   ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
-++#endif
-+   size.cx -= mOverhangCorrection;
-+   return size.cx;
-+ }
-+@@ -4385,7 +4409,11 @@
-+       // Clip out the extra underline/strikethru caused by the
-+       // bug in WIN95.
-+       SIZE size;
-++#ifdef __MINGW32__
-++      ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength, &size);
-++#else
-+       ::GetTextExtentPoint32W(aDC, aString, aLength, &size);
-++#endif
-+       size.cx -= mOverhangCorrection;
-+       RECT clipRect;
-+       clipRect.top = aY - size.cy;
-+@@ -4466,7 +4494,11 @@
-+   if (!mIsWide)
-+     ::GetTextExtentPoint32A(aDC, buffer.get(), destLength, &size);
-+   else
-++#ifdef __MINGW32__
-++    ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), destLength / 2, &size);
-++#else
-+     ::GetTextExtentPoint32W(aDC, (const PRUnichar*) buffer.get(), destLength / 2, &size);
-++#endif
-+   size.cx -= mOverhangCorrection;
-+ 
-+   return size.cx;
-+@@ -4649,7 +4681,11 @@
-+   if (NS_FAILED(rv) || !aLength) return 0;
-+ 
-+   SIZE size;
-++#ifdef __MINGW32__
-++  ::GetTextExtentPoint32W(aDC, NS_REINTERPRET_CAST(LPCWSTR, buffer.get()), aLength, &size);
-++#else
-+   ::GetTextExtentPoint32W(aDC, buffer.get(), aLength, &size);
-++#endif
-+   size.cx -= mOverhangCorrection;
-+ 
-+   return size.cx;
-+@@ -4828,13 +4864,21 @@
-+ {
-+   *aResultLength = 0;
-+   // Get the number of bytes needed for the conversion
-++#ifdef __MINGW32__
-++  int nb = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
-++#else
-+   int nb = WideCharToMultiByte(mCodePage, 0, aString, aLength,
-++#endif
-+                                nsnull, 0, nsnull, nsnull);
-+ 
-+   if (!nb || !aResult.EnsureElemCapacity(nb)) return;
-+   char* buf = aResult.get();
-+   // Convert the Unicode string to ANSI
-++#ifdef __MINGW32__
-++  *aResultLength = WideCharToMultiByte(mCodePage, 0, NS_REINTERPRET_CAST(LPCWSTR, aString), aLength,
-++#else
-+   *aResultLength = WideCharToMultiByte(mCodePage, 0, aString, aLength,
-++#endif
-+                                        buf, nb, nsnull, nsnull);
-+ }
-+ 
-+--- misc/mozilla/gfx/src/windows/nsRenderingContextWin.cpp	2006-06-30 01:18:35.000000000 +0200
-++++ misc/build/mozilla/gfx/src/windows/nsRenderingContextWin.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -2935,17 +2935,29 @@
-+ 
-+     GCP_RESULTSW gcpResult;
-+     gcpResult.lStructSize = sizeof(GCP_RESULTS);
-++#ifdef __MINGW32__
-++    gcpResult.lpOutString = NS_REINTERPRET_CAST(LPWSTR, outStr);     // Output string
-++#else
-+     gcpResult.lpOutString = outStr;     // Output string
-++#endif
-+     gcpResult.lpOrder = nsnull;         // Ordering indices
-+     gcpResult.lpDx = distanceArray;     // Distances between character cells
-+     gcpResult.lpCaretPos = nsnull;      // Caret positions
-+     gcpResult.lpClass = nsnull;         // Character classifications
-++#ifdef __MINGW32__
-++    gcpResult.lpGlyphs = NS_REINTERPRET_CAST(LPWSTR, glyphArray);    // Character glyphs
-++#else
-+     gcpResult.lpGlyphs = glyphArray;    // Character glyphs
-++#endif
-+     gcpResult.nGlyphs = 2;              // Array size
-+ 
-+     PRUnichar inStr[] = {araAin, one};
-+ 
-++#ifdef __MINGW32__
-++    if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER) 
-++#else
-+     if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER) 
-++#endif
-+         && (inStr[0] == outStr[1]) ) {
-+       gBidiInfo = GCP_REORDER | GCP_GLYPHSHAPE;
-+ #ifdef NS_DEBUG
-+@@ -2956,7 +2968,11 @@
-+       const PRUnichar hebAlef = 0x05D0;
-+       inStr[0] = hebAlef;
-+       inStr[1] = one;
-++#ifdef __MINGW32__
-++      if (::GetCharacterPlacementW(mDC, NS_REINTERPRET_CAST(LPCWSTR, inStr), 2, 0, &gcpResult, GCP_REORDER) 
-++#else
-+       if (::GetCharacterPlacementW(mDC, inStr, 2, 0, &gcpResult, GCP_REORDER) 
-++#endif
-+           && (inStr[0] == outStr[1]) ) {
-+         gBidiInfo = GCP_REORDER;
-+ #ifdef NS_DEBUG
-+--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.cpp	2004-04-17 23:52:34.000000000 +0200
-++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -177,7 +177,7 @@
-+   FTC_Manager mgr;
-+   nsresult rv;
-+   mFt2->GetFTCacheManager(&mgr);
-+-  rv = mFt2->ManagerLookupSize(mgr, &mImageDesc.font, &face, nsnull);
-++  rv = mFt2->ManagerLookupFace(mgr, mImageDesc->face_id, &face);
-+   NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get face/size");
-+   if (NS_FAILED(rv))
-+     return nsnull;
-+@@ -191,22 +191,15 @@
-+   PRBool embedded_bimap = PR_FALSE;
-+   mFaceID = aFaceID;
-+   mPixelSize = aPixelSize;
-+-  mImageDesc.font.face_id    = (void*)mFaceID;
-+-  mImageDesc.font.pix_width  = aPixelSize;
-+-  mImageDesc.font.pix_height = aPixelSize;
-+-  mImageDesc.image_type = 0;
-++  mImageDesc->face_id = (FTC_FaceID)&mFaceID;
-++  mImageDesc->width  = aPixelSize;
-++  mImageDesc->height = aPixelSize;
-++  mImageDesc->flags = 0;
-+ 
-+   if (aPixelSize < nsFreeType2::gAntiAliasMinimum) {
-+-    mImageDesc.image_type |= ftc_image_mono;
-+     anti_alias = PR_FALSE;
-+   }
-+ 
-+-  if (nsFreeType2::gFreeType2Autohinted)
-+-    mImageDesc.image_type |= ftc_image_flag_autohinted;
-+-
-+-  if (nsFreeType2::gFreeType2Unhinted)
-+-    mImageDesc.image_type |= ftc_image_flag_unhinted;
-+-
-+   PRUint32  num_embedded_bitmaps, i;
-+   PRInt32*  embedded_bitmapheights;
-+   mFaceID->GetEmbeddedBitmapHeights(&num_embedded_bitmaps,
-+@@ -218,7 +211,6 @@
-+         if (embedded_bitmapheights[i] == aPixelSize) {
-+           embedded_bimap = PR_TRUE;
-+           // unhinted must be set for embedded bitmaps to be used
-+-          mImageDesc.image_type |= ftc_image_flag_unhinted;
-+           break;
-+         }
-+       }
-+@@ -312,7 +304,7 @@
-+   if (!face)
-+     return NS_ERROR_FAILURE;
-+ 
-+-  FTC_Image_Cache icache;
-++  FTC_ImageCache icache;
-+   mFt2->GetImageCache(&icache);
-+   if (!icache)
-+     return NS_ERROR_FAILURE;
-+@@ -401,7 +393,7 @@
-+   if (!face)
-+     return 0;
-+ 
-+-  FTC_Image_Cache icache;
-++  FTC_ImageCache icache;
-+   mFt2->GetImageCache(&icache);
-+   if (!icache)
-+     return 0;
-+@@ -723,7 +715,7 @@
-+     if (y%4==0) (*blendPixelFunc)(sub_image, y, ascent-1, black, 255/2);
-+ #endif
-+ 
-+-  FTC_Image_Cache icache;
-++  FTC_ImageCache icache;
-+   mFt2->GetImageCache(&icache);
-+   if (!icache)
-+     return 0;
-+--- misc/mozilla/gfx/src/x11shared/nsFontFreeType.h	2004-04-17 23:52:34.000000000 +0200
-++++ misc/build/mozilla/gfx/src/x11shared/nsFontFreeType.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -110,7 +110,7 @@
-+   XImage *GetXImage(PRUint32 width, PRUint32 height);
-+   nsITrueTypeFontCatalogEntry *mFaceID;
-+   PRUint16        mPixelSize;
-+-  FTC_Image_Desc  mImageDesc;
-++  FTC_ImageType   mImageDesc;
-+   nsCOMPtr<nsIFreeType2> mFt2;
-+ };
-+ 
-+--- misc/mozilla/jpeg/jmorecfg.h	2004-12-12 01:57:39.000000000 +0100
-++++ misc/build/mozilla/jpeg/jmorecfg.h	2008-08-18 09:06:05.000000000 +0200
-+@@ -108,7 +108,7 @@
-+ /* Defines for MMX/SSE2 support. */
-+ 
-+ #if defined(XP_WIN32) && defined(_M_IX86) && !defined(__GNUC__)
-+-#define HAVE_MMX_INTEL_MNEMONICS 
-++//#define HAVE_MMX_INTEL_MNEMONICS 
-+ 
-+ /* SSE2 code appears broken for some cpus (bug 247437) */
-+ /* #define HAVE_SSE2_INTEL_MNEMONICS */
-+--- misc/mozilla/js/src/xpconnect/src/Makefile.in	2006-01-31 02:57:35.000000000 +0100
-++++ misc/build/mozilla/js/src/xpconnect/src/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -163,4 +163,3 @@
-+ endif
-+ endif
-+ endif
-+-
-+--- misc/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp	2006-03-16 18:09:14.000000000 +0100
-++++ misc/build/mozilla/layout/svg/renderer/src/libart/nsSVGLibartGlyphMetricsFT.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -423,19 +423,19 @@
-+     return;
-+   }
-+ 
-+-  FTC_Image_Desc imageDesc;
-+-  imageDesc.font.face_id=(void*)font_data.font_entry.get(); // XXX do we need to addref?
-++  FTC_ImageType imageDesc;
-++  imageDesc->face_id=(FTC_FaceID)font_data.font_entry.get(); // XXX do we need to addref?
-+   float twipstopixel = GetTwipsToPixels();
-+   float scale = GetPixelScale();
-+-  imageDesc.font.pix_width = (int)((float)(font_data.font.size)*twipstopixel/scale);
-+-  imageDesc.font.pix_height = (int)((float)(font_data.font.size)*twipstopixel/scale);
-+-  imageDesc.image_type |= ftc_image_grays;
-++  imageDesc->width = (int)((float)(font_data.font.size)*twipstopixel/scale);
-++  imageDesc->height = (int)((float)(font_data.font.size)*twipstopixel/scale);
-++  imageDesc->flags |= /* ftc_image_grays */0;
-+ 
-+   // get the face
-+   nsresult rv;
-+   FTC_Manager mgr;
-+   nsSVGLibartFreetype::ft2->GetFTCacheManager(&mgr);
-+-  rv = nsSVGLibartFreetype::ft2->ManagerLookupSize(mgr, &imageDesc.font, &mFace, nsnull);
-++  rv = nsSVGLibartFreetype::ft2->ManagerLookupFace(mgr, imageDesc->face_id, &mFace);
-+   NS_ASSERTION(mFace, "failed to get face/size");
-+ }
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/Makefile.in	2007-05-03 03:39:37.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/Makefile.in	2008-10-16 12:59:35.000000000 +0200
-+@@ -106,6 +106,7 @@
-+                 nsVCard.cpp \
-+                 nsVCardObj.cpp \
-+                 nsMsgVCardService.cpp \
-++		nsAbMD5sum.cpp	\
-+                 nsAbLDIFService.cpp \
-+ 		$(NULL)
-+ 
-+@@ -114,7 +115,9 @@
-+ 		nsDirPrefs.h \
-+ 		nsAbCardProperty.h \
-+ 		nsAbMDBCardProperty.h \
-+-                nsVCardObj.h \
-++		nsVCardObj.h \
-++		nsAbAddressCollecter.h \
-++		nsAbDirectoryQuery.h \
-+ 		$(NULL)
-+ 
-+ ifeq ($(OS_ARCH),WINNT)
-+--- misc/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h	2005-05-11 06:16:53.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbBoolExprToLDAPFilter.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -43,6 +43,7 @@
-+ #include "nsIAbBooleanExpression.h"
-+ #include "nsCOMPtr.h"
-+ #include "nsString.h"
-++#include "nsAbUtils.h"
-+ 
-+ class nsIAbLDAPAttributeMap;
-+ 
-+@@ -74,6 +75,16 @@
-+         nsIAbBooleanConditionString* condition,
-+         nsCString& filter,
-+         int flags);
-++    static void GenerateMultipleFilter(
-++       nsAbBooleanConditionType conditionType,
-++       nsCString& filter,
-++       NS_ConvertUCS2toUTF8 &vUTF8,
-++       CharPtrArrayGuard *pAttrs);
-++    static void GenerateSingleFilter(
-++       nsAbBooleanConditionType conditionType,
-++       nsCString& filter,
-++       NS_ConvertUCS2toUTF8 &vUTF8,
-++       const char *ldapProperty);
-+ };
-+ 
-+ #endif
-+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp	2007-02-18 23:18:13.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectory.cpp	2008-08-20 12:16:50.000000000 +0200
-+@@ -126,11 +126,13 @@
-+ 
-+     // use mURINoQuery to get a prefName
-+     nsCAutoString prefName;
-+-    prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen) + NS_LITERAL_CSTRING(".uri");
-++    prefName = nsDependentCString(mURINoQuery.get() + kLDAPDirectoryRootLen);
-+ 
-+     // turn moz-abldapdirectory://ldap_2.servers.nscpphonebook into -> "ldap_2.servers.nscpphonebook.uri"
-+     nsXPIDLCString URI;
-+-    rv = prefs->GetCharPref(prefName.get(), getter_Copies(URI));
-++    nsCAutoString uriPrefName;
-++    uriPrefName = prefName + NS_LITERAL_CSTRING(".uri");
-++    rv = prefs->GetCharPref(uriPrefName.get(), getter_Copies(URI));
-+     if (NS_FAILED(rv))
-+     {
-+         /*
-+@@ -154,6 +156,27 @@
-+         nsCAutoString tempLDAPURL(mURINoQuery);
-+         tempLDAPURL.ReplaceSubstring("moz-abldapdirectory:", "ldap:");
-+         rv = mURL->SetSpec(tempLDAPURL);
-++		NS_ENSURE_SUCCESS(rv,rv);
-++    
-++        nsCAutoString aHost;
-++        mURL->GetHost(aHost);
-++        aHost.ReplaceChar('.','_');
-++        prefName = nsDependentCString("ldap_2.servers.") + aHost;
-++        PRBool useSSL=0;
-++        rv = prefs->GetBoolPref(
-++                PromiseFlatCString(prefName
-++                + NS_LITERAL_CSTRING(".UseSSL")).get(),
-++                &useSSL
-++            );
-++        
-++        // If use SSL,ldap url will look like this ldaps://host:port/.....
-++        if (!NS_FAILED(rv) && useSSL)
-++        {
-++            tempLDAPURL.ReplaceSubstring("ldap:", "ldaps:"); 
-++            rv = mURL->SetSpec(tempLDAPURL);
-++        }
-++        //NS_FAILED(rv) means ldap_2.servers.nscpphonebook.UseSSL not exist
-++        rv = 0;
-+     }
-+     else
-+     {
-+@@ -164,24 +187,29 @@
-+     // get the login information, if there is any 
-+     //
-+     rv = prefs->GetCharPref(
-+-        PromiseFlatCString(
-+-            Substring(mURINoQuery, kLDAPDirectoryRootLen,
-+-                      mURINoQuery.Length() - kLDAPDirectoryRootLen)
-++        PromiseFlatCString(prefName
-+             + NS_LITERAL_CSTRING(".auth.dn")).get(),
-+         getter_Copies(mLogin));
-+     if (NS_FAILED(rv)) {
-+         mLogin.Truncate();  // zero out mLogin
-+     }
-+ 
-++    // get the password information, if there is any 
-++    //
-++    rv = prefs->GetCharPref(
-++        PromiseFlatCString(prefName
-++            + NS_LITERAL_CSTRING(".auth.pwd")).get(),
-++        getter_Copies(mPassword));
-++    if (NS_FAILED(rv)) {
-++        mPassword.Truncate();  // zero out mLogin
-++    }
-+     // get the protocol version, if there is any.  using a string pref
-+     // here instead of an int, as protocol versions sometimes have names like
-+     // "4bis".
-+     //
-+     nsXPIDLCString protocolVersion;
-+     rv = prefs->GetCharPref(
-+-        PromiseFlatCString(
-+-            Substring(mURINoQuery, kLDAPDirectoryRootLen,
-+-                      mURINoQuery.Length() - kLDAPDirectoryRootLen)
-++        PromiseFlatCString(prefName
-+             + NS_LITERAL_CSTRING(".protocolVersion")).get(),
-+         getter_Copies(protocolVersion));
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp	2006-12-22 14:51:38.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp	2008-08-20 15:01:16.000000000 +0200
-+@@ -74,7 +74,7 @@
-+         PRInt32 resultLimit = -1,
-+         PRInt32 timeOut = 0);
-+     virtual ~nsAbQueryLDAPMessageListener ();
-+-
-++    void SetPassword(const nsAString& aPassword){m_sPassword = aPassword;};
-+ protected:
-+     nsresult OnLDAPMessageBind (nsILDAPMessage *aMessage);
-+     nsresult OnLDAPMessageSearchEntry (nsILDAPMessage *aMessage,
-+@@ -108,6 +108,8 @@
-+     PRBool mCanceled;
-+     PRBool mWaitingForPrevQueryToFinish;
-+ 
-++    nsAutoString m_sPassword;
-++
-+     nsCOMPtr<nsILDAPOperation> mSearchOperation;
-+ 
-+     PRLock* mLock;
-+@@ -272,7 +274,7 @@
-+ 
-+     // If mLogin is set, we're expected to use it to get a password.
-+     //
-+-    if (!mDirectoryQuery->mLogin.IsEmpty()) {
-++    if (!mDirectoryQuery->mLogin.IsEmpty() && !m_sPassword.Length()) {
-+ // XXX hack until nsUTF8AutoString exists
-+ #define nsUTF8AutoString nsCAutoString
-+         nsUTF8AutoString spec;
-+@@ -415,10 +417,13 @@
-+     rv = ldapOperation->Init(mConnection, proxyListener, nsnull);
-+     NS_ENSURE_SUCCESS(rv, rv);
-+ 
-+-    // Bind
-+-    rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
-++	
-++	// Bind
-++    if (m_sPassword.Length())
-++		rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(m_sPassword));
-++	else
-++	    rv = ldapOperation->SimpleBind(NS_ConvertUCS2toUTF8(passwd));
-+     NS_ENSURE_SUCCESS(rv, rv);
-+-
-+     return rv;
-+ }
-+ 
-+@@ -707,7 +712,7 @@
-+     rv = getLdapReturnAttributes (arguments, returnAttributes);
-+     NS_ENSURE_SUCCESS(rv, rv);
-+ 
-+-
-++    
-+     // Get the filter
-+     nsCOMPtr<nsISupports> supportsExpression;
-+     rv = arguments->GetExpression (getter_AddRefs (supportsExpression));
-+@@ -828,6 +833,10 @@
-+       if (msgListener)
-+       {
-+         msgListener->mUrl = url;
-++        msgListener->mQueryListener = listener;
-++        msgListener->mResultLimit = resultLimit;
-++        msgListener->mTimeOut = timeOut;
-++        msgListener->mQueryArguments = arguments;
-+         return msgListener->DoSearch();
-+       }
-+     }
-+@@ -845,6 +854,11 @@
-+                 timeOut);
-+     if (_messageListener == NULL)
-+             return NS_ERROR_OUT_OF_MEMORY;
-++
-++    nsAutoString wPassword;
-++    wPassword.AssignWithConversion(mPassword.get());
-++    _messageListener->SetPassword(wPassword);
-++
-+     mListener = _messageListener;
-+     *_retval = 1;
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h	2004-07-24 21:50:29.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -72,6 +72,7 @@
-+     friend class nsAbQueryLDAPMessageListener;
-+     nsresult Initiate ();
-+     nsXPIDLCString mLogin; // authenticate to the LDAP server as...
-++    nsXPIDLCString mPassword; // password to the LDAP server as...
-+     nsCOMPtr<nsILDAPURL> mDirectoryUrl; // the URL for the server
-+     PRUint32 mProtocolVersion; // version of LDAP (see nsILDAPConnection.idl)
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp	2008-08-14 16:30:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMD5sum.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -1 +1,633 @@
-+-dummy
-++/*
-++ * The contents of this file are subject to the Mozilla Public
-++ * License Version 1.1 (the "License"); you may not use this file
-++ * except in compliance with the License. You may obtain a copy of
-++ * the License at http://www.mozilla.org/MPL/
-++ * 
-++ * Software distributed under the License is distributed on an "AS
-++ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-++ * implied. See the License for the specific language governing
-++ * rights and limitations under the License.
-++ * 
-++ * The Original Code is the Netscape security libraries.
-++ * 
-++ * The Initial Developer of the Original Code is Netscape
-++ * Communications Corporation.	Portions created by Netscape are 
-++ * Copyright (C) 1994-2000 Netscape Communications Corporation.  All
-++ * Rights Reserved.
-++ * 
-++ * Contributor(s):
-++ * 
-++ * Alternatively, the contents of this file may be used under the
-++ * terms of the GNU General Public License Version 2 or later (the
-++ * "GPL"), in which case the provisions of the GPL are applicable 
-++ * instead of those above.	If you wish to allow use of your 
-++ * version of this file only under the terms of the GPL and not to
-++ * allow others to use your version of this file under the MPL,
-++ * indicate your decision by deleting the provisions above and
-++ * replace them with the notice and other provisions required by
-++ * the GPL.  If you do not delete the provisions above, a recipient
-++ * may use your version of this file under either the MPL or the
-++ * GPL.
-++ */
-++#include <stdio.h>
-++#include <stdlib.h>
-++
-++#include "prerr.h"
-++
-++#include "prtypes.h"
-++#include "prlong.h"
-++#include "plstr.h"
-++#include "nsMemory.h"
-++
-++#define MD5_HASH_LEN 16
-++#define MD5_BUFFER_SIZE 64
-++#define MD5_END_BUFFER (MD5_BUFFER_SIZE - 8)
-++
-++#define CV0_1 0x67452301
-++#define CV0_2 0xefcdab89
-++#define CV0_3 0x98badcfe
-++#define CV0_4 0x10325476
-++
-++#define T1_0  0xd76aa478
-++#define T1_1  0xe8c7b756
-++#define T1_2  0x242070db
-++#define T1_3  0xc1bdceee
-++#define T1_4  0xf57c0faf
-++#define T1_5  0x4787c62a
-++#define T1_6  0xa8304613
-++#define T1_7  0xfd469501
-++#define T1_8  0x698098d8
-++#define T1_9  0x8b44f7af
-++#define T1_10 0xffff5bb1
-++#define T1_11 0x895cd7be
-++#define T1_12 0x6b901122
-++#define T1_13 0xfd987193
-++#define T1_14 0xa679438e
-++#define T1_15 0x49b40821
-++
-++#define T2_0  0xf61e2562
-++#define T2_1  0xc040b340
-++#define T2_2  0x265e5a51
-++#define T2_3  0xe9b6c7aa
-++#define T2_4  0xd62f105d
-++#define T2_5  0x02441453
-++#define T2_6  0xd8a1e681
-++#define T2_7  0xe7d3fbc8
-++#define T2_8  0x21e1cde6
-++#define T2_9  0xc33707d6
-++#define T2_10 0xf4d50d87
-++#define T2_11 0x455a14ed
-++#define T2_12 0xa9e3e905
-++#define T2_13 0xfcefa3f8
-++#define T2_14 0x676f02d9
-++#define T2_15 0x8d2a4c8a
-++
-++#define T3_0  0xfffa3942
-++#define T3_1  0x8771f681
-++#define T3_2  0x6d9d6122
-++#define T3_3  0xfde5380c
-++#define T3_4  0xa4beea44
-++#define T3_5  0x4bdecfa9
-++#define T3_6  0xf6bb4b60
-++#define T3_7  0xbebfbc70
-++#define T3_8  0x289b7ec6
-++#define T3_9  0xeaa127fa
-++#define T3_10 0xd4ef3085
-++#define T3_11 0x04881d05
-++#define T3_12 0xd9d4d039
-++#define T3_13 0xe6db99e5
-++#define T3_14 0x1fa27cf8
-++#define T3_15 0xc4ac5665
-++
-++#define T4_0  0xf4292244
-++#define T4_1  0x432aff97
-++#define T4_2  0xab9423a7
-++#define T4_3  0xfc93a039
-++#define T4_4  0x655b59c3
-++#define T4_5  0x8f0ccc92
-++#define T4_6  0xffeff47d
-++#define T4_7  0x85845dd1
-++#define T4_8  0x6fa87e4f
-++#define T4_9  0xfe2ce6e0
-++#define T4_10 0xa3014314
-++#define T4_11 0x4e0811a1
-++#define T4_12 0xf7537e82
-++#define T4_13 0xbd3af235
-++#define T4_14 0x2ad7d2bb
-++#define T4_15 0xeb86d391
-++
-++#define R1B0  0
-++#define R1B1  1
-++#define R1B2  2
-++#define R1B3  3
-++#define R1B4  4
-++#define R1B5  5
-++#define R1B6  6
-++#define R1B7  7
-++#define R1B8  8
-++#define R1B9  9
-++#define R1B10 10
-++#define R1B11 11
-++#define R1B12 12
-++#define R1B13 13
-++#define R1B14 14
-++#define R1B15 15
-++
-++#define R2B0  1
-++#define R2B1  6
-++#define R2B2  11
-++#define R2B3  0
-++#define R2B4  5
-++#define R2B5  10
-++#define R2B6  15
-++#define R2B7  4
-++#define R2B8  9
-++#define R2B9  14
-++#define R2B10 3 
-++#define R2B11 8 
-++#define R2B12 13
-++#define R2B13 2 
-++#define R2B14 7 
-++#define R2B15 12
-++
-++#define R3B0  5
-++#define R3B1  8
-++#define R3B2  11
-++#define R3B3  14
-++#define R3B4  1
-++#define R3B5  4
-++#define R3B6  7
-++#define R3B7  10
-++#define R3B8  13
-++#define R3B9  0
-++#define R3B10 3 
-++#define R3B11 6 
-++#define R3B12 9 
-++#define R3B13 12
-++#define R3B14 15
-++#define R3B15 2 
-++
-++#define R4B0  0
-++#define R4B1  7
-++#define R4B2  14
-++#define R4B3  5
-++#define R4B4  12
-++#define R4B5  3
-++#define R4B6  10
-++#define R4B7  1
-++#define R4B8  8
-++#define R4B9  15
-++#define R4B10 6 
-++#define R4B11 13
-++#define R4B12 4 
-++#define R4B13 11
-++#define R4B14 2 
-++#define R4B15 9 
-++
-++#define S1_0 7
-++#define S1_1 12
-++#define S1_2 17
-++#define S1_3 22
-++
-++#define S2_0 5
-++#define S2_1 9
-++#define S2_2 14
-++#define S2_3 20
-++
-++#define S3_0 4
-++#define S3_1 11
-++#define S3_2 16
-++#define S3_3 23
-++
-++#define S4_0 6
-++#define S4_1 10
-++#define S4_2 15
-++#define S4_3 21
-++
-++struct MD5ContextStr {
-++	PRUint32      lsbInput;
-++	PRUint32      msbInput;
-++	PRUint32      cv[4];
-++	union {
-++		PRUint8 b[64];
-++		PRUint32 w[16];
-++	} u;
-++};
-++typedef struct MD5ContextStr        MD5Context;
-++
-++#define inBuf u.b
-++
-++int MD5_Hash(unsigned char *dest, const char *src);
-++int MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length);
-++MD5Context * MD5_NewContext(void);
-++void MD5_DestroyContext(MD5Context *cx, PRBool freeit);
-++void MD5_Begin(MD5Context *cx);
-++static void md5_compress(MD5Context *cx);
-++void MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen);
-++void MD5_End(MD5Context *cx, unsigned char *digest,
-++        unsigned int *digestLen, unsigned int maxDigestLen);
-++unsigned int MD5_FlattenSize(MD5Context *cx);
-++int MD5_Flatten(MD5Context *cx, unsigned char *space);
-++MD5Context * MD5_Resurrect(unsigned char *space, void *arg);
-++void MD5_TraceState(MD5Context *cx);
-++
-++int 
-++MD5_Hash(unsigned char *dest, const char *src)
-++{
-++	return MD5_HashBuf(dest, (unsigned char *)src, PL_strlen(src));
-++}
-++
-++int 
-++MD5_HashBuf(unsigned char *dest, const unsigned char *src, uint32 src_length)
-++{
-++	unsigned int len;
-++	MD5Context *cx = MD5_NewContext();
-++	if (cx == NULL) {
-++//		PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-++		return -1;
-++	}
-++	MD5_Begin(cx);
-++	MD5_Update(cx, src, src_length);
-++	MD5_End(cx, dest, &len, MD5_HASH_LEN);
-++	MD5_DestroyContext(cx, PR_TRUE);
-++	return 0;
-++}
-++
-++MD5Context *
-++MD5_NewContext(void)
-++{
-++	MD5Context *cx = (MD5Context *)malloc(sizeof(MD5Context));
-++	if (cx == NULL) {
-++//		PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-++		return NULL;
-++	}
-++	return cx;
-++}
-++
-++void 
-++MD5_DestroyContext(MD5Context *cx, PRBool freeit)
-++{
-++	if (freeit) {
-++		free(cx);
-++	}
-++}
-++
-++void 
-++MD5_Begin(MD5Context *cx)
-++{
-++	cx->lsbInput = 0;
-++	cx->msbInput = 0;
-++	memset(cx->inBuf, 0, sizeof(cx->inBuf));
-++	cx->cv[0] = CV0_1;
-++	cx->cv[1] = CV0_2;
-++	cx->cv[2] = CV0_3;
-++	cx->cv[3] = CV0_4;
-++}
-++
-++#define cls(i32, s) (tmp = i32, tmp << s | tmp >> (32 - s))
-++
-++#define MASK 0x00ff00ff
-++#ifdef IS_LITTLE_ENDIAN
-++#define lendian(i32) \
-++	(i32)
-++#else
-++#define lendian(i32) \
-++	(tmp = i32 >> 16 | i32 << 16, (tmp & MASK) << 8 | tmp >> 8 & MASK)
-++#endif
-++
-++#if defined(SOLARIS) || defined(HPUX)
-++#define addto64(sumhigh, sumlow, addend) \
-++	sumlow += addend; sumhigh += (sumlow < addend);
-++#else
-++#define addto64(sumhigh, sumlow, addend) \
-++	sumlow += addend; if (sumlow < addend) ++sumhigh;
-++#endif
-++
-++#define F(X, Y, Z) \
-++	((X & Y) | ((~X) & Z))
-++
-++#define G(X, Y, Z) \
-++	((X & Z) | (Y & (~Z)))
-++
-++#define H(X, Y, Z) \
-++	(X ^ Y ^ Z)
-++
-++#define I(X, Y, Z) \
-++	(Y ^ (X | (~Z)))
-++
-++#define FF(a, b, c, d, bufint, s, ti) \
-++	a = b + cls(a + F(b, c, d) + bufint + ti, s)
-++
-++#define GG(a, b, c, d, bufint, s, ti) \
-++	a = b + cls(a + G(b, c, d) + bufint + ti, s)
-++
-++#define HH(a, b, c, d, bufint, s, ti) \
-++	a = b + cls(a + H(b, c, d) + bufint + ti, s)
-++
-++#define II(a, b, c, d, bufint, s, ti) \
-++	a = b + cls(a + I(b, c, d) + bufint + ti, s)
-++
-++static void
-++md5_compress(MD5Context *cx)
-++{
-++	PRUint32 a, b, c, d;
-++	PRUint32 tmp;
-++	a = cx->cv[0];
-++	b = cx->cv[1];
-++	c = cx->cv[2];
-++	d = cx->cv[3];
-++#ifndef IS_LITTLE_ENDIAN
-++	cx->u.w[0] = lendian(cx->u.w[0]);
-++	cx->u.w[1] = lendian(cx->u.w[1]);
-++	cx->u.w[2] = lendian(cx->u.w[2]);
-++	cx->u.w[3] = lendian(cx->u.w[3]);
-++	cx->u.w[4] = lendian(cx->u.w[4]);
-++	cx->u.w[5] = lendian(cx->u.w[5]);
-++	cx->u.w[6] = lendian(cx->u.w[6]);
-++	cx->u.w[7] = lendian(cx->u.w[7]);
-++	cx->u.w[8] = lendian(cx->u.w[8]);
-++	cx->u.w[9] = lendian(cx->u.w[9]);
-++	cx->u.w[10] = lendian(cx->u.w[10]);
-++	cx->u.w[11] = lendian(cx->u.w[11]);
-++	cx->u.w[12] = lendian(cx->u.w[12]);
-++	cx->u.w[13] = lendian(cx->u.w[13]);
-++	cx->u.w[14] = lendian(cx->u.w[14]);
-++	cx->u.w[15] = lendian(cx->u.w[15]);
-++#endif
-++	FF(a, b, c, d, cx->u.w[R1B0 ], S1_0, T1_0);
-++	FF(d, a, b, c, cx->u.w[R1B1 ], S1_1, T1_1);
-++	FF(c, d, a, b, cx->u.w[R1B2 ], S1_2, T1_2);
-++	FF(b, c, d, a, cx->u.w[R1B3 ], S1_3, T1_3);
-++	FF(a, b, c, d, cx->u.w[R1B4 ], S1_0, T1_4);
-++	FF(d, a, b, c, cx->u.w[R1B5 ], S1_1, T1_5);
-++	FF(c, d, a, b, cx->u.w[R1B6 ], S1_2, T1_6);
-++	FF(b, c, d, a, cx->u.w[R1B7 ], S1_3, T1_7);
-++	FF(a, b, c, d, cx->u.w[R1B8 ], S1_0, T1_8);
-++	FF(d, a, b, c, cx->u.w[R1B9 ], S1_1, T1_9);
-++	FF(c, d, a, b, cx->u.w[R1B10], S1_2, T1_10);
-++	FF(b, c, d, a, cx->u.w[R1B11], S1_3, T1_11);
-++	FF(a, b, c, d, cx->u.w[R1B12], S1_0, T1_12);
-++	FF(d, a, b, c, cx->u.w[R1B13], S1_1, T1_13);
-++	FF(c, d, a, b, cx->u.w[R1B14], S1_2, T1_14);
-++	FF(b, c, d, a, cx->u.w[R1B15], S1_3, T1_15);
-++	GG(a, b, c, d, cx->u.w[R2B0 ], S2_0, T2_0);
-++	GG(d, a, b, c, cx->u.w[R2B1 ], S2_1, T2_1);
-++	GG(c, d, a, b, cx->u.w[R2B2 ], S2_2, T2_2);
-++	GG(b, c, d, a, cx->u.w[R2B3 ], S2_3, T2_3);
-++	GG(a, b, c, d, cx->u.w[R2B4 ], S2_0, T2_4);
-++	GG(d, a, b, c, cx->u.w[R2B5 ], S2_1, T2_5);
-++	GG(c, d, a, b, cx->u.w[R2B6 ], S2_2, T2_6);
-++	GG(b, c, d, a, cx->u.w[R2B7 ], S2_3, T2_7);
-++	GG(a, b, c, d, cx->u.w[R2B8 ], S2_0, T2_8);
-++	GG(d, a, b, c, cx->u.w[R2B9 ], S2_1, T2_9);
-++	GG(c, d, a, b, cx->u.w[R2B10], S2_2, T2_10);
-++	GG(b, c, d, a, cx->u.w[R2B11], S2_3, T2_11);
-++	GG(a, b, c, d, cx->u.w[R2B12], S2_0, T2_12);
-++	GG(d, a, b, c, cx->u.w[R2B13], S2_1, T2_13);
-++	GG(c, d, a, b, cx->u.w[R2B14], S2_2, T2_14);
-++	GG(b, c, d, a, cx->u.w[R2B15], S2_3, T2_15);
-++	HH(a, b, c, d, cx->u.w[R3B0 ], S3_0, T3_0);
-++	HH(d, a, b, c, cx->u.w[R3B1 ], S3_1, T3_1);
-++	HH(c, d, a, b, cx->u.w[R3B2 ], S3_2, T3_2);
-++	HH(b, c, d, a, cx->u.w[R3B3 ], S3_3, T3_3);
-++	HH(a, b, c, d, cx->u.w[R3B4 ], S3_0, T3_4);
-++	HH(d, a, b, c, cx->u.w[R3B5 ], S3_1, T3_5);
-++	HH(c, d, a, b, cx->u.w[R3B6 ], S3_2, T3_6);
-++	HH(b, c, d, a, cx->u.w[R3B7 ], S3_3, T3_7);
-++	HH(a, b, c, d, cx->u.w[R3B8 ], S3_0, T3_8);
-++	HH(d, a, b, c, cx->u.w[R3B9 ], S3_1, T3_9);
-++	HH(c, d, a, b, cx->u.w[R3B10], S3_2, T3_10);
-++	HH(b, c, d, a, cx->u.w[R3B11], S3_3, T3_11);
-++	HH(a, b, c, d, cx->u.w[R3B12], S3_0, T3_12);
-++	HH(d, a, b, c, cx->u.w[R3B13], S3_1, T3_13);
-++	HH(c, d, a, b, cx->u.w[R3B14], S3_2, T3_14);
-++	HH(b, c, d, a, cx->u.w[R3B15], S3_3, T3_15);
-++	II(a, b, c, d, cx->u.w[R4B0 ], S4_0, T4_0);
-++	II(d, a, b, c, cx->u.w[R4B1 ], S4_1, T4_1);
-++	II(c, d, a, b, cx->u.w[R4B2 ], S4_2, T4_2);
-++	II(b, c, d, a, cx->u.w[R4B3 ], S4_3, T4_3);
-++	II(a, b, c, d, cx->u.w[R4B4 ], S4_0, T4_4);
-++	II(d, a, b, c, cx->u.w[R4B5 ], S4_1, T4_5);
-++	II(c, d, a, b, cx->u.w[R4B6 ], S4_2, T4_6);
-++	II(b, c, d, a, cx->u.w[R4B7 ], S4_3, T4_7);
-++	II(a, b, c, d, cx->u.w[R4B8 ], S4_0, T4_8);
-++	II(d, a, b, c, cx->u.w[R4B9 ], S4_1, T4_9);
-++	II(c, d, a, b, cx->u.w[R4B10], S4_2, T4_10);
-++	II(b, c, d, a, cx->u.w[R4B11], S4_3, T4_11);
-++	II(a, b, c, d, cx->u.w[R4B12], S4_0, T4_12);
-++	II(d, a, b, c, cx->u.w[R4B13], S4_1, T4_13);
-++	II(c, d, a, b, cx->u.w[R4B14], S4_2, T4_14);
-++	II(b, c, d, a, cx->u.w[R4B15], S4_3, T4_15);
-++	cx->cv[0] += a;
-++	cx->cv[1] += b;
-++	cx->cv[2] += c;
-++	cx->cv[3] += d;
-++}
-++
-++void 
-++MD5_Update(MD5Context *cx, const unsigned char *input, unsigned int inputLen)
-++{
-++	PRUint32 bytesToConsume;
-++	PRUint32 inBufIndex = cx->lsbInput & 63;
-++
-++	/* Add the number of input bytes to the 64-bit input counter. */
-++	addto64(cx->msbInput, cx->lsbInput, inputLen);
-++	if (inBufIndex) {
-++		/* There is already data in the buffer.  Fill with input. */
-++		bytesToConsume = PR_MIN(inputLen, MD5_BUFFER_SIZE - inBufIndex);
-++		memcpy(&cx->inBuf[inBufIndex], input, bytesToConsume);
-++		if (inBufIndex + bytesToConsume >= MD5_BUFFER_SIZE)
-++			/* The buffer is filled.  Run the compression function. */
-++			md5_compress(cx);
-++		/* Remaining input. */
-++		inputLen -= bytesToConsume;
-++		input += bytesToConsume;
-++	}
-++
-++	/* Iterate over 64-byte chunks of the message. */
-++	while (inputLen >= MD5_BUFFER_SIZE) {
-++		memcpy(cx->inBuf, input, MD5_BUFFER_SIZE);
-++		md5_compress(cx);
-++		inputLen -= MD5_BUFFER_SIZE;
-++		input += MD5_BUFFER_SIZE;
-++	}
-++
-++	/* Tail of message (message bytes mod 64). */
-++	if (inputLen)
-++		memcpy(cx->inBuf, input, inputLen);
-++}
-++
-++static const unsigned char padbytes[] = {
-++	0x80, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-++	0x00, 0x00, 0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00
-++};
-++
-++void 
-++MD5_End(MD5Context *cx, unsigned char *digest,
-++        unsigned int *digestLen, unsigned int maxDigestLen)
-++{
-++#ifndef IS_LITTLE_ENDIAN
-++	PRUint32 tmp;
-++#endif
-++	PRUint32 lowInput, highInput;
-++	PRUint32 inBufIndex = cx->lsbInput & 63;
-++
-++	if (maxDigestLen < MD5_HASH_LEN) {
-++//		PORT_SetError(SEC_ERROR_INVALID_ARGS);
-++		return;
-++	}
-++
-++	/* Copy out the length of bits input before padding. */
-++	lowInput = cx->lsbInput; 
-++	highInput = (cx->msbInput << 3) | (lowInput >> 29);
-++	lowInput <<= 3;
-++
-++	if (inBufIndex < MD5_END_BUFFER) {
-++		MD5_Update(cx, padbytes, MD5_END_BUFFER - inBufIndex);
-++	} else {
-++		MD5_Update(cx, padbytes, 
-++		           MD5_END_BUFFER + MD5_BUFFER_SIZE - inBufIndex);
-++	}
-++
-++	/* Store the number of bytes input (before padding) in final 64 bits. */
-++	cx->u.w[14] = lendian(lowInput);
-++	cx->u.w[15] = lendian(highInput);
-++
-++	/* Final call to compress. */
-++	md5_compress(cx);
-++
-++	/* Copy the resulting values out of the chain variables into return buf. */
-++	*digestLen = MD5_HASH_LEN;
-++#ifndef IS_LITTLE_ENDIAN
-++	cx->cv[0] = lendian(cx->cv[0]);
-++	cx->cv[1] = lendian(cx->cv[1]);
-++	cx->cv[2] = lendian(cx->cv[2]);
-++	cx->cv[3] = lendian(cx->cv[3]);
-++#endif
-++	memcpy(digest, cx->cv, MD5_HASH_LEN);
-++}
-++
-++unsigned int 
-++MD5_FlattenSize(MD5Context *cx)
-++{
-++	return sizeof(*cx);
-++}
-++
-++int 
-++MD5_Flatten(MD5Context *cx, unsigned char *space)
-++{
-++	memcpy(space, cx, sizeof(*cx));
-++	return 0;
-++}
-++
-++MD5Context * 
-++MD5_Resurrect(unsigned char *space, void *arg)
-++{
-++	MD5Context *cx = MD5_NewContext();
-++	if (cx)
-++		memcpy(cx, space, sizeof(*cx));
-++	return cx;
-++}
-++
-++void 
-++MD5_TraceState(MD5Context *cx)
-++{
-++//	PORT_SetError(PR_NOT_IMPLEMENTED_ERROR);
-++}
-++
-++int
-++md5_stream (FILE *stream, unsigned char *dest)
-++{
-++  /* Important: BLOCKSIZE must be a multiple of 64.  */
-++#define BLOCKSIZE 4096
-++	unsigned int len;
-++	MD5Context *cx = MD5_NewContext();
-++	if (cx == NULL) {
-++//		PORT_SetError(PR_OUT_OF_MEMORY_ERROR);
-++		return -1;
-++	}
-++
-++  unsigned char buffer[BLOCKSIZE + 72];
-++  size_t sum;
-++
-++  /* Initialize the computation context.  */
-++  MD5_Begin(cx);
-++
-++  /* Iterate over full file contents.  */
-++  while (1)
-++    {
-++      /* We read the file in blocks of BLOCKSIZE bytes.  One call of the
-++	 computation function processes the whole buffer so that with the
-++	 next round of the loop another block can be read.  */
-++      size_t n;
-++      sum = 0;
-++
-++      /* Read block.  Take care for partial reads.  */
-++      do
-++	{
-++	  n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream);
-++
-++	  sum += n;
-++	}
-++      while (sum < BLOCKSIZE && n != 0);
-++      if (n == 0 && ferror (stream))
-++        return 1;
-++
-++      /* If end of file is reached, end the loop.  */
-++      if (n == 0)
-++	break;
-++
-++      /* Process buffer with BLOCKSIZE bytes.  Note that
-++			BLOCKSIZE % 64 == 0
-++       */
-++	MD5_Update(cx, buffer, BLOCKSIZE);
-++    }
-++
-++  /* Add the last bytes if necessary.  */
-++  if (sum > 0)
-++	MD5_Update(cx, buffer, sum);
-++
-++	MD5_End(cx, dest, &len, MD5_HASH_LEN);
-++	MD5_DestroyContext(cx, PR_TRUE);
-++	return len;
-++
-++}
-++
-++int getMD5sum(const char * fileName,char * sum)
-++{
-++	unsigned char bin_sum[16];
-++	int len=0;
-++	if (fileName)
-++	{
-++		FILE *fp=fopen(fileName,"rb");
-++		if (fp)
-++		{
-++			len=md5_stream(fp,bin_sum);
-++			memset(sum,0,33);
-++			for (int i = 0; i < len; ++i)
-++				sprintf (sum,"%s%02x",sum, bin_sum[i]);
-++			fclose(fp);
-++			return 0;
-++		}
-++	}
-++	return 1;
-++}
-++
-++int testMD5sum(const char * fileName,char * sum)
-++{
-++	char newSum[33]="";
-++	if (getMD5sum(fileName,newSum))
-++		return 1;
-++	return strcmp(newSum,sum);
-++}
-+--- misc/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp	2006-12-22 14:51:38.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBCardProperty.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -273,8 +273,7 @@
-+ 	if (mCardDatabase)
-+ 	{
-+ 		mCardDatabase->EditCard(this, PR_TRUE);
-+-    mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-+-		return NS_OK;
-++		return mCardDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-+ 	}
-+ 	else
-+ 		return NS_ERROR_FAILURE;
-+--- misc/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp	2008-01-29 20:31:58.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbMDBDirectory.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -561,7 +561,7 @@
-+         }
-+       }
-+     }
-+-    mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-++    rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-+   }
-+   return rv;
-+ }
-+@@ -707,6 +707,7 @@
-+     return NS_ERROR_NOT_IMPLEMENTED;
-+ 
-+   nsresult rv = NS_OK;
-++
-+   if (!mDatabase)
-+     rv = GetAbDatabase();
-+ 
-+@@ -736,10 +737,11 @@
-+     mDatabase->CreateNewListCardAndAddToDB(this, m_dbRowID, newCard, PR_TRUE /* notify */);
-+   else
-+     mDatabase->CreateNewCardAndAddToDB(newCard, PR_TRUE);
-+-  mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-++  rv = mDatabase->Commit(nsAddrDBCommitType::kLargeCommit);
-+ 
-++  NS_ENSURE_SUCCESS(rv, rv);
-+   NS_IF_ADDREF(*addedCard = newCard);
-+-  return NS_OK;
-++  return rv;
-+ }
-+ 
-+ NS_IMETHODIMP nsAbMDBDirectory::DropCard(nsIAbCard* aCard, PRBool needToCopyCard)
-+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp	2004-07-31 20:04:18.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookCard.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -94,6 +94,7 @@
-+ {
-+     index_DisplayName = 0,
-+     index_EmailAddress,
-++    index_SecondEmailAddress,
-+     index_FirstName,
-+     index_LastName,
-+     index_NickName,
-+@@ -121,32 +122,34 @@
-+ 
-+ static const ULONG OutlookCardMAPIProps [] = 
-+ {
-+-    PR_DISPLAY_NAME_W,
-+-    PR_EMAIL_ADDRESS_W,
-+-    PR_GIVEN_NAME_W,
-+-    PR_SURNAME_W,
-+-    PR_NICKNAME_W,
-+-    PR_BUSINESS_TELEPHONE_NUMBER_W,
-+-    PR_HOME_TELEPHONE_NUMBER_W,
-+-    PR_BUSINESS_FAX_NUMBER_W,
-+-    PR_PAGER_TELEPHONE_NUMBER_W,
-+-    PR_MOBILE_TELEPHONE_NUMBER_W,
-+-    PR_HOME_ADDRESS_CITY_W,
-+-    PR_HOME_ADDRESS_STATE_OR_PROVINCE_W,
-+-    PR_HOME_ADDRESS_POSTAL_CODE_W,
-+-    PR_HOME_ADDRESS_COUNTRY_W,
-+-    PR_BUSINESS_ADDRESS_CITY_W,
-+-    PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_W,
-+-    PR_BUSINESS_ADDRESS_POSTAL_CODE_W,
-+-    PR_BUSINESS_ADDRESS_COUNTRY_W,
-+-    PR_TITLE_W,
-+-    PR_DEPARTMENT_NAME_W,
-+-    PR_COMPANY_NAME_W,
-+-    PR_BUSINESS_HOME_PAGE_W,
-+-    PR_PERSONAL_HOME_PAGE_W,
-+-    PR_COMMENT_W
-++    PR_DISPLAY_NAME_A,//0x8035001E
-++    PR_EMAIL_ADDRESS_A,//0x8034001E
-++    PR_SECOND_EMAIL_ADDRESS_A,//Second Email Address
-++    PR_GIVEN_NAME_A,
-++    PR_SURNAME_A,
-++    PR_NICKNAME_A,
-++    PR_BUSINESS_TELEPHONE_NUMBER_A,
-++    PR_HOME_TELEPHONE_NUMBER_A,
-++    PR_BUSINESS_FAX_NUMBER_A,
-++    PR_PAGER_TELEPHONE_NUMBER_A,
-++    PR_MOBILE_TELEPHONE_NUMBER_A,
-++    PR_HOME_ADDRESS_CITY_A,
-++    PR_HOME_ADDRESS_STATE_OR_PROVINCE_A,
-++    PR_HOME_ADDRESS_POSTAL_CODE_A,
-++    PR_HOME_ADDRESS_COUNTRY_A,
-++    PR_BUSINESS_ADDRESS_CITY_A,
-++    PR_BUSINESS_ADDRESS_STATE_OR_PROVINCE_A,
-++    PR_BUSINESS_ADDRESS_POSTAL_CODE_A,
-++    PR_BUSINESS_ADDRESS_COUNTRY_A,
-++    PR_TITLE_A,
-++    PR_DEPARTMENT_NAME_A,
-++    PR_COMPANY_NAME_A,
-++    PR_BUSINESS_HOME_PAGE_A,
-++    PR_PERSONAL_HOME_PAGE_A,
-++    PR_COMMENT_A
-+ } ;
-+ 
-++
-+ nsresult nsAbOutlookCard::Init(const char *aUri)
-+ {
-+     nsresult retCode = nsRDFResource::Init(aUri) ;
-+@@ -173,6 +176,7 @@
-+         SetDisplayName(unichars [index_DisplayName]->get()) ;
-+         SetNickName(unichars [index_NickName]->get()) ;
-+         SetPrimaryEmail(unichars [index_EmailAddress]->get()) ;
-++        SetSecondEmail(unichars [index_SecondEmailAddress]->get()) ;
-+         SetWorkPhone(unichars [index_WorkPhoneNumber]->get()) ;
-+         SetHomePhone(unichars [index_HomePhoneNumber]->get()) ;
-+         SetFaxNumber(unichars [index_WorkFaxNumber]->get()) ;
-+@@ -207,12 +211,12 @@
-+     nsAutoString unichar ;
-+     nsAutoString unicharBis ;
-+ 
-+-    if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_W, unichar)) {
-++    if (mapiAddBook->GetPropertyUString(*mMapiData, PR_HOME_ADDRESS_STREET_A, unichar)) {
-+         splitString(unichar, unicharBis) ;
-+         SetHomeAddress(unichar.get()) ;
-+         SetHomeAddress2(unicharBis.get()) ;
-+     }
-+-    if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_W, unichar)) {
-++    if (mapiAddBook->GetPropertyUString(*mMapiData, PR_BUSINESS_ADDRESS_STREET_A, unichar)) {
-+         splitString(unichar, unicharBis) ;
-+         SetWorkAddress(unichar.get()) ;
-+         SetWorkAddress2(unicharBis.get()) ;
-+@@ -290,6 +294,7 @@
-+     SetDisplayName(properties [index_DisplayName]) ;
-+     GetNickName(getter_Copies(properties [index_NickName])) ;
-+     GetPrimaryEmail(getter_Copies(properties [index_EmailAddress])) ;
-++    GetSecondEmail(getter_Copies(properties [index_SecondEmailAddress])) ;
-+     GetWorkPhone(getter_Copies(properties [index_WorkPhoneNumber])) ;
-+     GetHomePhone(getter_Copies(properties [index_HomePhoneNumber])) ;
-+     GetFaxNumber(getter_Copies(properties [index_WorkFaxNumber])) ;
-+@@ -309,9 +314,16 @@
-+     GetWebPage1(getter_Copies(properties [index_WorkWebPage])) ;
-+     GetWebPage2(getter_Copies(properties [index_HomeWebPage])) ;
-+     GetNotes(getter_Copies(properties [index_Comments])) ;
-+-    if (!mapiAddBook->SetPropertiesUString(*mMapiData, OutlookCardMAPIProps, 
-+-        index_LastProp, properties)) {
-+-        PRINTF(("Cannot set general properties.\n")) ;
-++
-++    int i=0;
-++    for (i=0;i<index_LastProp;i++)
-++    {
-++        if (!mapiAddBook->SetPropertyUString(*mMapiData,
-++                                            OutlookCardMAPIProps[i],
-++                                            properties[i]))
-++        {
-++            PRINTF(("Cannot set properties:%d.\n",OutlookCardMAPIProps[i])) ;
-++    }
-+     }
-+     delete [] properties ;
-+     nsXPIDLString unichar ;
-+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp	2004-04-17 20:32:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -124,8 +124,8 @@
-+     nsCAutoString uri ;
-+     nsCOMPtr<nsIRDFResource> resource ;
-+ 
-+-    for (ULONG i = 0 ; i < folders.mNbEntries ; ++ i) {
-+-        folders.mEntries [i].ToString(entryId) ;
-++    for (ULONG i = 0 ; i < folders.GetSize() ; ++ i) {
-++        folders[i].ToString(entryId) ;
-+         buildAbWinUri(kOutlookDirectoryScheme, abType, uri) ;
-+         uri.Append(entryId) ;
-+         
-+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp	2006-12-22 14:51:38.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -126,7 +126,7 @@
-+         PRINTF(("Cannot get type.\n")) ;
-+         return NS_ERROR_FAILURE ;
-+     }
-+-    if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, unichars)) {
-++    if (!mapiAddBook->GetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, unichars)) {
-+         PRINTF(("Cannot get name.\n")) ;
-+         return NS_ERROR_FAILURE ;
-+     }
-+@@ -163,45 +163,85 @@
-+     return retCode;
-+ }
-+ 
-++nsresult nsAbOutlookDirectory::BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard, 
-++                                                PRBool aSearchForOld, PRBool& aIsNewCard)
-++{   
-++    nsresult retCode = NS_OK ;
-++    if (aSearchForOld) {
-++        nsCStringKey key(uriName) ;
-++        nsCOMPtr<nsISupports> existingCard = mCardList.Get(&key) ;
-++        
-++        if (existingCard) {
-++            nsCOMPtr<nsIAbCard> card(do_QueryInterface(existingCard, &retCode)) ;
-++            
-++            NS_ENSURE_SUCCESS(retCode, retCode) ;
-++            NS_IF_ADDREF(*aNewCard = card) ;
-++            aIsNewCard = PR_FALSE ;
-++            return retCode ;
-++        }
-++    }
-++    aIsNewCard = PR_TRUE ;
-++    nsCOMPtr<nsIRDFResource> resource ;
-++
-++    nsCOMPtr<nsIAbCard> childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    resource = do_QueryInterface(childCard, &retCode) ;
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    retCode = resource->Init(uriName.get()) ;
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    NS_IF_ADDREF(*aNewCard = childCard);
-++    return retCode ;
-++}
-++
-+ NS_IMETHODIMP nsAbOutlookDirectory::GetChildCards(nsIEnumerator **aCards)
-+ {
-+     if (!aCards) { return NS_ERROR_NULL_POINTER ; }
-+     *aCards = nsnull ;
-+     nsCOMPtr<nsISupportsArray> cardList ;
-++    nsCStringArray uriList ;
-++    nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
-+     nsresult retCode ;
-+     
-+-    mCardList.Reset() ;
-+     if (mIsQueryURI) {
-+         retCode = StartSearch() ;
-+-        NS_NewISupportsArray(getter_AddRefs(cardList)) ;
-+     }
-+     else {
-+-        retCode = GetChildCards(getter_AddRefs(cardList), nsnull) ;
-++        retCode = GetChildCards(uriList, nsnull) ;
-+     }
-++    NS_NewISupportsArray(getter_AddRefs(cardList)) ;
-+     if (NS_SUCCEEDED(retCode)) {
-+         // Fill the results array and update the card list
-+         // Also update the address list and notify any changes.
-+         PRUint32 nbCards = 0 ;
-+-        nsCOMPtr<nsISupports> element ;
-++        nsCAutoString uriName;
-++        nsCOMPtr <nsIAbCard> childCard;
-++        PRBool searchForOldCards = 0; //(mCardList.Count() != 0) ;
-++
-++        nbCards = uriList.Count();
-++		NS_NewISupportsArray(getter_AddRefs(m_AddressList));
-+         
-+-        cardList->Enumerate(aCards) ;
-+-        cardList->Count(&nbCards) ;
-+         for (PRUint32 i = 0 ; i < nbCards ; ++ i) {
-+-            cardList->GetElementAt(i, getter_AddRefs(element)) ;
-+-            nsVoidKey newKey (NS_STATIC_CAST(void *, element)) ;
-+-            nsCOMPtr<nsISupports> oldElement = mCardList.Get(&newKey) ;
-++            PRBool isNewCard = PR_FALSE ;
-+ 
-+-            if (!oldElement) {
-++            uriList.CStringAt(i,uriName);
-++            retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), searchForOldCards, isNewCard);
-++            NS_ENSURE_SUCCESS(retCode, retCode) ;
-++            cardList->AppendElement(childCard);
-++
-++            if (isNewCard) {
-+                 // We are dealing with a new element (probably directly
-+                 // added from Outlook), we may need to sync m_AddressList
-+-                mCardList.Put(&newKey, element) ;
-+-                nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-++                nsCStringKey newKey(uriName) ;
-++
-++                mCardList.Put(&newKey, childCard) ;
-++                nsCOMPtr<nsIAbCard> card (do_QueryInterface(childCard, &retCode)) ;
-+ 
-+                 NS_ENSURE_SUCCESS(retCode, retCode) ;
-+                 PRBool isMailList = PR_FALSE ;
-+ 
-+                 retCode = card->GetIsMailList(&isMailList) ;
-+                 NS_ENSURE_SUCCESS(retCode, retCode) ;
-++
-+                 if (isMailList) {
-+                     // We can have mailing lists only in folder, 
-+                     // we must add the directory to m_AddressList
-+@@ -224,18 +264,33 @@
-+                     NotifyItemAddition(card) ;
-+                 }
-+             }
-+-            else {
-+-                NS_ASSERTION(oldElement == element, "Different card stored") ;
-+             }
-+         }
-++    return cardList->Enumerate(aCards) ;
-+     }
-++
-++static nsresult ExtractUriFromCard(nsIAbCard *aCard, nsCString& aUri) {
-++    nsresult retCode = NS_OK ;
-++    nsCOMPtr<nsIRDFResource> resource (do_QueryInterface(aCard, &retCode)) ;
-++    
-++    // Receiving a non-RDF card is accepted
-++    if (NS_FAILED(retCode)) { return NS_OK ; }
-++    nsXPIDLCString uri ;
-++    
-++    retCode = resource->GetValue(getter_Copies(uri)) ;
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    aUri = uri.get() ;
-+     return retCode ;
-+ }
-+ 
-+ NS_IMETHODIMP nsAbOutlookDirectory::HasCard(nsIAbCard *aCard, PRBool *aHasCard)
-+ {
-+     if (!aCard || !aHasCard) { return NS_ERROR_NULL_POINTER ; }
-+-    nsVoidKey key (NS_STATIC_CAST(void *, aCard)) ;
-++    *aHasCard = PR_FALSE ;
-++    nsCString uri ;
-++
-++    ExtractUriFromCard(aCard, uri) ;
-++    nsCStringKey key(uri) ;
-+ 
-+     *aHasCard = mCardList.Exists(&key) ;
-+     return NS_OK ;
-+@@ -317,7 +372,10 @@
-+                 PRINTF(("Cannot delete card %s.\n", entryString.get())) ;
-+             }
-+             else {
-+-                nsVoidKey key (NS_STATIC_CAST(void *, element)) ;
-++                nsCString uri ;
-++
-++                ExtractUriFromCard(card, uri) ;
-++                nsCStringKey key(uri) ;
-+                 
-+                 mCardList.Remove(&key) ;
-+                 if (m_IsMailList) { m_AddressList->RemoveElement(element) ; }
-+@@ -386,7 +444,10 @@
-+     }
-+     retCode = CreateCard(aData, addedCard) ;
-+     NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-    nsVoidKey newKey (NS_STATIC_CAST(void *, *addedCard)) ;
-++    nsCString uri ;
-++
-++    ExtractUriFromCard(*addedCard, uri) ;
-++    nsCStringKey newKey(uri) ;
-+     
-+     mCardList.Put(&newKey, *addedCard) ;
-+     if (m_IsMailList) { m_AddressList->AppendElement(*addedCard) ; }
-+@@ -457,7 +518,7 @@
-+     if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
-+     retCode = GetDirName(getter_Copies(name)) ;
-+     NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-    if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_W, name.get())) {
-++    if (!mapiAddBook->SetPropertyUString(*mMapiData, PR_DISPLAY_NAME_A, name.get())) {
-+         return NS_ERROR_FAILURE ;
-+     }
-+     retCode = CommitAddressList() ;
-+@@ -518,6 +579,7 @@
-+     {"DisplayName", PR_DISPLAY_NAME_A},
-+     {"NickName", PR_NICKNAME_A},
-+     {"PrimaryEmail", PR_EMAIL_ADDRESS_A},
-++    {"SecondEmail",PR_SECOND_EMAIL_ADDRESS_A},
-+     {"WorkPhone", PR_BUSINESS_TELEPHONE_NUMBER_A},
-+     {"HomePhone", PR_HOME_TELEPHONE_NUMBER_A},
-+     {"FaxNumber", PR_BUSINESS_FAX_NUMBER_A},
-+@@ -1027,7 +1089,10 @@
-+ 
-+ nsresult nsAbOutlookDirectory::OnSearchFoundCard(nsIAbCard *aCard) 
-+ {
-+-    nsVoidKey newKey (NS_STATIC_CAST(void *, aCard)) ;
-++    nsCString uri ;
-++
-++    ExtractUriFromCard(aCard, uri) ;
-++    nsCStringKey newKey(uri) ;
-+     nsresult retCode = NS_OK ;
-+     
-+     mCardList.Put(&newKey, aCard) ;
-+@@ -1051,14 +1116,14 @@
-+     retCode = BuildRestriction(aArguments, arguments) ;
-+     NS_ENSURE_SUCCESS(retCode, retCode) ;
-+     nsCOMPtr<nsISupportsArray> resultsArray ;
-++    nsCStringArray uriArray ;
-+     PRUint32 nbResults = 0 ;
-+     
-+-    retCode = GetChildCards(getter_AddRefs(resultsArray), 
-++    retCode = GetChildCards(uriArray, 
-+                             arguments.rt == RES_COMMENT ? nsnull : &arguments) ;
-+     DestroyRestriction(arguments) ;
-+     NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-    retCode = resultsArray->Count(&nbResults) ;
-+-    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    nbResults = uriArray.Count() ;
-+     nsCOMPtr<nsIAbDirectoryQueryResult> result ;
-+     nsAbDirectoryQueryResult *newResult = nsnull ;
-+ 
-+@@ -1066,15 +1131,18 @@
-+         nbResults = NS_STATIC_CAST(PRUint32, aResultLimit) ; 
-+     }
-+     PRUint32 i = 0 ;
-+-    nsCOMPtr<nsISupports> element ;
-+     nsCOMPtr<nsISupportsArray> propertyValues ;
-+     
-++    nsCAutoString uriName;
-++    nsCOMPtr <nsIAbCard> card;
-++
-+     for (i = 0 ; i < nbResults ; ++ i) {
-+-        retCode = resultsArray->GetElementAt(i, getter_AddRefs(element)) ;
-+-        NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-        nsCOMPtr<nsIAbCard> card (do_QueryInterface(element, &retCode)) ;
-++        PRBool isNewCard = PR_FALSE ;
-+         
-++        uriArray.CStringAt(i,uriName);
-++        retCode = BuildCardFromURI(uriName,getter_AddRefs(card), PR_FALSE, isNewCard);
-+         NS_ENSURE_SUCCESS(retCode, retCode) ;
-++        
-+         FillPropertyValues(card, aArguments, getter_AddRefs(propertyValues)) ;
-+         newResult = new nsAbDirectoryQueryResult(0, aArguments,
-+                                                  nsIAbDirectoryQueryResult::queryResultMatch, 
-+@@ -1099,13 +1167,43 @@
-+     if (!aCards) { return NS_ERROR_NULL_POINTER ; }
-+     *aCards = nsnull ;
-+     nsresult retCode = NS_OK ;
-+-    nsCOMPtr<nsISupportsArray> cards ;
-++
-++    nsCOMPtr<nsISupportsArray> cards;
-++    retCode = NS_NewISupportsArray(getter_AddRefs(cards));
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++
-++    nsCStringArray uriList;
-++    retCode = GetChildCards(uriList,aRestriction);
-++    NS_ENSURE_SUCCESS(retCode, retCode) ;
-++    
-++    nsCAutoString uriName;
-++    nsCOMPtr <nsIAbCard> childCard;
-++    PRUint32 nbURIs = 0 ;
-++    nbURIs = uriList.Count();
-++    PRUint32 i = 0 ;
-++        
-++    for (i = 0 ; i < nbURIs ; ++ i) {
-++        PRBool isNewCard = PR_FALSE ;
-++
-++        uriList.CStringAt(i,uriName);
-++        retCode = BuildCardFromURI(uriName,getter_AddRefs(childCard), PR_TRUE, isNewCard);
-++        NS_ENSURE_SUCCESS(retCode, retCode) ;
-++        cards->AppendElement(childCard);
-++    }        
-++    
-++    NS_IF_ADDREF(*aCards = cards);
-++    return retCode ;
-++}
-++
-++nsresult nsAbOutlookDirectory::GetChildCards(nsCStringArray& aURI, 
-++                                             void *aRestriction)
-++{
-++    nsresult retCode = NS_OK ;
-+     nsAbWinHelperGuard mapiAddBook (mAbWinType) ;
-+     nsMapiEntryArray cardEntries ;
-+     LPSRestriction restriction = (LPSRestriction) aRestriction ;
-+ 
-+     if (!mapiAddBook->IsOK()) { return NS_ERROR_FAILURE ; }
-+-    retCode = NS_NewISupportsArray(getter_AddRefs(cards)) ;
-+     NS_ENSURE_SUCCESS(retCode, retCode) ;
-+     if (!mapiAddBook->GetCards(*mMapiData, restriction, cardEntries)) {
-+         PRINTF(("Cannot get cards.\n")) ;
-+@@ -1114,22 +1212,14 @@
-+     nsCAutoString entryId ;
-+     nsCAutoString uriName ;
-+     nsCOMPtr<nsIRDFResource> resource ;
-+-    nsCOMPtr <nsIAbCard> childCard;
-+-        
-+-    for (ULONG card = 0 ; card < cardEntries.mNbEntries ; ++ card) {
-+-        cardEntries.mEntries [card].ToString(entryId) ;
-++    aURI.Clear();
-++    
-++    for (ULONG card = 0 ; card < cardEntries.GetSize() ; ++ card) {
-++        cardEntries [card].ToString(entryId) ;
-+         buildAbWinUri(kOutlookCardScheme, mAbWinType, uriName) ;
-+         uriName.Append(entryId) ;
-+-        childCard = do_CreateInstance(NS_ABOUTLOOKCARD_CONTRACTID, &retCode);
-+-        NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-        resource = do_QueryInterface(childCard, &retCode) ;
-+-        NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-        retCode = resource->Init(uriName.get()) ;
-+-        NS_ENSURE_SUCCESS(retCode, retCode) ;
-+-        cards->AppendElement(childCard) ;
-++        aURI.AppendCString(uriName);
-+     }
-+-    *aCards = cards ;
-+-    NS_ADDREF(*aCards) ;
-+     return retCode ;
-+ }
-+ 
-+@@ -1153,8 +1243,8 @@
-+     nsCAutoString uriName ;
-+     nsCOMPtr <nsIRDFResource> resource ;
-+ 
-+-    for (ULONG node = 0 ; node < nodeEntries.mNbEntries ; ++ node) {
-+-        nodeEntries.mEntries [node].ToString(entryId) ;
-++    for (ULONG node = 0 ; node < nodeEntries.GetSize() ; ++ node) {
-++        nodeEntries [node].ToString(entryId) ;
-+         buildAbWinUri(kOutlookDirectoryScheme, mAbWinType, uriName) ;
-+         uriName.Append(entryId) ;
-+         retCode = gRDFService->GetResource(uriName, getter_AddRefs(resource)) ;
-+@@ -1275,7 +1365,7 @@
-+         // In the case of a mailing list, we cannot directly create a new card,
-+         // we have to create a temporary one in a real folder (to be able to use
-+         // templates) and then copy it to the mailing list.
-+-        if (m_IsMailList) {
-++        if (m_IsMailList && mAbWinType == nsAbWinType_OutlookExp) {
-+             nsMapiEntry parentEntry ;
-+             nsMapiEntry temporaryEntry ;
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h	2004-04-17 20:32:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbOutlookDirectory.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -46,6 +46,7 @@
-+ #include "nsHashtable.h"
-+ 
-+ #include "nsISupportsArray.h"
-++#include "nsVoidArray.h"
-+ 
-+ struct nsMapiEntry ;
-+ 
-+@@ -92,6 +93,8 @@
-+ protected:
-+     // Retrieve hierarchy as cards, with an optional restriction
-+     nsresult GetChildCards(nsISupportsArray **aCards, void *aRestriction) ;
-++    // Retrieve hierarchy as URIs, with an optional restriction
-++    nsresult GetChildCards(nsCStringArray& aURI, void *aRestriction) ;
-+     // Retrieve hierarchy as directories
-+     nsresult GetChildNodes(nsISupportsArray **aNodes) ;
-+     // Create a new card
-+@@ -103,6 +106,9 @@
-+     nsresult CommitAddressList(void) ;
-+     // Read MAPI repository
-+     nsresult UpdateAddressList(void) ;
-++    // Search for an existing card or build a new one
-++    nsresult BuildCardFromURI(const nsCString& uriName,nsIAbCard **aNewCard, 
-++                              PRBool aSearchForOld, PRBool& aIsNewCard) ;
-+ 
-+     nsMapiEntry *mMapiData ;
-+     // Container for the query threads
-+--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp	2005-05-07 08:11:28.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -42,6 +42,9 @@
-+ #define USES_IID_IABContainer
-+ #define USES_IID_IMAPITable
-+ #define USES_IID_IDistList
-++#define USES_IID_IMsgStore
-++#define USES_IID_IMessage
-++#define USES_IID_IMAPIFolder
-+ 
-+ #include "nsAbWinHelper.h"
-+ #include "nsMapiAddressBook.h"
-+@@ -59,19 +62,6 @@
-+ 
-+ #define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
-+ 
-+-// Small utility to ensure release of all MAPI interfaces
-+-template <class tInterface> struct nsMapiInterfaceWrapper
-+-{
-+-    tInterface mInterface ;
-+-
-+-    nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-+-    ~nsMapiInterfaceWrapper(void) {
-+-        if (mInterface != NULL) { mInterface->Release() ; }
-+-    }
-+-    operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-+-    tInterface operator -> (void) const { return mInterface ; }
-+-    operator tInterface *(void) { return &mInterface ; }
-+-} ;
-+ 
-+ static void assignEntryID(LPENTRYID& aTarget, LPENTRYID aSource, ULONG aByteCount)
-+ {
-+@@ -249,24 +239,28 @@
-+ MOZ_DECL_CTOR_COUNTER(nsMapiEntryArray)
-+ 
-+ nsMapiEntryArray::nsMapiEntryArray(void)
-+-: mEntries(NULL), mNbEntries(0)
-+ {
-+     MOZ_COUNT_CTOR(nsMapiEntryArray) ;
-+ }
-+ 
-+ nsMapiEntryArray::~nsMapiEntryArray(void)
-+ {
-+-    if (mEntries) { delete [] mEntries ; }
-++    CleanUp();
-+     MOZ_COUNT_DTOR(nsMapiEntryArray) ;
-+ }
-+-
-++void  nsMapiEntryArray::AddItem(nsMapiEntry * aEntries)
-++{
-++    m_array.AppendElement(aEntries);
-++}
-+ void nsMapiEntryArray::CleanUp(void)
-+ {
-+-    if (mEntries != NULL) { 
-+-        delete [] mEntries ;
-+-        mEntries = NULL ;
-+-        mNbEntries = 0 ;
-++    nsMapiEntry *pEntries;
-++    for (int i = 0; i < m_array.Count(); i++)
-++    {
-++        pEntries = (nsMapiEntry *)m_array.ElementAt( i);
-++        delete pEntries;
-+     }
-++    m_array.Clear();
-+ }
-+ 
-+ MOZ_DECL_CTOR_COUNTER(nsAbWinHelper)
-+@@ -280,100 +274,55 @@
-+ // same protection (MAPI is supposed to be thread-safe).
-+ PRLock *nsAbWinHelper::mMutex = PR_NewLock() ;
-+ 
-++int            nsAbWinHelper::m_clients = 0;
-++
-++PRUnichar *    nsAbWinHelper::m_pUniBuff = NULL;
-++int            nsAbWinHelper::m_uniBuffLen = 0;
-++char      *    nsAbWinHelper::m_pCStrBuff = NULL;
-++int            nsAbWinHelper::m_cstrBuffLen = 0;
-++
-+ nsAbWinHelper::nsAbWinHelper(void)
-+-: mAddressBook(NULL), mLastError(S_OK)
-++:mLastError(S_OK)
-+ {
-+     MOZ_COUNT_CTOR(nsAbWinHelper) ;
-++    m_clients++;
-+ }
-+ 
-+ nsAbWinHelper::~nsAbWinHelper(void)
-+ {
-+     MOZ_COUNT_DTOR(nsAbWinHelper) ;
-+-}
-+-
-+-BOOL nsAbWinHelper::GetFolders(nsMapiEntryArray& aFolders)
-++    m_clients--;
-++    if (!m_clients)
-+ {
-+-    aFolders.CleanUp() ;
-+-    nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-+-    nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-+-    ULONG objType = 0 ;
-+-    ULONG rowCount = 0 ;
-+-    SRestriction restriction ;
-+-    SPropTagArray folderColumns ;
-+-
-+-    mLastError = mAddressBook->OpenEntry(0, NULL, NULL, 0, &objType, 
-+-                                         rootFolder) ;
-+-    if (HR_FAILED(mLastError)) { 
-+-        PRINTF(("Cannot open root %08x.\n", mLastError)) ;
-+-        return FALSE ; 
-++        delete [] m_pUniBuff;
-++        m_pUniBuff = NULL;
-++        m_uniBuffLen = 0;
-++        delete [] m_pCStrBuff;
-++        m_pCStrBuff = NULL;
-++        m_cstrBuffLen = 0;
-+     }
-+-    mLastError = rootFolder->GetHierarchyTable(0, folders) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot get hierarchy %08x.\n", mLastError)) ;
-+-        return FALSE ; 
-+     }
-+-    // We only take into account modifiable containers, 
-+-    // otherwise, we end up with all the directory services...
-+-    restriction.rt = RES_BITMASK ;
-+-    restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-+-    restriction.res.resBitMask.relBMR = BMR_NEZ ;
-+-    restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-+-    mLastError = folders->Restrict(&restriction, 0) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-+-    }
-+-    folderColumns.cValues = 1 ;
-+-    folderColumns.aulPropTag [0] = PR_ENTRYID ;
-+-    mLastError = folders->SetColumns(&folderColumns, 0) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    mLastError = folders->GetRowCount(0, &rowCount) ;
-+-    if (HR_SUCCEEDED(mLastError)) {
-+-        aFolders.mEntries = new nsMapiEntry [rowCount] ;
-+-        aFolders.mNbEntries = 0 ;
-+-        do {
-+-            LPSRowSet rowSet = NULL ;
-+-
-+-            rowCount = 0 ;
-+-            mLastError = folders->QueryRows(1, 0, &rowSet) ;
-+-            if (HR_SUCCEEDED(mLastError)) {
-+-                rowCount = rowSet->cRows ;
-+-                if (rowCount > 0) {
-+-                    nsMapiEntry& current = aFolders.mEntries [aFolders.mNbEntries ++] ;
-+-                    SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
-+-                    
-+-                    current.Assign(currentValue.Value.bin.cb,
-+-                                   NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-+-                }
-+-                MyFreeProws(rowSet) ;
-+-            }
-+-            else {
-+-                PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+-            }
-+-        } while (rowCount > 0) ;
-+-    }
-+-    return HR_SUCCEEDED(mLastError) ;
-+-}
-++
-+ 
-+ BOOL nsAbWinHelper::GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+                              nsMapiEntryArray& aCards)
-+ {
-+     aCards.CleanUp() ;
-+-    return GetContents(aParent, aRestriction, &aCards.mEntries, aCards.mNbEntries, 0) ;
-++    return GetContents(aParent, aRestriction, &aCards, 0) ;
-+ }
-+  
-+ BOOL nsAbWinHelper::GetNodes(const nsMapiEntry& aParent, nsMapiEntryArray& aNodes)
-+ { 
-+     aNodes.CleanUp() ;
-+-    return GetContents(aParent, NULL, &aNodes.mEntries, aNodes.mNbEntries, MAPI_DISTLIST) ;
-++    return GetContents(aParent, NULL, &aNodes, MAPI_DISTLIST) ;
-+ }
-+ 
-+ BOOL nsAbWinHelper::GetCardsCount(const nsMapiEntry& aParent, ULONG& aNbCards) 
-+ {
-+-    aNbCards = 0 ;
-+-    return GetContents(aParent, NULL, NULL, aNbCards, 0) ;
-++    nsMapiEntryArray aCards;
-++    BOOL ret=GetContents(aParent, NULL, &aCards,  0) ;
-++    aNbCards=aCards.GetSize();
-++    return ret;
-+ }
-+ 
-+ BOOL nsAbWinHelper::GetPropertyString(const nsMapiEntry& aObject,
-+@@ -390,7 +339,7 @@
-+             aName = values->Value.lpszA ;
-+         }
-+         else if (PROP_TYPE(values->ulPropTag) == PT_UNICODE) {
-+-            aName.AssignWithConversion(values->Value.lpszW) ;
-++            UnicodeToCStr(values->Value.lpszW,aName) ;
-+         }
-+     }
-+     FreeBuffer(values) ;
-+@@ -410,7 +359,7 @@
-+             aName = values->Value.lpszW ;
-+         }
-+         else if (PROP_TYPE(values->ulPropTag) == PT_STRING8) {
-+-            aName.AssignWithConversion(values->Value.lpszA) ;
-++            CStrToUnicode(values->Value.lpszA,aName) ;
-+         }
-+     }
-+     FreeBuffer(values) ;
-+@@ -431,16 +380,22 @@
-+         ULONG i = 0 ;
-+ 
-+         for (i = 0 ; i < valueCount ; ++ i) {
-+-            if (PROP_ID(values [i].ulPropTag) == PROP_ID(aPropertyTags [i])) {
-++            if (PROP_TYPE( values [i].ulPropTag) != PT_ERROR && values [i].Value.l != MAPI_E_NOT_FOUND){
-+                 if (PROP_TYPE(values [i].ulPropTag) == PT_STRING8) {
-+                     nsAutoString temp ;
-+ 
-+-                    temp.AssignWithConversion (values [i].Value.lpszA) ;
-++                    CStrToUnicode(values [i].Value.lpszA,temp) ;
-+                     aNames.AppendString(temp) ;
-+                 }
-+                 else if (PROP_TYPE(values [i].ulPropTag) == PT_UNICODE) {
-+                     aNames.AppendString(nsAutoString (values [i].Value.lpszW)) ;
-+                 }
-++                else if (aPropertyTags [i] == PR_EMAIL_ADDRESS_A) {
-++                    nsAutoString temp ;
-++
-++                    CStrToUnicode (values [i].Value.lpszA,temp) ;
-++                    aNames.AppendString(temp) ;
-++                }
-+                 else {
-+                     aNames.AppendString(nsAutoString((const PRUnichar *) "")) ;
-+                 }
-+@@ -466,7 +421,6 @@
-+     if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) { return FALSE ; }
-+     if (valueCount == 1 && values != NULL && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
-+         SYSTEMTIME readableTime ;
-+-
-+         if (FileTimeToSystemTime(&values->Value.ft, &readableTime)) {
-+             aYear = readableTime.wYear ;
-+             aMonth = readableTime.wMonth ;
-+@@ -518,7 +472,7 @@
-+     nsMapiInterfaceWrapper<LPMAPIPROP> subObject ;
-+     ULONG objType = 0 ;
-+     
-+-    mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+                                          &IID_IMAPIContainer, 0, &objType, 
-+                                          container) ;
-+     if (HR_FAILED(mLastError)) {
-+@@ -537,7 +491,7 @@
-+     SBinary entry ;
-+     SBinaryArray entryArray ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+                                          &IID_IABContainer, MAPI_MODIFY, &objType, 
-+                                          container) ;
-+     if (HR_FAILED(mLastError)) {
-+@@ -567,14 +521,15 @@
-+         value.Value.lpszW = NS_CONST_CAST(WCHAR *, aValue) ;
-+     }
-+     else if (PROP_TYPE(aPropertyTag) == PT_STRING8) {
-+-        alternativeValue.AssignWithConversion(aValue) ;
-++        UnicodeToCStr(aValue,alternativeValue) ;
-+         value.Value.lpszA = NS_CONST_CAST(char *, alternativeValue.get()) ;
-+     }
-+     else {
-+         PRINTF(("Property %08x is not a string.\n", aPropertyTag)) ;
-+         return TRUE ;
-+     }
-+-    return SetMAPIProperties(aObject, 1, &value) ;
-++    LPSPropValue values=&value;
-++    return SetMAPIProperties(aObject, 1, values) ;
-+ }
-+ 
-+ BOOL nsAbWinHelper::SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-+@@ -595,7 +550,7 @@
-+             values [currentValue ++].Value.lpszW = NS_CONST_CAST(WCHAR *, aValues [i].get()) ;
-+         }
-+         else if (PROP_TYPE(aPropertiesTag [i]) == PT_STRING8) {
-+-            alternativeValue.AssignWithConversion(aValues [i].get()) ;
-++            UnicodeToCStr(aValues [i].get(),alternativeValue) ;
-+             char *av = nsCRT::strdup(alternativeValue.get()) ;
-+             if (!av) {
-+                 retCode = FALSE ;
-+@@ -633,7 +588,8 @@
-+         readableTime.wSecond = 0 ;
-+         readableTime.wMilliseconds = 0 ;
-+         if (SystemTimeToFileTime(&readableTime, &value.Value.ft)) {
-+-            return SetMAPIProperties(aObject, 1, &value) ;
-++            LPSPropValue values=&value;
-++            return SetMAPIProperties(aObject, 1, values) ;
-+         }
-+         return TRUE ;
-+     }
-+@@ -645,7 +601,7 @@
-+     nsMapiInterfaceWrapper<LPABCONT> container ;
-+     ULONG objType = 0 ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++    mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+                                          &IID_IABContainer, MAPI_MODIFY, &objType,
-+                                          container) ;
-+     if (HR_FAILED(mLastError)) { 
-+@@ -708,7 +664,7 @@
-+     nsMapiInterfaceWrapper<LPABCONT> container ;
-+     ULONG objType = 0 ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++    mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-+                                          &IID_IABContainer, MAPI_MODIFY, &objType,
-+                                          container) ;
-+     if (HR_FAILED(mLastError)) {
-+@@ -773,7 +729,7 @@
-+     nsMapiInterfaceWrapper<LPABCONT> container ;
-+     ULONG objType = 0 ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-+                                          &IID_IABContainer, MAPI_MODIFY, &objType,
-+                                          container) ;
-+     if (HR_FAILED(mLastError)) { 
-+@@ -810,194 +766,77 @@
-+     return TRUE ;
-+ }
-+ 
-+-BOOL nsAbWinHelper::GetDefaultContainer(nsMapiEntry& aContainer)
-+-{
-+-    LPENTRYID entryId = NULL ; 
-+-    ULONG byteCount = 0 ;
-+-
-+-    mLastError = mAddressBook->GetPAB(&byteCount, &entryId) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot get PAB %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    aContainer.Assign(byteCount, entryId) ;
-+-    FreeBuffer(entryId) ;
-+-    return TRUE ;
-+-}
-+ 
-+-enum
-+-{
-+-    ContentsColumnEntryId = 0,
-+-    ContentsColumnObjectType,
-+-    ContentsColumnsSize
-+-} ;
-+ 
-+-static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-+-{
-+-    ContentsColumnsSize,
-+-    {
-+-        PR_ENTRYID,
-+-        PR_OBJECT_TYPE
-+-    }
-+-} ;
-+ 
-+-BOOL nsAbWinHelper::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-+-                                nsMapiEntry **aList, ULONG& aNbElements, ULONG aMapiType)
-++void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
-+ {
-+-    if (aList != NULL) { *aList = NULL ; }
-+-    aNbElements = 0 ;
-+-    nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-+-    nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-+-    ULONG objType = 0 ;
-+-    ULONG rowCount = 0 ;
-++    if (aRowset == NULL) { return ; }
-++    ULONG i = 0 ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aParent.mByteCount, aParent.mEntryId, 
-+-                                         &IID_IMAPIContainer, 0, &objType, 
-+-                                         parent) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-+-        return FALSE ; 
-+-    }
-+-    // Here, flags for WAB and MAPI could be different, so this works
-+-    // only as long as we don't want to use any flag in GetContentsTable
-+-    mLastError = parent->GetContentsTable(0, contents) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-+-        return FALSE ; 
-++    for (i = 0 ; i < aRowset->cRows ; ++ i) {
-++        FreeBuffer(aRowset->aRow [i].lpProps) ;
-+     }
-+-    if (aRestriction != NULL) {
-+-        mLastError = contents->Restrict(aRestriction, 0) ;
-+-        if (HR_FAILED(mLastError)) {
-+-            PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-+-            return FALSE ;
-+-        }
-+-    }
-+-    mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    mLastError = contents->GetRowCount(0, &rowCount) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    if (aList != NULL) { *aList = new nsMapiEntry [rowCount] ; }
-+-    aNbElements = 0 ;
-+-    do {
-+-        LPSRowSet rowSet = NULL ;
-+-        
-+-        rowCount = 0 ;
-+-        mLastError = contents->QueryRows(1, 0, &rowSet) ;
-+-        if (HR_FAILED(mLastError)) {
-+-            PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-+-            return FALSE ;
-+-        }
-+-        rowCount = rowSet->cRows ;
-+-        if (rowCount > 0 &&
-+-            (aMapiType == 0 ||
-+-            rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)) {
-+-            if (aList != NULL) {
-+-                nsMapiEntry& current = (*aList) [aNbElements] ;
-+-                SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-+-                
-+-                current.Assign(currentValue.Value.bin.cb,
-+-                    NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-++    FreeBuffer(aRowset) ;
-++        }
-++void nsAbWinHelper::CStrToUnicode( const char *pStr, nsString& result)
-++{
-++    result.Truncate( 0);
-++    int wLen = MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, 0);
-++    if (wLen >= m_uniBuffLen)
-++    {
-++        delete [] m_pUniBuff;
-++        m_pUniBuff = new PRUnichar[wLen + 64];
-++        m_uniBuffLen = wLen + 64;
-+             }
-+-            ++ aNbElements ;
-++    if (wLen)
-++    {
-++        MultiByteToWideChar( CP_ACP, 0, pStr, -1, m_pUniBuff, m_uniBuffLen);
-++        result = m_pUniBuff;
-+         }
-+-        MyFreeProws(rowSet) ;
-+-    } while (rowCount > 0) ;
-+-    return TRUE ;
-+ }
-+-
-+-BOOL nsAbWinHelper::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-+-                                      ULONG aNbProperties, LPSPropValue& aValue, 
-+-                                      ULONG& aValueCount)
-++void nsAbWinHelper::UnicodeToCStr( const  PRUnichar *pUStr,nsCString& result)
-+ {
-+-    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+-    ULONG objType = 0 ;
-+-    LPSPropTagArray properties = NULL ;
-+-    ULONG i = 0 ;
-+-    
-+-    mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+-                                         &IID_IMAPIProp, 0, &objType, 
-+-                                         object) ;
-+-    if (HR_FAILED(mLastError)) { 
-+-        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+-        return FALSE ; 
-++    result.Truncate( 0);
-++    int cLen = WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, 0,NULL,NULL);
-++    if (cLen >= m_cstrBuffLen) {
-++        if (m_pCStrBuff)
-++            delete [] m_pCStrBuff;
-++        m_pCStrBuff = new char[cLen + 64];
-++        m_cstrBuffLen = cLen + 64;
-+     }
-+-    AllocateBuffer(CbNewSPropTagArray(aNbProperties), 
-+-                   NS_REINTERPRET_CAST(void **, &properties)) ;
-+-    properties->cValues = aNbProperties ;
-+-    for (i = 0 ; i < aNbProperties ; ++ i) {
-+-        properties->aulPropTag [i] = aPropertyTags [i] ;
-+-    }
-+-    mLastError = object->GetProps(properties, 0, &aValueCount, &aValue) ;
-+-    FreeBuffer(properties) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot get props %08x.\n", mLastError)) ;
-++    if (cLen) {
-++        WideCharToMultiByte( CP_ACP, 0, pUStr, -1, m_pCStrBuff, m_cstrBuffLen,NULL,NULL);
-++        result = m_pCStrBuff;
-+     }
-+-    return HR_SUCCEEDED(mLastError) ;
-+ }
-+ 
-+-BOOL nsAbWinHelper::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-+-                                      const LPSPropValue& aValues)
-+-{
-+-    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-+-    ULONG objType = 0 ;
-+-    LPSPropProblemArray problems = NULL ;
-++static nsAbWinHelper *getOutlookAddressBook(void) {
-++    static nsMapiAddressBook *addressBook = NULL ;
-+ 
-+-    mLastError = mAddressBook->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-+-                                         &IID_IMAPIProp, MAPI_MODIFY, &objType, 
-+-                                         object) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-+-        return FALSE ;
-+-    }
-+-    if (problems != NULL) {
-+-        for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-+-            PRINTF(("Problem %d: index %d code %08x.\n", i, 
-+-                problems->aProblem [i].ulIndex, 
-+-                problems->aProblem [i].scode)) ;
-+-        }
-+-    }
-+-    mLastError = object->SaveChanges(0) ;
-+-    if (HR_FAILED(mLastError)) {
-+-        PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-+-    }
-+-    return HR_SUCCEEDED(mLastError) ;
-++    if (addressBook == NULL) { addressBook = new nsMapiAddressBook ; } 
-++    return addressBook ;
-+ }
-+ 
-+-void nsAbWinHelper::MyFreeProws(LPSRowSet aRowset)
-+-{
-+-    if (aRowset == NULL) { return ; }
-+-    ULONG i = 0 ; 
-++static nsAbWinHelper *getOutlookExpAddressBook(void) {
-++    static nsWabAddressBook *addressBook = NULL ;
-+ 
-+-    for (i = 0 ; i < aRowset->cRows ; ++ i) {
-+-        FreeBuffer(aRowset->aRow [i].lpProps) ;
-+-    }
-+-    FreeBuffer(aRowset) ;
-++    if (addressBook == NULL) { addressBook = new nsWabAddressBook ; } 
-++    return addressBook ;
-+ }
-+ 
-+ nsAbWinHelperGuard::nsAbWinHelperGuard(PRUint32 aType)
-+ : mHelper(NULL) 
-+ {
-+     switch(aType) {
-+-    case nsAbWinType_Outlook: mHelper = new nsMapiAddressBook ; break ;
-+-    case nsAbWinType_OutlookExp: mHelper = new nsWabAddressBook ; break ;
-++    case nsAbWinType_Outlook: mHelper = getOutlookAddressBook() ; break ;
-++    case nsAbWinType_OutlookExp: mHelper = getOutlookExpAddressBook() ; break ;
-+     default: break ;
-+     }
-+ }
-+ 
-+ nsAbWinHelperGuard::~nsAbWinHelperGuard(void)
-+ {
-+-    delete mHelper ;
-+ }
-+ 
-+ const char *kOutlookDirectoryScheme = "moz-aboutlookdirectory://" ;
-+--- misc/mozilla/mailnews/addrbook/src/nsAbWinHelper.h	2004-04-17 20:32:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAbWinHelper.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -45,6 +45,24 @@
-+ #include "nsVoidArray.h"
-+ #include "nsXPIDLString.h"
-+  
-++#define PR_SECOND_EMAIL_ADDRESS_A  0x8033001E
-++#define PR_SCREEN_NAME_A           0x805B001E
-++ 
-++
-++// Small utility to ensure release of all MAPI interfaces
-++template <class tInterface> struct nsMapiInterfaceWrapper
-++{
-++    tInterface mInterface ;
-++
-++    nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
-++    ~nsMapiInterfaceWrapper(void) {
-++        if (mInterface ) { mInterface->Release() ; }
-++    }
-++    operator LPUNKNOWN *(void) { return NS_REINTERPRET_CAST(LPUNKNOWN *, &mInterface) ; }
-++    tInterface operator -> (void) const { return mInterface ; }
-++    operator tInterface *(void) { return &mInterface ; }
-++} ;
-++
-+ struct nsMapiEntry
-+ {
-+     ULONG     mByteCount ;
-+@@ -62,14 +80,28 @@
-+ 
-+ struct nsMapiEntryArray 
-+ {
-+-    nsMapiEntry *mEntries ;
-+-    ULONG      mNbEntries ;
-+ 
-+     nsMapiEntryArray(void) ;
-+     ~nsMapiEntryArray(void) ;
-+ 
-+-    const nsMapiEntry& operator [] (int aIndex) const { return mEntries [aIndex] ; }
-++    void  AddItem(nsMapiEntry * aEntries);
-++    void  AddItem(    ULONG     mByteCount , LPENTRYID mEntryId )
-++    {
-++        nsMapiEntry * aEntries=new nsMapiEntry();
-++        aEntries->Assign(mByteCount,mEntryId);
-++        AddItem(aEntries);
-++    }
-++
-++    ULONG        GetSize( void) { return( m_array.Count());}
-++    nsMapiEntry& operator [] (int aIndex)  { return *(nsMapiEntry*)m_array.ElementAt(aIndex); }
-++    nsMapiEntry* ElementAt(int aIndex)  { return (nsMapiEntry*)m_array.ElementAt(aIndex); }
-+     void CleanUp(void) ;
-++    void Remove(nsMapiEntry * aEntries){ m_array.RemoveElement(aEntries); }
-++    void Remove(int index){ m_array.RemoveElementAt(index); }
-++    ULONG IndexOf(nsMapiEntry * aEntries){return m_array.IndexOf(aEntries);};
-++private:
-++    nsVoidArray        m_array;
-++
-+ } ;
-+ 
-+ class nsAbWinHelper
-+@@ -79,7 +111,7 @@
-+     virtual ~nsAbWinHelper(void) ;
-+ 
-+     // Get the top address books
-+-    BOOL GetFolders(nsMapiEntryArray& aFolders) ;
-++    virtual BOOL GetFolders(nsMapiEntryArray& aFolders) =0;
-+     // Get a list of entries for cards/mailing lists in a folder/mailing list
-+     BOOL GetCards(const nsMapiEntry& aParent, LPSRestriction aRestriction, 
-+                   nsMapiEntryArray& aCards) ;
-+@@ -97,18 +129,14 @@
-+     BOOL GetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag, 
-+                               ULONG aNbProperties, nsStringArray& aValues) ;
-+     // Get the value of a MAPI property of type SYSTIME
-+-    BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, 
-++    virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, 
-+                          WORD& aYear, WORD& aMonth, WORD& aDay) ;
-+-    // Get the value of a MAPI property of type LONG
-+-    BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
-+     // Get the value of a MAPI property of type BIN
-+     BOOL GetPropertyBin(const nsMapiEntry& aObject, ULONG aPropertyTag, nsMapiEntry& aValue) ;
-+     // Tests if a container contains an entry
-+     BOOL TestOpenEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-+-    // Delete an entry in the address book
-+-    BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-+     // Set the value of a MAPI property of type string in unicode
-+-    BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag, 
-++    virtual BOOL SetPropertyUString (const nsMapiEntry& aObject, ULONG aPropertyTag, 
-+                              const PRUnichar *aValue) ;
-+     // Same as previous, but with a bunch of properties in one call
-+     BOOL SetPropertiesUString(const nsMapiEntry& aObject, const ULONG *aPropertiesTag,
-+@@ -117,32 +145,44 @@
-+     BOOL SetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag, 
-+                          WORD aYear, WORD aMonth, WORD aDay) ;
-+     // Create entry in the address book
-+-    BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-++    virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-++    // Delete an entry in the address book
-++    virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-+     // Create a distribution list in the address book
-+-    BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-++    virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-+     // Copy an existing entry in the address book
-+-    BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-++    virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-+     // Get a default address book container
-+-    BOOL GetDefaultContainer(nsMapiEntry& aContainer) ;
-++    virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer) =0;
-+     // Is the helper correctly initialised?
-+-    BOOL IsOK(void) const { return mAddressBook != NULL ; }
-++    virtual BOOL IsOK(void) =0;/*const { return mAddressBook != NULL ; }*/
-++
-++    // Get the value of a MAPI property of type LONG
-++    virtual BOOL GetPropertyLong(const nsMapiEntry& aObject, ULONG aPropertyTag, ULONG& aValue) ;
-+ 
-+ protected:
-+     HRESULT mLastError ;
-+-    LPADRBOOK mAddressBook ;
-+     static PRUint32 mEntryCounter ;
-+     static PRLock *mMutex ;
-+ 
-++    virtual HRESULT OpenEntry(ULONG cbEntryID,
-++                    LPENTRYID lpEntryID,
-++                    LPCIID lpInterface,
-++                    ULONG ulFlags,
-++                    ULONG FAR * lpulObjType,
-++                    LPUNKNOWN FAR * lppUnk
-++                    ) = 0;
-++
-+     // Retrieve the contents of a container, with an optional restriction
-+-    BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, 
-+-                     nsMapiEntry **aList, ULONG &aNbElements, ULONG aMapiType) ;
-++    virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, 
-++                     nsMapiEntryArray *aList, ULONG aMapiType) =0;
-+     // Retrieve the values of a set of properties on a MAPI object
-+-    BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-++    virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-+                            ULONG aNbProperties,
-+-                           LPSPropValue& aValues, ULONG& aValueCount) ;
-++                           LPSPropValue& aValues, ULONG& aValueCount) =0;
-+     // Set the values of a set of properties on a MAPI object
-+-    BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-+-                           const LPSPropValue& aValues) ;
-++    virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-++                           LPSPropValue& aValues) =0;
-+     // Clean-up a rowset returned by QueryRows
-+     void MyFreeProws(LPSRowSet aSet) ;
-+     // Allocation of a buffer for transmission to interfaces
-+@@ -150,7 +190,16 @@
-+     // Destruction of a buffer provided by the interfaces
-+     virtual void FreeBuffer(LPVOID aBuffer) = 0 ;
-+ 
-++    static void            CStrToUnicode( const char *pStr, nsString& result);
-++    static void            UnicodeToCStr( const PRUnichar *pStr, nsCString& result);
-++
-+ private:
-++    static int                m_clients;
-++    static PRUnichar *        m_pUniBuff;
-++    static int                m_uniBuffLen;
-++    static char *             m_pCStrBuff;
-++    static int                m_cstrBuffLen;
-++
-+ } ;
-+ 
-+ enum nsAbWinType 
-+@@ -168,6 +217,7 @@
-+ 
-+     nsAbWinHelper *operator ->(void) { return mHelper ; }
-+ 
-++    static void FreeWinAbLibrarys();
-+ private:
-+     nsAbWinHelper *mHelper ;
-+ } ;
-+--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp	2006-12-22 14:51:39.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.cpp	2008-08-20 15:09:45.000000000 +0200
-+@@ -100,6 +100,9 @@
-+ 
-+ static const char kMailListAddressFormat[] = "Address%d";
-+ 
-++extern int getMD5sum(const char * fileName,char * sum);
-++extern int testMD5sum(const char * fileName,char * sum);
-++
-+ static NS_DEFINE_CID(kCMorkFactory, NS_MORK_CID);
-+ 
-+ nsAddrDatabase::nsAddrDatabase()
-+@@ -171,6 +174,7 @@
-+       m_LastRecordKey(0),
-+       m_dbDirectory(nsnull)
-+ {
-++	memset(m_dbMd5Sum,0,33);
-+ }
-+ 
-+ nsAddrDatabase::~nsAddrDatabase()
-+@@ -790,7 +794,11 @@
-+         if (NS_FAILED(ret))
-+           ret = NS_ERROR_FILE_ACCESS_DENIED;
-+       }
-+-      
-++
-++	  ret = getMD5sum(nativeFileName,m_dbMd5Sum);
-++	  if (ret == 1)
-++		ret = NS_ERROR_FAILURE;
-++
-+       nsCRT::free(nativeFileName);
-+       
-+       if (NS_SUCCEEDED(ret) && thumb)
-+@@ -883,6 +891,17 @@
-+ {
-+   nsresult err = NS_OK;
-+   nsIMdbThumb *commitThumb = nsnull;
-++  
-++  const char *pFilename = m_dbName.GetCString(); /* do not free */
-++  char    *nativeFileName = nsCRT::strdup(pFilename);
-++#if defined(XP_PC) || defined(XP_MAC)
-++  UnixToNative(nativeFileName);
-++#endif
-++  if (testMD5sum(nativeFileName,m_dbMd5Sum))
-++  {
-++     nsCRT::free(nativeFileName);
-++     return NS_ERROR_FILE_ACCESS_DENIED;
-++  }
-+ 
-+   if (commitType == nsAddrDBCommitType::kLargeCommit ||
-+       commitType == nsAddrDBCommitType::kSessionCommit)
-+@@ -936,6 +955,10 @@
-+   // ### do something with error, but clear it now because mork errors out on commits.
-+   if (m_mdbEnv)
-+     m_mdbEnv->ClearErrors();
-++  if (NS_SUCCEEDED(err) && getMD5sum(nativeFileName,m_dbMd5Sum))
-++    err = NS_ERROR_FAILURE;
-++  nsCRT::free(nativeFileName);
-++ 
-+   return err;
-+ }
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsAddrDatabase.h	2006-12-22 14:51:39.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsAddrDatabase.h	2008-08-14 16:29:20.000000000 +0200
-+@@ -394,6 +394,7 @@
-+   nsIMdbTable *m_mdbPabTable;
-+   nsIMdbTable *m_mdbDeletedCardsTable;
-+   nsFileSpec		    m_dbName;
-++  char                  m_dbMd5Sum[33];
-+   PRBool				m_mdbTokensInitialized;
-+   nsVoidArray /*<nsIAddrDBListener>*/ *m_ChangeListeners;
-+ 
-+--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp	2004-11-05 16:13:32.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -40,6 +40,22 @@
-+ 
-+ #include "prlog.h"
-+ 
-++static char * stristr(const char *big, const char *little)
-++{
-++    PRUint32 len;
-++
-++    if (!big || !little || !*big || !*little)
-++      return 0;
-++    len = strlen(little);
-++
-++    for( ; *big; big++ )
-++       if(!_strnicmp (big, little, 1) && ! _strnicmp (big, little, len) )
-++          return (char *)big;
-++
-++    return (char *)0;
-++
-++}
-++
-+ #ifdef PR_LOGGING
-+ static PRLogModuleInfo* gMapiAddressBookLog
-+     = PR_NewLogModule("nsMapiAddressBookLog");
-+@@ -47,6 +63,60 @@
-+ 
-+ #define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
-+ 
-++#define    OUTLOOK_EMAIL_DIAPLAY_MAPI_ID    0x00008005  //use to get and set display
-++#define    OUTLOOK_EMAIL1_MAPI_ID           0x00008084  //use to get and set primary email address
-++#define    OUTLOOK_EMAIL2_MAPI_ID           0x00008094  //use to get and set second  email address
-++#define    OUTLOOK_EMAIL_SCREEN_NAME        0x8061001E  //use to get and set screen name
-++#define    OUTLOOK_EMAIL_ORGID              0x00008085  //use to get orginal entryid to add to distlist
-++#define    OUTLOOK_EMAIL_LIST1              0x00008054  //use to get distlist table
-++#define    OUTLOOK_EMAIL_LIST2              0x00008055  //use to set distlist table
-++
-++static const TagMap TagMaps[]={
-++    {PR_DISPLAY_NAME_A,         OUTLOOK_EMAIL_DIAPLAY_MAPI_ID,    PT_STRING8},
-++    {PR_EMAIL_ADDRESS_A,        OUTLOOK_EMAIL1_MAPI_ID,           PT_STRING8},
-++    {PR_SECOND_EMAIL_ADDRESS_A, OUTLOOK_EMAIL2_MAPI_ID,           PT_STRING8},
-++    {PR_SCREEN_NAME_A,          OUTLOOK_EMAIL_SCREEN_NAME,        PT_STRING8}};
-++
-++enum {
-++    ieidPR_ENTRYID = 0,
-++    ieidPR_OBJECT_TYPE,
-++    ieidPR_DISPLAY_NAME,
-++    ieidPR_MESSAGE_CLASS,
-++    ieidPR_STORE_ENTRYID,
-++    ieidPR_MESSAGE_RECIPIENTS,
-++    ieidMax
-++};
-++
-++static const SizedSPropTagArray(ieidMax, ptaEid)=
-++{
-++    ieidMax,
-++    {
-++        PR_ENTRYID,
-++        PR_OBJECT_TYPE,
-++        PR_DISPLAY_NAME,
-++        PR_MESSAGE_CLASS,
-++        PR_STORE_ENTRYID,
-++        PR_MESSAGE_RECIPIENTS
-++    }
-++};
-++
-++enum
-++{
-++    ContentsColumnEntryId = 0,
-++    ContentsColumnObjectType,
-++    ContentsColumnMessageClass,
-++    ContentsColumnsSize
-++} ;
-++
-++static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-++{
-++    ContentsColumnsSize,
-++    {
-++        PR_ENTRYID,
-++        PR_OBJECT_TYPE,
-++        PR_MESSAGE_CLASS
-++    }
-++} ;
-+ 
-+ HMODULE nsMapiAddressBook::mLibrary = NULL ;
-+ PRInt32 nsMapiAddressBook::mLibUsage = 0 ;
-+@@ -59,7 +129,7 @@
-+ BOOL nsMapiAddressBook::mInitialized = FALSE ;
-+ BOOL nsMapiAddressBook::mLogonDone = FALSE ;
-+ LPMAPISESSION nsMapiAddressBook::mRootSession = NULL ;
-+-LPADRBOOK nsMapiAddressBook::mRootBook = NULL ;
-++#define MAPI_NO_COINIT 8
-+ 
-+ BOOL nsMapiAddressBook::LoadMapiLibrary(void)
-+ {
-+@@ -91,7 +161,7 @@
-+     mMAPILogonEx = NS_REINTERPRET_CAST(LPMAPILOGONEX, 
-+         GetProcAddress(mLibrary, "MAPILogonEx")) ;
-+     if (!mMAPILogonEx) { return FALSE ; }
-+-    MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS } ;
-++    MAPIINIT_0 mapiInit = { MAPI_INIT_VERSION, MAPI_MULTITHREAD_NOTIFICATIONS | MAPI_NO_COINIT } ;
-+     HRESULT retCode = mMAPIInitialize(&mapiInit) ;
-+ 
-+     if (HR_FAILED(retCode)) { 
-+@@ -105,22 +175,19 @@
-+                            MAPI_NEW_SESSION,
-+                            &mRootSession) ;
-+     if (HR_FAILED(retCode)) { 
-+-        PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ; return FALSE ;
-++        PRINTF(("Cannot logon to MAPI %08x.\n", retCode)) ;
-++        return FALSE ;
-+     }
-+     mLogonDone = TRUE ;
-+-    retCode = mRootSession->OpenAddressBook(0, NULL, 0, &mRootBook) ;
-+-    if (HR_FAILED(retCode)) { 
-+-        PRINTF(("Cannot open MAPI address book %08x.\n", retCode)) ;
-+-    }
-++
-+     return HR_SUCCEEDED(retCode) ;
-+ }
-+ 
-+ void nsMapiAddressBook::FreeMapiLibrary(void)
-+ {
-+     if (mLibrary) {
-+-        if (-- mLibUsage == 0) {
-++        if (--mLibUsage < 0) {
-+             {
-+-                if (mRootBook) { mRootBook->Release() ; }
-+                 if (mRootSession) {
-+                     if (mLogonDone) { 
-+                         mRootSession->Logoff(NULL, 0, 0) ; 
-+@@ -134,6 +201,7 @@
-+                 }
-+             }  
-+             FreeLibrary(mLibrary) ;
-++            mRootSession = NULL;
-+             mLibrary = NULL ; 
-+         }
-+     }
-+@@ -145,7 +213,6 @@
-+ : nsAbWinHelper()
-+ {
-+     BOOL result = Initialize() ;
-+-
-+     NS_ASSERTION(result == TRUE, "Couldn't initialize Mapi Helper") ;
-+     MOZ_COUNT_CTOR(nsMapiAddressBook) ;
-+ }
-+@@ -153,22 +220,882 @@
-+ nsMapiAddressBook::~nsMapiAddressBook(void)
-+ {
-+     nsAutoLock guard(mMutex) ;
-+-
-++    CleanUpMDB();
-+     FreeMapiLibrary() ;
-+     MOZ_COUNT_DTOR(nsMapiAddressBook) ;
-+ }
-+ 
-++LPSPropValue nsMapiAddressBook::GetMapiProperty( LPMAPIPROP pProp, ULONG tag)
-++{
-++    if (!pProp)
-++        return( NULL);
-++
-++    int    sz = CbNewSPropTagArray( 1);
-++    SPropTagArray *pTag = (SPropTagArray *) new char[sz];
-++    pTag->cValues = 1;
-++    pTag->aulPropTag[0] = tag;
-++    LPSPropValue    lpProp = NULL;
-++    ULONG    cValues = 0;
-++    HRESULT hr = pProp->GetProps( pTag, 0, &cValues, &lpProp);
-++    delete pTag;
-++    if (HR_FAILED( hr) || (cValues != 1)) {
-++        if (lpProp)
-++            mMAPIFreeBuffer( lpProp);
-++        return( NULL);
-++    }
-++    else {
-++        if (PROP_TYPE( lpProp->ulPropTag) == PT_ERROR) {
-++            if (lpProp->Value.l == MAPI_E_NOT_FOUND) {
-++                mMAPIFreeBuffer( lpProp);
-++                lpProp = NULL;
-++            }
-++        }
-++    }
-++
-++    return( lpProp);
-++}
-++BOOL nsMapiAddressBook::GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal)
-++{
-++    if (!pVal)
-++        return( FALSE);
-++    
-++    BOOL bResult = TRUE;
-++    switch (PROP_TYPE(pVal->ulPropTag))
-++    {
-++        case PT_BINARY:
-++            cbEntryId = pVal->Value.bin.cb;
-++            mMAPIAllocateBuffer( cbEntryId, (LPVOID *) &lpEntryId);
-++            memcpy( lpEntryId, pVal->Value.bin.lpb, cbEntryId);
-++        break;
-++
-++        default:
-++            PRINTF(( "EntryId not in BINARY prop value\n"));
-++            bResult = FALSE;
-++        break;
-++    }
-++
-++    if (pVal && delVal)
-++        mMAPIFreeBuffer( pVal);
-++
-++    return( bResult);
-++}
-++
-++BOOL nsMapiAddressBook::HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-++{
-++    LPMDB  lpMsgStore;
-++    ULONG objType=0;
-++    HRESULT             hr;
-++
-++    if (oType == MAPI_MESSAGE)
-++        return FALSE;
-++    if (oType == MAPI_STORE)
-++    {
-++        hr=mRootSession->OpenEntry(
-++                    cb,
-++                    pEntry,
-++                    &IID_IMsgStore,
-++                    MAPI_BEST_ACCESS,
-++                    &objType,
-++                    (IUnknown**)&lpMsgStore);
-++        if (FAILED(hr))
-++        return FALSE ;
-++        //Add MDB to a list to make it can be released when class  destroyed.
-++        //We must leave it openned or else we can't open address store in it.
-++        AddToMDBArray(lpMsgStore);
-++
-++        LPSPropValue    pVal;
-++        pVal=GetMapiProperty(lpMsgStore,PR_IPM_SUBTREE_ENTRYID);
-++        
-++        
-++        if (pVal) {
-++            ULONG            cbEntry;
-++            LPENTRYID        pEntry;
-++            nsMapiInterfaceWrapper<LPMAPICONTAINER> lpSubTree;
-++
-++            if (GetEntryIdFromProp( pVal, cbEntry, pEntry)) {
-++                // Open up the folder!
-++                BOOL bResult = TRUE;
-++                bResult = lpMsgStore->OpenEntry(
-++                                cbEntry,
-++                                pEntry,
-++                                NULL,
-++                                MAPI_BEST_ACCESS,
-++                                &objType,
-++                                lpSubTree);
-++                mMAPIFreeBuffer( pEntry);
-++                if (!bResult && *(LPMAPICONTAINER*)&lpSubTree) {
-++                    // Iterate the subtree with the results going into the folder list
-++                    bResult = IterateHierarchy(*(LPMAPICONTAINER*)&lpSubTree,aFolders);
-++    }
-++                else {
-++                    PRINTF(( "GetStoreFolders: Error opening sub tree.\n"));
-++                }
-++            }
-++            else {
-++                PRINTF(( "GetStoreFolders: Error getting entryID from sub tree property val.\n"));
-++    }
-++        }
-++        else {
-++            PRINTF(( "GetStoreFolders: Error getting sub tree property.\n"));
-++        }
-++    }
-++    else
-++    {
-++        PRINTF(("Type:%d\n",oType));
-++    }
-++
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::IterateHierarchy(LPMAPICONTAINER pFolder,nsMapiEntryArray& aFolders, ULONG flags)
-++{
-++    // flags can be CONVENIENT_DEPTH or 0
-++    // CONVENIENT_DEPTH will return all depths I believe instead
-++    // of just children
-++    HRESULT        hr;
-++    nsMapiInterfaceWrapper<LPMAPITABLE>    lpTable;
-++    hr = pFolder->GetHierarchyTable( CONVENIENT_DEPTH , lpTable);
-++    if (HR_FAILED(hr)) {
-++        PRINTF(( "IterateHierarchy: GetContentsTable failed: 0x%lx, %d\n", (long)hr, (int)hr));
-++        return( FALSE);
-++}
-++
-++    ULONG rowCount;
-++    hr = lpTable->GetRowCount( 0, &rowCount);
-++    if (!rowCount) {
-++        return( TRUE);
-++    }
-++
-++    hr = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-++    if (HR_FAILED(hr)) {
-++        PRINTF(( "IterateHierarchy: SetColumns failed: 0x%lx, %d\n", (long)hr, (int)hr));
-++        return( FALSE);
-++    }
-++
-++    hr = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-++    if (HR_FAILED(hr)) {
-++        PRINTF(( "IterateHierarchy: SeekRow failed: 0x%lx, %d\n", (long)hr, (int)hr));
-++        return( FALSE);
-++    }
-++
-++    int            cNumRows = 0;
-++    LPSRowSet    lpRow;
-++    BOOL        keepGoing = TRUE;
-++    BOOL        bResult = TRUE;
-++    do {
-++        
-++        lpRow = NULL;
-++        hr = lpTable->QueryRows( 1, 0, &lpRow);
-++
-++        if (HR_FAILED(hr))
-++{
-++            PRINTF(( "QueryRows failed: 0x%lx, %d\n", (long)hr, (int)hr));
-++            bResult = FALSE;
-++            break;
-++        }
-++
-++        if (lpRow){
-++            cNumRows = lpRow->cRows;
-++
-++            if (cNumRows) {
-++                LPENTRYID    lpEntry = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-++                ULONG        cb = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-++                ULONG        oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-++                
-++                keepGoing = HandleHierarchyItem( oType, cb, lpEntry,aFolders);
-++
-++            }
-++            MyFreeProws(lpRow);
-++        }
-++
-++    } while ( SUCCEEDED(hr) && cNumRows && lpRow && keepGoing);
-++
-++    
-++    if (bResult && !keepGoing)
-++        bResult = FALSE;
-++
-++    return( bResult);
-++}
-++BOOL nsMapiAddressBook::HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders)
-++{
-++    ULONG objType=0;
-++    if (oType == MAPI_FOLDER)
-++    {
-++        nsMapiInterfaceWrapper<LPMAPICONTAINER> pFolder ;
-++        if (!mRootSession->OpenEntry(
-++                        cb,
-++                        pEntry,
-++                        0,
-++                        MAPI_BEST_ACCESS,
-++                        &objType,
-++                        pFolder))
-++        {
-++            LPSPropValue        pVal;
-++
-++
-++            pVal = GetMapiProperty(*(LPMAPICONTAINER*)&pFolder, PR_CONTAINER_CLASS);
-++            if (pVal)
-++            {
-++                if (strcmp("IPF.Contact",pVal->Value.lpszA) == 0)
-++                {
-++                    SPropValue *currentValue=GetMapiProperty( *(LPMAPICONTAINER*)&pFolder, PR_ENTRYID);
-++                    
-++                    aFolders.AddItem(currentValue->Value.bin.cb,
-++                                  NS_REINTERPRET_CAST(LPENTRYID, currentValue->Value.bin.lpb)) ;
-++
-++                }
-++            }
-++        }
-++    }
-++    else
-++    {
-++        PRINTF(( "GetStoreFolders - HandleHierarchyItem: Unhandled ObjectType: %ld\n", oType));
-++    }
-++
-++    return( TRUE);
-++}
-++
-++
-++BOOL nsMapiAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-++{
-++    aFolders.CleanUp() ;
-++    nsMapiInterfaceWrapper<LPMAPICONTAINER> rootFolder ;
-++    nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-++    ULONG objType = 0 ;
-++    ULONG rowCount = 0 ;
-++
-++    nsMapiInterfaceWrapper<LPMAPITABLE>    lpTable;
-++
-++    mLastError = mRootSession->GetMsgStoresTable( 0, lpTable);
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open MAPI MsgStores %08x.\n", mLastError));
-++        return mLastError;
-++    }
-++
-++    mLastError = lpTable->GetRowCount( 0, &rowCount);
-++
-++    mLastError = lpTable->SetColumns( (LPSPropTagArray)&ptaEid, 0);
-++    if (FAILED(mLastError))
-++        return( mLastError);
-++    mLastError = lpTable->SeekRow( BOOKMARK_BEGINNING, 0, NULL);
-++    if (FAILED(mLastError))
-++        return mLastError;
-++    
-++    int            cNumRows = 0;
-++    LPSRowSet    lpRow;
-++    BOOL        keepGoing = TRUE;
-++    BOOL        bResult = TRUE;
-++    do {
-++        
-++        lpRow = NULL;
-++        mLastError = lpTable->QueryRows( 1, 0, &lpRow);
-++
-++        if (HR_FAILED(mLastError)){
-++            bResult = FALSE;
-++            break;
-++        }
-++
-++        if (lpRow){
-++            cNumRows = lpRow->cRows;
-++
-++            if (cNumRows) {
-++                LPENTRYID    lpEID = (LPENTRYID) lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.lpb;
-++                ULONG        cbEID = lpRow->aRow[0].lpProps[ieidPR_ENTRYID].Value.bin.cb;
-++                ULONG        oType = lpRow->aRow[0].lpProps[ieidPR_OBJECT_TYPE].Value.ul;
-++
-++
-++                keepGoing = HandleContentsItem( oType, cbEID, lpEID,aFolders);
-++            }
-++            MyFreeProws( lpRow);
-++        }
-++
-++    } while ( SUCCEEDED(mLastError) && cNumRows && lpRow && keepGoing);
-++
-++    
-++    return HR_SUCCEEDED(mLastError) ;
-++}
-++BOOL nsMapiAddressBook::CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction)
-++{
-++    ULONG conditionType = 0 ;
-++    ULONG ulResIndex;
-++    if (!aRestriction)
-++        return FALSE;
-++    for (ulResIndex=0;ulResIndex < aRestrictionNum;ulResIndex++)
-++    {
-++        conditionType = aRestriction[ulResIndex].rt;
-++        switch (conditionType) 
-++        {
-++        case RES_EXIST  :
-++            aRestriction[ulResIndex].res.resExist.ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resExist.ulPropTag);
-++            break ;
-++        case RES_BITMASK  :
-++            aRestriction[ulResIndex].res.resBitMask.ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resBitMask.ulPropTag);
-++            break ;
-++        case RES_CONTENT :
-++            aRestriction[ulResIndex].res.resContent.ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.ulPropTag);
-++            aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resContent.lpProp->ulPropTag);
-++            break ;
-++        case RES_PROPERTY :
-++            aRestriction[ulResIndex].res.resProperty.ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.ulPropTag);
-++            aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resProperty.lpProp->ulPropTag);
-++            break ;
-++        case RES_SIZE :
-++            aRestriction[ulResIndex].res.resSize.ulPropTag = 
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resSize.ulPropTag);
-++            break ;
-++        case RES_COMPAREPROPS :
-++            aRestriction[ulResIndex].res.resCompareProps.ulPropTag1 =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag1);
-++            aRestriction[ulResIndex].res.resCompareProps.ulPropTag2 =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resCompareProps.ulPropTag2);
-++            break ;
-++        case RES_NOT :
-++            CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resNot.lpRes);
-++            break;
-++        case RES_AND :
-++            CorrectRestriction(aMapiProp,
-++                                aRestriction[ulResIndex].res.resAnd.cRes,
-++                                aRestriction[ulResIndex].res.resAnd.lpRes);
-++            break;
-++        case RES_OR :
-++            CorrectRestriction(aMapiProp,
-++                                aRestriction[ulResIndex].res.resOr.cRes,
-++                                aRestriction[ulResIndex].res.resOr.lpRes);
-++            break;
-++
-++        case RES_COMMENT :
-++            CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resComment.lpRes);
-++            aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag =
-++                GetRealMapiPropertyTag(aMapiProp,aRestriction[ulResIndex].res.resComment.lpProp->ulPropTag);
-++            break;
-++        case RES_SUBRESTRICTION :
-++            CorrectRestriction(aMapiProp,1,aRestriction[ulResIndex].res.resSub.lpRes);
-++            break;
-++        default:
-++            return FALSE;
-++        }
-++    }
-++    return TRUE;
-++}
-++BOOL nsMapiAddressBook::Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList)
-++{
-++    if (!aRestriction)
-++        return FALSE;
-++
-++    ULONG conditionType = 0 ;
-++
-++    nsMapiEntryArray listOut;
-++    ULONG listindex=0;
-++    
-++    nsMapiEntryArray listDel;
-++    ULONG delindex=0;
-++
-++    ULONG listsize;
-++    ULONG resCount = 0;
-++    ULONG resIndex = 0;
-++
-++    listsize = aList->GetSize();
-++    conditionType = aRestriction->rt;
-++    switch (conditionType) 
-++    {
-++    case RES_EXIST  :
-++    case RES_BITMASK  :
-++    case RES_CONTENT :
-++    case RES_PROPERTY :
-++    case RES_SIZE :
-++    case RES_COMPAREPROPS :
-++    case RES_COMMENT :
-++    case RES_SUBRESTRICTION :
-++        {
-++            while(listindex < aList->GetSize())
-++            {
-++                if (!FilterOnOneRow(aList->ElementAt(listindex),aRestriction))
-++                    aList->Remove(listindex);
-++                else
-++                    listindex++;
-++            }
-++        }
-++        break;
-++    case RES_NOT :
-++        aRestriction->res.resNot.ulReserved = 1;
-++    case RES_AND :
-++    case RES_OR :
-++        {
-++            if (conditionType == RES_OR)
-++            {
-++                for(listindex=0;listindex<aList->GetSize();listindex++)
-++                {
-++                    listDel.AddItem(aList->ElementAt(listindex));
-++                }
-++            }
-++
-++            resCount = aRestriction->res.resAnd.cRes;
-++            //notice that SAndRestriction ,SNotRestriction ,SOrRestriction
-++            //use the same struct
-++            for (resIndex = 0;resIndex < resCount;resIndex++)
-++            {
-++                //can't call listOut.CleanUp() here
-++                //because it will destroy all Element too
-++                while(listOut.GetSize())
-++                {
-++                    listOut.Remove(0);
-++                }
-++
-++                for(listindex=0;listindex<aList->GetSize();listindex++)
-++                {
-++                    listOut.AddItem(aList->ElementAt(listindex));
-++                }
-++
-++                Filter(&aRestriction->res.resAnd.lpRes[resIndex],&listOut);
-++                if (conditionType == RES_NOT)
-++                {
-++                    for(listindex=0;listindex<listOut.GetSize();listindex++)
-++                    {
-++                        aList->Remove(listOut.ElementAt(listindex));
-++                    }
-++                }
-++                else if (conditionType == RES_AND )
-++                {
-++                    for(listindex=0;listindex<listOut.GetSize();listindex++)
-++                    {
-++                        if (!aList->IndexOf(listOut.ElementAt(listindex)))
-++                        {
-++                            aList->Remove(listOut.ElementAt(listindex));
-++                        }
-++                    }
-++                }
-++                else if (conditionType == RES_OR )
-++                {
-++                    for(listindex=0;listindex<listOut.GetSize();listindex++)
-++                    {
-++                        listDel.Remove(listOut.ElementAt(listindex));
-++                    }
-++                    if (listDel.GetSize() == 0)
-++                    {
-++                        break;
-++                    }
-++                }
-++            }
-++            if (conditionType == RES_OR)
-++            {
-++                for(listindex=0;listindex<listDel.GetSize();listindex++)
-++                {
-++                    aList->Remove(listDel.ElementAt(listindex));
-++                }
-++            }
-++        }
-++
-++    }
-++    while(listDel.GetSize())
-++    {
-++        listDel.Remove(0);
-++    }
-++    while(listOut.GetSize())
-++    {
-++        listOut.Remove(0);
-++    }
-++
-++
-++    return TRUE;
-++}
-++
-++BOOL nsMapiAddressBook::FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction)
-++{
-++    LPMAPIPROP object ;
-++    ULONG objType = 0 ;
-++    LPSPropValue realValue = NULL ;
-++    LPSPropValue resValue  = NULL ;
-++     ULONG valueCount = 0 ;
-++   
-++    mLastError = OpenEntry(aEntry->mByteCount, aEntry->mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, 
-++                                         (IUnknown **)&object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    
-++    ULONG conditionType = 0 ;
-++    conditionType = aRestriction->rt;
-++
-++    switch (conditionType) 
-++    {
-++    case RES_EXIST  :
-++        if (!GetMAPIProperties(*aEntry,&aRestriction->res.resExist.ulPropTag,1,realValue,valueCount)) 
-++            return FALSE;
-++        resValue = NULL;
-++        break ;
-++    case RES_CONTENT :
-++        if (!GetMAPIProperties(*aEntry,&aRestriction->res.resContent.ulPropTag,1,realValue,valueCount)) 
-++            return FALSE;
-++        resValue = aRestriction->res.resContent.lpProp;
-++        break ;
-++    case RES_PROPERTY :
-++        if (!GetMAPIProperties(*aEntry,&aRestriction->res.resProperty.ulPropTag,1,realValue,valueCount)) 
-++            return FALSE;
-++        resValue = aRestriction->res.resProperty.lpProp;
-++        break ;
-++    case RES_BITMASK  :
-++        return FALSE; //not support
-++        break ;
-++    case RES_SIZE :
-++        return FALSE;//not been used now
-++        break ;
-++    case RES_COMPAREPROPS :
-++        return FALSE;//not been used now
-++        break ;
-++    case RES_NOT :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_AND :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_OR :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_COMMENT :
-++        return TRUE;//comment
-++        break;
-++    case RES_SUBRESTRICTION :
-++        return FALSE;//not been used now
-++        break ;
-++}
-++    return AtomyFilter(aRestriction,realValue,resValue);
-++
-++}
-++
-++BOOL nsMapiAddressBook::AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue)
-++{
-++    ULONG conditionType = 0 ;
-++    conditionType = aRestriction->rt;
-++
-++    BOOL bTagEq=(aRealValue &&
-++                PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) && 
-++                aFilterValue;
-++                // PROP_TYPE( aRealValue->ulPropTag ) == PROP_TYPE( aFilterValue->ulPropTag ));
-++    switch (conditionType) 
-++    {
-++    case RES_EXIST  :
-++        return (aRealValue && PROP_TYPE( aRealValue->ulPropTag ) != PT_ERROR) ;
-++        break ;
-++    case RES_CONTENT :
-++        if (bTagEq)
-++        {
-++            switch(aRestriction->res.resContent.ulFuzzyLevel)
-++            {
-++            case FL_FULLSTRING :
-++                return !stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA);
-++                break;
-++            case FL_PREFIX :
-++                return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == aRealValue->Value.lpszA;
-++                break;
-++            case FL_SUBSTRING :
-++            default:
-++                return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-++                break;
-++            }
-++        }
-++        return FALSE;
-++        break ;
-++    case RES_PROPERTY :
-++        if (bTagEq)
-++        {
-++            switch(aRestriction->res.resProperty.relop)
-++            {
-++            case RELOP_GE :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) >= 0;
-++                break;
-++            case RELOP_GT :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) > 0;
-++                break;
-++            case RELOP_LE :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) <= 0;
-++                break;
-++            case RELOP_LT :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) < 0;
-++                break;
-++            case RELOP_EQ :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) == 0;
-++                break;
-++            case RELOP_NE :
-++                return stricmp(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != 0;
-++                break;
-++            case RELOP_RE :
-++            default:
-++                return stristr(aRealValue->Value.lpszA,aFilterValue->Value.lpszA) != NULL;
-++                break;
-++
-++            }
-++        }
-++        return FALSE;
-++        break ;
-++    case RES_BITMASK  :
-++        return FALSE; //not support
-++        break ;
-++    case RES_SIZE :
-++        return FALSE;//not been used now
-++        break ;
-++    case RES_COMPAREPROPS :
-++        return FALSE;//not been used now
-++        break ;
-++    case RES_NOT :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_AND :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_OR :
-++        return FALSE;//not need care here
-++        break;
-++    case RES_COMMENT :
-++        return TRUE;//comment
-++        break;
-++    case RES_SUBRESTRICTION :
-++        return FALSE;//not been used now
-++        break ;
-++    }
-++    return TRUE;
-++}
-++
-++BOOL nsMapiAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-++                                nsMapiEntryArray *aList, ULONG aMapiType)
-++{
-++    if (aList)
-++        aList->CleanUp();
-++
-++    nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-++    nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-++    ULONG objType = 0 ;
-++    ULONG rowCount = 0 ;
-++
-++
-++    nsMapiInterfaceWrapper<LPMAPIPROP> pFolder;
-++    nsCString cs;
-++    aParent.ToString(cs);
-++    
-++    mLastError = OpenEntry(aParent.mByteCount,     aParent.mEntryId,
-++                    0, MAPI_BEST_ACCESS, &objType, pFolder);
-++    if (HR_FAILED(mLastError))
-++    {
-++        PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-++        return FALSE;
-++    }
-++
-++
-++    LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&pFolder,PR_MESSAGE_CLASS);
-++    if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-++    {
-++        HRESULT             hr;
-++        LPSPropValue aValue = NULL ;
-++        ULONG aValueCount = 0 ;
-++
-++        LPSPropTagArray properties = NULL ;
-++        mMAPIAllocateBuffer(CbNewSPropTagArray(1),
-++                           (void **)&properties);
-++        properties->cValues = 1;
-++        properties->aulPropTag [0] = GetEmailPropertyTag(*(LPMAPIPROP*)&pFolder,OUTLOOK_EMAIL_LIST1);
-++        hr = pFolder->GetProps(properties, 0, &aValueCount, &aValue) ;
-++
-++        SBinaryArray *sa=&aValue->Value.MVbin;
-++
-++        LPENTRYID    lpEID;
-++        ULONG        cbEID;
-++        
-++        ULONG idx;
-++        nsMapiEntry testEntry;
-++        nsCString sClass;
-++        for (idx=0;sa->lpbin && idx<sa->cValues ;idx++)
-++        {
-++            lpEID= (LPENTRYID) sa->lpbin[idx].lpb;
-++            cbEID = sa->lpbin[idx].cb;
-++            testEntry.Assign(sa->lpbin[idx].cb,NS_REINTERPRET_CAST(LPENTRYID,sa->lpbin[idx].lpb));
-++            
-++            if (GetPropertyString(testEntry,PR_MESSAGE_CLASS,sClass)) //Error get property
-++            {
-++                aList->AddItem(cbEID,lpEID);
-++            }
-++        }
-++        Filter(aRestriction,aList);
-++    }
-++    else
-++    {
-++        if (aRestriction && !CorrectRestriction(*(LPMAPICONTAINER*)&pFolder,1,aRestriction))
-++            return FALSE;
-++        mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIContainer, MAPI_BEST_ACCESS, &objType,
-++                                         parent) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++
-++        mLastError = parent->GetContentsTable(0, contents) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-++            return FALSE;
-++        }
-++        if (aRestriction) {
-++            mLastError = contents->Restrict(aRestriction, TBL_BATCH) ;
-++            if (HR_FAILED(mLastError)) {
-++                PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-++                return FALSE ;
-++            }
-++        }
-++        mLastError = contents->SetColumns((LPSPropTagArray)&ContentsColumns, 0);
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++        mLastError = contents->GetRowCount(0, &rowCount) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++        do {
-++            LPSRowSet rowSet = NULL ;
-++
-++            rowCount = 0 ;
-++            mLastError = contents->QueryRows(1, 0, &rowSet) ;
-++            if (HR_FAILED(mLastError)) {
-++                PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-++                return FALSE ;
-++            }
-++            rowCount = rowSet->cRows ;
-++            if (rowCount > 0 && aList)
-++            {
-++                if (aMapiType == 0 || rowSet->aRow->lpProps[ContentsColumnObjectType].Value.ul == aMapiType)
-++                {
-++                    SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-++                    aList->AddItem(currentValue.Value.bin.cb,
-++                        NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-++                }
-++                else if (aMapiType == MAPI_DISTLIST)
-++                {
-++                    if (strcmp("IPM.DistList",rowSet->aRow->lpProps[ContentsColumnMessageClass].Value.lpszA)==0)
-++                    {
-++                        SPropValue& currentValue = rowSet->aRow->lpProps[ContentsColumnEntryId] ;
-++                        aList->AddItem(currentValue.Value.bin.cb,
-++                            NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-++
-++                    }
-++}
-++
-++            }
-++            MyFreeProws(rowSet) ;
-++        } while (rowCount > 0) ;
-++    }
-++
-++
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags,
-++                                      ULONG aNbProperties, LPSPropValue& aValue,
-++                                      ULONG& aValueCount)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-++    ULONG objType = 0 ;
-++    LPSPropTagArray properties = NULL ;
-++    ULONG i = 0 ;
-++    
-++    mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType, 
-++                                         object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-++                   NS_REINTERPRET_CAST(void **, &properties));
-++    properties->cValues = aNbProperties ;
-++    for (i = 0 ; i < aNbProperties ; ++ i)
-++    {
-++        properties->aulPropTag [i] = GetRealMapiPropertyTag(*(LPMAPIPROP*)&object,aPropertyTags [i],TRUE);
-++    }
-++    mLastError = object->GetProps(properties, 0 , &aValueCount, &aValue) ;
-++    FreeBuffer(properties) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Error get props %08x.\n", mLastError)) ;
-++    }
-++    return HR_SUCCEEDED(mLastError);
-++}
-++
-++BOOL nsMapiAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-++                                      LPSPropValue& aValues)
-++{
-++    nsMapiInterfaceWrapper<LPMESSAGE> object;
-++    ULONG objType = 0 ;
-++    LPSPropProblemArray problems = NULL ;
-++    ULONG i = 0 ;
-++
-++    LPMDB lpMsgStore=GetMsgStore(aObject);
-++    
-++    if (!lpMsgStore)
-++    {
-++        return FALSE;
-++    }
-++    mLastError = lpMsgStore->OpenEntry(aObject.mByteCount, aObject.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS  , &objType, 
-++                                         object) ;
-++    lpMsgStore->Release();
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    for (i = 0 ; i < aNbProperties ; ++ i)
-++    {
-++        aValues[i].ulPropTag = GetRealMapiPropertyTag(*(LPMESSAGE*)&object,aValues[i].ulPropTag,TRUE);
-++    }
-++    mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    if (problems) {
-++        for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-++            PRINTF(("Problem %d: index %d code %08x.\n", i,
-++                problems->aProblem [i].ulIndex,
-++                problems->aProblem [i].scode)) ;
-++        }
-++    }
-++    mLastError = object->SaveChanges(0) ;
-++    if (MAPI_E_OBJECT_CHANGED == mLastError)
-++    {
-++        mLastError = object->SaveChanges(FORCE_SAVE ) ;
-++    }
-++    return HR_SUCCEEDED(mLastError) ;
-++}
-++
-++BOOL nsMapiAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-++{
-++    return FALSE ;
-++}
-++
-++BOOL nsMapiAddressBook::IsOK(void)
-++{
-++    return mRootSession && mLibUsage;
-++}
-++
-+ BOOL nsMapiAddressBook::Initialize(void)
-+ {
-+-    if (mAddressBook) { return TRUE ; }
-++
-+     nsAutoLock guard(mMutex) ;
-+ 
-+     if (!LoadMapiLibrary()) {
-+         PRINTF(("Cannot load library.\n")) ;
-+         return FALSE ;
-+     }
-+-    mAddressBook = mRootBook ; 
-+-    return TRUE ;
-++    return TRUE;
-+ }
-+ 
-+ void nsMapiAddressBook::AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer)
-+@@ -181,7 +1108,803 @@
-+     mMAPIFreeBuffer(aBuffer) ;
-+ }
-+ 
-++ULONG nsMapiAddressBook::GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID)
-++{
-++    static GUID emailGUID =
-++    {
-++       0x00062004, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46
-++    };
-++
-++
-++  MAPINAMEID mapiNameID;
-++  mapiNameID.lpguid = &emailGUID;
-++  mapiNameID.ulKind = MNID_ID;
-++  mapiNameID.Kind.lID = nameID;
-++
-++  LPMAPINAMEID lpMapiNames = &mapiNameID;
-++  LPSPropTagArray lpMailTagArray = NULL;
-++
-++  HRESULT result = lpProp->GetIDsFromNames(1L, &lpMapiNames, 0, &lpMailTagArray);
-++  if (result == S_OK)
-++  {
-++    ULONG lTag = lpMailTagArray->aulPropTag[0];
-++    mMAPIFreeBuffer(lpMailTagArray);
-++    return lTag;
-++  }
-++  return 0L;
-++}
-++ULONG nsMapiAddressBook::GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest)
-++{
-++    LPSPropValue addr;
-++    ULONG        upRealTag=aPropertyTag;
-++    ULONG        lSize=sizeof(TagMaps) / sizeof(TagMap);
-++    
-++    for(int i=0; i<lSize; i++)
-++    {
-++        if (TagMaps[i].AddressTag == aPropertyTag)
-++        {
-++
-++            ULONG kPriEmailColumn=GetEmailPropertyTag(lpProp,TagMaps[i].NameID);
-++            if (aTest)
-++            {
-++                if (PR_DISPLAY_NAME_A == aPropertyTag)
-++                {
-++                    //We need not change PR_DISPLAY_NAME_A tag if we are not using an address
-++                    LPSPropValue msgClass=GetMapiProperty(lpProp,PR_MESSAGE_CLASS);
-++                    if (msgClass && !strcmp("IPM.Contact",msgClass->Value.lpszA))
-++                    {
-++                        if (kPriEmailColumn)
-++                            upRealTag  = kPriEmailColumn | TagMaps[i].TypeMask;
-++                    }
-++                    else
-++                    {
-++                        FreeBuffer(msgClass);
-++                        upRealTag = aPropertyTag;
-++                    }
-++                }
-++                else //PR_DISPLAY_NAME_A == aPropertyTag
-++                {
-++                    addr=GetMapiProperty(lpProp,aPropertyTag);
-++                    if (!addr || PROP_TYPE( addr->ulPropTag) == PT_ERROR ||
-++                        addr->Value.l == MAPI_E_NOT_FOUND)
-++                    {
-++                        if (kPriEmailColumn)
-++                            upRealTag  = kPriEmailColumn | TagMaps[i].TypeMask;
-++                    }
-++                }
-++            }
-++            else //aTest
-++            {
-++                if (kPriEmailColumn)
-++                    upRealTag  = kPriEmailColumn | TagMaps[i].TypeMask;
-++            }
-++      
-++            break; //we find it,exit
-++        }
-++    }
-++
-++    return upRealTag;
-++}
-++
-++BOOL nsMapiAddressBook::GetPropertyLong(const nsMapiEntry& aObject,
-++                                    ULONG aPropertyTag,
-++                                    ULONG& aValue)
-++{
-++    aValue = 0 ;
-++    LPSPropValue values = NULL ;
-++    ULONG valueCount = 0 ;
-++
-++    if (PR_OBJECT_TYPE == aPropertyTag)
-++    {
-++        nsMapiInterfaceWrapper<LPMAPIFOLDER> pFolder ;
-++        ULONG objType=0;
-++        mLastError = OpenEntry(aObject.mByteCount,aObject.mEntryId,
-++                         NULL,MAPI_BEST_ACCESS,&objType, pFolder);
-++        if (HR_FAILED(mLastError))
-++        {
-++            PRINTF(("Cannot open folder %08x.\n", mLastError)) ;
-++            return FALSE;
-++        }
-++        LPSPropValue msgClass=GetMapiProperty(*(LPMAPIFOLDER*)&pFolder,PR_MESSAGE_CLASS);
-++        if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-++        {
-++            FreeBuffer(msgClass);
-++            aValue = MAPI_DISTLIST;
-++            return TRUE;
-++        }
-++    }
-+ 
-++    if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount)) 
-++        return FALSE ;
-+ 
-++    if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_LONG) {
-++        aValue = values->Value.ul ;
-++    }
-++    FreeBuffer(values) ;
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-++                                    WORD& aYear, WORD& aMonth, WORD& aDay)
-++{
-++    aYear = 0;
-++    aMonth = 0;
-++    aDay = 0;
-++    LPSPropValue values = NULL ;
-++    ULONG valueCount = 0 ;
-++
-++    if (!GetMAPIProperties(aObject, &aPropertyTag, 1, values, valueCount))
-++        return FALSE ;
-++
-++    if (valueCount == 1 && values && PROP_TYPE(values->ulPropTag) == PT_SYSTIME) {
-++        SYSTEMTIME readableTime ;
-++        FILETIME   localTime ;
-++        FileTimeToLocalFileTime(&values->Value.ft,&localTime);
-++        if (FileTimeToSystemTime(&localTime, &readableTime)) {
-++            aYear = readableTime.wYear ;
-++            aMonth = readableTime.wMonth ;
-++            aDay = readableTime.wDay ;
-++        }
-++    }
-++    FreeBuffer(values) ;
-++    return TRUE ;
-++}
-++
-++HRESULT     nsMapiAddressBook::OpenEntry(ULONG cbEntryID,
-++                    LPENTRYID lpEntryID,
-++                    LPCIID lpInterface,
-++                    ULONG ulFlags,
-++                    ULONG FAR * lpulObjType,
-++                    LPUNKNOWN FAR * lppUnk
-++                    )
-++{
-++
-++    int err;
-++    HRESULT rv;
-++    __try
-++    {
-++        rv=mRootSession->OpenEntry(cbEntryID,
-++                    lpEntryID,
-++                    lpInterface,
-++                    ulFlags ,
-++                    lpulObjType,
-++                    lppUnk
-++                    );
-++    }__except(err)
-++    {
-++        return (-1);
-++    }
-++
-++    if (HR_FAILED(rv) && !m_MDBArray.Count())
-++    {
-++        //There are no openned Message store,so we have to open them all
-++        nsMapiEntryArray aFolders;
-++        if (GetFolders(aFolders))
-++        {
-++            __try
-++            {
-++                rv=mRootSession->OpenEntry(cbEntryID,
-++                            lpEntryID,
-++                            lpInterface,
-++                            ulFlags ,
-++                            lpulObjType,
-++                            lppUnk
-++                            );
-++            }__except(err)
-++            {
-++                return (-1);
-++            }
-++        }
-++    }
-++    return rv;
-++
-++}
-++
-++BOOL nsMapiAddressBook::AddEntryToList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-++    ULONG objType = 0 ;
-++
-++    nsMapiEntry parentEntry;
-++    if (!GetEntryParent(aDistlist,parentEntry))
-++        return FALSE;
-++    
-++    LPMDB lpMsgStore=GetMsgStore(parentEntry);
-++    
-++    if (!lpMsgStore)
-++        return FALSE;
-++    mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         container) ;
-++    lpMsgStore->Release();
-++
-++    if (HR_FAILED(mLastError))       
-++        return FALSE ;
-++    
-++
-++    /*
-++    When add mail address to distlist,Mapi need update 2 tag.
-++    */
-++    //update OUTLOOK_EMAIL_LIST1
-++    ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-++    SBinaryArray oldChilds;
-++    LPSBinary    bins=NULL;
-++    SBinaryArray newChilds;
-++    LPSPropValue oldChildValue = NULL ;
-++    ULONG valueCount = 0 ;
-++
-++    if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-++    {
-++        PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-++        return FALSE;
-++    }
-++
-++    if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-++    {
-++        oldChilds = oldChildValue->Value.MVbin;
-++        newChilds.cValues=oldChilds.cValues + 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++        for (ULONG i=0;i<oldChilds.cValues;i++)
-++        {
-++            newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-++            newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-++        }
-++    }
-++    else
-++    {
-++        newChilds.cValues = 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++    }
-++
-++    nsMapiEntry orgEntryID;
-++    if (!GetPropertyBin(aNewEntry,
-++        GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_ORGID) | PT_BINARY,
-++        orgEntryID))
-++    {
-++        return FALSE;
-++    }
-++    newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-++    newChilds.lpbin[newChilds.cValues-1].cb  = orgEntryID.mByteCount;
-++
-++    SPropValue childs;
-++    childs.ulPropTag = listTag;
-++    childs.Value.MVbin = newChilds;
-++
-++    LPSPropProblemArray problems = NULL ;
-++    mLastError = container->SetProps(1, &childs, &problems) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    //update OUTLOOK_EMAIL_LIST2
-++    listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-++    if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-++    {
-++        PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-++        return FALSE;
-++    }
-++    
-++    if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-++    {
-++        oldChilds = oldChildValue->Value.MVbin;
-++        newChilds.cValues=oldChilds.cValues + 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++        for (ULONG i=0;i<oldChilds.cValues;i++)
-++        {
-++            newChilds.lpbin[i].lpb = oldChilds.lpbin[i].lpb;
-++            newChilds.lpbin[i].cb = oldChilds.lpbin[i].cb;
-++        }
-++    }
-++    else
-++    {
-++        newChilds.cValues = 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++    }
-++
-++    /*
-++    Need more work here.
-++    There are two kind of mail address in outlook DistList.
-++    One is sample,not include in parent folder.
-++    The other is a link to a unattached address in parents folders.
-++    Currently we can only add first kind of address to a outlook distlist.
-++    */
-++    
-++    newChilds.lpbin[newChilds.cValues-1].lpb = NS_REINTERPRET_CAST(unsigned char *, orgEntryID.mEntryId);
-++    newChilds.lpbin[newChilds.cValues-1].cb  = orgEntryID.mByteCount;
-++
-++    childs.ulPropTag = listTag;
-++    childs.Value.MVbin = newChilds;
-++
-++    mLastError = container->SetProps(1, &childs, &problems) ;
-++    if (HR_FAILED(mLastError))
-++    {
-++        PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    mMAPIFreeBuffer(bins);
-++
-++    mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    return TRUE ;
-++}
-++BOOL nsMapiAddressBook::DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-++    ULONG objType = 0 ;
-++
-++    nsMapiEntry parentEntry;
-++    if (!GetEntryParent(aDistlist,parentEntry))
-++        return FALSE;
-++
-++    LPMDB lpMsgStore=GetMsgStore(parentEntry);
-++    if (!lpMsgStore)
-++        return FALSE;
-++
-++    mLastError = lpMsgStore->OpenEntry(aDistlist.mByteCount, aDistlist.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         container) ;
-++    lpMsgStore->Release();
-++
-++    if (HR_FAILED(mLastError))
-++        return FALSE ;
-++    /*
-++    When delete mail address from distlist,Mapi need update 2 tag.
-++    */
-++    //update OUTLOOK_EMAIL_LIST1
-++    ULONG listTag=GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST1) | PT_MV_BINARY;
-++
-++    SBinaryArray oldChilds;
-++    LPSBinary    bins=NULL;
-++    SBinaryArray newChilds;
-++    LPSPropValue oldChildValue = NULL ;
-++    ULONG valueCount = 0 ;
-++
-++    newChilds.lpbin=NULL;
-++
-++    ULONG lDeleteEntry=0;
-++    ULONG newIndex=0;
-++    ULONG oldIndex=0;
-++    if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-++    {
-++        PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-++        return FALSE;
-++    }
-++    
-++    if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-++    {
-++        oldChilds = oldChildValue->Value.MVbin;
-++        newChilds.cValues=oldChilds.cValues - 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++        for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-++        {
-++            if ( oldChilds.lpbin[oldIndex].cb == aNewEntry.mByteCount &&
-++                !memcmp((void*)(oldChilds.lpbin[oldIndex].lpb+4),
-++                        (void*)(aNewEntry.mEntryId->ab),
-++                        oldChilds.lpbin[oldIndex].cb-4))
-++            {
-++                lDeleteEntry=oldIndex;
-++            }
-++            else
-++            {
-++                newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-++                newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-++                newIndex++;
-++            }
-++        }
-++    }
-++    else
-++        return FALSE;
-++
-++
-++    SPropValue childs;
-++    LPSPropProblemArray problems = NULL ;
-++    
-++    if (newChilds.cValues == 0)
-++    {
-++        SPropTagArray delTags;
-++        delTags.cValues = 1;
-++        delTags.aulPropTag[0] = listTag;
-++
-++        mLastError = container->DeleteProps(&delTags, &problems) ;
-++    }
-++    else
-++    {
-++        childs.ulPropTag = listTag;
-++        childs.Value.MVbin = newChilds;
-++        mLastError = container->SetProps(1, &childs, &problems) ;
-++    }
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    //update OUTLOOK_EMAIL_LIST2
-++    listTag = GetEmailPropertyTag(*(LPMAPIPROP*)&container,OUTLOOK_EMAIL_LIST2) | PT_MV_BINARY;
-++    if (!GetMAPIProperties(aDistlist, &listTag, 1, oldChildValue, valueCount))
-++    {
-++        PRINTF(("Cannot get old childs %08x.\n", mLastError)) ;
-++        return FALSE;
-++    }
-++
-++    newIndex=0;
-++    if (! (oldChildValue->Value.l == MAPI_E_NOT_FOUND))
-++    {
-++        oldChilds = oldChildValue->Value.MVbin;
-++        newChilds.cValues=oldChilds.cValues - 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++        for (oldIndex=0;oldIndex<oldChilds.cValues;oldIndex++)
-++        {
-++            if (oldIndex != lDeleteEntry)
-++            {
-++                newChilds.lpbin[newIndex].lpb = oldChilds.lpbin[oldIndex].lpb;
-++                newChilds.lpbin[newIndex].cb = oldChilds.lpbin[oldIndex].cb;
-++                newIndex++;
-++            }
-++        }
-++    }
-++    else
-++    {
-++        newChilds.cValues = 1;
-++        mMAPIAllocateBuffer(sizeof(SBinary) * newChilds.cValues,(void**)& bins);
-++        newChilds.lpbin = bins;
-++    }
-+ 
-+ 
-++    
-++    if (newChilds.cValues == 0)
-++    {
-++        SPropTagArray delTags;
-++        delTags.cValues = 1;
-++        delTags.aulPropTag[0] = listTag;
-++
-++        mLastError = container->DeleteProps(&delTags, &problems) ;
-++    }
-++    else
-++    {
-++        childs.ulPropTag = listTag;
-++        childs.Value.MVbin = newChilds;
-++        mLastError = container->SetProps(1, &childs, &problems) ;
-++    }
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set childs %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    mMAPIFreeBuffer(bins);
-++
-++    mLastError = container->SaveChanges(KEEP_OPEN_READONLY) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-++    ULONG objType = 0 ;
-++    mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         (IUnknown **)&object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    SPropValue *parentID=GetMapiProperty(*(LPMAPIPROP*)&object, PR_PARENT_ENTRYID);
-++
-++    if (parentID->Value.l == MAPI_E_NOT_FOUND)
-++        return FALSE;
-++    aParentEntry.Assign(parentID->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, parentID->Value.bin.lpb));
-++    return TRUE;
-++}
-++BOOL nsMapiAddressBook::CreateEntryInList(const nsMapiEntry& aDistlist, nsMapiEntry& aNewEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> container ;
-++    ULONG objType = 0 ;
-++
-++    nsMapiEntry parentEntry;
-++    if (!GetEntryParent(aDistlist,parentEntry))
-++    {
-++        return FALSE;
-++    }
-++    nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-++    if (!CreateEntry(parentEntry,aNewEntry)) //Create a entry in parent folder
-++        return FALSE;
-++
-++    return AddEntryToList(aDistlist,aNewEntry);
-++}
-++
-++BOOL nsMapiAddressBook::CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-++    ULONG objType = 0 ;
-++
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object;
-++    mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return NULL ;
-++    }
-++    LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-++
-++    if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-++        return CreateEntryInList(aParent,aNewEntry);        //Create entry in DistList
-++    
-++    LPMDB lpMsgStore=GetMsgStore(aParent);
-++    
-++    if (!lpMsgStore)
-++        return FALSE;
-++    
-++    mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-++                                         container) ;
-++    lpMsgStore->Release();
-++
-++    if (HR_FAILED(mLastError))
-++        return FALSE;
-++    
-++    nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-++
-++    mLastError = container->CreateMessage(&IID_IMessage,
-++                                        0,
-++                                        newEntry) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    SPropValue messageclass ;
-++    LPSPropProblemArray problems = NULL ;
-++    nsCString tempName ;
-++
-++    messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-++    tempName.Assign("IPM.Contact") ;
-++    messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-++    mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set temporary name %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    SPropTagArray property ;
-++    LPSPropValue value = NULL ;
-++    ULONG valueCount = 0 ;
-++
-++    property.cValues = 1 ;
-++    property.aulPropTag [0] = PR_ENTRYID ;
-++    mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-++    if (HR_FAILED(mLastError) || valueCount != 1) {
-++        PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-++    FreeBuffer(value) ;
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-++    ULONG objType = 0 ;
-++
-++    LPMDB lpMsgStore=GetMsgStore(aParent);
-++    if (!lpMsgStore)
-++        return FALSE;
-++    mLastError = lpMsgStore->OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-++                                         container) ;
-++    lpMsgStore->Release();
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    nsMapiInterfaceWrapper<LPMESSAGE> newEntry ;
-++    mLastError = container->CreateMessage(&IID_IMAPIProp,
-++                                        0,
-++                                        newEntry) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    SPropValue messageclass ;
-++    LPSPropProblemArray problems = NULL ;
-++    nsCString tempName ;
-++
-++    messageclass.ulPropTag = PR_MESSAGE_CLASS_A ;
-++    tempName.Assign("IPM.DistList") ;
-++    messageclass.Value.lpszA = NS_CONST_CAST(char *, tempName.get()) ;
-++    mLastError = newEntry->SetProps(1, &messageclass, &problems) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set PR_MESSAGE_CLASS_A %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    mLastError = newEntry->SaveChanges(KEEP_OPEN_READONLY) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot commit new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    ULONG valueCount = 0 ;
-++    SPropTagArray property ;
-++    LPSPropValue value = NULL ;
-++
-++    property.cValues = 1 ;
-++    property.aulPropTag [0] = PR_ENTRYID ;
-++    mLastError = newEntry->GetProps(&property, 0, &valueCount, &value) ;
-++    if (HR_FAILED(mLastError) || valueCount != 1) {
-++        PRINTF(("Cannot get entry id %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    aNewEntry.Assign(value->Value.bin.cb, NS_REINTERPRET_CAST(LPENTRYID, value->Value.bin.lpb)) ;
-++
-++    FreeBuffer(value) ;
-++    return TRUE ;
-++}
-++
-++
-++BOOL nsMapiAddressBook::CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource,
-++                              nsMapiEntry& aTarget)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-++    nsMapiInterfaceWrapper<LPMAPIFOLDER> targetFolder ;
-++    ULONG objType = 0 ;
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object;
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-++
-++    if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-++    {
-++        //Add Entry To DistList
-++        if (!AddEntryToList(aContainer,aSource))
-++            return FALSE;
-++        aTarget.Assign(aSource.mByteCount,aSource.mEntryId);
-++        return TRUE;
-++    }
-++
-++    SBinary entry ;
-++    SBinaryArray entryArray ;
-++
-++    entry.cb = aSource.mByteCount ;
-++    entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aSource.mEntryId) ;
-++    entryArray.cValues = 1 ;
-++    entryArray.lpbin = &entry ;
-++ 
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++                                         &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-++                                         container) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    mLastError = OpenEntry(aTarget.mByteCount, aTarget.mEntryId,
-++                                         &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType,
-++                                         targetFolder) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open Target folder %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++
-++    nsMapiInterfaceWrapper<LPMAPIPROP> newEntry ;
-++
-++    mLastError = container->CopyMessages(&entryArray,
-++                                        &IID_IMessage,
-++                                        (void*)&targetFolder,
-++                                        0,
-++                                        NULL,
-++                                        NULL) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot create new entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    return TRUE ;
-++}
-++
-++BOOL nsMapiAddressBook::DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIFOLDER> container ;
-++    ULONG objType = 0 ;
-++    SBinary entry ;
-++    SBinaryArray entryArray ;
-++
-++    
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object;
-++    mLastError = OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS, &objType,
-++                                         object) ;
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    LPSPropValue msgClass=GetMapiProperty(*(LPMAPIPROP*)&object,PR_MESSAGE_CLASS);
-++
-++    if (msgClass && strcmp("IPM.DistList",msgClass->Value.lpszA) == 0)
-++        return DeleteEntryFromList(aContainer,aEntry);      //Delete Entry from DistList
-++
-++    LPMDB lpMsgStore=GetMsgStore(aContainer);
-++    if (!lpMsgStore)
-++        return FALSE;
-++
-++    mLastError = lpMsgStore->OpenEntry(aContainer.mByteCount, aContainer.mEntryId,
-++                                         &IID_IMAPIFolder, MAPI_BEST_ACCESS, &objType, 
-++                                         container) ;
-++    lpMsgStore->Release();
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open container %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    entry.cb = aEntry.mByteCount ;
-++    entry.lpb = NS_REINTERPRET_CAST(LPBYTE, aEntry.mEntryId) ;
-++    entryArray.cValues = 1 ;
-++    entryArray.lpbin = &entry ;
-++    mLastError = container->DeleteMessages(&entryArray, 0,0,0) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot delete entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    return TRUE ;
-++}
-++
-++//Use to open message store in write mode
-++LPMDB nsMapiAddressBook::GetMsgStore(const nsMapiEntry& aEntry)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object;
-++    ULONG objType=0;
-++
-++    mLastError = OpenEntry(aEntry.mByteCount, aEntry.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_BEST_ACCESS  , &objType, 
-++                                         object) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return NULL ;
-++    }
-++    SPropValue *svMsgSore=GetMapiProperty( *(LPMAPIPROP*)&object, PR_STORE_ENTRYID);;
-++
-++    LPMDB  lpMsgStore=NULL;
-++    mLastError=mRootSession->OpenMsgStore(0,
-++                              svMsgSore->Value.bin.cb,
-++                              (ENTRYID*)svMsgSore->Value.bin.lpb,
-++                              &IID_IMsgStore,
-++                              MAPI_BEST_ACCESS  ,
-++                              &lpMsgStore);
-++
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open MsgStore %08x.\n", mLastError)) ;
-++        return NULL ;
-++    }
-++    
-++    return lpMsgStore;
-++}
-+--- misc/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h	2004-04-17 20:32:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsMapiAddressBook.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -40,12 +40,42 @@
-+ 
-+ #include "nsAbWinHelper.h"
-+  
-++struct TagMap
-++{
-++    ULONG AddressTag;
-++    ULONG NameID;
-++    ULONG TypeMask;
-++};
-+ class nsMapiAddressBook : public nsAbWinHelper
-+ {
-+ public :
-+     nsMapiAddressBook(void) ;
-+     virtual ~nsMapiAddressBook(void) ;
-+ 
-++    // Get the top address books
-++    virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-++
-++    // Get a default address book container
-++    virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-++    // Is the helper correctly initialised?
-++    virtual BOOL IsOK(void);
-++    virtual BOOL GetPropertyLong(const nsMapiEntry& aObject,
-++                                    ULONG aPropertyTag,
-++                                    ULONG& aValue);
-++    // Get the value of a MAPI property of type SYSTIME
-++    virtual BOOL GetPropertyDate(const nsMapiEntry& aObject, ULONG aPropertyTag,
-++                         WORD& aYear, WORD& aMonth, WORD& aDay);
-++    // Create entry in the address book
-++    virtual BOOL CreateEntry(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-++    // Delete an entry in the address book
-++    virtual BOOL DeleteEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aEntry) ;
-++    // Create a distribution list in the address book
-++    virtual BOOL CreateDistList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry) ;
-++    // Copy an existing entry in the address book
-++    virtual BOOL CopyEntry(const nsMapiEntry& aContainer, const nsMapiEntry& aSource, nsMapiEntry& aTarget) ;
-++
-++    static void FreeMapiLibrary(void) ;
-++
-+ protected :
-+     // Class members to handle the library/entry points
-+     static HMODULE mLibrary ;
-+@@ -67,19 +97,77 @@
-+     static BOOL mInitialized ;
-+     static BOOL mLogonDone ;
-+     static LPMAPISESSION mRootSession ;
-+-    static LPADRBOOK mRootBook ;
-++
-+ 
-+     // Load the MAPI environment
-+     BOOL Initialize(void) ;
-++
-++    virtual HRESULT OpenEntry(ULONG cbEntryID,
-++                    LPENTRYID lpEntryID,
-++                    LPCIID lpInterface,
-++                    ULONG ulFlags,
-++                    ULONG FAR * lpulObjType,
-++                    LPUNKNOWN FAR * lppUnk
-++                    );
-++ 
-++
-++    // Retrieve the contents of a container, with an optional restriction
-++    virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, 
-++                     nsMapiEntryArray *aList, ULONG aMapiType) ;
-++    // Retrieve the values of a set of properties on a MAPI object
-++    virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-++                           ULONG aNbProperties,
-++                           LPSPropValue& aValues, ULONG& aValueCount) ;
-++    // Set the values of a set of properties on a MAPI object
-++    virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-++                           LPSPropValue& aValues);
-++
-++
-+     // Allocation of a buffer for transmission to interfaces
-+     virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
-+     // Destruction of a buffer provided by the interfaces
-+     virtual void FreeBuffer(LPVOID aBuffer) ;
-+     // Library management 
-+     static BOOL LoadMapiLibrary(void) ;
-+-    static void FreeMapiLibrary(void) ;
-++
-++    BOOL HandleContentsItem(ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-++    LPSPropValue GetMapiProperty( LPMAPIPROP pProp, ULONG tag);
-++    BOOL GetEntryIdFromProp( LPSPropValue pVal, ULONG& cbEntryId, LPENTRYID& lpEntryId, BOOL delVal=FALSE);
-++    BOOL HandleHierarchyItem( ULONG oType, ULONG cb, LPENTRYID pEntry,nsMapiEntryArray& aFolders);
-++    BOOL IterateHierarchy(IMAPIContainer * pFolder, nsMapiEntryArray& aFolders,ULONG flags=0);
-++    ULONG GetEmailPropertyTag(LPMAPIPROP lpProp, LONG nameID);
-++    ULONG GetRealMapiPropertyTag(LPMAPIPROP lpProp, LONG aPropertyTag,BOOL aTest=FALSE);
-++    LPMDB GetMsgStore(const nsMapiEntry& aEntry);
-++    BOOL CreateEntryInList(const nsMapiEntry& aParent, nsMapiEntry& aNewEntry);
-++    BOOL AddEntryToList(const nsMapiEntry& aParent,const nsMapiEntry& aNewEntry);
-++    BOOL DeleteEntryFromList(const nsMapiEntry& aDistlist, const nsMapiEntry& aNewEntry);
-++    BOOL GetEntryParent(const nsMapiEntry& aParent, nsMapiEntry& aParentEntry);
-++    BOOL CorrectRestriction(const LPMAPIPROP aMapiProp,ULONG aRestrictionNum, LPSRestriction aRestriction);
-++
-++    //filter
-++    BOOL Filter( LPSRestriction aRestriction,nsMapiEntryArray * aList);
-++    BOOL FilterOnOneRow(nsMapiEntry *aEntry,LPSRestriction aRestriction);
-++    BOOL AtomyFilter(LPSRestriction aRestriction,LPSPropValue aRealValue,LPSPropValue aFilterValue);
-++
-++    void AddToMDBArray(LPMDB aMDB)
-++    {
-++        m_MDBArray.AppendElement(aMDB);
-++    }
-++    void CleanUpMDB()
-++    {
-++        LPMDB mdb;
-++        for (int i = 0; i < m_MDBArray.Count(); i++)
-++        {
-++            mdb = (LPMDB)m_MDBArray.ElementAt(i);
-++            mdb->Release();
-++        }
-++        m_MDBArray.Clear();
-++    }
-+ 
-+ private :
-++    //use to keep all openned MsgStore,if we not open a message store,we can't open any thing on it
-++    //so we have to kill message stores openned
-++    nsVoidArray        m_MDBArray; 
-+ } ;
-+ 
-+ #endif // nsMapiAddressBook_h___
-+--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp	2004-11-05 16:13:32.000000000 +0100
-++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -46,6 +46,22 @@
-+ 
-+ #define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
-+ 
-++enum
-++{
-++    ContentsColumnEntryId = 0,
-++    ContentsColumnObjectType,
-++    ContentsColumnsSize
-++} ;
-++
-++static const SizedSPropTagArray(ContentsColumnsSize, ContentsColumns) =
-++{
-++    ContentsColumnsSize,
-++    {
-++        PR_ENTRYID,
-++        PR_OBJECT_TYPE
-++    }
-++} ;
-++
-+ HMODULE nsWabAddressBook::mLibrary = NULL ;
-+ PRInt32 nsWabAddressBook::mLibUsage = 0 ;
-+ LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
-+@@ -94,7 +110,7 @@
-+ MOZ_DECL_CTOR_COUNTER(nsWabAddressBook)
-+ 
-+ nsWabAddressBook::nsWabAddressBook(void)
-+-: nsAbWinHelper()
-++: nsAbWinHelper(),mAddressBook(NULL)
-+ {
-+     BOOL result = Initialize() ;
-+ 
-+@@ -109,9 +125,254 @@
-+     MOZ_COUNT_DTOR(nsWabAddressBook) ;
-+ }
-+ 
-++BOOL nsWabAddressBook::GetFolders(nsMapiEntryArray& aFolders)
-++{
-++    aFolders.CleanUp() ;
-++    nsMapiInterfaceWrapper<LPABCONT> rootFolder ;
-++    nsMapiInterfaceWrapper<LPMAPITABLE> folders ;
-++    ULONG objType = 0 ;
-++    ULONG rowCount = 0 ;
-++    SRestriction restriction ;
-++    SPropTagArray folderColumns ;
-++
-++    mLastError = OpenEntry(0, NULL, NULL, 0, &objType,
-++                                         rootFolder);
-++    if (HR_FAILED(mLastError)){
-++        PRINTF(("Cannot open root %08x.\n", mLastError));
-++        return FALSE;
-++    }
-++    mLastError = rootFolder->GetHierarchyTable(0, folders);
-++    if (HR_FAILED(mLastError)){
-++        PRINTF(("Cannot get hierarchy %08x.\n", mLastError));
-++        return FALSE;
-++    }
-++    // We only take into account modifiable containers,
-++    // otherwise, we end up with all the directory services...
-++    restriction.rt = RES_BITMASK ;
-++    restriction.res.resBitMask.ulPropTag = PR_CONTAINER_FLAGS ;
-++    restriction.res.resBitMask.relBMR = BMR_NEZ ;
-++    restriction.res.resBitMask.ulMask = AB_MODIFIABLE ;
-++    mLastError = folders->Restrict(&restriction, 0) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot restrict table %08x.\n", mLastError)) ;
-++    }
-++    folderColumns.cValues = 1 ;
-++    folderColumns.aulPropTag [0] = PR_ENTRYID ;
-++    mLastError = folders->SetColumns(&folderColumns, 0) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    mLastError = folders->GetRowCount(0, &rowCount) ;
-++    if (HR_SUCCEEDED(mLastError)) {
-++        do {
-++            LPSRowSet rowSet = NULL ;
-++
-++            rowCount = 0 ;
-++            mLastError = folders->QueryRows(1, 0, &rowSet) ;
-++            if (HR_SUCCEEDED(mLastError)) {
-++                rowCount = rowSet->cRows ;
-++                if (rowCount > 0) {
-++                    SPropValue& currentValue = rowSet->aRow->lpProps [0] ;
-++                    
-++                    aFolders.AddItem(currentValue.Value.bin.cb,
-++                                   NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-++                }
-++                MyFreeProws(rowSet) ;
-++            }
-++            else {
-++                PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-++            }
-++        } while (rowCount > 0) ;
-++    }
-++    return HR_SUCCEEDED(mLastError) ;
-++}
-++BOOL nsWabAddressBook::GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction,
-++                                nsMapiEntryArray *aList, ULONG aMapiType)
-++{
-++    if (aList) { aList->CleanUp(); }
-++    nsMapiInterfaceWrapper<LPMAPICONTAINER> parent ;
-++    nsMapiInterfaceWrapper<LPMAPITABLE> contents ;
-++    ULONG objType = 0 ;
-++    ULONG rowCount = 0 ;
-++
-++    mLastError = OpenEntry(aParent.mByteCount, aParent.mEntryId,
-++                                         &IID_IMAPIContainer, 0, &objType,
-++                                         parent) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open parent %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    // Here, flags for WAB and MAPI could be different, so this works
-++    // only as long as we don't want to use any flag in GetContentsTable
-++    mLastError = parent->GetContentsTable(0, contents) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot get contents %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    if (aRestriction) {
-++        mLastError = contents->Restrict(aRestriction, 0) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot set restriction %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++    }
-++    int entryId = ContentsColumnEntryId ;
-++    int objectType = ContentsColumnObjectType ;
-++
-++    if (aRestriction) 
-++    {
-++        LPSPropTagArray allColumns = NULL ;
-++
-++        mLastError = contents->QueryColumns(TBL_ALL_COLUMNS, &allColumns) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot query columns %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++
-++        for (unsigned int j = 0 ; j < allColumns->cValues ; ++ j) {
-++            if (allColumns->aulPropTag [j] == PR_ENTRYID) { 
-++                entryId = j ; 
-++            }
-++            else if (allColumns->aulPropTag [j] == PR_OBJECT_TYPE) { 
-++                objectType = j ; 
-++            }
-++        }
-++        mLastError = contents->SetColumns(allColumns, 0) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++        FreeBuffer(allColumns) ;
-++    }
-++    else
-++    {
-++
-++        mLastError = contents->SetColumns((LPSPropTagArray) &ContentsColumns, 0) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot set columns %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++     }    
-++    
-++    mLastError = contents->GetRowCount(0, &rowCount) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot get result count %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    do {
-++        LPSRowSet rowSet = NULL ;
-++        
-++        rowCount = 0 ;
-++        mLastError = contents->QueryRows(1, 0, &rowSet) ;
-++        if (HR_FAILED(mLastError)) {
-++            PRINTF(("Cannot query rows %08x.\n", mLastError)) ;
-++            return FALSE ;
-++        }
-++        rowCount = rowSet->cRows ;
-++        if (rowCount > 0 &&
-++            (aMapiType == 0 ||
-++            rowSet->aRow->lpProps[objectType].Value.ul == aMapiType)) {
-++            if (aList) {
-++                SPropValue& currentValue = rowSet->aRow->lpProps[entryId] ;
-++                
-++                aList->AddItem(currentValue.Value.bin.cb,
-++                    NS_REINTERPRET_CAST(LPENTRYID, currentValue.Value.bin.lpb)) ;
-++                
-++            }
-++        }
-++        MyFreeProws(rowSet) ;
-++    } while (rowCount > 0) ;
-++    return TRUE ;
-++}
-++
-++BOOL nsWabAddressBook::GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-++                                      ULONG aNbProperties, LPSPropValue& aValue, 
-++                                      ULONG& aValueCount)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-++    IMsgStore * mdb=NULL;
-++    ULONG objType = 0 ;
-++    LPSPropTagArray properties = NULL ;
-++    ULONG i = 0 ;
-++    
-++    mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-++                                         &IID_IMAPIProp, 0, &objType, 
-++                                         object) ;
-++
-++    if (HR_FAILED(mLastError)){
-++        PRINTF(("Cannot open entry %08x.\n", mLastError));
-++        return FALSE;
-++    }
-++    AllocateBuffer(CbNewSPropTagArray(aNbProperties),
-++                   NS_REINTERPRET_CAST(void **, &properties));
-++    properties->cValues = aNbProperties;
-++    for (i = 0 ; i < aNbProperties ; ++ i) {
-++        properties->aulPropTag [i] = aPropertyTags [i];
-++    }
-++    mLastError = object->GetProps(properties, 0, &aValueCount, &aValue);
-++    FreeBuffer(properties);
-++    if (HR_FAILED(mLastError)){
-++        PRINTF(("Cannot get props %08x.\n", mLastError));
-++    }
-++    return HR_SUCCEEDED(mLastError) ;
-++}
-++
-++BOOL nsWabAddressBook::SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-++                                      LPSPropValue& aValues)
-++{
-++    nsMapiInterfaceWrapper<LPMAPIPROP> object ;
-++    ULONG objType = 0 ;
-++    LPSPropProblemArray problems = NULL ;
-++
-++    mLastError = OpenEntry(aObject.mByteCount, aObject.mEntryId,
-++                                         &IID_IMAPIProp, MAPI_MODIFY, &objType, 
-++                                         object) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot open entry %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    mLastError = object->SetProps(aNbProperties, aValues, &problems) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot update the object %08x.\n", mLastError)) ;
-++        return FALSE ;
-++    }
-++    if (problems) {
-++        for (ULONG i = 0 ; i < problems->cProblem ; ++ i) {
-++            PRINTF(("Problem %d: index %d code %08x.\n", i,
-++                problems->aProblem [i].ulIndex,
-++                problems->aProblem [i].scode));
-++        }
-++    }
-++    mLastError = object->SaveChanges(0) ;
-++    if (HR_FAILED(mLastError)) {
-++        PRINTF(("Cannot commit changes %08x.\n", mLastError)) ;
-++    }
-++    return HR_SUCCEEDED(mLastError) ;
-++}
-++
-++BOOL nsWabAddressBook::GetDefaultContainer(nsMapiEntry& aContainer)
-++{
-++    LPENTRYID entryId = NULL;
-++    ULONG byteCount = 0;
-++
-++    mLastError = mAddressBook->GetPAB(&byteCount, &entryId);
-++    if (HR_FAILED(mLastError)){
-++        PRINTF(("Cannot get PAB %08x.\n", mLastError));
-++        return FALSE;
-++    }
-++    aContainer.Assign(byteCount, entryId);
-++    FreeBuffer(entryId) ;
-++    return TRUE ;
-++}
-++
-++BOOL nsWabAddressBook::IsOK(void)
-++{
-++    return mAddressBook != NULL ;
-++}
-++
-+ BOOL nsWabAddressBook::Initialize(void)
-+ {
-+-    if (mAddressBook) { return TRUE ; }
-+     nsAutoLock guard(mMutex) ;
-+ 
-+     if (!LoadWabLibrary()) {
-+--- misc/mozilla/mailnews/addrbook/src/nsWabAddressBook.h	2004-04-17 20:32:14.000000000 +0200
-++++ misc/build/mozilla/mailnews/addrbook/src/nsWabAddressBook.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -47,6 +47,15 @@
-+     nsWabAddressBook(void) ;
-+     virtual ~nsWabAddressBook(void) ;
-+ 
-++    // Get the top address books
-++    virtual BOOL GetFolders(nsMapiEntryArray& aFolders);
-++
-++    // Get a default address book container
-++    virtual BOOL GetDefaultContainer(nsMapiEntry& aContainer);
-++    // Is the helper correctly initialised?
-++    virtual BOOL IsOK(void);
-++    static void FreeWabLibrary(void) ;
-++
-+ protected :
-+     // Session and address book that will be shared by all instances
-+     // (see nsMapiAddressBook.h for details)
-+@@ -57,15 +66,46 @@
-+     static HMODULE mLibrary ;
-+     static LPWABOPEN mWABOpen ;
-+ 
-++    LPADRBOOK mAddressBook ;
-++
-+     // Load the WAB environment
-+     BOOL Initialize(void) ;
-++
-++    virtual HRESULT OpenEntry(ULONG cbEntryID,
-++                    LPENTRYID lpEntryID,
-++                    LPCIID lpInterface,
-++                    ULONG ulFlags,
-++                    ULONG FAR * lpulObjType,
-++                    LPUNKNOWN FAR * lppUnk
-++                    )
-++    {
-++        return mAddressBook->OpenEntry(cbEntryID,
-++                    lpEntryID,
-++                    lpInterface,
-++                    ulFlags,
-++                    lpulObjType,
-++                    lppUnk
-++                    );
-++    }
-++ 
-++
-++    // Retrieve the contents of a container, with an optional restriction
-++    virtual BOOL GetContents(const nsMapiEntry& aParent, LPSRestriction aRestriction, 
-++                     nsMapiEntryArray *aList, ULONG aMapiType) ;
-++    // Retrieve the values of a set of properties on a MAPI object
-++    virtual BOOL GetMAPIProperties(const nsMapiEntry& aObject, const ULONG *aPropertyTags, 
-++                           ULONG aNbProperties,
-++                           LPSPropValue& aValues, ULONG& aValueCount) ;
-++    // Set the values of a set of properties on a MAPI object
-++    virtual BOOL SetMAPIProperties(const nsMapiEntry& aObject, ULONG aNbProperties, 
-++                           LPSPropValue& aValues) ;
-++
-+     // Allocation of a buffer for transmission to interfaces
-+     virtual void AllocateBuffer(ULONG aByteCount, LPVOID *aBuffer) ;
-+     // Destruction of a buffer provided by the interfaces
-+     virtual void FreeBuffer(LPVOID aBuffer) ;
-+     // Manage the library
-+     static BOOL LoadWabLibrary(void) ;
-+-    static void FreeWabLibrary(void) ;
-+ 
-+ private :
-+ } ;
-+--- misc/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp	2007-05-03 03:39:41.000000000 +0200
-++++ misc/build/mozilla/mailnews/base/src/nsMessengerWinIntegration.cpp	2008-08-20 16:46:58.000000000 +0200
-+@@ -819,8 +819,13 @@
-+   
-+   if (mUseWideCharBiffIcon)
-+   {
-+-    ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
-+-    if (wcslen(aToolTipString) >= toolTipBufSize)
-++#ifdef __MINGW32__
-++      ::wcsncpy( sWideBiffIconData.szTip, NS_REINTERPRET_CAST(LPCWSTR, aToolTipString), toolTipBufSize);
-++      if (wcslen(NS_REINTERPRET_CAST(LPCWSTR, aToolTipString)) >= toolTipBufSize)
-++#else
-++      ::wcsncpy( sWideBiffIconData.szTip, aToolTipString, toolTipBufSize);
-++      if (wcslen(aToolTipString) >= toolTipBufSize)
-++#endif
-+       sWideBiffIconData.szTip[toolTipBufSize - 1] = 0;
-+   }
-+   else
-+@@ -862,7 +867,11 @@
-+   // now we need to copy over any left over tool tip strings
-+   if (sWideBiffIconData.szTip)
-+   {
-++#ifdef __MINGW32__
-++    const PRUnichar * oldTooltipString = reinterpret_cast<PRUnichar*>(sWideBiffIconData.szTip);
-++#else
-+     const PRUnichar * oldTooltipString = sWideBiffIconData.szTip;
-++#endif
-+     SetToolTipStringOnIconData(oldTooltipString);
-+   }
-+ }
-+@@ -1040,7 +1049,11 @@
-+                                                   registryUnreadMailCountKey, 
-+                                                   sizeof(registryUnreadMailCountKey))))
-+   {
-++#ifdef __MINGW32__
-++    if (wcscmp(registryUnreadMailCountKey, NS_REINTERPRET_CAST(LPCWSTR, currentUnreadMailCountKey.get()))==0) {
-++#else
-+     if (wcscmp(registryUnreadMailCountKey, currentUnreadMailCountKey.get())==0) {
-++#endif
-+       nsAutoString deleteKey;
-+       deleteKey.Assign(NS_LITERAL_STRING(UNREADMAILNODEKEY).get());
-+       deleteKey.Append(currentUnreadMailCountKey.get());
-+@@ -1108,9 +1121,15 @@
-+     }
-+ 
-+     // Write the info into the registry
-++#ifdef __MINGW32__
-++    HRESULT hr = mSHSetUnreadMailCount(NS_REINTERPRET_CAST(LPCWSTR, pBuffer.get()), 
-++                                       mCurrentUnreadCount, 
-++                                       NS_REINTERPRET_CAST(LPCWSTR, commandLinerForAppLaunch.get()));
-++#else
-+     HRESULT hr = mSHSetUnreadMailCount(pBuffer.get(), 
-+                                        mCurrentUnreadCount, 
-+                                        commandLinerForAppLaunch.get());
-++#endif
-+   }
-+ 
-+   // do this last
-+--- misc/mozilla/modules/libpref/src/Makefile.in	2006-02-03 15:44:52.000000000 +0100
-++++ misc/build/mozilla/modules/libpref/src/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -91,7 +91,7 @@
-+ PREF_JS_EXPORTS	+= $(srcdir)/init/non-shared.txt
-+ endif
-+ 
-+-EXTRA_DSO_LDOPTS = \
-++EXTRA_DSO_LDOPTS += \
-+ 		$(LIBS_DIR) \
-+ 		$(MOZ_JS_LIBS) \
-+ 		$(MOZ_COMPONENT_LIBS) \
-+--- misc/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp	2005-07-20 20:31:42.000000000 +0200
-++++ misc/build/mozilla/netwerk/protocol/http/src/nsHttpConnectionMgr.cpp	2008-08-20 15:45:06.000000000 +0200
-+@@ -277,7 +277,7 @@
-+ nsresult
-+ nsHttpConnectionMgr::UpdateParam(nsParamName name, PRUint16 value)
-+ {
-+-    PRUint32 param = (PRUint32(name) << 16) | PRUint32(value);
-++    PRUint32 param = (NS_PTR_TO_INT32(name) << 16) | NS_PTR_TO_INT32(value);
-+     return PostEvent(&nsHttpConnectionMgr::OnMsgUpdateParam, 0, (void *) param);
-+ }
-+ 
-+--- misc/mozilla/nsprpub/build/cygwin-wrapper	2006-12-22 14:47:17.000000000 +0100
-++++ misc/build/mozilla/nsprpub/build/cygwin-wrapper	2008-08-14 16:22:21.000000000 +0200
-+@@ -1,4 +1,4 @@
-+-#!/bin/sh
-++#!/bin/bash
-+ #
-+ # Stupid wrapper to avoid win32 dospath/cygdrive issues
-+ # Try not to spawn programs from within this file. If the stuff in here looks royally 
-+--- misc/mozilla/nsprpub/config/autoconf.mk.in	2006-12-22 14:47:17.000000000 +0100
-++++ misc/build/mozilla/nsprpub/config/autoconf.mk.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -22,6 +22,7 @@
-+ RELEASE_OBJDIR_NAME = @RELEASE_OBJDIR_NAME@
-+ OBJDIR_NAME	= @OBJDIR_NAME@
-+ OBJDIR		= @OBJDIR@
-++LIB_PREFIX	= @LIB_PREFIX@
-+ OBJ_SUFFIX	= @OBJ_SUFFIX@
-+ LIB_SUFFIX	= @LIB_SUFFIX@
-+ DLL_SUFFIX	= @DLL_SUFFIX@
-+--- misc/mozilla/nsprpub/config/rules.mk	2006-12-22 14:47:17.000000000 +0100
-++++ misc/build/mozilla/nsprpub/config/rules.mk	2008-12-12 10:09:34.437500000 +0100
-+@@ -340,6 +340,10 @@
-+ else	# AIX 4.1
-+ ifeq ($(NS_USE_GCC)_$(OS_ARCH),_WINNT)
-+ 	$(LINK_DLL) -MAP $(DLLBASE) $(DLL_LIBS) $(EXTRA_LIBS) $(OBJS) $(RES)
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
-++		rm -f $@.manifest; \
-++	fi
-+ else
-+ ifeq ($(MOZ_OS2_TOOLS),VACPP)
-+ 	$(LINK_DLL) $(DLLBASE) $(OBJS) $(OS_LIBS) $(EXTRA_LIBS) $(MAPFILE)
-+--- misc/mozilla/nsprpub/configure	2008-01-29 20:27:43.000000000 +0100
-++++ misc/build/mozilla/nsprpub/configure	2008-08-14 16:22:21.000000000 +0200
-+@@ -2737,6 +2737,7 @@
-+ LIB_SUFFIX=a
-+ DLL_SUFFIX=so
-+ ASM_SUFFIX=s
-++LIB_PREFIX=lib
-+ MKSHLIB='$(LD) $(DSO_LDOPTS) -o $@'
-+ PR_MD_ASFILES=
-+ PR_MD_CSRCS=
-+@@ -3475,7 +3476,7 @@
-+ EOF
-+ 
-+     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-+-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
-++    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
-+     if test "$MOZ_OBJFORMAT" = "elf"; then
-+         DLL_SUFFIX=so
-+     else
-+@@ -3941,7 +3942,7 @@
-+         CC="$CC -mno-cygwin"
-+         CXX="$CXX -mno-cygwin"
-+         DLL_SUFFIX=dll
-+-        MKSHLIB='$(CC) -shared -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
-++        MKSHLIB='$(CC) -shared -Wl,--enable-runtime-pseudo-reloc -Wl,--export-all-symbols -Wl,--out-implib -Wl,$(IMPORT_LIBRARY) $(DLLBASE) -o $(subst $(OBJDIR)/,,$(SHARED_LIBRARY))'
-+         RC=$WINDRES
-+         # Use temp file for windres (bug 213281)
-+         RCFLAGS='-O coff --use-temp-file'
-+@@ -5766,6 +5767,7 @@
-+     CC="\$(CYGWIN_WRAPPER) $CC"
-+     CXX="\$(CYGWIN_WRAPPER) $CXX"
-+     RC="\$(CYGWIN_WRAPPER) $RC"
-++    LD="\$(CYGWIN_WRAPPER) $LD"
-+     ;;
-+ esac
-+ 
-+@@ -6127,6 +6129,7 @@
-+ s%@LIB_SUFFIX@%$LIB_SUFFIX%g
-+ s%@DLL_SUFFIX@%$DLL_SUFFIX%g
-+ s%@ASM_SUFFIX@%$ASM_SUFFIX%g
-++s%@LIB_PREFIX@%$LIB_PREFIX%g
-+ s%@MKSHLIB@%$MKSHLIB%g
-+ s%@DSO_CFLAGS@%$DSO_CFLAGS%g
-+ s%@DSO_LDOPTS@%$DSO_LDOPTS%g
-+--- misc/mozilla/nsprpub/configure.in	2008-01-29 20:27:44.000000000 +0100
-++++ misc/build/mozilla/nsprpub/configure.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -1137,7 +1137,7 @@
-+     AC_DEFINE(HAVE_BSD_FLOCK)
-+     AC_DEFINE(HAVE_SOCKLEN_T)
-+     CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
-+-    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
-++    MOZ_OBJFORMAT=`test -x /usr/bin/objformat && /usr/bin/objformat || echo elf`
-+     if test "$MOZ_OBJFORMAT" = "elf"; then
-+         DLL_SUFFIX=so
-+     else
-+--- misc/mozilla/nsprpub/lib/ds/Makefile.in	2006-12-22 14:47:17.000000000 +0100
-++++ misc/build/mozilla/nsprpub/lib/ds/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -79,18 +79,22 @@
-+ OS_LIBS = -lc
-+ endif
-+ 
-++ifeq ($(OS_ARCH),Linux)
-++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-++endif
-++
-+ ifeq ($(OS_ARCH),SunOS)
-+ OS_LIBS = -lc
-+ MAPFILE = $(OBJDIR)/pldsmap.sun
-+ GARBAGE += $(MAPFILE)
-+ ifdef NS_USE_GCC
-+ ifdef GCC_USE_GNU_LD
-+-MKSHLIB += -Wl,--version-script,$(MAPFILE)
-++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ else
-+-MKSHLIB += -Wl,-M,$(MAPFILE)
-++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
-+ endif
-+ else
-+-MKSHLIB += -M $(MAPFILE)
-++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
-+ endif
-+ # The -R '$ORIGIN' linker option instructs this library to search for its
-+ # dependencies in the same directory where it resides.
-+--- misc/mozilla/nsprpub/lib/libc/src/Makefile.in	2006-12-22 14:47:17.000000000 +0100
-++++ misc/build/mozilla/nsprpub/lib/libc/src/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -89,18 +89,22 @@
-+ OS_LIBS = -lc
-+ endif
-+ 
-++ifeq ($(OS_ARCH),Linux)
-++MKSHLIB += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-++endif
-++
-+ ifeq ($(OS_ARCH),SunOS)
-+ OS_LIBS = -lc
-+ MAPFILE = $(OBJDIR)/plcmap.sun
-+ GARBAGE += $(MAPFILE)
-+ ifdef NS_USE_GCC
-+ ifdef GCC_USE_GNU_LD
-+-MKSHLIB += -Wl,--version-script,$(MAPFILE)
-++MKSHLIB += -Wl,--version-script,$(MAPFILE) -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ else
-+-MKSHLIB += -Wl,-M,$(MAPFILE)
-++MKSHLIB += -Wl,-M,$(MAPFILE) -Wl,-R,'$$ORIGIN'
-+ endif
-+ else
-+-MKSHLIB += -M $(MAPFILE)
-++MKSHLIB += -M $(MAPFILE) -Wl,-R,'$$ORIGIN'
-+ endif
-+ # The -R '$ORIGIN' linker option instructs this library to search for its
-+ # dependencies in the same directory where it resides.
-+--- misc/mozilla/nsprpub/pr/include/prtypes.h	2006-12-22 14:47:19.000000000 +0100
-++++ misc/build/mozilla/nsprpub/pr/include/prtypes.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -472,7 +472,7 @@
-+ 
-+ #ifndef __PRUNICHAR__
-+ #define __PRUNICHAR__
-+-#if defined(WIN32) || defined(XP_MAC)
-++#if !defined(__MINGW32__) && (defined(WIN32) || defined(XP_MAC))
-+ typedef wchar_t PRUnichar;
-+ #else
-+ typedef PRUint16 PRUnichar;
-+--- misc/mozilla/nsprpub/pr/src/misc/prnetdb.c	2006-12-22 14:47:27.000000000 +0100
-++++ misc/build/mozilla/nsprpub/pr/src/misc/prnetdb.c	2008-08-14 16:22:21.000000000 +0200
-+@@ -113,7 +113,8 @@
-+ #define _PR_HAVE_5_ARG_GETPROTO_R
-+ #endif
-+ 
-+-#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2)
-++#if (defined(LINUX) && defined(__GLIBC__) && __GLIBC__ >= 2) || \
-++	(defined(__FreeBSD__) && __FreeBSD_version > 601103)
-+ #define _PR_HAVE_GETPROTO_R
-+ #define _PR_HAVE_5_ARG_GETPROTO_R
-+ #endif
-+--- misc/mozilla/security/coreconf/FreeBSD.mk	2006-12-22 14:48:06.000000000 +0100
-++++ misc/build/mozilla/security/coreconf/FreeBSD.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -65,7 +65,7 @@
-+ 
-+ ARCH			= freebsd
-+ 
-+-MOZ_OBJFORMAT		:= $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo aout)
-++MOZ_OBJFORMAT		:= $(shell test -x /usr/bin/objformat && /usr/bin/objformat || echo elf)
-+ 
-+ ifeq ($(MOZ_OBJFORMAT),elf)
-+ DLL_SUFFIX		= so
-+--- misc/mozilla/security/coreconf/Linux.mk	2006-12-22 14:48:06.000000000 +0100
-++++ misc/build/mozilla/security/coreconf/Linux.mk	2008-08-18 10:16:15.000000000 +0200
-+@@ -139,7 +139,7 @@
-+ 
-+ ifeq ($(OS_RELEASE),2.0)
-+ 	OS_REL_CFLAGS	+= -DLINUX2_0
-+-	MKSHLIB		= $(CC) -shared -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
-++	MKSHLIB		= $(CC) $(DSO_LDOPTS) -Wl,-soname -Wl,$(@:$(OBJDIR)/%.so=%.so)
-+ 	ifdef MAPFILE
-+ 		MKSHLIB += -Wl,--version-script,$(MAPFILE)
-+ 	endif
-+@@ -166,6 +166,7 @@
-+ 
-+ DSO_CFLAGS		= -fPIC
-+ DSO_LDOPTS		= -shared $(ARCHFLAG)
-++DSO_LDOPTS		+= -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ DSO_LDFLAGS		=
-+ LDFLAGS			+= $(ARCHFLAG)
-+ 
-+--- misc/mozilla/security/coreconf/SunOS5.mk	2008-06-16 00:22:15.000000000 +0200
-++++ misc/build/mozilla/security/coreconf/SunOS5.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -161,12 +161,14 @@
-+ 
-+ # ld options:
-+ # -G: produce a shared object
-++# -R '$ORIGIN': search for dependencies in same directory
-+ # -z defs: no unresolved symbols allowed
-+ ifdef NS_USE_GCC
-+ ifeq ($(USE_64), 1)
-+ 	DSO_LDOPTS += -m64
-+ endif
-+ 	DSO_LDOPTS += -shared -h $(notdir $@)
-++    DSO_LDOPTS += -Wl,-rpath,\$$ORIGIN:\$$ORIGIN/../ure-link/lib
-+ else
-+ ifeq ($(USE_64), 1)
-+ 	ifeq ($(OS_TEST),i86pc)
-+@@ -176,6 +178,7 @@
-+ 	endif
-+ endif
-+ 	DSO_LDOPTS += -G -h $(notdir $@)
-++    DSO_LDOPTS += -R '$$ORIGIN'
-+ endif
-+ DSO_LDOPTS += -z combreloc -z defs -z ignore
-+ 
-+--- misc/mozilla/security/coreconf/WIN32.mk	2008-06-16 00:22:15.000000000 +0200
-++++ misc/build/mozilla/security/coreconf/WIN32.mk	2008-08-18 16:04:59.000000000 +0200
-+@@ -43,24 +43,24 @@
-+ DEFAULT_COMPILER = cl
-+ 
-+ ifdef NS_USE_GCC
-+-	CC           = gcc
-+-	CCC          = g++
-+-	LINK         = ld
-+-	AR           = ar
-++	CC           = $(CYGWIN_WRAPPER) gcc
-++	CCC          = $(CYGWIN_WRAPPER) g++
-++	LINK         = $(CYGWIN_WRAPPER) ld
-++	AR           = $(CYGWIN_WRAPPER) ar
-+ 	AR          += cr $@
-+-	RANLIB       = ranlib
-++	RANLIB       = $(CYGWIN_WRAPPER) ranlib
-+ 	BSDECHO      = echo
-+-	RC           = windres.exe -O coff --use-temp-file
-+-	LINK_DLL      = $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
-++	RC           = $(CYGWIN_WRAPPER) windres.exe -O coff --use-temp-file
-++	LINK_DLL     = $(CYGWIN_WRAPPER)  $(CC) $(OS_DLLFLAGS) $(DLLFLAGS)
-+ else
-+-	CC           = cl
-+-	CCC          = cl
-+-	LINK         = link
-+-	AR           = lib
-++	CC           = $(CYGWIN_WRAPPER) cl
-++	CCC          = $(CYGWIN_WRAPPER) cl
-++	LINK         = $(CYGWIN_WRAPPER) link
-++	AR           = $(CYGWIN_WRAPPER) lib
-+ 	AR          += -NOLOGO -OUT:"$@"
-+ 	RANLIB       = echo
-+ 	BSDECHO      = echo
-+-	RC           = rc.exe
-++	RC           = $(CYGWIN_WRAPPER) rc.exe
-+ 	MT           = mt.exe
-+ endif
-+ 
-+@@ -69,7 +69,7 @@
-+ else
-+ NSINSTALL_DIR  = $(CORE_DEPTH)/coreconf/nsinstall
-+ endif
-+-NSINSTALL      = nsinstall
-++NSINSTALL      = $(CYGWIN_WRAPPER) nsinstall
-+ 
-+ MKDEPEND_DIR    = $(CORE_DEPTH)/coreconf/mkdepend
-+ MKDEPEND        = $(MKDEPEND_DIR)/$(OBJDIR_NAME)/mkdepend.exe
-+@@ -95,7 +95,7 @@
-+     # dllimport cannot be used as as a constant address.
-+     OS_CFLAGS += -mno-cygwin -mms-bitfields -mnop-fun-dllimport
-+     _GEN_IMPORT_LIB=-Wl,--out-implib,$(IMPORT_LIBRARY)
-+-    DLLFLAGS  += -mno-cygwin -o $@ -shared -Wl,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
-++    DLLFLAGS  += -mno-cygwin -o $@ -shared -Wl,--enable-runtime-pseudo-reloc,--export-all-symbols $(if $(IMPORT_LIBRARY),$(_GEN_IMPORT_LIB))
-+     ifdef BUILD_OPT
-+ 	OPTIMIZER  += -O2
-+ 	DEFINES    += -UDEBUG -U_DEBUG -DNDEBUG
-+--- misc/mozilla/security/coreconf/WIN954.0.mk	2008-06-16 00:22:15.000000000 +0200
-++++ misc/build/mozilla/security/coreconf/WIN954.0.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -72,3 +72,7 @@
-+ endif
-+ endif
-+ DEFINES += -DWIN95
-++
-++ifdef NS_USE_GCC
-++NSPR31_LIB_PREFIX = lib
-++endif
-+--- misc/mozilla/security/coreconf/command.mk	2008-06-16 00:22:15.000000000 +0200
-++++ misc/build/mozilla/security/coreconf/command.mk	2008-08-19 09:58:11.000000000 +0200
-+@@ -45,7 +45,7 @@
-+ CCF           = $(CC) $(CFLAGS)
-+ LINK_DLL      = $(LINK) $(OS_DLLFLAGS) $(DLLFLAGS)
-+ LINK_EXE      = $(LINK) $(OS_LFLAGS) $(LFLAGS)
-+-CFLAGS        = $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
-++CFLAGS        += $(OPTIMIZER) $(OS_CFLAGS) $(XP_DEFINE) $(DEFINES) $(INCLUDES) \
-+ 		$(XCFLAGS)
-+ PERL          = perl
-+ RANLIB        = echo
-+--- misc/mozilla/security/coreconf/rules.mk	2008-06-16 00:22:15.000000000 +0200
-++++ misc/build/mozilla/security/coreconf/rules.mk	2008-08-19 10:46:57.000000000 +0200
-+@@ -284,7 +284,7 @@
-+ $(PROGRAM): $(OBJS) $(EXTRA_LIBS)
-+ 	@$(MAKE_OBJDIR)
-+ ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
-+-	$(MKPROG) $(subst /,\\,$(OBJS)) -Fe$@ -link $(LDFLAGS) $(subst /,\\,$(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS))
-++	$(MKPROG) $(OBJS) -Fe$@ -link $(LDFLAGS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS)
-+ ifdef MT
-+ 	if test -f $@.manifest; then \
-+ 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-+@@ -305,11 +305,7 @@
-+ $(LIBRARY): $(OBJS)
-+ 	@$(MAKE_OBJDIR)
-+ 	rm -f $@
-+-ifeq (,$(filter-out _WIN%,$(NS_USE_GCC)_$(OS_TARGET)))
-+-	$(AR) $(subst /,\\,$(OBJS))
-+-else
-+ 	$(AR) $(OBJS)
-+-endif
-+ 	$(RANLIB) $@
-+ 
-+ 
-+@@ -344,7 +340,7 @@
-+ ifdef NS_USE_GCC
-+ 	$(LINK_DLL) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
-+ else
-+-	$(LINK_DLL) -MAP $(DLLBASE) $(subst /,\\,$(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES))
-++	$(LINK_DLL) -MAP $(DLLBASE) $(OBJS) $(SUB_SHLOBJS) $(EXTRA_LIBS) $(EXTRA_SHARED_LIBS) $(OS_LIBS) $(LD_LIBS) $(RES)
-+ ifdef MT
-+ 	if test -f $@.manifest; then \
-+ 		$(MT) -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
-+@@ -429,15 +425,15 @@
-+ endif
-+ endif
-+ 
-+-core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
-++mozabspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1)))
-+ 
-+ $(OBJDIR)/$(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
-+ 	@$(MAKE_OBJDIR)
-+ ifdef USE_NT_C_SYNTAX
-+-	$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ ifdef NEED_ABSOLUTE_PATH
-+-	$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ 	$(CC) -o $@ -c $(CFLAGS) $<
-+ endif
-+@@ -445,10 +441,10 @@
-+ 
-+ $(PROG_PREFIX)%$(OBJ_SUFFIX): %.c
-+ ifdef USE_NT_C_SYNTAX
-+-	$(CC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ ifdef NEED_ABSOLUTE_PATH
-+-	$(CC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ 	$(CC) -o $@ -c $(CFLAGS) $<
-+ endif
-+@@ -477,10 +473,10 @@
-+ $(OBJDIR)/$(PROG_PREFIX)%: %.cpp
-+ 	@$(MAKE_OBJDIR)
-+ ifdef USE_NT_C_SYNTAX
-+-	$(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ ifdef NEED_ABSOLUTE_PATH
-+-	$(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ 	$(CCC) -o $@ -c $(CFLAGS) $<
-+ endif
-+@@ -501,10 +497,10 @@
-+ 	rm -f $(OBJDIR)/t_$*.cc
-+ else
-+ ifdef USE_NT_C_SYNTAX
-+-	$(CCC) -Fo$@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CCC) -Fo$@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ ifdef NEED_ABSOLUTE_PATH
-+-	$(CCC) -o $@ -c $(CFLAGS) $(call core_abspath,$<)
-++	$(CCC) -o $@ -c $(CFLAGS) $(call mozabspath,$<)
-+ else
-+ 	$(CCC) -o $@ -c $(CFLAGS) $<
-+ endif
-+--- misc/mozilla/security/manager/Makefile.in	2008-06-16 00:23:29.000000000 +0200
-++++ misc/build/mozilla/security/manager/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -172,6 +172,7 @@
-+ endif
-+ ifeq ($(OS_ARCH),WINNT)
-+ DEFAULT_GMAKE_FLAGS += OS_TARGET=WIN95
-++DEFAULT_GMAKE_FLAGS += CYGWIN_WRAPPER=@CYGWIN_WRAPPER@
-+ ifdef MOZ_DEBUG
-+ ifndef MOZ_NO_DEBUG_RTL
-+ DEFAULT_GMAKE_FLAGS += USE_DEBUG_RTL=1
-+--- misc/mozilla/security/nss/cmd/shlibsign/Makefile	2007-02-16 03:16:24.000000000 +0100
-++++ misc/build/mozilla/security/nss/cmd/shlibsign/Makefile	2009-02-12 15:42:13.033408000 +0100
-+@@ -86,17 +86,46 @@
-+ 
-+ include ../platrules.mk
-+ 
-+-SRCDIR = $(call core_abspath,.)
-+-
-++ifeq ($(OS_TARGET), Darwin)
-++	SRCDIR = .
-++else
-++ifeq ($(OS_TARGET), Linux)
-++	SRCDIR = .
-++else
-++ifeq ($(OS_TARGET), WIN95)
-++	SRCDIR = $(shell cygpath -d $(SRCDIR))
-++else
-++	SRCDIR = .
-++endif
-++endif
-++endif
-+ %.chk: %.$(DLL_SUFFIX) 
-+ ifeq ($(OS_TARGET), OS2)
-+ 	cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
-+ 	$(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
-+ 	$(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
-+ else
-+-	cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
-+-	$(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
-+-	$(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
-++ifeq ($(OS_TARGET), WIN95)
-++	sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
-++	$(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
-++	$(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
-++else
-++ifeq ($(OS_TARGET), Darwin)
-++	cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
-++	$(OBJDIR) $(OS_TARGET) \
-++	$(NSPR_LIB_DIR) $<
-++else
-++ifeq ($(OS_TARGET), Linux)
-++	cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
-++	$(OBJDIR) $(OS_TARGET) \
-++	$(NSPR_LIB_DIR) $<
-++else
-++	cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
-++	$(OBJDIR) $(OS_TARGET) \
-++	$(NSPR_LIB_DIR) $<
-++endif
-++endif
-++endif
-+ endif
-+ 
-+ libs install :: $(CHECKLOC)
-+--- misc/mozilla/security/nss/lib/ckfw/builtins/config.mk	2005-01-20 03:25:46.000000000 +0100
-++++ misc/build/mozilla/security/nss/lib/ckfw/builtins/config.mk	2008-08-14 16:22:21.000000000 +0200
-+@@ -63,9 +63,4 @@
-+ DSO_LDOPTS = -bundle
-+ endif
-+ 
-+-ifeq ($(OS_TARGET),SunOS)
-+-# The -R '$ORIGIN' linker option instructs this library to search for its
-+-# dependencies in the same directory where it resides.
-+-MKSHLIB += -R '$$ORIGIN'
-+-endif
-+ 
-+--- misc/mozilla/security/nss/lib/freebl/Makefile	2008-06-16 00:22:09.000000000 +0200
-++++ misc/build/mozilla/security/nss/lib/freebl/Makefile	2008-08-18 14:31:08.000000000 +0200
-+@@ -199,10 +199,6 @@
-+ endif
-+ 
-+ ifeq ($(OS_TARGET),SunOS)
-+-
-+-# The -R '$ORIGIN' linker option instructs this library to search for its
-+-# dependencies in the same directory where it resides.
-+-MKSHLIB += -R '$$ORIGIN'
-+ ifdef NS_USE_GCC
-+     ifdef GCC_USE_GNU_LD
-+ 	MKSHLIB += -Wl,-Bsymbolic,-z,now,-z,text
-+@@ -210,7 +206,7 @@
-+ 	MKSHLIB += -Wl,-B,symbolic,-z,now,-z,text
-+     endif # GCC_USE_GNU_LD
-+ else
-+-    MKSHLIB += -B symbolic -z now -z text
-++    MKSHLIB += -z now -z text
-+ endif # NS_USE_GCC
-+ 
-+ # Sun's WorkShop defines v8, v8plus and v9 architectures.
-+--- misc/mozilla/security/nss/lib/nss/config.mk	2006-12-22 14:47:56.000000000 +0100
-++++ misc/build/mozilla/security/nss/lib/nss/config.mk	2008-08-19 17:07:42.000000000 +0200
-+@@ -113,12 +113,10 @@
-+ # The -R '$ORIGIN' linker option instructs this library to search for its
-+ # dependencies in the same directory where it resides.
-+ ifeq ($(USE_64), 1)
-+-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
-++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1/64:/usr/lib/mps/64'
-+ else
-+-MKSHLIB += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
-++DSO_LDOPTS += -R '$$ORIGIN:/usr/lib/mps/secv1:/usr/lib/mps'
-+ endif
-+-else
-+-MKSHLIB += -R '$$ORIGIN'
-+ endif
-+ endif
-+ 
-+@@ -127,9 +125,9 @@
-+ # pa-risc
-+ ifeq ($(USE_64), 1)
-+ MKSHLIB += +b '$$ORIGIN'
-+-endif
-+-endif
-+-endif
-++endif # USE_64
-++endif # OS_TEST
-++endif # OS_ARCH
-+ 
-+ ifeq (,$(filter-out WINNT WIN95,$(OS_TARGET)))
-+ ifndef NS_USE_GCC
-+--- misc/mozilla/security/nss/lib/nss/nss.def	2008-06-16 00:22:10.000000000 +0200
-++++ misc/build/mozilla/security/nss/lib/nss/nss.def	2008-08-14 16:22:21.000000000 +0200
-+@@ -61,6 +61,7 @@
-+ CERT_CheckCertValidTimes;
-+ CERT_CreateCertificateRequest;
-+ CERT_ChangeCertTrust;
-++CERT_DecodeDERCertificate;
-+ CERT_DecodeDERCrl;
-+ CERT_DestroyCertificateRequest;
-+ CERT_DestroyCertList;
-+--- misc/mozilla/security/nss/lib/smime/config.mk	2006-12-22 14:48:00.000000000 +0100
-++++ misc/build/mozilla/security/nss/lib/smime/config.mk	2008-08-19 17:01:53.000000000 +0200
-+@@ -92,8 +92,3 @@
-+ 	../pkcs7 \
-+ 	$(NULL)
-+ 
-+-ifeq ($(OS_TARGET),SunOS)
-+-# The -R '$ORIGIN' linker option instructs this library to search for its
-+-# dependencies in the same directory where it resides.
-+-MKSHLIB += -R '$$ORIGIN'
-+-endif
-+--- misc/mozilla/security/nss/lib/softoken/config.mk	2006-12-22 14:48:00.000000000 +0100
-++++ misc/build/mozilla/security/nss/lib/softoken/config.mk	2008-08-20 10:36:17.000000000 +0200
-+@@ -87,13 +87,6 @@
-+ 	$(NULL)
-+ endif
-+ 
-+-ifeq ($(OS_TARGET),SunOS)
-+-# The -R '$ORIGIN' linker option instructs this library to search for its
-+-# dependencies in the same directory where it resides.
-+-MKSHLIB += -R '$$ORIGIN'
-+-OS_LIBS += -lbsm 
-+-endif
-+-
-+ ifeq ($(OS_TARGET),WINCE)
-+ DEFINES += -DDBM_USING_NSPR
-+ endif
-+--- misc/mozilla/security/nss/lib/ssl/config.mk	2008-06-16 00:22:12.000000000 +0200
-++++ misc/build/mozilla/security/nss/lib/ssl/config.mk	2008-08-19 17:03:03.000000000 +0200
-+@@ -116,13 +116,6 @@
-+ EXTRA_SHARED_LIBS += -dylib_file @executable_path/libsoftokn3.dylib:$(DIST)/lib/libsoftokn3.dylib
-+ endif
-+ 
-+-ifeq ($(OS_TARGET),SunOS)
-+-# The -R '$ORIGIN' linker option instructs this library to search for its
-+-# dependencies in the same directory where it resides.
-+-MKSHLIB += -R '$$ORIGIN'
-+-#EXTRA_SHARED_LIBS += -ldl -lrt -lc -z defs
-+-endif
-+-
-+ endif
-+ 
-+ # indicates dependency on freebl static lib
-+--- misc/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp	2007-10-08 21:09:06.000000000 +0200
-++++ misc/build/mozilla/uriloader/exthandler/win/nsOSHelperAppService.cpp	2008-08-18 09:53:47.000000000 +0200
-+@@ -163,11 +163,21 @@
-+   if (aProtocolScheme && *aProtocolScheme)
-+   {
-+      HKEY hKey;
-+-     LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
-++     LONG err;
-++#ifdef __MINGW32__
-++     err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, NS_REINTERPRET_CAST(LPCWSTR, aProtocolScheme), 0,
-+                                KEY_QUERY_VALUE, &hKey);
-++#else
-++     err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
-++                               KEY_QUERY_VALUE, &hKey);
-++#endif
-+      if (err == ERROR_SUCCESS)
-+      {
-++#ifdef __MINGW32__
-++       err = ::RegQueryValueEx(hKey, NS_REINTERPRET_CAST(LPCWSTR, "URL Protocol"), NULL, NULL, NULL, NULL);
-++#else 
-+        err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL);
-++#endif    
-+        *aHandlerExists = (err == ERROR_SUCCESS);
-+        // close the key
-+        ::RegCloseKey(hKey);
-+--- misc/mozilla/webshell/tests/viewer/Makefile.in	2006-06-17 18:27:10.000000000 +0200
-++++ misc/build/mozilla/webshell/tests/viewer/Makefile.in	2008-08-14 16:22:21.000000000 +0200
-+@@ -181,7 +181,7 @@
-+ GTK_LIBS		= unix/gtk/libviewer_gtk_s.a -lgtksuperwin $(XP_LIBS) $(MOZ_GTK_LDFLAGS)
-+ 
-+ XP_DIST_DEP_LIBS	:= $(filter-out -L$(DIST)/bin -L$(DIST)/lib, $(XP_DIST_LIBS))
-+-XP_DIST_DEP_LIBS	:= $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(LIB_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
-++XP_DIST_DEP_LIBS	:= $(wildcard $(addprefix $(DIST)/,$(patsubst -l%,bin/$(DLL_PREFIX)%$(DLL_SUFFIX),$(XP_DIST_DEP_LIBS:-l%_s=lib/lib%_s)))*)
-+ 
-+ EXTRA_DEPS		= \
-+ 			$(XP_DIST_DEP_LIBS) \
-+--- misc/mozilla/widget/src/windows/nsDataObj.cpp	2006-06-21 06:33:32.000000000 +0200
-++++ misc/build/mozilla/widget/src/windows/nsDataObj.cpp	2008-08-18 15:49:13.000000000 +0200
-+@@ -570,9 +570,15 @@
-+   int currLen, textLen = (int) NS_MIN(aText.Length(), aFilenameLen);
-+   char defaultChar = '_';
-+   do {
-++#ifdef __MINGW32__
-++    currLen = WideCharToMultiByte(CP_ACP, 
-++      NS_REINTERPRET_CAST(LPCWSTR, WC_COMPOSITECHECK|WC_DEFAULTCHAR),
-++      aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
-++#else
-+     currLen = WideCharToMultiByte(CP_ACP, 
-+       WC_COMPOSITECHECK|WC_DEFAULTCHAR,
-+       aText.get(), textLen--, aFilename, maxUsableFilenameLen, &defaultChar, NULL);
-++#endif
-+   }
-+   while (currLen == 0 && textLen > 0 && GetLastError() == ERROR_INSUFFICIENT_BUFFER);
-+   if (currLen > 0 && textLen > 0) {
-+--- misc/mozilla/widget/src/windows/nsFilePicker.cpp	2006-02-03 15:41:10.000000000 +0100
-++++ misc/build/mozilla/widget/src/windows/nsFilePicker.cpp	2008-08-19 10:05:12.000000000 +0200
-+@@ -135,7 +135,11 @@
-+ 
-+   PRBool result = PR_FALSE;
-+   PRUnichar fileBuffer[FILE_BUFFER_SIZE+1];
-++#ifdef __MINGW32__
-++  wcsncpy(NS_REINTERPRET_CAST(LPOWSTR, fileBuffer),  NS_REINTERPRET_CAST(LPOWSTR, mDefault.get()), FILE_BUFFER_SIZE);
-++#else
-+   wcsncpy(fileBuffer,  mDefault.get(), FILE_BUFFER_SIZE);
-++#endif
-+   fileBuffer[FILE_BUFFER_SIZE] = '\0'; // null terminate in case copy truncated
-+ 
-+   NS_NAMED_LITERAL_STRING(htmExt, "html");
-+@@ -155,14 +159,22 @@
-+ 
-+   if (mMode == modeGetFolder) {
-+     PRUnichar dirBuffer[MAX_PATH+1];
-++#ifdef __MINGW32__
-++    wcsncpy(NS_REINTERPRET_CAST(LPWSTR, dirBuffer), NS_REINTERPRET_CAST(LPCWSTR, initialDir.get()), MAX_PATH);
-++#else
-+     wcsncpy(dirBuffer, initialDir.get(), MAX_PATH);
-++#endif
-+ 
-+     BROWSEINFOW browserInfo;
-+     browserInfo.hwndOwner      = (HWND)
-+       (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0); 
-+     browserInfo.pidlRoot       = nsnull;
-+     browserInfo.pszDisplayName = (LPWSTR)dirBuffer;
-++#ifdef __MINGW32__
-++    browserInfo.lpszTitle      = NS_REINTERPRET_CAST(LPCWSTR, mTitle.get());
-++#else
-+     browserInfo.lpszTitle      = mTitle.get();
-++#endif
-+     browserInfo.ulFlags        = BIF_USENEWUI | BIF_RETURNONLYFSDIRS;
-+     if (initialDir.Length()) // convert folder path to native, the strdup copy will be released in BrowseCallbackProc
-+     {
-+@@ -202,7 +214,11 @@
-+     nsString filterBuffer = mFilterList;
-+                                   
-+     if (!initialDir.IsEmpty()) {
-++#ifdef __MINGW32__
-++      ofn.lpstrInitialDir = NS_REINTERPRET_CAST(LPCWSTR, initialDir.get());
-++#else
-+       ofn.lpstrInitialDir = initialDir.get();
-++#endif
-+     }
-+     
-+     ofn.lpstrTitle   = (LPCWSTR)mTitle.get();
-+@@ -210,13 +226,21 @@
-+     ofn.nFilterIndex = mSelectedType;
-+     ofn.hwndOwner    = (HWND)
-+       (mParentWidget.get() ? mParentWidget->GetNativeData(NS_NATIVE_WINDOW) : 0); 
-++#ifdef __MINGW32__
-++    ofn.lpstrFile    = NS_REINTERPRET_CAST(LPWSTR, fileBuffer);
-++#else
-+     ofn.lpstrFile    = fileBuffer;
-++#endif
-+     ofn.nMaxFile     = FILE_BUFFER_SIZE;
-+ 
-+     ofn.Flags = OFN_NOCHANGEDIR | OFN_SHAREAWARE | OFN_LONGNAMES | OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST;
-+ 
-+     if (!mDefaultExtension.IsEmpty()) {
-++#ifdef __MINGW32__
-++      ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, mDefaultExtension.get());
-++#else
-+       ofn.lpstrDefExt = mDefaultExtension.get();
-++#endif
-+     }
-+     else {
-+       // Get file extension from suggested filename
-+@@ -236,7 +260,11 @@
-+           //XXX Actually, behavior is sort of weird:
-+           //    often appends ".html" even if you have an extension
-+           //    It obeys your extension if you put quotes around name
-++#ifdef __MINGW32__
-++          ofn.lpstrDefExt = NS_REINTERPRET_CAST(LPCWSTR, htmExt.get());
-++#else
-+           ofn.lpstrDefExt = htmExt.get();
-++#endif
-+         }
-+       }
-+     }
-+--- misc/mozilla/widget/src/windows/nsWindow.cpp	2007-11-19 21:40:12.000000000 +0100
-++++ misc/build/mozilla/widget/src/windows/nsWindow.cpp	2008-08-20 16:18:08.000000000 +0200
-+@@ -7088,7 +7088,11 @@
-+       return; // out of memory
-+ 
-+     unicharSize = MultiByteToWideChar(gCurrentKeyboardCP, MB_PRECOMPOSED,
-+-      aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
-++#ifdef __MINGW32__
-++    aStrAnsi->get(), aStrAnsi->Length(), S_REINTERPRET_CAST(LPWSTR, aStrUnicode->BeginWriting()), unicharSize + 1);
-++#else
-++    aStrAnsi->get(), aStrAnsi->Length(), aStrUnicode->BeginWriting(), unicharSize + 1);
-++#endif
-+     aStrUnicode->SetLength(unicharSize);
-+   }
-+ }
-+@@ -7265,7 +7269,11 @@
-+         sIMEAttributeArray[i] = sIMEAttributeArray[offset];
-+ 
-+         offset += ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-+-          sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
-++#ifdef __MINGW32__
-++        REINTERPRET_CAST(LPCWSTR, sIMECompUnicode->get() + i), 1, NULL, 0, NULL, NULL);
-++#else
-++        sIMECompUnicode->get() + i, 1, NULL, 0, NULL, NULL);
-++#endif
-+       }
-+ 
-+       sIMEAttributeArrayLength = sIMECompUnicode->Length();
-+@@ -7477,7 +7485,11 @@
-+         *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
-+       } else {
-+         len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-++#ifdef __MINGW32__
-++                                    NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
-++#else
-+                                     sIMEReconvertUnicode,
-++#endif                  
-+                                     nsCRT::strlen(sIMEReconvertUnicode),
-+                                     NULL, 0, NULL, NULL);
-+         *oResult = sizeof(RECONVERTSTRING) + len;
-+@@ -7496,7 +7508,11 @@
-+       *oResult = sizeof(RECONVERTSTRING) + len * sizeof(WCHAR);
-+     } else {
-+       len = ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-++#ifdef __MINGW32__ 
-++                                  NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
-++#else
-+                                   sIMEReconvertUnicode,
-++#endif
-+                                   nsCRT::strlen(sIMEReconvertUnicode),
-+                                   NULL, 0, NULL, NULL);
-+       *oResult = sizeof(RECONVERTSTRING) + len;
-+@@ -7523,7 +7539,11 @@
-+                    sIMEReconvertUnicode, len * sizeof(WCHAR));
-+     } else {
-+       ::WideCharToMultiByte(gCurrentKeyboardCP, 0,
-++#ifdef __MINGW32__
-++                            NS_REINTERPRET_CAST(LPCWSTR, sIMEReconvertUnicode),
-++#else
-+                             sIMEReconvertUnicode,
-++#endif
-+                             nsCRT::strlen(sIMEReconvertUnicode),
-+                             (LPSTR) (aData + sizeof(RECONVERTSTRING)),
-+                             len,
-+--- misc/mozilla/xpcom/base/nscore.h	2006-08-24 23:46:32.000000000 +0200
-++++ misc/build/mozilla/xpcom/base/nscore.h	2008-08-16 12:01:53.000000000 +0200
-+@@ -337,7 +337,7 @@
-+    * commercial build.  When this is fixed there will be no need for the
-+    * |NS_REINTERPRET_CAST| in nsLiteralString.h either.
-+    */
-+-  #if defined(HAVE_CPP_2BYTE_WCHAR_T) && defined(NS_WIN32)
-++  #if defined(HAVE_CPP_2BYTE_WCHAR_T) && !defined(__MINGW32__) && (defined(NS_WIN32) || defined(XP_MAC))    
-+     typedef wchar_t PRUnichar;
-+   #else
-+     typedef PRUint16 PRUnichar;
-+--- misc/mozilla/xpcom/io/nsLocalFileWin.cpp	2007-11-19 21:38:17.000000000 +0100
-++++ misc/build/mozilla/xpcom/io/nsLocalFileWin.cpp	2008-08-20 16:39:58.000000000 +0200
-+@@ -836,8 +836,11 @@
-+     PRUnichar *resolvedPath = mResolvedPath.BeginWriting();
-+ 
-+     // resolve this shortcut
-++#ifdef __MINGW32__
-++    nsresult rv = gResolver->Resolve(NS_REINTERPRET_CAST(LPCWSTR, mWorkingPath.get()), resolvedPath);
-++#else
-+     nsresult rv = gResolver->Resolve(mWorkingPath.get(), resolvedPath);
-+-
-++#endif
-+     size_t len = NS_FAILED(rv) ? 0 : wcslen(resolvedPath);
-+     mResolvedPath.SetLength(len);
-+ 
-+--- misc/mozilla/xpcom/io/nsNativeCharsetUtils.cpp	2006-06-22 21:13:01.000000000 +0200
-++++ misc/build/mozilla/xpcom/io/nsNativeCharsetUtils.cpp	2008-08-14 16:22:21.000000000 +0200
-+@@ -935,7 +935,11 @@
-+ 
-+         PRUnichar *result = out_iter.get();
-+ 
-++#ifdef __MINGW32__
-++        ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, NS_REINTERPRET_CAST(LPWSTR, result), resultLen);
-++#else
-+         ::MultiByteToWideChar(CP_ACP, 0, buf, inputLen, result, resultLen);
-++#endif
-+     }
-+     return NS_OK;
-+ }
-+@@ -953,7 +957,11 @@
-+     // determine length of result
-+     PRUint32 resultLen = 0;
-+ 
-++#ifdef __MINGW32__
-++    int n = ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, NULL, 0, NULL, NULL);
-++#else
-+     int n = ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, NULL, 0, NULL, NULL);
-++#endif
-+     if (n > 0)
-+         resultLen += n;
-+ 
-+@@ -970,7 +978,11 @@
-+ 
-+         char *result = out_iter.get();
-+ 
-++#ifdef __MINGW32__
-++        ::WideCharToMultiByte(CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, buf), inputLen, result, resultLen,
-++#else
-+         ::WideCharToMultiByte(CP_ACP, 0, buf, inputLen, result, resultLen,
-++#endif
-+                               &defaultChar, NULL);
-+     }
-+     return NS_OK;
-+--- misc/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h	2004-04-18 16:18:20.000000000 +0200
-++++ misc/build/mozilla/xpcom/reflect/xptinfo/public/xptinfo.h	2008-08-14 16:22:21.000000000 +0200
-+@@ -132,7 +132,7 @@
-+         }
-+ 
-+     PRBool IsArray() const
-+-        {return (PRBool) TagPart() == T_ARRAY;}
-++        {return (PRBool) (TagPart() == T_ARRAY);}
-+ 
-+     // 'Dependent' means that params of this type are dependent upon other 
-+     // params. e.g. an T_INTERFACE_IS is dependent upon some other param at 
-+@@ -152,7 +152,7 @@
-+     uint8 TagPart() const
-+         {return (uint8) (flags & XPT_TDP_TAGMASK);}
-+ 
-+-    enum
-++    enum _xpttype
-+     {
-+         T_I8                = TD_INT8             ,
-+         T_I16               = TD_INT16            ,
-+--- misc/mozilla/xpfe/bootstrap/Makefile.in	2007-10-08 21:09:58.000000000 +0200
-++++ misc/build/mozilla/xpfe/bootstrap/Makefile.in	2008-08-18 14:10:04.000000000 +0200
-+@@ -115,11 +115,14 @@
-+ 
-+ include $(topsrcdir)/config/config.mk
-+ 
-++# reduce prerequisites by disabling mozilla binary
-++ifndef DISABLE_MOZ_EXECUTABLE
-+ ifeq ($(USE_SHORT_LIBNAME),1)
-+ PROGRAM		= $(MOZ_APP_NAME)$(BIN_SUFFIX)
-+ else
-+ PROGRAM		= $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
-+ endif
-++endif
-+ 
-+ # Force applications to be built non-statically
-+ # when building the mozcomps meta component
-+@@ -491,6 +494,7 @@
-+ APP_NAME = $(MOZ_APP_DISPLAYNAME)
-+ endif
-+ 
-++ifdef PROGRAM
-+ libs:: $(PROGRAM)
-+ 	mkdir -p $(DIST)/$(APP_NAME).app/Contents/MacOS
-+ 	rsync -a --exclude CVS --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app
-+@@ -505,6 +509,7 @@
-+ 	rsync -a --copy-unsafe-links $(DIST)/package/PrintPDE.plugin $(DIST)/$(APP_NAME).app/Contents/Plug-Ins
-+ 	cp -RL $(DIST)/package/mozillaSuite.rsrc $(DIST)/$(APP_NAME).app/Contents/Resources/$(PROGRAM).rsrc
-+ 	echo -n APPLMOZZ > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
-++endif
-+ 
-+ clean clobber::
-+ 	rm -rf $(DIST)/$(APP_NAME).app
-+--- misc/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp	2007-02-22 14:05:28.000000000 +0100
-++++ misc/build/mozilla/xpfe/bootstrap/nsNativeAppSupportWin.cpp	2008-08-20 16:53:04.000000000 +0200
-+@@ -142,7 +142,11 @@
-+     int acplen = aStr.Length() * 2 + 1;
-+     char * acp = new char[ acplen ];
-+     if( acp ) {
-+-        int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),
-++#ifdef __MINGW32__
-++        int outlen = ::WideCharToMultiByte( CP_ACP, 0, NS_REINTERPRET_CAST(LPCWSTR, aStr.get()), aStr.Length(),
-++#else
-++        int outlen = ::WideCharToMultiByte( CP_ACP, 0, aStr.get(), aStr.Length(),                                      
-++#endif
-+                                             acp, acplen-1, NULL, NULL );
-+         acp[ outlen ] = '\0';  // null terminate
-+     }
-+@@ -2507,7 +2511,11 @@
-+         }
-+         // Create menu and add item.
-+         mTrayIconMenu = ::CreatePopupMenu();
-++#ifdef __MINGW32__
-++        ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, NS_REINTERPRET_CAST(LPCWSTR, navigatorText.get()) );
-++#else
-+         ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_NAVIGATOR, navigatorText.get() );
-++#endif
-+         if ( ::GetLastError() == ERROR_CALL_NOT_IMPLEMENTED ) {
-+             AppendMenuItem( mTrayIconMenu, TURBO_NAVIGATOR, navigatorText );
-+             if ( isMail )
-+@@ -2521,6 +2529,15 @@
-+         }
-+         else {
-+             if (isMail)
-++#ifdef __MINGW32__
-++                ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, NS_REINTERPRET_CAST(LPCWSTR, mailText.get()) );
-++            ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, NS_REINTERPRET_CAST(LPCWSTR, editorText.get()) );
-++            if (isMail)
-++                ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_ADDRESSBOOK, NS_REINTERPRET_CAST(LPCWSTR, addressbookText.get()) );
-++            ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
-++            ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, NS_REINTERPRET_CAST(LPCWSTR, disableText.get()) );
-++            ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, NS_REINTERPRET_CAST(LPCWSTR, exitText.get()) );
-++#else
-+                 ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_MAIL, mailText.get() );
-+             ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EDITOR, editorText.get() );
-+             if (isMail)
-+@@ -2528,6 +2545,7 @@
-+             ::AppendMenuW( mTrayIconMenu, MF_SEPARATOR, NULL, NULL );
-+             ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_DISABLE, disableText.get() );
-+             ::AppendMenuW( mTrayIconMenu, MF_STRING, TURBO_EXIT, exitText.get() );
-++#endif
-+         }
-+     }
-+ 
---- moz/download/mozilla-source.txt	(.../tags/DEV300_m41/moz)	(revision 268999)
-+++ moz/download/mozilla-source.txt	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -1,15 +1,9 @@
- Please copy the source archive for the Mozilla sources into this directory.
--At the moment "mozilla-source-1.7.5.tar.gz" is required, it can be found
-+At the moment "seamonkey-1.1.12-source.tar.gz" is required, it can be found
- here:
--  http://ftp.mozilla.org/pub/mozilla.org/mozilla/releases/mozilla1.7.5/source/
-+ http://releases.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.13
- 
- Windows builders need also
--  "vc71-glib-1.2.10-bin.zip" and
--  "vc71-libIDL-0.6.8-bin.zip".
--They can be found here:
--  ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/
--
--And also
--  "wintools.zip"
-+  "vc8-moztools.zip"
- which can be found here:
--  http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/wintools.zip
-\ No newline at end of file
-+  ftp://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/win32/historic/vc8/
---- moz/patches/embed_manifest.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/embed_manifest.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,142 @@
-+--- mozilla.pure/configure	2008-06-16 00:25:31.000000000 +0200
-++++ mozilla/configure	2008-11-09 23:59:19.984375000 +0100
-+@@ -1068,6 +1068,8 @@
-+ GCONF_VERSION=1.2.1
-+ LIBGNOME_VERSION=2.0
-+ 
-++MSMANIFEST_TOOL=
-++
-+ MISSING_X=
-+ for ac_prog in gawk mawk nawk awk
-+ do
-+@@ -3025,6 +3027,22 @@
-+         else
-+             { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
-+         fi
-++	
-++	# bug #249782
-++	# ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
-++	if test "$_CC_SUITE" -ge "8"; then
-++		MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
-++		if test -n "MSMT_TOOL"; then
-++			MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
-++			if test -z "MSMANIFEST_TOOL_VERSION"; then
-++				echo "configure: warning: Unknown version of the Microsoft (R) Manifest Tool." 1>&2
-++			fi
-++			MSMANIFEST_TOOL=1
-++			unset MSMT_TOOL
-++		else
-++			{ echo "Microsoft (R) Manifest Tool must be in your \$PATH." 1>&2; exit 1; }
-++		fi
-++	fi
-+ 
-+         # Check linker version
-+         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
-+--- mozilla.pure/configure.in	2008-06-16 00:25:32.000000000 +0200
-++++ mozilla/configure.in	2008-11-09 23:59:20.000000000 +0100
-+@@ -126,6 +126,8 @@
-+ GCONF_VERSION=1.2.1
-+ LIBGNOME_VERSION=2.0
-+ 
-++MSMANIFEST_TOOL=
-++
-+ dnl Set various checks
-+ dnl ========================================================
-+ MISSING_X=
-+@@ -428,6 +430,22 @@
-+         else
-+             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
-+         fi
-++	
-++	# bug #249782
-++	# ensure that mt.exe is Microsoft (R) Manifest Tool and not magnetic tape manipulation utility (or something else)
-++	if test "$_CC_SUITE" -ge "8"; then
-++		MSMT_TOOL=`mt 2>&1|grep 'Microsoft (R) Manifest Tool'`
-++		if test -n "MSMT_TOOL"; then
-++			MSMANIFEST_TOOL_VERSION=`echo ${MSMANIFEST_TOOL}|grep -Po "(^|\s)[0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?(\s|$)"`
-++			if test -z "MSMANIFEST_TOOL_VERSION"; then
-++				AC_MSG_WARN([Unknown version of the Microsoft (R) Manifest Tool.])
-++			fi
-++			MSMANIFEST_TOOL=1
-++			unset MSMT_TOOL
-++		else
-++			AC_MSG_ERROR([Microsoft (R) Manifest Tool must be in your \$PATH.])
-++		fi
-++	fi
-+ 
-+         # Check linker version
-+         _LD_FULL_VERSION=`"${LD}" -v 2>&1 | sed -ne "$_MSVC_VER_FILTER"`
-+@@ -7319,6 +7339,7 @@
-+ AC_SUBST(USE_N32)
-+ AC_SUBST(CC_VERSION)
-+ AC_SUBST(CXX_VERSION)
-++AC_SUBST(MSMANIFEST_TOOL)
-+ 
-+ if test "$USING_HCC"; then
-+    CC='${topsrcdir}/build/hcc'
-+--- mozilla.pure/config/rules.mk	2008-01-29 20:30:22.000000000 +0100
-++++ mozilla/config/rules.mk	2008-11-09 23:59:19.968750000 +0100
-+@@ -811,6 +812,12 @@
-+ 
-+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-+ 	$(LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ ifeq ($(CPP_PROG_LINK),1)
-+ 	$(CCC) -o $@ $(CXXFLAGS) $(WRAP_MALLOC_CFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(EXE_DEF_FILE)
-+@@ -843,6 +850,12 @@
-+ else
-+ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
-+ 	$(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ 	$(HOST_CC) -o $@ $(HOST_CFLAGS) $(HOST_LDFLAGS) $(HOST_PROGOBJS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
-+ endif
-+@@ -866,6 +879,12 @@
-+ else
-+ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-+ 	$(LD) -nologo -out:$@ -pdb:$(PDBFILE) $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-+ else
-+ ifeq ($(CPP_PROG_LINK),1)
-+ 	$(CCC) $(WRAP_MALLOC_CFLAGS) $(CXXFLAGS) -o $@ $< $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(LIBS_DIR) $(LIBS) $(OS_LIBS) $(EXTRA_LIBS) $(WRAP_MALLOC_LIB) $(PROFILER_LIBS) $(BIN_FLAGS)
-+@@ -1019,6 +1038,14 @@
-+ endif # SHARED_LIBRARY_LIBS
-+ endif # NO_LD_ARCHIVE_FLAGS
-+ 	$(MKSHLIB) $(SHLIB_LDSTARTFILE) $(OBJS) $(LOBJS) $(SUB_SHLOBJS) $(RESFILE) $(LDFLAGS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE) $(SHLIB_LDENDFILE)
-++ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
-++ifdef MSMANIFEST_TOOL
-++	@if test -f $@.manifest; then \
-++		mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;2; \
-++		rm -f $@.manifest; \
-++	fi
-++endif	# MSVC with manifest tool
-++endif	# WINNT && !GCC
-+ 	@rm -f foodummyfilefoo $(SUB_SHLOBJS) $(DELETE_AFTER_LINK)
-+ else # os2 vacpp
-+ 	$(MKSHLIB) -O:$@ -DLL -INC:_dllentry $(LDFLAGS) $(OBJS) $(LOBJS) $(EXTRA_DSO_LDOPTS) $(OS_LIBS) $(EXTRA_LIBS) $(DEF_FILE)
-+--- mozilla.pure/config/autoconf.mk.in	2006-09-14 20:07:03.000000000 +0200
-++++ mozilla/config/autoconf.mk.in	2008-11-09 23:59:19.953125000 +0100
-+@@ -543,6 +543,7 @@
-+ MOZ_TOOLS_DIR	= @MOZ_TOOLS_DIR@
-+ MOZ_DEBUG_SYMBOLS = @MOZ_DEBUG_SYMBOLS@
-+ MOZ_QUANTIFY	= @MOZ_QUANTIFY@
-++MSMANIFEST_TOOL = @MSMANIFEST_TOOL@
-+ 
-+ #python options
-+ PYTHON = @MOZ_PYTHON@
-
-Property changes on: patches/embed_manifest.patch
-___________________________________________________________________
-Added: svn:executable
-   + *
-
---- moz/patches/consecutive_ldap_queries.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/consecutive_ldap_queries.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,13 @@
-+--- mozilla/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp	2009-02-02 09:39:32.054968600 +0100
-++++ mozilla.patched/mailnews/addrbook/src/nsAbLDAPDirectoryQuery.cpp	2009-02-02 09:35:35.633832119 +0100
-+@@ -833,6 +833,10 @@
-+       if (msgListener)
-+       {
-+         msgListener->mUrl = url;
-++        msgListener->mQueryListener = listener;
-++        msgListener->mResultLimit = resultLimit;
-++        msgListener->mTimeOut = timeOut;
-++        msgListener->mQueryArguments = arguments;
-+         return msgListener->DoSearch();
-+       }
-+     }
---- moz/patches/wchart_on_msvc8.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/wchart_on_msvc8.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,20 @@
-+--- mozilla.pure/configure.in	2008-06-16 00:25:32.000000000 +0200
-++++ mozilla/configure.in	2008-11-10 16:15:36.859375000 +0100
-+@@ -425,6 +425,7 @@
-+             _CC_SUITE=7
-+         elif test "$_CC_MAJOR_VERSION" = "14"; then
-+             _CC_SUITE=8
-++            CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
-+         else
-+             AC_MSG_ERROR([This version of the MSVC compiler, $CC_VERSION , is unsupported.])
-+         fi
-+--- mozilla.pure/configure	2008-06-16 00:25:31.000000000 +0200
-++++ mozilla/configure	2008-11-10 16:15:30.437500000 +0100
-+@@ -3022,6 +3022,7 @@
-+             _CC_SUITE=7
-+         elif test "$_CC_MAJOR_VERSION" = "14"; then
-+             _CC_SUITE=8
-++            CXXFLAGS="$CXXFLAGS -Zc:wchar_t-"
-+         else
-+             { echo "configure: error: This version of the MSVC compiler, $CC_VERSION , is unsupported." 1>&2; exit 1; }
-+         fi
---- moz/patches/cygwin_paths_in_ldap_sdk.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/cygwin_paths_in_ldap_sdk.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,12 @@
-+--- mozilla.org/directory/c-sdk/ldap/include/Makefile.in	2006-02-03 15:44:33.000000000 +0100
-++++ mozilla/directory/c-sdk/ldap/include/Makefile.in	2008-10-31 23:34:41.695625000 +0100
-+@@ -85,6 +85,9 @@
-+ 
-+ ###########################################################################
-+ 
-++INCLUDEDIR:=$(shell cygpath -u $(INCLUDEDIR))
-++GENHEADERS:=$(shell cygpath -u $(GENHEADERS))
-++
-+ all export::	$(INCLUDEDIR) $(GENHEADERS)
-+ 	$(NSINSTALL) -D $(PRIVATEINCDIR)
-+ 	$(INSTALL) $(INSTALLFLAGS) -m 644 $(HEADERS) $(INCLUDEDIR)
---- moz/patches/index.txt	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/index.txt	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,65 @@
-+====================================================================================
-+File name
-+---------
-+  embed_manifest.patch
-+
-+Description
-+-----------
-+  When building Mozilla with MSVC2005, generated libraries and applications
-+  require the manifest file (name.dll.manifest) to reside beside the file
-+  itself, or to be embedded.
-+
-+  The patch does the latter: embedding the manifest file into the
-+  library/application itself, using the Manifest Tool from the Platform SDK
-+  resp. MSVC installation.
-+
-+  The patch is effectively the patch as was committed to the Mozilla trunk,
-+  taken from here: https://bugzilla.mozilla.org/show_bug.cgi?id=249782#c81.
-+
-+====================================================================================
-+File name
-+---------
-+  wchart_on_msvc8.patch
-+
-+Description
-+-----------
-+  For compiling with MSVC2005: See https://bugzilla.mozilla.org/show_bug.cgi?id=324842.
-+
-+====================================================================================
-+File name
-+---------
-+  cygwin_paths_in_ldap_sdk.patch
-+
-+Description
-+-----------
-+  make 1.81, as currently part of cygwin, does not support Windows paths anymore.
-+  So, targets, and target dependencies, in makefile may need to be converted to cygwin
-+  notation. This patch does this for directory/c-sdk/ldap/include, other occurances are
-+  not known, yet.
-+
-+====================================================================================
-+File name
-+---------
-+  no_core_abspath_in_nss.patch
-+
-+Description
-+-----------
-+  On various platforms, building security/nss/cmd/shlibsign fails. In all cases, the
-+  error messages indicate the core_abspath macro used in the Makefile is not resolved
-+  properly.
-+  This patch replaces the usage of core_abspath with platform-specific constructs.
-+
-+====================================================================================
-+File name
-+---------
-+  consecutive_ldap_queries.patch
-+
-+Description
-+-----------
-+  Consecutive LDAP address book queries (using the same instance of nsAbLDAPDirectoryQuery,
-+  but different parameters to the DoQuery method) do not work in OOo. The reason is that
-+  the second call to DoQuery ignores most of its arguments, including the listener which
-+  is to be notified about the query results, and re-uses the arguments from the first
-+  call.
-+  The patch changes the DoQuery behavior to respect the arguments of the second call.
-+
---- moz/patches/no_core_abspath_in_nss.patch	(.../tags/DEV300_m41/moz)	(revision 0)
-+++ moz/patches/no_core_abspath_in_nss.patch	(.../cws/moz2seamonkey01/moz)	(revision 268999)
-@@ -0,0 +1,52 @@
-+--- mozilla.pure/security/nss/cmd/shlibsign/Makefile	2007-02-16 03:16:24.000000000 +0100
-++++ mozilla/security/nss/cmd/shlibsign/Makefile	2008-11-05 14:04:54.798875000 +0100
-+@@ -86,18 +86,47 @@
-+ 
-+ include ../platrules.mk
-+ 
-+-SRCDIR = $(call core_abspath,.)
-+-
-++ifeq ($(OS_TARGET), Darwin)
-++	SRCDIR = .
-++else
-++ifeq ($(OS_TARGET), Linux)
-++	SRCDIR = .
-++else
-++ifeq ($(OS_TARGET), WIN95)
-++	SRCDIR = $(shell cygpath -d $(SRCDIR))
-++else
-++	SRCDIR = $(call core_abspath,.)
-++endif
-++endif
-++endif
-+ %.chk: %.$(DLL_SUFFIX) 
-+ ifeq ($(OS_TARGET), OS2)
-+ 	cd $(OBJDIR) ; cmd.exe /c $(SRCDIR)/sign.cmd $(DIST) \
-+ 	$(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
-+ 	$(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
-+ else
-++ifeq ($(OS_TARGET), WIN95)
-++	sh $(CYGWIN_WRAPPER) ./sign.sh $(shell cygpath -d -a $(DIST)) \
-++	$(shell cygpath -d -a $(OBJDIR)) $(OS_TARGET) \
-++	$(shell cygpath -d -a $(NSPR_LIB_DIR)) $(shell cygpath -d -a $<)
-++else
-++ifeq ($(OS_TARGET), Darwin)
-++	cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
-++	$(OBJDIR) $(OS_TARGET) \
-++	$(NSPR_LIB_DIR) $<
-++else
-++ifeq ($(OS_TARGET), Linux)
-++	cd $(SRCDIR) ; sh ./sign.sh $(DIST) \
-++	$(OBJDIR) $(OS_TARGET) \
-++	$(NSPR_LIB_DIR) $<
-++else
-+ 	cd $(OBJDIR) ; sh $(SRCDIR)/sign.sh $(call core_abspath,$(DIST)) \
-+ 	$(call core_abspath,$(OBJDIR)) $(OS_TARGET) \
-+ 	$(call core_abspath,$(NSPR_LIB_DIR)) $(call core_abspath,$<)
-+ endif
-++endif
-++endif
-++endif
-+ 
-+ libs install :: $(CHECKLOC)
-+ 
diff --git a/patches/dev300/cws-scsheetprotection02-sc.diff b/patches/dev300/cws-scsheetprotection02-sc.diff
deleted file mode 100644
index 4e4f0b3..0000000
--- a/patches/dev300/cws-scsheetprotection02-sc.diff
+++ /dev/null
@@ -1,7194 +0,0 @@
---- sc/inc/document.hxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/inc/document.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -90,6 +90,7 @@ class ScDBData;
- class ScDetOpData;
- class ScDetOpList;
- class ScDocOptions;
-+class ScDocProtection;
- class ScDocumentPool;
- class ScDrawLayer;
- class ScExtDocOptions;
-@@ -108,6 +109,7 @@ class ScRangeName;
- class ScStyleSheet;
- class ScStyleSheetPool;
- class ScTable;
-+class ScTableProtection;
- class ScTokenArray;
- class ScValidationData;
- class ScValidationDataList;
-@@ -283,7 +285,7 @@ private:
- 
- 	ScFieldEditEngine*	pCacheFieldEditEngine;
- 
--	com::sun::star::uno::Sequence<sal_Int8>	aProtectPass;
-+    ::std::auto_ptr<ScDocProtection> pDocProtection;
- 
-     ::std::auto_ptr<ScExternalRefManager> pExternalRefMgr;
- 	String              aDocName;                       // opt: Dokumentname
-@@ -347,7 +349,6 @@ private:
- 
- 	ScLkUpdMode			eLinkMode;
- 
--	BOOL				bProtected;
- 	BOOL				bAutoCalc;						// Automatisch Berechnen
- 	BOOL				bAutoCalcShellDisabled;			// in/von/fuer ScDocShell disabled
- 	// ob noch ForcedFormulas berechnet werden muessen,
-@@ -529,13 +530,14 @@ public:
- 	SC_DLLPUBLIC inline SCTAB	GetTableCount() const { return nMaxTableNumber; }
- 	SvNumberFormatterIndexTable* GetFormatExchangeList() const { return pFormatExchangeList; }
- 
--	SC_DLLPUBLIC void			SetDocProtection( BOOL bProtect, const com::sun::star::uno::Sequence <sal_Int8>& aPass );
--	SC_DLLPUBLIC void			SetTabProtection( SCTAB nTab, BOOL bProtect, const com::sun::star::uno::Sequence <sal_Int8>& aPass );
-+    SC_DLLPUBLIC ScDocProtection* GetDocProtection() const;
-+    SC_DLLPUBLIC void            SetDocProtection(const ScDocProtection* pProtect);
- 	SC_DLLPUBLIC BOOL			IsDocProtected() const;
- 	BOOL			IsDocEditable() const;
- 	SC_DLLPUBLIC BOOL			IsTabProtected( SCTAB nTab ) const;
--	const com::sun::star::uno::Sequence <sal_Int8>&	GetDocPassword() const;
--	const com::sun::star::uno::Sequence <sal_Int8>&	GetTabPassword( SCTAB nTab ) const;
-+    SC_DLLPUBLIC ScTableProtection* GetTabProtection( SCTAB nTab ) const;
-+    SC_DLLPUBLIC void               SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect);
-+    void            CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest);
- 
- 	void			LockTable(SCTAB nTab);
- 	void			UnlockTable(SCTAB nTab);
-@@ -1471,7 +1473,8 @@ public:
- 
- 
- private:
--//UNUSED2008-05  void				SetAutoFilterFlags();
-+    ScDocument(const ScDocument& r); // disabled with no definition
-+
- 	void				FindMaxRotCol( SCTAB nTab, RowInfo* pRowInfo, SCSIZE nArrCount,
- 										SCCOL nX1, SCCOL nX2 ) const;
- 
---- sc/inc/sc.hrc.old	2009-04-06 16:41:49.000000000 +0000
-+++ sc/inc/sc.hrc	2009-04-06 16:41:49.000000000 +0000
-@@ -1627,7 +1627,12 @@
- #define RID_SCDLG_CONFLICTS             (SC_DIALOGS_START + 145)
- #define RID_SCDLG_SHAREDOCUMENT         (SC_DIALOGS_START + 146)
- 
--#define SC_DIALOGS_END          (SC_DIALOGS_START + 150)
-+#define RID_SCDLG_TABPROTECTION         (SC_DIALOGS_START + 147)
-+#define RID_SCDLG_DOCPROTECTION         (SC_DIALOGS_START + 148)
-+#define RID_SCDLG_RETYPEPASS            (SC_DIALOGS_START + 149)
-+#define RID_SCDLG_RETYPEPASS_INPUT      (SC_DIALOGS_START + 150)
-+
-+#define SC_DIALOGS_END          (SC_DIALOGS_START + 151)
- 
- #ifndef STD_MASKCOLOR
- #define STD_MASKCOLOR Color { Red = 0xFF00; Green = 0x0000; Blue = 0xFF00; }
---- sc/inc/scextopt.hxx.old	2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/scextopt.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -46,8 +46,6 @@ struct ScExtDocSettings
-     double              mfTabBarWidth;      /// Width of the tabbar, relative to frame window width (0.0 ... 1.0).
-     sal_uInt32          mnLinkCnt;          /// Recursive counter for loading external documents.
-     SCTAB               mnDisplTab;         /// Index of displayed sheet.
--    bool                mbWinProtected;     /// true = Window properties are protected.
--    bool                mbEncrypted;        /// true = Imported file was encrypted.
- 
-     explicit            ScExtDocSettings();
- };
---- sc/inc/table.hxx.old	2009-04-02 10:45:43.000000000 +0000
-+++ sc/inc/table.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -39,6 +39,8 @@
- #include "sortparam.hxx"
- #include "compressedarray.hxx"
- 
-+#include <memory>
-+
- namespace utl {
- 	class SearchParam;
- 	class TextSearch;
-@@ -65,6 +67,7 @@ class ScRangeList;
- class ScSortInfoArray;
- class ScStyleSheet;
- class ScTableLink;
-+class ScTableProtection;
- class ScUserListData;
- class ScIndexMap;
- struct RowInfo;
-@@ -102,8 +105,7 @@ private:
- 	SCROW			nRepeatStartY;
- 	SCROW			nRepeatEndY;
- 
--	BOOL			bProtected;
--	com::sun::star::uno::Sequence<sal_Int8>	aProtectPass;
-+    ::std::auto_ptr<ScTableProtection> pTabProtection;
- 
- 	USHORT*			pColWidth;
- 	ScSummableCompressedArray< SCROW, USHORT>*  pRowHeight;
-@@ -218,10 +220,9 @@ public:
- 	void			SetPageStyle( const String& rName );
- 	void			PageStyleModified( const String& rNewName );
- 
--	BOOL			IsProtected() const						{ return bProtected; }
--	const com::sun::star::uno::Sequence<sal_Int8>&	GetPassword() const						{ return aProtectPass; }
--	void			SetProtection( BOOL bProtect, const com::sun::star::uno::Sequence<sal_Int8>& rPasswd )
--										{ bProtected = bProtect; aProtectPass = rPasswd; }
-+    BOOL            IsProtected() const;
-+    void            SetProtection(const ScTableProtection* pProtect);
-+    ScTableProtection* GetProtection();
- 
- 	Size			GetPageSize() const;
- 	void			SetPageSize( const Size& rSize );
---- sc/inc/tabprotection.hxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/inc/tabprotection.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,180 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: tabprotection.hxx,v $
-+ * $Revision: 1.1.4.6 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_TAB_PROTECTION_HXX
-+#define SC_TAB_PROTECTION_HXX
-+
-+#include "sal/types.h"
-+#include <com/sun/star/uno/Sequence.hxx>
-+
-+#include "global.hxx"
-+#include <vector>
-+#include <boost/shared_ptr.hpp>
-+
-+#define ENABLE_SHEET_PROTECTION 0
-+
-+class ScDocument;
-+class ScTableProtectionImpl;
-+
-+enum ScPasswordHash
-+{
-+    PASSHASH_OOO = 0,
-+    PASSHASH_XL
-+};
-+
-+class ScPassHashHelper
-+{
-+public:
-+    /** Check for the compatibility of all password hashes.  If there is at
-+        least one hash that needs to be regenerated, it returns true.  If all
-+        hash values are compatible with the specified hash type, then it
-+        returns false. */
-+    static bool needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash);
-+
-+private:
-+    ScPassHashHelper();
-+    ~ScPassHashHelper();
-+};
-+
-+// ============================================================================
-+
-+class SAL_NO_VTABLE ScPassHashProtectable
-+{
-+public:
-+    virtual ~ScPassHashProtectable() = 0;
-+
-+    virtual bool isProtected() const = 0;
-+    virtual bool isProtectedWithPass() const = 0;
-+    virtual void setProtected(bool bProtected) = 0;
-+
-+    virtual bool isPasswordEmpty() const = 0;
-+    virtual bool hasPasswordHash(ScPasswordHash eHash) const = 0;
-+    virtual void setPassword(const String& aPassText) = 0;
-+    virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const = 0;
-+    virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, 
-+                                 ScPasswordHash eHash = PASSHASH_OOO) = 0;
-+    virtual bool verifyPassword(const String& aPassText) const = 0;
-+};
-+
-+// ============================================================================
-+
-+class SC_DLLPUBLIC ScDocProtection : public ScPassHashProtectable
-+{
-+public:
-+    enum Option
-+    {
-+        STRUCTURE = 0,
-+        WINDOWS,
-+        CONTENT,
-+        NONE        // last item - used to resize the vector
-+    };
-+
-+    explicit ScDocProtection();
-+    explicit ScDocProtection(const ScDocProtection& r);
-+    virtual ~ScDocProtection();
-+
-+    virtual bool isProtected() const;
-+    virtual bool isProtectedWithPass() const;
-+    virtual void setProtected(bool bProtected);
-+            
-+    virtual bool isPasswordEmpty() const;
-+    virtual bool hasPasswordHash(ScPasswordHash eHash) const;
-+    virtual void setPassword(const String& aPassText);
-+    virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
-+    virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, 
-+                                 ScPasswordHash eHash = PASSHASH_OOO);
-+    virtual bool verifyPassword(const String& aPassText) const;
-+    
-+    bool isOptionEnabled(Option eOption) const;
-+    void setOption(Option eOption, bool bEnabled);
-+
-+private:
-+    ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
-+};
-+
-+// ============================================================================
-+
-+/** sheet protection state container
-+    
-+    This class stores sheet's protection state: 1) whether the protection
-+    is on, 2) password and/or password hash, and 3) any associated
-+    protection options.  This class is also used as a protection state
-+    container for the undo/redo stack, in which case the password, hash and
-+    the options need to be preserved even when the protection flag is
-+    off. */
-+class SC_DLLPUBLIC ScTableProtection : public ScPassHashProtectable
-+{
-+public:
-+    enum Option
-+    {
-+        AUTOFILTER = 0,
-+        DELETE_COLUMNS,
-+        DELETE_ROWS,
-+        FORMAT_CELLS,
-+        FORMAT_COLUMNS,
-+        FORMAT_ROWS,
-+        INSERT_COLUMNS,
-+        INSERT_HYPERLINKS,
-+        INSERT_ROWS,
-+        OBJECTS,
-+        PIVOT_TABLES,
-+        SCENARIOS,
-+        SELECT_LOCKED_CELLS,
-+        SELECT_UNLOCKED_CELLS,
-+        SHEET,
-+        SORT,
-+        NONE        // last item - used to resize the vector
-+    };
-+
-+    explicit ScTableProtection();
-+    explicit ScTableProtection(const ScTableProtection& r);
-+    virtual ~ScTableProtection();
-+
-+    virtual bool isProtected() const;
-+    virtual bool isProtectedWithPass() const;
-+    virtual void setProtected(bool bProtected);
-+            
-+    virtual bool isPasswordEmpty() const;
-+    virtual bool hasPasswordHash(ScPasswordHash eHash) const;
-+    virtual void setPassword(const String& aPassText);
-+    virtual ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
-+    virtual void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, 
-+                                 ScPasswordHash eHash = PASSHASH_OOO);
-+    virtual bool verifyPassword(const String& aPassText) const;
-+    
-+    bool isOptionEnabled(Option eOption) const;
-+    void setOption(Option eOption, bool bEnabled);
-+
-+private:
-+    ::boost::shared_ptr<ScTableProtectionImpl> mpImpl;
-+};
-+
-+
-+#endif
---- sc/source/core/data/documen2.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/documen2.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -94,6 +94,7 @@
- #include "recursionhelper.hxx"
- #include "lookupcache.hxx"
- #include "externalrefmgr.hxx"
-+#include "tabprotection.hxx"
- 
- // pImpl because including lookupcache.hxx in document.hxx isn't wanted, and
- // dtor plus helpers are convenient.
-@@ -151,6 +152,7 @@ ScDocument::ScDocument( ScDocumentMode	e
- 		pChangeViewSettings( NULL ),
- 		pScriptTypeData( NULL ),
-         pCacheFieldEditEngine( NULL ),
-+        pDocProtection( NULL ),
-         pExternalRefMgr( NULL ),
- 		pViewOptions( NULL ),
- 		pDocOptions( NULL ),
-@@ -174,7 +176,6 @@ ScDocument::ScDocument( ScDocumentMode	e
- 		nHardRecalcState(0),
- 		nVisibleTab( 0 ),
- 		eLinkMode(LM_UNKNOWN),
--		bProtected( FALSE ),
- 		bAutoCalc( eMode == SCDOCMODE_DOCUMENT ),
- 		bAutoCalcShellDisabled( FALSE ),
- 		bForcedFormulaPending( FALSE ),
---- sc/source/core/data/documen3.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/documen3.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -77,6 +77,8 @@
- #include "drwlayer.hxx"
- #include "unoreflist.hxx"
- #include "listenercalls.hxx"
-+#include "svtools/PasswordHelper.hxx"
-+#include "tabprotection.hxx"
- 
- #include <memory>
- 
-@@ -1701,28 +1703,28 @@ void ScDocument::SnapVisArea( Rectangle&
-         ScDrawLayer::MirrorRectRTL( rRect );        // back to real rectangle
- }
- 
--void ScDocument::SetDocProtection( BOOL bProtect, const uno::Sequence<sal_Int8>& rPasswd )
-+ScDocProtection* ScDocument::GetDocProtection() const
- {
--	bProtected = bProtect;
--	aProtectPass = rPasswd;
-+    return pDocProtection.get();
- }
- 
--void ScDocument::SetTabProtection( SCTAB nTab, BOOL bProtect, const uno::Sequence<sal_Int8>& rPasswd )
-+void ScDocument::SetDocProtection(const ScDocProtection* pProtect)
- {
--	if (VALIDTAB(nTab))
--		if (pTab[nTab])
--			pTab[nTab]->SetProtection( bProtect, rPasswd );
-+    if (pProtect)
-+        pDocProtection.reset(new ScDocProtection(*pProtect));
-+    else
-+        pDocProtection.reset(NULL);
- }
- 
- BOOL ScDocument::IsDocProtected() const
- {
--	return bProtected;
-+    return pDocProtection.get() && pDocProtection->isProtected();
- }
- 
- BOOL ScDocument::IsDocEditable() const
- {
-     // import into read-only document is possible
--    return !bProtected && ( bImportingXML || mbChangeReadOnlyEnabled || !pShell || !pShell->IsReadOnly() );
-+    return !IsDocProtected() && ( bImportingXML || mbChangeReadOnlyEnabled || !pShell || !pShell->IsReadOnly() );
- }
- 
- BOOL ScDocument::IsTabProtected( SCTAB nTab ) const
-@@ -1734,18 +1736,28 @@ BOOL ScDocument::IsTabProtected( SCTAB n
- 	return FALSE;
- }
- 
--const uno::Sequence<sal_Int8>& ScDocument::GetDocPassword() const
-+ScTableProtection* ScDocument::GetTabProtection( SCTAB nTab ) const
- {
--	return aProtectPass;
-+    if (VALIDTAB(nTab) && pTab[nTab])
-+        return pTab[nTab]->GetProtection();
-+
-+    return NULL;
- }
- 
--const uno::Sequence<sal_Int8>& ScDocument::GetTabPassword( SCTAB nTab ) const
-+void ScDocument::SetTabProtection(SCTAB nTab, const ScTableProtection* pProtect)
- {
--	if (VALIDTAB(nTab) && pTab[nTab])
--		return pTab[nTab]->GetPassword();
-+    if (!ValidTab(nTab))
-+        return;
- 
--	DBG_ERROR("Falsche Tabellennummer");
--	return aProtectPass;
-+    pTab[nTab]->SetProtection(pProtect);
-+}
-+
-+void ScDocument::CopyTabProtection(SCTAB nTabSrc, SCTAB nTabDest)
-+{
-+    if (!ValidTab(nTabSrc) || !ValidTab(nTabDest))
-+        return;
-+
-+    pTab[nTabDest]->SetProtection( pTab[nTabSrc]->GetProtection() );
- }
- 
- const ScDocOptions& ScDocument::GetDocOptions() const
---- sc/source/core/data/document.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/document.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -93,6 +93,7 @@
- #include "bcaslot.hxx"
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
-+#include "tabprotection.hxx"
- 
- namespace WritingMode2 = ::com::sun::star::text::WritingMode2;
- 
-@@ -3972,24 +3973,6 @@ BOOL ScDocument::RefreshAutoFilter( SCCO
- }
- 
- 
--//UNUSED2008-05  void ScDocument::SetAutoFilterFlags()
--//UNUSED2008-05  {
--//UNUSED2008-05      USHORT nCount = pDBCollection->GetCount();
--//UNUSED2008-05      for (USHORT i=0; i<nCount; i++)
--//UNUSED2008-05      {
--//UNUSED2008-05          ScDBData* pData = (*pDBCollection)[i];
--//UNUSED2008-05          SCTAB nDBTab;
--//UNUSED2008-05          SCCOL nDBStartCol;
--//UNUSED2008-05          SCROW nDBStartRow;
--//UNUSED2008-05          SCCOL nDBEndCol;
--//UNUSED2008-05          SCROW nDBEndRow;
--//UNUSED2008-05          pData->GetArea( nDBTab, nDBStartCol,nDBStartRow, nDBEndCol,nDBEndRow );
--//UNUSED2008-05          pData->SetAutoFilter( HasAttrib( nDBStartCol,nDBStartRow,nDBTab,
--//UNUSED2008-05                                  nDBEndCol,nDBStartRow,nDBTab, HASATTR_AUTOFILTER ) );
--//UNUSED2008-05      }
--//UNUSED2008-05  }
--
--
- BOOL ScDocument::IsHorOverlapped( SCCOL nCol, SCROW nRow, SCTAB nTab ) const
- {
- 	const ScMergeFlagAttr* pAttr = (const ScMergeFlagAttr*)
---- sc/source/core/data/makefile.mk.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/makefile.mk	2009-04-06 16:41:49.000000000 +0000
-@@ -108,6 +108,7 @@ SLOFILES =  \
- 	$(SLO)$/table4.obj \
- 	$(SLO)$/table5.obj \
- 	$(SLO)$/table6.obj \
-+	$(SLO)$/tabprotection.obj \
- 	$(SLO)$/userdat.obj \
- 	$(SLO)$/validat.obj \
- 	$(SLO)$/postit.obj
-@@ -128,6 +129,7 @@ EXCEPTIONSFILES= \
- 	$(SLO)$/global2.obj \
-     $(SLO)$/table1.obj \
-     $(SLO)$/table3.obj \
-+	$(SLO)$/tabprotection.obj \
- 	$(SLO)$/postit.obj \
- 	$(SLO)$/documen3.obj \
- 	$(SLO)$/documen5.obj \
---- sc/source/core/data/table1.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/table1.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -114,6 +114,7 @@
- #include "progress.hxx"
- #include "hints.hxx"		// fuer Paint-Broadcast
- #include "prnsave.hxx"
-+#include "tabprotection.hxx"
- 
- // STATIC DATA -----------------------------------------------------------
- 
-@@ -132,7 +133,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTA
- 	bPageSizeValid( FALSE ),
- 	nRepeatStartX( SCCOL_REPEAT_NONE ),
- 	nRepeatStartY( SCROW_REPEAT_NONE ),
--	bProtected( FALSE ),
-+    pTabProtection( NULL ),
- 	pColWidth( NULL ),
- 	pRowHeight( NULL ),
- 	pColFlags( NULL ),
---- sc/source/core/data/table2.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/table2.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -292,7 +292,7 @@ void ScTable::DeleteArea(SCCOL nCol1, SC
- 			// Zellschutz auf geschuetzter Tabelle nicht setzen
- 			//
- 
--		if ( bProtected && (nDelFlag & IDF_ATTRIB) )
-+		if ( IsProtected() && (nDelFlag & IDF_ATTRIB) )
- 		{
- 			ScPatternAttr aPattern(pDocument->GetPool());
- 			aPattern.GetItemSet().Put( ScProtectionAttr( FALSE ) );
-@@ -318,7 +318,7 @@ void ScTable::DeleteSelection( USHORT nD
- 		// Zellschutz auf geschuetzter Tabelle nicht setzen
- 		//
- 
--	if ( bProtected && (nDelFlag & IDF_ATTRIB) )
-+	if ( IsProtected() && (nDelFlag & IDF_ATTRIB) )
- 	{
- 		ScDocumentPool* pPool = pDocument->GetPool();
- 		SfxItemSet aSet( *pPool, ATTR_PATTERN_START, ATTR_PATTERN_END );
-@@ -361,7 +361,7 @@ void ScTable::CopyToClip(SCCOL nCol1, SC
- 
- 		//	ggf. Formeln durch Werte ersetzen
- 
--		if (bProtected)
-+		if ( IsProtected() )
- 			for (i = nCol1; i <= nCol2; i++)
- 				pTable->aCol[i].RemoveProtected(nRow1, nRow2);
- 	}
-@@ -406,7 +406,7 @@ void ScTable::CopyFromClip(SCCOL nCol1,
- 				// Zellschutz auf geschuetzter Tabelle nicht setzen
- 				//
- 
--			if ( bProtected && (nInsFlag & IDF_ATTRIB) )
-+			if ( IsProtected() && (nInsFlag & IDF_ATTRIB) )
- 			{
- 				ScPatternAttr aPattern(pDocument->GetPool());
- 				aPattern.GetItemSet().Put( ScProtectionAttr( FALSE ) );
-@@ -1451,7 +1451,7 @@ BOOL ScTable::IsBlockEditable( SCCOL nCo
- 	BOOL bIsEditable = TRUE;
- 	if ( nLockCount )
- 		bIsEditable = FALSE;
--    else if ( bProtected && !pDocument->IsScenario(nTab) )
-+    else if ( IsProtected() && !pDocument->IsScenario(nTab) )
-     {
-         if((bIsEditable = !HasAttrib( nCol1, nRow1, nCol2, nRow2, HASATTR_PROTECTED )) != FALSE)
-         {
-@@ -1518,7 +1518,7 @@ BOOL ScTable::IsSelectionEditable( const
- 	BOOL bIsEditable = TRUE;
- 	if ( nLockCount )
- 		bIsEditable = FALSE;
--    else if ( bProtected && !pDocument->IsScenario(nTab))
-+    else if ( IsProtected() && !pDocument->IsScenario(nTab) )
-     {
-         if((bIsEditable = !HasAttribSelection( rMark, HASATTR_PROTECTED )) != FALSE)
-         {
---- sc/source/core/data/table5.cxx.old	2009-04-02 10:45:01.000000000 +0000
-+++ sc/source/core/data/table5.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -51,8 +51,11 @@
- #include "stlpool.hxx"
- #include "stlsheet.hxx"
- #include "brdcst.hxx"
-+#include "tabprotection.hxx"
- #include "globstr.hrc"
- 
-+using ::com::sun::star::uno::Sequence;
-+
- // STATIC DATA -----------------------------------------------------------
- 
- #define GET_SCALEVALUE(set,id) 	((const SfxUInt16Item&)(set.Get( id ))).GetValue()
-@@ -273,6 +276,24 @@ void ScTable::SetPageSize( const Size& r
- 		bPageSizeValid = FALSE;
- }
- 
-+BOOL ScTable::IsProtected() const
-+{
-+    return pTabProtection.get() && pTabProtection->isProtected();
-+}
-+
-+void ScTable::SetProtection(const ScTableProtection* pProtect)
-+{
-+    if (pProtect)
-+        pTabProtection.reset(new ScTableProtection(*pProtect));
-+    else
-+        pTabProtection.reset(NULL);
-+}
-+
-+ScTableProtection* ScTable::GetProtection()
-+{
-+    return pTabProtection.get();
-+}
-+
- Size ScTable::GetPageSize() const
- {
- 	if ( bPageSizeValid )
---- sc/source/core/data/tabprotection.cxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/core/data/tabprotection.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,465 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ *
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: tabprotection.cxx,v $
-+ * $Revision: 1.1.4.7 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+// MARKER(update_precomp.py): autogen include statement, do not remove
-+#include "precompiled_sc.hxx"
-+
-+// INCLUDE ---------------------------------------------------------------
-+
-+#include "tabprotection.hxx"
-+#include "tools/debug.hxx"
-+#include "svtools/PasswordHelper.hxx"
-+#include "document.hxx"
-+
-+#define DEBUG_TAB_PROTECTION 0
-+
-+using namespace ::com::sun::star;
-+using ::com::sun::star::uno::Sequence;
-+using ::rtl::OUString;
-+
-+// ============================================================================
-+
-+bool ScPassHashHelper::needsPassHashRegen(const ScDocument& rDoc, ScPasswordHash eHash)
-+{
-+    if (rDoc.IsDocProtected())
-+    {
-+        const ScDocProtection* p = rDoc.GetDocProtection();
-+        if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash))
-+            return true;
-+    }
-+
-+    SCTAB nTabCount = rDoc.GetTableCount();
-+    for (SCTAB i = 0; i < nTabCount; ++i)
-+    {
-+        const ScTableProtection* p = rDoc.GetTabProtection(i);
-+        if (!p || !p->isProtected())
-+            // Sheet not protected.  Skip it.
-+            continue;
-+
-+        if (!p->isPasswordEmpty() && !p->hasPasswordHash(eHash))
-+            return true;
-+    }
-+
-+    return false;
-+}
-+
-+// ============================================================================
-+
-+ScPassHashProtectable::~ScPassHashProtectable()
-+{
-+}
-+
-+// ============================================================================
-+
-+static sal_uInt16 lcl_getXLHashFromChar(const sal_Char* szPassword)
-+{
-+    sal_uInt16 cchPassword = strlen(szPassword);
-+    sal_uInt16 wPasswordHash = 0;
-+    if (!cchPassword)
-+        return wPasswordHash;
-+
-+    const char* pch = &szPassword[cchPassword];
-+    while (pch-- != szPassword)
-+    {
-+        wPasswordHash = ((wPasswordHash >> 14) & 0x01) | 
-+                        ((wPasswordHash << 1) & 0x7fff);
-+        wPasswordHash ^= *pch;
-+    }
-+
-+    wPasswordHash = ((wPasswordHash >> 14) & 0x01) | 
-+                    ((wPasswordHash << 1) & 0x7fff);
-+
-+    wPasswordHash ^= (0x8000 | ('N' << 8) | 'K');
-+    wPasswordHash ^= cchPassword;
-+
-+    return wPasswordHash;
-+}
-+
-+static Sequence<sal_Int8> lcl_getXLHash(const String& aPassText)
-+{
-+    const sal_Char* szBuf = OUStringToOString(OUString(aPassText), RTL_TEXTENCODING_UTF8).getStr();
-+    sal_uInt16 nHash = lcl_getXLHashFromChar(szBuf);
-+    Sequence<sal_Int8> aHash(2);
-+    aHash[0] = (nHash >> 8) & 0xFF;
-+    aHash[1] = nHash & 0xFF;
-+    return aHash;
-+}
-+
-+class ScTableProtectionImpl
-+{
-+public:
-+    static ::com::sun::star::uno::Sequence<sal_Int8> hashPassword(const String& aPassText, ScPasswordHash eHash = PASSHASH_OOO);
-+
-+    explicit ScTableProtectionImpl(SCSIZE nOptSize);
-+    explicit ScTableProtectionImpl(const ScTableProtectionImpl& r);
-+
-+    bool isProtected() const;
-+    bool isProtectedWithPass() const;
-+    void setProtected(bool bProtected);
-+
-+    bool isPasswordEmpty() const;
-+    bool hasPasswordHash(ScPasswordHash eHash) const;
-+    void setPassword(const String& aPassText);
-+    ::com::sun::star::uno::Sequence<sal_Int8> getPasswordHash(ScPasswordHash eHash) const;
-+    void setPasswordHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash = PASSHASH_OOO);
-+    bool verifyPassword(const String& aPassText) const;
-+    
-+    bool isOptionEnabled(SCSIZE nOptId) const;
-+    void setOption(SCSIZE nOptId, bool bEnabled);
-+
-+private:
-+    String maPassText;
-+    ::com::sun::star::uno::Sequence<sal_Int8>   maPassHash;
-+    ::std::vector<bool> maOptions;
-+    bool mbEmptyPass;
-+    bool mbProtected;
-+    ScPasswordHash meHash;
-+};
-+
-+Sequence<sal_Int8> ScTableProtectionImpl::hashPassword(const String& aPassText, ScPasswordHash eHash)
-+{
-+    Sequence<sal_Int8> aHash;
-+    switch (eHash)
-+    {
-+        case PASSHASH_XL:
-+            aHash = lcl_getXLHash(aPassText);
-+        break;
-+        case PASSHASH_OOO:
-+        default:            
-+            SvPasswordHelper::GetHashPassword(aHash, aPassText);
-+        break;
-+    }
-+    return aHash;
-+}
-+
-+ScTableProtectionImpl::ScTableProtectionImpl(SCSIZE nOptSize) :
-+    maOptions(nOptSize),
-+    mbEmptyPass(true),
-+    mbProtected(false),
-+    meHash(PASSHASH_OOO)
-+{
-+}
-+
-+ScTableProtectionImpl::ScTableProtectionImpl(const ScTableProtectionImpl& r) :
-+    maPassText(r.maPassText),
-+    maPassHash(r.maPassHash),
-+    maOptions(r.maOptions),
-+    mbEmptyPass(r.mbEmptyPass),
-+    mbProtected(r.mbProtected),
-+    meHash(r.meHash)
-+{
-+}
-+
-+bool ScTableProtectionImpl::isProtected() const
-+{
-+    return mbProtected;
-+}
-+
-+bool ScTableProtectionImpl::isProtectedWithPass() const
-+{
-+    if (!mbProtected)
-+        return false;
-+
-+    return maPassText.Len() || maPassHash.getLength();
-+}
-+
-+void ScTableProtectionImpl::setProtected(bool bProtected)
-+{
-+    mbProtected = bProtected;
-+    // We need to keep the old password even when the protection is off.  So, 
-+    // don't erase the password data here.
-+}
-+
-+void ScTableProtectionImpl::setPassword(const String& aPassText)
-+{
-+    // We can't hash it here because we don't know whether this document will
-+    // get saved to Excel or ODF, depending on which we will need to use a
-+    // different hashing algorithm.  One alternative is to hash it using all
-+    // hash algorithms that we support, and store them all.
-+
-+    maPassText = aPassText;
-+    mbEmptyPass = aPassText.Len() == 0;
-+    if (mbEmptyPass)
-+    {
-+        maPassHash = Sequence<sal_Int8>();
-+    }
-+}
-+
-+bool ScTableProtectionImpl::isPasswordEmpty() const
-+{
-+    return mbEmptyPass;
-+}
-+
-+bool ScTableProtectionImpl::hasPasswordHash(ScPasswordHash eHash) const
-+{
-+    if (mbEmptyPass)
-+        return true;
-+
-+    if (maPassText.Len())
-+        return true;
-+
-+    if (meHash == eHash)
-+        return true;
-+
-+    return false;
-+}
-+
-+Sequence<sal_Int8> ScTableProtectionImpl::getPasswordHash(ScPasswordHash eHash) const
-+{
-+    if (mbEmptyPass)
-+        // Flaged as empty.
-+        return Sequence<sal_Int8>();
-+
-+    if (maPassText.Len())
-+        // Cleartext password exists.  Hash it.
-+        return hashPassword(maPassText, eHash);
-+
-+    if (meHash == eHash)
-+        // Stored hash exists.
-+        return maPassHash;
-+
-+    // Failed to find a matching hash.
-+    return Sequence<sal_Int8>();
-+}
-+
-+void ScTableProtectionImpl::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
-+{
-+    sal_Int32 nLen = aPassword.getLength();
-+    mbEmptyPass = nLen <= 0 ? true : false;
-+    meHash = eHash;
-+    maPassHash = aPassword;
-+
-+#if DEBUG_TAB_PROTECTION
-+    for (sal_Int32 i = 0; i < nLen; ++i)
-+        printf("%2.2X ", static_cast<sal_uInt8>(aPassword[i]));
-+    printf("\n");
-+#endif
-+}
-+
-+bool ScTableProtectionImpl::verifyPassword(const String& aPassText) const
-+{
-+#if DEBUG_TAB_PROTECTION    
-+    fprintf(stdout, "ScTableProtectionImpl::verifyPassword: input = '%s'\n",
-+            OUStringToOString(rtl::OUString(aPassText), RTL_TEXTENCODING_UTF8).getStr());
-+#endif    
-+
-+    if (mbEmptyPass)
-+        return aPassText.Len() == 0;
-+
-+    if (maPassText.Len())
-+        // Clear text password exists, and this one takes precedence.
-+        return aPassText.Equals(maPassText);
-+
-+    Sequence<sal_Int8> aHash = hashPassword(aPassText, meHash);
-+
-+#if DEBUG_TAB_PROTECTION    
-+    fprintf(stdout, "ScTableProtectionImpl::verifyPassword: hash = ");
-+    for (sal_Int32 i = 0; i < aHash.getLength(); ++i)
-+        printf("%2.2X ", static_cast<sal_uInt8>(aHash[i]));
-+    printf("\n");
-+#endif    
-+
-+    return aHash == maPassHash;
-+}
-+
-+bool ScTableProtectionImpl::isOptionEnabled(SCSIZE nOptId) const
-+{
-+    if ( maOptions.size() <= static_cast<size_t>(nOptId) )
-+    {
-+        DBG_ERROR("ScTableProtectionImpl::isOptionEnabled: wrong size");
-+        return false;
-+    }
-+
-+    return maOptions[nOptId];
-+}
-+
-+void ScTableProtectionImpl::setOption(SCSIZE nOptId, bool bEnabled)
-+{
-+    if ( maOptions.size() <= static_cast<size_t>(nOptId) )
-+    {
-+        DBG_ERROR("ScTableProtectionImpl::setOption: wrong size");
-+        return;
-+    }
-+
-+    maOptions[nOptId] = bEnabled;
-+}
-+
-+// ============================================================================
-+
-+ScDocProtection::ScDocProtection() :
-+    mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScDocProtection::NONE)))
-+{
-+}
-+
-+ScDocProtection::ScDocProtection(const ScDocProtection& r) :
-+    ScPassHashProtectable(),
-+    mpImpl(new ScTableProtectionImpl(*r.mpImpl))
-+{
-+}
-+
-+ScDocProtection::~ScDocProtection()
-+{
-+}
-+
-+bool ScDocProtection::isProtected() const
-+{
-+    return mpImpl->isProtected();
-+}
-+
-+bool ScDocProtection::isProtectedWithPass() const
-+{
-+    return mpImpl->isProtectedWithPass();
-+}
-+
-+void ScDocProtection::setProtected(bool bProtected)
-+{
-+    mpImpl->setProtected(bProtected);
-+
-+    // Currently Calc doesn't support document protection options.  So, let's
-+    // assume that when the document is protected, its structure is protected.
-+    // We need to do this for Excel export.
-+    mpImpl->setOption(ScDocProtection::STRUCTURE, bProtected);
-+}
-+
-+bool ScDocProtection::isPasswordEmpty() const
-+{
-+    return mpImpl->isPasswordEmpty();
-+}
-+
-+bool ScDocProtection::hasPasswordHash(ScPasswordHash eHash) const
-+{
-+    return mpImpl->hasPasswordHash(eHash);
-+}
-+
-+void ScDocProtection::setPassword(const String& aPassText)
-+{
-+    mpImpl->setPassword(aPassText);
-+}
-+
-+uno::Sequence<sal_Int8> ScDocProtection::getPasswordHash(ScPasswordHash eHash) const
-+{
-+    return mpImpl->getPasswordHash(eHash);
-+}
-+
-+void ScDocProtection::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
-+{
-+    mpImpl->setPasswordHash(aPassword, eHash);
-+}
-+
-+bool ScDocProtection::verifyPassword(const String& aPassText) const
-+{
-+    return mpImpl->verifyPassword(aPassText);
-+}
-+
-+bool ScDocProtection::isOptionEnabled(Option eOption) const
-+{
-+    return mpImpl->isOptionEnabled(eOption);
-+}
-+
-+void ScDocProtection::setOption(Option eOption, bool bEnabled)
-+{
-+    mpImpl->setOption(eOption, bEnabled);
-+}
-+
-+// ============================================================================
-+
-+ScTableProtection::ScTableProtection() :
-+    mpImpl(new ScTableProtectionImpl(static_cast<SCSIZE>(ScTableProtection::NONE)))
-+{
-+    // Set default values for the options.
-+    mpImpl->setOption(SELECT_LOCKED_CELLS,   true);
-+    mpImpl->setOption(SELECT_UNLOCKED_CELLS, true);
-+}
-+
-+ScTableProtection::ScTableProtection(const ScTableProtection& r) :
-+    ScPassHashProtectable(),
-+    mpImpl(new ScTableProtectionImpl(*r.mpImpl))
-+{
-+}
-+
-+ScTableProtection::~ScTableProtection()
-+{
-+}
-+
-+bool ScTableProtection::isProtected() const
-+{
-+    return mpImpl->isProtected();
-+}
-+
-+bool ScTableProtection::isProtectedWithPass() const
-+{
-+    return mpImpl->isProtectedWithPass();
-+}
-+
-+void ScTableProtection::setProtected(bool bProtected)
-+{
-+    mpImpl->setProtected(bProtected);
-+}
-+
-+bool ScTableProtection::isPasswordEmpty() const
-+{
-+    return mpImpl->isPasswordEmpty();
-+}
-+
-+bool ScTableProtection::hasPasswordHash(ScPasswordHash eHash) const
-+{
-+    return mpImpl->hasPasswordHash(eHash);
-+}
-+
-+void ScTableProtection::setPassword(const String& aPassText)
-+{
-+    mpImpl->setPassword(aPassText);
-+}
-+
-+Sequence<sal_Int8> ScTableProtection::getPasswordHash(ScPasswordHash eHash) const
-+{
-+    return mpImpl->getPasswordHash(eHash);
-+}
-+
-+void ScTableProtection::setPasswordHash(const uno::Sequence<sal_Int8>& aPassword, ScPasswordHash eHash)
-+{
-+    mpImpl->setPasswordHash(aPassword, eHash);
-+}
-+
-+bool ScTableProtection::verifyPassword(const String& aPassText) const
-+{
-+    return mpImpl->verifyPassword(aPassText);
-+}
-+
-+bool ScTableProtection::isOptionEnabled(Option eOption) const
-+{
-+    return mpImpl->isOptionEnabled(eOption);
-+}
-+
-+void ScTableProtection::setOption(Option eOption, bool bEnabled)
-+{
-+    mpImpl->setOption(eOption, bEnabled);
-+}
-+
---- sc/source/filter/excel/excdoc.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/excdoc.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -68,11 +68,11 @@
- #include "convuno.hxx"
- #include "patattr.hxx"
- #include "docoptio.hxx"
-+#include "tabprotection.hxx"
- 
- #include "excdoc.hxx"
- #include "namebuff.hxx"
- 
--#include "xcl97dum.hxx"
- #include "xcl97rec.hxx"
- #include "xcl97esc.hxx"
- #include "xetable.hxx"
-@@ -118,7 +118,7 @@ static void lcl_AddCalcPr( XclExpRecordL
-     aRecList.AppendNewRecord( new XclRefmode( rDoc ) );
-     aRecList.AppendNewRecord( new XclIteration( rDoc ) );
-     aRecList.AppendNewRecord( new XclDelta( rDoc ) );
--    aRecList.AppendNewRecord( new ExcDummy8_02 );
-+    aRecList.AppendNewRecord( new XclExpBoolRecord(0x005F, true) ); // SAVERECALC
-     aRecList.AppendNewRecord( new XclExpXmlEndSingleElementRecord() );  // XML_calcPr
- }
- 
-@@ -209,7 +209,16 @@ void ExcTable::FillAsHeader( ExcBoundshe
- 		Add( new ExcDummy_00 );
- 	else
- 	{
--		Add( new ExcDummy8_00a );
-+        if ( IsDocumentEncrypted() )
-+            Add( new XclExpFilePass(GetRoot()) );
-+
-+        Add( new XclExpInterfaceHdr );
-+        Add( new XclExpMMS );
-+        Add( new XclExpInterfaceEnd );
-+        Add( new XclExpWriteAccess );
-+        Add( new XclExpCodePage );
-+        Add( new XclExpDSF );
-+        Add( new XclExpExcel9File );
- 		rR.pTabId = new XclExpChTrTabId( Max( nExcTabCount, nCodenames ) );
- 		Add( rR.pTabId );
-         if( HasVbaStorage() )
-@@ -219,7 +228,8 @@ void ExcTable::FillAsHeader( ExcBoundshe
-             if( rCodeName.Len() )
-                 Add( new XclCodename( rCodeName ) );
- 		}
--		Add( new ExcDummy8_00b );
-+
-+        Add( new XclExpFnGroupCount );
- 	}
- 
- 	// erst Namen- und Tabellen-Eintraege aufbauen
-@@ -239,12 +249,22 @@ void ExcTable::FillAsHeader( ExcBoundshe
-         aRecList.AppendRecord( CreateRecord( EXC_ID_NAME ) );
-     }
- 
--    aRecList.AppendNewRecord( new XclExpWindowProtection( GetExtDocOptions().GetDocSettings().mbWinProtected ) );
--    aRecList.AppendNewRecord( new XclExpDocProtection( rDoc.IsDocProtected() ) );
--    aRecList.AppendNewRecord( new XclExpBoolRecord( EXC_ID_PASSWORD, false ) );
-+    // document protection options
-+    const ScDocProtection* pProtect = GetDoc().GetDocProtection();
-+    if (pProtect && pProtect->isProtected())
-+    {
-+        Add( new XclExpWindowProtection(pProtect->isOptionEnabled(ScDocProtection::WINDOWS)) );
-+        Add( new XclExpProtection(pProtect->isOptionEnabled(ScDocProtection::STRUCTURE)) );
-+#if ENABLE_SHEET_PROTECTION
-+        Add( new XclExpPassHash(pProtect->getPasswordHash(PASSHASH_XL)) );
-+#endif
-+    }
- 
-     if( GetBiff() == EXC_BIFF8 )
--        Add( new ExcDummy8_040 );
-+    {
-+        Add( new XclExpProt4Rev );
-+        Add( new XclExpProt4RevPass );
-+    }
- 
-     // document protection options
-     if( GetOutput() == EXC_OUTPUT_BINARY )
-@@ -255,6 +275,12 @@ void ExcTable::FillAsHeader( ExcBoundshe
- 
-     Add( new XclExpXmlStartSingleElementRecord( XML_workbookPr ) );
- 
-+    if ( GetBiff() == EXC_BIFF8 )
-+    {
-+        Add( new XclExpBoolRecord(0x0040, false) ); // BACKUP
-+        Add( new XclExpBoolRecord(0x008D, false) ); // HIDEOBJ
-+    }
-+
-     if( GetBiff() <= EXC_BIFF5 )
-     {
- 		Add( new ExcDummy_040 );
-@@ -263,9 +289,12 @@ void ExcTable::FillAsHeader( ExcBoundshe
-     }
-     else
-     {
-+        // BIFF8
-         Add( new Exc1904( rDoc ) );
-         Add( new XclExpBoolRecord( 0x000E, !rDoc.GetDocOptions().IsCalcAsShown() ) );
--        Add( new ExcDummy8_041 );
-+        Add( new XclExpBoolRecord(0x01B7, false) ); // REFRESHALL
-+        Add( new XclExpBoolRecord(0x00DA, false) ); // BOOKBOOL
-+
-         // OOXTODO: The following /workbook/workbookPr attributes are mapped
-         //          to various BIFF records that are not currently supported:
-         //
-@@ -361,10 +390,14 @@ void ExcTable::FillAsHeader( ExcBoundshe
-         if( GetOutput() != EXC_OUTPUT_BINARY )
-             lcl_AddCalcPr( aRecList, *this );
- 
-+        Add( new XclExpRecalcId );
-+
- 		// MSODRAWINGGROUP per-document data
- 		Add( new XclMsodrawinggroup( rR, ESCHER_DggContainer ) );
-         // Shared string table: SST, EXTSST
-         aRecList.AppendRecord( CreateRecord( EXC_ID_SST ) );
-+
-+        Add( new XclExpBookExt );
- 	}
- 
- 	Add( new ExcEof );
-@@ -425,8 +458,16 @@ void ExcTable::FillAsTable( size_t nCode
-     // page settings (SETUP and various other records)
-     aRecList.AppendRecord( xPageSett );
- 
--    if( rDoc.IsTabProtected( mnScTab ) )
--		Add( new XclProtection() );
-+    const ScTableProtection* pTabProtect = rDoc.GetTabProtection(mnScTab);
-+    if (pTabProtect && pTabProtect->isProtected())
-+    {
-+        Add( new XclExpProtection(true) );
-+        Add( new XclExpBoolRecord(0x00DD, pTabProtect->isOptionEnabled(ScTableProtection::SCENARIOS)) );
-+        Add( new XclExpBoolRecord(0x0063, pTabProtect->isOptionEnabled(ScTableProtection::OBJECTS)) );
-+#if ENABLE_SHEET_PROTECTION
-+        Add( new XclExpPassHash(pTabProtect->getPasswordHash(PASSHASH_XL)) );
-+#endif
-+    }
- 
-     // local link table: EXTERNCOUNT, EXTERNSHEET
-     if( eBiff <= EXC_BIFF5 )
-@@ -467,6 +508,9 @@ void ExcTable::FillAsTable( size_t nCode
- 
-     if( eBiff == EXC_BIFF8 )
- 	{
-+        // sheet protection options
-+        Add( new XclExpSheetProtectOptions( GetRoot(), mnScTab ) );
-+
- 		// web queries
-         Add( new XclExpWebQueryBuffer( GetRoot() ) );
- 
---- sc/source/filter/excel/excimp8.cxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/filter/excel/excimp8.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -160,12 +160,6 @@ void ImportExcel8::Iteration( void )
- }
- 
- 
--void ImportExcel8:: WinProtection( void )
--{
--    if( aIn.ReaduInt16() != 0 )
--        GetExtDocOptions().GetDocSettings().mbWinProtected = true;
--}
--
- void ImportExcel8::Boundsheet( void )
- {
- 	UINT8			nLen;
-@@ -249,6 +243,11 @@ void ImportExcel8::Codename( BOOL bWorkb
- 	}
- }
- 
-+void ImportExcel8::SheetProtection( void )
-+{
-+    GetSheetProtectBuffer().ReadOptions( aIn, GetCurrScTab() );
-+}
-+
- bool lcl_hasVBAEnabled()
- {
- 	uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY);
-@@ -295,6 +294,8 @@ void ImportExcel8::PostDocLoad( void )
-         pExcRoot->pAutoFilterBuffer->Apply();
- 
-     GetWebQueryBuffer().Apply();    //! test if extant
-+    GetSheetProtectBuffer().Apply();
-+    GetDocProtectBuffer().Apply();
- 
- 	ImportExcel::PostDocLoad();
- 
---- sc/source/filter/excel/excrecds.cxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/filter/excel/excrecds.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -340,6 +340,7 @@ sal_Size ExcFngroupcount::GetLen( void )
- }
- 
- 
-+using ::com::sun::star::uno::Sequence;
- 
- //--------------------------------------------------------- class ExcDummy_00 -
- 
-@@ -432,7 +433,9 @@ ExcBundlesheetBase::ExcBundlesheetBase()
- void ExcBundlesheetBase::UpdateStreamPos( XclExpStream& rStrm )
- {
-     rStrm.SetSvStreamPos( nOwnPos );
-+    rStrm.DisableEncryption();
- 	rStrm << static_cast<sal_uInt32>(nStrPos);
-+    rStrm.EnableEncryption();
- }
- 
- 
-@@ -543,14 +546,36 @@ void XclExpWindowProtection::SaveXml( Xc
-             FSEND );
- }
- 
--// XclExpDocProtection ===============================================================
-+// XclExpProtection ===========================================================
- 
--XclExpDocProtection::XclExpDocProtection(bool bValue) :
-+XclExpProtection::XclExpProtection(bool bValue) :
- 	XclExpBoolRecord(EXC_ID_PROTECT,bValue)
- {
- }
- 
- // ============================================================================
-+
-+XclExpPassHash::XclExpPassHash(const Sequence<sal_Int8>& aHash) :
-+    XclExpRecord(EXC_ID_PASSWORD, 2),
-+    mnHash(0x0000)
-+{
-+    if (aHash.getLength() >= 2)
-+    {
-+        mnHash  = ((aHash[0] << 8) & 0xFFFF);
-+        mnHash |= (aHash[1] & 0xFF);
-+    }
-+}
-+
-+XclExpPassHash::~XclExpPassHash()
-+{
-+}
-+
-+void XclExpPassHash::WriteBody(XclExpStream& rStrm)
-+{
-+    rStrm << mnHash;
-+}
-+
-+// ============================================================================
- 
- XclExpFiltermode::XclExpFiltermode() :
-     XclExpEmptyRecord( EXC_ID_FILTERMODE )
---- sc/source/filter/excel/impop.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/impop.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -84,6 +84,7 @@
- #include "xiview.hxx"
- #include "xilink.hxx"
- #include "xiescher.hxx"
-+#include "xicontent.hxx"
- 
- #include "excimp8.hxx"
- #include "excform.hxx"
-@@ -418,14 +419,12 @@ void ImportExcel::Eof( void )
- }
- 
- 
--BOOL ImportExcel::Password( void )
-+void ImportExcel::SheetPassword( void )
- {
--	// POST: return = TRUE, wenn Password <> 0
--	UINT16 nPasswd;
-+    if (GetRoot().GetBiff() != EXC_BIFF8)
-+        return;
- 
--	aIn >> nPasswd;
--
--	return nPasswd != 0x0000;
-+    GetRoot().GetSheetProtectBuffer().ReadPasswordHash( aIn, GetCurrScTab() );
- }
- 
- 
-@@ -439,6 +438,15 @@ void ImportExcel::Externsheet( void )
- }
- 
- 
-+void ImportExcel:: WinProtection( void )
-+{
-+    if (GetRoot().GetBiff() != EXC_BIFF8)
-+        return;
-+
-+    GetRoot().GetDocProtectBuffer().ReadWinProtect( aIn );
-+}
-+
-+
- void ImportExcel::Columndefault( void )
- {// Default Cell Attributes
- 	UINT16	nColMic, nColMac;
-@@ -570,27 +578,33 @@ void ImportExcel::Defrowheight2( void )
- }
- 
- 
--void ImportExcel::Protect( void )
-+void ImportExcel::SheetProtect( void )
- {
--    if( aIn.ReaduInt16() )
--    {
--        uno::Sequence<sal_Int8> aEmptyPass;
--        GetDoc().SetTabProtection( GetCurrScTab(), TRUE, aEmptyPass );
--    }
-+    if (GetRoot().GetBiff() != EXC_BIFF8)
-+        return;
-+
-+    GetRoot().GetSheetProtectBuffer().ReadProtect( aIn, GetCurrScTab() );
- }
- 
- void ImportExcel::DocProtect( void )
- {
--    if( aIn.ReaduInt16() )
--    {
--        uno::Sequence<sal_Int8> aEmptyPass;
--        GetDoc().SetDocProtection( TRUE, aEmptyPass );
--    }
-+    if (GetRoot().GetBiff() != EXC_BIFF8)
-+        return;
-+
-+    GetRoot().GetDocProtectBuffer().ReadDocProtect( aIn );
- }
- 
-+void ImportExcel::DocPasssword( void )
-+{
-+    if (GetRoot().GetBiff() != EXC_BIFF8)
-+        return;
-+
-+    GetRoot().GetDocProtectBuffer().ReadPasswordHash( aIn );
-+}
- 
- void ImportExcel::Codepage( void )
- {
-+    maStrm.EnableDecryption();
-     SetCodePage( maStrm.ReaduInt16() );
- }
- 
---- sc/source/filter/excel/read.cxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/filter/excel/read.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -363,7 +363,7 @@ FltError ImportExcel::Read( void )
-                         Eof();
- 						eAkt = Z_Ende;
- 						break;
--					case 0x12:  Protect(); break;       // SHEET PROTECTION
-+					case 0x12:  SheetProtect(); break;       // SHEET PROTECTION
-                     case 0x14:
-                     case 0x15:  rPageSett.ReadHeaderFooter( maStrm );   break;
- 					case 0x17:	Externsheet(); break;	// EXTERNSHEET	[ 2345]
-@@ -478,7 +478,7 @@ FltError ImportExcel::Read( void )
-                         Eof();
-                         eAkt = Z_Biff4E;
-                     break;
--					case 0x12:  Protect(); break;       // SHEET PROTECTION
-+					case 0x12:  SheetProtect(); break;       // SHEET PROTECTION
-                     case 0x14:
-                     case 0x15:  rPageSett.ReadHeaderFooter( maStrm );   break;
-                     case 0x1A:
-@@ -605,7 +605,7 @@ FltError ImportExcel::Read( void )
-                             eAkt = Z_Biff5T;
-                             aIn.SeekGlobalPosition(); // und zurueck an alte Position
-                             break;
--                        case 0x12:  Protect(); break;       // SHEET PROTECTION
-+                        case 0x12:  SheetProtect(); break;       // SHEET PROTECTION
-                         case 0x1A:
-                         case 0x1B:  rPageSett.ReadPageBreaks( maStrm );     break;
-                         case 0x1D:  rTabViewSett.ReadSelection( maStrm );   break;
-@@ -904,6 +904,7 @@ FltError ImportExcel8::Read( void )
-                         }
- 						break;
- 					case 0x12:	DocProtect(); break;	// PROTECT		[    5678]
-+                    case 0x13:  DocPasssword(); break;
- 					case 0x19:  WinProtection(); break;
- 					case 0x2F:							// FILEPASS		[ 2345   ]
-                         eLastErr = XclImpDecryptHelper::ReadFilepass( maStrm );
-@@ -1048,7 +1049,8 @@ FltError ImportExcel8::Read( void )
-                         eAkt = EXC_STATE_SHEET;
-                         aIn.SeekGlobalPosition();         // und zurueck an alte Position
-                         break;
--                    case 0x12:  Protect(); break;
-+                    case 0x12:  SheetProtect(); break;
-+                    case 0x13:  SheetPassword(); break;
-                     case 0x42:  Codepage(); break;      // CODEPAGE     [ 2345   ]
-                     case 0x55:  DefColWidth(); break;
-                     case 0x7D:  Colinfo(); break;       // COLINFO      [  345   ]
-@@ -1064,6 +1066,7 @@ FltError ImportExcel8::Read( void )
-                     case 0x0221: Array34(); break;      // ARRAY        [  34    ]
-                     case 0x0225: Defrowheight345();break;//DEFAULTROWHEI[  345   ]
-                     case 0x04BC: Shrfmla(); break;      // SHRFMLA      [    5   ]
-+                    case 0x0867: SheetProtection(); break; // SHEETPROTECTION
-                 }
-             }
-             break;
---- sc/source/filter/excel/xeroot.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xeroot.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -31,7 +31,11 @@
- // MARKER(update_precomp.py): autogen include statement, do not remove
- #include "precompiled_sc.hxx"
- #include <sfx2/docfile.hxx>
-+#include <sfx2/sfxsids.hrc>
- #include <svtools/saveopt.hxx>
-+#include <svtools/itemset.hxx>
-+#include <svtools/stritem.hxx>
-+#include <svtools/eitem.hxx>
- #include "xecontent.hxx"
- #include "xltracer.hxx"
- #include "xehelper.hxx"
-@@ -42,8 +46,10 @@
- #include "xepivot.hxx"
- #include "xeroot.hxx"
- 
--// for filter manager
--#include "excrecds.hxx"
-+#include "excrecds.hxx"  // for filter manager
-+#include "tabprotection.hxx"
-+#include "document.hxx"
-+#include "scextopt.hxx"
- 
- // Global data ================================================================
- 
-@@ -221,6 +227,40 @@ XclExpRecordRef XclExpRoot::CreateRecord
-     return xRec;
- }
- 
-+bool XclExpRoot::IsDocumentEncrypted() const
-+{
-+    // We need to encrypt the content when the document structure is protected.
-+    const ScDocProtection* pDocProt = GetDoc().GetDocProtection();
-+    if (pDocProt && pDocProt->isProtected() && pDocProt->isOptionEnabled(ScDocProtection::STRUCTURE))
-+        return true;
-+
-+    if (GetPassword().Len() > 0)
-+        // Password is entered directly into the save dialog.
-+        return true;
-+
-+    return false;
-+}
-+
-+const String XclExpRoot::GetPassword() const
-+{
-+    SfxItemSet* pSet = GetMedium().GetItemSet();
-+    if (!pSet)
-+        return String();
-+
-+    const SfxPoolItem* pItem = NULL;
-+    if (SFX_ITEM_SET == pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
-+    {
-+        const SfxStringItem* pStrItem = dynamic_cast<const SfxStringItem*>(pItem);
-+        if (pStrItem)
-+        {
-+            // Password from the save dialog.
-+            return pStrItem->GetValue();
-+        }
-+    }
-+
-+    return String();
-+}
-+
- XclExpRootData::XclExpLinkMgrRef XclExpRoot::GetLocalLinkMgrRef() const
- {
-     return IsInGlobals() ? mrExpData.mxGlobLinkMgr : mrExpData.mxLocLinkMgr;
---- sc/source/filter/excel/xestream.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xestream.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -51,6 +51,10 @@
- #include <oox/core/tokens.hxx>
- #include <formula/grammar.hxx>
- 
-+#define DEBUG_XL_ENCRYPTION 0
-+
-+using ::std::vector;
-+
- using ::com::sun::star::beans::PropertyValue;
- using ::com::sun::star::io::XOutputStream;
- using ::com::sun::star::io::XStream;
-@@ -92,16 +96,19 @@ XclExpStream::~XclExpStream()
- void XclExpStream::StartRecord( sal_uInt16 nRecId, sal_Size nRecSize )
- {
-     DBG_ASSERT( !mbInRec, "XclExpStream::StartRecord - another record still open" );
-+    DisableEncryption();
-     mnMaxContSize = mnCurrMaxSize = mnMaxRecSize;
-     mnPredictSize = nRecSize;
-     mbInRec = true;
-     InitRecord( nRecId );
-     SetSliceSize( 0 );
-+    EnableEncryption();
- }
- 
- void XclExpStream::EndRecord()
- {
-     DBG_ASSERT( mbInRec, "XclExpStream::EndRecord - no record open" );
-+    DisableEncryption();
-     UpdateRecSize();
-     mrStrm.Seek( STREAM_SEEK_TO_END );
-     mbInRec = false;
-@@ -113,6 +120,86 @@ void XclExpStream::SetSliceSize( sal_uIn
-     mnSliceSize = 0;
- }
- 
-+XclExpStream& XclExpStream::operator<<( sal_Int8 nValue )
-+{
-+    PrepareWrite( 1 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, nValue);
-+    else
-+        mrStrm << nValue;
-+    return *this;
-+}
-+
-+XclExpStream& XclExpStream::operator<<( sal_uInt8 nValue )
-+{
-+    PrepareWrite( 1 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, nValue);
-+    else
-+        mrStrm << nValue;
-+    return *this;
-+}
-+
-+XclExpStream& XclExpStream::operator<<( sal_Int16 nValue )
-+{
-+    PrepareWrite( 2 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, nValue);
-+    else
-+        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 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, nValue);
-+    else
-+        mrStrm << nValue;
-+    return *this;
-+}
-+
-+XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
-+{
-+    PrepareWrite( 4 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, nValue);
-+    else
-+        mrStrm << nValue;
-+    return *this;
-+}
-+
-+XclExpStream& XclExpStream::operator<<( float fValue )
-+{
-+    PrepareWrite( 4 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, fValue);
-+    else
-+        mrStrm << fValue;
-+    return *this;
-+}
-+
-+XclExpStream& XclExpStream::operator<<( double fValue )
-+{
-+    PrepareWrite( 8 );
-+    if (mbUseEncrypter && HasValidEncrypter())
-+        mxEncrypter->Encrypt(mrStrm, fValue);
-+    else
-+        mrStrm << fValue;
-+    return *this;
-+}
-+
- sal_Size XclExpStream::Write( const void* pData, sal_Size nBytes )
- {
-     sal_Size nRet = 0;
-@@ -127,9 +214,21 @@ sal_Size XclExpStream::Write( const void
-             while( bValid && (nBytesLeft > 0) )
-             {
-                 sal_Size nWriteLen = ::std::min< sal_Size >( PrepareWrite(), nBytesLeft );
--                sal_Size nWriteRet = mrStrm.Write( pBuffer, nWriteLen );
-+                sal_Size nWriteRet = nWriteLen;
-+                if (mbUseEncrypter && HasValidEncrypter())
-+                {
-+                    DBG_ASSERT(nWriteLen > 0, "XclExpStream::Write: write length is 0!");
-+                    vector<sal_uInt8> aBytes(nWriteLen);
-+                    memcpy(&aBytes[0], pBuffer, nWriteLen);
-+                    mxEncrypter->EncryptBytes(mrStrm, aBytes);
-+                    // TODO: How do I check if all the bytes have been successfully written ?
-+                }
-+                else
-+                {
-+                    nWriteRet = mrStrm.Write( pBuffer, nWriteLen );
-                 bValid = (nWriteLen == nWriteRet);
-                 DBG_ASSERT( bValid, "XclExpStream::Write - stream write error" );
-+                }
-                 pBuffer += nWriteRet;
-                 nRet += nWriteRet;
-                 nBytesLeft -= nWriteRet;
-@@ -265,6 +364,26 @@ void XclExpStream::WriteCharBuffer( cons
-     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" );
-@@ -356,6 +475,190 @@ void XclExpStream::WriteRawZeroBytes( sa
- 
- // ============================================================================
- 
-+XclExpBiff8Encrypter::XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16],
-+                                            const sal_uInt8 nSalt[16] ) :
-+    mrRoot(rRoot),
-+    mnOldPos(STREAM_SEEK_TO_END),
-+    mbValid(false)
-+{
-+    String aPass = rRoot.GetPassword();
-+    if (aPass.Len() == 0)
-+        // Empty password.  Get the default biff8 password.
-+        aPass = XclCryptoHelper::GetBiff8WbProtPassword();
-+    Init(aPass, nDocId, nSalt);
-+}
-+
-+XclExpBiff8Encrypter::~XclExpBiff8Encrypter()
-+{
-+}
-+
-+bool XclExpBiff8Encrypter::IsValid() const
-+{
-+    return mbValid;
-+}
-+
-+void XclExpBiff8Encrypter::GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const
-+{
-+    memcpy(nSaltDigest, mnSaltDigest, 16);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt8 nData )
-+{
-+    vector<sal_uInt8> aByte(1);
-+    aByte[0] = nData;
-+    EncryptBytes(rStrm, aByte);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt16 nData )
-+{
-+    ::std::vector<sal_uInt8> pnBytes(2);
-+    pnBytes[0] = nData & 0xFF;
-+    pnBytes[1] = (nData >> 8) & 0xFF;
-+    EncryptBytes(rStrm, pnBytes);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_uInt32 nData )
-+{
-+    ::std::vector<sal_uInt8> pnBytes(4);
-+    pnBytes[0] = nData & 0xFF;
-+    pnBytes[1] = (nData >>  8) & 0xFF;
-+    pnBytes[2] = (nData >> 16) & 0xFF;
-+    pnBytes[3] = (nData >> 24) & 0xFF;
-+    EncryptBytes(rStrm, pnBytes);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, float fValue )
-+{
-+    ::std::vector<sal_uInt8> pnBytes(4);
-+    memcpy(&pnBytes[0], &fValue, 4);
-+    EncryptBytes(rStrm, pnBytes);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, double fValue )
-+{
-+    ::std::vector<sal_uInt8> pnBytes(8);
-+    memcpy(&pnBytes[0], &fValue, 8);
-+    EncryptBytes(rStrm, pnBytes);
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int8 nData )
-+{
-+    Encrypt(rStrm, static_cast<sal_uInt8>(nData));
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int16 nData )
-+{
-+    Encrypt(rStrm, static_cast<sal_uInt16>(nData));
-+}
-+
-+void XclExpBiff8Encrypter::Encrypt( SvStream& rStrm, sal_Int32 nData )
-+{
-+    Encrypt(rStrm, static_cast<sal_uInt32>(nData));
-+}
-+
-+void XclExpBiff8Encrypter::Init( const String& aPass, const sal_uInt8 nDocId[16],
-+                                 const sal_uInt8 nSalt[16] )
-+{
-+    memset(mnSaltDigest, 0, sizeof(mnSaltDigest));
-+
-+    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);
-+
-+        // generate salt hash.
-+        ::svx::MSCodec_Std97 aCodec;
-+        aCodec.InitKey(mnPassw, mnDocId);
-+        aCodec.CreateSaltDigest(nSalt, mnSaltDigest);
-+
-+        // verify to make sure it's in good shape.
-+        bValid = maCodec.VerifyKey(nSalt, mnSaltDigest);
-+    }
-+
-+    mbValid = bValid;
-+}
-+
-+sal_uInt32 XclExpBiff8Encrypter::GetBlockPos( sal_Size nStrmPos ) const
-+{
-+    return static_cast<sal_uInt32>(nStrmPos / EXC_ENCR_BLOCKSIZE);
-+}
-+
-+sal_uInt16 XclExpBiff8Encrypter::GetOffsetInBlock( sal_Size nStrmPos ) const
-+{
-+    return static_cast<sal_uInt16>(nStrmPos % EXC_ENCR_BLOCKSIZE);
-+}
-+
-+void XclExpBiff8Encrypter::EncryptBytes( SvStream& rStrm, vector<sal_uInt8>& aBytes )
-+{
-+    sal_Size nStrmPos = rStrm.Tell();
-+    sal_uInt16 nBlockOffset = GetOffsetInBlock(nStrmPos);
-+    sal_uInt16 nBlockPos = GetBlockPos(nStrmPos);
-+
-+#if DEBUG_XL_ENCRYPTION
-+    fprintf(stdout, "XclExpBiff8Encrypter::EncryptBytes: stream pos = %ld  offset in block = %d  block pos = %ld\n",
-+            nStrmPos, nBlockOffset, nBlockPos);
-+#endif
-+
-+    sal_uInt16 nSize = aBytes.size();
-+    if (nSize == 0)
-+        return;
-+
-+#if DEBUG_XL_ENCRYPTION    
-+    fprintf(stdout, "RAW: ");
-+    for (sal_uInt16 i = 0; i < nSize; ++i)
-+        fprintf(stdout, "%2.2X ", aBytes[i]);
-+    fprintf(stdout, "\n");
-+#endif    
-+
-+    if (mnOldPos != nStrmPos)
-+    {
-+        sal_uInt16 nOldOffset = GetOffsetInBlock(mnOldPos);
-+        sal_uInt16 nOldBlockPos = GetBlockPos(mnOldPos);
-+
-+        if ( (nBlockPos != nOldBlockPos) || (nBlockOffset < nOldOffset) )
-+        {
-+            maCodec.InitCipher(nBlockPos);
-+            nOldOffset = 0;
-+        }
-+
-+        if (nBlockOffset > nOldOffset)
-+            maCodec.Skip(nBlockOffset - nOldOffset);
-+    }
-+
-+    sal_uInt16 nBytesLeft = nSize;
-+    sal_uInt16 nPos = 0;
-+    while (nBytesLeft > 0)
-+    {
-+        sal_uInt16 nBlockLeft = EXC_ENCR_BLOCKSIZE - nBlockOffset;
-+        sal_uInt16 nEncBytes = ::std::min(nBlockLeft, nBytesLeft);
-+
-+        bool bRet = maCodec.Encode(&aBytes[nPos], nEncBytes, &aBytes[nPos], nEncBytes);
-+        DBG_ASSERT(bRet, "XclExpBiff8Encrypter::EncryptBytes: encryption failed!!");
-+
-+        sal_Size nRet = rStrm.Write(&aBytes[nPos], nEncBytes);
-+        DBG_ASSERT(nRet == nEncBytes, "XclExpBiff8Encrypter::EncryptBytes: fail to write to stream!!");
-+
-+        nStrmPos = rStrm.Tell();
-+        nBlockOffset = GetOffsetInBlock(nStrmPos);
-+        nBlockPos = GetBlockPos(nStrmPos);
-+        if (nBlockOffset == 0)
-+            maCodec.InitCipher(nBlockPos);
-+
-+        nBytesLeft -= nEncBytes;
-+        nPos += nEncBytes;
-+    }
-+    mnOldPos = nStrmPos;
-+}
- rtl::OUString XclXmlUtils::GetStreamName( const char* sStreamDir, const char* sStream, sal_Int32 nId )
- {
-     rtl::OUStringBuffer sBuf;
---- sc/source/filter/excel/xicontent.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xicontent.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -41,6 +41,7 @@
- #include "scitems.hxx"
- #include <svx/eeitem.hxx>
- #include <svtools/intitem.hxx>
-+#include <svtools/stritem.hxx>
- #include <svx/flditem.hxx>
- #include <svx/fhgtitem.hxx>
- #include <svx/wghtitem.hxx>
-@@ -67,6 +68,12 @@
- #include "xiname.hxx"
- 
- #include "excform.hxx"
-+#include "tabprotection.hxx"
-+
-+#include <memory>
-+
-+using ::com::sun::star::uno::Sequence;
-+using ::std::auto_ptr;
- 
- // Shared string table ========================================================
- 
-@@ -1091,11 +1098,186 @@ ErrCode XclImpDecryptHelper::ReadFilepas
-     };
-     // set decrypter at import stream
-     rStrm.SetDecrypter( xDecr );
--    // remember encryption for export
--    rStrm.GetRoot().GetExtDocOptions().GetDocSettings().mbEncrypted = true;
-+
-+    // Store the document password for export.
-+    SfxItemSet* pSet = rStrm.GetRoot().GetDocShell()->GetMedium()->GetItemSet();
-+    if (pSet)
-+    {
-+        String aPass = xDecr->GetPassword();
-+        pSet->Put( SfxStringItem(SID_PASSWORD, aPass) );
-+    }
- 
-     return xDecr.is() ? xDecr->GetError() : EXC_ENCR_ERROR_UNSUPP_CRYPT;
- }
- 
-+// Document protection ========================================================
-+
-+XclImpDocProtectBuffer::XclImpDocProtectBuffer( const XclImpRoot& rRoot ) :
-+    XclImpRoot( rRoot ),
-+    mnPassHash(0x0000),
-+    mbDocProtect(false),
-+    mbWinProtect(false)
-+{
-+}
-+
-+void XclImpDocProtectBuffer::ReadDocProtect( XclImpStream& rStrm )
-+{
-+    mbDocProtect = rStrm.ReaduInt16() ? true : false;
-+}
-+
-+void XclImpDocProtectBuffer::ReadWinProtect( XclImpStream& rStrm )
-+{
-+    mbWinProtect = rStrm.ReaduInt16() ? true : false;
-+}
-+
-+void XclImpDocProtectBuffer::ReadPasswordHash( XclImpStream& rStrm )
-+{
-+    rStrm.EnableDecryption();
-+    mnPassHash = rStrm.ReaduInt16();
-+}
-+
-+void XclImpDocProtectBuffer::Apply() const
-+{
-+    if (!mbDocProtect && !mbWinProtect)
-+        // Excel requires either the structure or windows protection is set.
-+        // If neither is set then the document is not protected at all.
-+        return;
-+
-+    auto_ptr<ScDocProtection> pProtect(new ScDocProtection);
-+    pProtect->setProtected(true);
-+
-+#if ENABLE_SHEET_PROTECTION
-+    if (mnPassHash)
-+    {
-+        // 16-bit password pash.
-+        Sequence<sal_Int8> aPass(2);
-+        aPass[0] = (mnPassHash >> 8) & 0xFF;
-+        aPass[1] = mnPassHash & 0xFF;
-+        pProtect->setPasswordHash(aPass, PASSHASH_XL);
-+    }
-+#endif
-+
-+    // document protection options
-+    pProtect->setOption(ScDocProtection::STRUCTURE, mbDocProtect);
-+    pProtect->setOption(ScDocProtection::WINDOWS,   mbWinProtect);
-+
-+    GetDoc().SetDocProtection(pProtect.get());
-+}
-+
-+// Sheet Protection ===========================================================
-+
-+XclImpSheetProtectBuffer::Sheet::Sheet() :
-+    mbProtected(false),
-+    mnPasswordHash(0x0000),
-+    mnOptions(0x4400)
-+{
-+}
-+
-+// ----------------------------------------------------------------------------
-+
-+XclImpSheetProtectBuffer::Sheet::Sheet(const Sheet& r) :
-+    mbProtected(r.mbProtected),
-+    mnPasswordHash(r.mnPasswordHash),
-+    mnOptions(r.mnOptions)
-+{
-+}
-+
-+XclImpSheetProtectBuffer::XclImpSheetProtectBuffer( const XclImpRoot& rRoot ) :
-+    XclImpRoot( rRoot )
-+{
-+}
-+
-+void XclImpSheetProtectBuffer::ReadProtect( XclImpStream& rStrm, SCTAB nTab )
-+{
-+    if ( rStrm.ReaduInt16() )
-+    {
-+        Sheet* pSheet = GetSheetItem(nTab);
-+        if (pSheet)
-+            pSheet->mbProtected = true;
-+    }
-+}
-+
-+void XclImpSheetProtectBuffer::ReadOptions( XclImpStream& rStrm, SCTAB nTab )
-+{
-+    rStrm.Ignore(19);
-+    sal_uInt16 nOptions;
-+    rStrm >> nOptions;
-+
-+    Sheet* pSheet = GetSheetItem(nTab);
-+    if (pSheet)
-+        pSheet->mnOptions = nOptions;
-+}
-+
-+void XclImpSheetProtectBuffer::ReadPasswordHash( XclImpStream& rStrm, SCTAB nTab )
-+{
-+    sal_uInt16 nHash;
-+    rStrm >> nHash;
-+    Sheet* pSheet = GetSheetItem(nTab);
-+    if (pSheet)
-+        pSheet->mnPasswordHash = nHash;
-+}
-+
-+void XclImpSheetProtectBuffer::Apply() const
-+{
-+    for (ProtectedSheetMap::const_iterator itr = maProtectedSheets.begin(), itrEnd = maProtectedSheets.end();
-+         itr != itrEnd; ++itr)
-+    {
-+        if (!itr->second.mbProtected)
-+            // This sheet is (for whatever reason) not protected.
-+            continue;
-+
-+        auto_ptr<ScTableProtection> pProtect(new ScTableProtection);
-+        pProtect->setProtected(true);
-+
-+#if ENABLE_SHEET_PROTECTION
-+        // 16-bit hash password
-+        const sal_uInt16 nHash = itr->second.mnPasswordHash;
-+        if (nHash)
-+        {
-+            Sequence<sal_Int8> aPass(2);
-+            aPass[0] = (nHash >> 8) & 0xFF;
-+            aPass[1] = nHash & 0xFF;
-+            pProtect->setPasswordHash(aPass, PASSHASH_XL);
-+        }
-+#endif
-+
-+        // sheet protection options
-+        const sal_uInt16 nOptions = itr->second.mnOptions;
-+        pProtect->setOption( ScTableProtection::OBJECTS,               (nOptions & 0x0001) );
-+        pProtect->setOption( ScTableProtection::SCENARIOS,             (nOptions & 0x0002) );
-+        pProtect->setOption( ScTableProtection::FORMAT_CELLS,          (nOptions & 0x0004) );
-+        pProtect->setOption( ScTableProtection::FORMAT_COLUMNS,        (nOptions & 0x0008) );
-+        pProtect->setOption( ScTableProtection::FORMAT_ROWS,           (nOptions & 0x0010) );
-+        pProtect->setOption( ScTableProtection::INSERT_COLUMNS,        (nOptions & 0x0020) );
-+        pProtect->setOption( ScTableProtection::INSERT_ROWS,           (nOptions & 0x0040) );
-+        pProtect->setOption( ScTableProtection::INSERT_HYPERLINKS,     (nOptions & 0x0080) );
-+        pProtect->setOption( ScTableProtection::DELETE_COLUMNS,        (nOptions & 0x0100) );
-+        pProtect->setOption( ScTableProtection::DELETE_ROWS,           (nOptions & 0x0200) );
-+        pProtect->setOption( ScTableProtection::SELECT_LOCKED_CELLS,   (nOptions & 0x0400) );
-+        pProtect->setOption( ScTableProtection::SORT,                  (nOptions & 0x0800) );
-+        pProtect->setOption( ScTableProtection::AUTOFILTER,            (nOptions & 0x1000) );
-+        pProtect->setOption( ScTableProtection::PIVOT_TABLES,          (nOptions & 0x2000) );
-+        pProtect->setOption( ScTableProtection::SELECT_UNLOCKED_CELLS, (nOptions & 0x4000) );
-+
-+        // all done.  now commit.
-+        GetDoc().SetTabProtection(itr->first, pProtect.get());
-+    }
-+}
-+
-+XclImpSheetProtectBuffer::Sheet* XclImpSheetProtectBuffer::GetSheetItem( SCTAB nTab )
-+{
-+    ProtectedSheetMap::iterator itr = maProtectedSheets.find(nTab);
-+    if (itr == maProtectedSheets.end())
-+    {
-+        // new sheet
-+        if ( !maProtectedSheets.insert( ProtectedSheetMap::value_type(nTab, Sheet()) ).second )
-+            return NULL;
-+
-+        itr = maProtectedSheets.find(nTab);
-+    }
-+
-+    return &itr->second;
-+}
-+
- // ============================================================================
- 
---- sc/source/filter/excel/xilink.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xilink.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -263,6 +263,7 @@ void XclImpTabInfo::ReadTabid( XclImpStr
-     DBG_ASSERT_BIFF( rStrm.GetRoot().GetBiff() == EXC_BIFF8 );
-     if( rStrm.GetRoot().GetBiff() == EXC_BIFF8 )
-     {
-+        rStrm.EnableDecryption();
-         sal_Size nReadCount = rStrm.GetRecLeft() / 2;
-         DBG_ASSERT( nReadCount <= 0xFFFF, "XclImpTabInfo::ReadTabid - record too long" );
-         maTabIdVec.clear();
---- sc/source/filter/excel/xiroot.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xiroot.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -52,6 +52,7 @@
- XclImpRootData::XclImpRootData( XclBiff eBiff, SfxMedium& rMedium,
-         SotStorageRef xRootStrg, ScDocument& rDoc, rtl_TextEncoding eTextEnc ) :
-     XclRootData( eBiff, rMedium, xRootStrg, rDoc, eTextEnc, false ),
-+    mbPassQueried( false ),
-     mbHasCodePage( false )
- {
- }
-@@ -86,6 +87,8 @@ XclImpRoot::XclImpRoot( XclImpRootData&
-         GetOldRoot().pAutoFilterBuffer = new XclImpAutoFilterBuffer;
-         mrImpData.mxWebQueryBfr.reset( new XclImpWebQueryBuffer( GetRoot() ) );
-         mrImpData.mxPTableMgr.reset( new XclImpPivotTableManager( GetRoot() ) );
-+        mrImpData.mxTabProtect.reset( new XclImpSheetProtectBuffer( GetRoot() ) );
-+        mrImpData.mxDocProtect.reset( new XclImpDocProtectBuffer( GetRoot() ) );
-     }
- 
-     mrImpData.mxPageSett.reset( new XclImpPageSettings( GetRoot() ) );
-@@ -232,6 +235,18 @@ XclImpPivotTableManager& XclImpRoot::Get
-     return *mrImpData.mxPTableMgr;
- }
- 
-+XclImpSheetProtectBuffer& XclImpRoot::GetSheetProtectBuffer() const
-+{
-+    DBG_ASSERT( mrImpData.mxTabProtect.is(), "XclImpRoot::GetSheetProtectBuffer - invalid call, wrong BIFF" );
-+    return *mrImpData.mxTabProtect;
-+}
-+
-+XclImpDocProtectBuffer& XclImpRoot::GetDocProtectBuffer() const
-+{
-+    DBG_ASSERT( mrImpData.mxDocProtect.is(), "XclImpRoot::GetDocProtectBuffer - invalid call, wrong BIFF" );
-+    return *mrImpData.mxDocProtect;
-+}
-+
- XclImpPageSettings& XclImpRoot::GetPageSettings() const
- {
-     return *mrImpData.mxPageSett;
-@@ -255,5 +270,16 @@ String XclImpRoot::GetScAddInName( const
-     return rXclName;
- }
- 
-+const String& XclImpRoot::QueryPassword() const
-+{
-+    if( !mrImpData.mbPassQueried )
-+    {
-+        mrImpData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() );
-+        // set to true, even if dialog has been cancelled (never ask twice)
-+        mrImpData.mbPassQueried = true;
-+    }
-+    return mrImpData.maPassw;
-+}
-+
- // ============================================================================
- 
---- sc/source/filter/excel/xistream.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xistream.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -36,6 +36,8 @@
- #include "xlstring.hxx"
- #include "xiroot.hxx"
- 
-+#include <vector>
-+
- // ============================================================================
- // Decryption
- // ============================================================================
-@@ -97,11 +99,21 @@ sal_uInt16 XclImpDecrypter::Read( SvStre
-     return nRet;
- }
- 
-+const String XclImpDecrypter::GetPassword() const
-+{
-+    return maPass;
-+}
-+
- void XclImpDecrypter::SetHasValidPassword( bool bValid )
- {
-     mnError = bValid ? ERRCODE_NONE : EXC_ENCR_ERROR_WRONG_PASS;
- }
- 
-+void XclImpDecrypter::SetPassword( const String& rPass )
-+{
-+    maPass = rPass;
-+}
-+
- // ----------------------------------------------------------------------------
- 
- XclImpBiff5Decrypter::XclImpBiff5Decrypter( const XclImpRoot& rRoot, sal_uInt16 nKey, sal_uInt16 nHash )
-@@ -157,6 +169,9 @@ void XclImpBiff5Decrypter::Init( const B
-         // init codec
-         maCodec.InitKey( mpnPassw );
-         bValid = maCodec.VerifyKey( nKey, nHash );
-+
-+        String aUniPass( rPass, RTL_TEXTENCODING_MS_1252 );
-+        SetPassword( aUniPass );
-     }
- 
-     SetHasValidPassword( bValid );
-@@ -255,6 +270,8 @@ void XclImpBiff8Decrypter::Init(
-         // init codec
-         maCodec.InitKey( mpnPassw, mpnDocId );
-         bValid = maCodec.VerifyKey( pnSaltData, pnSaltHash );
-+
-+        SetPassword(rPass);
-     }
- 
-     SetHasValidPassword( bValid );
---- sc/source/filter/excel/xlroot.cxx.old	2009-04-02 10:44:55.000000000 +0000
-+++ sc/source/filter/excel/xlroot.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -92,8 +92,7 @@ XclRootData::XclRootData( XclBiff eBiff,
-     mxRD( new RootData ),//!
-     mnCharWidth( 110 ),
-     mnScTab( 0 ),
--    mbExport( bExport ),
--    mbHasPassw( false )
-+    mbExport( bExport )
- {
-     // default script type, e.g. for empty cells
-     switch( ScGlobal::GetDefaultScriptType() )
-@@ -199,17 +198,6 @@ void XclRoot::SetCharWidth( const XclFon
-     }
- }
- 
--const String& XclRoot::QueryPassword() const
--{
--    if( !mrData.mbHasPassw )
--    {
--        mrData.maPassw = ScfApiHelper::QueryPasswordForMedium( GetMedium() );
--        // set to true, even if dialog has been cancelled (never ask twice)
--        mrData.mbHasPassw = true;
--    }
--    return mrData.maPassw;
--}
--
- bool XclRoot::HasVbaStorage() const
- {
-     SotStorageRef xRootStrg = GetRootStorage();
---- sc/source/filter/inc/excimp8.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/excimp8.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -61,7 +61,6 @@ class ImportExcel8 : public ImportExcel
-         void                    Precision( void );              // 0x0E
- 		void					Delta( void );					// 0x10
- 		void					Iteration( void );				// 0x11
--		void					WinProtection(	void );         // 0x19
- 		void					Boundsheet( void );				// 0x85
- 		void					FilterMode( void );				// 0x9B
- 		void					AutoFilterInfo( void );			// 0x9D
-@@ -73,6 +72,7 @@ class ImportExcel8 : public ImportExcel
- 
- 		void					Hlink( void );					// 0x01B8
- 		void					Codename( BOOL bWBGlobals );	// 0x01BA
-+        void                    SheetProtection( void );        // 0x0867
- 
-         virtual void            EndSheet( void );
- 		virtual void			PostDocLoad( void );
---- sc/source/filter/inc/excrecds.hxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/filter/inc/excrecds.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -246,10 +246,23 @@ class XclExpWindowProtection : public	Xc
- };
- 
- // EXC_ID_PROTECT  Document Protection
--class XclExpDocProtection : public	XclExpBoolRecord
-+class XclExpProtection : public	XclExpBoolRecord
- {
- 	public:
--		XclExpDocProtection(bool bValue);
-+		XclExpProtection(bool bValue);
-+};
-+
-+class XclExpPassHash : public XclExpRecord
-+{
-+public:
-+    XclExpPassHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aHash);
-+    virtual ~XclExpPassHash();
-+
-+private:
-+    virtual void    WriteBody(XclExpStream& rStrm);
-+
-+private:
-+    sal_uInt16  mnHash;
- };
- 
- 
---- sc/source/filter/inc/imp_op.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/imp_op.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -135,9 +135,11 @@ protected:
- 	void					Bof2( void );					// 0x09
- 	void					Eof( void );					// 0x0A
- 	void					DocProtect( void );             // 0x12
--	void					Protect( void );				// 0x12	Sheet Protection
--	BOOL					Password( void );				// 0x13
-+    void                    SheetProtect( void );           // 0x12 Sheet Protection
-+    void                    DocPasssword( void );           // 0x13 document password
-+    void                    SheetPassword( void );               // 0x13 sheet password
- 	void					Externsheet( void );			// 0x17
-+    void                    WinProtection( void );          // 0x19
- 	void					Columndefault( void );			// 0x20
- 	void					Array25( void );				// 0x21
- 	void					Rec1904( void );				// 0x22
---- sc/source/filter/inc/xcl97rec.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xcl97rec.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -35,6 +35,8 @@
- #include "xcl97esc.hxx"
- #include "xlstyle.hxx"
- 
-+#include <vector>
-+
- // --- class XclMsodrawing_Base --------------------------------------
- 
- class XclMsodrawing_Base
-@@ -57,29 +59,26 @@ public:
- 
- // --- class XclMsodrawinggroup --------------------------------------
- 
--class XclMsodrawinggroup : public XclMsodrawing_Base, public ExcRecord
-+class XclMsodrawinggroup : public XclMsodrawing_Base, public XclExpRecord
- {
- private:
- 
--	virtual	void				SaveCont( XclExpStream& rStrm );
-+	virtual	void				WriteBody( XclExpStream& rStrm );
- 
- public:
- 								XclMsodrawinggroup( RootData& rRoot,
- 									UINT16 nEscherType = 0 );
- 	virtual						~XclMsodrawinggroup();
--
--	virtual UINT16				GetNum() const;
--    virtual sal_Size            GetLen() const;
- };
- 
- 
- // --- class XclMsodrawing -------------------------------------------
- 
--class XclMsodrawing : public XclMsodrawing_Base, public ExcRecord
-+class XclMsodrawing : public XclMsodrawing_Base, public XclExpRecord
- {
- private:
- 
--	virtual	void				SaveCont( XclExpStream& rStrm );
-+	virtual	void				WriteBody( XclExpStream& rStrm );
- 
- public:
-                                 XclMsodrawing(
-@@ -87,9 +86,6 @@ public:
-                                     UINT16 nEscherType = 0,
-                                     sal_Size nInitialSize = 0 );
- 	virtual						~XclMsodrawing();
--
--	virtual UINT16				GetNum() const;
--    virtual sal_Size            GetLen() const;
- };
- 
- 
-@@ -464,23 +460,24 @@ public:
-     virtual sal_Size            GetLen() const;
- };
- 
-+// ============================================================================
- 
--// ---- class XclProtection ------------------------------------------
--
--class XclProtection : public ExcDummyRec
-+/** Represents a SHEETPROTECTION record that stores sheet protection
-+    options.  Note that a sheet still needs to save its sheet protection
-+    options even when it's not protected. */
-+class XclExpSheetProtectOptions : public XclExpRecord
- {
--	// replacement for records PROTECT, SCENPROTECT, OBJPROTECT...
--private:
--	static const BYTE			pMyData[];
--    static const sal_Size       nMyLen;
- public:
--    virtual sal_Size            GetLen( void ) const;
--	virtual	const BYTE*			GetData( void ) const;
--};
-+    explicit            XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab );
- 
-+private:
-+    virtual void        WriteBody( XclExpStream& rStrm );
- 
--// -------------------------------------------------------------------
-+private:
-+    sal_uInt16      mnOptions;      /// Encoded sheet protection options.
-+};
- 
-+// ============================================================================
- 
- class XclCalccount : public ExcRecord
- {
-@@ -533,6 +530,163 @@ public:
-     virtual void                SaveXml( XclExpXmlStream& rStrm );
- };
- 
-+// ============================================================================
-+
-+class XclExpFilePass : public XclExpRecord
-+{
-+public:
-+    explicit XclExpFilePass( const XclExpRoot& rRoot );
-+    virtual ~XclExpFilePass();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+
-+private:
-+    const XclExpRoot& mrRoot;
-+};
-+
-+// ============================================================================
-+
-+class XclExpFnGroupCount : public XclExpRecord
-+{
-+public:
-+    explicit XclExpFnGroupCount();
-+    virtual ~XclExpFnGroupCount();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+/** Beginning of User Interface Records */
-+class XclExpInterfaceHdr : public XclExpRecord
-+{
-+public:
-+    explicit XclExpInterfaceHdr();
-+    virtual ~XclExpInterfaceHdr();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+/** Beginning of User Interface Records */
-+class XclExpInterfaceEnd : public XclExpRecord
-+{
-+public:
-+    explicit XclExpInterfaceEnd();
-+    virtual ~XclExpInterfaceEnd();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+/** ADDMENU/DELMENU Record Group Count */
-+class XclExpMMS : public XclExpRecord
-+{
-+public:
-+    explicit XclExpMMS();
-+    virtual ~XclExpMMS();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+/** Write Access User Name - This record contains the user name, which is
-+    the name you type when you install Excel. */
-+class XclExpWriteAccess : public XclExpRecord
-+{
-+public:
-+    explicit XclExpWriteAccess();
-+    virtual ~XclExpWriteAccess();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+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 );
-+};
-+
-+// ============================================================================
-+
-+class XclExpProt4Rev : public XclExpRecord
-+{
-+public:
-+    explicit XclExpProt4Rev();
-+    virtual ~XclExpProt4Rev();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+class XclExpProt4RevPass : public XclExpRecord
-+{
-+public:
-+    explicit XclExpProt4RevPass();
-+    virtual ~XclExpProt4RevPass();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+/** What's this record for?  It is a zero-byte record. */
-+class XclExpExcel9File : public XclExpRecord
-+{
-+public:
-+    explicit XclExpExcel9File();
-+    virtual ~XclExpExcel9File();
-+
-+private:
-+    virtual void WriteBody( XclExpStream& rStrm );
-+};
-+
-+// ============================================================================
-+
-+class XclExpRecalcId : public XclExpDummyRecord
-+{
-+public:
-+    explicit XclExpRecalcId();
-+};
-+
-+// ============================================================================
-+
-+class XclExpBookExt : public XclExpDummyRecord
-+{
-+public:
-+    explicit XclExpBookExt();
-+};
-+
- 
- 
- 
---- sc/source/filter/inc/xeroot.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xeroot.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -154,7 +154,12 @@ public:
-         @param nRecId  Identifier that specifies which record is returned. */
-     XclExpRecordRef     CreateRecord( sal_uInt16 nRecId ) const;
- 
-+    bool                IsDocumentEncrypted() const;
-+
-+    const String        GetPassword() const;
-+
- private:
-+
-     /** Returns the local or global link manager, depending on current context. */
-     XclExpRootData::XclExpLinkMgrRef GetLocalLinkMgrRef() const;
- 
---- sc/source/filter/inc/xestream.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xestream.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -43,6 +43,9 @@
- #include "xlstream.hxx"
- #include "xestring.hxx"
- 
-+#include <svx/mscodec.hxx>
-+#include <vector>
-+
- /* ============================================================================
- Output stream class for Excel export
- - CONTINUE record handling
-@@ -50,6 +53,8 @@ Output stream class for Excel export
- ============================================================================ */
- 
- 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
-@@ -108,14 +113,14 @@ public:
-     /** 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 );
-@@ -158,6 +163,14 @@ public:
-     /** Returns the absolute position of the system stream. */
-     inline sal_Size     GetSvStreamPos() const { return mrStrm.Tell(); }
- 
-+    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 );
-@@ -180,6 +193,9 @@ private:
-     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.
-@@ -197,64 +213,51 @@ private:
- 
- // ----------------------------------------------------------------------------
- 
--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 )
-+class XclExpBiff8Encrypter
- {
--    PrepareWrite( 2 );
--    mrStrm << nValue;
--    return *this;
--}
-+public:
-+    explicit XclExpBiff8Encrypter( const XclExpRoot& rRoot, const sal_uInt8 nDocId[16], 
-+                                   const sal_uInt8 nSalt[16] );
-+    ~XclExpBiff8Encrypter();
- 
--inline XclExpStream& XclExpStream::operator<<( sal_uInt16 nValue )
--{
--    PrepareWrite( 2 );
--    mrStrm << nValue;
--    return *this;
--}
-+    bool IsValid() const;
- 
--inline XclExpStream& XclExpStream::operator<<( sal_Int32 nValue )
--{
--    PrepareWrite( 4 );
--    mrStrm << nValue;
--    return *this;
--}
-+    void GetSaltDigest( sal_uInt8 nSaltDigest[16] ) const;
- 
--inline XclExpStream& XclExpStream::operator<<( sal_uInt32 nValue )
--{
--    PrepareWrite( 4 );
--    mrStrm << nValue;
--    return *this;
--}
-+    void Encrypt( SvStream& rStrm, sal_uInt8  nData );
-+    void Encrypt( SvStream& rStrm, sal_uInt16 nData );
-+    void Encrypt( SvStream& rStrm, sal_uInt32 nData );
- 
--inline XclExpStream& XclExpStream::operator<<( float fValue )
--{
--    PrepareWrite( 4 );
--    mrStrm << fValue;
--    return *this;
--}
-+    void Encrypt( SvStream& rStrm, sal_Int8  nData );
-+    void Encrypt( SvStream& rStrm, sal_Int16 nData );
-+    void Encrypt( SvStream& rStrm, sal_Int32 nData );
- 
--inline XclExpStream& XclExpStream::operator<<( double fValue )
--{
--    PrepareWrite( 8 );
--    mrStrm << fValue;
--    return *this;
--}
-+    void Encrypt( SvStream& rStrm, float fValue );
-+    void Encrypt( SvStream& rStrm, double fValue );
- 
-+    void EncryptBytes( SvStream& rStrm, ::std::vector<sal_uInt8>& aBytes );
- 
--// ============================================================================
-+private:
-+    void Init( const String& aPass, const sal_uInt8 nDocId[16], 
-+               const sal_uInt8 nSalt[16] );
-+
-+    sal_uInt32 GetBlockPos( sal_Size nStrmPos ) const;
-+    sal_uInt16 GetOffsetInBlock( sal_Size nStrmPos ) const;
-+
-+
-+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.
-+    sal_uInt8           mnSaltDigest[16];
-+
-+    const XclExpRoot&   mrRoot;
-+    sal_Size            mnOldPos;      /// Last known stream position
-+    bool                mbValid;
-+};
- 
- // ----------------------------------------------------------------------------
- 
---- sc/source/filter/inc/xetable.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xetable.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -1088,7 +1088,5 @@ private:
-     XclExpDvalRef       mxDval;             /// Data validation with DVAL and DV records.
- };
- 
--// ============================================================================
--
- #endif
- 
---- sc/source/filter/inc/xicontent.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xicontent.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -37,6 +37,8 @@
- #include "xistring.hxx"
- #include "xiroot.hxx"
- 
-+#include <map>
-+
- /* ============================================================================
- Classes to import the big Excel document contents (related to several cells or
- globals for the document).
-@@ -249,5 +251,64 @@ public:
- 
- // ============================================================================
- 
-+// Document protection ========================================================
-+
-+class XclImpDocProtectBuffer : protected XclImpRoot
-+{
-+public:
-+    explicit            XclImpDocProtectBuffer( const XclImpRoot& rRoot );
-+
-+    /** document structure protection flag  */
-+    void                ReadDocProtect( XclImpStream& rStrm );
-+
-+    /** document windows properties protection flag */
-+    void                ReadWinProtect( XclImpStream& rStrm );
-+
-+    void                ReadPasswordHash( XclImpStream& rStrm );
-+
-+    void                Apply() const;
-+
-+private:
-+    sal_uInt16      mnPassHash;
-+    bool            mbDocProtect:1;
-+    bool            mbWinProtect:1;
-+};
-+
-+// Sheet protection ===========================================================
-+
-+class XclImpSheetProtectBuffer : protected XclImpRoot
-+{
-+public:
-+    explicit            XclImpSheetProtectBuffer( const XclImpRoot& rRoot );
-+
-+    void                ReadProtect( XclImpStream& rStrm, SCTAB nTab );
-+
-+    void                ReadOptions( XclImpStream& rStrm, SCTAB nTab );
-+
-+    void                ReadPasswordHash( XclImpStream& rStrm, SCTAB nTab );
-+
-+    void                Apply() const;
-+
-+private:
-+    struct Sheet
-+    {
-+        bool        mbProtected;
-+        sal_uInt16  mnPasswordHash;
-+        sal_uInt16  mnOptions;
-+
-+        Sheet();
-+        Sheet(const Sheet& r);
-+    };
-+
-+    Sheet* GetSheetItem( SCTAB nTab );
-+
-+private:
-+    typedef ::std::map<SCTAB, Sheet> ProtectedSheetMap;
-+    ProtectedSheetMap   maProtectedSheets;
-+};
-+
-+
-+// ============================================================================
-+
- #endif
- 
---- sc/source/filter/inc/xiroot.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xiroot.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -61,6 +61,8 @@ class XclImpPivotTableManager;
- class XclImpPageSettings;
- class XclImpDocViewSettings;
- class XclImpTabViewSettings;
-+class XclImpSheetProtectBuffer;
-+class XclImpDocProtectBuffer;
- 
- class _ScRangeListTabs;
- class ExcelToSc;
-@@ -87,6 +89,8 @@ struct XclImpRootData : public XclRootDa
-     typedef ScfRef< XclImpPageSettings >        XclImpPageSettRef;
-     typedef ScfRef< XclImpDocViewSettings >     XclImpDocViewSettRef;
-     typedef ScfRef< XclImpTabViewSettings >     XclImpTabViewSettRef;
-+    typedef ScfRef< XclImpSheetProtectBuffer >  XclImpTabProtectRef;
-+    typedef ScfRef< XclImpDocProtectBuffer >    XclImpDocProtectRef;
- 
-     XclImpAddrConvRef   mxAddrConv;         /// The address converter.
-     XclImpFmlaCompRef   mxFmlaComp;         /// The formula compiler.
-@@ -110,6 +114,11 @@ struct XclImpRootData : public XclRootDa
-     XclImpPageSettRef   mxPageSett;         /// Page settings for current sheet.
-     XclImpDocViewSettRef mxDocViewSett;     /// View settings for entire document.
-     XclImpTabViewSettRef mxTabViewSett;     /// View settings for current sheet.
-+    XclImpTabProtectRef mxTabProtect;       /// Sheet protection options for current sheet.
-+    XclImpDocProtectRef mxDocProtect;       /// Document protection options.
-+
-+    String              maPassw;            /// Entered password for stream decryption.
-+    bool                mbPassQueried;      /// true = Password already querried.
- 
-     bool                mbHasCodePage;      /// true = CODEPAGE record exists.
- 
-@@ -181,6 +190,10 @@ public:
-     XclImpWebQueryBuffer& GetWebQueryBuffer() const;
-     /** Returns the pivot table manager. */
-     XclImpPivotTableManager& GetPivotTableManager() const;
-+    /** Returns the sheet protection options of the current sheet. */
-+    XclImpSheetProtectBuffer& GetSheetProtectBuffer() const;
-+    /** Returns the document protection options. */
-+    XclImpDocProtectBuffer& GetDocProtectBuffer() const;
- 
-     /** Returns the page settings of the current sheet. */
-     XclImpPageSettings& GetPageSettings() const;
-@@ -192,6 +205,9 @@ public:
-     /** Returns the Calc add-in function name for an Excel function name. */
-     String              GetScAddInName( const String& rXclName ) const;
- 
-+    /** Queries a password from the user and returns it (empty string -> input cancelled). */
-+    const String&       QueryPassword() const;
-+
- private:
-     mutable XclImpRootData& mrImpData;      /// Reference to the global import data struct.
- };
---- sc/source/filter/inc/xistream.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xistream.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -73,6 +73,8 @@ public:
-         @return  Count of bytes really read. */
-     sal_uInt16          Read( SvStream& rStrm, void* pData, sal_uInt16 nBytes );
- 
-+    const String        GetPassword() const;
-+
- protected:
-     /** Protected copy c'tor for OnClone(). */
-     explicit            XclImpDecrypter( const XclImpDecrypter& rSrc );
-@@ -80,6 +82,8 @@ protected:
-     /** Sets the decrypter to a state showing whether the password was correct. */
-     void                SetHasValidPassword( bool bValid );
- 
-+    void                SetPassword( const String& rPass );
-+
- private:
-     /** Implementation of cloning this object. */
-     virtual XclImpDecrypter* OnClone() const = 0;
-@@ -89,6 +93,7 @@ private:
-     virtual sal_uInt16  OnRead( SvStream& rStrm, sal_uInt8* pnData, sal_uInt16 nBytes ) = 0;
- 
- private:
-+    String              maPass;         /// Stored password (needed for export)
-     ErrCode             mnError;        /// Decrypter error code.
-     sal_Size            mnOldPos;       /// Last known stream position.
-     sal_uInt16          mnRecSize;      /// Current record size.
---- sc/source/filter/inc/xlroot.hxx.old	2009-04-02 10:44:58.000000000 +0000
-+++ sc/source/filter/inc/xlroot.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -92,7 +92,6 @@ struct XclRootData
-     ScDocument&         mrDoc;              /// The source or destination document.
-     String              maDocUrl;           /// Document URL of imported/exported file.
-     String              maBasePath;         /// Base path of imported/exported file (path of maDocUrl).
--    String              maPassw;            /// Entered password for stream encryption/decryption.
-     rtl_TextEncoding    meTextEnc;          /// Text encoding to import/export byte strings.
-     LanguageType        meSysLang;          /// System language.
-     LanguageType        meDocLang;          /// Document language (import: from file, export: from system).
-@@ -116,7 +115,6 @@ struct XclRootData
-     long                mnCharWidth;        /// Width of '0' in default font (twips).
-     SCTAB               mnScTab;            /// Current Calc sheet index.
-     const bool          mbExport;           /// false = Import, true = Export.
--    bool                mbHasPassw;         /// true = Password already querried.
- 
-     explicit            XclRootData( XclBiff eBiff, SfxMedium& rMedium,
-                             SotStorageRef xRootStrg, ScDocument& rDoc,
-@@ -184,8 +182,6 @@ public:
-     inline const String& GetDocUrl() const { return mrData.maDocUrl; }
-     /** Returns the base path of the imported/exported file. */
-     inline const String& GetBasePath() const { return mrData.maBasePath; }
--    /** Queries a password from the user and returns it (empty string -> input cancelled). */
--    const String&       QueryPassword() const;
- 
-     /** Returns the OLE2 root storage of the imported/exported file.
-         @return  Pointer to root storage or 0, if the file is a simple stream. */
---- sc/source/filter/starcalc/scflt.cxx.old	2009-04-02 10:44:59.000000000 +0000
-+++ sc/source/filter/starcalc/scflt.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -81,6 +81,7 @@
- #include "postit.hxx"
- #include "globstr.hrc"
- #include "ftools.hxx"
-+#include "tabprotection.hxx"
- 
- #include "fprogressbar.hxx"
- 
-@@ -1087,9 +1088,11 @@ void Sc10Import::LoadProtect()
- 	//rStream.Read(&SheetProtect, sizeof(SheetProtect));
- 	lcl_ReadSheetProtect(rStream, SheetProtect);
- 	nError = rStream.GetError();
--	uno::Sequence<sal_Int8> aPass;
--	SvPasswordHelper::GetHashPassword(aPass, SC10TOSTRING( SheetProtect.PassWord ));
--	pDoc->SetDocProtection( SheetProtect.Protect,  aPass);
-+
-+    ScDocProtection aProtection;
-+    aProtection.setProtected(static_cast<bool>(SheetProtect.Protect));
-+    aProtection.setPassword(SC10TOSTRING(SheetProtect.PassWord));
-+    pDoc->SetDocProtection(&aProtection);
- }
- 
- 
-@@ -1441,10 +1444,11 @@ void Sc10Import::LoadTables()
- 
- 		//rStream.Read(&TabProtect, sizeof(TabProtect));
- 		lcl_ReadTabProtect(rStream, TabProtect);
--		uno::Sequence<sal_Int8> aPass;
--		SvPasswordHelper::GetHashPassword(aPass, SC10TOSTRING( TabProtect.PassWord ));
- 
--		pDoc->SetTabProtection( static_cast<SCTAB>(Tab), TabProtect.Protect, aPass);
-+        ScTableProtection aProtection;
-+        aProtection.setProtected(static_cast<bool>(TabProtect.Protect));
-+        aProtection.setPassword(SC10TOSTRING(TabProtect.PassWord));
-+        pDoc->SetTabProtection(static_cast<SCTAB>(Tab), &aProtection);
- 
- 		rStream >> TabNo;
- 
---- sc/source/filter/xcl97/XclExpChangeTrack.cxx.old	2009-04-02 10:44:57.000000000 +0000
-+++ sc/source/filter/xcl97/XclExpChangeTrack.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -491,6 +491,7 @@ void XclExpChTrTabId::Copy( const XclExp
- 
- void XclExpChTrTabId::SaveCont( XclExpStream& rStrm )
- {
-+    rStrm.EnableEncryption();
- 	if( pBuffer )
- 		for( sal_uInt16* pElem = pBuffer; pElem < (pBuffer + nTabCount); pElem++ )
- 			rStrm << *pElem;
---- sc/source/filter/xcl97/makefile.mk.old	2009-04-02 10:44:57.000000000 +0000
-+++ sc/source/filter/xcl97/makefile.mk	2009-04-06 16:41:49.000000000 +0000
-@@ -49,7 +49,6 @@ PROJECTPCHSOURCE=..\pch\filt_pch
- # --- Files --------------------------------------------------------
- 
- SLOFILES =									\
--		$(SLO)$/xcl97dum.obj				\
- 		$(SLO)$/xcl97esc.obj				\
- 		$(SLO)$/xcl97rec.obj				\
- 		$(SLO)$/XclImpChangeTrack.obj		\
---- sc/source/filter/xcl97/xcl97rec.cxx.old	2009-04-02 10:44:57.000000000 +0000
-+++ sc/source/filter/xcl97/xcl97rec.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -78,6 +78,7 @@
- #include "scextopt.hxx"
- #include "docoptio.hxx"
- #include "patattr.hxx"
-+#include "tabprotection.hxx"
- 
- #include <oox/core/tokens.hxx>
- 
-@@ -135,9 +136,9 @@ sal_Size XclMsodrawing_Base::GetDataLen(
- 
- // --- class XclMsodrawinggroup --------------------------------------
- 
--XclMsodrawinggroup::XclMsodrawinggroup( RootData& rRoot, UINT16 nEscherType )
--		:
--		XclMsodrawing_Base( *rRoot.pEscher )
-+XclMsodrawinggroup::XclMsodrawinggroup( RootData& rRoot, UINT16 nEscherType ) :
-+    XclMsodrawing_Base( *rRoot.pEscher ),
-+    XclExpRecord(0x00EB, 2) // bogus record size since we don't know the actual size yet.
- {
- 	if ( nEscherType )
- 	{
-@@ -182,7 +183,7 @@ XclMsodrawinggroup::~XclMsodrawinggroup(
- }
- 
- 
--void XclMsodrawinggroup::SaveCont( XclExpStream& rStrm )
-+void XclMsodrawinggroup::WriteBody( XclExpStream& rStrm )
- {
-     DBG_ASSERT( GetEscherEx()->GetStreamPos() == GetEscherEx()->GetOffsetFromMap( nStartPos ),
- 		"XclMsodrawinggroup::SaveCont: Escher stream position mismatch" );
-@@ -190,23 +191,11 @@ void XclMsodrawinggroup::SaveCont( XclEx
- }
- 
- 
--UINT16 XclMsodrawinggroup::GetNum() const
--{
--	return 0x00EB;
--}
--
--
--sal_Size XclMsodrawinggroup::GetLen() const
--{
--    return GetDataLen();
--}
--
--
--
- // --- class XclMsodrawing --------------------------------------
- 
- XclMsodrawing::XclMsodrawing( const XclExpRoot& rRoot, UINT16 nEscherType, sal_Size nInitialSize ) :
--    XclMsodrawing_Base( *rRoot.GetOldRoot().pEscher, nInitialSize )
-+    XclMsodrawing_Base( *rRoot.GetOldRoot().pEscher, nInitialSize ),
-+    XclExpRecord( 0x00EC, nInitialSize )
- {
- 	if ( nEscherType )
- 	{
-@@ -232,7 +221,7 @@ XclMsodrawing::~XclMsodrawing()
- }
- 
- 
--void XclMsodrawing::SaveCont( XclExpStream& rStrm )
-+void XclMsodrawing::WriteBody( XclExpStream& rStrm )
- {
-     DBG_ASSERT( GetEscherEx()->GetStreamPos() == GetEscherEx()->GetOffsetFromMap( nStartPos ),
- 		"XclMsodrawing::SaveCont: Escher stream position mismatch" );
-@@ -240,16 +229,6 @@ void XclMsodrawing::SaveCont( XclExpStre
- }
- 
- 
--UINT16 XclMsodrawing::GetNum() const
--{
--	return 0x00EC;
--}
--
--
--sal_Size XclMsodrawing::GetLen() const
--{
--    return GetDataLen();
--}
- 
- 
- // --- class XclObjList ----------------------------------------------
-@@ -887,6 +866,7 @@ ExcBof8_Base::ExcBof8_Base()
- 
- void ExcBof8_Base::SaveCont( XclExpStream& rStrm )
- {
-+    rStrm.DisableEncryption();
- 	rStrm	<< nVers << nDocType << nRupBuild << nRupYear
- 			<< nFileHistory << nLowestBiffVer;
- }
-@@ -946,7 +926,10 @@ void ExcBundlesheet8::SaveCont( XclExpSt
- {
-     nOwnPos = rStrm.GetSvStreamPos();
-     // write dummy position, real position comes later
--    rStrm << sal_uInt32( 0 ) << nGrbit << GetName();
-+    rStrm.DisableEncryption();
-+    rStrm << sal_uInt32(0);
-+    rStrm.EnableEncryption();
-+    rStrm << nGrbit << GetName();
- }
- 
- 
-@@ -1254,33 +1237,73 @@ sal_Size ExcEScenarioManager::GetLen() c
- 	return 8;
- }
- 
-+// ============================================================================
- 
--
--// ---- class XclProtection ------------------------------------------
--
--const BYTE		XclProtection::pMyData[] =
-+struct XclExpTabProtectOption
- {
--	0x12, 0x00, 0x02, 0x00, 0x01, 0x00,			// PROTECT
--	0xDD, 0x00, 0x02, 0x00, 0x01, 0x00,			// SCENPROTECT
--	0x63, 0x00, 0x02, 0x00, 0x01, 0x00			// OBJPROTECT
-+    ScTableProtection::Option   eOption;
-+    sal_uInt16                  nMask;
- };
--const sal_Size XclProtection::nMyLen = sizeof( XclProtection::pMyData );
- 
--sal_Size XclProtection::GetLen( void ) const
-+XclExpSheetProtectOptions::XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab ) :
-+    XclExpRecord( 0x0867, 23 )
- {
--	return nMyLen;
--}
--
-+    static const XclExpTabProtectOption aTable[] =
-+    {
-+        { ScTableProtection::OBJECTS,               0x0001 },
-+        { ScTableProtection::SCENARIOS,             0x0002 },
-+        { ScTableProtection::FORMAT_CELLS,          0x0004 },
-+        { ScTableProtection::FORMAT_COLUMNS,        0x0008 },
-+        { ScTableProtection::FORMAT_ROWS,           0x0010 },
-+        { ScTableProtection::INSERT_COLUMNS,        0x0020 },
-+        { ScTableProtection::INSERT_ROWS,           0x0040 },
-+        { ScTableProtection::INSERT_HYPERLINKS,     0x0080 },
-+
-+        { ScTableProtection::DELETE_COLUMNS,        0x0100 },
-+        { ScTableProtection::DELETE_ROWS,           0x0200 },
-+        { ScTableProtection::SELECT_LOCKED_CELLS,   0x0400 },
-+        { ScTableProtection::SORT,                  0x0800 },
-+        { ScTableProtection::AUTOFILTER,            0x1000 },
-+        { ScTableProtection::PIVOT_TABLES,          0x2000 },
-+        { ScTableProtection::SELECT_UNLOCKED_CELLS, 0x4000 },
-+
-+        { ScTableProtection::NONE,                  0x0000 }
-+    };
-+
-+    mnOptions = 0x0000;
-+    ScTableProtection* pProtect = rRoot.GetDoc().GetTabProtection(nTab);
-+    if (!pProtect)
-+        return;
- 
--const BYTE* XclProtection::GetData( void ) const
--{
--	return pMyData;
-+    for (int i = 0; aTable[i].nMask != 0x0000; ++i)
-+    {
-+        if ( pProtect->isOptionEnabled(aTable[i].eOption) )
-+            mnOptions |= aTable[i].nMask;
-+    }
- }
- 
-+void XclExpSheetProtectOptions::WriteBody( XclExpStream& rStrm )
-+{
-+    sal_uInt16 nBytes = 0x0867;
-+    rStrm << nBytes;
- 
-+    sal_uChar nZero = 0x00;
-+    for (int i = 0; i < 9; ++i)
-+        rStrm << nZero;
- 
-+    nBytes = 0x0200;
-+    rStrm << nBytes;
-+    nBytes = 0x0100;
-+    rStrm << nBytes;
-+    nBytes = 0xFFFF;
-+    rStrm << nBytes << nBytes;
- 
-+    rStrm << mnOptions;
-+    nBytes = 0;
-+    rStrm << nBytes;
-+}
- 
-+// ============================================================================
- 
- 
- 
-@@ -1393,6 +1416,253 @@ XclRefmode::XclRefmode( const ScDocument
- {
- }
- 
-+// ============================================================================
-+
-+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 };
-+
-+    // 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;
-+
-+    sal_uInt8 nSaltHash[16];
-+    XclExpEncrypterRef xEnc( new XclExpBiff8Encrypter(mrRoot, nDocId, nSalt) );
-+    xEnc->GetSaltDigest(nSaltHash);
-+
-+    rStrm.Write(nDocId, 16);
-+    rStrm.Write(nSalt, 16);
-+    rStrm.Write(nSaltHash, 16);
-+
-+    rStrm.SetEncrypter(xEnc);
-+}
-+
-+// ============================================================================
-+
-+XclExpFnGroupCount::XclExpFnGroupCount() :
-+    XclExpRecord(0x009C, 2)
-+{
-+}
-+
-+XclExpFnGroupCount::~XclExpFnGroupCount()
-+{
-+}
-+
-+void XclExpFnGroupCount::WriteBody( XclExpStream& rStrm )
-+{
-+    rStrm << static_cast<sal_uInt16>(14);
-+}
-+
-+// ============================================================================
-+
-+XclExpInterfaceHdr::XclExpInterfaceHdr() :
-+    XclExpRecord(0x00E1, 2)
-+{
-+}
-+
-+XclExpInterfaceHdr::~XclExpInterfaceHdr()
-+{
-+}
-+
-+void XclExpInterfaceHdr::WriteBody( XclExpStream& rStrm )
-+{
-+    // The value must be the same value as the CODEPAGE record.
-+    rStrm.DisableEncryption();
-+    rStrm << static_cast<sal_uInt16>(0x04B0);
-+}
-+
-+// ============================================================================
-+
-+XclExpInterfaceEnd::XclExpInterfaceEnd() :
-+    XclExpRecord(0x00E2, 0)
-+{
-+}
-+
-+XclExpInterfaceEnd::~XclExpInterfaceEnd()
-+{
-+}
-+
-+void XclExpInterfaceEnd::WriteBody( XclExpStream& /*rStrm*/ )
-+{
-+}
-+
-+// ============================================================================
-+
-+XclExpMMS::XclExpMMS() :
-+    XclExpRecord(0x00C1, 2)
-+{
-+}
-+
-+XclExpMMS::~XclExpMMS()
-+{
-+}
-+
-+void XclExpMMS::WriteBody( XclExpStream& rStrm )
-+{
-+    rStrm << static_cast<sal_uInt16>(0x0000);
-+}
-+
-+// ============================================================================
-+
-+XclExpWriteAccess::XclExpWriteAccess() :
-+    XclExpRecord(0x005C, 112)
-+{
-+}
-+
-+XclExpWriteAccess::~XclExpWriteAccess()
-+{
-+}
-+
-+void XclExpWriteAccess::WriteBody( XclExpStream& rStrm )
-+{
-+    static const sal_uInt8 aData[] = {
-+        0x04, 0x00, 0x00,  'C',  'a',  'l',  'c', 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, 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, 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, 0x20,
-+        0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 };
-+
-+    sal_Size nDataSize = sizeof(aData);
-+    for (sal_Size i = 0; i < nDataSize; ++i)
-+        rStrm << aData[i];
-+}
-+
-+// ============================================================================
-+
-+XclExpCodePage::XclExpCodePage() :
-+    XclExpRecord(0x0042, 2)
-+{
-+}
-+
-+XclExpCodePage::~XclExpCodePage()
-+{
-+}
-+
-+void XclExpCodePage::WriteBody( XclExpStream& rStrm )
-+{
-+    // 0x04B0 : UTF-16 (BIFF8)
-+    rStrm << static_cast<sal_uInt16>(0x04B0);
-+}
-+
-+// ============================================================================
-+
-+XclExpDSF::XclExpDSF() :
-+    XclExpRecord(0x0161, 2)
-+{
-+}
-+
-+XclExpDSF::~XclExpDSF()
-+{
-+}
-+
-+void XclExpDSF::WriteBody( XclExpStream& rStrm )
-+{
-+    rStrm << static_cast<sal_uInt16>(0x0000);
-+}
-+
-+// ============================================================================
-+
-+XclExpProt4Rev::XclExpProt4Rev() :
-+    XclExpRecord(0x01AF, 2)
-+{
-+}
-+
-+XclExpProt4Rev::~XclExpProt4Rev()
-+{
-+}
-+
-+void XclExpProt4Rev::WriteBody( XclExpStream& rStrm )
-+{
-+    rStrm << static_cast<sal_uInt16>(0x0000);
-+}
-+
-+// ============================================================================
-+
-+XclExpProt4RevPass::XclExpProt4RevPass() :
-+    XclExpRecord(0x01BC, 2)
-+{
-+}
-+
-+XclExpProt4RevPass::~XclExpProt4RevPass()
-+{
-+}
-+
-+void XclExpProt4RevPass::WriteBody( XclExpStream& rStrm )
-+{
-+    rStrm << static_cast<sal_uInt16>(0x0000);
-+}
-+
-+// ============================================================================
-+
-+XclExpExcel9File::XclExpExcel9File() :
-+    XclExpRecord(0x01C0, 0)
-+{
-+}
-+
-+XclExpExcel9File::~XclExpExcel9File()
-+{
-+}
-+
-+void XclExpExcel9File::WriteBody( XclExpStream& /*rStrm*/ )
-+{
-+}
-+
-+// ============================================================================
-+
-+static const sal_uInt8 nDataRecalcId[] = {
-+    0xC1, 0x01, 0x00, 0x00, 0x54, 0x8D, 0x01, 0x00
-+};
-+
-+XclExpRecalcId::XclExpRecalcId() :
-+    XclExpDummyRecord(0x01C1, nDataRecalcId, sizeof(nDataRecalcId))
-+{
-+}
-+
-+// ============================================================================
-+
-+static const sal_uInt8 nDataBookExt[] = {
-+    0x63, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-+    0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
-+    0x02
-+};
-+
-+XclExpBookExt::XclExpBookExt() :
-+    XclExpDummyRecord(0x0863, nDataBookExt, sizeof(nDataBookExt))
-+{
-+}
-+
-+
- void XclRefmode::SaveXml( XclExpXmlStream& rStrm )
- {
-     rStrm.WriteAttributes(
---- sc/source/filter/xml/xmlbodyi.cxx.old	2009-04-02 10:44:57.000000000 +0000
-+++ sc/source/filter/xml/xmlbodyi.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -52,6 +52,7 @@
- #include "XMLTrackedChangesContext.hxx"
- #include "XMLEmptyContext.hxx"
- #include "scerrors.hxx"
-+#include "tabprotection.hxx"
- 
- #include <xmloff/xmltkmap.hxx>
- #include <xmloff/xmltoken.hxx>
-@@ -62,6 +63,8 @@
- #include <sal/types.h>
- #include <tools/debug.hxx>
- 
-+#include <memory>
-+
- using rtl::OUString;
- using namespace com::sun::star;
- using namespace xmloff::token;
-@@ -281,10 +284,17 @@ void ScXMLBodyContext::EndElement()
-         // #i37959# handle document protection after the sheet settings
- 		if (bProtected)
- 		{
-+            ::std::auto_ptr<ScDocProtection> pProtection(new ScDocProtection);
-+            pProtection->setProtected(true);
-+
- 			uno::Sequence<sal_Int8> aPass;
- 			if (sPassword.getLength())
-+            {
- 				SvXMLUnitConverter::decodeBase64(aPass, sPassword);
--			pDoc->SetDocProtection(bProtected, aPass);
-+                pProtection->setPasswordHash(aPass, PASSHASH_OOO);
-+            }
-+
-+            pDoc->SetDocProtection(pProtection.get());
- 		}
- 	}
- 	GetScImport().UnlockSolarMutex();
---- sc/source/filter/xml/xmlexprt.cxx.old	2009-04-06 16:41:49.000000000 +0000
-+++ sc/source/filter/xml/xmlexprt.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -68,6 +68,7 @@
- #include "convuno.hxx"
- #include "postit.hxx"
- #include "externalrefmgr.hxx"
-+#include "tabprotection.hxx"
- 
- #include <xmloff/xmltoken.hxx>
- #include <xmloff/xmlnmspe.hxx>
-@@ -1439,7 +1440,11 @@ void ScXMLExport::SetBodyAttributes()
- 	{
- 		AddAttribute(XML_NAMESPACE_TABLE, XML_STRUCTURE_PROTECTED, XML_TRUE);
- 		rtl::OUStringBuffer aBuffer;
--		SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetDocPassword());
-+        uno::Sequence<sal_Int8> aPassHash;
-+        const ScDocProtection* p = pDoc->GetDocProtection();
-+        if (p)
-+            aPassHash = p->getPasswordHash(PASSHASH_OOO);
-+		SvXMLUnitConverter::encodeBase64(aBuffer, aPassHash);
- 		if (aBuffer.getLength())
- 			AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
- 	}
-@@ -1513,7 +1518,11 @@ void ScXMLExport::_ExportContent()
-                         AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
-                         rtl::OUStringBuffer aBuffer;
-                         if (pDoc)
--                            SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetTabPassword(static_cast<SCTAB>(nTable)));
-+                        {
-+                            ScTableProtection* pProtect = pDoc->GetTabProtection(static_cast<SCTAB>(nTable));
-+                            if (pProtect)
-+                                SvXMLUnitConverter::encodeBase64(aBuffer, pProtect->getPasswordHash(PASSHASH_OOO));
-+                        }
-                         if (aBuffer.getLength())
-                             AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
-                     }
---- sc/source/filter/xml/xmlsubti.cxx.old	2009-04-02 10:44:57.000000000 +0000
-+++ sc/source/filter/xml/xmlsubti.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -42,6 +42,7 @@
- #include "docuno.hxx"
- #include "cellsuno.hxx"
- #include "XMLStylesImportHelper.hxx"
-+#include "tabprotection.hxx"
- 
- #include <xmloff/xmltkmap.hxx>
- #include <xmloff/nmspmap.hxx>
-@@ -58,6 +59,10 @@
- #include <com/sun/star/util/XProtectable.hpp>
- #include <com/sun/star/sheet/XArrayFormulaRange.hpp>
- 
-+#include <memory>
-+
-+using ::std::auto_ptr;
-+
- //------------------------------------------------------------------
- 
- using namespace com::sun::star;
-@@ -616,13 +621,10 @@ void ScMyTables::DeleteTable()
- 	{
- 		uno::Sequence<sal_Int8> aPass;
- 		SvXMLUnitConverter::decodeBase64(aPass, sPassword);
--		rImport.GetDocument()->SetTabProtection(static_cast<SCTAB>(nCurrentSheet), bProtection, aPass);
--		/*uno::Reference <util::XProtectable> xProtectable(xCurrentSheet, uno::UNO_QUERY);
--		if (xProtectable.is())
--		{
--			rtl::OUString sKey;
--			xProtectable->protect(sKey);
--		}*/
-+        auto_ptr<ScTableProtection> pProtect(new ScTableProtection);
-+        pProtect->setProtected(bProtection);
-+        pProtect->setPasswordHash(aPass, PASSHASH_OOO);
-+        rImport.GetDocument()->SetTabProtection(static_cast<SCTAB>(nCurrentSheet), pProtect.get());
- 	}
- 
- 	rImport.UnlockSolarMutex();
---- sc/source/ui/docshell/docfunc.cxx.old	2009-04-02 10:45:27.000000000 +0000
-+++ sc/source/ui/docshell/docfunc.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -92,7 +92,12 @@
- #include "editable.hxx"
- #include "compiler.hxx"
- #include "scui_def.hxx" //CHINA001
-+#include "tabprotection.hxx"
-+
-+#include <memory>
-+
- using namespace com::sun::star;
-+using ::com::sun::star::uno::Sequence;
- 
- // STATIC DATA -----------------------------------------------------------
- 
-@@ -2861,103 +2866,156 @@ BOOL ScDocFunc::RemovePageBreak( BOOL bC
- 
- //------------------------------------------------------------------------
- 
--BOOL lcl_ValidPassword( ScDocument* pDoc, SCTAB nTab,
--						const String& rPassword,
--						uno::Sequence<sal_Int8>* pReturnOld = NULL )
-+void ScDocFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
- {
--	uno::Sequence<sal_Int8> aOldPassword;
--	if ( nTab == TABLEID_DOC )
--	{
--		if (pDoc->IsDocProtected())
--			aOldPassword = pDoc->GetDocPassword();
--	}
--	else
--	{
--		if (pDoc->IsTabProtected(nTab))
--			aOldPassword = pDoc->GetTabPassword(nTab);
--	}
-+    ScDocument* pDoc = rDocShell.GetDocument();
- 
--	if (pReturnOld)
--		*pReturnOld = aOldPassword;
-+    pDoc->SetTabProtection(nTab, &rProtect);
-+    if (pDoc->IsUndoEnabled())
-+    {
-+        ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+        DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
-+        if (pProtect)
-+        {
-+            ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
-+            p->setProtected(true); // just in case ...
-+            rDocShell.GetUndoManager()->AddUndoAction(
-+                new ScUndoTabProtect(&rDocShell, nTab, p) );
- 
--	return ((aOldPassword.getLength() == 0) || SvPasswordHelper::CompareHashPassword(aOldPassword, rPassword));
-+            // ownership of auto_ptr now transferred to ScUndoTabProtect.
-+        }
-+    }
-+
-+    rDocShell.PostPaintGridAll();
-+    ScDocShellModificator aModificator(rDocShell);
-+    aModificator.SetDocumentModified();
- }
- 
--BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL bApi )
-+BOOL ScDocFunc::Protect( SCTAB nTab, const String& rPassword, BOOL /*bApi*/ )
- {
--	ScDocShellModificator aModificator( rDocShell );
-+    ScDocument* pDoc = rDocShell.GetDocument();
-+    if (nTab == TABLEID_DOC)
-+    {
-+        // document protection
-+        ScDocProtection aProtection;
-+        aProtection.setProtected(true);
-+        aProtection.setPassword(rPassword);
-+        pDoc->SetDocProtection(&aProtection);
-+        if (pDoc->IsUndoEnabled())
-+        {
-+            ScDocProtection* pProtect = pDoc->GetDocProtection();
-+            DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScDocProtection pointer is NULL!");
-+            if (pProtect)
-+            {
-+                ::std::auto_ptr<ScDocProtection> p(new ScDocProtection(*pProtect));
-+                p->setProtected(true); // just in case ...
-+                rDocShell.GetUndoManager()->AddUndoAction(
-+                    new ScUndoDocProtect(&rDocShell, p) );
-+                // ownership of auto_ptr is transferred to ScUndoDocProtect.
-+            }
-+        }
-+    }
-+    else
-+    {
-+        // sheet protection
- 
--	ScDocument* pDoc = rDocShell.GetDocument();
--	BOOL bUndo(pDoc->IsUndoEnabled());
--	BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword);
--	if ( bOk )
--	{
--	    uno::Sequence<sal_Int8> aPass;
--	    if (rPassword.Len())
--	        SvPasswordHelper::GetHashPassword(aPass, rPassword);
-+        ScTableProtection aProtection;
-+        aProtection.setProtected(true);
-+        aProtection.setPassword(rPassword);
-+        pDoc->SetTabProtection(nTab, &aProtection);
-+        if (pDoc->IsUndoEnabled())
-+        {
-+            ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+            DBG_ASSERT(pProtect, "ScDocFunc::Unprotect: ScTableProtection pointer is NULL!");
-+            if (pProtect)
-+            {
-+                ::std::auto_ptr<ScTableProtection> p(new ScTableProtection(*pProtect));
-+                p->setProtected(true); // just in case ...
-+                rDocShell.GetUndoManager()->AddUndoAction(
-+                    new ScUndoTabProtect(&rDocShell, nTab, p) );
-+                // ownership of auto_ptr now transferred to ScUndoTabProtect.
-+            }
-+        }
-+    }
- 
--		if (bUndo)
--		{
--			rDocShell.GetUndoManager()->AddUndoAction(
--						new ScUndoProtect( &rDocShell, nTab, TRUE, aPass ) );
--		}
-+    rDocShell.PostPaintGridAll();
-+    ScDocShellModificator aModificator( rDocShell );
-+    aModificator.SetDocumentModified();
- 
--		if ( nTab == TABLEID_DOC )
--			pDoc->SetDocProtection( TRUE, aPass );
--		else
--			pDoc->SetTabProtection( nTab, TRUE, aPass );
-+    return true;
-+}
- 
--		rDocShell.PostPaintGridAll();
--		aModificator.SetDocumentModified();
--	}
--	else if (!bApi)
--	{
--		//	different password was set before
-+BOOL ScDocFunc::Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi )
-+{
-+    ScDocument* pDoc = rDocShell.GetDocument();
- 
--//!		rDocShell.ErrorMessage(...);
-+    if (nTab == TABLEID_DOC)
-+    {
-+        // document protection
- 
--		InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
--		aBox.Execute();
--	}
-+        ScDocProtection* pDocProtect = pDoc->GetDocProtection();
-+        if (!pDocProtect || !pDocProtect->isProtected())
-+            // already unprotected (should not happen)!
-+            return true;
- 
--	return bOk;
--}
-+        // save the protection state before unprotect (for undo).
-+        ::std::auto_ptr<ScDocProtection> pProtectCopy(new ScDocProtection(*pDocProtect));
- 
--BOOL ScDocFunc::Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi )
--{
--	ScDocShellModificator aModificator( rDocShell );
-+        if (!pDocProtect->verifyPassword(rPassword))
-+        {
-+            if (!bApi)
-+            {
-+                InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
-+                aBox.Execute();
-+            }
-+            return false;
-+        }
- 
--	ScDocument* pDoc = rDocShell.GetDocument();
--	BOOL bUndo(pDoc->IsUndoEnabled());
--	uno::Sequence<sal_Int8> aOldPassword;
--	uno::Sequence<sal_Int8> aPass;
--	BOOL bOk = lcl_ValidPassword( pDoc, nTab, rPassword, &aOldPassword );
--	if ( bOk )
--	{
--		uno::Sequence<sal_Int8> aEmptyPass;
--		if ( nTab == TABLEID_DOC )
--			pDoc->SetDocProtection( FALSE, aEmptyPass );
--		else
--			pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
-+        pDoc->SetDocProtection(NULL);
-+        if (pDoc->IsUndoEnabled())
-+        {
-+            pProtectCopy->setProtected(false);
-+            rDocShell.GetUndoManager()->AddUndoAction(
-+                new ScUndoDocProtect(&rDocShell, pProtectCopy) );
-+            // ownership of auto_ptr now transferred to ScUndoDocProtect.
-+        }
-+    }
-+    else
-+    {
-+        // sheet protection
- 
--		if (bUndo)
--		{
--			rDocShell.GetUndoManager()->AddUndoAction(
--						new ScUndoProtect( &rDocShell, nTab, FALSE, aOldPassword ) );
--		}
-+        ScTableProtection* pTabProtect = pDoc->GetTabProtection(nTab);
-+        if (!pTabProtect || !pTabProtect->isProtected())
-+            // already unprotected (should not happen)!
-+            return true;
-+
-+        // save the protection state before unprotect (for undo).
-+        ::std::auto_ptr<ScTableProtection> pProtectCopy(new ScTableProtection(*pTabProtect));
-+        if (!pTabProtect->verifyPassword(rPassword))
-+        {
-+            if (!bApi)
-+            {
-+                InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
-+                aBox.Execute();
-+            }
-+            return false;
-+        }
- 
--		rDocShell.PostPaintGridAll();
--		aModificator.SetDocumentModified();
--	}
--	else if (!bApi)
--	{
--//!		rDocShell.ErrorMessage(...);
-+        pDoc->SetTabProtection(nTab, NULL);
-+        if (pDoc->IsUndoEnabled())
-+        {
-+            pProtectCopy->setProtected(false);
-+            rDocShell.GetUndoManager()->AddUndoAction(
-+                new ScUndoTabProtect(&rDocShell, nTab, pProtectCopy) );
-+            // ownership of auto_ptr now transferred to ScUndoTabProtect.
-+        }
-+    }
- 
--		InfoBox aBox( rDocShell.GetActiveDialogParent(), String( ScResId( SCSTR_WRONGPASSWORD ) ) );
--		aBox.Execute();
--	}
-+    rDocShell.PostPaintGridAll();
-+    ScDocShellModificator aModificator( rDocShell );
-+    aModificator.SetDocumentModified();
- 
--	return bOk;
-+    return true;
- }
- 
- //------------------------------------------------------------------------
---- sc/source/ui/docshell/docsh.cxx.old	2009-04-06 16:41:46.000000000 +0000
-+++ sc/source/ui/docshell/docsh.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -79,11 +79,6 @@
- #include <sot/formats.hxx>
- #define SOT_FORMATSTR_ID_STARCALC_30 SOT_FORMATSTR_ID_STARCALC
- 
--//REMOVE	#ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED
--//REMOVE	#define SO2_DECL_SVSTORAGESTREAM_DEFINED
--//REMOVE	SO2_DECL_REF(SotStorageStream)
--//REMOVE	#endif
--
- // INCLUDE ---------------------------------------------------------------
- 
- #include "cell.hxx"
-@@ -97,7 +92,6 @@
- #include "scresid.hxx"
- #include "sc.hrc"
- #include "globstr.hrc"
--//CHINA001 #include "tpstat.hxx"
- #include "scerrors.hxx"
- #include "brdcst.hxx"
- #include "stlpool.hxx"
-@@ -126,6 +120,7 @@
- #include "cfgids.hxx"
- #include "warnpassword.hxx"
- #include "optsolver.hxx"
-+#include "tabprotection.hxx"
- 
- #include "docsh.hxx"
- #include "docshimp.hxx"
-@@ -1323,6 +1318,16 @@ BOOL __EXPORT ScDocShell::SaveAs( SfxMed
- {
- 	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
- 
-+#if ENABLE_SHEET_PROTECTION
-+    ScTabViewShell* pViewShell = GetBestViewShell();
-+    if (pViewShell && ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_OOO))
-+    {
-+        if (!pViewShell->ExecuteRetypePassDlg(PASSHASH_OOO))
-+            // password re-type cancelled.  Don't save the document.
-+            return false;
-+    }
-+#endif
-+
- 	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
- 
-     PrepareSaveGuard aPrepareGuard( *this);
-@@ -1788,7 +1793,6 @@ void ScDocShell::AsciiSave( SvStream& rS
- 	rStream.SetNumberFormatInt( nOldNumberFormatInt );
- }
- 
--
- BOOL __EXPORT ScDocShell::ConvertTo( SfxMedium &rMed )
- {
- 	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::ConvertTo" );
-@@ -1842,15 +1846,40 @@ BOOL __EXPORT ScDocShell::ConvertTo( Sfx
-                 aDocument.SetExtDocOptions( pExtDocOpt = new ScExtDocOptions );
-             pViewShell->GetViewData()->WriteExtOptions( *pExtDocOpt );
- 
--            /*  #115980 #If the imported document contained an encrypted password -
--                determine if we should save without it. */
--            ScExtDocSettings& rDocSett = pExtDocOpt->GetDocSettings();
--            if( rDocSett.mbEncrypted )
-+#if ENABLE_SHEET_PROTECTION
-+            bool bNeedRetypePassDlg = ScPassHashHelper::needsPassHashRegen(aDocument, PASSHASH_XL);
-+            if (bNeedRetypePassDlg && !pViewShell->ExecuteRetypePassDlg(PASSHASH_XL))
-             {
-+                SetError( ERRCODE_ABORT );
-+                return false;
-+            }
-+#else
-+            bool bEncrypted = false;
-+
-+            do
-+            {
-+                SfxItemSet* pSet = rMed.GetItemSet();
-+                if (!pSet)
-+                    break;
-+                                                                                              
-+                const SfxPoolItem* pItem = NULL;
-+                if (SFX_ITEM_SET != pSet->GetItemState(SID_PASSWORD, sal_True, &pItem))
-+                    // password is not set.
-+                    break;
-+
-+                /*  #115980 #If the imported document contained an encrypted password -
-+                    determine if we should save without it. */
-                 bDoSave = ScWarnPassword::WarningOnPassword( rMed );
--                // #i42858# warn only on time
--                rDocSett.mbEncrypted = false;
-+
-+                if (bDoSave)
-+                {
-+                    // #i42858# warn only one time
-+                    pSet->ClearItem(SID_PASSWORD);
-+                }
-             }
-+            while (false);
-+
-+#endif            
-         }
- 
-         if( bDoSave )
---- sc/source/ui/docshell/docsh5.cxx.old	2009-04-02 10:45:27.000000000 +0000
-+++ sc/source/ui/docshell/docsh5.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -827,7 +827,7 @@ BOOL ScDocShell::MoveTable( SCTAB nSrcTa
- 				++nAdjSource;				// new position of source table after CopyTab
- 
- 			if ( aDocument.IsTabProtected( nAdjSource ) )
--				aDocument.SetTabProtection( nDestTab, TRUE, aDocument.GetTabPassword( nAdjSource ) );
-+                aDocument.CopyTabProtection(nAdjSource, nDestTab);
- 
- 			if (bRecord)
- 			{
---- sc/source/ui/inc/docfunc.hxx.old	2009-04-02 10:45:37.000000000 +0000
-+++ sc/source/ui/inc/docfunc.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -47,7 +47,7 @@ class ScRangeName;
- class ScBaseCell;
- class ScTokenArray;
- struct ScTabOpParam;
--
-+class ScTableProtection;
- 
- // ---------------------------------------------------------------------------
- 
-@@ -135,6 +135,8 @@ public:
- 	BOOL			RemovePageBreak( BOOL bColumn, const ScAddress& rPos,
- 									BOOL bRecord, BOOL bSetModified, BOOL bApi );
- 
-+    void            ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
-+
- 	BOOL			Protect( SCTAB nTab, const String& rPassword, BOOL bApi );
- 	BOOL			Unprotect( SCTAB nTab, const String& rPassword, BOOL bApi );
- 
---- sc/source/ui/inc/protectiondlg.hrc.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/inc/protectiondlg.hrc	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,47 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: protectiondlg.hrc,v $
-+ * $Revision: 1.1.2.1 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include <sc.hrc>
-+
-+#define BTN_OK                  1
-+#define BTN_CANCEL              2
-+#define BTN_HELP                3
-+
-+#define BTN_PROTECT             4
-+#define FT_PASSWORD1            5
-+#define ED_PASSWORD1            6
-+#define FT_PASSWORD2            7
-+#define ED_PASSWORD2            8
-+#define FL_OPTIONS              9
-+#define FT_OPTIONS             10
-+#define CLB_OPTIONS            11
-+
-+#define ST_SELECT_LOCKED_CELLS          50
-+#define ST_SELECT_UNLOCKED_CELLS        51
---- sc/source/ui/inc/protectiondlg.hxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/inc/protectiondlg.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,85 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: protectiondlg.hxx,v $
-+ * $Revision: 1.1.2.4 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_UI_PROTECTION_DLG_HXX
-+#define SC_UI_PROTECTION_DLG_HXX
-+
-+#include <vcl/dialog.hxx>
-+#include <vcl/button.hxx>
-+#include <vcl/fixed.hxx>
-+#include <vcl/edit.hxx>
-+#include <svx/checklbx.hxx>
-+
-+class Window;
-+class ScTableProtection;
-+
-+class ScTableProtectionDlg : public ModalDialog
-+{
-+public:
-+    explicit ScTableProtectionDlg(Window* pParent);
-+    virtual ~ScTableProtectionDlg();
-+
-+    virtual short Execute();
-+
-+    void SetDialogData(const ScTableProtection& rData);
-+
-+    void WriteData(ScTableProtection& rData) const;
-+
-+private:
-+    ScTableProtectionDlg(); // disabled
-+
-+    void Init();
-+
-+    void EnableOptionalWidgets(bool bEnable = true);
-+
-+    CheckBox        maBtnProtect;
-+
-+    FixedText       maPassword1Text;
-+    Edit            maPassword1Edit;
-+    FixedText       maPassword2Text;
-+    Edit            maPassword2Edit;
-+
-+    FixedLine       maOptionsLine;
-+    FixedText       maOptionsText;
-+    SvxCheckListBox maOptionsListBox;
-+
-+    OKButton        maBtnOk;
-+    CancelButton    maBtnCancel;
-+    HelpButton      maBtnHelp;
-+
-+    String          maSelectLockedCells;
-+    String          maSelectUnlockedCells;
-+
-+    DECL_LINK( OKHdl, OKButton* );
-+    DECL_LINK( CheckBoxHdl, CheckBox* );
-+    DECL_LINK( PasswordModifyHdl, Edit* );
-+};
-+
-+#endif
---- sc/source/ui/inc/retypepassdlg.hrc.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/inc/retypepassdlg.hrc	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,74 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: retypepassdlg.hrc,v $
-+ * $Revision: 1.1.2.2 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include <sc.hrc>
-+
-+#define BTN_OK                   1
-+#define BTN_CANCEL               2
-+#define BTN_HELP                 3
-+
-+#define FT_DESC                 10
-+#define FL_DOCUMENT             11
-+#define FT_DOCSTATUS            12
-+#define BTN_RETYPE_DOC          13
-+
-+#define FL_SHEET                112
-+
-+#define FT_SHEETNAME1           113
-+#define FT_SHEETSTATUS1         114
-+#define BTN_RETYPE_SHEET1       115
-+
-+#define FT_SHEETNAME2           116
-+#define FT_SHEETSTATUS2         117
-+#define BTN_RETYPE_SHEET2       118
-+
-+#define FT_SHEETNAME3           119
-+#define FT_SHEETSTATUS3         120
-+#define BTN_RETYPE_SHEET3       121
-+
-+#define FT_SHEETNAME4           122
-+#define FT_SHEETSTATUS4         123
-+#define BTN_RETYPE_SHEET4       124
-+
-+#define SB_SCROLL               190
-+
-+#define STR_NOT_PROTECTED       200
-+#define STR_NOT_PASS_PROTECTED  201
-+#define STR_HASH_BAD            202
-+#define STR_HASH_GOOD           203
-+#define STR_HASH_REGENERATED    204
-+
-+#define FT_PASSWORD1            301
-+#define ED_PASSWORD1            302
-+#define FT_PASSWORD2            303
-+#define ED_PASSWORD2            304
-+#define BTN_MATCH_OLD_PASSWORD  305
-+#define BTN_RETYPE_PASSWORD     306
-+#define BTN_REMOVE_PASSWORD     307
---- sc/source/ui/inc/retypepassdlg.hxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/inc/retypepassdlg.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,177 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: retypepassdlg.hxx,v $
-+ * $Revision: 1.1.2.7 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#ifndef SC_UI_RETYPEPASS_DLG_HXX
-+#define SC_UI_RETYPEPASS_DLG_HXX
-+
-+#include <vcl/dialog.hxx>
-+#include <vcl/button.hxx>
-+#include <vcl/fixed.hxx>
-+#include <vcl/edit.hxx>
-+#include <vcl/scrbar.hxx>
-+#include <svx/checklbx.hxx>
-+#include <svtools/stdctrl.hxx>
-+
-+#include "tabprotection.hxx"
-+
-+#include <boost/shared_ptr.hpp>
-+
-+class Window;
-+class ScDocProtection;
-+class ScTableProtection;
-+class ScDocument;
-+
-+class ScRetypePassDlg : public ModalDialog
-+{
-+public:
-+    typedef ::boost::shared_ptr<ScDocProtection>    DocProtectionPtr;
-+    typedef ::boost::shared_ptr<ScTableProtection>  TabProtectionPtr;
-+
-+    explicit ScRetypePassDlg(Window* pParent);
-+    virtual ~ScRetypePassDlg();
-+
-+    virtual short Execute();
-+
-+    void SetData(const ScDocument& rDoc);
-+    void SetDesiredHash(ScPasswordHash eHash);
-+
-+    /** Write the new set of password data to the document instance to
-+        overwrite the current ones. */
-+    void WriteNewDataToDocument(ScDocument& rDoc) const;
-+
-+private:
-+    ScRetypePassDlg(); // disabled
-+
-+    void Init();
-+    void PopulateDialog();
-+    void SetDocData();
-+    void SetTableData(sal_uInt8 nRowPos, SCTAB nTab);
-+    void ResetTableRows();
-+
-+    /** Check the status of all hash values to see if it's okay to enable
-+        the OK button. */
-+    void CheckHashStatus();
-+
-+private:
-+    OKButton        maBtnOk;
-+    CancelButton    maBtnCancel;
-+    HelpButton      maBtnHelp;
-+
-+    FixedInfo       maTextDescription;
-+
-+    FixedLine       maLineDocument;
-+    FixedText       maTextDocStatus;
-+    PushButton      maBtnRetypeDoc;
-+
-+    FixedLine       maLineSheet;
-+    FixedText       maTextSheetName1;
-+    FixedText       maTextSheetStatus1;
-+    PushButton      maBtnRetypeSheet1;
-+
-+    FixedText       maTextSheetName2;
-+    FixedText       maTextSheetStatus2;
-+    PushButton      maBtnRetypeSheet2;
-+
-+    FixedText       maTextSheetName3;
-+    FixedText       maTextSheetStatus3;
-+    PushButton      maBtnRetypeSheet3;
-+
-+    FixedText       maTextSheetName4;
-+    FixedText       maTextSheetStatus4;
-+    PushButton      maBtnRetypeSheet4;
-+
-+    ScrollBar       maScrollBar;
-+
-+    String          maTextNotProtected;
-+    String          maTextNotPassProtected;
-+    String          maTextHashBad;
-+    String          maTextHashGood;
-+    String          maTextHashRegen;
-+
-+    DECL_LINK( OKHdl, OKButton* );
-+    DECL_LINK( RetypeBtnHdl, PushButton* );
-+    DECL_LINK( ScrollHdl, ScrollBar* );
-+
-+    struct TableItem
-+    {
-+        String              maName;
-+        TabProtectionPtr    mpProtect;
-+    };
-+    ::std::vector<TableItem> maTableItems;
-+
-+    DocProtectionPtr    mpDocItem;
-+    size_t              mnCurScrollPos;
-+    ScPasswordHash      meDesiredHash;
-+};
-+
-+// ============================================================================
-+
-+class ScRetypePassInputDlg : public ModalDialog
-+{
-+public:
-+    explicit ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected);
-+    virtual ~ScRetypePassInputDlg();
-+
-+    virtual short Execute();
-+
-+    bool IsRemovePassword() const;
-+    String GetNewPassword() const;
-+
-+private:
-+    ScRetypePassInputDlg(); // disabled
-+
-+    void Init();
-+    void CheckPasswordInput();
-+
-+private:
-+    OKButton        maBtnOk;
-+    CancelButton    maBtnCancel;
-+    HelpButton      maBtnHelp;
-+
-+    RadioButton     maBtnRetypePassword;
-+
-+    FixedText       maPassword1Text;
-+    Edit            maPassword1Edit;
-+    FixedText       maPassword2Text;
-+    Edit            maPassword2Edit;
-+
-+    CheckBox        maBtnMatchOldPass;
-+
-+    RadioButton     maBtnRemovePassword;
-+
-+    DECL_LINK( OKHdl, OKButton* );
-+    DECL_LINK( RadioBtnHdl, RadioButton* );
-+    DECL_LINK( CheckBoxHdl, CheckBox* );
-+    DECL_LINK( PasswordModifyHdl, Edit* );
-+
-+    ScPassHashProtectable* mpProtected;
-+};
-+
-+#endif
---- sc/source/ui/inc/tabvwsh.hxx.old	2009-04-06 16:41:41.000000000 +0000
-+++ sc/source/ui/inc/tabvwsh.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -38,6 +38,7 @@
- #include "target.hxx"
- #include "rangelst.hxx"			// ScRangeListRef
- #include "shellids.hxx"
-+#include "tabprotection.hxx" // for ScPasswordHash
- 
- class FmFormShell;
- class SbxObject;
-@@ -428,6 +429,8 @@ public:
- 	void	BroadcastAccessibility( const SfxHint &rHint );
- 	BOOL	HasAccessibilityObjects();
- 
-+    bool    ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
-+
-     using ScTabView::ShowCursor;
- };
- 
---- sc/source/ui/inc/undotab.hxx.old	2009-04-02 10:45:37.000000000 +0000
-+++ sc/source/ui/inc/undotab.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -52,11 +52,15 @@
- 
- #include <com/sun/star/uno/Sequence.hxx>
- 
-+#include <memory>
-+
- class ScDocShell;
- class ScDocument;
- class SdrUndoAction;
- class ScPrintRangeSaver;
- class SdrObject;
-+class ScDocProtection;
-+class ScTableProtection;
- 
- //----------------------------------------------------------------------------
- 
-@@ -335,14 +339,15 @@ private:
- 	void DoChange( BOOL bShow ) const;
- };
- 
-+// ============================================================================
- 
--class ScUndoProtect : public ScSimpleUndo
-+/** This class implements undo & redo of document protect & unprotect
-+    operations. */
-+class ScUndoDocProtect : public ScSimpleUndo
- {
- public:
--					TYPEINFO();
--					ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
--									BOOL bNewProtect, const com::sun::star::uno::Sequence<sal_Int8>& rNewPassword );
--	virtual			~ScUndoProtect();
-+                    ScUndoDocProtect(ScDocShell* pShell, ::std::auto_ptr<ScDocProtection> pProtectSettings);
-+	virtual			~ScUndoDocProtect();
- 
- 	virtual void	Undo();
- 	virtual void	Redo();
-@@ -352,11 +357,34 @@ public:
- 	virtual String	GetComment() const;
- 
- private:
--	SCTAB	nTab;
--	BOOL	bProtect;
--	com::sun::star::uno::Sequence<sal_Int8>	aPassword;
-+    ::std::auto_ptr<ScDocProtection> mpProtectSettings;
-+
-+	void	DoProtect(bool bProtect);
-+};
-+
-+// ============================================================================
-+
-+/** This class implements undo & redo of both protect and unprotect of
-+    sheet. */
-+class ScUndoTabProtect : public ScSimpleUndo
-+{
-+public:
-+                    ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab, 
-+                                     ::std::auto_ptr<ScTableProtection> pProtectSettings);
-+	virtual			~ScUndoTabProtect();
-+
-+	virtual void	Undo();
-+	virtual void	Redo();
-+	virtual void	Repeat(SfxRepeatTarget& rTarget);
-+	virtual BOOL	CanRepeat(SfxRepeatTarget& rTarget) const;
-+
-+	virtual String	GetComment() const;
-+
-+private:
-+    SCTAB   mnTab;
-+    ::std::auto_ptr<ScTableProtection> mpProtectSettings;
- 
--	void	DoProtect( BOOL bDo );
-+	void	DoProtect(bool bProtect);
- };
- 
- 
---- sc/source/ui/inc/viewfunc.hxx.old	2009-04-06 16:41:39.000000000 +0000
-+++ sc/source/ui/inc/viewfunc.hxx	2009-04-06 16:41:49.000000000 +0000
-@@ -69,6 +69,7 @@ class Exchange;
- class ScRangeList;
- class SvxHyperlinkItem;
- class ScTransferObj;
-+class ScTableProtection;
- 
- namespace com { namespace sun { namespace star { namespace datatransfer { class XTransferable; } } } }
- 
-@@ -199,6 +200,8 @@ public:
- 
- 	void			ChangeIndent( BOOL bIncrement );
- 
-+	void			ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect );
-+
- 	void			Protect( SCTAB nTab, const String& rPassword );
- 	BOOL			Unprotect( SCTAB nTab, const String& rPassword );
- 
---- sc/source/ui/miscdlgs/makefile.mk.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/ui/miscdlgs/makefile.mk	2009-04-06 16:41:49.000000000 +0000
-@@ -79,7 +79,9 @@ SLOFILES =  \
- 	$(SLO)$/warnbox.obj	\
- 	$(SLO)$/scuiautofmt.obj     \
- 	$(SLO)$/conflictsdlg.obj    \
--	$(SLO)$/sharedocdlg.obj
-+	$(SLO)$/sharedocdlg.obj \
-+	$(SLO)$/protectiondlg.obj \
-+	$(SLO)$/retypepassdlg.obj
- 
- EXCEPTIONSFILES = \
-     $(SLO)$/acredlin.obj        \
-@@ -88,7 +90,9 @@ EXCEPTIONSFILES = \
-     $(SLO)$/optsolver.obj       \
-     $(SLO)$/solveroptions.obj   \
-     $(SLO)$/crnrdlg.obj         \
--    $(SLO)$/solverutil.obj
-+    $(SLO)$/solverutil.obj \
-+    $(SLO)$/protectiondlg.obj \
-+    $(SLO)$/retypepassdlg.obj
- 
- SRS1NAME=$(TARGET)
- SRC1FILES = \
-@@ -97,7 +101,9 @@ SRC1FILES = \
- 	highred.src					\
- 	linkarea.src                \
- 	conflictsdlg.src            \
--	sharedocdlg.src
-+	sharedocdlg.src \
-+	protectiondlg.src \
-+	retypepassdlg.src
- 
- LIB1TARGET = $(SLB)$/$(TARGET).lib
- 
-@@ -119,7 +125,9 @@ LIB1OBJFILES =  \
- 	$(SLO)$/conflictsdlg.obj    \
- 	$(SLO)$/sharedocdlg.obj     \
- 	$(SLO)$/scuiautofmt.obj			\
--	$(SLO)$/strindlg.obj            
-+	$(SLO)$/strindlg.obj \
-+	$(SLO)$/protectiondlg.obj \
-+	$(SLO)$/retypepassdlg.obj
- 
- # --- Tagets -------------------------------------------------------
- 
---- sc/source/ui/miscdlgs/protectiondlg.cxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/miscdlgs/protectiondlg.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,161 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: protectiondlg.cxx,v $
-+ * $Revision: 1.1.2.6 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "protectiondlg.hxx"
-+#include "protectiondlg.hrc"
-+#include "scresid.hxx"
-+#include "tabprotection.hxx"
-+
-+#include <vcl/msgbox.hxx>
-+
-+
-+// The order must match that of the list box.
-+static const ScTableProtection::Option aOptions[] = {
-+    ScTableProtection::SELECT_LOCKED_CELLS,
-+    ScTableProtection::SELECT_UNLOCKED_CELLS,
-+};
-+static const USHORT nOptionCount = sizeof(aOptions)/sizeof(aOptions[0]);
-+
-+
-+ScTableProtectionDlg::ScTableProtectionDlg(Window* pParent) :
-+    ModalDialog(pParent, ScResId(RID_SCDLG_TABPROTECTION)),
-+
-+    maBtnProtect    (this, ScResId(BTN_PROTECT)),
-+    maPassword1Text (this, ScResId(FT_PASSWORD1)),
-+    maPassword1Edit (this, ScResId(ED_PASSWORD1)),
-+    maPassword2Text (this, ScResId(FT_PASSWORD2)),
-+    maPassword2Edit (this, ScResId(ED_PASSWORD2)),
-+    maOptionsLine   (this, ScResId(FL_OPTIONS)),
-+    maOptionsText   (this, ScResId(FT_OPTIONS)),
-+    maOptionsListBox(this, ScResId(CLB_OPTIONS)),
-+
-+    maBtnOk     (this, ScResId(BTN_OK)),
-+    maBtnCancel (this, ScResId(BTN_CANCEL)),
-+    maBtnHelp   (this, ScResId(BTN_HELP)),
-+
-+    maSelectLockedCells(ScResId(ST_SELECT_LOCKED_CELLS)),
-+    maSelectUnlockedCells(ScResId(ST_SELECT_UNLOCKED_CELLS))
-+{
-+    Init();
-+    FreeResource();
-+}
-+
-+ScTableProtectionDlg::~ScTableProtectionDlg()
-+{
-+}
-+
-+short ScTableProtectionDlg::Execute()
-+{
-+    return ModalDialog::Execute();
-+}
-+
-+void ScTableProtectionDlg::SetDialogData(const ScTableProtection& rData)
-+{
-+    for (USHORT i = 0; i < nOptionCount; ++i)
-+        maOptionsListBox.CheckEntryPos(i, rData.isOptionEnabled(aOptions[i]));
-+}
-+
-+void ScTableProtectionDlg::WriteData(ScTableProtection& rData) const
-+{
-+    rData.setProtected(maBtnProtect.IsChecked());
-+
-+    // We assume that the two password texts match.
-+    rData.setPassword(maPassword1Edit.GetText());
-+
-+    for (USHORT i = 0; i < nOptionCount; ++i)
-+        rData.setOption(aOptions[i], maOptionsListBox.IsChecked(i));
-+}
-+
-+void ScTableProtectionDlg::Init()
-+{
-+    Link aLink = LINK( this, ScTableProtectionDlg, CheckBoxHdl );
-+    maBtnProtect.SetClickHdl(aLink);
-+
-+    aLink = LINK( this, ScTableProtectionDlg, OKHdl );
-+    maBtnOk.SetClickHdl(aLink);
-+
-+    aLink = LINK( this, ScTableProtectionDlg, PasswordModifyHdl );
-+    maPassword1Edit.SetModifyHdl(aLink);
-+    maPassword2Edit.SetModifyHdl(aLink);
-+
-+    maOptionsListBox.SetUpdateMode(false);
-+    maOptionsListBox.Clear();
-+
-+    maOptionsListBox.InsertEntry(maSelectLockedCells);
-+    maOptionsListBox.InsertEntry(maSelectUnlockedCells);
-+
-+    maOptionsListBox.CheckEntryPos(0, true);
-+    maOptionsListBox.CheckEntryPos(1, true);
-+
-+    maOptionsListBox.SetUpdateMode(true);
-+
-+    // Set the default state of the dialog.
-+    maBtnProtect.Check(true);
-+    maPassword1Edit.GrabFocus();
-+}
-+
-+void ScTableProtectionDlg::EnableOptionalWidgets(bool bEnable)
-+{
-+    maPassword1Text.Enable(bEnable);
-+    maPassword1Edit.Enable(bEnable);
-+    maPassword2Text.Enable(bEnable);
-+    maPassword2Edit.Enable(bEnable);
-+    maOptionsLine.Enable(bEnable);
-+    maOptionsText.Enable(bEnable);
-+
-+    maOptionsListBox.Enable(bEnable);
-+    maOptionsListBox.Invalidate();
-+}
-+
-+IMPL_LINK( ScTableProtectionDlg, CheckBoxHdl, CheckBox*, pBtn )
-+{
-+    if (pBtn == &maBtnProtect)
-+    {
-+        bool bChecked = maBtnProtect.IsChecked();
-+        EnableOptionalWidgets(bChecked);
-+        maBtnOk.Enable(bChecked);
-+    }
-+
-+    return 0;
-+}
-+
-+IMPL_LINK( ScTableProtectionDlg, OKHdl, OKButton*, EMPTYARG )
-+{
-+    EndDialog(RET_OK);
-+    return 0;
-+}
-+
-+IMPL_LINK( ScTableProtectionDlg, PasswordModifyHdl, Edit*, EMPTYARG )
-+{
-+    String aPass1 = maPassword1Edit.GetText();
-+    String aPass2 = maPassword2Edit.GetText();
-+    maBtnOk.Enable(aPass1.Equals(aPass2));
-+    return 0;
-+}
---- sc/source/ui/miscdlgs/protectiondlg.src.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/miscdlgs/protectiondlg.src	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,130 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: protectiondlg.src,v $
-+ * $Revision: 1.1.2.6 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "protectiondlg.hrc"
-+
-+ModalDialog RID_SCDLG_TABPROTECTION
-+{
-+    Text [ en-US ] = "Protect Sheet" ;
-+    Size = MAP_APPFONT ( 220 , 135 ) ;
-+    Moveable = TRUE ;
-+    Closeable = TRUE ;
-+
-+    OKButton BTN_OK
-+    {
-+        Pos = MAP_APPFONT ( 164 , 6 ) ;
-+        Size = MAP_APPFONT ( 50 , 14 ) ;
-+        DefButton = TRUE ;
-+    };
-+    CancelButton BTN_CANCEL
-+    {
-+        Pos = MAP_APPFONT ( 164 , 23 ) ;
-+        Size = MAP_APPFONT ( 50 , 14 ) ;
-+    };
-+    HelpButton BTN_HELP
-+    {
-+        Pos = MAP_APPFONT ( 164 , 43 ) ;
-+        Size = MAP_APPFONT ( 50 , 14 ) ;
-+    };
-+
-+    CheckBox BTN_PROTECT
-+    {
-+        Pos = MAP_APPFONT ( 6 , 6 ) ;
-+        Size = MAP_APPFONT ( 150 , 10 );
-+
-+        Text [ en-US ] = "P~rotect this sheet and the contents of locked cells" ;
-+    };
-+
-+    FixedText FT_PASSWORD1
-+    {
-+        Pos = MAP_APPFONT ( 11, 23 );
-+        Size = MAP_APPFONT ( 42, 10 );
-+
-+        Text [ en-US ] = "~Password" ;
-+    };
-+
-+    Edit ED_PASSWORD1
-+    {
-+        Border = TRUE;
-+        PassWord = TRUE;
-+        Pos = MAP_APPFONT ( 56, 22 );
-+        Size = MAP_APPFONT ( 75, 12 );
-+    };
-+
-+    FixedText FT_PASSWORD2
-+    {
-+        Pos = MAP_APPFONT ( 11, 40 );
-+        Size = MAP_APPFONT ( 42, 10 );
-+
-+        Text [ en-US ] = "~Confirm" ;
-+    };
-+
-+    Edit ED_PASSWORD2
-+    {
-+        Border = TRUE;
-+        PassWord = TRUE;
-+        Pos = MAP_APPFONT ( 56, 39 );
-+        Size = MAP_APPFONT ( 75, 12 );
-+    };
-+
-+    FixedLine FL_OPTIONS
-+    {
-+        Pos = MAP_APPFONT ( 6, 60 );
-+        Size = MAP_APPFONT ( 150, 8 );
-+
-+        Text [ en-US ] = "Options";
-+    };
-+
-+    FixedText FT_OPTIONS
-+    {
-+        Pos = MAP_APPFONT ( 11, 74 );
-+        Size = MAP_APPFONT ( 140, 8 );
-+
-+        Text [ en-US ] = "Allow all users of this sheet to:";
-+    };
-+
-+    Control CLB_OPTIONS
-+    {
-+        Pos = MAP_APPFONT ( 11, 85 );
-+        Size = MAP_APPFONT ( 140, 40 );
-+        Border = TRUE ;
-+        TabStop = TRUE ;
-+    };
-+
-+    String ST_SELECT_LOCKED_CELLS
-+    {
-+        Text [ en-US ] = "Select locked cells";
-+    };
-+
-+    String ST_SELECT_UNLOCKED_CELLS
-+    {
-+        Text [ en-US ] = "Select unlocked cells";
-+    };
-+};
---- sc/source/ui/miscdlgs/retypepassdlg.cxx.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/miscdlgs/retypepassdlg.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,544 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: retypepassdlg.cxx,v $
-+ * $Revision: 1.1.2.7 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "retypepassdlg.hxx"
-+#include "retypepassdlg.hrc"
-+#include "scresid.hxx"
-+#include "document.hxx"
-+#include "tabprotection.hxx"
-+
-+#include <stdio.h>
-+
-+#include <vcl/msgbox.hxx>
-+
-+ScRetypePassDlg::ScRetypePassDlg(Window* pParent) :
-+    ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS)),
-+
-+    maBtnOk     (this, ScResId(BTN_OK)),
-+    maBtnCancel (this, ScResId(BTN_CANCEL)),
-+    maBtnHelp   (this, ScResId(BTN_HELP)),
-+
-+    maTextDescription(this, ScResId(FT_DESC)),
-+    maLineDocument(this, ScResId(FL_DOCUMENT)),
-+    maTextDocStatus(this, ScResId(FT_DOCSTATUS)),
-+    maBtnRetypeDoc(this, ScResId(BTN_RETYPE_DOC)),
-+
-+    maLineSheet(this, ScResId(FL_SHEET)),
-+    maTextSheetName1(this, ScResId(FT_SHEETNAME1)),
-+    maTextSheetStatus1(this, ScResId(FT_SHEETSTATUS1)),
-+    maBtnRetypeSheet1(this, ScResId(BTN_RETYPE_SHEET1)),
-+
-+    maTextSheetName2(this, ScResId(FT_SHEETNAME2)),
-+    maTextSheetStatus2(this, ScResId(FT_SHEETSTATUS2)),
-+    maBtnRetypeSheet2(this, ScResId(BTN_RETYPE_SHEET2)),
-+
-+    maTextSheetName3(this, ScResId(FT_SHEETNAME3)),
-+    maTextSheetStatus3(this, ScResId(FT_SHEETSTATUS3)),
-+    maBtnRetypeSheet3(this, ScResId(BTN_RETYPE_SHEET3)),
-+
-+    maTextSheetName4(this, ScResId(FT_SHEETNAME4)),
-+    maTextSheetStatus4(this, ScResId(FT_SHEETSTATUS4)),
-+    maBtnRetypeSheet4(this, ScResId(BTN_RETYPE_SHEET4)),
-+
-+    maScrollBar (this, ScResId(SB_SCROLL)),
-+
-+    maTextNotProtected(ScResId(STR_NOT_PROTECTED)),
-+    maTextNotPassProtected(ScResId(STR_NOT_PASS_PROTECTED)),
-+    maTextHashBad(ScResId(STR_HASH_BAD)),
-+    maTextHashGood(ScResId(STR_HASH_GOOD)),
-+    maTextHashRegen(ScResId(STR_HASH_REGENERATED)),
-+
-+    mpDocItem(static_cast<ScDocProtection*>(NULL)),
-+    mnCurScrollPos(0),
-+    meDesiredHash(PASSHASH_OOO)
-+{
-+    Init();
-+}
-+
-+ScRetypePassDlg::~ScRetypePassDlg()
-+{
-+}
-+
-+short ScRetypePassDlg::Execute()
-+{
-+    PopulateDialog();
-+    CheckHashStatus();
-+    return ModalDialog::Execute();
-+}
-+
-+void ScRetypePassDlg::SetData(const ScDocument& rDoc)
-+{
-+    const ScDocProtection* pDocProtect = rDoc.GetDocProtection();
-+    if (pDocProtect && pDocProtect->isProtected())
-+        mpDocItem.reset(new ScDocProtection(*pDocProtect));
-+
-+    SCTAB nTabCount = rDoc.GetTableCount();
-+    maTableItems.reserve(nTabCount);
-+    for (SCTAB i = 0; i < nTabCount; ++i)
-+    {
-+        TableItem aTabItem;
-+        rDoc.GetName(i, aTabItem.maName);
-+
-+        const ScTableProtection* pTabProtect = rDoc.GetTabProtection(i);
-+        if (pTabProtect && pTabProtect->isProtected())
-+            aTabItem.mpProtect.reset(new ScTableProtection(*pTabProtect));
-+
-+        maTableItems.push_back(aTabItem);
-+    }
-+}
-+
-+void ScRetypePassDlg::SetDesiredHash(ScPasswordHash eHash)
-+{
-+    meDesiredHash = eHash;
-+}
-+
-+void ScRetypePassDlg::WriteNewDataToDocument(ScDocument& rDoc) const
-+{
-+    if (mpDocItem.get())
-+        rDoc.SetDocProtection(mpDocItem.get());
-+
-+    size_t nTabCount = rDoc.GetTableCount();
-+    size_t n = maTableItems.size();
-+    for (size_t i = 0; i < n; ++i)
-+    {
-+        if (i >= nTabCount)
-+            break;
-+
-+        ScTableProtection* pTabProtect = maTableItems[i].mpProtect.get();
-+        if (pTabProtect)
-+            rDoc.SetTabProtection(static_cast<SCTAB>(i), pTabProtect);
-+    }
-+}
-+
-+void ScRetypePassDlg::Init()
-+{
-+    Link aLink = LINK( this, ScRetypePassDlg, OKHdl );
-+    maBtnOk.SetClickHdl(aLink);
-+
-+    aLink = LINK( this, ScRetypePassDlg, RetypeBtnHdl );
-+    maBtnRetypeDoc.SetClickHdl(aLink);
-+    maBtnRetypeSheet1.SetClickHdl(aLink);
-+    maBtnRetypeSheet2.SetClickHdl(aLink);
-+    maBtnRetypeSheet3.SetClickHdl(aLink);
-+    maBtnRetypeSheet4.SetClickHdl(aLink);
-+
-+    maTextDocStatus.SetText(maTextNotProtected);
-+    maTextSheetStatus1.SetText(maTextNotProtected);
-+    maTextSheetStatus2.SetText(maTextNotProtected);
-+    maTextSheetStatus3.SetText(maTextNotProtected);
-+    maTextSheetStatus4.SetText(maTextNotProtected);
-+    maBtnRetypeDoc.Disable();
-+
-+    // Make all sheet rows invisible.
-+
-+    maTextSheetName1.Show(false);
-+    maTextSheetStatus1.Show(false);
-+    maBtnRetypeSheet1.Show(false);
-+    maBtnRetypeSheet1.Disable();
-+    
-+    maTextSheetName2.Show(false);
-+    maTextSheetStatus2.Show(false);
-+    maBtnRetypeSheet2.Show(false);
-+    maBtnRetypeSheet2.Disable();
-+
-+    maTextSheetName3.Show(false);
-+    maTextSheetStatus3.Show(false);
-+    maBtnRetypeSheet3.Show(false);
-+    maBtnRetypeSheet3.Disable();
-+
-+    maTextSheetName4.Show(false);
-+    maTextSheetStatus4.Show(false);
-+    maBtnRetypeSheet4.Show(false);
-+    maBtnRetypeSheet4.Disable();
-+
-+    maScrollBar.Show(false);
-+
-+    maScrollBar.SetEndScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
-+    maScrollBar.SetScrollHdl( LINK( this, ScRetypePassDlg, ScrollHdl ) );
-+
-+    maScrollBar.SetPageSize(4);
-+    maScrollBar.SetVisibleSize(4);
-+    maScrollBar.SetLineSize(1);
-+}
-+
-+void ScRetypePassDlg::PopulateDialog()
-+{
-+    // Document protection first.
-+    SetDocData();
-+
-+    // Sheet protection next.  We're only interested in the first 4 sheets
-+    // (or less).
-+    size_t n = maTableItems.size();
-+    for (size_t i = 0; i < n && i < 4; ++i)
-+        SetTableData(i, i);
-+
-+    if (n > 4)
-+    {
-+        maScrollBar.Show(true);
-+        maScrollBar.SetRange(Range(0, n));
-+    }
-+}
-+
-+void ScRetypePassDlg::SetDocData()
-+{
-+    bool bBtnEnabled = false;
-+    if (mpDocItem.get() && mpDocItem->isProtected())
-+    {
-+        if (mpDocItem->isPasswordEmpty())
-+            maTextDocStatus.SetText(maTextNotPassProtected);
-+        else if (mpDocItem->hasPasswordHash(meDesiredHash))
-+            maTextDocStatus.SetText(maTextHashGood);
-+        else
-+        {
-+            // incompatible hash
-+            maTextDocStatus.SetText(maTextHashBad);
-+            bBtnEnabled = true;
-+        }
-+    }
-+    maBtnRetypeDoc.Enable(bBtnEnabled);
-+}
-+
-+void ScRetypePassDlg::SetTableData(sal_uInt8 nRowPos, SCTAB nTab)
-+{
-+    if (nRowPos >= 4)
-+        return;
-+
-+    FixedText* pName = NULL;
-+    FixedText* pStatus = NULL;
-+    PushButton* pBtn = NULL;
-+    switch (nRowPos)
-+    {
-+        case 0:
-+            pName = &maTextSheetName1;
-+            pStatus = &maTextSheetStatus1;
-+            pBtn = &maBtnRetypeSheet1;
-+        break;
-+        case 1:
-+            pName = &maTextSheetName2;
-+            pStatus = &maTextSheetStatus2;
-+            pBtn = &maBtnRetypeSheet2;
-+        break;
-+        case 2:
-+            pName = &maTextSheetName3;
-+            pStatus = &maTextSheetStatus3;
-+            pBtn = &maBtnRetypeSheet3;
-+        break;
-+        case 3:
-+            pName = &maTextSheetName4;
-+            pStatus = &maTextSheetStatus4;
-+            pBtn = &maBtnRetypeSheet4;
-+        break;
-+        default:
-+            return;
-+    }
-+
-+    bool bBtnEnabled = false;
-+    pName->SetText(maTableItems[nTab].maName);
-+    pName->Show(true);
-+    const ScTableProtection* pTabProtect = maTableItems[nTab].mpProtect.get();
-+    if (pTabProtect && pTabProtect->isProtected())
-+    {
-+        if (pTabProtect->isPasswordEmpty())
-+            pStatus->SetText(maTextNotPassProtected);
-+        else if (pTabProtect->hasPasswordHash(meDesiredHash))
-+            pStatus->SetText(maTextHashGood);
-+        else
-+        {
-+            // incompatible hash 
-+            pStatus->SetText(maTextHashBad);
-+            bBtnEnabled = true;
-+        }
-+    }
-+    else
-+        pStatus->SetText(maTextNotProtected);
-+
-+    pStatus->Show(true);
-+    pBtn->Show(true);
-+    pBtn->Enable(bBtnEnabled);
-+}
-+
-+void ScRetypePassDlg::ResetTableRows()
-+{
-+    long nScrollPos = maScrollBar.GetThumbPos();
-+    mnCurScrollPos = nScrollPos < 0 ? 0 : nScrollPos;
-+    size_t nRowCount = maTableItems.size() - nScrollPos;
-+    for (size_t i = 0; i < nRowCount; ++i)
-+        SetTableData(i, i + nScrollPos);
-+}
-+
-+bool lcl_IsInGoodStatus(ScPassHashProtectable* pProtected, ScPasswordHash eDesiredHash)
-+{
-+    if (!pProtected || !pProtected->isProtected())
-+        // Not protected.
-+        return true;
-+
-+    if (pProtected->isPasswordEmpty())
-+        return true;
-+
-+    if (pProtected->hasPasswordHash(eDesiredHash))
-+        return true;
-+
-+    return false;
-+}
-+
-+void ScRetypePassDlg::CheckHashStatus()
-+{
-+    do
-+    {
-+        if (!lcl_IsInGoodStatus(mpDocItem.get(), meDesiredHash))
-+            break;
-+
-+        bool bStatusGood = true;
-+        size_t nTabCount = maTableItems.size();
-+        for (size_t i = 0; i < nTabCount && bStatusGood; ++i)
-+        {
-+            if (!lcl_IsInGoodStatus(maTableItems[i].mpProtect.get(), meDesiredHash))
-+                bStatusGood = false;
-+        }
-+        if (!bStatusGood)
-+            break;
-+
-+        maBtnOk.Enable();
-+        return;
-+    }
-+    while (false);
-+
-+    maBtnOk.Disable();
-+}
-+
-+IMPL_LINK( ScRetypePassDlg, OKHdl, OKButton*, EMPTYARG )
-+{
-+    EndDialog(RET_OK);
-+    return 0;
-+}
-+
-+IMPL_LINK( ScRetypePassDlg, RetypeBtnHdl, PushButton*, pBtn )
-+{
-+    ScPassHashProtectable* pProtected = NULL;
-+    if (pBtn == &maBtnRetypeDoc)
-+    {
-+        // document protection.
-+        pProtected = mpDocItem.get();
-+    }
-+    else
-+    {
-+        // sheet protection.
-+        size_t nTabPos = mnCurScrollPos;
-+        if (pBtn == &maBtnRetypeSheet2)
-+            nTabPos += 1;
-+        else if (pBtn == &maBtnRetypeSheet3)
-+            nTabPos += 2;
-+        else if (pBtn == &maBtnRetypeSheet4)
-+            nTabPos += 3;
-+        else if (pBtn != &maBtnRetypeSheet1)
-+            // This should never happen !
-+            return 0;
-+
-+        if (nTabPos >= maTableItems.size())
-+            // Likewise, this should never happen !
-+            return 0;
-+
-+        pProtected = maTableItems[nTabPos].mpProtect.get();
-+    }
-+
-+    if (!pProtected)
-+        // What the ... !?
-+        return 0;
-+
-+    ScRetypePassInputDlg aDlg(this, pProtected);
-+    if (aDlg.Execute() == RET_OK)
-+    {
-+        // OK is pressed.  Update the protected item.
-+        if (aDlg.IsRemovePassword())
-+        {
-+            // Remove password from this item.
-+            pProtected->setPassword(String());
-+        }
-+        else
-+        {
-+            // Set a new password.
-+            String aNewPass = aDlg.GetNewPassword();
-+            pProtected->setPassword(aNewPass);
-+        }
-+
-+        SetDocData();
-+        ResetTableRows();
-+        CheckHashStatus();
-+    }
-+    return 0;
-+}
-+
-+IMPL_LINK( ScRetypePassDlg, ScrollHdl, ScrollBar*, EMPTYARG )
-+{
-+    ResetTableRows();
-+    return 0;
-+}
-+
-+// ============================================================================
-+
-+ScRetypePassInputDlg::ScRetypePassInputDlg(Window* pParent, ScPassHashProtectable* pProtected) :
-+    ModalDialog(pParent, ScResId(RID_SCDLG_RETYPEPASS_INPUT)),
-+
-+    maBtnOk     (this, ScResId(BTN_OK)),
-+    maBtnCancel (this, ScResId(BTN_CANCEL)),
-+    maBtnHelp   (this, ScResId(BTN_HELP)),
-+
-+    maBtnRetypePassword(this, ScResId(BTN_RETYPE_PASSWORD)),
-+
-+    maPassword1Text (this, ScResId(FT_PASSWORD1)),
-+    maPassword1Edit (this, ScResId(ED_PASSWORD1)),
-+    maPassword2Text (this, ScResId(FT_PASSWORD2)),
-+    maPassword2Edit (this, ScResId(ED_PASSWORD2)),
-+    maBtnMatchOldPass(this, ScResId(BTN_MATCH_OLD_PASSWORD)),
-+
-+    maBtnRemovePassword(this, ScResId(BTN_REMOVE_PASSWORD)),
-+
-+    mpProtected(pProtected)
-+{
-+    Init();
-+}
-+
-+ScRetypePassInputDlg::~ScRetypePassInputDlg()
-+{
-+}
-+
-+short ScRetypePassInputDlg::Execute()
-+{
-+    return ModalDialog::Execute();
-+}
-+
-+bool ScRetypePassInputDlg::IsRemovePassword() const
-+{
-+    return maBtnRemovePassword.IsChecked();
-+}
-+
-+String ScRetypePassInputDlg::GetNewPassword() const
-+{
-+    return maPassword1Edit.GetText();
-+}
-+
-+void ScRetypePassInputDlg::Init()
-+{
-+    Link aLink = LINK( this, ScRetypePassInputDlg, OKHdl );
-+    maBtnOk.SetClickHdl(aLink);
-+    aLink = LINK( this, ScRetypePassInputDlg, RadioBtnHdl );
-+    maBtnRetypePassword.SetClickHdl(aLink);
-+    maBtnRemovePassword.SetClickHdl(aLink);
-+    aLink = LINK( this, ScRetypePassInputDlg, CheckBoxHdl );
-+    maBtnMatchOldPass.SetClickHdl(aLink);
-+    aLink = LINK( this, ScRetypePassInputDlg, PasswordModifyHdl );
-+    maPassword1Edit.SetModifyHdl(aLink);
-+    maPassword2Edit.SetModifyHdl(aLink);
-+
-+    maBtnOk.Disable();
-+    maBtnRetypePassword.Check(true);
-+    maBtnMatchOldPass.Check(true);
-+    maPassword1Edit.GrabFocus();
-+}
-+
-+void ScRetypePassInputDlg::CheckPasswordInput()
-+{
-+    String aPass1 = maPassword1Edit.GetText();
-+    String aPass2 = maPassword2Edit.GetText();
-+
-+    if (!aPass1.Len() || !aPass2.Len())
-+    {
-+        // Empty password is not allowed.
-+        maBtnOk.Disable();
-+        return;
-+    }
-+
-+    if (!aPass1.Equals(aPass2))
-+    {
-+        // The two passwords differ.
-+        maBtnOk.Disable();
-+        return;
-+    }
-+
-+    if (!maBtnMatchOldPass.IsChecked())
-+    {
-+        maBtnOk.Enable();
-+        return;
-+    }
-+
-+    if (!mpProtected)
-+    {
-+        // This should never happen!
-+        maBtnOk.Disable();
-+        return;
-+    }
-+
-+    bool bPassGood = mpProtected->verifyPassword(aPass1);
-+    maBtnOk.Enable(bPassGood);
-+}
-+
-+IMPL_LINK( ScRetypePassInputDlg, OKHdl, OKButton*, EMPTYARG )
-+{
-+    EndDialog(RET_OK);
-+    return 0;
-+}
-+
-+IMPL_LINK( ScRetypePassInputDlg, RadioBtnHdl, RadioButton*, pBtn )
-+{
-+    if (pBtn == &maBtnRetypePassword)
-+    {
-+        maBtnRemovePassword.Check(false);
-+        maPassword1Text.Enable();
-+        maPassword1Edit.Enable();
-+        maPassword2Text.Enable();
-+        maPassword2Edit.Enable();
-+        maBtnMatchOldPass.Enable();
-+        CheckPasswordInput();
-+    }
-+    else if (pBtn == &maBtnRemovePassword)
-+    {
-+        maBtnRetypePassword.Check(false);
-+        maPassword1Text.Disable();
-+        maPassword1Edit.Disable();
-+        maPassword2Text.Disable();
-+        maPassword2Edit.Disable();
-+        maBtnMatchOldPass.Disable();
-+        maBtnOk.Enable();
-+    }
-+
-+    return 0;
-+}
-+
-+IMPL_LINK( ScRetypePassInputDlg, CheckBoxHdl, CheckBox*, EMPTYARG )
-+{
-+    CheckPasswordInput();
-+    return 0;
-+}
-+
-+IMPL_LINK( ScRetypePassInputDlg, PasswordModifyHdl, Edit*, EMPTYARG )
-+{
-+    CheckPasswordInput();
-+    return 0;
-+}
---- sc/source/ui/miscdlgs/retypepassdlg.src.old	1970-01-01 00:00:00.000000000 +0000
-+++ sc/source/ui/miscdlgs/retypepassdlg.src	2009-04-06 16:41:49.000000000 +0000
-@@ -0,0 +1,316 @@
-+/*************************************************************************
-+ *
-+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-+ * 
-+ * Copyright 2008 by Sun Microsystems, Inc.
-+ *
-+ * OpenOffice.org - a multi-platform office productivity suite
-+ *
-+ * $RCSfile: retypepassdlg.src,v $
-+ * $Revision: 1.1.2.3 $
-+ *
-+ * This file is part of OpenOffice.org.
-+ *
-+ * OpenOffice.org is free software: you can redistribute it and/or modify
-+ * it under the terms of the GNU Lesser General Public License version 3
-+ * only, as published by the Free Software Foundation.
-+ *
-+ * OpenOffice.org is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU Lesser General Public License version 3 for more details
-+ * (a copy is included in the LICENSE file that accompanied this code).
-+ *
-+ * You should have received a copy of the GNU Lesser General Public License
-+ * version 3 along with OpenOffice.org.  If not, see
-+ * <http://www.openoffice.org/license.html>
-+ * for a copy of the LGPLv3 License.
-+ *
-+ ************************************************************************/
-+
-+#include "retypepassdlg.hrc"
-+
-+
-+ModalDialog RID_SCDLG_RETYPEPASS
-+{
-+    Text [ en-US ] = "Re-type Password" ;
-+    Size = MAP_APPFONT ( 260 , 165 ) ;
-+    Moveable = TRUE ;
-+    Closeable = TRUE ;
-+
-+    OKButton BTN_OK
-+    {
-+        Pos = MAP_APPFONT ( 204, 6 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+        DefButton = TRUE ;
-+    };
-+
-+    CancelButton BTN_CANCEL
-+    {
-+        Pos = MAP_APPFONT ( 204, 23 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+    };
-+
-+    HelpButton BTN_HELP
-+    {
-+        Pos = MAP_APPFONT ( 204, 43 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+    };
-+
-+    FixedText FT_DESC
-+    {
-+        Pos = MAP_APPFONT ( 6, 6 ) ;
-+        Size = MAP_APPFONT ( 190, 36 );
-+
-+        WordBreak = TRUE ;
-+
-+        Text [ en-US ] = "The document you are about to export has one or more protected items with password that cannot be exported.  Please re-type your password to be able to export your document." ;
-+    };
-+
-+    FixedLine FL_DOCUMENT
-+    {
-+        Pos = MAP_APPFONT ( 6, 48 );
-+        Size = MAP_APPFONT ( 190, 8 );
-+
-+        Text [ en-US ] = "Document protection" ;
-+    };
-+
-+    FixedText FT_DOCSTATUS
-+    {
-+        Pos = MAP_APPFONT ( 10, 62 );
-+        Size = MAP_APPFONT ( 140, 8 );
-+
-+        Text [ en-US ] = "Status unknown" ;
-+    };
-+
-+    PushButton BTN_RETYPE_DOC
-+    {
-+        Pos = MAP_APPFONT ( 158, 59 );
-+        Size = MAP_APPFONT ( 30, 14 );
-+
-+        Text [ en-US ] = "Re-type" ;
-+    };
-+
-+    FixedLine FL_SHEET
-+    {
-+        Pos = MAP_APPFONT ( 6, 83 );
-+        Size = MAP_APPFONT ( 190, 8 );
-+
-+        Text [ en-US ] = "Sheet protection" ;
-+    };
-+
-+    FixedText FT_SHEETNAME1
-+    {
-+        Pos = MAP_APPFONT ( 10, 97 );
-+        Size = MAP_APPFONT ( 68, 8 );
-+
-+        Text [ en-US ] = "Sheet1 has a really long name" ;
-+    };
-+
-+    FixedText FT_SHEETSTATUS1
-+    {
-+        Pos = MAP_APPFONT ( 82, 97 );
-+        Size = MAP_APPFONT ( 72, 8 );
-+
-+        Text [ en-US ] = "Status unknown" ;
-+    };
-+
-+    PushButton BTN_RETYPE_SHEET1
-+    {
-+        Pos = MAP_APPFONT ( 158, 94 );
-+        Size = MAP_APPFONT ( 30, 14 );
-+
-+        Text [ en-US ] = "Re-type" ;
-+    };
-+
-+    FixedText FT_SHEETNAME2
-+    {
-+        Pos = MAP_APPFONT ( 10, 113 );
-+        Size = MAP_APPFONT ( 68, 8 );
-+
-+        Text [ en-US ] = "Sheet2" ;
-+    };
-+
-+    FixedText FT_SHEETSTATUS2
-+    {
-+        Pos = MAP_APPFONT ( 82, 113 );
-+        Size = MAP_APPFONT ( 72, 8 );
-+
-+        Text [ en-US ] = "Status unknown" ;
-+    };
-+
-+    PushButton BTN_RETYPE_SHEET2
-+    {
-+        Pos = MAP_APPFONT ( 158, 110 );
-+        Size = MAP_APPFONT ( 30, 14 );
-+
-+        Text [ en-US ] = "Re-type" ;
-+    };
-+
-+    FixedText FT_SHEETNAME3
-+    {
-+        Pos = MAP_APPFONT ( 10, 129 );
-+        Size = MAP_APPFONT ( 68, 8 );
-+
-+        Text [ en-US ] = "Sheet3" ;
-+    };
-+
-+    FixedText FT_SHEETSTATUS3
-+    {
-+        Pos = MAP_APPFONT ( 82, 129 );
-+        Size = MAP_APPFONT ( 72, 8 );
-+
-+        Text [ en-US ] = "Status unknown" ;
-+    };
-+
-+    PushButton BTN_RETYPE_SHEET3
-+    {
-+        Pos = MAP_APPFONT ( 158, 126 );
-+        Size = MAP_APPFONT ( 30, 14 );
-+
-+        Text [ en-US ] = "Re-type" ;
-+    };
-+
-+    FixedText FT_SHEETNAME4
-+    {
-+        Pos = MAP_APPFONT ( 10, 145 );
-+        Size = MAP_APPFONT ( 68, 8 );
-+
-+        Text [ en-US ] = "Sheet4" ;
-+    };
-+
-+    FixedText FT_SHEETSTATUS4
-+    {
-+        Pos = MAP_APPFONT ( 82, 145 );
-+        Size = MAP_APPFONT ( 72, 8 );
-+
-+        Text [ en-US ] = "Status unknown" ;
-+    };
-+
-+    PushButton BTN_RETYPE_SHEET4
-+    {
-+        Pos = MAP_APPFONT ( 158, 142 );
-+        Size = MAP_APPFONT ( 30, 14 );
-+
-+        Text [ en-US ] = "Re-type" ;
-+    };
-+
-+    ScrollBar SB_SCROLL
-+    {
-+        Pos = MAP_APPFONT ( 190, 94 ) ;
-+        Size = MAP_APPFONT (  8, 61 ) ;
-+        VScroll = TRUE ;
-+    };
-+
-+    String STR_NOT_PROTECTED
-+    {
-+        Text [ en-US ] = "Not protected" ;
-+    };
-+
-+    String STR_NOT_PASS_PROTECTED
-+    {
-+        Text [ en-US ] = "Not password-protected" ;
-+    };
-+
-+    String STR_HASH_BAD
-+    {
-+        Text [ en-US ] = "Hash incompatible" ;
-+    };
-+
-+    String STR_HASH_GOOD
-+    {
-+        Text [ en-US ] = "Hash compatible" ;
-+    };
-+
-+    String STR_HASH_REGENERATED
-+    {
-+        Text [ en-US ] = "Hash re-generated" ;
-+    };
-+};
-+
-+// ----------------------------------------------------------------------------
-+
-+ModalDialog RID_SCDLG_RETYPEPASS_INPUT
-+{
-+    Text [ en-US ] = "Re-type Password" ;
-+    Size = MAP_APPFONT ( 230 , 110 ) ;
-+    Moveable = TRUE ;
-+    Closeable = TRUE ;
-+
-+    OKButton BTN_OK
-+    {
-+        Pos = MAP_APPFONT ( 174, 6 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+        DefButton = TRUE ;
-+    };
-+
-+    CancelButton BTN_CANCEL
-+    {
-+        Pos = MAP_APPFONT ( 174, 23 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+    };
-+
-+    HelpButton BTN_HELP
-+    {
-+        Pos = MAP_APPFONT ( 174, 43 ) ;
-+        Size = MAP_APPFONT ( 50, 14 ) ;
-+    };
-+
-+    RadioButton BTN_RETYPE_PASSWORD
-+    {
-+        Pos = MAP_APPFONT ( 11, 10 );
-+        Size = MAP_APPFONT ( 150, 10 );
-+
-+        Text [ en-US ] = "Re-type password" ;
-+    };
-+
-+    FixedText FT_PASSWORD1
-+    {
-+        Pos = MAP_APPFONT ( 20, 30 );
-+        Size = MAP_APPFONT ( 42, 10 );
-+
-+        Text [ en-US ] = "~Password" ;
-+    };
-+
-+    Edit ED_PASSWORD1
-+    {
-+        Border = TRUE;
-+        PassWord = TRUE;
-+        Pos = MAP_APPFONT ( 65, 29 );
-+        Size = MAP_APPFONT ( 75, 12 );
-+    };
-+
-+    FixedText FT_PASSWORD2
-+    {
-+        Pos = MAP_APPFONT ( 20, 45 );
-+        Size = MAP_APPFONT ( 42, 10 );
-+
-+        Text [ en-US ] = "~Confirm" ;
-+    };
-+
-+    Edit ED_PASSWORD2
-+    {
-+        Border = TRUE;
-+        PassWord = TRUE;
-+        Pos = MAP_APPFONT ( 65, 44 );
-+        Size = MAP_APPFONT ( 75, 12 );
-+    };
-+
-+    CheckBox BTN_MATCH_OLD_PASSWORD
-+    {
-+        Pos = MAP_APPFONT ( 20, 65 );
-+        Size = MAP_APPFONT ( 150, 10 );
-+
-+        Text [ en-US ] = "New password must match the original password." ;
-+    };
-+
-+    RadioButton BTN_REMOVE_PASSWORD
-+    {
-+        Pos = MAP_APPFONT ( 11, 90 );
-+        Size = MAP_APPFONT ( 150, 10 );
-+
-+        Text [ en-US ] = "Remove password from this protected item." ;
-+    };
-+};
-+
-+
---- sc/source/ui/undo/undotab.cxx.old	2009-04-02 10:45:28.000000000 +0000
-+++ sc/source/ui/undo/undotab.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -61,6 +61,7 @@
- #include "prnsave.hxx"
- #include "printfun.hxx"
- #include "chgtrack.hxx"
-+#include "tabprotection.hxx"
- 
- // for ScUndoRenameObject - might me moved to another file later
- #include <svx/svditer.hxx>
-@@ -72,6 +73,8 @@
- extern BOOL bDrawIsInUndo;			//! irgendwo als Member !!!
- 
- using namespace com::sun::star;
-+using ::com::sun::star::uno::Sequence;
-+using ::std::auto_ptr;
- 
- // STATIC DATA -----------------------------------------------------------
- 
-@@ -85,7 +88,6 @@ TYPEINIT1(ScUndoMakeScenario,	SfxUndoAct
- TYPEINIT1(ScUndoImportTab,		SfxUndoAction);
- TYPEINIT1(ScUndoRemoveLink,		SfxUndoAction);
- TYPEINIT1(ScUndoShowHideTab,	SfxUndoAction);
--TYPEINIT1(ScUndoProtect,		SfxUndoAction);
- TYPEINIT1(ScUndoPrintRange,		SfxUndoAction);
- TYPEINIT1(ScUndoScenarioFlags,	SfxUndoAction);
- TYPEINIT1(ScUndoRenameObject,	SfxUndoAction);
-@@ -112,12 +114,12 @@ ScUndoInsertTab::ScUndoInsertTab( ScDocS
- 	SetChangeTrack();
- }
- 
--__EXPORT ScUndoInsertTab::~ScUndoInsertTab()
-+ScUndoInsertTab::~ScUndoInsertTab()
- {
- 	DeleteSdrUndoAction( pDrawUndo );
- }
- 
--String __EXPORT ScUndoInsertTab::GetComment() const
-+String ScUndoInsertTab::GetComment() const
- {
- 	if (bAppend)
- 		return ScGlobal::GetRscString( STR_UNDO_APPEND_TAB );
-@@ -138,7 +140,7 @@ void ScUndoInsertTab::SetChangeTrack()
- 		nEndChangeAction = 0;
- }
- 
--void __EXPORT ScUndoInsertTab::Undo()
-+void ScUndoInsertTab::Undo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 	pViewShell->SetTabNo(nTab);
-@@ -159,7 +161,7 @@ void __EXPORT ScUndoInsertTab::Undo()
- 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
- }
- 
--void __EXPORT ScUndoInsertTab::Redo()
-+void ScUndoInsertTab::Redo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 
-@@ -180,14 +182,14 @@ void __EXPORT ScUndoInsertTab::Redo()
- 	SetChangeTrack();
- }
- 
--void __EXPORT ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoInsertTab::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
- }
- 
--BOOL __EXPORT ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoInsertTab::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
-@@ -211,7 +213,7 @@ ScUndoInsertTables::ScUndoInsertTables(
- 	SetChangeTrack();
- }
- 
--__EXPORT ScUndoInsertTables::~ScUndoInsertTables()
-+ScUndoInsertTables::~ScUndoInsertTables()
- {
- 	String *pStr=NULL;
- 	if(pNameList!=NULL)
-@@ -227,7 +229,7 @@ __EXPORT ScUndoInsertTables::~ScUndoInse
- 	DeleteSdrUndoAction( pDrawUndo );
- }
- 
--String __EXPORT ScUndoInsertTables::GetComment() const
-+String ScUndoInsertTables::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
- }
-@@ -252,7 +254,7 @@ void ScUndoInsertTables::SetChangeTrack(
- 		nStartChangeAction = nEndChangeAction = 0;
- }
- 
--void __EXPORT ScUndoInsertTables::Undo()
-+void ScUndoInsertTables::Undo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 	pViewShell->SetTabNo(nTab);
-@@ -282,7 +284,7 @@ void __EXPORT ScUndoInsertTables::Undo()
- 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
- }
- 
--void __EXPORT ScUndoInsertTables::Redo()
-+void ScUndoInsertTables::Redo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 
-@@ -299,14 +301,14 @@ void __EXPORT ScUndoInsertTables::Redo()
- 	SetChangeTrack();
- }
- 
--void __EXPORT ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoInsertTables::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
- }
- 
--BOOL __EXPORT ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoInsertTables::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
-@@ -327,12 +329,12 @@ ScUndoDeleteTab::ScUndoDeleteTab( ScDocS
- 		SetChangeTrack();
- }
- 
--__EXPORT ScUndoDeleteTab::~ScUndoDeleteTab()
-+ScUndoDeleteTab::~ScUndoDeleteTab()
- {
- 	theTabs.Remove(0,theTabs.Count());
- }
- 
--String __EXPORT ScUndoDeleteTab::GetComment() const
-+String ScUndoDeleteTab::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_DELETE_TAB );
- }
-@@ -366,7 +368,7 @@ SCTAB lcl_GetVisibleTabBefore( ScDocumen
- 	return nTab;
- }
- 
--void __EXPORT ScUndoDeleteTab::Undo()
-+void ScUndoDeleteTab::Undo()
- {
- 	BeginUndo();
- 	int i=0;
-@@ -414,7 +416,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
-             pDoc->SetVisible( nTab, pRefUndoDoc->IsVisible( nTab ) );
- 
-             if ( pRefUndoDoc->IsTabProtected( nTab ) )
--                pDoc->SetTabProtection( nTab, TRUE, pRefUndoDoc->GetTabPassword( nTab ) );
-+                pDoc->SetTabProtection(nTab, pRefUndoDoc->GetTabProtection(nTab));
- 
- 			//	Drawing-Layer passiert beim MoveUndo::EndUndo
- 	//		pDoc->TransferDrawPage(pRefUndoDoc, nTab,nTab);
-@@ -450,7 +452,7 @@ void __EXPORT ScUndoDeleteTab::Undo()
- //	EndUndo();
- }
- 
--void __EXPORT ScUndoDeleteTab::Redo()
-+void ScUndoDeleteTab::Redo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 	pViewShell->SetTabNo( lcl_GetVisibleTabBefore( *pDocShell->GetDocument(), theTabs[0] ) );
-@@ -469,7 +471,7 @@ void __EXPORT ScUndoDeleteTab::Redo()
- 	pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
- }
- 
--void __EXPORT ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoDeleteTab::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 	{
-@@ -478,7 +480,7 @@ void __EXPORT ScUndoDeleteTab::Repeat(Sf
- 	}
- }
- 
--BOOL __EXPORT ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoDeleteTab::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
-@@ -500,11 +502,11 @@ ScUndoRenameTab::ScUndoRenameTab( ScDocS
- 	sNewName = rNewName;
- }
- 
--__EXPORT ScUndoRenameTab::~ScUndoRenameTab()
-+ScUndoRenameTab::~ScUndoRenameTab()
- {
- }
- 
--String __EXPORT ScUndoRenameTab::GetComment() const
-+String ScUndoRenameTab::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_RENAME_TAB );
- }
-@@ -526,22 +528,22 @@ void ScUndoRenameTab::DoChange( SCTAB nT
- 		pViewShell->UpdateInputHandler();
- }
- 
--void __EXPORT ScUndoRenameTab::Undo()
-+void ScUndoRenameTab::Undo()
- {
- 	DoChange(nTab, sOldName);
- }
- 
--void __EXPORT ScUndoRenameTab::Redo()
-+void ScUndoRenameTab::Redo()
- {
- 	DoChange(nTab, sNewName);
- }
- 
--void __EXPORT ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoRenameTab::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 	//	Repeat macht keinen Sinn
- }
- 
--BOOL __EXPORT ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoRenameTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;
- }
-@@ -565,13 +567,13 @@ ScUndoMoveTab::ScUndoMoveTab( ScDocShell
-         theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
- }
- 
--__EXPORT ScUndoMoveTab::~ScUndoMoveTab()
-+ScUndoMoveTab::~ScUndoMoveTab()
- {
- 	theNewTabs.Remove(0,theNewTabs.Count());
- 	theOldTabs.Remove(0,theOldTabs.Count());
- }
- 
--String __EXPORT ScUndoMoveTab::GetComment() const
-+String ScUndoMoveTab::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_MOVE_TAB );
- }
-@@ -618,22 +620,22 @@ void ScUndoMoveTab::DoChange( BOOL bUndo
- 	pDocShell->PostDataChanged();
- }
- 
--void __EXPORT ScUndoMoveTab::Undo()
-+void ScUndoMoveTab::Undo()
- {
- 	DoChange( TRUE );
- }
- 
--void __EXPORT ScUndoMoveTab::Redo()
-+void ScUndoMoveTab::Redo()
- {
- 	DoChange( FALSE );
- }
- 
--void __EXPORT ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoMoveTab::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 		// kein Repeat ! ? !
- }
- 
--BOOL __EXPORT ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoMoveTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;
- }
-@@ -660,12 +662,12 @@ ScUndoCopyTab::ScUndoCopyTab( ScDocShell
-         theNewTabs.Insert(aNewTab[sal::static_int_cast<USHORT>(i)],theNewTabs.Count());
- }
- 
--__EXPORT ScUndoCopyTab::~ScUndoCopyTab()
-+ScUndoCopyTab::~ScUndoCopyTab()
- {
- 	DeleteSdrUndoAction( pDrawUndo );
- }
- 
--String __EXPORT ScUndoCopyTab::GetComment() const
-+String ScUndoCopyTab::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_COPY_TAB );
- }
-@@ -684,7 +686,7 @@ void ScUndoCopyTab::DoChange() const
- 	pDocShell->PostDataChanged();
- }
- 
--void __EXPORT ScUndoCopyTab::Undo()
-+void ScUndoCopyTab::Undo()
- {
- 	ScDocument* pDoc = pDocShell->GetDocument();
- 
-@@ -717,7 +719,7 @@ void __EXPORT ScUndoCopyTab::Undo()
- 	DoChange();
- }
- 
--void __EXPORT ScUndoCopyTab::Redo()
-+void ScUndoCopyTab::Redo()
- {
- 	ScDocument* pDoc = pDocShell->GetDocument();
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-@@ -756,7 +758,7 @@ void __EXPORT ScUndoCopyTab::Redo()
- 		}
- 
- 		if ( pDoc->IsTabProtected( nAdjSource ) )
--			pDoc->SetTabProtection( nNewTab, TRUE, pDoc->GetTabPassword( nAdjSource ) );
-+            pDoc->CopyTabProtection(nAdjSource, nNewTab);
- 	}
- 
-     RedoSdrUndoAction( pDrawUndo );             // after the sheets are inserted
-@@ -767,12 +769,12 @@ void __EXPORT ScUndoCopyTab::Redo()
- 
- }
- 
--void __EXPORT ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoCopyTab::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 		// kein Repeat ! ? !
- }
- 
--BOOL __EXPORT ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoCopyTab::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;
- }
-@@ -801,17 +803,17 @@ ScUndoMakeScenario::ScUndoMakeScenario(
-     pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
- }
- 
--__EXPORT ScUndoMakeScenario::~ScUndoMakeScenario()
-+ScUndoMakeScenario::~ScUndoMakeScenario()
- {
-     DeleteSdrUndoAction( pDrawUndo );
- }
- 
--String __EXPORT ScUndoMakeScenario::GetComment() const
-+String ScUndoMakeScenario::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_MAKESCENARIO );
- }
- 
--void __EXPORT ScUndoMakeScenario::Undo()
-+void ScUndoMakeScenario::Undo()
- {
- 	ScDocument* pDoc = pDocShell->GetDocument();
- 
-@@ -836,7 +838,7 @@ void __EXPORT ScUndoMakeScenario::Undo()
-     pDocShell->Broadcast( SfxSimpleHint( SC_HINT_FORCESETTAB ) );
- }
- 
--void __EXPORT ScUndoMakeScenario::Redo()
-+void ScUndoMakeScenario::Redo()
- {
- 	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
- 	if (pViewShell)
-@@ -858,7 +860,7 @@ void __EXPORT ScUndoMakeScenario::Redo()
- 	SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- }
- 
--void __EXPORT ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoMakeScenario::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 	{
-@@ -866,7 +868,7 @@ void __EXPORT ScUndoMakeScenario::Repeat
- 	}
- }
- 
--BOOL __EXPORT ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoMakeScenario::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
-@@ -889,13 +891,13 @@ ScUndoImportTab::ScUndoImportTab( ScDocS
- 	pDrawUndo = GetSdrUndoAction( pDocShell->GetDocument() );
- }
- 
--__EXPORT ScUndoImportTab::~ScUndoImportTab()
-+ScUndoImportTab::~ScUndoImportTab()
- {
- 	delete pRedoDoc;
- 	DeleteSdrUndoAction( pDrawUndo );
- }
- 
--String __EXPORT ScUndoImportTab::GetComment() const
-+String ScUndoImportTab::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_INSERT_TAB );
- }
-@@ -922,7 +924,7 @@ void ScUndoImportTab::DoChange() const
- 								PAINT_GRID | PAINT_TOP | PAINT_LEFT | PAINT_EXTRAS );
- }
- 
--void __EXPORT ScUndoImportTab::Undo()
-+void ScUndoImportTab::Undo()
- {
- 	//!	eingefuegte Bereichsnamen etc.
- 
-@@ -958,7 +960,7 @@ void __EXPORT ScUndoImportTab::Undo()
- 			}
- 
- 			if ( pDoc->IsTabProtected( nTabPos ) )
--				pRedoDoc->SetTabProtection( nTabPos, TRUE, pDoc->GetTabPassword( nTabPos ) );
-+                pRedoDoc->SetTabProtection(nTabPos, pDoc->GetTabProtection(nTabPos));
- 		}
- 
- 	}
-@@ -973,7 +975,7 @@ void __EXPORT ScUndoImportTab::Undo()
- 	DoChange();
- }
- 
--void __EXPORT ScUndoImportTab::Redo()
-+void ScUndoImportTab::Redo()
- {
- 	if (!pRedoDoc)
- 	{
-@@ -1012,7 +1014,7 @@ void __EXPORT ScUndoImportTab::Redo()
- 		}
- 
- 		if ( pRedoDoc->IsTabProtected( nTabPos ) )
--			pDoc->SetTabProtection( nTabPos, TRUE, pRedoDoc->GetTabPassword( nTabPos ) );
-+            pDoc->SetTabProtection(nTabPos, pRedoDoc->GetTabProtection(nTabPos));
- 	}
- 
-     RedoSdrUndoAction( pDrawUndo );     // after the sheets are inserted
-@@ -1020,14 +1022,14 @@ void __EXPORT ScUndoImportTab::Redo()
- 	DoChange();
- }
- 
--void __EXPORT ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoImportTab::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- 			Execute(FID_INS_TABLE, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
- }
- 
--BOOL __EXPORT ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoImportTab::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
-@@ -1075,14 +1077,14 @@ ScUndoRemoveLink::ScUndoRemoveLink( ScDo
- 	}
- }
- 
--__EXPORT ScUndoRemoveLink::~ScUndoRemoveLink()
-+ScUndoRemoveLink::~ScUndoRemoveLink()
- {
- 	delete pTabs;
- 	delete pModes;
- 	delete[] pTabNames;
- }
- 
--String __EXPORT ScUndoRemoveLink::GetComment() const
-+String ScUndoRemoveLink::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_REMOVELINK );
- }
-@@ -1099,22 +1101,22 @@ void ScUndoRemoveLink::DoChange( BOOL bL
- 	pDocShell->UpdateLinks();
- }
- 
--void __EXPORT ScUndoRemoveLink::Undo()
-+void ScUndoRemoveLink::Undo()
- {
- 	DoChange( TRUE );
- }
- 
--void __EXPORT ScUndoRemoveLink::Redo()
-+void ScUndoRemoveLink::Redo()
- {
- 	DoChange( FALSE );
- }
- 
--void __EXPORT ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoRemoveLink::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 	//	gippsnich
- }
- 
--BOOL __EXPORT ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoRemoveLink::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;
- }
-@@ -1132,7 +1134,7 @@ ScUndoShowHideTab::ScUndoShowHideTab( Sc
- {
- }
- 
--__EXPORT ScUndoShowHideTab::~ScUndoShowHideTab()
-+ScUndoShowHideTab::~ScUndoShowHideTab()
- {
- }
- 
-@@ -1149,17 +1151,17 @@ void ScUndoShowHideTab::DoChange( BOOL b
- 	pDocShell->SetDocumentModified();
- }
- 
--void __EXPORT ScUndoShowHideTab::Undo()
-+void ScUndoShowHideTab::Undo()
- {
- 	DoChange(!bShow);
- }
- 
--void __EXPORT ScUndoShowHideTab::Redo()
-+void ScUndoShowHideTab::Redo()
- {
- 	DoChange(bShow);
- }
- 
--void __EXPORT ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoShowHideTab::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
-@@ -1167,97 +1169,154 @@ void __EXPORT ScUndoShowHideTab::Repeat(
- 								SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
- }
- 
--BOOL __EXPORT ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoShowHideTab::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
- 
--String __EXPORT ScUndoShowHideTab::GetComment() const
-+String ScUndoShowHideTab::GetComment() const
- {
- 	USHORT nId = bShow ? STR_UNDO_SHOWTAB : STR_UNDO_HIDETAB;
- 	return ScGlobal::GetRscString( nId );
- }
- 
--// -----------------------------------------------------------------------
--//
--//		Tabelle/Dokument schuetzen oder Schutz aufheben
--//
-+// ============================================================================
- 
--ScUndoProtect::ScUndoProtect( ScDocShell* pShell, SCTAB nNewTab,
--							BOOL bNewProtect, const uno::Sequence<sal_Int8>& rNewPassword ) :
--	ScSimpleUndo( pShell ),
--	nTab( nNewTab ),
--	bProtect( bNewProtect ),
--	aPassword( rNewPassword )
-+ScUndoDocProtect::ScUndoDocProtect(ScDocShell* pShell, auto_ptr<ScDocProtection> pProtectSettings) :
-+    ScSimpleUndo(pShell),
-+    mpProtectSettings(pProtectSettings)
- {
- }
- 
--__EXPORT ScUndoProtect::~ScUndoProtect()
-+ScUndoDocProtect::~ScUndoDocProtect()
- {
- }
- 
--void ScUndoProtect::DoProtect( BOOL bDo )
-+void ScUndoDocProtect::DoProtect(bool bProtect)
- {
--	ScDocument* pDoc = pDocShell->GetDocument();
-+    ScDocument* pDoc = pDocShell->GetDocument();
- 
--	if (bDo)
--	{
--		if ( nTab == TABLEID_DOC )
--			pDoc->SetDocProtection( TRUE, aPassword );
--		else
--			pDoc->SetTabProtection( nTab, TRUE, aPassword );
--	}
--	else
--	{
--		uno::Sequence<sal_Int8> aEmptyPass;
--		if ( nTab == TABLEID_DOC )
--			pDoc->SetDocProtection( FALSE, aEmptyPass );
--		else
--			pDoc->SetTabProtection( nTab, FALSE, aEmptyPass );
--	}
-+    if (bProtect)
-+    {
-+        // set protection.
-+        auto_ptr<ScDocProtection> pCopy(new ScDocProtection(*mpProtectSettings));
-+        pCopy->setProtected(true);
-+        pDoc->SetDocProtection(pCopy.get());
-+    }
-+    else
-+    {
-+        // remove protection.
-+        pDoc->SetDocProtection(NULL);
-+    }
- 
--	ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
--	if (pViewShell)
--	{
--		pViewShell->UpdateLayerLocks();
--		pViewShell->UpdateInputHandler(TRUE);	// damit sofort wieder eingegeben werden kann
--	}
-+    ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-+    if (pViewShell)
-+    {
-+        pViewShell->UpdateLayerLocks();
-+        pViewShell->UpdateInputHandler(TRUE);   // damit sofort wieder eingegeben werden kann
-+    }
- 
--	pDocShell->PostPaintGridAll();
-+    pDocShell->PostPaintGridAll();
- }
- 
--void __EXPORT ScUndoProtect::Undo()
-+void ScUndoDocProtect::Undo()
- {
--	BeginUndo();
--	DoProtect( !bProtect );
--	EndUndo();
-+    BeginUndo();
-+    DoProtect(!mpProtectSettings->isProtected());
-+    EndUndo();
- }
- 
--void __EXPORT ScUndoProtect::Redo()
-+void ScUndoDocProtect::Redo()
- {
--	BeginRedo();
--	DoProtect( bProtect );
--	EndRedo();
-+    BeginRedo();
-+    DoProtect(mpProtectSettings->isProtected());
-+    EndRedo();
- }
- 
--void __EXPORT ScUndoProtect::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoDocProtect::Repeat(SfxRepeatTarget& /* rTarget */)
- {
--	//	gippsnich
-+    //  gippsnich
- }
- 
--BOOL __EXPORT ScUndoProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoDocProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
--	return FALSE;		// gippsnich
-+    return FALSE;       // gippsnich
- }
- 
--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;
--	else
--		nId = bProtect ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
--	return ScGlobal::GetRscString( nId );
-+    USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_DOC : STR_UNDO_UNPROTECT_DOC;
-+    return ScGlobal::GetRscString( nId );
-+}
-+
-+// ============================================================================
-+
-+ScUndoTabProtect::ScUndoTabProtect(ScDocShell* pShell, SCTAB nTab, auto_ptr<ScTableProtection> pProtectSettings) :
-+    ScSimpleUndo(pShell),
-+    mnTab(nTab),
-+    mpProtectSettings(pProtectSettings)
-+{
-+}
-+
-+ScUndoTabProtect::~ScUndoTabProtect()
-+{
-+}
-+
-+void ScUndoTabProtect::DoProtect(bool bProtect)
-+{
-+    ScDocument* pDoc = pDocShell->GetDocument();
-+
-+    if (bProtect)
-+    {
-+        // set protection.
-+        auto_ptr<ScTableProtection> pCopy(new ScTableProtection(*mpProtectSettings));
-+        pCopy->setProtected(true);
-+        pDoc->SetTabProtection(mnTab, pCopy.get());
-+    }
-+    else
-+    {
-+        // remove protection.
-+        pDoc->SetTabProtection(mnTab, NULL);
-+    }
-+
-+    ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell();
-+    if (pViewShell)
-+    {
-+        pViewShell->UpdateLayerLocks();
-+        pViewShell->UpdateInputHandler(TRUE);   // damit sofort wieder eingegeben werden kann
-+    }
-+
-+    pDocShell->PostPaintGridAll();
-+}
-+
-+void ScUndoTabProtect::Undo()
-+{
-+    BeginUndo();
-+    DoProtect(!mpProtectSettings->isProtected());
-+    EndUndo();
-+}
-+
-+void ScUndoTabProtect::Redo()
-+{
-+    BeginRedo();
-+    DoProtect(mpProtectSettings->isProtected());
-+    EndRedo();
-+}
-+
-+void ScUndoTabProtect::Repeat(SfxRepeatTarget& /* rTarget */)
-+{
-+    //  gippsnich
-+}
-+
-+BOOL ScUndoTabProtect::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+{
-+    return FALSE;       // gippsnich
-+}
-+
-+String ScUndoTabProtect::GetComment() const
-+{
-+    USHORT nId = mpProtectSettings->isProtected() ? STR_UNDO_PROTECT_TAB : STR_UNDO_UNPROTECT_TAB;
-+    return ScGlobal::GetRscString( nId );
- }
- 
- // -----------------------------------------------------------------------
-@@ -1274,7 +1333,7 @@ ScUndoPrintRange::ScUndoPrintRange( ScDo
- {
- }
- 
--__EXPORT ScUndoPrintRange::~ScUndoPrintRange()
-+ScUndoPrintRange::~ScUndoPrintRange()
- {
- 	delete pOldRanges;
- 	delete pNewRanges;
-@@ -1297,31 +1356,31 @@ void ScUndoPrintRange::DoChange(BOOL bUn
- 	pDocShell->PostPaint( ScRange(0,0,nTab,MAXCOL,MAXROW,nTab), PAINT_GRID );
- }
- 
--void __EXPORT ScUndoPrintRange::Undo()
-+void ScUndoPrintRange::Undo()
- {
- 	BeginUndo();
- 	DoChange( TRUE );
- 	EndUndo();
- }
- 
--void __EXPORT ScUndoPrintRange::Redo()
-+void ScUndoPrintRange::Redo()
- {
- 	BeginRedo();
- 	DoChange( FALSE );
- 	EndRedo();
- }
- 
--void __EXPORT ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoPrintRange::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 	//	gippsnich
- }
- 
--BOOL __EXPORT ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoPrintRange::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;		// gippsnich
- }
- 
--String __EXPORT ScUndoPrintRange::GetComment() const
-+String ScUndoPrintRange::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_PRINTRANGES );
- }
-@@ -1350,16 +1409,16 @@ ScUndoScenarioFlags::ScUndoScenarioFlags
- {
- }
- 
--__EXPORT ScUndoScenarioFlags::~ScUndoScenarioFlags()
-+ScUndoScenarioFlags::~ScUndoScenarioFlags()
- {
- }
- 
--String __EXPORT ScUndoScenarioFlags::GetComment() const
-+String ScUndoScenarioFlags::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_EDITSCENARIO );
- }
- 
--void __EXPORT ScUndoScenarioFlags::Undo()
-+void ScUndoScenarioFlags::Undo()
- {
- 	ScDocument* pDoc = pDocShell->GetDocument();
- 
-@@ -1376,7 +1435,7 @@ void __EXPORT ScUndoScenarioFlags::Undo(
- 		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- }
- 
--void __EXPORT ScUndoScenarioFlags::Redo()
-+void ScUndoScenarioFlags::Redo()
- {
- 	ScDocument* pDoc = pDocShell->GetDocument();
- 
-@@ -1393,12 +1452,12 @@ void __EXPORT ScUndoScenarioFlags::Redo(
- 		SFX_APP()->Broadcast( SfxSimpleHint( SC_HINT_TABLES_CHANGED ) );
- }
- 
--void __EXPORT ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoScenarioFlags::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- 	//	Repeat macht keinen Sinn
- }
- 
--BOOL __EXPORT ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
-+BOOL ScUndoScenarioFlags::CanRepeat(SfxRepeatTarget& /* rTarget */) const
- {
- 	return FALSE;
- }
-@@ -1498,7 +1557,7 @@ ScUndoLayoutRTL::ScUndoLayoutRTL( ScDocS
- {
- }
- 
--__EXPORT ScUndoLayoutRTL::~ScUndoLayoutRTL()
-+ScUndoLayoutRTL::~ScUndoLayoutRTL()
- {
- }
- 
-@@ -1518,29 +1577,29 @@ void ScUndoLayoutRTL::DoChange( BOOL bNe
- 	pDocShell->SetInUndo( FALSE );
- }
- 
--void __EXPORT ScUndoLayoutRTL::Undo()
-+void ScUndoLayoutRTL::Undo()
- {
- 	DoChange(!bRTL);
- }
- 
--void __EXPORT ScUndoLayoutRTL::Redo()
-+void ScUndoLayoutRTL::Redo()
- {
- 	DoChange(bRTL);
- }
- 
--void __EXPORT ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
-+void ScUndoLayoutRTL::Repeat(SfxRepeatTarget& rTarget)
- {
- 	if (rTarget.ISA(ScTabViewTarget))
- 		((ScTabViewTarget&)rTarget).GetViewShell()->GetViewData()->GetDispatcher().
- 			Execute( FID_TAB_RTL, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD);
- }
- 
--BOOL __EXPORT ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoLayoutRTL::CanRepeat(SfxRepeatTarget& rTarget) const
- {
- 	return (rTarget.ISA(ScTabViewTarget));
- }
- 
--String __EXPORT ScUndoLayoutRTL::GetComment() const
-+String ScUndoLayoutRTL::GetComment() const
- {
- 	return ScGlobal::GetRscString( STR_UNDO_TAB_RTL );
- }
-@@ -1560,7 +1619,7 @@ ScUndoSetGrammar::ScUndoSetGrammar( ScDo
-     meOldGrammar = pDocShell->GetDocument()->GetGrammar();
- }
- 
--__EXPORT ScUndoSetGrammar::~ScUndoSetGrammar()
-+ScUndoSetGrammar::~ScUndoSetGrammar()
- {
- }
- 
-@@ -1573,17 +1632,17 @@ void ScUndoSetGrammar::DoChange( formula
-     pDocShell->SetInUndo( FALSE );
- }
- 
--void __EXPORT ScUndoSetGrammar::Undo()
-+void ScUndoSetGrammar::Undo()
- {
-     DoChange( meOldGrammar );
- }
- 
--void __EXPORT ScUndoSetGrammar::Redo()
-+void ScUndoSetGrammar::Redo()
- {
-     DoChange( meNewGrammar );
- }
- 
--void __EXPORT ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
-+void ScUndoSetGrammar::Repeat(SfxRepeatTarget& /* rTarget */)
- {
- #if 0
- // erAck: 2006-09-07T23:00+0200  commented out in CWS scr1c1
-@@ -1593,12 +1652,12 @@ void __EXPORT ScUndoSetGrammar::Repeat(S
- #endif
- }
- 
--BOOL __EXPORT ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
-+BOOL ScUndoSetGrammar::CanRepeat(SfxRepeatTarget& rTarget) const
- {
-     return (rTarget.ISA(ScTabViewTarget));
- }
- 
--String __EXPORT ScUndoSetGrammar::GetComment() const
-+String ScUndoSetGrammar::GetComment() const
- {
-     return ScGlobal::GetRscString( STR_UNDO_TAB_R1C1 );
- }
---- sc/source/ui/unoobj/warnpassword.cxx.old	2009-04-02 10:45:26.000000000 +0000
-+++ sc/source/ui/unoobj/warnpassword.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -95,3 +95,4 @@ bool ScWarnPassword::WarningOnPassword(
-     }
-     return bReturn;
- }
-+
---- sc/source/ui/view/gridwin.cxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/ui/view/gridwin.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -118,6 +118,7 @@
- #include "userdat.hxx"
- #include "drwlayer.hxx"
- #include "attrib.hxx"
-+#include "tabprotection.hxx"
- 
- // #114409#
- #include <vcl/salbtype.hxx>		// FRound
-@@ -1990,8 +1991,9 @@ void __EXPORT ScGridWindow::MouseButtonU
- 		Point aPos = rMEvt.GetPosPixel();
-         SCsCOL nPosX;
-         SCsROW nPosY;
-+        SCTAB nTab = pViewData->GetTabNo();
-         pViewData->GetPosFromPixel( aPos.X(), aPos.Y(), eWhich, nPosX, nPosY );
--		ScDPObject*	pDPObj	= pDoc->GetDPAtCursor( nPosX, nPosY, pViewData->GetTabNo() );
-+		ScDPObject*	pDPObj	= pDoc->GetDPAtCursor( nPosX, nPosY, nTab );
- 		if ( pDPObj && pDPObj->GetSaveData()->GetDrillDown() )
- 		{
- 			ScAddress aCellPos( nPosX, nPosY, pViewData->GetTabNo() );
-@@ -2033,19 +2035,37 @@ void __EXPORT ScGridWindow::MouseButtonU
- 			return;
- 		}
- 
--		//	edit cell contents
--		pViewData->GetViewShell()->UpdateInputHandler();
--		pScMod->SetInputMode( SC_INPUT_TABLE );
--		if (pViewData->HasEditView(eWhich))
--		{
--			//	Text-Cursor gleich an die geklickte Stelle setzen
--			EditView* pEditView = pViewData->GetEditView( eWhich );
--			MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
--			pEditView->MouseButtonDown( aEditEvt );
--			pEditView->MouseButtonUp( aEditEvt );
--		}
-+        // Check for cell protection attribute.
-+        ScTableProtection* pProtect = pDoc->GetTabProtection( nTab );
-+        bool bEditAllowed = true;
-+        if ( pProtect && pProtect->isProtected() )
-+        {
-+            bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
-+            bool bSkipProtected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
-+            bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
-+
-+            if ( bSkipProtected && bSkipUnprotected )
-+                bEditAllowed = false;
-+            else if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
-+                bEditAllowed = false;
-+        }
-+
-+        if ( bEditAllowed )
-+        {
-+            //  edit cell contents
-+            pViewData->GetViewShell()->UpdateInputHandler();
-+            pScMod->SetInputMode( SC_INPUT_TABLE );
-+            if (pViewData->HasEditView(eWhich))
-+            {
-+                //  Text-Cursor gleich an die geklickte Stelle setzen
-+                EditView* pEditView = pViewData->GetEditView( eWhich );
-+                MouseEvent aEditEvt( rMEvt.GetPosPixel(), 1, MOUSE_SYNTHETIC, MOUSE_LEFT, 0 );
-+                pEditView->MouseButtonDown( aEditEvt );
-+                pEditView->MouseButtonUp( aEditEvt );
-+            }
-+        }
-         return;
--	}
-+    }
- 
- 			//
- 			//		Links in edit cells
---- sc/source/ui/view/scextopt.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/scextopt.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -42,9 +42,7 @@ ScExtDocSettings::ScExtDocSettings() :
-     maOleSize( ScAddress::INITIALIZE_INVALID ),
-     mfTabBarWidth( -1.0 ),
-     mnLinkCnt( 0 ),
--    mnDisplTab( 0 ),
--    mbWinProtected( false ),
--    mbEncrypted( false )
-+    mnDisplTab( 0 )
- {
- }
- 
---- sc/source/ui/view/select.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/select.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -47,6 +47,7 @@
- //#include "dataobj.hxx"
- #include "transobj.hxx"
- #include "docsh.hxx"
-+#include "tabprotection.hxx"
- 
- extern USHORT nScFillModeMouseModifier;				// global.cxx
- 
-@@ -322,6 +323,26 @@ BOOL ScViewFunctionSet::SetCursorAtCell(
- {
- 	ScTabView* pView = pViewData->GetView();
- 	SCTAB nTab = pViewData->GetTabNo();
-+    ScDocument* pDoc = pViewData->GetDocument();
-+
-+    if ( pDoc->IsTabProtected(nTab) )
-+    {
-+        if (nPosX < 0 || nPosY < 0)
-+            return false;
-+
-+        ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+        bool bSkipProtected   = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
-+        bool bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
-+
-+        if ( bSkipProtected && bSkipUnprotected )
-+            return FALSE;
-+
-+        bool bCellProtected = pDoc->HasAttrib(nPosX, nPosY, nTab, nPosX, nPosY, nTab, HASATTR_PROTECTED);
-+        if ( (bCellProtected && bSkipProtected) || (!bCellProtected && bSkipUnprotected) )
-+            // Don't select this cell!
-+            return FALSE;
-+    }
-+
- 	ScModule* pScMod = SC_MOD();
-     ScTabViewShell* pViewShell = pViewData->GetViewShell();
-     bool bRefMode = ( pViewShell ? pViewShell->IsRefInputMode() : false );
-@@ -375,7 +396,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell(
- 
- 		ScRange aDelRange;
- 		BOOL bOldDelMark = pViewData->GetDelMark( aDelRange );
--		ScDocument* pDoc = pViewData->GetDocument();
- 
- 		if ( nPosX+1 >= (SCsCOL) nStartX && nPosX <= (SCsCOL) nEndX &&
- 			 nPosY+1 >= (SCsROW) nStartY && nPosY <= (SCsROW) nEndY &&
-@@ -511,7 +531,6 @@ BOOL ScViewFunctionSet::SetCursorAtCell(
- 		BYTE nMode = pViewData->GetFillMode();
- 		if ( nMode == SC_FILL_EMBED_LT || nMode == SC_FILL_EMBED_RB )
- 		{
--			ScDocument* pDoc = pViewData->GetDocument();
- 			DBG_ASSERT( pDoc->IsEmbedded(), "!pDoc->IsEmbedded()" );
-             ScRange aRange;
- 			pDoc->GetEmbedded( aRange);
---- sc/source/ui/view/tabview3.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/tabview3.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -79,6 +79,7 @@
- #include "AccessibilityHints.hxx"
- #include "rangeutl.hxx"
- #include "client.hxx"
-+#include "tabprotection.hxx"
- 
- #include <com/sun/star/chart2/data/HighlightedRange.hpp>
- 
-@@ -946,6 +947,17 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 	ScDocument* pDoc = aViewData.GetDocument();
- 	SCTAB nTab = aViewData.GetTabNo();
- 
-+    bool bSkipProtected = false, bSkipUnprotected = false;
-+    ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+    if ( pProtect && pProtect->isProtected() )
-+    {
-+        bSkipProtected   = !pProtect->isOptionEnabled(ScTableProtection::SELECT_LOCKED_CELLS);
-+        bSkipUnprotected = !pProtect->isOptionEnabled(ScTableProtection::SELECT_UNLOCKED_CELLS);
-+    }
-+
-+    if ( bSkipProtected && bSkipUnprotected )
-+        return;
-+
- 	SCsCOL nOldX;
- 	SCsROW nOldY;
- 	SCsCOL nCurX;
-@@ -965,7 +977,7 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 		nCurY = (nMovY != 0) ? nOldY+nMovY : (SCsROW) aViewData.GetOldCurY();
- 	}
- 
--	BOOL bHidden;
-+	BOOL bSkipCell = FALSE;
- 	aViewData.ResetOldCursor();
- 
- 	if (nMovX != 0 && VALIDCOLROW(nCurX,nCurY))
-@@ -974,15 +986,20 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 		do
- 		{
- 			BYTE nColFlags = pDoc->GetColFlags( nCurX, nTab );
--			bHidden = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
--			if (bHidden)
-+            bSkipCell = (nColFlags & CR_HIDDEN) || pDoc->IsHorOverlapped( nCurX, nCurY, nTab );
-+            if (bSkipProtected && !bSkipCell)
-+                bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
-+            if (bSkipUnprotected && !bSkipCell)
-+                bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
-+
-+			if (bSkipCell)
- 			{
- 				if ( nCurX<=0 || nCurX>=MAXCOL )
- 				{
- 					if (bHFlip)
- 					{
- 						nCurX = nOldX;
--						bHidden = FALSE;
-+						bSkipCell = FALSE;
- 					}
- 					else
- 					{
-@@ -995,7 +1012,8 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 					if (nMovX > 0) ++nCurX; else --nCurX;
- 			}
- 		}
--		while (bHidden);
-+		while (bSkipCell);
-+
- 		if (pDoc->IsVerOverlapped( nCurX, nCurY, nTab ))
- 		{
- 			aViewData.SetOldCursor( nCurX,nCurY );
-@@ -1010,15 +1028,20 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 		do
- 		{
- 			BYTE nRowFlags = pDoc->GetRowFlags( nCurY, nTab );
--			bHidden = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
--			if (bHidden)
-+            bSkipCell = (nRowFlags & CR_HIDDEN) || pDoc->IsVerOverlapped( nCurX, nCurY, nTab );
-+            if (bSkipProtected && !bSkipCell)
-+                bSkipCell = pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
-+            if (bSkipUnprotected && !bSkipCell)
-+                bSkipCell = !pDoc->HasAttrib(nCurX, nCurY, nTab, nCurX, nCurY, nTab, HASATTR_PROTECTED);
-+
-+			if (bSkipCell)
- 			{
- 				if ( nCurY<=0 || nCurY>=MAXROW )
- 				{
- 					if (bVFlip)
- 					{
- 						nCurY = nOldY;
--						bHidden = FALSE;
-+						bSkipCell = FALSE;
- 					}
- 					else
- 					{
-@@ -1031,7 +1054,8 @@ void ScTabView::MoveCursorRel( SCsCOL nM
- 					if (nMovY > 0) ++nCurY; else --nCurY;
- 			}
- 		}
--		while (bHidden);
-+		while (bSkipCell);
-+
- 		if (pDoc->IsHorOverlapped( nCurX, nCurY, nTab ))
- 		{
- 			aViewData.SetOldCursor( nCurX,nCurY );
---- sc/source/ui/view/tabvwsh3.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/tabvwsh3.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -75,6 +75,8 @@
- #include "autofmt.hxx"
- #include "dwfunctr.hxx"
- #include "shtabdlg.hxx"
-+#include "tabprotection.hxx"
-+#include "protectiondlg.hxx"
- 
- #include <svtools/ilstitem.hxx>
- #define _SVSTDARR_ULONGS
-@@ -85,6 +87,10 @@
- #include <svx/dialogs.hrc> //CHINA001
- #include "scabstdlg.hxx" //CHINA001
- 
-+#include <memory>
-+
-+using ::std::auto_ptr;
-+
- #define IS_EDITMODE() GetViewData()->HasEditView( GetViewData()->GetActivePart() )
- #define IS_AVAILABLE(WhichId,ppItem) \
-     (pReqArgs->GetItemState((WhichId), TRUE, ppItem ) == SFX_ITEM_SET)
-@@ -1002,12 +1008,13 @@ void ScTabViewShell::Execute( SfxRequest
-                     }
-                 }
- 
--				if (pDoc->IsDocProtected())
-+                ScDocProtection* pProtect = pDoc->GetDocProtection();
-+                if (pProtect && pProtect->isProtected())
- 				{
- 					BOOL	bCancel = FALSE;
- 					String	aPassword;
- 
--					if (pDoc->GetDocPassword().getLength())
-+                    if (pProtect->isProtectedWithPass())
- 					{
- 						String	aText( ScResId(SCSTR_PASSWORD) );
- 
-@@ -1057,89 +1064,164 @@ void ScTabViewShell::Execute( SfxRequest
- 
- 
- 		case FID_PROTECT_TABLE:
--			{
--				ScDocument* 		pDoc = GetViewData()->GetDocument();
--				SCTAB				nTab = GetViewData()->GetTabNo();
--				SfxPasswordDialog*	pDlg;
--				String				aPassword;
--				BOOL				bCancel = FALSE;
--				BOOL				bOldProtection = pDoc->IsTabProtected(nTab);
--				BOOL				bNewProtection = ! bOldProtection;
-+        {
-+            ScDocument* pDoc = GetViewData()->GetDocument();
-+            SCTAB		nTab = GetViewData()->GetTabNo();
-+            bool        bOldProtection = pDoc->IsTabProtected(nTab);
- 
--				if( pReqArgs )
--				{
--					const SfxPoolItem* pItem;
--					if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
--						bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
--                    if( bNewProtection == bOldProtection )
-+#if ENABLE_SHEET_PROTECTION
-+
-+            if( pReqArgs )
-+            {
-+                const SfxPoolItem* pItem;
-+                bool bNewProtection = !bOldProtection;
-+                if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
-+                    bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
-+                if( bNewProtection == bOldProtection )
-+                {
-+                    rReq.Ignore();
-+                    break;
-+                }
-+            }
-+
-+            if (bOldProtection)
-+            {
-+                // Unprotect a protected sheet.
-+
-+                ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+                if (pProtect && pProtect->isProtectedWithPass())
-+                {
-+                    String aText( ScResId(SCSTR_PASSWORDOPT) );
-+                    auto_ptr<SfxPasswordDialog> pDlg(new SfxPasswordDialog(GetDialogParent(), &aText));
-+                    pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
-+                    pDlg->SetMinLen( 0 );
-+                    pDlg->SetHelpId( FID_PROTECT_TABLE );
-+                    pDlg->SetEditHelpId( HID_PASSWD_TABLE );
-+
-+                    if (pDlg->Execute() == RET_OK)
-                     {
--                        rReq.Ignore();
--                        break;
-+                        String aPassword = pDlg->GetPassword();
-+                        Unprotect(nTab, aPassword);
-                     }
-                 }
-+                else
-+                    // this sheet is not password-protected.
-+                    Unprotect(nTab, String());
- 
--                    if ( bOldProtection)
--                    {
--                        if (pDoc->GetTabPassword(nTab).getLength())
--                        {
--                            String  aText( ScResId(SCSTR_PASSWORD) );
-+                if (!pReqArgs)
-+                {
-+                    rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
-+                    rReq.Done();
-+                }
-+            }
-+            else
-+            {
-+                // Protect a current sheet.
- 
--                            pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
--                            pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
--                            pDlg->SetMinLen( 0 );
--                            pDlg->SetHelpId( FID_PROTECT_TABLE );
--                            pDlg->SetEditHelpId( HID_PASSWD_TABLE );
--
--                            if (pDlg->Execute() == RET_OK)
--                                aPassword = pDlg->GetPassword();
--                            else
--                                bCancel = TRUE;
-+                auto_ptr<ScTableProtectionDlg> pDlg(new ScTableProtectionDlg(GetDialogParent()));
- 
--                            delete pDlg;
--                        }
-+                ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+                if (pProtect)
-+                    pDlg->SetDialogData(*pProtect);
-+
-+                if (pDlg->Execute() == RET_OK)
-+                {
-+                    pScMod->InputEnterHandler();
-+
-+                    ScTableProtection aNewProtect;
-+                    pDlg->WriteData(aNewProtect);
-+                    ProtectSheet(nTab, aNewProtect);
-+                    if (!pReqArgs)
-+                    {
-+                        rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, true) );
-+                        rReq.Done();
-                     }
-+                }
-+            }
-+#else
-+            auto_ptr<SfxPasswordDialog> pDlg;
-+            String				aPassword;
-+            BOOL				bCancel = FALSE;
-+            BOOL				bNewProtection = ! bOldProtection;
-+
-+            if( pReqArgs )
-+            {
-+                const SfxPoolItem* pItem;
-+                if( IS_AVAILABLE( FID_PROTECT_TABLE, &pItem ) )
-+                    bNewProtection = ((const SfxBoolItem*)pItem)->GetValue();
-+                if( bNewProtection == bOldProtection )
-+                {
-+                    rReq.Ignore();
-+                    break;
-+                }
-+            }
-+
-+            if ( bOldProtection)
-+            {
-+                // Unprotect a protected sheet.
-+
-+                ScTableProtection* pProtect = pDoc->GetTabProtection(nTab);
-+                if (pProtect && pProtect->isProtectedWithPass())
-+                {
-+                    String aText( ScResId(SCSTR_PASSWORDOPT) );
-+                    pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
-+                    pDlg->SetText( ScResId(SCSTR_UNPROTECTTAB) );
-+                    pDlg->SetMinLen( 0 );
-+                    pDlg->SetHelpId( FID_PROTECT_TABLE );
-+                    pDlg->SetEditHelpId( HID_PASSWD_TABLE );
-+
-+                    if (pDlg->Execute() == RET_OK)
-+                        aPassword = pDlg->GetPassword();
-                     else
--                    {
--                        String aText( ScResId(SCSTR_PASSWORDOPT) );
-+                        bCancel = TRUE;
-+                }
- 
--                        pDlg = new SfxPasswordDialog( GetDialogParent(), &aText );
--                        pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
--                        pDlg->SetMinLen( 0 );
--                        pDlg->SetHelpId( FID_PROTECT_TABLE );
--                        pDlg->SetEditHelpId( HID_PASSWD_TABLE );
--                        pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
--
--                        if (pDlg->Execute() == RET_OK)
--                            aPassword = pDlg->GetPassword();
--                        else
--                            bCancel = TRUE;
-+                if (!pReqArgs)
-+                {
-+                    rReq.AppendItem( SfxBoolItem(FID_PROTECT_TABLE, false) );
-+                    rReq.Done();
-+                }
-+            }
-+            else
-+            {
-+                String aText( ScResId(SCSTR_PASSWORDOPT) );
- 
--                        delete pDlg;
--                    }
-+                pDlg.reset(new SfxPasswordDialog(GetDialogParent(), &aText));
-+                pDlg->SetText( ScResId(SCSTR_PROTECTTAB) );
-+                pDlg->SetMinLen( 0 );
-+                pDlg->SetHelpId( FID_PROTECT_TABLE );
-+                pDlg->SetEditHelpId( HID_PASSWD_TABLE );
-+                pDlg->ShowExtras( SHOWEXTRAS_CONFIRM );
- 
--                if( !bCancel )
--				{
--                    if ( bOldProtection )
--						Unprotect( nTab, aPassword );
--					else
--                    {
--                        pScMod->InputEnterHandler();
-+                if (pDlg->Execute() == RET_OK)
-+                    aPassword = pDlg->GetPassword();
-+                else
-+                    bCancel = TRUE;
-+            }
- 
--						Protect( nTab, aPassword );
--                    }
-+            if( !bCancel )
-+            {
-+                if ( bOldProtection )
-+                    Unprotect( nTab, aPassword );
-+                else
-+                {
-+                    pScMod->InputEnterHandler();
- 
--                    if( !pReqArgs )
--					{
--						rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
--						rReq.Done();
--					}
--				}
-+                    Protect( nTab, aPassword );
-+                }
- 
--				TabChanged();
--				UpdateInputHandler(TRUE);	// damit sofort wieder eingegeben werden kann
--				SelectionChanged();
--			}
--			break;
-+                if( !pReqArgs )
-+                {
-+                    rReq.AppendItem( SfxBoolItem( FID_PROTECT_TABLE, bNewProtection ) );
-+                    rReq.Done();
-+                }
-+            }
-+#endif
-+            TabChanged();
-+            UpdateInputHandler(true);   // damit sofort wieder eingegeben werden kann
-+            SelectionChanged();
-+        }
-+        break;
- 
-         case SID_OPT_LOCALE_CHANGED :
-             {   // locale changed, SYSTEM number formats changed => repaint cell contents
---- sc/source/ui/view/tabvwshh.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/tabvwshh.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -43,6 +43,7 @@
- #include <sfx2/request.hxx>
- #include <basic/sbxcore.hxx>
- #include <svtools/whiter.hxx>
-+#include <vcl/msgbox.hxx>
- 
- #include "tabvwsh.hxx"
- #include "client.hxx"
-@@ -50,6 +51,10 @@
- #include "docsh.hxx"
- #include "sc.hrc"
- #include "drwlayer.hxx"		// GetVisibleName
-+#include "retypepassdlg.hxx"
-+#include "tabprotection.hxx"
-+
-+#include <memory>
- 
- using namespace com::sun::star;
- 
-@@ -270,6 +275,22 @@ BOOL ScTabViewShell::HasAccessibilityObj
- 	return pAccessibilityBroadcaster != NULL;
- }
- 
-+bool ScTabViewShell::ExecuteRetypePassDlg(ScPasswordHash eDesiredHash)
-+{
-+    using ::std::auto_ptr;
-+
-+    ScDocument* pDoc = GetViewData()->GetDocument();
-+
-+    auto_ptr<ScRetypePassDlg> pDlg(new ScRetypePassDlg(GetDialogParent()));
-+    pDlg->SetData(*pDoc);
-+    pDlg->SetDesiredHash(eDesiredHash);
-+    if (pDlg->Execute() != RET_OK)
-+        return false;
-+
-+    pDlg->WriteNewDataToDocument(*pDoc);
-+    return true;
-+}
-+
- 
- 
- 
---- sc/source/ui/view/viewfun2.cxx.old	2009-04-02 10:45:40.000000000 +0000
-+++ sc/source/ui/view/viewfun2.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -2197,7 +2197,7 @@ BOOL ScViewFunc::DeleteTables(const SvSh
- 			pUndoDoc->SetVisible( nTab, pDoc->IsVisible( nTab ) );
- 
- 			if ( pDoc->IsTabProtected( nTab ) )
--				pUndoDoc->SetTabProtection( nTab, TRUE, pDoc->GetTabPassword( nTab ) );
-+                pUndoDoc->SetTabProtection(nTab, pDoc->GetTabProtection(nTab));
- 
- 			//	Drawing-Layer muss sein Undo selbst in der Hand behalten !!!
- 			//		pUndoDoc->TransferDrawPage(pDoc, nTab,nTab);
-@@ -2612,7 +2612,7 @@ void ScViewFunc::MoveTable( USHORT nDest
- 				}
- 
- 				if ( nErrVal > 0 && pDoc->IsTabProtected( TheTabs[i] ) )
--					pDestDoc->SetTabProtection( nDestTab1, TRUE, pDoc->GetTabPassword( TheTabs[i] ) );
-+                    pDestDoc->SetTabProtection(nDestTab1, pDoc->GetTabProtection(TheTabs[i]));
- 
- 				nDestTab1++;
- 			}
---- sc/source/ui/view/viewfunc.cxx.old	2009-04-06 16:41:48.000000000 +0000
-+++ sc/source/ui/view/viewfunc.cxx	2009-04-06 16:41:49.000000000 +0000
-@@ -2582,6 +2582,36 @@ void ScViewFunc::ModifyCellSize( ScDirec
- 	ShowAllCursors();
- }
- 
-+void ScViewFunc::ProtectSheet( SCTAB nTab, const ScTableProtection& rProtect )
-+{
-+    if (nTab == TABLEID_DOC)
-+        return;
-+
-+	ScMarkData& rMark = GetViewData()->GetMarkData();
-+	ScDocShell* pDocSh = GetViewData()->GetDocShell();
-+	ScDocument* pDoc = pDocSh->GetDocument();
-+	ScDocFunc aFunc(*pDocSh);
-+	bool bUndo(pDoc->IsUndoEnabled());
-+
-+    //	modifying several tables is handled here
-+
-+    if (bUndo)
-+    {
-+        String aUndo = ScGlobal::GetRscString( STR_UNDO_PROTECT_TAB );
-+        pDocSh->GetUndoManager()->EnterListAction( aUndo, aUndo );
-+    }
-+
-+    SCTAB nCount = pDocSh->GetDocument()->GetTableCount();
-+    for ( SCTAB i=0; i<nCount; i++ )
-+        if ( rMark.GetTableSelect(i) )
-+            aFunc.ProtectSheet(i, rProtect);
-+
-+    if (bUndo)
-+        pDocSh->GetUndoManager()->LeaveListAction();
-+
-+	UpdateLayerLocks();			//!	broadcast to all views
-+}
-+
- void ScViewFunc::Protect( SCTAB nTab, const String& rPassword )
- {
- 	ScMarkData& rMark = GetViewData()->GetMarkData();
diff --git a/patches/dev300/cws-scsheetprotection02-sfx2.diff b/patches/dev300/cws-scsheetprotection02-sfx2.diff
deleted file mode 100644
index 39c9fa6..0000000
--- a/patches/dev300/cws-scsheetprotection02-sfx2.diff
+++ /dev/null
@@ -1,74 +0,0 @@
-diff --git sfx2/inc/sfx2/passwd.hxx sfx2/inc/sfx2/passwd.hxx
-index a9b176b..15aeb1f 100644
---- sfx2/inc/sfx2/passwd.hxx
-+++ sfx2/inc/sfx2/passwd.hxx
-@@ -86,6 +86,7 @@ public:
- 	String			GetConfirm() const { return maConfirmED.GetText(); }
- 
- 	void 			SetMinLen( USHORT Len );
-+    void            SetMaxLen( USHORT Len );
- 	void			SetEditHelpId( ULONG nId ) { maPasswordED.SetHelpId( nId ); }
- 	void			ShowExtras( USHORT nExtras ) { mnExtras = nExtras; }
- 
-diff --git sfx2/source/dialog/filedlghelper.cxx sfx2/source/dialog/filedlghelper.cxx
-index 42976cd..37f2426 100644
---- sfx2/source/dialog/filedlghelper.cxx
-+++ sfx2/source/dialog/filedlghelper.cxx
-@@ -559,9 +559,20 @@ struct CheckPasswordCapability
- {
- 	sal_Bool operator() ( const SfxFilter* _pFilter )
- 	{
--        return  _pFilter && _pFilter->IsOwnFormat()
--			&&	_pFilter->UsesStorage()
--			&&	( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
-+        if (!_pFilter)
-+            return false;
-+
-+#if 0 // to be enabled in the future
-+        if (_pFilter->GetFilterName().EqualsAscii("MS Excel 97"))
-+            // For now, we eanble password protection for Excel 97 as a 
-+            // special case.  If we start having more filters supporting
-+            // export encryption with password, we should probably switch to
-+            // using a filter flag instead.
-+            return true;
-+#endif
-+
-+        return _pFilter->IsOwnFormat() && _pFilter->UsesStorage()
-+            && ( SOFFICE_FILEFORMAT_60 <= _pFilter->GetVersion() );
- 	}
- };
- 
-@@ -1617,11 +1628,12 @@ ErrCode FileDialogHelper_Impl::execute( SvStringsDtor*& rpURLList,
- 				sal_Bool bPassWord = sal_False;
- 				if ( ( aValue >>= bPassWord ) && bPassWord )
- 				{
--					// ask for the password
-+					// ask for a password
-                     uno::Reference < ::com::sun::star::task::XInteractionHandler > xInteractionHandler( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.comp.uui.UUIInteractionHandler")), UNO_QUERY );
- 
-                     if( xInteractionHandler.is() )
-                     {
-+                        // TODO: find out a way to set the 1-15 char limits on MS Excel 97 filter.
-                         RequestDocumentPassword* pPasswordRequest = new RequestDocumentPassword(
-                             ::com::sun::star::task::PasswordRequestMode_PASSWORD_CREATE, *(rpURLList->GetObject(0)) );
-  
-diff --git sfx2/source/dialog/passwd.cxx sfx2/source/dialog/passwd.cxx
-index f49467f..062fb9c 100644
---- sfx2/source/dialog/passwd.cxx
-+++ sfx2/source/dialog/passwd.cxx
-@@ -136,6 +136,15 @@ void SfxPasswordDialog::SetMinLen( USHORT nLen )
- 
- // -----------------------------------------------------------------------
- 
-+void SfxPasswordDialog::SetMaxLen( USHORT nLen )
-+{
-+    maPasswordED.SetMaxTextLen( nLen );
-+    maConfirmED.SetMaxTextLen( nLen );
-+	EditModifyHdl( NULL );
-+}
-+
-+// -----------------------------------------------------------------------
-+
- short SfxPasswordDialog::Execute()
- {
- 	if ( mnExtras < SHOWEXTRAS_ALL )
diff --git a/patches/dev300/cws-scsheetprotection02-svx.diff b/patches/dev300/cws-scsheetprotection02-svx.diff
deleted file mode 100644
index 540bb39..0000000
--- a/patches/dev300/cws-scsheetprotection02-svx.diff
+++ /dev/null
@@ -1,261 +0,0 @@
-diff --git svx/inc/mscodec.hxx svx/inc/mscodec.hxx
-index 66dcf5d..be67b46 100644
---- svx/inc/mscodec.hxx
-+++ svx/inc/mscodec.hxx
-@@ -235,6 +235,14 @@ public:
-      */
-     bool                InitCipher( sal_uInt32 nCounter );
- 
-+    /** Creates an MD5 digest of salt digest. */
-+    bool                CreateSaltDigest( 
-+                            const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] );
-+
-+    bool                Encode(
-+                            const void* pData, sal_Size nDatLen,
-+                            sal_uInt8* pBuffer, sal_Size nBufLen );
-+
-     /** Decodes a block of memory.
- 
-         @see rtl_cipher_decode()
-@@ -276,6 +284,9 @@ public:
-     bool                Skip( sal_Size nDatLen );
- 
- private:
-+    void                GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] );
-+
-+private:
-                         SVX_DLLPRIVATE MSCodec_Std97( const MSCodec_Std97& );
-     SVX_DLLPRIVATE MSCodec_Std97&      operator=( const MSCodec_Std97& );
- 
-diff --git svx/source/msfilter/mscodec.cxx svx/source/msfilter/mscodec.cxx
-index 30baed5..d086754 100644
---- svx/source/msfilter/mscodec.cxx
-+++ svx/source/msfilter/mscodec.cxx
-@@ -37,6 +37,13 @@
- #include <string.h>
- #include <tools/solar.h>
- 
-+#define DEBUG_MSO_ENCRYPTION_STD97 0
-+
-+#if DEBUG_MSO_ENCRYPTION_STD97
-+#include <stdio.h>
-+#endif
-+
-+
- namespace svx {
- 
- // ============================================================================
-@@ -241,15 +248,50 @@ MSCodec_Std97::~MSCodec_Std97 ()
-     rtl_cipher_destroy (m_hCipher);
- }
- 
-+#if DEBUG_MSO_ENCRYPTION_STD97    
-+static void lcl_PrintKeyData(const sal_uInt8* pKeyData, const char* msg)
-+{
-+    printf("pKeyData: (%s)\n", msg);
-+    for (int j = 0; j < 4; ++j)
-+    {
-+        for (int i = 0; i < 16; ++i)
-+            printf("%2.2x ", pKeyData[j*16+i]);
-+        printf("\n");
-+    }
-+}
-+#else
-+static void lcl_PrintKeyData(const sal_uInt8* /*pKeyData*/, const char* /*msg*/)
-+{
-+}
-+#endif    
-+
-+#if DEBUG_MSO_ENCRYPTION_STD97    
-+static void lcl_PrintDigest(const sal_uInt8* pDigest, const char* msg)
-+{
-+    printf("digest: (%s)\n", msg);
-+    for (int i = 0; i < 16; ++i)
-+        printf("%2.2x ", pDigest[i]);
-+    printf("\n");
-+}
-+#else
-+static void lcl_PrintDigest(const sal_uInt8* /*pDigest*/, const char* /*msg*/)
-+{
-+}
-+#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;
- 
-     // Fill PassData into KeyData.
-     (void)memset (pKeyData, 0, sizeof(pKeyData));
-+    lcl_PrintKeyData(pKeyData, "initial");
-     for (i = 0, n = 16; (i < n) && pPassData[i]; i++)
-     {
-         pKeyData[2*i    ] = sal::static_int_cast< sal_uInt8 >(
-@@ -260,12 +302,16 @@ void MSCodec_Std97::InitKey (
-     pKeyData[2*i] = 0x80;
-     pKeyData[ 56] = sal::static_int_cast< sal_uInt8 >(i << 4);
- 
-+    lcl_PrintKeyData(pKeyData, "password data");
-+
-     // Fill raw digest of KeyData into KeyData.
-     (void)rtl_digest_updateMD5 (
-         m_hDigest, pKeyData, sizeof(pKeyData));
-     (void)rtl_digest_rawMD5 (
-         m_hDigest, pKeyData, RTL_DIGEST_LENGTH_MD5);
- 
-+    lcl_PrintKeyData(pKeyData, "raw digest of key data");
-+
-     // Update digest with KeyData and Unique.
-     for (i = 0; i < 16; i++)
-     {
-@@ -279,6 +325,8 @@ void MSCodec_Std97::InitKey (
-     pKeyData[56] = 0x80;
-     pKeyData[57] = 0x0a;
- 
-+    lcl_PrintKeyData(pKeyData, "update digest with padding");
-+
-     rtl_digest_updateMD5 (
-         m_hDigest, &(pKeyData[16]), sizeof(pKeyData) - 16);
- 
-@@ -286,6 +334,8 @@ void MSCodec_Std97::InitKey (
-     rtl_digest_rawMD5 (
-         m_hDigest, m_pDigestValue, sizeof(m_pDigestValue));
- 
-+    lcl_PrintDigest(m_pDigestValue, "digest value");
-+
-     // Erase KeyData array and leave.
-     (void)memset (pKeyData, 0, sizeof(pKeyData));
- }
-@@ -294,27 +344,21 @@ bool MSCodec_Std97::VerifyKey (
-     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");
-+    lcl_PrintDigest(pSaltData, "salt data");
-+    lcl_PrintDigest(pSaltDigest, "salt hash");
-+#endif    
-     bool result = false;
- 
-     if (InitCipher(0))
-     {
-         sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
--        sal_uInt8 pBuffer[64];
--
--        // Decode SaltData into Buffer.
--        rtl_cipher_decode (
--            m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
--
--        pBuffer[16] = 0x80;
--        (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
--        pBuffer[56] = 0x80;
--
--        // Fill raw digest of Buffer into Digest.
--        rtl_digest_updateMD5 (
--            m_hDigest, pBuffer, sizeof(pBuffer));
--        rtl_digest_rawMD5 (
--            m_hDigest, pDigest, sizeof(pDigest));
-+        GetDigestFromSalt(pSaltData, pDigest);
- 
-+        sal_uInt8 pBuffer[16];
-         // Decode original SaltDigest into Buffer.
-         rtl_cipher_decode (
-             m_hCipher, pSaltDigest, 16, pBuffer, sizeof(pBuffer));
-@@ -333,7 +377,7 @@ bool MSCodec_Std97::VerifyKey (
- bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
- {
-     rtlCipherError result;
--    sal_uInt8      pKeyData[64];
-+    sal_uInt8      pKeyData[64]; // 512-bit message block
- 
-     // Initialize KeyData array.
-     (void)memset (pKeyData, 0, sizeof(pKeyData));
-@@ -358,7 +402,7 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
- 
-     // Initialize Cipher with KeyData (for decoding).
-     result = rtl_cipher_init (
--        m_hCipher, rtl_Cipher_DirectionDecode,
-+        m_hCipher, rtl_Cipher_DirectionBoth,
-         pKeyData, RTL_DIGEST_LENGTH_MD5, 0, 0);
- 
-     // Erase KeyData array and leave.
-@@ -367,6 +411,38 @@ bool MSCodec_Std97::InitCipher (sal_uInt32 nCounter)
-     return (result == rtl_Cipher_E_None);
- }
- 
-+bool MSCodec_Std97::CreateSaltDigest( const sal_uInt8 nSaltData[16], sal_uInt8 nSaltDigest[16] )
-+{
-+#if DEBUG_MSO_ENCRYPTION_STD97
-+    lcl_PrintDigest(pSaltData, "salt data");
-+#endif    
-+    bool result = false;
-+
-+    if (InitCipher(0))
-+    {
-+        sal_uInt8 pDigest[RTL_DIGEST_LENGTH_MD5];
-+        GetDigestFromSalt(nSaltData, pDigest);
-+
-+        rtl_cipher_decode (
-+            m_hCipher, pDigest, 16, pDigest, sizeof(pDigest));
-+
-+        (void)memcpy(nSaltDigest, pDigest, 16);
-+    }
-+
-+    return (result);
-+}
-+
-+bool MSCodec_Std97::Encode(
-+    const void *pData,   sal_Size nDatLen,
-+    sal_uInt8  *pBuffer, sal_Size nBufLen)
-+{
-+    rtlCipherError result;
-+    result = rtl_cipher_encode (
-+        m_hCipher, pData, nDatLen, pBuffer, nBufLen);
-+
-+    return (result == rtl_Cipher_E_None);
-+}
-+
- bool MSCodec_Std97::Decode (
-     const void *pData,   sal_Size nDatLen,
-     sal_uInt8  *pBuffer, sal_Size nBufLen)
-@@ -395,6 +471,33 @@ bool MSCodec_Std97::Skip( sal_Size nDatLen )
-     return bResult;
- }
- 
-+void MSCodec_Std97::GetDigestFromSalt( const sal_uInt8 pSaltData[16], sal_uInt8 pDigest[16] )
-+{
-+    sal_uInt8 pBuffer[64];
-+    sal_uInt8 pDigestLocal[16];
-+
-+    // Decode SaltData into Buffer.
-+    rtl_cipher_decode (
-+        m_hCipher, pSaltData, 16, pBuffer, sizeof(pBuffer));
-+
-+    // set the 129th bit to make the buffer 128-bit in length.
-+    pBuffer[16] = 0x80;
-+
-+    // erase the rest of the buffer with zeros.
-+    (void)memset (pBuffer + 17, 0, sizeof(pBuffer) - 17);
-+
-+    // set the 441st bit.
-+    pBuffer[56] = 0x80;
-+
-+    // Fill raw digest of Buffer into Digest.
-+    rtl_digest_updateMD5 (
-+        m_hDigest, pBuffer, sizeof(pBuffer));
-+    rtl_digest_rawMD5 (
-+        m_hDigest, pDigestLocal, sizeof(pDigestLocal));
-+
-+    memcpy(pDigest, pDigestLocal, 16);
-+}
-+
- // ============================================================================
- 
- } // namespace svx
diff --git a/patches/dev300/cws-sdk311.diff b/patches/dev300/cws-sdk311.diff
deleted file mode 100644
index 198263f..0000000
--- a/patches/dev300/cws-sdk311.diff
+++ /dev/null
@@ -1,187 +0,0 @@
-Index: odk/setsdkenv_unix.sh.in
-===================================================================
---- odk/setsdkenv_unix.sh.in	(.../tags/OOO310_m12)	(Revision 272420)
-+++ odk/setsdkenv_unix.sh.in	(.../cws/sdk311)	(Revision 272420)
-@@ -122,7 +122,7 @@
- # Prepare appropriate output directory.
- if [ -n "${OO_SDK_OUTPUT_DIR}" ]
- then
--    OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/$OO_SDK_NAME
-+    OO_SDK_OUT=${OO_SDK_OUTPUT_DIR}/${OO_SDK_NAME}
-     export OO_SDK_OUT
- fi
- 
-@@ -278,37 +278,44 @@
-     export STLDEBUG
- fi
- 
--# For URE, prepare symbolic links for libraries:
--rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
--
--if [ -L "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
-+if [ "${platform}" = "MacOSX" ]
- then
--    rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
--fi
-+#    For URE, prepare symbolic links for libraries:
-+#    Only necessary on MacOSX, on other Unix systems the links are already prepared
-+#    in the SDK installation.
- 
-+#    cleanup potential old links first
-+    rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
- 
--if [ "${OO_SDK_URE_HOME}" ]
--then
--    mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
-+    if [ -L "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
-+    then
-+	rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+    fi
- 
--    if [ -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
-+#    prepare links 
-+    if [ "${OO_SDK_URE_HOME}" ]
-     then
--	ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
--	    "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+	mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
-+
-+	if [ -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ]
-+	then
-+	    ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
-+		"${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+	fi
-     fi
-+fi 
- 
--fi
- 
- # Prepare shell with all necessary environment variables.
- echo 
-Index: odk/setsdkenv_unix.csh.in
-===================================================================
---- odk/setsdkenv_unix.csh.in	(.../tags/OOO310_m12)	(Revision 272420)
-+++ odk/setsdkenv_unix.csh.in	(.../cws/sdk311)	(Revision 272420)
-@@ -237,34 +237,40 @@
- endif
- 
- 
--# For URE, prepare symbolic links for libraries:
--rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
--    "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
-+if [ "${platform}" == "MacOSX" ] then
-+#    For URE, prepare symbolic links for libraries:
-+#    Only necessary on MacOSX, on other Unix systems the links are already prepared
-+#    in the SDK installation.
- 
--if ( -e "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
--    rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
--endif
-+#    cleanup potential old links first
-+    rm -f "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.so" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}" \
-+	"${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
- 
--if ( "${OO_SDK_URE_HOME}" != "" ) then
--    mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
--    ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
--        "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
-+    if ( -e "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
-+	rm -rf "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+    endif
- 
--    if ( -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
--	ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
--	    "${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+    if ( "${OO_SDK_URE_HOME}" != "" ) then
-+	mkdir -p "${OO_SDK_OUT}/${directoryname}/lib"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppu.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppu.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_cppuhelper${comid}.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_cppuhelper${comid}.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_sal.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_sal.${soext}"
-+	ln -s "${OO_SDK_URE_LIB_DIR}/libuno_salhelper${comid}.${soext}.3" \
-+	    "${OO_SDK_OUT}/${directoryname}/lib/libuno_salhelper${comid}.${soext}"
-+
-+	if ( -r "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" ) then
-+	    ln -s "${OO_SDK_URE_LIB_DIR}/libstlport_${pltfrm}${STLDEBUG}.${soext}" \
-+		"${OO_SDK_OUT}/${directoryname}/lib/libstlport_${pltfrm}${STLDEBUG}.${soext}"
-+	endif
-     endif
--
- endif
- 
-+ 
- echo 
- echo " ************************************************************************"
- echo " *"                                                  
-Index: odk/settings/settings.mk
-===================================================================
---- odk/settings/settings.mk	(.../tags/OOO310_m12)	(Revision 272420)
-+++ odk/settings/settings.mk	(.../cws/sdk311)	(Revision 272420)
-@@ -216,7 +216,7 @@
- COMP_LINK_FLAGS=$(LIBRARY_LINK_FLAGS) -M $(PRJ)/settings/component.uno.map
- 
- EXE_LINK_FLAGS=-w -mt -z combreloc -PIC -temp=/tmp -norunpath -Bdirect -z defs
--LINK_LIBS=-L$(OUT)/lib -L$(OO_SDK_OUT)/$(PLATFORM)/lib -L"$(OO_SDK_URE_LIB_DIR)"
-+LINK_LIBS=-L"$(OUT)/lib" -L"$(OO_SDK_HOME)/lib" -L"$(OO_SDK_URE_LIB_DIR)"
- LINK_JAVA_LIBS=-L"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
- 
- ifeq "$(PROCTYPE)" "sparc64"
-@@ -362,7 +362,7 @@
- 
- #EXE_LINK_FLAGS=-Wl,--allow-shlib-undefined -Wl,-export-dynamic -Wl,-z,defs -Wl,--whole-archive -lsalcpprt -Wl,--no-whole-archive
- EXE_LINK_FLAGS=-Wl,--allow-shlib-undefined -Wl,-export-dynamic -Wl,-z,defs -Wl,--no-whole-archive
--LINK_LIBS=-L$(OUT)/lib -L$(OO_SDK_OUT)/$(PLATFORM)/lib -L"$(OO_SDK_URE_LIB_DIR)"
-+LINK_LIBS=-L"$(OUT)/lib" -L"$(OO_SDK_HOME)/lib" -L"$(OO_SDK_URE_LIB_DIR)"
- LINK_JAVA_LIBS=-L"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
- 
- ifneq "$(OO_SDK_URE_HOME)" ""
-@@ -570,7 +570,7 @@
- 
- EXE_LINK_FLAGS=-Wl,--allow-shlib-undefined 
- #EXE_LINK_FLAGS+=-Wl,-export-dynamic -Wl,-z,defs
--LINK_LIBS=-L$(OUT)/lib -L$(OO_SDK_OUT)/$(PLATFORM)/lib -L"$(OO_SDK_URE_LIB_DIR)" $(PTHREAD_LIBS)
-+LINK_LIBS=-L"$(OUT)/lib" -L"$(OO_SDK_HOME)/lib" -L"$(OO_SDK_URE_LIB_DIR)" $(PTHREAD_LIBS)
- LINK_JAVA_LIBS=-L"$(OO_SDK_JAVA_HOME)/jre/lib/$(JAVA_PROC_TYPE)"
- 
- ifneq "$(OO_SDK_URE_HOME)" ""
-
-Eigenschaftsänderungen: .
-___________________________________________________________________
-Hinzugefügt: svn:mergeinfo
-   Zusammengeführt /branches/OOO310:r271209-272259
-   Zusammengeführt /tags/OOO310_m12:r272260-272335
-
commit 0ad101e351f6c26643db19dec2c8620cb47c1245
Author: Rene Engelhard <rene at debian.org>
Date:   Fri Aug 7 12:06:04 2009 +0200

    bump OOO_MAJOR and OOO_VERSION for 3.2

diff --git a/configure.in b/configure.in
index 95b0165..a563b06 100644
--- a/configure.in
+++ b/configure.in
@@ -1050,8 +1050,8 @@ AC_MSG_RESULT([$DRINK])
 AC_SUBST(DRINK)
 
 AC_MSG_CHECKING([for ooo-version])
-OOO_MAJOR=3.1
-OOO_VERSION=3.1
+OOO_MAJOR=3.2
+OOO_VERSION=3.2
 AC_MSG_RESULT([$OOO_VERSION])
 AC_SUBST(OOO_VERSION)
 


More information about the ooo-build-commit mailing list