Commits

Anonymous committed fa8be85 Merge

fs33a: merge after pulling OOO330.m5's changes

Comments (0)

Files changed (189)

 c85a59971620bc9e04ad689600ee9846f0f9dc18 OOO330_m2
 c605e94568651ba1b2626a6f37aa4c7ca4b4710f OOO330_m3
 03cf80e29979c28332a36bcb00a8947032433b3d OOO330_m4
+d9859c6e249e31fbd651f9a98c2fbe85d6f2df80 OOO330_m5

basegfx/source/polygon/b2dtrapezoid.cxx

 
             if(aSource.areControlPointsUsed())
             {
-                aSource = aSource.getDefaultAdaptiveSubdivision();
+	        const double fPrecisionFactor = 0.25;
+                aSource = adaptiveSubdivideByDistance( aSource, fLineWidth * fPrecisionFactor );
             }
 
             const sal_uInt32 nPointCount(aSource.count());

comphelper/inc/comphelper/storagehelper.hxx

 
     static sal_Bool IsValidZipEntryFileName( const ::rtl::OUString& aName, sal_Bool bSlashAllowed );
     static sal_Bool IsValidZipEntryFileName( const sal_Unicode *pChar, sal_Int32 nLength, sal_Bool bSlashAllowed );
+
+    static sal_Bool PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment );
 };
 
 }

comphelper/source/misc/officerestartmanager.cxx

         // if the restart already running there is no need to trigger it again
         if ( m_bRestartRequested )
             return;
-#ifndef MACOSX
+
         m_bRestartRequested = sal_True;
-#endif
+
         // the office is still not initialized, no need to terminate, changing the state is enough
         if ( !m_bOfficeInitialized )
             return;

comphelper/source/misc/storagehelper.cxx

     return sal_True;
 }
 
+// ----------------------------------------------------------------------
+sal_Bool OStorageHelper::PathHasSegment( const ::rtl::OUString& aPath, const ::rtl::OUString& aSegment )
+{
+    sal_Bool bResult = sal_False;
+    const sal_Int32 nPathLen = aPath.getLength();
+    const sal_Int32 nSegLen = aSegment.getLength();
+
+    if ( nSegLen && nPathLen >= nSegLen )
+    {
+        ::rtl::OUString aEndSegment( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+        aEndSegment += aSegment;
+
+        ::rtl::OUString aInternalSegment( aEndSegment );
+        aInternalSegment += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/" ) );
+
+        if ( aPath.indexOf( aInternalSegment ) >= 0 )
+            bResult = sal_True;
+
+        if ( !bResult && !aPath.compareTo( aSegment, nSegLen ) )
+        {
+            if ( nPathLen == nSegLen || aPath.getStr()[nSegLen] == (sal_Unicode)'/' )
+                bResult = sal_True;
+        }
+
+        if ( !bResult && nPathLen > nSegLen && aPath.copy( nPathLen - nSegLen - 1, nSegLen + 1 ).equals( aEndSegment ) )
+            bResult = sal_True;
+    }
+
+    return bResult;
 }
 
+}
+

configmgr/source/rootaccess.cxx

         for (ChangesListeners::iterator i(changesListeners_.begin());
              i != changesListeners_.end(); ++i)
         {
+            cppu::OWeakObject* pSource = static_cast< cppu::OWeakObject * >(this);
+            css::uno::Reference< css::uno::XInterface > xBase( pSource, css::uno::UNO_QUERY );
             broadcaster->addChangesNotification(
                 *i,
                 css::util::ChangesEvent(
-                    static_cast< cppu::OWeakObject * >(this),
-                    css::uno::makeAny(pathRepresentation_), set));
+                    pSource, makeAny( xBase ), set));
         }
     }
 }

desktop/source/app/app.cxx

 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_desktop.hxx"
 
+#include <cstdlib>
+#include <vector>
+
 #include <memory>
 #include <unistd.h>
 #include "app.hxx"
 #include <osl/file.hxx>
 #include <osl/signal.h>
 #include <rtl/uuid.h>
+#include <rtl/uri.hxx>
 #include <unotools/pathoptions.hxx>
 #include <svl/languageoptions.hxx>
 #include <unotools/internaloptions.hxx>
 
 #include "langselect.hxx"
 
+#if defined MACOSX
+#include <errno.h>
+#include <sys/wait.h>
+#endif
+
 #define DEFINE_CONST_UNICODE(CONSTASCII)        UniString(RTL_CONSTASCII_USTRINGPARAM(CONSTASCII))
 #define U2S(STRING)                                ::rtl::OUStringToOString(STRING, RTL_TEXTENCODING_UTF8)
 
     }
 }
 
+static const char      pLastSyncFileName[]     = "lastsynchronized";
+static const sal_Int32 nStrLenLastSync         = 16;
+		
+static bool needsSynchronization( 
+    ::rtl::OUString const & baseSynchronizedURL, ::rtl::OUString const & userSynchronizedURL )
+{
+    bool bNeedsSync( false );
+
+    ::osl::DirectoryItem itemUserFile;
+    ::osl::File::RC err1 =
+          ::osl::DirectoryItem::get(userSynchronizedURL, itemUserFile);
+
+    //If it does not exist, then there is nothing to be done
+    if (err1 == ::osl::File::E_NOENT)
+    {
+        return true;
+    }
+    else if (err1 != ::osl::File::E_None)
+    {
+        OSL_ENSURE(0, "Cannot access lastsynchronized in user layer");
+        return true; //sync just in case
+    }
+    
+    //If last synchronized does not exist in base layer, then do nothing
+    ::osl::DirectoryItem itemBaseFile;
+    ::osl::File::RC err2 = ::osl::DirectoryItem::get(baseSynchronizedURL, itemBaseFile);
+    if (err2 == ::osl::File::E_NOENT)
+    {
+        return true;
+        
+    }
+    else if (err2 != ::osl::File::E_None)
+    {
+        OSL_ENSURE(0, "Cannot access file lastsynchronized in base layer");
+        return true; //sync just in case
+    }
+    
+    //compare the modification time of the extension folder and the last
+    //modified file
+    ::osl::FileStatus statUser(FileStatusMask_ModifyTime);
+    ::osl::FileStatus statBase(FileStatusMask_ModifyTime);
+    if (itemUserFile.getFileStatus(statUser) == ::osl::File::E_None)
+    {
+        if (itemBaseFile.getFileStatus(statBase) == ::osl::File::E_None)
+        {
+            TimeValue timeUser = statUser.getModifyTime();
+            TimeValue timeBase = statBase.getModifyTime();
+
+            if (timeUser.Seconds < timeBase.Seconds)
+                bNeedsSync = true;
+        }
+        else
+        {
+            OSL_ASSERT(0);
+            bNeedsSync = true; 
+        }
+    }
+    else
+    {
+        OSL_ASSERT(0);
+        bNeedsSync = true;
+    }
+    
+    return bNeedsSync;
+}
+
+static ::rtl::OUString getBrandSharePreregBundledPathURL()
+{
+	::rtl::OUString url(
+        RTL_CONSTASCII_USTRINGPARAM("$BRAND_BASE_DIR/share/prereg/bundled"));
+
+    ::rtl::Bootstrap::expandMacros(url);
+    return url;
+}
+
+static ::rtl::OUString getUserBundledExtPathURL()
+{
+    ::rtl::OUString folder( RTL_CONSTASCII_USTRINGPARAM( "$BUNDLED_EXTENSIONS_USER" ));
+    ::rtl::Bootstrap::expandMacros(folder);
+
+    return folder;
+}
+
+static ::rtl::OUString getLastSyncFileURLFromBrandInstallation()
+{
+    ::rtl::OUString aURL = getBrandSharePreregBundledPathURL();
+    ::sal_Int32    nLastIndex         = aURL.lastIndexOf('/');
+        
+    ::rtl::OUStringBuffer aTmp( aURL );
+
+    if ( nLastIndex != aURL.getLength()-1 )
+        aTmp.appendAscii( "/" );
+    aTmp.appendAscii( pLastSyncFileName );
+        
+    return aTmp.makeStringAndClear();
+}
+
+static ::rtl::OUString getLastSyncFileURLFromUserInstallation()
+{
+	::rtl::OUString aUserBundledPathURL = getUserBundledExtPathURL();
+    ::sal_Int32    nLastIndex          = aUserBundledPathURL.lastIndexOf('/');
+    
+    ::rtl::OUStringBuffer aTmp( aUserBundledPathURL );
+
+    if ( nLastIndex != aUserBundledPathURL.getLength()-1 )
+        aTmp.appendAscii( "/" );
+    aTmp.appendAscii( pLastSyncFileName );
+
+    return aTmp.makeStringAndClear();
+}
+
+static osl::FileBase::RC copy_bundled_recursive( 
+    const rtl::OUString& srcUnqPath,
+    const rtl::OUString& dstUnqPath,
+    sal_Int32            TypeToCopy ) 
+throw()
+{
+    osl::FileBase::RC err = osl::FileBase::E_None;
+
+    if( TypeToCopy == -1 ) // Document
+    {
+        err = osl::File::copy( srcUnqPath,dstUnqPath );
+    }
+    else if( TypeToCopy == +1 ) // Folder
+    {
+        osl::Directory aDir( srcUnqPath );
+        aDir.open();
+
+        err = osl::Directory::create( dstUnqPath );
+        osl::FileBase::RC next = err;
+        if( err == osl::FileBase::E_None || 
+            err == osl::FileBase::E_EXIST )
+        {
+            err = osl::FileBase::E_None;
+            sal_Int32 n_Mask = FileStatusMask_FileURL | FileStatusMask_FileName | FileStatusMask_Type;
+
+            osl::DirectoryItem aDirItem;
+
+            while( err == osl::FileBase::E_None && ( next = aDir.getNextItem( aDirItem ) ) == osl::FileBase::E_None )
+            {
+                sal_Bool IsDoc = false;
+                sal_Bool bFilter = false;
+                osl::FileStatus aFileStatus( n_Mask );
+                aDirItem.getFileStatus( aFileStatus );
+                if( aFileStatus.isValid( FileStatusMask_Type ) )
+                    IsDoc = aFileStatus.getFileType() == osl::FileStatus::Regular;
+
+                // Getting the information for the next recursive copy
+                sal_Int32 newTypeToCopy = IsDoc ? -1 : +1;
+
+                rtl::OUString newSrcUnqPath;
+                if( aFileStatus.isValid( FileStatusMask_FileURL ) )
+                    newSrcUnqPath = aFileStatus.getFileURL();
+
+                rtl::OUString newDstUnqPath = dstUnqPath;
+                rtl::OUString tit;
+                if( aFileStatus.isValid( FileStatusMask_FileName ) )              
+                {
+                    ::rtl::OUString aFileName = aFileStatus.getFileName();
+                    tit = rtl::Uri::encode( aFileName,
+                                            rtl_UriCharClassPchar,
+                                            rtl_UriEncodeIgnoreEscapes,
+                                            RTL_TEXTENCODING_UTF8 );
+                    
+                    // Special treatment for "lastsychronized" file. Must not be
+                    // copied from the bundled folder!
+                    if ( IsDoc && aFileName.equalsAscii( pLastSyncFileName ))
+                        bFilter = true;
+                }
+                
+                if( newDstUnqPath.lastIndexOf( sal_Unicode('/') ) != newDstUnqPath.getLength()-1 )
+                    newDstUnqPath += rtl::OUString::createFromAscii( "/" );
+
+                newDstUnqPath += tit;
+
+                if (( newSrcUnqPath != dstUnqPath ) && !bFilter )
+                    err = copy_bundled_recursive( newSrcUnqPath,newDstUnqPath, newTypeToCopy );
+            }
+
+            if( err == osl::FileBase::E_None && next != osl::FileBase::E_NOENT )
+                err = next;
+        }
+        aDir.close();
+    }
+
+    return err;
+}
+
 Desktop::Desktop()
 : m_bServicesRegistered( false )
 , m_aBootstrapError( BE_OK )
     RTL_LOGFILE_CONTEXT( aLog, "desktop (cd100003) ::Desktop::Init" );
     SetBootstrapStatus(BS_OK);
 
-    // create service factory...
+    // Check for lastsynchronized file for bundled extensions in the user directory
+    // and test if synchronzation is necessary!
+	{
+        ::rtl::OUString aUserLastSyncFilePathURL = getLastSyncFileURLFromUserInstallation();
+        ::rtl::OUString aPreregSyncFilePathURL = getLastSyncFileURLFromBrandInstallation();
+
+        if ( needsSynchronization( aPreregSyncFilePathURL, aUserLastSyncFilePathURL ))
+        {
+            rtl::OUString aUserPath = getUserBundledExtPathURL();
+            rtl::OUString aPreregBundledPath = getBrandSharePreregBundledPathURL();
+            
+            // copy bundled folder to the user directory
+            osl::FileBase::RC rc = osl::Directory::createPath(aUserPath);
+            (void) rc;
+            copy_bundled_recursive( aPreregBundledPath, aUserPath, +1 );
+        }
+    }
+	
+	// create service factory...
     Reference < XMultiServiceFactory > rSMgr = CreateApplicationServiceManager();
     if( rSMgr.is() )
     {
         sal_False);
 }
 
-#ifdef MACOSX
-static void DoRestart()
-{
-	oslProcess		process;
-	oslProcessError	error;
-	OUString	sExecutableFile;
-
-	osl_getExecutableFile( &sExecutableFile.pData );
-
-	error = osl_executeProcess(
-		sExecutableFile.pData,
-		NULL,
-		0,
-		0,
-		NULL,
-		NULL,
-		NULL,
-		0,
-		&process
-		);
+namespace {
+
+void restartOnMac(bool passArguments) {
+#if defined MACOSX
+    OfficeIPCThread::DisableOfficeIPCThread();
+    rtl::OUString execUrl;
+    OSL_VERIFY(osl_getExecutableFile(&execUrl.pData) == osl_Process_E_None);
+    rtl::OUString execPath;
+    rtl::OString execPath8;
+    if ((osl::FileBase::getSystemPathFromFileURL(execUrl, execPath)
+         != osl::FileBase::E_None) ||
+        !execPath.convertToString(
+            &execPath8, osl_getThreadTextEncoding(),
+            (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+             RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+    {
+        std::abort();
+    }
+    std::vector< rtl::OString > args;
+    args.push_back(execPath8);
+    bool wait = false;
+    if (passArguments) {
+        sal_uInt32 n = osl_getCommandArgCount();
+        for (sal_uInt32 i = 0; i < n; ++i) {
+            rtl::OUString arg;
+            OSL_VERIFY(osl_getCommandArg(i, &arg.pData) == osl_Process_E_None);
+            if (arg.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("-accept="))) {
+                wait = true;
+            }
+            rtl::OString arg8;
+            if (!arg.convertToString(
+                    &arg8, osl_getThreadTextEncoding(),
+                    (RTL_UNICODETOTEXT_FLAGS_UNDEFINED_ERROR |
+                     RTL_UNICODETOTEXT_FLAGS_INVALID_ERROR)))
+            {
+                std::abort();
+            }
+            args.push_back(arg8);
+        }
+    }
+    std::vector< char const * > argPtrs;
+    for (std::vector< rtl::OString >::iterator i(args.begin()); i != args.end();
+         ++i)
+    {
+        argPtrs.push_back(i->getStr());
+    }
+    argPtrs.push_back(0);
+    execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+    if (errno == ENOTSUP) { // happens when multithreaded on OS X < 10.6
+        pid_t pid = fork();
+        if (pid == 0) {
+            execv(execPath8.getStr(), const_cast< char ** >(&argPtrs[0]));
+        } else if (pid > 0) {
+            // Two simultaneously running soffice processes lead to two dock
+            // icons, so avoid waiting here unless it must be assumed that the
+            // process invoking soffice itself wants to wait for soffice to
+            // finish:
+            if (!wait) {
+                return;
+            }
+            int stat;
+            if (waitpid(pid, &stat, 0) == pid && WIFEXITED(stat)) {
+                _exit(WEXITSTATUS(stat));
+            }
+        }
+    }
+    std::abort();
+#else
+    (void) passArguments; // avoid warnings
+#endif
 }
-#endif
+
+}
 
 USHORT Desktop::Exception(USHORT nError)
 {
                 OfficeIPCThread::DisableOfficeIPCThread();
                 if( pSignalHandler )
                     DELETEZ( pSignalHandler );
-#ifdef MACOSX
-				DoRestart();
-#endif
+                restartOnMac(false);
                 _exit( ExitHelper::E_CRASH_WITH_RESTART );
             }
             else
     std::auto_ptr<SvtLanguageOptions> pLanguageOptions;
     std::auto_ptr<SvtPathOptions> pPathOptions;
 
-    Reference < css::document::XEventListener > xGlobalBroadcaster;
+	sal_Bool bRestartRequested( sal_False );
+	sal_Bool bUseSystemFileDialog(sal_True);
+    int		 nAcquireCount( 0 );
+	Reference < css::document::XEventListener > xGlobalBroadcaster;
     try
     {
         RegisterServices( xSMgr );
 			( xSMgr->createInstance(
             DEFINE_CONST_UNICODE( "com.sun.star.frame.GlobalEventBroadcaster" ) ), UNO_QUERY );
 
+        /* ensure existance of a default window that messages can be dispatched to
+           This is for the benefit of testtool which uses PostUserEvent extensively
+           and else can deadlock while creating this window from another tread while
+           the main thread is not yet in the event loop.
+        */
+        Application::GetDefaultDevice();
+
         // initialize test-tool library (if available)
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ tools::InitTestToolLib" );
         tools::InitTestToolLib();
         impl_checkRecoveryState(bCrashed, bExistsRecoveryData, bExistsSessionData);
         RTL_LOGFILE_CONTEXT_TRACE( aLog, "} impl_checkRecoveryState" );
 
-        if (
-            (pCmdLineArgs->IsEmptyOrAcceptOnly()                                   ) &&
-            (SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
-            (!bExistsRecoveryData                                                  ) &&
-            (!bExistsSessionData                                                   ) &&
-            (!Application::AnyInput( INPUT_APPEVENT )                              )
-           )
-        {
-            RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
-            Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
-                OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
-            if (xDesktopFrame.is())
-            {
-//                SetSplashScreenProgress(60);
-                Reference< XFrame > xBackingFrame;
-                Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
-
-                xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
-                if (xBackingFrame.is())
-                    xContainerWindow = xBackingFrame->getContainerWindow();
-                if (xContainerWindow.is())
-                {
-                    // set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
-                    // frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
-                    // otherwise documents loaded into this frame will later on miss functionality depending on the style.
-                    Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
-                    OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
-                    pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
-
-                    SetSplashScreenProgress(75);
-                    Sequence< Any > lArgs(1);
-                    lArgs[0] <<= xContainerWindow;
-
-                    Reference< XController > xBackingComp(
-                        xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
-                        UNO_QUERY);
-//                    SetSplashScreenProgress(80);
-                    if (xBackingComp.is())
-                    {
-                        Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
-                        // Attention: You MUST(!) call setComponent() before you call attachFrame().
-                        // Because the backing component set the property "IsBackingMode" of the frame
-                        // to true inside attachFrame(). But setComponent() reset this state everytimes ...
-                        xBackingFrame->setComponent(xBackingWin, xBackingComp);
-                        SetSplashScreenProgress(100);
-                        xBackingComp->attachFrame(xBackingFrame);
-                        CloseSplashScreen();
-                        xContainerWindow->setVisible(sal_True);
-                    }
-                }
-            }
-            RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
-        }
+		Reference< ::com::sun::star::task::XRestartManager > xRestartManager;
+		{
+			::comphelper::ComponentContext aContext( xSMgr );
+			xRestartManager.set( aContext.getSingleton( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.task.OfficeRestartManager" ) ) ), UNO_QUERY );
+		}
+
+		// check whether the shutdown is caused by restart
+		bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
+
+		if ( pCmdLineArgs->IsHeadless() )
+		{
+			// Ensure that we use not the system file dialogs as
+			// headless mode relies on Application::EnableHeadlessMode()
+			// which does only work for VCL dialogs!!
+			SvtMiscOptions aMiscOptions;
+			bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
+			aMiscOptions.SetUseSystemFileDialog( sal_False );
+		}
+
+        if ( !bRestartRequested )
+		{
+			if (
+				(pCmdLineArgs->IsEmptyOrAcceptOnly()                                   ) &&
+				(SvtModuleOptions().IsModuleInstalled(SvtModuleOptions::E_SSTARTMODULE)) &&
+				(!bExistsRecoveryData                                                  ) &&
+				(!bExistsSessionData                                                   ) &&
+				(!Application::AnyInput( INPUT_APPEVENT )                              )
+			   )
+			{
+				RTL_LOGFILE_CONTEXT_TRACE( aLog, "{ create BackingComponent" );
+				Reference< XFrame > xDesktopFrame( xSMgr->createInstance(
+					OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+				if (xDesktopFrame.is())
+				{
+	//                SetSplashScreenProgress(60);
+					Reference< XFrame > xBackingFrame;
+					Reference< ::com::sun::star::awt::XWindow > xContainerWindow;
+
+					xBackingFrame = xDesktopFrame->findFrame(OUString( RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0);
+					if (xBackingFrame.is())
+						xContainerWindow = xBackingFrame->getContainerWindow();
+					if (xContainerWindow.is())
+					{
+						// set the WB_EXT_DOCUMENT style. Normally, this is done by the TaskCreator service when a "_blank"
+						// frame/window is created. Since we do not use the TaskCreator here, we need to mimic its behavior,
+						// otherwise documents loaded into this frame will later on miss functionality depending on the style.
+						Window* pContainerWindow = VCLUnoHelper::GetWindow( xContainerWindow );
+						OSL_ENSURE( pContainerWindow, "Desktop::Main: no implementation access to the frame's container window!" );
+						pContainerWindow->SetExtendedStyle( pContainerWindow->GetExtendedStyle() | WB_EXT_DOCUMENT );
+
+						SetSplashScreenProgress(75);
+						Sequence< Any > lArgs(1);
+						lArgs[0] <<= xContainerWindow;
+
+						Reference< XController > xBackingComp(
+							xSMgr->createInstanceWithArguments(OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.frame.StartModule") ), lArgs),
+							UNO_QUERY);
+	//                    SetSplashScreenProgress(80);
+						if (xBackingComp.is())
+						{
+							Reference< ::com::sun::star::awt::XWindow > xBackingWin(xBackingComp, UNO_QUERY);
+							// Attention: You MUST(!) call setComponent() before you call attachFrame().
+							// Because the backing component set the property "IsBackingMode" of the frame
+							// to true inside attachFrame(). But setComponent() reset this state everytimes ...
+							xBackingFrame->setComponent(xBackingWin, xBackingComp);
+							SetSplashScreenProgress(100);
+							xBackingComp->attachFrame(xBackingFrame);
+							CloseSplashScreen();
+							xContainerWindow->setVisible(sal_True);
+						}
+					}
+				}
+				RTL_LOGFILE_CONTEXT_TRACE( aLog, "} create BackingComponent" );
+			}
+		}
     }
     catch ( com::sun::star::lang::WrappedTargetException& wte )
     {
 	aOptions.SetVCLSettings();
 //    SetSplashScreenProgress(60);
 
-	Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
-
-	sal_Bool bTerminateRequested = sal_False;
-
-    // Preload function depends on an initialized sfx application!
-    SetSplashScreenProgress(75);
-
-    sal_Bool bUseSystemFileDialog(sal_True);
-    if ( pCmdLineArgs->IsHeadless() )
-    {
-        // Ensure that we use not the system file dialogs as
-        // headless mode relies on Application::EnableHeadlessMode()
-        // which does only work for VCL dialogs!!
-        SvtMiscOptions aMiscOptions;
-        bUseSystemFileDialog = aMiscOptions.UseSystemFileDialog();
-        aMiscOptions.SetUseSystemFileDialog( sal_False );
-    }
-
-    // use system window dialogs
-    Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
-
-//    SetSplashScreenProgress(80);
-
-    if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
-         !pCmdLineArgs->IsNoQuickstart() )
-        InitializeQuickstartMode( xSMgr );
-
-    RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
-    try
-    {
-        Reference< XDesktop > xDesktop( xSMgr->createInstance(
-            OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
-        if ( xDesktop.is() )
-            xDesktop->addTerminateListener( new OfficeIPCThreadController );
-        SetSplashScreenProgress(100);
-    }
-    catch ( com::sun::star::uno::Exception& e )
-    {
-        FatalError( MakeStartupErrorMessage(e.Message) );
-        return;
-    }
-    /*
-    catch ( ... )
-    {
-        FatalError( MakeStartupErrorMessage(
-            OUString::createFromAscii(
-            "Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
-        return;
-    }
-    */
-
-    // Release solar mutex just before we wait for our client to connect
-    int nAcquireCount = 0;
-    ::vos::IMutex& rMutex = Application::GetSolarMutex();
-    if ( rMutex.tryToAcquire() )
-        nAcquireCount = Application::ReleaseSolarMutex() - 1;
-
-    // Post user event to startup first application component window
-    // We have to send this OpenClients message short before execute() to
-    // minimize the risk that this message overtakes type detection contruction!!
-    Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
-
-    // Post event to enable acceptors
-    Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
-
-    // The configuration error handler currently is only for startup
-    aConfigErrHandler.deactivate();
-
-   // 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
-        // the creation of a Java Virtual Machine fails
-        com::sun::star::uno::ContextLayer layer2(
-            new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
-
-        ::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 ) )
-            Execute();
-    }
-    catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
-    {
-        OfficeIPCThread::SetDowning();
-        FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
-    }
-    catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
-    {
-        OfficeIPCThread::SetDowning();
-        FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
-    }
-
-    // check whether the shutdown is caused by restart
-    sal_Bool bRestartRequested = ( xRestartManager.is() && xRestartManager->isRestartRequested( sal_True ) );
-
-    if (xGlobalBroadcaster.is())
+    if ( !bRestartRequested )
+	{
+		Application::SetFilterHdl( LINK( this, Desktop, ImplInitFilterHdl ) );
+
+		sal_Bool bTerminateRequested = sal_False;
+
+		// Preload function depends on an initialized sfx application!
+		SetSplashScreenProgress(75);
+
+		// use system window dialogs
+		Application::SetSystemWindowMode( SYSTEMWINDOW_MODE_DIALOG );
+
+	//    SetSplashScreenProgress(80);
+
+		if ( !bTerminateRequested && !pCmdLineArgs->IsInvisible() &&
+			 !pCmdLineArgs->IsNoQuickstart() )
+			InitializeQuickstartMode( xSMgr );
+
+		RTL_LOGFILE_CONTEXT( aLog2, "desktop (cd100003) createInstance com.sun.star.frame.Desktop" );
+		try
+		{
+			Reference< XDesktop > xDesktop( xSMgr->createInstance(
+				OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ))), UNO_QUERY );
+			if ( xDesktop.is() )
+				xDesktop->addTerminateListener( new OfficeIPCThreadController );
+			SetSplashScreenProgress(100);
+		}
+		catch ( com::sun::star::uno::Exception& e )
+		{
+			FatalError( MakeStartupErrorMessage(e.Message) );
+			return;
+		}
+		/*
+		catch ( ... )
+		{
+			FatalError( MakeStartupErrorMessage(
+				OUString::createFromAscii(
+				"Unknown error during startup (TD/Desktop service).\nInstallation could be damaged.")));
+			return;
+		}
+		*/
+
+		// Post user event to startup first application component window
+		// We have to send this OpenClients message short before execute() to
+		// minimize the risk that this message overtakes type detection contruction!!
+		Application::PostUserEvent( LINK( this, Desktop, OpenClients_Impl ) );
+
+		// Post event to enable acceptors
+		Application::PostUserEvent( LINK( this, Desktop, EnableAcceptors_Impl) );
+
+		// 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()" );
+
+		try
+		{
+			// The JavaContext contains an interaction handler which is used when
+			// the creation of a Java Virtual Machine fails
+			com::sun::star::uno::ContextLayer layer2(
+				new svt::JavaContext( com::sun::star::uno::getCurrentContext() ) );
+
+			Execute();
+		}
+		catch(const com::sun::star::document::CorruptedFilterConfigurationException& exFilterCfg)
+		{
+			OfficeIPCThread::SetDowning();
+			FatalError( MakeStartupErrorMessage(exFilterCfg.Message) );
+		}
+		catch(const com::sun::star::configuration::CorruptedConfigurationException& exAnyCfg)
+		{
+			OfficeIPCThread::SetDowning();
+			FatalError( MakeStartupErrorMessage(exAnyCfg.Message) );
+		}
+	}
+    
+	if (xGlobalBroadcaster.is())
     {
         css::document::EventObject aEvent;
         aEvent.EventName = ::rtl::OUString::createFromAscii("OnCloseApp");
     RTL_LOGFILE_CONTEXT_TRACE( aLog, "FINISHED WITH Destop::Main" );
     if ( bRestartRequested )
     {
-#ifdef MACOSX
-        DoRestart();
-#endif
+        restartOnMac(true);
         // wouldn't the solution be more clean if SalMain returns the exit code to the system?
         _exit( ExitHelper::E_NORMAL_RESTART );
     }

desktop/source/app/userinstall.cxx

File contents unchanged.

desktop/source/app/userinstall.hxx

File contents unchanged.

desktop/source/deployment/gui/dp_gui_dialog2.cxx

 
     if ( ! GetEntryData( nPos )->m_bLocked )
     {
-        if ( GetEntryData( nPos )->m_eState == REGISTERED )
-            aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
-        else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
-            aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
-    
+    	if ( GetEntryData( nPos )->m_bUser )
+    	{
+            if ( GetEntryData( nPos )->m_eState == REGISTERED )
+                aPopup.InsertItem( CMD_DISABLE, DialogHelper::getResourceString( RID_CTX_ITEM_DISABLE ) );
+            else if ( GetEntryData( nPos )->m_eState != NOT_AVAILABLE )
+                aPopup.InsertItem( CMD_ENABLE, DialogHelper::getResourceString( RID_CTX_ITEM_ENABLE ) );
+        }
         aPopup.InsertItem( CMD_REMOVE, DialogHelper::getResourceString( RID_CTX_ITEM_REMOVE ) );
     }
 

desktop/source/deployment/manager/dp_extensionmanager.cxx

         bModified |= m_bundledRepository->synchronize(xAbortChannel, xCmdEnv);
         progressBundled.update(OUSTR("\n\n"));
         
+        //Always determine the active extension. This is necessary for the 
+        //first-start optimization. The setup creates the registration data for the 
+        //bundled extensions (brand_layer/share/prereg/bundled), which is copied to the user 
+        //installation (user_installation/extension/bundled) when a user starts OOo 
+        //for the first time after running setup. All bundled extensions are registered
+        //at that moment. However, extensions with the same identifier can be in the
+        //shared or user repository, in which case the respective bundled extensions must 
+        //be revoked.
         try
         {
             const uno::Sequence<uno::Sequence<Reference<deploy::XPackage> > >

desktop/source/deployment/manager/dp_manager.cxx

File contents unchanged.

desktop/source/deployment/manager/dp_properties.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *

desktop/source/deployment/manager/dp_properties.hxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_manager.h,v $
- * $Revision: 1.17 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/misc/dp_misc.cxx

 
 void syncRepositories(Reference<ucb::XCommandEnvironment> const & xCmdEnv)
 {
+    OUString sDisable;
+    ::rtl::Bootstrap::get( OUSTR( "DISABLE_EXTENSION_SYNCHRONIZATION" ), sDisable, OUString() );
+    if (sDisable.getLength() > 0)
+        return;
+
     Reference<deployment::XExtensionManager> xExtensionManager;
     //synchronize shared before bundled otherewise there are
     //more revoke and registration calls.

desktop/source/deployment/registry/configuration/dp_configuration.cxx

                 do {
                     OUString token( line.getToken( 0, ' ', index ).trim() );
                     if (token.getLength() > 0) {
-                        // cleanup, check if existing:
-                        if (create_ucb_content(
-                                0, expandUnoRcTerm(token), xCmdEnv,
-                                false /* no throw */ )) {
-                            //The  file may not exist anymore if a shared or bundled
-                            //extension was removed, but it can still be in the configmgrini.
-                            //After running XExtensionManager::synchronize, the configmgrini is
-                            //cleaned up
-                            m_xcs_files.push_back( token );
-                        }
+                        //The  file may not exist anymore if a shared or bundled
+                        //extension was removed, but it can still be in the configmgrini.
+                        //After running XExtensionManager::synchronize, the configmgrini is
+                        //cleaned up
+                        m_xcs_files.push_back( token );
                     }
                 }
                 while (index >= 0);
                 sal_Int32 index = sizeof ("DATA=") - 1;
                 do {
                     OUString token( line.getToken( 0, ' ', index ).trim() );
-                    if (token.getLength() > 0) {
+                    if (token.getLength() > 0)
+                    {
                         if (token[ 0 ] == '?')
                             token = token.copy( 1 );
-                        // cleanup, check if existing:
-                        if (create_ucb_content(
-                                0, expandUnoRcTerm(token),
-                                xCmdEnv, false /* no throw */ )) {
-                            //The  file may not exist anymore if a shared or bundled
-                            //extension was removed, but it can still be in the configmgrini.
-                            //After running XExtensionManager::synchronize, the configmgrini is
-                            //cleaned up
-                            m_xcu_files.push_back( token );
-                        }
-                        else
-                        {
-                            //Check if it was removed. Only when the file contained %origin, so that 
-                            //a new file was writen in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
-                            //See also ConfigurationBackendDb.iniEntry
-                            ::std::list<OUString> iniEntries = getAllIniEntries();
-                            if (::std::find(iniEntries.begin(), iniEntries.end(), token)
-                                != iniEntries.end())
-                                m_xcu_files.push_back( token );
-                            else
-                                OSL_ENSURE(0, "Extension manager: Invalid configmgr.ini entry.");
-                        }
+                        //The  file may not exist anymore if a shared or bundled
+                        //extension was removed, but it can still be in the configmgrini.
+                        //After running XExtensionManager::synchronize, the configmgrini is
+                        //cleaned up
+                        m_xcu_files.push_back( token );
                     }
                 }
                 while (index >= 0);
     {
         //in case the xcu contained %origin% then the configmr.ini contains the
         //url to the file in the user installation (e.g. $BUNDLED_EXTENSIONS_USER)
+        //However, m_url (getURL()) contains the URL for the file in the actual
+        //extension installatation.
         ::boost::optional<ConfigurationBackendDb::Data> data = readDataFromDb(url_);
         if (data)
             i = std::find(rSet.begin(), rSet.end(), data->iniEntry);
                 }
                 that->m_registeredPackages->erase(i->first);
             }
-            ::ucbhelper::Content(
-                makeURL( that->getCachePath(), OUSTR("registry") ),
-                xCmdEnv ).executeCommand(
-                    OUSTR("delete"), Any( true /* delete physically */ ) );
+            try
+            {
+                ::ucbhelper::Content(
+                    makeURL( that->getCachePath(), OUSTR("registry") ),
+                    xCmdEnv ).executeCommand(
+                        OUSTR("delete"), Any( true /* delete physically */ ) );
+            }
+            catch(Exception&)
+            {
+                OSL_ASSERT(0);
+            }
         }
         that->deleteDataFromDb(getURL());
         

desktop/source/deployment/registry/configuration/dp_configurationbackenddb.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/configuration/dp_configurationbackenddb.hxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/dp_registry.cxx

     virtual Reference<deployment::XPackage> SAL_CALL bindPackage(
         OUString const & url, OUString const & mediaType, sal_Bool bRemoved,
         OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
-        throw (deployment::DeploymentException, CommandFailedException,
+        throw (deployment::DeploymentException,
+               deployment::InvalidRemovedParameterException,
+               CommandFailedException,
                lang::IllegalArgumentException, RuntimeException);
     virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL
     getSupportedPackageTypes() throw (RuntimeException);
 Reference<deployment::XPackage> PackageRegistryImpl::bindPackage(
     OUString const & url, OUString const & mediaType_, sal_Bool bRemoved,
     OUString const & identifier, Reference<XCommandEnvironment> const & xCmdEnv )
-    throw (deployment::DeploymentException, CommandFailedException,
+    throw (deployment::DeploymentException, deployment::InvalidRemovedParameterException,
+           CommandFailedException,
            lang::IllegalArgumentException, RuntimeException)
 {
     check();

desktop/source/deployment/registry/executable/dp_executablebackenddb.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/executable/dp_executablebackenddb.hxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/help/dp_helpbackenddb.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/help/dp_helpbackenddb.hxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/package/dp_package.cxx

             try {
                 xPackage->registerPackage( startup, xSubAbortChannel, xCmdEnv );
             }
-            catch (RuntimeException &) {
-                throw;
-            }
-            catch (ucb::CommandAbortedException &) {
-                throw;
-            }
-            catch (Exception &) {
-                // CommandFailedException, DeploymentException:
+            catch (Exception &) 
+            {
+               //We even try a rollback if the user cancelled the action (CommandAbortedException)
+                //in order to prevent invalid database entries.
                 Any exc( ::cppu::getCaughtException() );
                 // try to handle exception, notify:
                 bool approve = false, abort = false;
                             bundle[ pos ]->revokePackage(
                                 xSubAbortChannel, xCmdEnv );
                         }
-                        catch (RuntimeException &) {
-                            throw;
-                        }
-                        catch (ucb::CommandAbortedException &) {
-                            throw;
-                        }
-                        catch (Exception &) {
-                            // bundle rollback error:
+                        catch (Exception &) 
+                        {
                             OSL_ENSURE( 0, ::rtl::OUStringToOString(
                                             ::comphelper::anyToString(
                                                 ::cppu::getCaughtException() ),

desktop/source/deployment/registry/script/dp_scriptbackenddb.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_package.cxx,v $
- * $Revision: 1.34.16.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/deployment/registry/script/dp_scriptbackenddb.hxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: dp_backend.h,v $
- * $Revision: 1.18 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/migration/services/cexportsoo3.cxx

  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  * 
- * Copyright 2008 by Sun Microsystems, Inc.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: cexports.cxx,v $
- * $Revision: 1.9 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/migration/services/oo3extensionmigration.cxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: extensionmigration.cxx,v $
- * $Revision: 1.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/migration/services/oo3extensionmigration.hxx

 /*************************************************************************
  *
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
+ * 
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
  *
  * OpenOffice.org - a multi-platform office productivity suite
  *
- * $RCSfile: extensionmigration.hxx,v $
- * $Revision: 1.2 $
- *
  * This file is part of OpenOffice.org.
  *
  * OpenOffice.org is free software: you can redistribute it and/or modify

desktop/source/pkgchk/unopkg/unopkg_app.cxx

 #include "osl/thread.h"
 #include "osl/process.h"
 #include "osl/conditn.hxx"
+#include "osl/file.hxx"
 #include "cppuhelper/implbase1.hxx"
 #include "cppuhelper/exc_hlp.hxx"
 #include "comphelper/anytostring.hxx"
             if (e != osl_File_E_None && e != osl_File_E_NOENT)
                 throw Exception(OUSTR("Could not delete ") + extensionUnorc, 0);
         }
+        else if (subCommand.equals(OUSTR("sync")))
+        {
+            //sync is private!!!! Only for bundled extensions!!!
+            //For performance reasons unopkg sync is called during the setup and
+            //creates the registration data for the repository of the bundled
+            //extensions. It is then copied to the user installation during
+            //startup of OOo (userdata/extensions/bundled).  The registration
+            //data is in the brand installation and must be removed when
+            //uninstalling OOo.  We do this here, before UNO is
+            //bootstrapped. Otherwies files could be locked by this process.
+
+            //If there is no folder left in
+            //$BRAND_BASE_DIR/share/extensions
+            //then we can delete the registration data at
+            //$BUNDLED_EXTENSIONS_USER
+            if (hasNoFolder(OUSTR("$BRAND_BASE_DIR/share/extensions")))
+            {
+                removeFolder(OUSTR("$BUNDLED_EXTENSIONS_USER"));
+                //return otherwise we create the registration data again
+                return 0;
+            }
+            
+        }
 
         xComponentContext = getUNO(
             disposeGuard, option_verbose, option_shared, subcmd_gui,
             xDialog->startExecuteModal(xListener);
             dialogEnded.wait();
         }
+        else if (subCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("sync")))
+        {
+            //This sub command may be removed later and is only there to have a
+            //possibility to start extension synching without any output.
+            //This is just here so we do not get an error, because of an unknown
+            //sub-command. We do synching before
+            //the sub-commands are processed.
+            
+        }
         else
         {
             dp_misc::writeConsoleError(

desktop/source/pkgchk/unopkg/unopkg_misc.cxx

     return xComponentContext;
 }
 
+//Determines if a folder does not contains a folder.
+//Return false may also mean that the status could not be determined
+//because some error occurred.
+bool hasNoFolder(OUString const & folderUrl)
+{
+    bool ret = false;
+    OUString url = folderUrl;
+    ::rtl::Bootstrap::expandMacros(url);
+    ::osl::Directory dir(url);
+    osl::File::RC rc = dir.open();
+    if (rc == osl::File::E_None)
+    {
+        bool bFolderExist = false;
+        osl::DirectoryItem i;
+        osl::File::RC rcNext = osl::File::E_None;
+        while ( (rcNext = dir.getNextItem(i)) == osl::File::E_None)
+        {
+            osl::FileStatus stat(FileStatusMask_Type);
+            if (i.getFileStatus(stat) == osl::File::E_None)
+            {
+                if (stat.getFileType() == osl::FileStatus::Directory)
+                {
+                    bFolderExist = true;
+                    break;
+                }
+            }
+            else
+            {
+                dp_misc::writeConsole(
+                    OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+                break;
+            }
+            i = osl::DirectoryItem();
+        }
+                
+        if (rcNext == osl::File::E_NOENT ||
+            rcNext == osl::File::E_None)
+        {
+            if (!bFolderExist)
+                ret = true;
+        }
+        else
+        {
+            dp_misc::writeConsole(
+                OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+        }
+        
+        dir.close();
+    }
+    else
+    {
+        dp_misc::writeConsole(
+            OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+    }
+    return ret;
 }
 
+void removeFolder(OUString const & folderUrl)
+{
+    OUString url = folderUrl;
+    ::rtl::Bootstrap::expandMacros(url);
+    ::osl::Directory dir(url);
+    ::osl::File::RC rc = dir.open();
+    if (rc == osl::File::E_None)
+    {
+        ::osl::DirectoryItem i;
+        ::osl::File::RC rcNext = ::osl::File::E_None;
+        while ( (rcNext = dir.getNextItem(i)) == ::osl::File::E_None)
+        {
+            ::osl::FileStatus stat(FileStatusMask_Type | FileStatusMask_FileURL);
+            if (i.getFileStatus(stat) == ::osl::File::E_None)
+            {
+                ::osl::FileStatus::Type t = stat.getFileType();
+                if (t == ::osl::FileStatus::Directory)
+                {
+                    //remove folder
+                    removeFolder(stat.getFileURL());
+                }
+                else if (t == ::osl::FileStatus::Regular)
+                {
+                    //remove file
+                    ::osl::File::remove(stat.getFileURL());
+                }
+                else
+                {
+                    OSL_ASSERT(0);
+                }
+            }
+            else
+            {
+                dp_misc::writeConsole(
+                    OUSTR("unopkg: Error while investigating ") + url + OUSTR("\n"));
+                break;
+            }
+            i = ::osl::DirectoryItem();
+        }
+        dir.close();
+        ::osl::Directory::remove(url);
+    }
+    else
+    {
+        dp_misc::writeConsole(
+            OUSTR("unopkg: Error while removing ") + url + OUSTR("\n"));
+    }    
+}
+
+}

desktop/source/pkgchk/unopkg/unopkg_shared.h

     DisposeGuard & disposeGuard, bool verbose, bool shared, bool bGui,
     css::uno::Reference<css::uno::XComponentContext> & out_LocalComponentContext);
 
+bool hasNoFolder(::rtl::OUString const & folderUrl);
+
+void removeFolder(::rtl::OUString const & folderUrl);
+
 }
 
+
+

filter/source/xsltdialog/xmlfilterjar.cxx

 
 static Reference< XInterface > addFolder( Reference< XInterface >& xRootFolder, Reference< XSingleServiceFactory >& xFactory, const OUString& rName ) throw( Exception )
 {
+    if ( rName.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( ".." ) ) )
+      || rName.equals( OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ) )
+        throw lang::IllegalArgumentException();
+
 	Sequence< Any > aArgs(1);
 	aArgs[0] <<= (sal_Bool)sal_True;
 
 	{
 		OUString szPackagePath( encodeZipUri( rURL.copy( sVndSunStarPackage.getLength() ) ) );
 
+        if ( ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, OUString( RTL_CONSTASCII_USTRINGPARAM( ".." ) ) )
+          || ::comphelper::OStorageHelper::PathHasSegment( szPackagePath, OUString( RTL_CONSTASCII_USTRINGPARAM( "." ) ) ) )
+            throw lang::IllegalArgumentException();
+
 		if( xIfc->hasByHierarchicalName( szPackagePath ) )
 		{
 			Reference< XActiveDataSink > xFileEntry;

framework/source/accelerators/acceleratorconfiguration.cxx

 
 #include <svtools/acceleratorexecute.hxx>
 
+#include <stdio.h>
+
 //_______________________________________________
 // const
 
 
 	const sal_Int32 c = aEvent.Changes.getLength();
 	      sal_Int32 i = 0;
-
-	for (i=0; i<c; ++i)
+    for (i=0; i<c; ++i)
 	{
 		const css::util::ElementChange& aChange  =   aEvent.Changes[i];
 
 
         aChange.Accessor >>= sOrgPath;
         sPath              = sOrgPath;
-        ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath);
-        sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sPrimarySecondary);
-
-        ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath);
-        sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sGlobalModules);
-
+        ::rtl::OUString sPrimarySecondary = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+        ::rtl::OUString sGlobalModules = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+        
         if ( sGlobalModules.equals(CFG_ENTRY_GLOBAL) )
         {
             ::rtl::OUString sModule;
-            sKey = ::utl::extractFirstFromConfigurationPath(sPath);
-            if ( sKey.getLength() )
+            sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+            if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
                 reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
         }
         else if ( sGlobalModules.equals(CFG_ENTRY_MODULES) )
         {
-            ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath);
-            ::rtl::OUString sDropModule = ::rtl::OUString::createFromAscii("Module['") + sModule +  ::rtl::OUString::createFromAscii("']");
-            sPath = ::utl::dropPrefixFromConfigurationPath(sPath, sDropModule);
-            sKey = ::utl::extractFirstFromConfigurationPath(sPath);
-            if ( sKey.getLength() )
+            ::rtl::OUString sModule = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+            sKey = ::utl::extractFirstFromConfigurationPath(sPath, &sPath);
+            
+            if (( sKey.getLength() > 0 ) && ( sPath.getLength() > 0 ))
+            {
                 reloadChanged(sPrimarySecondary, sGlobalModules, sModule, sKey);
+            }
         }
 	}
 }
                     aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD1;
                 else if (sToken[k].equalsAscii("MOD2"))
                     aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD2;
-		else if (sToken[k].equalsAscii("MOD3"))
-		    aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
+                else if (sToken[k].equalsAscii("MOD3"))
+		            aKeyEvent.Modifiers |= css::awt::KeyModifier::MOD3;
                 else
                 {
                     bValid = sal_False;

graphite/graphite-2.3.1.patch.mingw

  #include <assert.h>
 --- misc/silgraphite-2.3.1/wrappers/win32/WinFont.cpp	2009-01-29 17:33:19.000000000 +0900
 +++ misc/build/silgraphite-2.3.1/wrappers/win32/WinFont.cpp	2009-08-23 20:59:16.211375000 +0900
-@@ -408,7 +408,7 @@
- 					if (pPolyCurve->wType == TT_PRIM_QSPLINE &&
- 						// test if this is the last curve
- 						pPolyHdr->cb - (int)((byte *)(&pPolyCurve->apfx[j]) - (byte *)(pPolyHdr))
--							== sizeof POINTFX &&
-+							== sizeof(POINTFX) &&
- 						// and the two points are identical
- 						CompareFixed(pPolyCurve->apfx[j].x, pPolyHdr->pfxStart.x) &&
- 						CompareFixed(pPolyCurve->apfx[j].y, pPolyHdr->pfxStart.y))
 @@ -846,7 +846,7 @@
  
  } // namespace gr

helpcontent2/source/auxiliary/no_localization

Empty file added.

javainstaller2/src/JavaSetup/org/openoffice/setup/InstallData.java

     static private boolean databaseQueried = false;
     static private boolean useRtl = false;
     static private boolean installedProductMinorSet = false;
+    static private boolean isDebianSystem = false;
+    static private boolean debianInvestigated = false;
     static private String installType;            /* custom or typical installation */
     static private String osType;                 /* Linux, SunOS, ...              */
     static private String installDir = null;
         installedProductMinorSet = value;
     }
 
+    public boolean debianInvestigated() {
+    	return debianInvestigated;
+    }
+
+    public void setDebianInvestigated(boolean value) {
+        debianInvestigated = value;
+    }
+
+    public boolean isDebianSystem() {
+    	return isDebianSystem;
+    }
+
+    public void setIsDebianSystem(boolean value) {
+        isDebianSystem = value;
+    }
+
     public boolean databaseQueried() {
     	return databaseQueried;
     }

javainstaller2/src/JavaSetup/org/openoffice/setup/Installer/LinuxInstaller.java

                 // already exists. These pacakges return true with methode "useForce()".
                 boolean useForce = false;
                 if ( packageData.useForce() ) {
-                	File sofficeLink = new File("/usr/bin/soffice");
-                	if ( sofficeLink.exists() ) { useForce = true; }
+                    File sofficeLink = new File("/usr/bin/soffice");
+                    if ( sofficeLink.exists() ) { useForce = true; }
+                }
+                
+                // On Debian based systems, rpms can be installed with the switch --force-debian, if a rpm
+                // is installed.
+
+                String forceDebianString = "";
+                String nodepsString = "";
+                
+                if ( ! data.debianInvestigated() ) {
+                    helper.investigateDebian(data);
+                    data.setDebianInvestigated(true);
+                }
+                
+                if ( data.isDebianSystem() ) {
+                    forceDebianString = "--force-debian";
+                    nodepsString = "--nodeps";
                 }
                 
                 String rpmCommand = "";
                 if (useForce) {
                     if (useLocalDatabase) {
                         if ( relocations != null ) {
-                            rpmCommand = "rpm --upgrade --ignoresize --force -vh " +
+                            rpmCommand = "rpm --upgrade --ignoresize --force " + forceDebianString + " " + nodepsString + " -vh " +
                                     "--relocate " + relocations + " " + databaseString +
                                     " " + databasePath + " " + packageName;
+                            rpmCommandArray = new String[12];
+                            rpmCommandArray[0] = "rpm";
+                            rpmCommandArray[1] = "--upgrade";
+                            rpmCommandArray[2] = "--ignoresize";
+                            rpmCommandArray[3] = "--force";
+                            rpmCommandArray[4] = forceDebianString;
+                            rpmCommandArray[5] = nodepsString;
+                            rpmCommandArray[6] = "-vh";
+                            rpmCommandArray[7] = "--relocate";
+                            rpmCommandArray[8] = relocations;
+                            rpmCommandArray[9] = databaseString;
+                            rpmCommandArray[10] = databasePath;