[ooo-build-commit] Branch 'ooo/OOO320' - 3 commits - desktop/inc desktop/source framework/inc framework/source officecfg/registry sfx2/source shell/inc xmlhelp/source

Jan Holesovsky kendy at kemper.freedesktop.org
Wed Dec 9 20:27:39 PST 2009


 desktop/inc/app.hxx                                          |    1 
 desktop/source/app/app.cxx                                   |   33 ++
 framework/inc/services/autorecovery.hxx                      |    7 
 framework/inc/services/sessionlistener.hxx                   |   22 +
 framework/source/services/autorecovery.cxx                   |  143 ++++++---
 framework/source/services/sessionlistener.cxx                |  159 ++++++++---
 framework/source/uielement/toolbarmanager.cxx                |    4 
 officecfg/registry/schema/org/openoffice/Office/Recovery.xcs |   13 
 sfx2/source/control/makefile.mk                              |    6 
 sfx2/source/doc/docfile.cxx                                  |    7 
 shell/inc/internal/xml_parser.hxx                            |    4 
 xmlhelp/source/com/sun/star/help/makefile.mk                 |    5 
 xmlhelp/source/treeview/tvread.cxx                           |    4 
 13 files changed, 306 insertions(+), 102 deletions(-)

New commits:
commit 5d54f34507205fdc88ca59d7d6c22464c6be06e7
Author: Oliver Bolte <obo at openoffice.org>
Date:   Wed Dec 9 12:24:01 2009 +0000

    CWS-TOOLING: integrate CWS fwk128
    2009-12-03 15:16:35 +0100 mav  r277713 : #i10000# remove unused variable
    2009-12-03 11:37:54 +0100 mav  r277710 : #i105172# allow to request storing of documents from the user on session shutdown
    2009-12-03 11:22:54 +0100 mav  r277709 : #i105172# PL:extend session management
    2009-12-03 11:20:53 +0100 mav  r277708 : #i105172# PL:extend session management
    2009-11-26 15:15:24 +0100 mav  r277660 : #i105172# try to store documents on shutdown
    2009-11-26 15:13:55 +0100 mav  r277658 : #i105172# PL: implement cancelShutdown

diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx
index 432006a..8315658 100644
--- a/desktop/inc/app.hxx
+++ b/desktop/inc/app.hxx
@@ -186,6 +186,7 @@ class Desktop : public Application
         static sal_Bool         _bTasksSaved;
 
         static void             retrieveCrashReporterState();
+        static sal_Bool         isUIOnSessionShutdownAllowed();
 
         // on-demand acceptors
         static void							createAcceptor(const OUString& aDescription);
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index aadf6bc..2686626 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -937,6 +937,29 @@ void Desktop::retrieveCrashReporterState()
     _bCrashReporterEnabled = bEnabled;
 }
 
+sal_Bool Desktop::isUIOnSessionShutdownAllowed()
+{
+    static const ::rtl::OUString CFG_PACKAGE_RECOVERY = ::rtl::OUString::createFromAscii("org.openoffice.Office.Recovery/");
+    static const ::rtl::OUString CFG_PATH_SESSION     = ::rtl::OUString::createFromAscii("SessionShutdown"                );
+    static const ::rtl::OUString CFG_ENTRY_UIENABLED  = ::rtl::OUString::createFromAscii("DocumentStoreUIEnabled"         );
+
+    css::uno::Reference< css::lang::XMultiServiceFactory > xSMGR = ::comphelper::getProcessServiceFactory();
+
+    sal_Bool bResult = sal_False;
+    if ( xSMGR.is() )
+    {
+        css::uno::Any aVal = ::comphelper::ConfigurationHelper::readDirectKey(
+                                    xSMGR,
+                                    CFG_PACKAGE_RECOVERY,
+                                    CFG_PATH_SESSION,
+                                    CFG_ENTRY_UIENABLED,
+                                    ::comphelper::ConfigurationHelper::E_READONLY);
+        aVal >>= bResult;
+    }
+
+    return bResult;
+}
+
 //-----------------------------------------------
 /** @short  check if crash reporter feature is enabled or
             disabled.
@@ -2458,7 +2481,15 @@ void Desktop::OpenClients()
         {
             xSessionListener = Reference< XInitialization >(::comphelper::getProcessServiceFactory()->createInstance(
                         OUString::createFromAscii("com.sun.star.frame.SessionListener")), UNO_QUERY_THROW);
-            xSessionListener->initialize(Sequence< Any >(0));
+
+            // specifies whether the UI-interaction on Session shutdown is allowed
+            sal_Bool bAllowUI = isUIOnSessionShutdownAllowed();
+            css::beans::NamedValue aProperty( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AllowUserInteractionOnQuit" ) ),
+                                              css::uno::makeAny( bAllowUI ) );
+            css::uno::Sequence< css::uno::Any > aArgs( 1 );
+            aArgs[0] <<= aProperty;
+
+            xSessionListener->initialize( aArgs );
         }
         catch(const com::sun::star::uno::Exception& e)
         {
diff --git a/framework/inc/services/autorecovery.hxx b/framework/inc/services/autorecovery.hxx
index ab249fc..55efef2 100644
--- a/framework/inc/services/autorecovery.hxx
+++ b/framework/inc/services/autorecovery.hxx
@@ -239,7 +239,8 @@ class AutoRecovery  : public  css::lang::XTypeProvider
             E_SESSION_SAVE              =  64,
             E_SESSION_RESTORE           = 128,
             E_DISABLE_AUTORECOVERY      = 256,
-            E_SET_AUTOSAVE_STATE        = 512
+            E_SET_AUTOSAVE_STATE        = 512,
+            E_SESSION_QUIET_QUIT        = 1024
         };
 
         //---------------------------------------
@@ -884,6 +885,10 @@ class AutoRecovery  : public  css::lang::XTypeProvider
 
         //---------------------------------------
         // TODO document me
+        void implts_doSessionQuietQuit(const DispatchParams& aParams);
+
+        //---------------------------------------
+        // TODO document me
         void implts_doSessionRestore(const DispatchParams& aParams);
 
         //---------------------------------------
diff --git a/framework/inc/services/sessionlistener.hxx b/framework/inc/services/sessionlistener.hxx
index b78a054..bc35993 100644
--- a/framework/inc/services/sessionlistener.hxx
+++ b/framework/inc/services/sessionlistener.hxx
@@ -49,7 +49,7 @@
 #include <com/sun/star/lang/XInitialization.hpp>
 
 
-#include <com/sun/star/frame/XSessionManagerListener.hpp>
+#include <com/sun/star/frame/XSessionManagerListener2.hpp>
 #include <com/sun/star/frame/XSessionManagerClient.hpp>
 #include <com/sun/star/frame/XStatusListener.hpp>
 #include <com/sun/star/frame/FeatureStateEvent.hpp>
@@ -98,7 +98,7 @@ namespace framework{
 class SessionListener :   // interfaces
                         public css::lang::XTypeProvider,
                         public css::lang::XInitialization,
-                        public css::frame::XSessionManagerListener,
+                        public css::frame::XSessionManagerListener2,
                         public css::frame::XStatusListener,
                         public css::lang::XServiceInfo,
                         // baseclasses (order important for initialization!)
@@ -119,7 +119,19 @@ class SessionListener :   // interfaces
 
         // restore handling
         sal_Bool m_bRestored;
+
+        sal_Bool m_bSessionStoreRequested;
+
+        sal_Bool m_bAllowUserInteractionOnQuit;
+        sal_Bool m_bTerminated;
  
+
+        // in case of synchronous call the caller should do saveDone() call himself!
+        void StoreSession( sal_Bool bAsync );
+
+        // let session quietly close the documents, remove lock files, store configuration and etc.
+        void QuitSessionQuietly();
+
     public:
 
         //---------------------------------------
@@ -146,7 +158,7 @@ class SessionListener :   // interfaces
         SessionListener( const css::uno::Reference< css::lang::XMultiServiceFactory >& xSMGR );
 
         virtual ~SessionListener();
-        
+
         virtual void SAL_CALL disposing(const com::sun::star::lang::EventObject&) throw (css::uno::RuntimeException);
 
 
@@ -163,6 +175,10 @@ class SessionListener :   // interfaces
        virtual sal_Bool SAL_CALL doRestore()
             throw (css::uno::RuntimeException);
 
+        // XSessionManagerListener2
+        virtual void SAL_CALL doQuit()
+            throw (::com::sun::star::uno::RuntimeException);
+
        // XStatusListener
        virtual void SAL_CALL statusChanged(const com::sun::star::frame::FeatureStateEvent& event) 
            throw (css::uno::RuntimeException);
diff --git a/framework/source/services/autorecovery.cxx b/framework/source/services/autorecovery.cxx
index ca7b94f..84bcce2 100644
--- a/framework/source/services/autorecovery.cxx
+++ b/framework/source/services/autorecovery.cxx
@@ -170,6 +170,7 @@ static const ::rtl::OUString CMD_DO_RECOVERY                 = ::rtl::OUString::
 static const ::rtl::OUString CMD_DO_ENTRY_BACKUP             = ::rtl::OUString::createFromAscii("/doEntryBackup"          );    // try to store a temp or original file to a user defined location
 static const ::rtl::OUString CMD_DO_ENTRY_CLEANUP            = ::rtl::OUString::createFromAscii("/doEntryCleanUp"         );    // remove the specified entry from the recovery cache
 static const ::rtl::OUString CMD_DO_SESSION_SAVE             = ::rtl::OUString::createFromAscii("/doSessionSave"          );    // save all open documents if e.g. a window manager closes an user session
+static const ::rtl::OUString CMD_DO_SESSION_QUIET_QUIT       = ::rtl::OUString::createFromAscii("/doSessionQuietQuit"     );    // let the current session be quietly closed ( the saving should be done using doSessionSave previously ) if e.g. a window manager closes an user session
 static const ::rtl::OUString CMD_DO_SESSION_RESTORE          = ::rtl::OUString::createFromAscii("/doSessionRestore"       );    // restore a saved user session from disc
 static const ::rtl::OUString CMD_DO_DISABLE_RECOVERY         = ::rtl::OUString::createFromAscii("/disableRecovery"        );    // disable recovery and auto save (!) temp. for this office session
 static const ::rtl::OUString CMD_DO_SET_AUTOSAVE_STATE       = ::rtl::OUString::createFromAscii("/setAutoSaveState"       );    // disable/enable auto save (not crash save) for this office session
@@ -725,6 +726,16 @@ void AutoRecovery::implts_dispatch(const DispatchParams& aParams)
         }
         else
         if (
+            ((eJob & AutoRecovery::E_SESSION_QUIET_QUIT    ) == AutoRecovery::E_SESSION_QUIET_QUIT ) &&
+            ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY)
+            )
+        {
+            LOG_RECOVERY("... do session quiet quit ...")
+            bAllowAutoSaveReactivation = sal_False;
+            implts_doSessionQuietQuit(aParams);
+        }
+        else
+        if (
             ((eJob & AutoRecovery::E_SESSION_RESTORE ) == AutoRecovery::E_SESSION_RESTORE ) &&
             ((eJob & AutoRecovery::E_DISABLE_AUTORECOVERY) != AutoRecovery::E_DISABLE_AUTORECOVERY)
             )
@@ -1987,6 +1998,30 @@ void AutoRecovery::implts_changeAllDocVisibility(sal_Bool bVisible)
 }
 
 //-----------------------------------------------
+/* Currently the document is not closed in case of crash,
+   so the lock file must be removed explicitly
+*/
+void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo)
+{
+    if ( rInfo.Document.is() )
+    {
+        try
+        {
+            css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW);
+            ::rtl::OUString aURL = xStore->getLocation();
+            if ( aURL.getLength() )
+            {
+                ::svt::DocumentLockFile aLockFile( aURL );
+                aLockFile.RemoveFile();
+            }
+        }
+        catch( const css::uno::Exception& )
+        {}
+    }
+}
+
+
+//-----------------------------------------------
 void AutoRecovery::implts_prepareSessionShutdown()
 {
     LOG_RECOVERY("AutoRecovery::implts_prepareSessionShutdown() starts ...")
@@ -2004,6 +2039,10 @@ void AutoRecovery::implts_prepareSessionShutdown()
     {
         AutoRecovery::TDocumentInfo& rInfo = *pIt;
 
+        // WORKAROUND... Since the documents are not closed the lock file must be removed explicitly
+        // it is not done on documents saving since shutdown can be cancelled
+        lc_removeLockFile( rInfo );
+
         // Prevent us from deregistration of these documents.
         // Because we close these documents by ourself (see XClosable below) ...
         // it's fact, that we reach our deregistration method. There we
@@ -2014,31 +2053,38 @@ void AutoRecovery::implts_prepareSessionShutdown()
         // reset modified flag of these documents (ignoring the notification about it!)
         // Otherwise a message box is shown on closing these models.
         implts_stopModifyListeningOnDoc(rInfo);
-        css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY);
-        if (xModify.is())
-            xModify->setModified(sal_False);
 
-        // close the model.
-        css::uno::Reference< css::util::XCloseable > xClose(rInfo.Document, css::uno::UNO_QUERY);
-        if (xClose.is())
+        // if the session save is still running the documents should not be thrown away,
+        // actually that would be a bad sign, that means that the SessionManager tryes
+        // to kill the session before the saving is ready
+        if ((m_eJob & AutoRecovery::E_SESSION_SAVE) != AutoRecovery::E_SESSION_SAVE)
         {
-            try
+            css::uno::Reference< css::util::XModifiable > xModify(rInfo.Document, css::uno::UNO_QUERY);
+            if (xModify.is())
+                xModify->setModified(sal_False);
+
+            // close the model.
+            css::uno::Reference< css::util::XCloseable > xClose(rInfo.Document, css::uno::UNO_QUERY);
+            if (xClose.is())
             {
-                xClose->close(sal_False);
-            }
-            /*
-            catch(const css::lang::DisposedException&)
-                {
-                    // closed ... disposed ... always the same .-)
-                }
-            */
-            catch(const css::uno::Exception&)
+                try
                 {
-                    // At least it's only a try to close these documents before anybody else it does.
-                    // So it seams to be possible to ignore any error here .-)
+                    xClose->close(sal_False);
                 }
+                /*
+                catch(const css::lang::DisposedException&)
+                    {
+                        // closed ... disposed ... always the same .-)
+                    }
+                */
+                catch(const css::uno::Exception&)
+                    {
+                        // At least it's only a try to close these documents before anybody else it does.
+                        // So it seams to be possible to ignore any error here .-)
+                    }
 
-            rInfo.Document.clear();
+                rInfo.Document.clear();
+            }
         }
     }
 
@@ -2047,30 +2093,6 @@ void AutoRecovery::implts_prepareSessionShutdown()
 }
 
 //-----------------------------------------------
-/* Currently the document is not closed in case of crash,
-   so the lock file must be removed explicitly
-*/
-void lc_removeLockFile(AutoRecovery::TDocumentInfo& rInfo)
-{
-    if ( rInfo.Document.is() )
-    {
-        try
-        {
-            css::uno::Reference< css::frame::XStorable > xStore(rInfo.Document, css::uno::UNO_QUERY_THROW);
-            ::rtl::OUString aURL = xStore->getLocation();
-            if ( aURL.getLength() )
-            {
-                ::svt::DocumentLockFile aLockFile( aURL );
-                aLockFile.RemoveFile();
-            }
-        }
-        catch( const css::uno::Exception& )
-        {}
-    }
-}
-
-
-//-----------------------------------------------
 /* TODO WORKAROUND:
 
         #i64599#
@@ -2750,6 +2772,9 @@ void AutoRecovery::implts_informListener(      sal_Int32                      eJ
     if ((eJob & AutoRecovery::E_SESSION_SAVE) == AutoRecovery::E_SESSION_SAVE)
         sFeature.append(CMD_DO_SESSION_SAVE);
     else
+    if ((eJob & AutoRecovery::E_SESSION_QUIET_QUIT) == AutoRecovery::E_SESSION_QUIET_QUIT)
+        sFeature.append(CMD_DO_SESSION_QUIET_QUIT);
+    else
     if ((eJob & AutoRecovery::E_SESSION_RESTORE) == AutoRecovery::E_SESSION_RESTORE)
         sFeature.append(CMD_DO_SESSION_RESTORE);
     else
@@ -2792,6 +2817,9 @@ sal_Int32 AutoRecovery::implst_classifyJob(const css::util::URL& aURL)
         if (aURL.Path.equals(CMD_DO_SESSION_SAVE))
             return AutoRecovery::E_SESSION_SAVE;
         else
+        if (aURL.Path.equals(CMD_DO_SESSION_QUIET_QUIT))
+            return AutoRecovery::E_SESSION_QUIET_QUIT;
+        else
         if (aURL.Path.equals(CMD_DO_SESSION_RESTORE))
             return AutoRecovery::E_SESSION_RESTORE;
         else
@@ -2968,14 +2996,6 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams)
 {
     LOG_RECOVERY("AutoRecovery::implts_doSessionSave()")
 
-    // try to make sure next time office will be started user wont be
-    // notified about any other might be running office instance
-    // remove ".lock" file from disc !
-    // it is done as a first action for session save since Gnome sessions
-    // do not provide enough time for shutdown, and the dialog looks to be
-    // confusing for the user
-    AutoRecovery::st_impl_removeLockFile();
-
     // Be sure to know all open documents realy .-)
     implts_verifyCacheAgainstDesktopDocumentList();
 
@@ -2991,7 +3011,8 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams)
     AutoRecovery::ETimerType eSuggestedTimer    = AutoRecovery::E_DONT_START_TIMER;
     do
     {
-        eSuggestedTimer = implts_saveDocs(bAllowUserIdleLoop, sal_True, &aParams);
+        // do not remove lock files of the documents, it will be done on session quit
+        eSuggestedTimer = implts_saveDocs(bAllowUserIdleLoop, sal_False, &aParams);
     }
     while(eSuggestedTimer == AutoRecovery::E_CALL_ME_BACK);
 
@@ -3002,6 +3023,23 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams)
     // any "handle" state ...
     implts_resetHandleStates(sal_False);
 
+    // flush config cached back to disc.
+    impl_flushALLConfigChanges();
+}
+
+//-----------------------------------------------
+void AutoRecovery::implts_doSessionQuietQuit(const DispatchParams& /*aParams*/)
+{
+    LOG_RECOVERY("AutoRecovery::implts_doSessionQuietQuit()")
+
+    // try to make sure next time office will be started user wont be
+    // notified about any other might be running office instance
+    // remove ".lock" file from disc !
+    // it is done as a first action for session save since Gnome sessions
+    // do not provide enough time for shutdown, and the dialog looks to be
+    // confusing for the user
+    AutoRecovery::st_impl_removeLockFile();
+
     // reset all modified documents, so the dont show any UI on closing ...
     // and close all documents, so we can shutdown the OS!
     implts_prepareSessionShutdown();
@@ -3020,6 +3058,7 @@ void AutoRecovery::implts_doSessionSave(const DispatchParams& aParams)
     impl_flushALLConfigChanges();
 }
 
+
 //-----------------------------------------------
 void AutoRecovery::implts_doSessionRestore(const DispatchParams& aParams)
 {
diff --git a/framework/source/services/sessionlistener.cxx b/framework/source/services/sessionlistener.cxx
index 9bda14b..836f6c8 100644
--- a/framework/source/services/sessionlistener.cxx
+++ b/framework/source/services/sessionlistener.cxx
@@ -60,6 +60,7 @@
 #include <com/sun/star/frame/XStorable.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/frame/XDispatch.hpp>
+#include <com/sun/star/frame/XDesktop.hpp>
 #include <com/sun/star/util/XModifiable.hpp>
 #include <com/sun/star/util/XChangesBatch.hpp>
 #include <com/sun/star/util/XURLTransformer.hpp>
@@ -103,12 +104,13 @@ namespace framework{
 //***********************************************
 // XInterface, XTypeProvider, XServiceInfo
 
-DEFINE_XINTERFACE_5(
+DEFINE_XINTERFACE_6(
         SessionListener,
         OWeakObject,
         DIRECT_INTERFACE(css::lang::XTypeProvider),
         DIRECT_INTERFACE(css::lang::XInitialization),
         DIRECT_INTERFACE(css::frame::XSessionManagerListener),
+        DIRECT_INTERFACE(css::frame::XSessionManagerListener2),
         DIRECT_INTERFACE(css::frame::XStatusListener),
         DIRECT_INTERFACE(css::lang::XServiceInfo))
 
@@ -116,7 +118,7 @@ DEFINE_XTYPEPROVIDER_5(
         SessionListener,
         css::lang::XTypeProvider,
         css::lang::XInitialization,
-        css::frame::XSessionManagerListener,
+        css::frame::XSessionManagerListener2,
         css::frame::XStatusListener,
         css::lang::XServiceInfo)
 
@@ -137,7 +139,10 @@ SessionListener::SessionListener(const css::uno::Reference< css::lang::XMultiSer
         : ThreadHelpBase      (&Application::GetSolarMutex())
         , OWeakObject         (                             )
         , m_xSMGR             (xSMGR                        )
-        , m_bRestored( false )
+        , m_bRestored( sal_False )
+        , m_bSessionStoreRequested( sal_False )
+        , m_bAllowUserInteractionOnQuit( sal_False )
+        , m_bTerminated( sal_False )
 {   
 }
 
@@ -150,6 +155,63 @@ SessionListener::~SessionListener()
     }
 }
 
+void SessionListener::StoreSession( sal_Bool bAsync )
+{
+    ResetableGuard aGuard(m_aLock);    
+    try 
+    {
+        // xd create SERVICENAME_AUTORECOVERY -> XDispatch
+        // xd->dispatch("vnd.sun.star.autorecovery:/doSessionSave, async=bAsync
+        // on stop event m_rSessionManager->saveDone(this); in case of asynchronous call
+        // in case of synchronous call the caller should do saveDone() call himself!
+
+        css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW);
+        css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW);
+        URL aURL;
+        aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionSave");
+        xURLTransformer->parseStrict(aURL);
+
+        // in case of asynchronous call the notification will trigger saveDone()
+        if ( bAsync )
+            xDispatch->addStatusListener(this, aURL);
+
+        Sequence< PropertyValue > args(1);
+        args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(bAsync),PropertyState_DIRECT_VALUE);
+        xDispatch->dispatch(aURL, args);
+    } catch (com::sun::star::uno::Exception& e) {
+        OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8);
+        OSL_ENSURE(sal_False, aMsg.getStr());
+        // save failed, but tell manager to go on if we havent yet dispatched the request
+        // in case of synchronous saving the notification is done by the caller
+        if ( bAsync && m_rSessionManager.is() )
+            m_rSessionManager->saveDone(this);
+    }
+}
+
+void SessionListener::QuitSessionQuietly()
+{
+    ResetableGuard aGuard(m_aLock);    
+    try 
+    {
+        // xd create SERVICENAME_AUTORECOVERY -> XDispatch
+        // xd->dispatch("vnd.sun.star.autorecovery:/doSessionQuietQuit, async=false
+        // it is done synchronously to avoid conflict with normal quit process
+
+        css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW);
+        css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW);
+        URL aURL;
+        aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionQuietQuit");
+        xURLTransformer->parseStrict(aURL);
+
+        Sequence< PropertyValue > args(1);
+        args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(sal_False),PropertyState_DIRECT_VALUE);
+        xDispatch->dispatch(aURL, args);
+    } catch (com::sun::star::uno::Exception& e) {
+        OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8);
+        OSL_ENSURE(sal_False, aMsg.getStr());
+    }
+}
+
 void SAL_CALL SessionListener::disposing(const com::sun::star::lang::EventObject&) throw (RuntimeException)
 {
 }
@@ -170,6 +232,8 @@ void SAL_CALL SessionListener::initialize(const Sequence< Any  >& args)
                     v.Value >>= aSMgr;
                 else if (v.Name.equalsAscii("SessionManager"))
                     v.Value >>= m_rSessionManager;
+                else if (v.Name.equalsAscii("AllowUserInteractionOnQuit"))
+                    v.Value >>= m_bAllowUserInteractionOnQuit;
             }
         }
     }
@@ -235,46 +299,75 @@ void SAL_CALL SessionListener::doSave( sal_Bool bShutdown, sal_Bool /*bCancelabl
 {
     if (bShutdown)
     {
-        sal_Bool bDispatched = sal_False;
-        ResetableGuard aGuard(m_aLock);    
-        try 
-        {
-            // xd create SERVICENAME_AUTORECOVERY -> XDispatch
-            // xd->dispatch("vnd.sun.star.autorecovery:/doSessionSave, async=true
-            // on stop event m_rSessionManager->saveDone(this);
-
-            css::uno::Reference< XDispatch > xDispatch(m_xSMGR->createInstance(SERVICENAME_AUTORECOVERY), UNO_QUERY_THROW);
-            css::uno::Reference< XURLTransformer > xURLTransformer(m_xSMGR->createInstance(SERVICENAME_URLTRANSFORMER), UNO_QUERY_THROW);
-            URL aURL;
-            aURL.Complete = OUString::createFromAscii("vnd.sun.star.autorecovery:/doSessionSave");
-            xURLTransformer->parseStrict(aURL);
-            xDispatch->addStatusListener(this, aURL);
-            Sequence< PropertyValue > args(1);
-            args[0] = PropertyValue(OUString::createFromAscii("DispatchAsynchron"),-1,makeAny(sal_True),PropertyState_DIRECT_VALUE);
-            xDispatch->dispatch(aURL, args);
-            bDispatched = sal_True;
-            // on stop event set call m_rSessionManager->saveDone(this);            
-        } catch (com::sun::star::uno::Exception& e) {
-            OString aMsg = OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8);
-            OSL_ENSURE(sal_False, aMsg.getStr());
-            // save failed, but tell manager to go on if we havent yet dispatched the request
-            if (m_rSessionManager.is() && !bDispatched)
-                m_rSessionManager->saveDone(this);
-        }
+        m_bSessionStoreRequested = sal_True; // there is no need to protect it with mutex
+        if ( m_bAllowUserInteractionOnQuit && m_rSessionManager.is() )
+            m_rSessionManager->queryInteraction( static_cast< css::frame::XSessionManagerListener* >( this ) );
+        else
+            StoreSession( sal_True );
     }
     // we don't have anything to do so tell the session manager we're done
     else if( m_rSessionManager.is() )
         m_rSessionManager->saveDone( this );
 }
 
-   
 
-void SAL_CALL SessionListener::approveInteraction( sal_Bool /*bInteractionGranted*/ )
+
+void SAL_CALL SessionListener::approveInteraction( sal_Bool bInteractionGranted )
     throw (RuntimeException)
-{}
+{
+    // do AutoSave as the first step
+    ResetableGuard aGuard(m_aLock);    
+
+    if ( bInteractionGranted )
+    {
+        // close the office documents in normal way
+        try
+        {
+            // first of all let the session be stored to be sure that we lose no information
+            StoreSession( sal_False );
+
+            css::uno::Reference< css::frame::XDesktop > xDesktop( m_xSMGR->createInstance(SERVICENAME_DESKTOP), css::uno::UNO_QUERY_THROW);
+            m_bTerminated = xDesktop->terminate();
+
+            if ( m_rSessionManager.is() )
+            {
+                // false means that the application closing has been cancelled
+                if ( !m_bTerminated )
+                    m_rSessionManager->cancelShutdown();
+                else
+                    m_rSessionManager->interactionDone( this );
+            }
+        }
+        catch( css::uno::Exception& )
+        {
+            StoreSession( sal_True );
+            m_rSessionManager->interactionDone( this );
+        }
+
+        if ( m_rSessionManager.is() )
+            m_rSessionManager->saveDone(this);
+    }
+    else
+    {
+        StoreSession( sal_True );
+    }
+}
 
 void SessionListener::shutdownCanceled()
     throw (RuntimeException)
-{}
+{
+    // set the state back
+    m_bSessionStoreRequested = sal_False; // there is no need to protect it with mutex
+}
+
+void SessionListener::doQuit()
+    throw (RuntimeException)
+{
+    if ( m_bSessionStoreRequested && !m_bTerminated )
+    {
+        // let the session be closed quietly in this case
+        QuitSessionQuietly();
+    }
+}
 
 }
diff --git a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
index 41ceb99..b510709 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Recovery.xcs
@@ -81,6 +81,19 @@
                 <desc>TODO</desc>
             </info>
         </set>
+        <group oor:name="SessionShutdown">
+            <info>
+				<author>MAV</author>
+                <desc>The session shutdown related information.</desc>
+            </info>
+            <prop oor:name="DocumentStoreUIEnabled" oor:type="xs:boolean">
+                <info>
+                    <author>MAV</author>
+                    <desc>Determines if the office is allowed to show request to store modified documents on session shutdown.</desc>
+                </info>
+                <value>false</value>
+            </prop>
+        </group>
         <group oor:name="RecoveryInfo">
             <info>
                 <desc>TODO</desc>
commit a4cc452f9b7cb84d418cf594adcc02c534fe9c39
Author: Oliver Bolte <obo at openoffice.org>
Date:   Wed Dec 9 08:32:23 2009 +0000

    CWS-TOOLING: integrate CWS fwk129
    2009-12-07 14:19:39 +0100 mba  r277741 : #i106367#: typo again
    2009-12-02 10:32:30 +0100 jsk  r277700 : fwk129: #i105719 - Fixed file size, wording and timing
    2009-11-25 13:25:48 +0100 mav  r277632 : #i107047# let the temporary stream be flushed in time
    2009-11-25 13:17:36 +0100 mav  r277631 : #i105719# switch to temporary file ealier to allow storing to the same location
    2009-11-23 14:47:02 +0100 mav  r277596 : #i105343# no outdated info in the buffer
    2009-11-23 14:09:49 +0100 os  r277595 : #i107064# copy styles in SwDoc::CreateCopy()
    2009-11-23 10:38:29 +0100 mba  r277592 : #i104338#: fix build without Java
    2009-11-20 10:22:11 +0100 cd  r277572 : #i107003# Make toolbar invisible before calling doLazyDelete. This prevents possible crashes in scenarios where a modal dialog is visible.
    2009-11-19 18:30:33 +0100 mav  r277569 : #i107035# let the temporary file be removed after the stream has been closed
    2009-11-19 18:06:21 +0100 mba  r277565 : #i106390#: crash caused by optimization
    2009-11-19 17:58:34 +0100 mba  r277564 : #i106367#: typo prevents correct asian language fallback
    2009-11-19 17:57:16 +0100 mba  r277563 : #i106390#: crash caused by optimization
    2009-11-19 16:35:41 +0100 nn  r277561 : #i106854# get source stream directly from document's storage instead of a temporary SfxMedium
    2009-11-19 12:36:38 +0100 mav  r277558 : #i106854# check the date of the original file

diff --git a/framework/source/uielement/toolbarmanager.cxx b/framework/source/uielement/toolbarmanager.cxx
index 6d5add1..7451f68 100644
--- a/framework/source/uielement/toolbarmanager.cxx
+++ b/framework/source/uielement/toolbarmanager.cxx
@@ -341,9 +341,11 @@ void ToolBarManager::Destroy()
             delete static_cast< AddonsParams* >( m_pToolBar->GetItemData( nItemId ));
     }
 
+    // Hide toolbar as lazy delete can destroy the toolbar much later.
+    m_pToolBar->Hide();
     /* #i99167# removed change for i93173 since there is some weird crash */
         // #i93173# delete toolbar lazily as we can still be in one of its handlers
-        m_pToolBar->doLazyDelete();
+    m_pToolBar->doLazyDelete();
     
     Link aEmpty;
     m_pToolBar->SetSelectHdl( aEmpty );
diff --git a/sfx2/source/control/makefile.mk b/sfx2/source/control/makefile.mk
index 4819524..9d93654 100644
--- a/sfx2/source/control/makefile.mk
+++ b/sfx2/source/control/makefile.mk
@@ -1,7 +1,7 @@
 #*************************************************************************
 #
 # 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
@@ -47,6 +47,10 @@ CFLAGS+=-Od
 .ENDIF
 .ENDIF
 
+.IF "$(COM)"=="GCC"
+CFLAGS+=-O0
+.ENDIF
+
 # --- Files --------------------------------------------------------
 
 SLOFILES = \
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 445508e..5b1e220 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -590,11 +590,14 @@ sal_Bool SfxMedium::DocNeedsFileDateCheck()
 //------------------------------------------------------------------
 util::DateTime SfxMedium::GetInitFileDate( sal_Bool bIgnoreOldValue )
 {
-    if ( ( bIgnoreOldValue || !pImp->m_bGotDateTime ) && GetContent().is() )
+    if ( ( bIgnoreOldValue || !pImp->m_bGotDateTime ) && aLogicName.Len() )
     {
         try
         {
-            pImp->aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DateModified" )) ) >>= pImp->m_aDateTime;
+            uno::Reference< ::com::sun::star::ucb::XCommandEnvironment > xDummyEnv;
+            ::ucbhelper::Content aContent( GetURLObject().GetMainURL( INetURLObject::NO_DECODE ), xDummyEnv );
+
+            aContent.getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DateModified" )) ) >>= pImp->m_aDateTime;
             pImp->m_bGotDateTime = sal_True;
         }
         catch ( ::com::sun::star::uno::Exception& )
diff --git a/xmlhelp/source/com/sun/star/help/makefile.mk b/xmlhelp/source/com/sun/star/help/makefile.mk
index 1e1a2c5..f5cbd39 100644
--- a/xmlhelp/source/com/sun/star/help/makefile.mk
+++ b/xmlhelp/source/com/sun/star/help/makefile.mk
@@ -36,6 +36,7 @@ LIBBASENAME = helplinker
 PACKAGE = com$/sun$/star$/help
 TARGETTYPE=CUI
 
+.IF "$(SOLAR_JAVA)"!=""
 # --- Settings -----------------------------------------------------
 
 .INCLUDE : settings.mk
@@ -109,3 +110,7 @@ fix_system_lucene:
     @echo "Fix Java Class-Path entry for Lucene libraries from system."
     @$(SED) -r -e "s#^(Class-Path:).*#\1 file://$(LUCENE_CORE_JAR) file://$(LUCENE_ANALYZERS_JAR)#" \
     -i ../../../../../$(INPATH)/class/HelpLinker/META-INF/MANIFEST.MF
+.ELSE
+all:
+        @echo java disabled
+.ENDIF
commit df6c6fd40cd92185f4e421d5cf827166d3981f43
Author: Oliver Bolte <obo at openoffice.org>
Date:   Wed Dec 9 07:00:10 2009 +0000

    CWS-TOOLING: integrate CWS expat201
    2009-11-16 09:53:37 +0100 cmc  r277511 : #i106889# tweak api defs under windows
    2009-11-13 12:06:34 +0100 cmc  r277499 : #i106889# upgrade expat to 2.0.1

diff --git a/shell/inc/internal/xml_parser.hxx b/shell/inc/internal/xml_parser.hxx
index 6080d4c..6452d66 100644
--- a/shell/inc/internal/xml_parser.hxx
+++ b/shell/inc/internal/xml_parser.hxx
@@ -31,11 +31,7 @@
 #ifndef _XML_PARSER_HXX_
 #define _XML_PARSER_HXX_
 
-#ifdef SYSTEM_EXPAT
 #include <expat.h>
-#else
-#include <external/expat/xmlparse.h>
-#endif
 #include <stdexcept>
 
 //-----------------------------------------------------
diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx
index bc7af59..d94d7f9 100644
--- a/xmlhelp/source/treeview/tvread.cxx
+++ b/xmlhelp/source/treeview/tvread.cxx
@@ -38,11 +38,7 @@
 #include <vos/diagnose.hxx>
 #endif
 #include "tvread.hxx"
-#ifdef SYSTEM_EXPAT
 #include <expat.h>
-#else
-#include <expat/xmlparse.h>
-#endif
 #include <osl/file.hxx>
 #include <unotools/configmgr.hxx>
 #include <com/sun/star/frame/XConfigManager.hpp>


More information about the ooo-build-commit mailing list