Commits

Anonymous committed 4e2c9fb Merge

CWS-TOOLING: integrate CWS fwk152

Comments (0)

Files changed (17)

configmgr/source/xcsparser.cxx

     } else {
         switch (state_) {
         case STATE_COMPONENT_SCHEMA:
+            // To support old, broken extensions with .xcs files that contain
+            // empty <component-schema> elements:
+            state_ = STATE_COMPONENT_DONE;
+            break;
+        case STATE_TEMPLATES:
+            state_ = STATE_TEMPLATES_DONE;
+            break;
         case STATE_TEMPLATES_DONE:
             throw css::uno::RuntimeException(
                 (rtl::OUString(
                     RTL_CONSTASCII_USTRINGPARAM("no component element in ")) +
                  reader.getUrl()),
                 css::uno::Reference< css::uno::XInterface >());
-        case STATE_TEMPLATES:
-            state_ = STATE_TEMPLATES_DONE;
-            break;
         case STATE_COMPONENT_DONE:
             break;
         default:

desktop/inc/app.hxx

         static sal_Bool         IsFirstStartWizardNeeded();
         static sal_Bool         CheckExtensionDependencies();
 
+        static void             DoRestartActionsIfNecessary( sal_Bool bQuickStart );
+        static void             SetRestartState();
+
         void                    SynchronizeExtensionRepositories();
         void                    SetSplashScreenText( const ::rtl::OUString& rText );
         void                    SetSplashScreenProgress( sal_Int32 );

desktop/source/app/app.cxx

 		// The configuration error handler currently is only for startup
 		aConfigErrHandler.deactivate();
 
-		// call Application::Execute to process messages in vcl message loop
-		RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
-
+       // Acquire solar mutex just before we enter our message loop
+        if ( nAcquireCount )
+            Application::AcquireSolarMutex( nAcquireCount );
+
+        // call Application::Execute to process messages in vcl message loop
+        RTL_LOGFILE_PRODUCT_TRACE( "PERFORMANCE - enter Application::Execute()" );
+
+        Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
 		try
 		{
 			// The JavaContext contains an interaction handler which is used when
 			com::sun::star::uno::ContextLayer layer2(
 				new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
 
-			Execute();
+            ::comphelper::ComponentContext aContext( xSMgr );
+            xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+            if ( !xRestartManager.is() || !xRestartManager->isRestartRequested( sal_True ) )
+            {
+                // if this run of the office is triggered by restart, some additional actions should be done
+                DoRestartActionsIfNecessary( !pCmdLineArgs->IsInvisible() && !pCmdLineArgs->IsNoQuickstart() );
+
+                Execute();
+            }
 		}
 		catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
 		{
 			OfficeIPCThread::SetDowning();
 			FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
 		}
+
+        // check whether the shutdown is caused by restart
+        sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+        if ( bRestartRequested )
+            SetRestartState();
 	}
     
 	if (xGlobalBroadcaster.is())

desktop/source/app/appfirststart.cxx

 #include <comphelper/processfactory.hxx>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/beans/NamedValue.hpp>
+#include <com/sun/star/util/XChangesBatch.hpp>
 
 #include "app.hxx"
 
-using rtl::OUString;
-using namespace desktop;
-using namespace com::sun::star::beans;
+using ::rtl::OUString;
+using namespace ::desktop;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
 
 static const OUString sConfigSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationProvider" ) );
 static const OUString sAccessSrvc( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.configuration.ConfigurationUpdateAccess" ) );
 */
 }
 
+/* Local function - get access to the configuration */
+static Reference< XPropertySet > impl_getConfigurationAccess( const OUString& rPath )
+{
+    Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+
+    // get configuration provider
+    Reference< XMultiServiceFactory > xConfigProvider = Reference< XMultiServiceFactory >(
+            xFactory->createInstance( sConfigSrvc ), UNO_QUERY_THROW );
+
+    Sequence< Any > aArgs( 1 );
+    NamedValue aValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "NodePath" ) ), makeAny( rPath ) );
+    aArgs[0] <<= aValue;
+    return Reference< XPropertySet >(
+            xConfigProvider->createInstanceWithArguments( sAccessSrvc, aArgs ), UNO_QUERY_THROW );
+}
+
 /* Local function - was the wizard completed already? */
 static sal_Bool impl_isFirstStart()
 {
     try {
-        Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+        Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
 
-        // get configuration provider
-        Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
-                xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
-
-        Sequence< Any > theArgs(1);
-        NamedValue v(OUString::createFromAscii("NodePath"), makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
-        theArgs[0] <<= v;
-
-        Reference< XPropertySet > pset = Reference< XPropertySet >(
-                theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-
-        Any result = pset->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
+        Any result = xPSet->getPropertyValue(OUString::createFromAscii("FirstStartWizardCompleted"));
         sal_Bool bCompleted = sal_False;
         if ((result >>= bCompleted) && bCompleted)
             return sal_False;  // wizard was already completed
 
     try
     {
-        Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+        Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
 
-        // get configuration provider
-        Reference< XMultiServiceFactory > theConfigProvider = Reference< XMultiServiceFactory >(
-                xFactory->createInstance(sConfigSrvc), UNO_QUERY_THROW);
-
-        Sequence< Any > theArgs(1);
-        NamedValue v(OUString::createFromAscii("NodePath"),
-                makeAny(OUString::createFromAscii("org.openoffice.Setup/Office")));
-        theArgs[0] <<= v;
-        Reference< XPropertySet > pset = Reference< XPropertySet >(
-                theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW);
-
-        Any result = pset->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
+        Any result = xPSet->getPropertyValue(OUString::createFromAscii("LicenseAcceptDate"));
 
         OUString aAcceptDate;
         if (result >>= aAcceptDate)
     return impl_isFirstStart() || !impl_isLicenseAccepted();
 }
 
+void Desktop::DoRestartActionsIfNecessary( sal_Bool bQuickStart )
+{
+    if ( bQuickStart )
+    {
+        try
+        {
+            Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
+
+            OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
+            Any aRestart = xPSet->getPropertyValue( sPropName );
+            sal_Bool bRestart = sal_False;
+            if ( ( aRestart >>= bRestart ) && bRestart )
+            {
+                xPSet->setPropertyValue( sPropName, makeAny( sal_False ) );
+                Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
+
+                Sequence< Any > aSeq( 2 );
+                aSeq[0] <<= sal_True;
+                aSeq[1] <<= sal_True;
+
+                Reference < XInitialization > xQuickstart( ::comphelper::getProcessServiceFactory()->createInstance(
+                    OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.office.Quickstart" ) ) ),UNO_QUERY_THROW );
+                xQuickstart->initialize( aSeq );
+            }
+        }
+        catch( uno::Exception& )
+        {
+            // this is no critical operation so it should not prevent office from starting
+        }
+    }
+}
+
+void Desktop::SetRestartState()
+{
+    try
+    {
+        Reference< XPropertySet > xPSet = impl_getConfigurationAccess( OUString( RTL_CONSTASCII_USTRINGPARAM( "org.openoffice.Setup/Office" ) ) );
+        OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "OfficeRestartInProgress" ) );
+        xPSet->setPropertyValue( sPropName, makeAny( sal_True ) );
+        Reference< util::XChangesBatch >( xPSet, UNO_QUERY_THROW )->commitChanges();
+    }
+    catch( uno::Exception& )
+    {
+        // this is no critical operation, ignore the exception
+    }
+
+}
+

desktop/win32/source/officeloader/officeloader.cxx

                 p = desktop_win32::commandLineAppend(p, argv[i]);
             }
         }
+
         p = desktop_win32::commandLineAppend(
             p, MY_STRING(L"\" \"-env:OOO_CWD="));
         if (cwdLen == 0) {

editeng/source/editeng/eehtml.cxx

 #include <editeng/wghtitem.hxx>
 #include <svtools/htmltokn.h>
 #include <svtools/htmlkywd.hxx>
-
+#include <tools/tenccvt.hxx>
 
 #define ACTION_INSERTTEXT		  1
 #define ACTION_INSERTPARABRK	  2
 	nNumberingLevel = 0;
 	bFieldsInserted = FALSE;
 
+    DBG_ASSERT( RTL_TEXTENCODING_DONTKNOW == GetSrcEncoding( ), "EditHTMLParser::EditHTMLParser: Where does the encoding come from?" );
+    DBG_ASSERT( !IsSwitchToUCS2(), "EditHTMLParser::::EditHTMLParser: Switch to UCS2?" );
+
+    // Altough the real default encoding is ISO8859-1, we use MS-1252
+    // als default encoding.
+    SetSrcEncoding( GetExtendedCompatibilityTextEncoding(  RTL_TEXTENCODING_ISO_8859_1 ) );
+
+    // If the file starts with a BOM, switch to UCS2.
+    SetSwitchToUCS2( TRUE );
+
     if ( pHTTPHeaderAttrs )
-		SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
+        SetEncodingByHTTPHeader( pHTTPHeaderAttrs );
 }
 
 EditHTMLParser::~EditHTMLParser()

filter/source/config/fragments/filters/MathML_XML__Math_.xcu

 	<node oor:name="MathML XML (Math)" oor:op="replace">
-		<prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE ENCRYPTION</value></prop>
+		<prop oor:name="Flags"><value>IMPORT EXPORT TEMPLATE</value></prop>
 		<prop oor:name="UIComponent"/>
 		<prop oor:name="FilterService"/>
 		<prop oor:name="UserData"><value></value></prop>

framework/source/loadenv/loadenv.cxx

 #include <unotools/moduleoptions.hxx>
 #include <svtools/sfxecode.hxx>
 #include <unotools/processfactory.hxx>
+#include <unotools/ucbhelper.hxx>
 #include <comphelper/configurationhelper.hxx>
 #include <rtl/ustrbuf.hxx>
 #include <vcl/svapp.hxx>
             // don't check the complete URL here.
             // use its main part - ignore optional jumpmarks!
 			const ::rtl::OUString sURL = xModel->getURL();
-            if (!m_aURL.Main.equals(sURL))
+            if (!::utl::UCBContentHelper::EqualURLs( m_aURL.Main, sURL ))
 			{
 				xTask.clear ();
                 continue;

officecfg/registry/schema/org/openoffice/Setup.xcs

 					<author>AS</author>
 					<desc>Contains all of the document factories that were installed during setup.</desc>
 				</info>
-			</set>
+            </set>
+            <prop oor:name="OfficeRestartInProgress" oor:type="xs:boolean">
+                <info>
+                    <author>MAV</author>
+                    <desc>The entry specifies that we are in restart process</desc>
+                </info>
+                <value>false</value>
+            </prop>
 		</group>
 		<group oor:name="L10N">
 			<info>

sfx2/inc/sfx2/docfile.hxx

 
     static com::sun::star::uno::Sequence < com::sun::star::util::RevisionTag > GetVersionList(
 					const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
-	static sal_Bool EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL );
 	static ::rtl::OUString CreateTempCopyWithExt( const ::rtl::OUString& aURL );
     static sal_Bool CallApproveHandler( const ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler >& xHandler, ::com::sun::star::uno::Any aRequest, sal_Bool bAllowAbort );
 

sfx2/source/doc/docfile.cxx

 	pImp->m_nSignatureState = nState;
 }
 
-//----------------------------------------------------------------
-sal_Bool SfxMedium::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL )
-{
-	sal_Bool bResult = sal_False;
-
-	if ( aFirstURL.getLength() && aSecondURL.getLength() )
-	{
-		INetURLObject aFirst( aFirstURL );
-		INetURLObject aSecond( aSecondURL );
-
-        if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID )
-		{
-			try
-			{
-    			::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
-				if ( !pBroker )
-					throw uno::RuntimeException();
-
-				uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac
-					= pBroker->getContentIdentifierFactoryInterface();
-				if ( !xIdFac.is() )
-					throw uno::RuntimeException();
-
-				uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst
-					= xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) );
-				uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond
-					= xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) );
-
-				if ( xIdFirst.is() && xIdSecond.is() )
-				{
-					uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider =
-															pBroker->getContentProviderInterface();
-					if ( !xProvider.is() )
-						throw uno::RuntimeException();
-					bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond );
-				}
-			}
-			catch( uno::Exception& )
-			{
-				OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" );
-			}
-		}
-	}
-
-	return bResult;
-}
-
 BOOL SfxMedium::HasStorage_Impl() const
 {
     return pImp->xStorage.is();

sfx2/source/doc/doctemplates.cxx

 		aStoreArgs[1].Value <<= rTemplateName;
 
 		::rtl::OUString aCurrentDocumentURL = rStorable->getLocation();
-		if( !SfxMedium::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
+		if( !::utl::UCBContentHelper::EqualURLs( aNewTemplateTargetURL, rStorable->getLocation() ))
 			rStorable->storeToURL( aNewTemplateTargetURL, aStoreArgs );
 		else
 			rStorable->store();

sfx2/source/doc/objmisc.cxx

     SetSharedXMLFlag( sal_False );
 
     if ( IsDocShared() && aTempFileURL.getLength()
-      && !SfxMedium::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
+      && !::utl::UCBContentHelper::EqualURLs( aTempFileURL, GetSharedFileURL() ) )
     {
         if ( pImp->m_bAllowShareControlFileClean )
         {

sfx2/source/doc/objstor.cxx

     if ( pMedium
       && pMedium->GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
       && rMedium.GetName().CompareIgnoreCaseToAscii( "private:stream", 14 ) != COMPARE_EQUAL
-      && SfxMedium::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
+      && ::utl::UCBContentHelper::EqualURLs( pMedium->GetName(), rMedium.GetName() ) )
     {
         bStoreToSameLocation = sal_True;
         AddLog( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( OSL_LOG_PREFIX "Save" ) ) );

sfx2/source/doc/sfxbasemodel.cxx

 #include <framework/titlehelper.hxx>
 #include <comphelper/numberedcollection.hxx>
 #include <unotools/ucbstreamhelper.hxx>
+#include <unotools/ucbhelper.hxx>
 
 //________________________________________________________________________________________________________
 //	includes of my own project
     sal_Bool bSaved = sal_False;
     if ( !bSaveTo && m_pData->m_pObjectShell && sURL.getLength()
       && sURL.compareToAscii( "private:stream", 14 ) != COMPARE_EQUAL
-	  && SfxMedium::EqualURLs( getLocation(), sURL ) )
+	  && ::utl::UCBContentHelper::EqualURLs( getLocation(), sURL ) )
     {
         // this is the same file URL as the current document location, try to use storeOwn if possible
 

unotools/inc/unotools/ucbhelper.hxx

         static sal_Bool             FindInPath( const String& rPath, const String& rName, String& rFile, char cDelim = ';', BOOL bAllowWildCards = TRUE );
         static sal_Bool             Find( const String& rFolder, const String& rName, String& rFile, BOOL bAllowWildCards = FALSE );
 		static sal_Bool				IsSubPath( const ::rtl::OUString& rPath, const ::rtl::OUString& rChildCandidate, const ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >& xContentProvider = ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XContentProvider >() );
+        static sal_Bool             EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL );
     };
 }
 

unotools/source/ucbhelper/ucbhelper.cxx

     return bResult;
 }
 
+// -----------------------------------------------------------------------
+sal_Bool UCBContentHelper::EqualURLs( const ::rtl::OUString& aFirstURL, const ::rtl::OUString& aSecondURL )
+{
+	sal_Bool bResult = sal_False;
+
+	if ( aFirstURL.getLength() && aSecondURL.getLength() )
+	{
+		INetURLObject aFirst( aFirstURL );
+		INetURLObject aSecond( aSecondURL );
+
+        if ( aFirst.GetProtocol() != INET_PROT_NOT_VALID && aSecond.GetProtocol() != INET_PROT_NOT_VALID )
+		{
+			try
+			{
+    			::ucbhelper::ContentBroker* pBroker = ::ucbhelper::ContentBroker::get();
+				if ( !pBroker )
+					throw uno::RuntimeException();
+
+				uno::Reference< ::com::sun::star::ucb::XContentIdentifierFactory > xIdFac
+					= pBroker->getContentIdentifierFactoryInterface();
+				if ( !xIdFac.is() )
+					throw uno::RuntimeException();
+
+				uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdFirst
+					= xIdFac->createContentIdentifier( aFirst.GetMainURL( INetURLObject::NO_DECODE ) );
+				uno::Reference< ::com::sun::star::ucb::XContentIdentifier > xIdSecond
+					= xIdFac->createContentIdentifier( aSecond.GetMainURL( INetURLObject::NO_DECODE ) );
+
+				if ( xIdFirst.is() && xIdSecond.is() )
+				{
+					uno::Reference< ::com::sun::star::ucb::XContentProvider > xProvider =
+															pBroker->getContentProviderInterface();
+					if ( !xProvider.is() )
+						throw uno::RuntimeException();
+					bResult = !xProvider->compareContentIds( xIdFirst, xIdSecond );
+				}
+			}
+			catch( uno::Exception& )
+			{
+				OSL_ENSURE( sal_False, "Can't compare URL's, treat as different!\n" );
+			}
+		}
+	}
+
+	return bResult;
+}
+
+
+
 } // namespace utl