diff -pur sc.orig/source/ui/docshell/docsh.cxx sc/source/ui/docshell/docsh.cxx
--- sc.orig/source/ui/docshell/docsh.cxx	2007-01-17 14:24:04.000000000 +0100
+++ sc/source/ui/docshell/docsh.cxx	2007-01-17 18:36:18.000000000 +0100
@@ -59,6 +59,7 @@
 #include <vcl/virdev.hxx>
 #include <vcl/waitobj.hxx>
 #include <svtools/ctrltool.hxx>
+#include <svtools/ehdl.hxx>
 #include <svtools/sfxecode.hxx>
 #include <svtools/zforlist.hxx>
 #include <sfx2/app.hxx>
@@ -102,6 +103,7 @@
 
 // INCLUDE ---------------------------------------------------------------
 
+#include "acredlin.hxx"
 #include "cell.hxx"
 #include "global.hxx"
 #include "filter.hxx"
@@ -131,6 +133,7 @@
 #include "printfun.hxx"
 #include "dociter.hxx"
 #include "cellform.hxx"
+#include "reffact.hxx"
 #include "chartlis.hxx"
 #include "hints.hxx"
 #include "xmlwrap.hxx"
@@ -141,6 +144,7 @@
 #include "compiler.hxx"
 #include "cfgids.hxx"
 #include "warnpassword.hxx"
+#include "chgviset.hxx"
 
 #include "docsh.hxx"
 
@@ -1445,55 +1449,93 @@ BOOL __EXPORT ScDocShell::ConvertFrom( S
 	return bRet;
 }
 
-
-BOOL __EXPORT ScDocShell::Save()
+void ScDocShell::LoadAndMergeSharedWorksheet( SfxMedium* pMedium )
 {
-	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Save" );
+    if ( /* FIXME !bSharedWorksheet ||*/ !pMedium )
+        return;
 
-	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+    fprintf( stderr, "Shared worksheet...\n" );
 
-	//	DoEnterHandler hier nicht (wegen AutoSave), ist im ExecuteSave
+    // FIXME ExecuteChangeProtectionDialog()
 
-	ScChartListenerCollection* pCharts = aDocument.GetChartListenerCollection();
-	if (pCharts)
-		pCharts->UpdateDirtyCharts();					// Charts, die noch upgedated werden muessen
-	if (pAutoStyleList)
-		pAutoStyleList->ExecuteAllNow();				// Vorlagen-Timeouts jetzt ausfuehren
-	if (GetCreateMode()== SFX_CREATE_MODE_STANDARD)
-        SfxObjectShell::SetVisArea( Rectangle() );     // normal bearbeitet -> keine VisArea
+    bool bHasConflicts = false;
+    do {
+        SfxMedium *pMed = new SfxMedium( pMedium->GetName(), STREAM_STD_READ, FALSE, pMedium->GetFilter() /* TODO the other params as well? */ );
+        SfxErrorContext aEc( ERRCTX_SFX_OPENDOC, pMed->GetName() );
 
-	//	wait cursor is handled with progress bar
-    BOOL bRet = SfxObjectShell::Save();
-	if( bRet )
-        bRet = SaveXML( GetMedium(), NULL );
-	return bRet;
-}
+        // load the most recent version of the doc
+        ScDocShell* pOtherDocSh = new ScDocShell;
+        SfxObjectShellRef aDocShTablesRef = pOtherDocSh;
+        pOtherDocSh->DoLoad( pMed );
+        ULONG nErr = pOtherDocSh->GetErrorCode();
 
+        // merge just if OK - we ignore errors
+        if ( pOtherDocSh->GetError() )
+            bHasConflicts = false;
+        else
+        {
+            MergeDocument( *pOtherDocSh->GetDocument() );
+            bHasConflicts = !bHasConflicts/* FIXME real value according to whether there were conflicts or not */;
 
-BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
+            if ( bHasConflicts )
+            {
+                // TODO Unlock
+                ScAcceptChgModalDlg aChangeDlg( GetDialogParent(), GetViewData() );
+                aChangeDlg.Execute();
+                // TODO Lock
+            }
+        }
+        pOtherDocSh->DoClose(); // delete happens with the Ref
+    } while ( bHasConflicts );
+}
+
+BOOL ScDocShell::impl_Save( SfxMedium *pMedium )
 {
-	RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
+    bool bSaveAs = true;
+    if ( !pMedium )
+    {
+        bSaveAs = false;
+        pMedium = GetMedium();
+    }
 
-	ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
+    ScRefreshTimerProtector( aDocument.GetRefreshTimerControlAddress() );
 
-	//	DoEnterHandler hier nicht (wegen AutoSave), ist im ExecuteSave
+    // DoEnterHandler hier nicht (wegen AutoSave), ist im ExecuteSave
 
-	ScChartListenerCollection* pCharts = aDocument.GetChartListenerCollection();
-	if (pCharts)
-		pCharts->UpdateDirtyCharts();					// Charts, die noch upgedated werden muessen
-	if (pAutoStyleList)
-		pAutoStyleList->ExecuteAllNow();				// Vorlagen-Timeouts jetzt ausfuehren
-	if (GetCreateMode()== SFX_CREATE_MODE_STANDARD)
+    ScChartListenerCollection* pCharts = aDocument.GetChartListenerCollection();
+    if (pCharts)
+        pCharts->UpdateDirtyCharts();					// Charts, die noch upgedated werden muessen
+    if (pAutoStyleList)
+        pAutoStyleList->ExecuteAllNow();				// Vorlagen-Timeouts jetzt ausfuehren
+    if (GetCreateMode()== SFX_CREATE_MODE_STANDARD)
         SfxObjectShell::SetVisArea( Rectangle() );     // normal bearbeitet -> keine VisArea
 
-	//	wait cursor is handled with progress bar
-    BOOL bRet = SfxObjectShell::SaveAs( rMedium );
-	if( bRet )
-        bRet = SaveXML( &rMedium, NULL );
+    // TODO Lock
+    LoadAndMergeSharedWorksheet( pMedium );
 
-	return bRet;
+    // wait cursor is handled with progress bar
+    BOOL bRet = bSaveAs? SfxObjectShell::SaveAs( *pMedium ): SfxObjectShell::Save();
+    if( bRet )
+        bRet = SaveXML( pMedium, NULL );
+
+    // TODO Unlock
+
+    return bRet;
 }
 
+BOOL __EXPORT ScDocShell::Save()
+{
+    RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::Save" );
+
+    return impl_Save( NULL );
+}
+
+BOOL __EXPORT ScDocShell::SaveAs( SfxMedium& rMedium )
+{
+    RTL_LOGFILE_CONTEXT_AUTHOR ( aLog, "sc", "nn93723", "ScDocShell::SaveAs" );
+
+    return impl_Save( &rMedium );
+}
 
 BOOL __EXPORT ScDocShell::IsInformationLost()
 {
diff -pur sc.orig/source/ui/inc/docsh.hxx sc/source/ui/inc/docsh.hxx
--- sc.orig/source/ui/inc/docsh.hxx	2007-01-17 14:24:04.000000000 +0100
+++ sc/source/ui/inc/docsh.hxx	2007-01-17 18:57:36.000000000 +0100
@@ -150,6 +150,9 @@ class SC_DLLPUBLIC ScDocShell: public Sf
 	SC_DLLPRIVATE void			InitOptions();
 	SC_DLLPRIVATE void			ResetDrawObjectShell();
 
+	SC_DLLPRIVATE void			LoadAndMergeSharedWorksheet( SfxMedium* pMedium );
+	SC_DLLPRIVATE BOOL			impl_Save( SfxMedium *pMedium );
+
 	SC_DLLPRIVATE BOOL			GetTabParam( const SfxItemSet* pArgs, USHORT nId, SCTAB& rTab );
     //BOOL            LoadCalc( SotStorage* pStor );
     //BOOL            SaveCalc( SotStorage* pStor );
