diff options
author | sb <sb@openoffice.org> | 2010-04-14 17:21:13 +0200 |
---|---|---|
committer | sb <sb@openoffice.org> | 2010-04-14 17:21:13 +0200 |
commit | cd6cdc2be3b081a80c8500a3b71a1ae12dd6bc9a (patch) | |
tree | 9e021ac079e52180ca0b8ec4a5057b58d5b7598b /desktop | |
parent | d5436f22776a63a56bd90b44b06eb9bbfc39607f (diff) | |
parent | b0818f8883618cbfcb18f839ce9bf8709b23fcb6 (diff) |
sb118: merged in backout
Diffstat (limited to 'desktop')
330 files changed, 5754 insertions, 5676 deletions
diff --git a/desktop/inc/app.hxx b/desktop/inc/app.hxx index 353a3e045719..0ae632a6e968 100644 --- a/desktop/inc/app.hxx +++ b/desktop/inc/app.hxx @@ -2,13 +2,10 @@ * * 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: app.hxx,v $ - * $Revision: 1.37.14.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/inc/deployment.hrc b/desktop/inc/deployment.hrc index e29d1229bd18..7e4c21d3c5a4 100644 --- a/desktop/inc/deployment.hrc +++ b/desktop/inc/deployment.hrc @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/inc/makefile.mk b/desktop/inc/makefile.mk index 5e64fbff985a..8715d814274f 100644 --- a/desktop/inc/makefile.mk +++ b/desktop/inc/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/inc/pch/precompiled_desktop.cxx b/desktop/inc/pch/precompiled_desktop.cxx index 1f6af75a26d2..f95c8300208b 100644 --- a/desktop/inc/pch/precompiled_desktop.cxx +++ b/desktop/inc/pch/precompiled_desktop.cxx @@ -2,13 +2,10 @@ * * 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: precompiled_desktop.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/inc/pch/precompiled_desktop.hxx b/desktop/inc/pch/precompiled_desktop.hxx index 017531b5cf50..796ed48aa7a2 100644 --- a/desktop/inc/pch/precompiled_desktop.hxx +++ b/desktop/inc/pch/precompiled_desktop.hxx @@ -2,13 +2,10 @@ * * 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: precompiled_desktop.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/os2/source/applauncher/launcher.cxx b/desktop/os2/source/applauncher/launcher.cxx index 1d1280c71bf1..36c23e1eb4e0 100644 --- a/desktop/os2/source/applauncher/launcher.cxx +++ b/desktop/os2/source/applauncher/launcher.cxx @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/os2/source/applauncher/makefile.mk b/desktop/os2/source/applauncher/makefile.mk index 3ffff922506f..bf71b57c2fdf 100644 --- a/desktop/os2/source/applauncher/makefile.mk +++ b/desktop/os2/source/applauncher/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/prj/build.lst b/desktop/prj/build.lst index d9213aed12d6..9253b4e82bc7 100644 --- a/desktop/prj/build.lst +++ b/desktop/prj/build.lst @@ -1,4 +1,4 @@ -dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg NULL +dt desktop : l10n sfx2 stoc BERKELEYDB:berkeleydb sysui SO:sysui_so BOOST:boost svx xmlhelp sal unoil officecfg configmgr NULL dt desktop usr1 - all dt_mkout NULL dt desktop\inc nmake - all dt_inc NULL dt desktop\prj get - all dt_prj NULL diff --git a/desktop/prj/d.lst b/desktop/prj/d.lst index 5ec84bca7d37..92a4853c2bed 100644 --- a/desktop/prj/d.lst +++ b/desktop/prj/d.lst @@ -59,8 +59,8 @@ mkdir: %_DEST%\bin%_EXT%\odf4ms ..\%__SRC%\lib\liboffacc*.so %_DEST%\lib%_EXT%\liboffacc*.so ..\%__SRC%\lib\liboffacc*.dylib %_DEST%\lib%_EXT%\liboffacc*.dylib ..\%__SRC%\bin\migratio*.dll %_DEST%\bin%_EXT%\migratio*.dll -..\%__SRC%\lib\migrationoo2.uno.so %_DEST%\lib%_EXT%\migrationoo2.uno.so -..\%__SRC%\lib\migrationoo2.uno.dylib %_DEST%\lib%_EXT%\migrationoo2.uno.dylib +..\%__SRC%\lib\migratio*.uno.so %_DEST%\lib%_EXT%\migratio*.uno.so +..\%__SRC%\lib\migratio*.uno.dylib %_DEST%\lib%_EXT%\migratio*.uno.dylib ..\%__SRC%\bin\sweb %_DEST%\bin%_EXT%\sweb.bin diff --git a/desktop/qa/deployment_misc/makefile.mk b/desktop/qa/deployment_misc/makefile.mk index f673f27e49cb..15faef0dc46e 100644 --- a/desktop/qa/deployment_misc/makefile.mk +++ b/desktop/qa/deployment_misc/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -38,6 +34,7 @@ ENABLE_EXCEPTIONS := TRUE .INCLUDE: settings.mk .INCLUDE: $(PRJ)$/source$/deployment$/inc$/dp_misc.mk +CFLAGSCXX += $(CPPUNIT_CFLAGS) DLLPRE = # no leading "lib" on .so files SHL1TARGET = $(TARGET) diff --git a/desktop/qa/deployment_misc/test_dp_version.cxx b/desktop/qa/deployment_misc/test_dp_version.cxx index 728ed52c37b1..7b974a8bae73 100644 --- a/desktop/qa/deployment_misc/test_dp_version.cxx +++ b/desktop/qa/deployment_misc/test_dp_version.cxx @@ -2,13 +2,10 @@ * * 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: test_dp_version.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/qa/deployment_misc/version.map b/desktop/qa/deployment_misc/version.map index 4833b67470ca..7321bbca16ad 100644 --- a/desktop/qa/deployment_misc/version.map +++ b/desktop/qa/deployment_misc/version.map @@ -2,14 +2,10 @@ # # 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: version.map,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/registry/data/org/openoffice/Office/Jobs.xcu b/desktop/registry/data/org/openoffice/Office/Jobs.xcu index 628e3dcdf70a..0572d96a2a63 100644 --- a/desktop/registry/data/org/openoffice/Office/Jobs.xcu +++ b/desktop/registry/data/org/openoffice/Office/Jobs.xcu @@ -3,14 +3,10 @@ * * 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: Jobs.xcu,v $ - * - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/registry/data/org/openoffice/Office/makefile.mk b/desktop/registry/data/org/openoffice/Office/makefile.mk index 651c731fa4a9..2ad8441ea3d3 100644 --- a/desktop/registry/data/org/openoffice/Office/makefile.mk +++ b/desktop/registry/data/org/openoffice/Office/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/scripts/makefile.mk b/desktop/scripts/makefile.mk index 001ead351928..5c412f818702 100644 --- a/desktop/scripts/makefile.mk +++ b/desktop/scripts/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.15 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/scripts/soffice.sh b/desktop/scripts/soffice.sh index 0690e9647f35..73653092f59c 100644 --- a/desktop/scripts/soffice.sh +++ b/desktop/scripts/soffice.sh @@ -3,14 +3,10 @@ # # 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: soffice.sh,v $ -# -# $Revision: 1.34 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/scripts/unoinfo.sh b/desktop/scripts/unoinfo.sh index f49f139e6f54..081e414365cf 100644 --- a/desktop/scripts/unoinfo.sh +++ b/desktop/scripts/unoinfo.sh @@ -3,14 +3,10 @@ # # 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: unoinfo.sh,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/scripts/unopkg.sh b/desktop/scripts/unopkg.sh index 01e5b95f77e3..9e74f34d0e57 100644 --- a/desktop/scripts/unopkg.sh +++ b/desktop/scripts/unopkg.sh @@ -3,14 +3,10 @@ # # 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: unopkg.sh,v $ -# -# $Revision: 1.14 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 4b544fdd483f..efba60ca75b9 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -2,12 +2,10 @@ * * 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: app.cxx,v $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1151,16 +1149,6 @@ USHORT Desktop::Exception(USHORT nError) switch( nError & EXC_MAJORTYPE ) { -/* - case EXC_USER: - if( nError == EXC_OUTOFMEMORY ) - { - // not possible without a special NewHandler! - String aMemExceptionString; - Application::Abort( aMemExceptionString ); - } - break; -*/ case EXC_RSCNOTLOADED: { String aResExceptionString; @@ -1177,23 +1165,14 @@ USHORT Desktop::Exception(USHORT nError) default: { - if ( pArgs->IsNoRestore() ) { - if (m_pLockfile != NULL) { - m_pLockfile->clean(); - } - _exit( ExitHelper::E_LOCKFILE ); + if (m_pLockfile != NULL) { + m_pLockfile->clean(); } - if( bRestart ) { OfficeIPCThread::DisableOfficeIPCThread(); if( pSignalHandler ) DELETEZ( pSignalHandler ); - - if (m_pLockfile != NULL) { - m_pLockfile->clean(); - } - #ifdef MACOSX DoRestart(); #endif @@ -1201,17 +1180,15 @@ USHORT Desktop::Exception(USHORT nError) } else { - bInException = sal_False; - _exit( ExitHelper::E_CRASH ); + Application::Abort( String() ); } break; } } + OSL_ASSERT(false); // unreachable return 0; - - // ConfigManager is disposed, so no way to continue } void Desktop::AppEvent( const ApplicationEvent& rAppEvent ) diff --git a/desktop/source/app/appfirststart.cxx b/desktop/source/app/appfirststart.cxx index 1c8a1ed877be..c48805fcfeb7 100644 --- a/desktop/source/app/appfirststart.cxx +++ b/desktop/source/app/appfirststart.cxx @@ -2,13 +2,10 @@ * * 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: appfirststart.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 95ce7a728a55..97eb3f555f60 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -2,13 +2,10 @@ * * 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: appinit.cxx,v $ - * $Revision: 1.29 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/appinit.hxx b/desktop/source/app/appinit.hxx index 0004a143f3d3..c5b48fd4a488 100644 --- a/desktop/source/app/appinit.hxx +++ b/desktop/source/app/appinit.hxx @@ -2,13 +2,10 @@ * * 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: appinit.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/appsys.cxx b/desktop/source/app/appsys.cxx index 40ea640c1ed1..4cff81e3bb54 100644 --- a/desktop/source/app/appsys.cxx +++ b/desktop/source/app/appsys.cxx @@ -2,13 +2,10 @@ * * 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: appsys.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/appsys.hxx b/desktop/source/app/appsys.hxx index 04470599a309..5d1b06c1bbe7 100644 --- a/desktop/source/app/appsys.hxx +++ b/desktop/source/app/appsys.hxx @@ -2,13 +2,10 @@ * * 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: appsys.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/check_ext_deps.cxx b/desktop/source/app/check_ext_deps.cxx index a66031184200..8b73e0c2c525 100644 --- a/desktop/source/app/check_ext_deps.cxx +++ b/desktop/source/app/check_ext_deps.cxx @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2009 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * diff --git a/desktop/source/app/checkinstall.cxx b/desktop/source/app/checkinstall.cxx index 7e45d0b870f6..bb7258554cfe 100644 --- a/desktop/source/app/checkinstall.cxx +++ b/desktop/source/app/checkinstall.cxx @@ -2,13 +2,10 @@ * * 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: checkinstall.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/checkinstall.hxx b/desktop/source/app/checkinstall.hxx index efab15b8eeba..495ea3161bd3 100644 --- a/desktop/source/app/checkinstall.hxx +++ b/desktop/source/app/checkinstall.hxx @@ -2,13 +2,10 @@ * * 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: checkinstall.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/cmdlineargs.cxx b/desktop/source/app/cmdlineargs.cxx index 680a9377ac5d..0625191ee2ea 100644 --- a/desktop/source/app/cmdlineargs.cxx +++ b/desktop/source/app/cmdlineargs.cxx @@ -2,13 +2,10 @@ * * 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: cmdlineargs.cxx,v $ - * $Revision: 1.40 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -230,7 +227,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) bViewEvent = sal_False; bStartEvent = sal_False; bDisplaySpec = sal_False; - } + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-view" )) { // open in viewmode @@ -242,31 +239,43 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) bViewEvent = sal_True; bStartEvent = sal_False; bDisplaySpec = sal_False; - } + } else if ( aArgStr.EqualsIgnoreCaseAscii( "-show" )) { - // open in viewmode - bOpenEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_True; - bPrintEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bForceOpenEvent = sal_False; - bDisplaySpec = sal_False; + // open in viewmode + bOpenEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_True; + bPrintEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bForceOpenEvent = sal_False; + bDisplaySpec = sal_False; } else if ( aArgStr.EqualsIgnoreCaseAscii( "-display" )) { - // open in viewmode - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_True; + // set display + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_True; } + else if ( aArgStr.EqualsIgnoreCaseAscii( "-language" )) + { + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_False; + } + #ifdef MACOSX /* #i84053# ignore -psn on Mac Platform dependent #ifdef here is ugly, however this is currently @@ -275,15 +284,15 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier ) */ else if ( aArgStr.CompareToAscii( "-psn", 4 ) == COMPARE_EQUAL ) { - // finder argument from MacOSX - bOpenEvent = sal_False; - bPrintEvent = sal_False; - bForceOpenEvent = sal_False; - bPrintToEvent = sal_False; - bForceNewEvent = sal_False; - bViewEvent = sal_False; - bStartEvent = sal_False; - bDisplaySpec = sal_False; + // finder argument from MacOSX + bOpenEvent = sal_False; + bPrintEvent = sal_False; + bForceOpenEvent = sal_False; + bPrintToEvent = sal_False; + bForceNewEvent = sal_False; + bViewEvent = sal_False; + bStartEvent = sal_False; + bDisplaySpec = sal_False; } #endif } @@ -512,7 +521,12 @@ sal_Bool CommandLineArgs::InterpretCommandLineParameter( const ::rtl::OUString& } else if ( aArgStr.Copy(0, 9).EqualsIgnoreCaseAscii( "-version=" )) { - AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 15 ) ); + AddStringListParam_Impl( CMD_STRINGPARAM_VERSION, aArgStr.Copy( 9 ) ); + return sal_True; + } + else if ( aArgStr.Copy(0, 10).EqualsIgnoreCaseAscii( "-language=" )) + { + AddStringListParam_Impl( CMD_STRINGPARAM_LANGUAGE, aArgStr.Copy( 10 ) ); return sal_True; } else if ( aArg.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "-writer" )) == sal_True ) @@ -861,6 +875,13 @@ sal_Bool CommandLineArgs::GetPrinterName( ::rtl::OUString& rPara ) const return m_aStrSetParams[ CMD_STRINGPARAM_PRINTERNAME ]; } +sal_Bool CommandLineArgs::GetLanguage( ::rtl::OUString& rPara ) const +{ + osl::MutexGuard aMutexGuard( m_aMutex ); + rPara = m_aStrParams[ CMD_STRINGPARAM_LANGUAGE ]; + return m_aStrSetParams[ CMD_STRINGPARAM_LANGUAGE ]; +} + sal_Bool CommandLineArgs::IsEmpty() const { osl::MutexGuard aMutexGuard( m_aMutex ); diff --git a/desktop/source/app/cmdlineargs.hxx b/desktop/source/app/cmdlineargs.hxx index 622b900ad503..615577098c2d 100644 --- a/desktop/source/app/cmdlineargs.hxx +++ b/desktop/source/app/cmdlineargs.hxx @@ -2,13 +2,10 @@ * * 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: cmdlineargs.hxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -94,6 +91,7 @@ class CommandLineArgs CMD_STRINGPARAM_PRINTTOLIST, CMD_STRINGPARAM_PRINTERNAME, CMD_STRINGPARAM_DISPLAY, + CMD_STRINGPARAM_LANGUAGE, CMD_STRINGPARAM_COUNT // must be last element! }; @@ -170,6 +168,7 @@ class CommandLineArgs sal_Bool GetPrintList( ::rtl::OUString& rPara) const; sal_Bool GetPrintToList( ::rtl::OUString& rPara ) const; sal_Bool GetPrinterName( ::rtl::OUString& rPara ) const; + sal_Bool GetLanguage( ::rtl::OUString& rPara ) const; // Special analyzed states (does not match directly to a command line parameter!) sal_Bool IsPrinting() const; diff --git a/desktop/source/app/cmdlinehelp.cxx b/desktop/source/app/cmdlinehelp.cxx index 43ecf7e2bc3d..c4530e9ce61c 100644 --- a/desktop/source/app/cmdlinehelp.cxx +++ b/desktop/source/app/cmdlinehelp.cxx @@ -2,13 +2,10 @@ * * 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: cmdlinehelp.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/configinit.cxx b/desktop/source/app/configinit.cxx index aa1fe4da39a1..bd722a136e8a 100644 --- a/desktop/source/app/configinit.cxx +++ b/desktop/source/app/configinit.cxx @@ -2,13 +2,10 @@ * * 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: configinit.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktop.hrc b/desktop/source/app/desktop.hrc index 81110d665868..9c68d7b9fd2d 100644 --- a/desktop/source/app/desktop.hrc +++ b/desktop/source/app/desktop.hrc @@ -2,13 +2,10 @@ * * 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: desktop.hrc,v $ - * $Revision: 1.25 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktop.src b/desktop/source/app/desktop.src index 03f7674e900d..d7ab4a27764e 100644 --- a/desktop/source/app/desktop.src +++ b/desktop/source/app/desktop.src @@ -2,13 +2,10 @@ * * 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: desktop.src,v $ - * $Revision: 1.74 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktopcontext.cxx b/desktop/source/app/desktopcontext.cxx index c75d0a106bc2..e516b5eadd46 100644 --- a/desktop/source/app/desktopcontext.cxx +++ b/desktop/source/app/desktopcontext.cxx @@ -2,13 +2,10 @@ * * 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: desktopcontext.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktopcontext.hxx b/desktop/source/app/desktopcontext.hxx index f6b60a8e9411..88948e753af5 100644 --- a/desktop/source/app/desktopcontext.hxx +++ b/desktop/source/app/desktopcontext.hxx @@ -2,13 +2,10 @@ * * 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: desktopcontext.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktopresid.cxx b/desktop/source/app/desktopresid.cxx index 0ddecd7e6788..90cc8e220fba 100644 --- a/desktop/source/app/desktopresid.cxx +++ b/desktop/source/app/desktopresid.cxx @@ -2,13 +2,10 @@ * * 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: desktopresid.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/desktopresid.hxx b/desktop/source/app/desktopresid.hxx index ad627ef316dd..410ca429f5ad 100644 --- a/desktop/source/app/desktopresid.hxx +++ b/desktop/source/app/desktopresid.hxx @@ -2,13 +2,10 @@ * * 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: desktopresid.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index c1dd167ea39a..db7f3c45964f 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -2,13 +2,10 @@ * * 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: dispatchwatcher.cxx,v $ - * $Revision: 1.30 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/dispatchwatcher.hxx b/desktop/source/app/dispatchwatcher.hxx index 364933ffe962..2b3f1ab54680 100644 --- a/desktop/source/app/dispatchwatcher.hxx +++ b/desktop/source/app/dispatchwatcher.hxx @@ -2,13 +2,10 @@ * * 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: dispatchwatcher.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/langselect.cxx b/desktop/source/app/langselect.cxx index e8b50cdd295e..5e2145b03729 100644 --- a/desktop/source/app/langselect.cxx +++ b/desktop/source/app/langselect.cxx @@ -2,13 +2,10 @@ * * 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: langselect.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,15 +30,14 @@ #include "app.hxx" #include "langselect.hxx" +#include "cmdlineargs.hxx" #include <stdio.h> -#ifndef _RTL_STRING_HXX #include <rtl/string.hxx> -#endif -#ifndef _SVTOOLS_PATHOPTIONS_HXX +#include <rtl/bootstrap.hxx> #include <unotools/pathoptions.hxx> -#endif #include <tools/resid.hxx> +#include <tools/config.hxx> #include <i18npool/mslangid.hxx> #include <comphelper/processfactory.hxx> #include <com/sun/star/container/XNameAccess.hpp> @@ -55,6 +51,7 @@ #include <rtl/locale.hxx> #include <rtl/instance.hxx> #include <osl/process.h> +#include <osl/file.hxx> using namespace rtl; using namespace com::sun::star::uno; @@ -65,10 +62,54 @@ using namespace com::sun::star::util; namespace desktop { +static char const SOFFICE_BOOTSTRAP[] = "Bootstrap"; +static char const SOFFICE_STARTLANG[] = "STARTLANG"; sal_Bool LanguageSelection::bFoundLanguage = sal_False; OUString LanguageSelection::aFoundLanguage; const OUString LanguageSelection::usFallbackLanguage = OUString::createFromAscii("en-US"); + +static sal_Bool existsURL( OUString const& sURL ) +{ + using namespace osl; + DirectoryItem aDirItem; + + if (sURL.getLength() != 0) + return ( DirectoryItem::get( sURL, aDirItem ) == DirectoryItem::E_None ); + + return sal_False; +} + +// locate soffice.ini/.rc file +static OUString locateSofficeIniFile() +{ + OUString aUserDataPath; + OUString aSofficeIniFileURL; + + // Retrieve the default file URL for the soffice.ini/rc + rtl::Bootstrap().getIniName( aSofficeIniFileURL ); + + if ( utl::Bootstrap::locateUserData( aUserDataPath ) == utl::Bootstrap::PATH_EXISTS ) + { + const char CONFIG_DIR[] = "/config"; + + sal_Int32 nIndex = aSofficeIniFileURL.lastIndexOf( '/'); + if ( nIndex > 0 ) + { + OUString aUserSofficeIniFileURL; + OUStringBuffer aBuffer( aUserDataPath ); + aBuffer.appendAscii( CONFIG_DIR ); + aBuffer.append( aSofficeIniFileURL.copy( nIndex )); + aUserSofficeIniFileURL = aBuffer.makeStringAndClear(); + + if ( existsURL( aUserSofficeIniFileURL )) + return aUserSofficeIniFileURL; + } + } + // Fallback try to use the soffice.ini/rc from program folder + return aSofficeIniFileURL; +} + Locale LanguageSelection::IsoStringToLocale(const OUString& str) { Locale l; @@ -122,8 +163,51 @@ bool LanguageSelection::prepareLanguage() catch (Exception&) { } + // get the selected UI language as string - OUString aLocaleString = getLanguageString(); + bool bCmdLanguage( false ); + bool bIniLanguage( false ); + OUString aEmpty; + OUString aLocaleString = getUserUILanguage(); + + if ( aLocaleString.getLength() == 0 ) + { + CommandLineArgs* pCmdLineArgs = Desktop::GetCommandLineArgs(); + if ( pCmdLineArgs ) + { + pCmdLineArgs->GetLanguage(aLocaleString); + if (isInstalledLanguage(aLocaleString, sal_False)) + { + bCmdLanguage = true; + bFoundLanguage = true; + aFoundLanguage = aLocaleString; + } + else + aLocaleString = aEmpty; + } + + if ( !bCmdLanguage ) + { + OUString aSOfficeIniURL = locateSofficeIniFile(); + Config aConfig(aSOfficeIniURL); + aConfig.SetGroup( SOFFICE_BOOTSTRAP ); + OString sLang = aConfig.ReadKey( SOFFICE_STARTLANG ); + aLocaleString = OUString( sLang.getStr(), sLang.getLength(), RTL_TEXTENCODING_ASCII_US ); + if (isInstalledLanguage(aLocaleString, sal_False)) + { + bIniLanguage = true; + bFoundLanguage = true; + aFoundLanguage = aLocaleString; + } + else + aLocaleString = aEmpty; + } + } + + // user further fallbacks for the UI language + if ( aLocaleString.getLength() == 0 ) + aLocaleString = getLanguageString(); + if ( aLocaleString.getLength() > 0 ) { try @@ -140,8 +224,20 @@ bool LanguageSelection::prepareLanguage() theConfigProvider->setLocale(loc); Reference< XPropertySet > xProp(getConfigAccess("org.openoffice.Setup/L10N/", sal_True), UNO_QUERY_THROW); - xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); - Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + if ( !bCmdLanguage ) + { + // Store language only + xProp->setPropertyValue(OUString::createFromAscii("ooLocale"), makeAny(aLocaleString)); + Reference< XChangesBatch >(xProp, UNO_QUERY_THROW)->commitChanges(); + } + + if ( bIniLanguage ) + { + // Store language only + Reference< XPropertySet > xProp2(getConfigAccess("org.openoffice.Office.Linguistic/General/", sal_True), UNO_QUERY_THROW); + xProp2->setPropertyValue(OUString::createFromAscii("UILocale"), makeAny(aLocaleString)); + Reference< XChangesBatch >(xProp2, UNO_QUERY_THROW)->commitChanges(); + } MsLangId::setConfiguredSystemUILanguage( MsLangId::convertLocaleToLanguage(loc) ); @@ -149,7 +245,7 @@ bool LanguageSelection::prepareLanguage() xProp->getPropertyValue(OUString::createFromAscii("ooSetupSystemLocale")) >>= sLocale; if ( sLocale.getLength() ) { - loc = LanguageSelection::IsoStringToLocale(aLocaleString); + loc = LanguageSelection::IsoStringToLocale(sLocale); MsLangId::setConfiguredSystemLanguage( MsLangId::convertLocaleToLanguage(loc) ); } else @@ -200,11 +296,8 @@ void LanguageSelection::setDefaultLanguage(const OUString& sLocale) } } -OUString LanguageSelection::getLanguageString() +OUString LanguageSelection::getUserUILanguage() { - // did we already find a language? - if (bFoundLanguage) - return aFoundLanguage; // check whether the user has selected a specific language OUString aUserLanguage = getUserLanguage(); if (aUserLanguage.getLength() > 0 ) @@ -222,6 +315,21 @@ OUString LanguageSelection::getLanguageString() resetUserLanguage(); } } + + return aUserLanguage; +} + +OUString LanguageSelection::getLanguageString() +{ + // did we already find a language? + if (bFoundLanguage) + return aFoundLanguage; + + // check whether the user has selected a specific language + OUString aUserLanguage = getUserUILanguage(); + if (aUserLanguage.getLength() > 0 ) + return aUserLanguage ; + // try to use system default aUserLanguage = getSystemLanguage(); if (aUserLanguage.getLength() > 0 ) diff --git a/desktop/source/app/langselect.hxx b/desktop/source/app/langselect.hxx index e9753ae4ab73..60308164690f 100644 --- a/desktop/source/app/langselect.hxx +++ b/desktop/source/app/langselect.hxx @@ -2,13 +2,10 @@ * * 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: langselect.hxx,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -53,6 +50,7 @@ private: static com::sun::star::uno::Sequence< rtl::OUString > getInstalledLanguages(); static sal_Bool isInstalledLanguage(rtl::OUString& usLocale, sal_Bool bExact=sal_False); static rtl::OUString getFirstInstalledLanguage(); + static rtl::OUString getUserUILanguage(); static rtl::OUString getUserLanguage(); static rtl::OUString getSystemLanguage(); static void resetUserLanguage(); diff --git a/desktop/source/app/lockfile.cxx b/desktop/source/app/lockfile.cxx index 5d6b4258d44c..9cc447a6c56b 100644 --- a/desktop/source/app/lockfile.cxx +++ b/desktop/source/app/lockfile.cxx @@ -2,13 +2,10 @@ * * 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: lockfile.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/lockfile.hxx b/desktop/source/app/lockfile.hxx index 74979f2beec8..248e44c52160 100644 --- a/desktop/source/app/lockfile.hxx +++ b/desktop/source/app/lockfile.hxx @@ -2,13 +2,10 @@ * * 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: lockfile.hxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/lockfile2.cxx b/desktop/source/app/lockfile2.cxx index 1004e4b36142..c155d9e6a3cd 100644 --- a/desktop/source/app/lockfile2.cxx +++ b/desktop/source/app/lockfile2.cxx @@ -2,13 +2,10 @@ * * 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: lockfile2.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/main.c b/desktop/source/app/main.c index 30892d7c7ade..dceaf1a3fba1 100644 --- a/desktop/source/app/main.c +++ b/desktop/source/app/main.c @@ -2,13 +2,10 @@ * * 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: main.c,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/makefile.mk b/desktop/source/app/makefile.mk index ffaf68c0fbad..d9db7c163481 100644 --- a/desktop/source/app/makefile.mk +++ b/desktop/source/app/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.42.40.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 6777bbd52fe6..fc74c3fb4504 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -2,13 +2,10 @@ * * 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: officeipcthread.cxx,v $ - * $Revision: 1.62.44.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/officeipcthread.hxx b/desktop/source/app/officeipcthread.hxx index 0b78eb5ff5a0..2cbcab0fce2a 100644 --- a/desktop/source/app/officeipcthread.hxx +++ b/desktop/source/app/officeipcthread.hxx @@ -2,13 +2,10 @@ * * 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: officeipcthread.hxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/omutexmember.hxx b/desktop/source/app/omutexmember.hxx index 35294b361145..1edb90fec8c6 100644 --- a/desktop/source/app/omutexmember.hxx +++ b/desktop/source/app/omutexmember.hxx @@ -2,13 +2,10 @@ * * 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: omutexmember.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 48807151da2e..fc06850f237a 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -2,13 +2,10 @@ * * 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: sofficemain.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/sofficemain.h b/desktop/source/app/sofficemain.h index 867bf06ff51e..97775acd7016 100644 --- a/desktop/source/app/sofficemain.h +++ b/desktop/source/app/sofficemain.h @@ -2,13 +2,10 @@ * * 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: sofficemain.h,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/userinstall.cxx b/desktop/source/app/userinstall.cxx index ccdeadbd7c53..546a6f0ad13c 100644 --- a/desktop/source/app/userinstall.cxx +++ b/desktop/source/app/userinstall.cxx @@ -2,13 +2,10 @@ * * 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: userinstall.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -246,7 +243,7 @@ namespace desktop { return UserInstall::E_InvalidBaseinstall; // create the user directory - FileBase::RC rc = Directory::create(aUserPath); + FileBase::RC rc = Directory::createPath(aUserPath); if ((rc != FileBase::E_None) && (rc != FileBase::E_EXIST)) return UserInstall::E_Creation; // copy data from shared data directory of base installation diff --git a/desktop/source/app/userinstall.hxx b/desktop/source/app/userinstall.hxx index 377aa54a2763..8d6a51cd66be 100644 --- a/desktop/source/app/userinstall.hxx +++ b/desktop/source/app/userinstall.hxx @@ -2,13 +2,10 @@ * * 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: userinstall.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/app/version.map b/desktop/source/app/version.map index 24da5bbb53c2..0ffffcd58635 100644 --- a/desktop/source/app/version.map +++ b/desktop/source/app/version.map @@ -2,14 +2,10 @@ # # 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: version.map,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +25,7 @@ # #************************************************************************* -soffice.3 { +UDK_3_0_0 { global: soffice_main; diff --git a/desktop/source/deployment/deployment.map b/desktop/source/deployment/deployment.map deleted file mode 100644 index 563b3d86a5d0..000000000000 --- a/desktop/source/deployment/deployment.map +++ /dev/null @@ -1,8 +0,0 @@ -UDK_3_1_0 { - global: - component_getImplementationEnvironment; - component_writeInfo; - component_getFactory; - local: - *; -}; diff --git a/desktop/source/deployment/dp_log.cxx b/desktop/source/deployment/dp_log.cxx index d83ee8602204..44c5e1efd4ed 100644 --- a/desktop/source/deployment/dp_log.cxx +++ b/desktop/source/deployment/dp_log.cxx @@ -2,13 +2,10 @@ * * 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_log.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/dp_persmap.cxx b/desktop/source/deployment/dp_persmap.cxx index 75005b728465..d93c5a52c782 100644 --- a/desktop/source/deployment/dp_persmap.cxx +++ b/desktop/source/deployment/dp_persmap.cxx @@ -2,13 +2,10 @@ * * 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_persmap.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -81,19 +78,6 @@ PersistentMap::~PersistentMap() } //______________________________________________________________________________ -void PersistentMap::flush() const -{ - try { - int err = m_db.sync(0); - if (err != 0) - throw_rtexc(err); - } - catch (DbException & exc) { - throw_rtexc( exc.get_errno(), exc.what() ); - } -} - -//______________________________________________________________________________ PersistentMap::PersistentMap( OUString const & url_, bool readOnly ) : m_db( 0, 0 ) { diff --git a/desktop/source/deployment/dp_services.cxx b/desktop/source/deployment/dp_services.cxx index c98522a168df..c83a62bfd17e 100644 --- a/desktop/source/deployment/dp_services.cxx +++ b/desktop/source/deployment/dp_services.cxx @@ -2,13 +2,10 @@ * * 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_services.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/dp_xml.cxx b/desktop/source/deployment/dp_xml.cxx index 8ed30ccc9066..0453ab8372c0 100644 --- a/desktop/source/deployment/dp_xml.cxx +++ b/desktop/source/deployment/dp_xml.cxx @@ -2,13 +2,10 @@ * * 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_xml.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/descedit.cxx b/desktop/source/deployment/gui/descedit.cxx index f38f80f27620..5df203c60fc9 100644 --- a/desktop/source/deployment/gui/descedit.cxx +++ b/desktop/source/deployment/gui/descedit.cxx @@ -2,13 +2,10 @@ * * 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: descedit.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/descedit.hxx b/desktop/source/deployment/gui/descedit.hxx index 8afd5a561bd6..023551ac360d 100644 --- a/desktop/source/deployment/gui/descedit.hxx +++ b/desktop/source/deployment/gui/descedit.hxx @@ -2,13 +2,10 @@ * * 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: descedit.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui.h b/desktop/source/deployment/gui/dp_gui.h index 7f2cb7a9626a..85e6eaef3544 100644 --- a/desktop/source/deployment/gui/dp_gui.h +++ b/desktop/source/deployment/gui/dp_gui.h @@ -2,13 +2,10 @@ * * 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_gui.h,v $ - * $Revision: 1.24.86.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -33,7 +30,6 @@ #include "dp_gui_updatedata.hxx" #include "dp_misc.h" -#include "dp_gui_updatability.hxx" #include "dp_gui.hrc" #include "rtl/ref.hxx" #include "rtl/instance.hxx" diff --git a/desktop/source/deployment/gui/dp_gui.hrc b/desktop/source/deployment/gui/dp_gui.hrc index 387072c98618..8da4db5ca74f 100644 --- a/desktop/source/deployment/gui/dp_gui.hrc +++ b/desktop/source/deployment/gui/dp_gui.hrc @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx b/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx index 9a0b76773f27..ce69797db0a8 100644 --- a/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx +++ b/desktop/source/deployment/gui/dp_gui_autoscrolledit.cxx @@ -2,13 +2,10 @@ * * 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_gui_autoscrolledit.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_autoscrolledit.hxx b/desktop/source/deployment/gui/dp_gui_autoscrolledit.hxx index 3353bd42f04d..421b00517998 100644 --- a/desktop/source/deployment/gui/dp_gui_autoscrolledit.hxx +++ b/desktop/source/deployment/gui/dp_gui_autoscrolledit.hxx @@ -2,13 +2,10 @@ * * 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_gui_autoscrolledit.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_backend.src b/desktop/source/deployment/gui/dp_gui_backend.src index 18c44fdf6e46..4d554ab4ded9 100644 --- a/desktop/source/deployment/gui/dp_gui_backend.src +++ b/desktop/source/deployment/gui/dp_gui_backend.src @@ -2,13 +2,10 @@ * * 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_gui_backend.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx index 2e8b64dd237d..4c5dfdfc89d4 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.cxx @@ -2,13 +2,10 @@ * * 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_gui_dependencydialog.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx index 7030ea68ffd5..98cb7de7a04f 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.hxx @@ -2,13 +2,10 @@ * * 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_gui_dependencydialog.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_dependencydialog.src b/desktop/source/deployment/gui/dp_gui_dependencydialog.src index dc03e75f4291..fa7465678326 100644 --- a/desktop/source/deployment/gui/dp_gui_dependencydialog.src +++ b/desktop/source/deployment/gui/dp_gui_dependencydialog.src @@ -2,13 +2,10 @@ * * 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_gui_dependencydialog.src,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_dialog.src b/desktop/source/deployment/gui/dp_gui_dialog.src index e7c785c86973..79c0c5172030 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog.src +++ b/desktop/source/deployment/gui/dp_gui_dialog.src @@ -2,13 +2,10 @@ * * 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_gui_dialog.src,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index b2620703a44a..2d0733dfbae3 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -2,14 +2,10 @@ * * 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_gui_dialog2.cxx,v $ - * - * $Revision: 1.8.4.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -94,8 +90,7 @@ using ::rtl::OUString; namespace dp_gui { -#define ICON_OFFSET 50 -#define TOP_OFFSET 3 +#define TOP_OFFSET 5 #define LINE_SIZE 4 #define PROGRESS_WIDTH 60 #define PROGRESS_HEIGHT 14 @@ -769,12 +764,6 @@ ExtMgrDialog::~ExtMgrDialog() } //------------------------------------------------------------------------------ -void ExtMgrDialog::selectEntry( long nPos ) -{ - m_pExtensionBox->selectEntry( nPos ); -} - -//------------------------------------------------------------------------------ void ExtMgrDialog::setGetExtensionsURL( const ::rtl::OUString &rURL ) { m_aGetExtensions.SetURL( rURL ); diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.hxx b/desktop/source/deployment/gui/dp_gui_dialog2.hxx index 7536aa403cfe..d5e939ace8a9 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.hxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.hxx @@ -2,14 +2,10 @@ * * 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_gui_dialog2.hxx,v $ - * - * $Revision: 1.4.74.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -163,7 +159,6 @@ public: virtual void updatePackageInfo( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); void setGetExtensionsURL( const ::rtl::OUString &rURL ); - void selectEntry( long nPos ); virtual long addPackageToList( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &, const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > & ); bool enablePackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.src b/desktop/source/deployment/gui/dp_gui_dialog2.src index 7e4004bca1d4..d55421d50d75 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.src +++ b/desktop/source/deployment/gui/dp_gui_dialog2.src @@ -2,14 +2,10 @@ * * 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_gui_dialog2.src,v $ - * - * $Revision: 1.2.86.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 889fdc04c9e1..58a5ab1c19ea 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -2,14 +2,10 @@ * * 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_gui_extensioncmdqueue.cxx,v $ - * - * $Revision: 1.7.4.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -252,7 +248,6 @@ public: const bool bEnable ); void checkForUpdates( const std::vector< TUpdateListEntry > &vExtensionList ); void stop(); - bool hasTerminated(); bool isBusy(); static OUString searchAndReplaceAll( const OUString &rSource, @@ -745,13 +740,6 @@ void ExtensionCmdQueue::Thread::stop() } //------------------------------------------------------------------------------ -bool ExtensionCmdQueue::Thread::hasTerminated() -{ - osl::MutexGuard aGuard( m_mutex ); - return m_bTerminated; -} - -//------------------------------------------------------------------------------ bool ExtensionCmdQueue::Thread::isBusy() { osl::MutexGuard aGuard( m_mutex ); @@ -1161,17 +1149,6 @@ void ExtensionCmdQueue::stop() m_thread->stop(); } -void ExtensionCmdQueue::stopAndWait() -{ - m_thread->stop(); - m_thread->join(); -} - -bool ExtensionCmdQueue::hasTerminated() -{ - return m_thread->hasTerminated(); -} - bool ExtensionCmdQueue::isBusy() { return m_thread->isBusy(); diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx index 2d24f00e3c8e..f984c71c6c1c 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.hxx @@ -2,14 +2,10 @@ * * 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_gui_extensioncmdqueue.hxx,v $ - * - * $Revision: 1.3.14.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -96,14 +92,6 @@ public: */ void stop(); - /** Determines if thread of this class has terminated. - */ - bool hasTerminated(); - - /** Blocks until the thread has terminated. All URLs in the queue will be processed. - */ - void stopAndWait(); - bool isBusy(); private: ExtensionCmdQueue(ExtensionCmdQueue &); // not defined diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx index 36f08dbf5b32..2e02a90f59fd 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx @@ -1,1175 +1,1175 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2009 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_desktop.hxx"
-
-#include "svtools/controldims.hrc"
-
-#include "dp_gui.h"
-#include "dp_gui_extlistbox.hxx"
-#include "dp_gui_theextmgr.hxx"
-#include "dp_gui_dialog2.hxx"
-#include "dp_dependencies.hxx"
-
-#include "comphelper/processfactory.hxx"
-#include "com/sun/star/i18n/CollatorOptions.hpp"
-#include "com/sun/star/deployment/DependencyException.hpp"
-#include "com/sun/star/deployment/DeploymentException.hpp"
-
-
-#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) )
-
-using namespace ::com::sun::star;
-
-namespace dp_gui {
-
-//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager,
- PackageState eState ) :
- m_bActive( false ),
- m_bLocked( false ),
- m_bHasOptions( false ),
- m_bShared( false ),
- m_bNew( false ),
- m_bChecked( false ),
- m_bMissingDeps( false ),
- m_eState( eState ),
- m_pPublisher( NULL ),
- m_xPackage( xPackage ),
- m_xPackageManager( xPackageManager )
-{
- m_sTitle = xPackage->getDisplayName();
- m_sVersion = xPackage->getVersion();
- m_sDescription = xPackage->getDescription();
-
- beans::StringPair aInfo( m_xPackage->getPublisherInfo() );
- m_sPublisher = aInfo.First;
- m_sPublisherURL = aInfo.Second;
-
- // get the icons for the package if there are any
- uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false );
- if ( xGraphic.is() )
- m_aIcon = Image( xGraphic );
-
- xGraphic = xPackage->getIcon( true );
- if ( xGraphic.is() )
- m_aIconHC = Image( xGraphic );
- else
- m_aIconHC = m_aIcon;
-
- m_bLocked = m_xPackageManager->isReadOnly();
-
- if ( eState == AMBIGUOUS )
- m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else if ( eState == NOT_REGISTERED )
- checkDependencies();
-}
-
-//------------------------------------------------------------------------------
-Entry_Impl::~Entry_Impl()
-{}
-
-//------------------------------------------------------------------------------
-StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const
-{
- StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle );
- if ( eCompare == COMPARE_EQUAL )
- {
- eCompare = m_sVersion.CompareTo( pEntry->m_sVersion );
- if ( eCompare == COMPARE_EQUAL )
- {
- if ( m_xPackageManager != pEntry->m_xPackageManager )
- {
- sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() );
- if ( nCompare < 0 )
- eCompare = COMPARE_LESS;
- else if ( nCompare > 0 )
- eCompare = COMPARE_GREATER;
- }
- }
- }
- return eCompare;
-}
-
-//------------------------------------------------------------------------------
-void Entry_Impl::checkDependencies()
-{
- try {
- m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() );
- }
- catch ( deployment::DeploymentException &e )
- {
- deployment::DependencyException depExc;
- if ( e.Cause >>= depExc )
- {
- rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) );
- for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i )
- {
- aMissingDep += OUSTR("\n");
- aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]);
- }
- aMissingDep += OUSTR("\n");
- m_sErrorText = aMissingDep;
- m_bMissingDeps = true;
- }
- }
-}
-//------------------------------------------------------------------------------
-// ExtensionRemovedListener
-//------------------------------------------------------------------------------
-void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt )
- throw ( uno::RuntimeException )
-{
- uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY );
-
- if ( xPackage.is() )
- {
- m_pParent->removeEntry( xPackage );
- }
-}
-
-//------------------------------------------------------------------------------
-ExtensionRemovedListener::~ExtensionRemovedListener()
-{
-}
-
-//------------------------------------------------------------------------------
-// ExtensionBox_Impl
-//------------------------------------------------------------------------------
-ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) :
- IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ),
- m_bHasScrollBar( false ),
- m_bHasActive( false ),
- m_bNeedsRecalc( true ),
- m_bHasNew( false ),
- m_bInCheckMode( false ),
- m_bAdjustActive( false ),
- m_bInDelete( false ),
- m_nActive( 0 ),
- m_nTopIndex( 0 ),
- m_nActiveHeight( 0 ),
- m_nExtraHeight( 2 ),
- m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ),
- m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ),
- m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ),
- m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ),
- m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ),
- m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ),
- m_pScrollBar( NULL ),
- m_pManager( pManager )
-{
- SetHelpId( HID_EXTENSION_MANAGER_LISTBOX );
-
- m_pScrollBar = new ScrollBar( this, WB_VERT );
- m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) );
- m_pScrollBar->EnableDrag();
-
- SetPaintTransparent( true );
- SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) );
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- m_nStdHeight = nTitleHeight;
- else
- m_nStdHeight = nIconHeight;
- m_nStdHeight += GetTextHeight() + TOP_OFFSET;
-
- nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1;
- if ( m_nStdHeight < nIconHeight )
- m_nStdHeight = nIconHeight;
-
- m_nActiveHeight = m_nStdHeight;
-
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- m_xRemoveListener = new ExtensionRemovedListener( this );
-
- m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() );
- m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() );
- m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE );
-
- Show();
-}
-
-//------------------------------------------------------------------------------
-ExtensionBox_Impl::~ExtensionBox_Impl()
-{
- if ( ! m_bInDelete )
- DeleteRemoved();
-
- m_bInDelete = true;
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
- (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
- }
-
- m_vEntries.clear();
-
- delete m_pScrollBar;
-
- m_xRemoveListener.clear();
-
- delete m_pLocale;
- delete m_pCollator;
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getItemCount() const
-{
- return static_cast< sal_Int32 >( m_vEntries.size() );
-}
-
-//------------------------------------------------------------------------------
-sal_Int32 ExtensionBox_Impl::getSelIndex() const
-{
- if ( m_bHasActive )
- {
- OSL_ASSERT( m_nActive >= -1);
- return static_cast< sal_Int32 >( m_nActive );
- }
- else
- return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const
-{
- if ( nIndex < 0 )
- throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 );
- if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size())
- throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position."
- "The position exceeds the number of available list entries"),0, 0 );
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sTitle;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sVersion;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sDescription;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisher;
-}
-
-//------------------------------------------------------------------------------
-rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- return m_vEntries[ nIndex ]->m_sPublisherURL;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( sal_Int32 nIndex )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- checkIndex( nIndex );
- selectEntry( nIndex );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::select( const rtl::OUString & sName )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
- typedef ::std::vector< TEntry_Impl >::const_iterator It;
-
- for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ )
- {
- if ( sName.equals( (*iIter)->m_sTitle ) )
- {
- long nPos = iIter - m_vEntries.begin();
- selectEntry( nPos );
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-//------------------------------------------------------------------------------
-// Title + description
-void ExtensionBox_Impl::CalcActiveHeight( const long nPos )
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- // get title height
- long aTextHeight;
- long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = 2*TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // calc description height
- Size aSize = GetOutputSizePixel();
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- aSize.Width() -= ICON_OFFSET;
- aSize.Height() = 10000;
-
- rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText );
- aText += m_vEntries[ nPos ]->m_sDescription;
-
- Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText,
- TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- aTextHeight += aRect.GetHeight();
-
- if ( aTextHeight < m_nStdHeight )
- aTextHeight = m_nStdHeight;
-
- m_nActiveHeight = aTextHeight + m_nExtraHeight;
-}
-
-//------------------------------------------------------------------------------
-const Size ExtensionBox_Impl::GetMinOutputSizePixel() const
-{
- return Size( 200, 80 );
-}
-
-//------------------------------------------------------------------------------
-Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- if ( m_vEntries[ nPos ]->m_bActive )
- aSize.Height() = m_nActiveHeight;
- else
- aSize.Height() = m_nStdHeight;
-
- Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight );
- if ( m_bHasActive && ( nPos < m_nActive ) )
- aPos.Y() += m_nActiveHeight - m_nStdHeight;
-
- return Rectangle( aPos, aSize );
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::DeleteRemoved()
-{
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- m_bInDelete = true;
-
- if ( ! m_vRemovedEntries.empty() )
- {
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_pPublisher )
- {
- delete (*iIndex)->m_pPublisher;
- (*iIndex)->m_pPublisher = NULL;
- }
- }
-
- m_vRemovedEntries.clear();
- }
-
- m_bInDelete = false;
-}
-
-//------------------------------------------------------------------------------
-//This function may be called with nPos < 0
-void ExtensionBox_Impl::selectEntry( const long nPos )
-{
- //ToDo whe should not use the guard at such a big scope here.
- //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be
- //modified in this function.
- //It would be probably best to always use a copy of m_vEntries
- //and some other state variables from ExtensionBox_Impl for
- //the whole painting operation. See issue i86993
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
-
- if ( m_bInCheckMode )
- return;
-
- if ( m_bHasActive )
- {
- if ( nPos == m_nActive )
- return;
-
- m_bHasActive = false;
- m_vEntries[ m_nActive ]->m_bActive = false;
- }
-
- if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) )
- {
- m_bHasActive = true;
- m_nActive = nPos;
- m_vEntries[ nPos ]->m_bActive = true;
-
- if ( IsReallyVisible() )
- {
- m_bNeedsRecalc = true;
- m_bAdjustActive = true;
- }
- }
-
- if ( IsReallyVisible() )
- Invalidate();
-
- guard.clear();
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry )
-{
- const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
-
- if ( pEntry->m_bActive )
- SetTextColor( rStyleSettings.GetHighlightTextColor() );
- else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) )
- SetTextColor( rStyleSettings.GetDisableColor() );
- else if ( IsControlForeground() )
- SetTextColor( GetControlForeground() );
- else
- SetTextColor( rStyleSettings.GetFieldTextColor() );
-
- if ( pEntry->m_bActive )
- {
- SetLineColor();
- SetFillColor( rStyleSettings.GetHighlightColor() );
- DrawRect( rRect );
- }
- else
- {
- if( IsControlBackground() )
- SetBackground( GetControlBackground() );
- else
- SetBackground( rStyleSettings.GetFieldColor() );
-
- SetTextFillColor();
- Erase( rRect );
- }
-
- // Draw extension icon
- Point aPos( rRect.TopLeft() );
- aPos += Point( TOP_OFFSET, TOP_OFFSET );
- Image aImage;
- if ( ! pEntry->m_aIcon )
- aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage;
- else
- aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon;
- Size aImageSize = aImage.GetSizePixel();
- if ( ( aImageSize.Width() <= ICON_HEIGHT ) && ( aImageSize.Height() <= ICON_HEIGHT ) )
- DrawImage( Point( aPos.X()+((ICON_HEIGHT-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage );
- else
- DrawImage( aPos, Size( ICON_HEIGHT, ICON_HEIGHT ), aImage );
-
- // Setup fonts
- Font aStdFont( GetFont() );
- Font aBoldFont( aStdFont );
- aBoldFont.SetWeight( WEIGHT_BOLD );
- SetFont( aBoldFont );
- long aTextHeight = GetTextHeight();
-
- // Init publisher link here
- if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() )
- {
- pEntry->m_pPublisher = new svt::FixedHyperlink( this );
- pEntry->m_pPublisher->SetBackground();
- pEntry->m_pPublisher->SetPaintTransparent( true );
- pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL );
- pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher );
- Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher );
- pEntry->m_pPublisher->SetSizePixel( aSize );
-
- if ( m_aClickHdl.IsSet() )
- pEntry->m_pPublisher->SetClickHdl( m_aClickHdl );
- }
-
- // Get max title width
- long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET;
- nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN );
- if ( pEntry->m_pPublisher )
- {
- nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN);
- }
-
- long aVersionWidth = GetTextWidth( pEntry->m_sVersion );
- long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3);
-
- aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET );
-
- if ( aTitleWidth > nMaxTitleWidth - aVersionWidth )
- {
- aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3);
- String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth );
- DrawText( aPos, aShortTitle );
- aTitleWidth += (aTextHeight / 3);
- }
- else
- DrawText( aPos, pEntry->m_sTitle );
-
- SetFont( aStdFont );
- DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion );
-
- long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE;
- long nTitleHeight = TOP_OFFSET + GetTextHeight();
- if ( nIconHeight < nTitleHeight )
- aTextHeight = nTitleHeight;
- else
- aTextHeight = nIconHeight;
-
- // draw description
- String sDescription;
- if ( pEntry->m_sErrorText.Len() )
- {
- if ( pEntry->m_bActive )
- sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription;
- else
- sDescription = pEntry->m_sErrorText;
- }
- else
- sDescription = pEntry->m_sDescription;
-
- aPos.Y() += aTextHeight;
- if ( pEntry->m_bActive )
- {
- DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ),
- sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK );
- }
- else
- {
- const long nWidth = GetTextWidth( sDescription );
- if ( nWidth > rRect.GetWidth() - aPos.X() )
- sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() );
- DrawText( aPos, sDescription );
- }
-
- // Draw publisher link
- if ( pEntry->m_pPublisher )
- {
- pEntry->m_pPublisher->Show();
- aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET );
- pEntry->m_pPublisher->SetPosPixel( aPos );
- }
-
- // Draw status icons
- if ( pEntry->m_bShared )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage );
- }
- if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps )
- {
- aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET );
- DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage );
- }
-
- SetLineColor( Color( COL_LIGHTGRAY ) );
- DrawLine( rRect.BottomLeft(), rRect.BottomRight() );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::RecalcAll()
-{
- if ( m_bHasActive )
- CalcActiveHeight( m_nActive );
-
- SetupScrollBar();
-
- if ( m_bHasActive )
- {
- Rectangle aEntryRect = GetEntryRect( m_nActive );
-
- if ( m_bAdjustActive )
- {
- m_bAdjustActive = false;
-
- // If the top of the selected entry isn't visible, make it visible
- if ( aEntryRect.Top() < 0 )
- {
- m_nTopIndex += aEntryRect.Top();
- aEntryRect.Move( 0, -aEntryRect.Top() );
- }
-
- // If the bottom of the selected entry isn't visible, make it visible even if now the top
- // isn't visible any longer ( the buttons are more important )
- Size aOutputSize = GetOutputSizePixel();
- if ( aEntryRect.Bottom() > aOutputSize.Height() )
- {
- m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() );
- aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) );
- }
-
- // If there is unused space below the last entry but all entries don't fit into the box,
- // move the content down to use the whole space
- const long nTotalHeight = GetTotalHeight();
- if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) )
- {
- long nOffset = m_nTopIndex;
- m_nTopIndex = nTotalHeight - aOutputSize.Height();
- nOffset -= m_nTopIndex;
- aEntryRect.Move( 0, nOffset );
- }
-
- if ( m_bHasScrollBar )
- m_pScrollBar->SetThumbPos( m_nTopIndex );
- }
- }
-
- m_bNeedsRecalc = false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleTabKey( bool )
-{
- return false;
-}
-
-// -----------------------------------------------------------------------
-bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode )
-{
- if ( m_vEntries.empty() )
- return true;
-
- long nSelect = 0;
-
- if ( m_bHasActive )
- {
- long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight;
- if ( nPageSize < 2 )
- nPageSize = 2;
-
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) )
- nSelect = m_nActive + 1;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) )
- nSelect = m_nActive - 1;
- else if ( nKeyCode == KEY_HOME )
- nSelect = 0;
- else if ( nKeyCode == KEY_END )
- nSelect = m_vEntries.size() - 1;
- else if ( nKeyCode == KEY_PAGEUP )
- nSelect = m_nActive - nPageSize + 1;
- else if ( nKeyCode == KEY_PAGEDOWN )
- nSelect = m_nActive + nPageSize - 1;
- }
- else // when there is no selected entry, we will select the first or the last.
- {
- if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) )
- nSelect = 0;
- else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) )
- nSelect = m_vEntries.size() - 1;
- }
-
- if ( nSelect < 0 )
- nSelect = 0;
- if ( nSelect >= (long) m_vEntries.size() )
- nSelect = m_vEntries.size() - 1;
-
- selectEntry( nSelect );
-
- return true;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ )
-{
- if ( !m_bInDelete )
- DeleteRemoved();
-
- if ( m_bNeedsRecalc )
- RecalcAll();
-
- Point aStart( 0, -m_nTopIndex );
- Size aSize( GetOutputSizePixel() );
-
- if ( m_bHasScrollBar )
- aSize.Width() -= m_pScrollBar->GetSizePixel().Width();
-
- const ::osl::MutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight;
- Rectangle aEntryRect( aStart, aSize );
- DrawRow( aEntryRect, *iIndex );
- aStart.Y() += aSize.Height();
- }
-}
-
-// -----------------------------------------------------------------------
-long ExtensionBox_Impl::GetTotalHeight() const
-{
- long nHeight = m_vEntries.size() * m_nStdHeight;
-
- if ( m_bHasActive )
- {
- nHeight += m_nActiveHeight - m_nStdHeight;
- }
-
- return nHeight;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::SetupScrollBar()
-{
- const Size aSize = GetOutputSizePixel();
- const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize();
- const long nTotalHeight = GetTotalHeight();
- const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() );
-
- if ( bNeedsScrollBar )
- {
- if ( m_nTopIndex + aSize.Height() > nTotalHeight )
- m_nTopIndex = nTotalHeight - aSize.Height();
-
- m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ),
- Size( nScrBarSize, aSize.Height() ) );
- m_pScrollBar->SetRangeMax( nTotalHeight );
- m_pScrollBar->SetVisibleSize( aSize.Height() );
- m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 );
- m_pScrollBar->SetLineSize( m_nStdHeight );
- m_pScrollBar->SetThumbPos( m_nTopIndex );
-
- if ( !m_bHasScrollBar )
- m_pScrollBar->Show();
- }
- else if ( m_bHasScrollBar )
- {
- m_pScrollBar->Hide();
- m_nTopIndex = 0;
- }
-
- m_bHasScrollBar = bNeedsScrollBar;
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::Resize()
-{
- RecalcAll();
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::PointToPos( const Point& rPos )
-{
- long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight;
-
- if ( m_bHasActive && ( nPos > m_nActive ) )
- {
- if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight )
- nPos = m_nActive;
- else
- nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight;
- }
-
- return nPos;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt )
-{
- long nPos = PointToPos( rMEvt.GetPosPixel() );
-
- if ( rMEvt.IsLeft() )
- {
- if ( rMEvt.IsMod1() && m_bHasActive )
- selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one
- else
- selectEntry( nPos );
- }
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt )
-{
- if ( !m_bInDelete )
- DeleteRemoved();
-
- bool bHandled = false;
-
- if ( rNEvt.GetType() == EVENT_KEYINPUT )
- {
- const KeyEvent* pKEvt = rNEvt.GetKeyEvent();
- KeyCode aKeyCode = pKEvt->GetKeyCode();
- USHORT nKeyCode = aKeyCode.GetCode();
-
- if ( nKeyCode == KEY_TAB )
- bHandled = HandleTabKey( aKeyCode.IsShift() );
- else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR )
- bHandled = HandleCursorKey( nKeyCode );
- }
-
- if ( rNEvt.GetType() == EVENT_COMMAND )
- {
- if ( m_bHasScrollBar &&
- ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) )
- {
- const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData();
- if ( pData->GetMode() == COMMAND_WHEEL_SCROLL )
- {
- long nThumbPos = m_pScrollBar->GetThumbPos();
- if ( pData->GetDelta() < 0 )
- m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight );
- else
- m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight );
- bHandled = true;
- }
- }
- }
-
- if ( !bHandled )
- return Control::Notify( rNEvt );
- else
- return true;
-}
-
-//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart,
- const long nEnd, long &nPos )
-{
- nPos = nStart;
- if ( nStart > nEnd )
- return false;
-
- StringCompare eCompare;
-
- if ( nStart == nEnd )
- {
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] );
- if ( eCompare == COMPARE_LESS )
- return false;
- else if ( eCompare == COMPARE_EQUAL )
- {
- //Workaround. See i86963.
- if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nStart ]->m_bChecked = true;
- return true;
- }
- else
- {
- nPos = nStart + 1;
- return false;
- }
- }
-
- const long nMid = nStart + ( ( nEnd - nStart ) / 2 );
- eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] );
-
- if ( eCompare == COMPARE_LESS )
- return FindEntryPos( pEntry, nStart, nMid-1, nPos );
- else if ( eCompare == COMPARE_GREATER )
- return FindEntryPos( pEntry, nMid+1, nEnd, nPos );
- else
- {
- //Workaround.See i86963.
- if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage)
- return false;
-
- if ( m_bInCheckMode )
- m_vEntries[ nMid ]->m_bChecked = true;
- nPos = nMid;
- return true;
- }
-}
-
-//------------------------------------------------------------------------------
-long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
- const uno::Reference< deployment::XPackageManager > &xPackageManager )
-{
- long nPos = 0;
- PackageState eState = m_pManager->getPackageState( xPackage );
-
- TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) );
- xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) );
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- if ( m_vEntries.empty() )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.push_back( pEntry );
- }
- else
- {
- if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) )
- {
- pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager );
- pEntry->m_bNew = m_bInCheckMode;
- m_vEntries.insert( m_vEntries.begin()+nPos, pEntry );
- }
- else if ( !m_bInCheckMode )
- {
- OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" );
- }
- }
- //access to m_nActive must be guarded
- if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) )
- m_nActive += 1;
-
- guard.clear();
-
- if ( IsReallyVisible() )
- Invalidate();
-
- m_bNeedsRecalc = true;
-
- return nPos;
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage )
-{
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- PackageState eState = m_pManager->getPackageState( xPackage );
- (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage );
- (*iIndex)->m_eState = eState;
- (*iIndex)->m_sTitle = xPackage->getDisplayName();
- (*iIndex)->m_sVersion = xPackage->getVersion();
- (*iIndex)->m_sDescription = xPackage->getDescription();
-
- if ( eState == AMBIGUOUS )
- (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS );
- else
- (*iIndex)->m_sErrorText = String();
-
- if ( IsReallyVisible() )
- Invalidate();
- break;
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage )
-{
- if ( ! m_bInDelete )
- {
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackage == xPackage )
- {
- long nPos = iIndex - m_vEntries.begin();
-
- // Entries mustn't removed here, because they contain a hyperlink control
- // which can only be deleted when the thread has the solar mutex. Therefor
- // the entry will be moved into the m_vRemovedEntries list which will be
- // cleared on the next paint event
- m_vRemovedEntries.push_back( *iIndex );
- m_vEntries.erase( iIndex );
-
- m_bNeedsRecalc = true;
-
- if ( IsReallyVisible() )
- Invalidate();
-
- if ( m_bHasActive )
- {
- if ( nPos < m_nActive )
- m_nActive -= 1;
- else if ( ( nPos == m_nActive ) &&
- ( nPos == (long) m_vEntries.size() ) )
- m_nActive -= 1;
-
- m_bHasActive = false;
- //clear before calling out of this method
- aGuard.clear();
- selectEntry( m_nActive );
- }
- break;
- }
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::RemoveUnlocked()
-{
- bool bAllRemoved = false;
-
- while ( ! bAllRemoved )
- {
- bAllRemoved = true;
-
- ::osl::ClearableMutexGuard aGuard( m_entriesMutex );
-
- typedef std::vector< TEntry_Impl >::iterator ITER;
-
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( !(*iIndex)->m_bLocked )
- {
- bAllRemoved = false;
- uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage;
- aGuard.clear();
- removeEntry( xPackage );
- break;
- }
- }
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr )
-{
- m_bInCheckMode = true;
- typedef std::vector< TEntry_Impl >::iterator ITER;
- for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex )
- {
- if ( (*iIndex)->m_xPackageManager == xPackageMgr )
- (*iIndex)->m_bChecked = false;
- else
- (*iIndex)->m_bChecked = true;
- (*iIndex)->m_bNew = false;
- }
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::checkEntries()
-{
- long nNewPos = -1;
- long nPos = 0;
- bool bNeedsUpdate = false;
-
- ::osl::ClearableMutexGuard guard(m_entriesMutex);
- typedef std::vector< TEntry_Impl >::iterator ITER;
- ITER iIndex = m_vEntries.begin();
- while ( iIndex < m_vEntries.end() )
- {
- if ( (*iIndex)->m_bChecked == false )
- {
- bNeedsUpdate = true;
- nPos = iIndex-m_vEntries.begin();
- if ( (*iIndex)->m_bNew )
- {
- if ( nNewPos == - 1)
- nNewPos = nPos;
- if ( nPos <= m_nActive )
- m_nActive += 1;
- }
- }
- iIndex++;
- }
- guard.clear();
-
- m_bInCheckMode = false;
-
- if ( nNewPos != - 1)
- selectEntry( nNewPos );
-
- if ( bNeedsUpdate )
- {
- m_bNeedsRecalc = true;
- if ( IsReallyVisible() )
- Invalidate();
- }
-}
-//------------------------------------------------------------------------------
-bool ExtensionBox_Impl::isHCMode()
-{
- return (bool)GetSettings().GetStyleSettings().GetHighContrastMode();
-}
-
-//------------------------------------------------------------------------------
-void ExtensionBox_Impl::SetScrollHdl( const Link& rLink )
-{
- if ( m_pScrollBar )
- m_pScrollBar->SetScrollHdl( rLink );
-}
-
-// -----------------------------------------------------------------------
-void ExtensionBox_Impl::DoScroll( long nDelta )
-{
- m_nTopIndex += nDelta;
- Point aNewSBPt( m_pScrollBar->GetPosPixel() );
-
- Rectangle aScrRect( Point(), GetOutputSizePixel() );
- aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width();
- Scroll( 0, -nDelta, aScrRect );
-
- m_pScrollBar->SetPosPixel( aNewSBPt );
-}
-
-// -----------------------------------------------------------------------
-IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar )
-{
- DoScroll( pScrBar->GetDelta() );
-
- return 1;
-}
-
-} //namespace dp_gui
+/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "svtools/controldims.hrc" + +#include "dp_gui.h" +#include "dp_gui_extlistbox.hxx" +#include "dp_gui_theextmgr.hxx" +#include "dp_gui_dialog2.hxx" +#include "dp_dependencies.hxx" + +#include "comphelper/processfactory.hxx" +#include "com/sun/star/i18n/CollatorOptions.hpp" +#include "com/sun/star/deployment/DependencyException.hpp" +#include "com/sun/star/deployment/DeploymentException.hpp" + + +#define OUSTR(x) ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(x) ) + +using namespace ::com::sun::star; + +namespace dp_gui { + +//------------------------------------------------------------------------------ +// struct Entry_Impl +//------------------------------------------------------------------------------ +Entry_Impl::Entry_Impl( const uno::Reference< deployment::XPackage > &xPackage, + const uno::Reference< deployment::XPackageManager > &xPackageManager, + PackageState eState ) : + m_bActive( false ), + m_bLocked( false ), + m_bHasOptions( false ), + m_bShared( false ), + m_bNew( false ), + m_bChecked( false ), + m_bMissingDeps( false ), + m_eState( eState ), + m_pPublisher( NULL ), + m_xPackage( xPackage ), + m_xPackageManager( xPackageManager ) +{ + m_sTitle = xPackage->getDisplayName(); + m_sVersion = xPackage->getVersion(); + m_sDescription = xPackage->getDescription(); + + beans::StringPair aInfo( m_xPackage->getPublisherInfo() ); + m_sPublisher = aInfo.First; + m_sPublisherURL = aInfo.Second; + + // get the icons for the package if there are any + uno::Reference< graphic::XGraphic > xGraphic = xPackage->getIcon( false ); + if ( xGraphic.is() ) + m_aIcon = Image( xGraphic ); + + xGraphic = xPackage->getIcon( true ); + if ( xGraphic.is() ) + m_aIconHC = Image( xGraphic ); + else + m_aIconHC = m_aIcon; + + m_bLocked = m_xPackageManager->isReadOnly(); + + if ( eState == AMBIGUOUS ) + m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); + else if ( eState == NOT_REGISTERED ) + checkDependencies(); +} + +//------------------------------------------------------------------------------ +Entry_Impl::~Entry_Impl() +{} + +//------------------------------------------------------------------------------ +StringCompare Entry_Impl::CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const +{ + StringCompare eCompare = (StringCompare) pCollator->compareString( m_sTitle, pEntry->m_sTitle ); + if ( eCompare == COMPARE_EQUAL ) + { + eCompare = m_sVersion.CompareTo( pEntry->m_sVersion ); + if ( eCompare == COMPARE_EQUAL ) + { + if ( m_xPackageManager != pEntry->m_xPackageManager ) + { + sal_Int32 nCompare = m_xPackageManager->getContext().compareTo( pEntry->m_xPackageManager->getContext() ); + if ( nCompare < 0 ) + eCompare = COMPARE_LESS; + else if ( nCompare > 0 ) + eCompare = COMPARE_GREATER; + } + } + } + return eCompare; +} + +//------------------------------------------------------------------------------ +void Entry_Impl::checkDependencies() +{ + try { + m_xPackage->checkDependencies( uno::Reference< ucb::XCommandEnvironment >() ); + } + catch ( deployment::DeploymentException &e ) + { + deployment::DependencyException depExc; + if ( e.Cause >>= depExc ) + { + rtl::OUString aMissingDep( DialogHelper::getResourceString( RID_STR_ERROR_MISSING_DEPENDENCIES ) ); + for ( sal_Int32 i = 0; i < depExc.UnsatisfiedDependencies.getLength(); ++i ) + { + aMissingDep += OUSTR("\n"); + aMissingDep += dp_misc::Dependencies::getErrorText( depExc.UnsatisfiedDependencies[i]); + } + aMissingDep += OUSTR("\n"); + m_sErrorText = aMissingDep; + m_bMissingDeps = true; + } + } +} +//------------------------------------------------------------------------------ +// ExtensionRemovedListener +//------------------------------------------------------------------------------ +void ExtensionRemovedListener::disposing( lang::EventObject const & rEvt ) + throw ( uno::RuntimeException ) +{ + uno::Reference< deployment::XPackage > xPackage( rEvt.Source, uno::UNO_QUERY ); + + if ( xPackage.is() ) + { + m_pParent->removeEntry( xPackage ); + } +} + +//------------------------------------------------------------------------------ +ExtensionRemovedListener::~ExtensionRemovedListener() +{ +} + +//------------------------------------------------------------------------------ +// ExtensionBox_Impl +//------------------------------------------------------------------------------ +ExtensionBox_Impl::ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ) : + IExtensionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_CHILDDLGCTRL ), + m_bHasScrollBar( false ), + m_bHasActive( false ), + m_bNeedsRecalc( true ), + m_bHasNew( false ), + m_bInCheckMode( false ), + m_bAdjustActive( false ), + m_bInDelete( false ), + m_nActive( 0 ), + m_nTopIndex( 0 ), + m_nActiveHeight( 0 ), + m_nExtraHeight( 2 ), + m_aLockedImage( DialogHelper::getResId( RID_IMG_LOCKED ) ), + m_aLockedImageHC( DialogHelper::getResId( RID_IMG_LOCKED_HC ) ), + m_aWarningImage( DialogHelper::getResId( RID_IMG_WARNING ) ), + m_aWarningImageHC( DialogHelper::getResId( RID_IMG_WARNING_HC ) ), + m_aDefaultImage( DialogHelper::getResId( RID_IMG_EXTENSION ) ), + m_aDefaultImageHC( DialogHelper::getResId( RID_IMG_EXTENSION_HC ) ), + m_pScrollBar( NULL ), + m_pManager( pManager ) +{ + SetHelpId( HID_EXTENSION_MANAGER_LISTBOX ); + + m_pScrollBar = new ScrollBar( this, WB_VERT ); + m_pScrollBar->SetScrollHdl( LINK( this, ExtensionBox_Impl, ScrollHdl ) ); + m_pScrollBar->EnableDrag(); + + SetPaintTransparent( true ); + SetPosPixel( Point( RSC_SP_DLG_INNERBORDER_LEFT, RSC_SP_DLG_INNERBORDER_TOP ) ); + long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; + long nTitleHeight = 2*TOP_OFFSET + GetTextHeight(); + if ( nIconHeight < nTitleHeight ) + m_nStdHeight = nTitleHeight; + else + m_nStdHeight = nIconHeight; + m_nStdHeight += GetTextHeight() + TOP_OFFSET; + + nIconHeight = ICON_HEIGHT + 2*TOP_OFFSET + 1; + if ( m_nStdHeight < nIconHeight ) + m_nStdHeight = nIconHeight; + + m_nActiveHeight = m_nStdHeight; + + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + if( IsControlBackground() ) + SetBackground( GetControlBackground() ); + else + SetBackground( rStyleSettings.GetFieldColor() ); + + m_xRemoveListener = new ExtensionRemovedListener( this ); + + m_pLocale = new lang::Locale( Application::GetSettings().GetLocale() ); + m_pCollator = new CollatorWrapper( ::comphelper::getProcessServiceFactory() ); + m_pCollator->loadDefaultCollator( *m_pLocale, i18n::CollatorOptions::CollatorOptions_IGNORE_CASE ); + + Show(); +} + +//------------------------------------------------------------------------------ +ExtensionBox_Impl::~ExtensionBox_Impl() +{ + if ( ! m_bInDelete ) + DeleteRemoved(); + + m_bInDelete = true; + + typedef std::vector< TEntry_Impl >::iterator ITER; + + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + if ( (*iIndex)->m_pPublisher ) + { + delete (*iIndex)->m_pPublisher; + (*iIndex)->m_pPublisher = NULL; + } + (*iIndex)->m_xPackage->removeEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); + } + + m_vEntries.clear(); + + delete m_pScrollBar; + + m_xRemoveListener.clear(); + + delete m_pLocale; + delete m_pCollator; +} + +//------------------------------------------------------------------------------ +sal_Int32 ExtensionBox_Impl::getItemCount() const +{ + return static_cast< sal_Int32 >( m_vEntries.size() ); +} + +//------------------------------------------------------------------------------ +sal_Int32 ExtensionBox_Impl::getSelIndex() const +{ + if ( m_bHasActive ) + { + OSL_ASSERT( m_nActive >= -1); + return static_cast< sal_Int32 >( m_nActive ); + } + else + return static_cast< sal_Int32 >( EXTENSION_LISTBOX_ENTRY_NOTFOUND ); +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::checkIndex( sal_Int32 nIndex ) const +{ + if ( nIndex < 0 ) + throw lang::IllegalArgumentException( OUSTR("The list index starts with 0"),0, 0 ); + if ( static_cast< sal_uInt32 >( nIndex ) >= m_vEntries.size()) + throw lang::IllegalArgumentException( OUSTR("There is no element at the provided position." + "The position exceeds the number of available list entries"),0, 0 ); +} + +//------------------------------------------------------------------------------ +rtl::OUString ExtensionBox_Impl::getItemName( sal_Int32 nIndex ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + return m_vEntries[ nIndex ]->m_sTitle; +} + +//------------------------------------------------------------------------------ +rtl::OUString ExtensionBox_Impl::getItemVersion( sal_Int32 nIndex ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + return m_vEntries[ nIndex ]->m_sVersion; +} + +//------------------------------------------------------------------------------ +rtl::OUString ExtensionBox_Impl::getItemDescription( sal_Int32 nIndex ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + return m_vEntries[ nIndex ]->m_sDescription; +} + +//------------------------------------------------------------------------------ +rtl::OUString ExtensionBox_Impl::getItemPublisher( sal_Int32 nIndex ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + return m_vEntries[ nIndex ]->m_sPublisher; +} + +//------------------------------------------------------------------------------ +rtl::OUString ExtensionBox_Impl::getItemPublisherLink( sal_Int32 nIndex ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + return m_vEntries[ nIndex ]->m_sPublisherURL; +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::select( sal_Int32 nIndex ) +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + checkIndex( nIndex ); + selectEntry( nIndex ); +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::select( const rtl::OUString & sName ) +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + typedef ::std::vector< TEntry_Impl >::const_iterator It; + + for ( It iIter = m_vEntries.begin(); iIter < m_vEntries.end(); iIter++ ) + { + if ( sName.equals( (*iIter)->m_sTitle ) ) + { + long nPos = iIter - m_vEntries.begin(); + selectEntry( nPos ); + break; + } + } +} + +//------------------------------------------------------------------------------ +//------------------------------------------------------------------------------ +// Title + description +void ExtensionBox_Impl::CalcActiveHeight( const long nPos ) +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + + // get title height + long aTextHeight; + long nIconHeight = 2*TOP_OFFSET + SMALL_ICON_SIZE; + long nTitleHeight = 2*TOP_OFFSET + GetTextHeight(); + if ( nIconHeight < nTitleHeight ) + aTextHeight = nTitleHeight; + else + aTextHeight = nIconHeight; + + // calc description height + Size aSize = GetOutputSizePixel(); + if ( m_bHasScrollBar ) + aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + + aSize.Width() -= ICON_OFFSET; + aSize.Height() = 10000; + + rtl::OUString aText( m_vEntries[ nPos ]->m_sErrorText ); + aText += m_vEntries[ nPos ]->m_sDescription; + + Rectangle aRect = GetTextRect( Rectangle( Point(), aSize ), aText, + TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + aTextHeight += aRect.GetHeight(); + + if ( aTextHeight < m_nStdHeight ) + aTextHeight = m_nStdHeight; + + m_nActiveHeight = aTextHeight + m_nExtraHeight; +} + +//------------------------------------------------------------------------------ +const Size ExtensionBox_Impl::GetMinOutputSizePixel() const +{ + return Size( 200, 80 ); +} + +//------------------------------------------------------------------------------ +Rectangle ExtensionBox_Impl::GetEntryRect( const long nPos ) const +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + + Size aSize( GetOutputSizePixel() ); + + if ( m_bHasScrollBar ) + aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + + if ( m_vEntries[ nPos ]->m_bActive ) + aSize.Height() = m_nActiveHeight; + else + aSize.Height() = m_nStdHeight; + + Point aPos( 0, -m_nTopIndex + nPos * m_nStdHeight ); + if ( m_bHasActive && ( nPos < m_nActive ) ) + aPos.Y() += m_nActiveHeight - m_nStdHeight; + + return Rectangle( aPos, aSize ); +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::DeleteRemoved() +{ + const ::osl::MutexGuard aGuard( m_entriesMutex ); + + m_bInDelete = true; + + if ( ! m_vRemovedEntries.empty() ) + { + typedef std::vector< TEntry_Impl >::iterator ITER; + + for ( ITER iIndex = m_vRemovedEntries.begin(); iIndex < m_vRemovedEntries.end(); ++iIndex ) + { + if ( (*iIndex)->m_pPublisher ) + { + delete (*iIndex)->m_pPublisher; + (*iIndex)->m_pPublisher = NULL; + } + } + + m_vRemovedEntries.clear(); + } + + m_bInDelete = false; +} + +//------------------------------------------------------------------------------ +//This function may be called with nPos < 0 +void ExtensionBox_Impl::selectEntry( const long nPos ) +{ + //ToDo whe should not use the guard at such a big scope here. + //Currently it is used to gard m_vEntries and m_nActive. m_nActive will be + //modified in this function. + //It would be probably best to always use a copy of m_vEntries + //and some other state variables from ExtensionBox_Impl for + //the whole painting operation. See issue i86993 + ::osl::ClearableMutexGuard guard(m_entriesMutex); + + if ( m_bInCheckMode ) + return; + + if ( m_bHasActive ) + { + if ( nPos == m_nActive ) + return; + + m_bHasActive = false; + m_vEntries[ m_nActive ]->m_bActive = false; + } + + if ( ( nPos >= 0 ) && ( nPos < (long) m_vEntries.size() ) ) + { + m_bHasActive = true; + m_nActive = nPos; + m_vEntries[ nPos ]->m_bActive = true; + + if ( IsReallyVisible() ) + { + m_bNeedsRecalc = true; + m_bAdjustActive = true; + } + } + + if ( IsReallyVisible() ) + Invalidate(); + + guard.clear(); +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry ) +{ + const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings(); + + if ( pEntry->m_bActive ) + SetTextColor( rStyleSettings.GetHighlightTextColor() ); + else if ( ( pEntry->m_eState != REGISTERED ) && ( pEntry->m_eState != NOT_AVAILABLE ) ) + SetTextColor( rStyleSettings.GetDisableColor() ); + else if ( IsControlForeground() ) + SetTextColor( GetControlForeground() ); + else + SetTextColor( rStyleSettings.GetFieldTextColor() ); + + if ( pEntry->m_bActive ) + { + SetLineColor(); + SetFillColor( rStyleSettings.GetHighlightColor() ); + DrawRect( rRect ); + } + else + { + if( IsControlBackground() ) + SetBackground( GetControlBackground() ); + else + SetBackground( rStyleSettings.GetFieldColor() ); + + SetTextFillColor(); + Erase( rRect ); + } + + // Draw extension icon + Point aPos( rRect.TopLeft() ); + aPos += Point( TOP_OFFSET, TOP_OFFSET ); + Image aImage; + if ( ! pEntry->m_aIcon ) + aImage = isHCMode() ? m_aDefaultImageHC : m_aDefaultImage; + else + aImage = isHCMode() ? pEntry->m_aIconHC : pEntry->m_aIcon; + Size aImageSize = aImage.GetSizePixel(); + if ( ( aImageSize.Width() <= ICON_WIDTH ) && ( aImageSize.Height() <= ICON_HEIGHT ) ) + DrawImage( Point( aPos.X()+((ICON_WIDTH-aImageSize.Width())/2), aPos.Y()+((ICON_HEIGHT-aImageSize.Height())/2) ), aImage ); + else + DrawImage( aPos, Size( ICON_WIDTH, ICON_HEIGHT ), aImage ); + + // Setup fonts + Font aStdFont( GetFont() ); + Font aBoldFont( aStdFont ); + aBoldFont.SetWeight( WEIGHT_BOLD ); + SetFont( aBoldFont ); + long aTextHeight = GetTextHeight(); + + // Init publisher link here + if ( !pEntry->m_pPublisher && pEntry->m_sPublisher.Len() ) + { + pEntry->m_pPublisher = new svt::FixedHyperlink( this ); + pEntry->m_pPublisher->SetBackground(); + pEntry->m_pPublisher->SetPaintTransparent( true ); + pEntry->m_pPublisher->SetURL( pEntry->m_sPublisherURL ); + pEntry->m_pPublisher->SetDescription( pEntry->m_sPublisher ); + Size aSize = FixedText::CalcMinimumTextSize( pEntry->m_pPublisher ); + pEntry->m_pPublisher->SetSizePixel( aSize ); + + if ( m_aClickHdl.IsSet() ) + pEntry->m_pPublisher->SetClickHdl( m_aClickHdl ); + } + + // Get max title width + long nMaxTitleWidth = rRect.GetWidth() - ICON_OFFSET; + nMaxTitleWidth -= ( 2 * SMALL_ICON_SIZE ) + ( 4 * SPACE_BETWEEN ); + if ( pEntry->m_pPublisher ) + { + nMaxTitleWidth -= pEntry->m_pPublisher->GetSizePixel().Width() + (2*SPACE_BETWEEN); + } + + long aVersionWidth = GetTextWidth( pEntry->m_sVersion ); + long aTitleWidth = GetTextWidth( pEntry->m_sTitle ) + (aTextHeight / 3); + + aPos = rRect.TopLeft() + Point( ICON_OFFSET, TOP_OFFSET ); + + if ( aTitleWidth > nMaxTitleWidth - aVersionWidth ) + { + aTitleWidth = nMaxTitleWidth - aVersionWidth - (aTextHeight / 3); + String aShortTitle = GetEllipsisString( pEntry->m_sTitle, aTitleWidth ); + DrawText( aPos, aShortTitle ); + aTitleWidth += (aTextHeight / 3); + } + else + DrawText( aPos, pEntry->m_sTitle ); + + SetFont( aStdFont ); + DrawText( Point( aPos.X() + aTitleWidth, aPos.Y() ), pEntry->m_sVersion ); + + long nIconHeight = TOP_OFFSET + SMALL_ICON_SIZE; + long nTitleHeight = TOP_OFFSET + GetTextHeight(); + if ( nIconHeight < nTitleHeight ) + aTextHeight = nTitleHeight; + else + aTextHeight = nIconHeight; + + // draw description + String sDescription; + if ( pEntry->m_sErrorText.Len() ) + { + if ( pEntry->m_bActive ) + sDescription = pEntry->m_sErrorText + OUSTR("\n") + pEntry->m_sDescription; + else + sDescription = pEntry->m_sErrorText; + } + else + sDescription = pEntry->m_sDescription; + + aPos.Y() += aTextHeight; + if ( pEntry->m_bActive ) + { + DrawText( Rectangle( aPos.X(), aPos.Y(), rRect.Right(), rRect.Bottom() - m_nExtraHeight ), + sDescription, TEXT_DRAW_MULTILINE | TEXT_DRAW_WORDBREAK ); + } + else + { + const long nWidth = GetTextWidth( sDescription ); + if ( nWidth > rRect.GetWidth() - aPos.X() ) + sDescription = GetEllipsisString( sDescription, rRect.GetWidth() - aPos.X() ); + DrawText( aPos, sDescription ); + } + + // Draw publisher link + if ( pEntry->m_pPublisher ) + { + pEntry->m_pPublisher->Show(); + aPos = rRect.TopLeft() + Point( ICON_OFFSET + nMaxTitleWidth + (2*SPACE_BETWEEN), TOP_OFFSET ); + pEntry->m_pPublisher->SetPosPixel( aPos ); + } + + // Draw status icons + if ( pEntry->m_bShared ) + { + aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SMALL_ICON_SIZE), TOP_OFFSET ); + DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aLockedImageHC : m_aLockedImage ); + } + if ( ( pEntry->m_eState == AMBIGUOUS ) || pEntry->m_bMissingDeps ) + { + aPos = rRect.TopRight() + Point( -(RIGHT_ICON_OFFSET + SPACE_BETWEEN + 2*SMALL_ICON_SIZE), TOP_OFFSET ); + DrawImage( aPos, Size( SMALL_ICON_SIZE, SMALL_ICON_SIZE ), isHCMode() ? m_aWarningImageHC : m_aWarningImage ); + } + + SetLineColor( Color( COL_LIGHTGRAY ) ); + DrawLine( rRect.BottomLeft(), rRect.BottomRight() ); +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::RecalcAll() +{ + if ( m_bHasActive ) + CalcActiveHeight( m_nActive ); + + SetupScrollBar(); + + if ( m_bHasActive ) + { + Rectangle aEntryRect = GetEntryRect( m_nActive ); + + if ( m_bAdjustActive ) + { + m_bAdjustActive = false; + + // If the top of the selected entry isn't visible, make it visible + if ( aEntryRect.Top() < 0 ) + { + m_nTopIndex += aEntryRect.Top(); + aEntryRect.Move( 0, -aEntryRect.Top() ); + } + + // If the bottom of the selected entry isn't visible, make it visible even if now the top + // isn't visible any longer ( the buttons are more important ) + Size aOutputSize = GetOutputSizePixel(); + if ( aEntryRect.Bottom() > aOutputSize.Height() ) + { + m_nTopIndex += ( aEntryRect.Bottom() - aOutputSize.Height() ); + aEntryRect.Move( 0, -( aEntryRect.Bottom() - aOutputSize.Height() ) ); + } + + // If there is unused space below the last entry but all entries don't fit into the box, + // move the content down to use the whole space + const long nTotalHeight = GetTotalHeight(); + if ( m_bHasScrollBar && ( aOutputSize.Height() + m_nTopIndex > nTotalHeight ) ) + { + long nOffset = m_nTopIndex; + m_nTopIndex = nTotalHeight - aOutputSize.Height(); + nOffset -= m_nTopIndex; + aEntryRect.Move( 0, nOffset ); + } + + if ( m_bHasScrollBar ) + m_pScrollBar->SetThumbPos( m_nTopIndex ); + } + } + + m_bNeedsRecalc = false; +} + +// ----------------------------------------------------------------------- +bool ExtensionBox_Impl::HandleTabKey( bool ) +{ + return false; +} + +// ----------------------------------------------------------------------- +bool ExtensionBox_Impl::HandleCursorKey( USHORT nKeyCode ) +{ + if ( m_vEntries.empty() ) + return true; + + long nSelect = 0; + + if ( m_bHasActive ) + { + long nPageSize = GetOutputSizePixel().Height() / m_nStdHeight; + if ( nPageSize < 2 ) + nPageSize = 2; + + if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_RIGHT ) ) + nSelect = m_nActive + 1; + else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_LEFT ) ) + nSelect = m_nActive - 1; + else if ( nKeyCode == KEY_HOME ) + nSelect = 0; + else if ( nKeyCode == KEY_END ) + nSelect = m_vEntries.size() - 1; + else if ( nKeyCode == KEY_PAGEUP ) + nSelect = m_nActive - nPageSize + 1; + else if ( nKeyCode == KEY_PAGEDOWN ) + nSelect = m_nActive + nPageSize - 1; + } + else // when there is no selected entry, we will select the first or the last. + { + if ( ( nKeyCode == KEY_DOWN ) || ( nKeyCode == KEY_PAGEDOWN ) || ( nKeyCode == KEY_HOME ) ) + nSelect = 0; + else if ( ( nKeyCode == KEY_UP ) || ( nKeyCode == KEY_PAGEUP ) || ( nKeyCode == KEY_END ) ) + nSelect = m_vEntries.size() - 1; + } + + if ( nSelect < 0 ) + nSelect = 0; + if ( nSelect >= (long) m_vEntries.size() ) + nSelect = m_vEntries.size() - 1; + + selectEntry( nSelect ); + + return true; +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::Paint( const Rectangle &/*rPaintRect*/ ) +{ + if ( !m_bInDelete ) + DeleteRemoved(); + + if ( m_bNeedsRecalc ) + RecalcAll(); + + Point aStart( 0, -m_nTopIndex ); + Size aSize( GetOutputSizePixel() ); + + if ( m_bHasScrollBar ) + aSize.Width() -= m_pScrollBar->GetSizePixel().Width(); + + const ::osl::MutexGuard aGuard( m_entriesMutex ); + + typedef std::vector< TEntry_Impl >::iterator ITER; + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + aSize.Height() = (*iIndex)->m_bActive ? m_nActiveHeight : m_nStdHeight; + Rectangle aEntryRect( aStart, aSize ); + DrawRow( aEntryRect, *iIndex ); + aStart.Y() += aSize.Height(); + } +} + +// ----------------------------------------------------------------------- +long ExtensionBox_Impl::GetTotalHeight() const +{ + long nHeight = m_vEntries.size() * m_nStdHeight; + + if ( m_bHasActive ) + { + nHeight += m_nActiveHeight - m_nStdHeight; + } + + return nHeight; +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::SetupScrollBar() +{ + const Size aSize = GetOutputSizePixel(); + const long nScrBarSize = GetSettings().GetStyleSettings().GetScrollBarSize(); + const long nTotalHeight = GetTotalHeight(); + const bool bNeedsScrollBar = ( nTotalHeight > aSize.Height() ); + + if ( bNeedsScrollBar ) + { + if ( m_nTopIndex + aSize.Height() > nTotalHeight ) + m_nTopIndex = nTotalHeight - aSize.Height(); + + m_pScrollBar->SetPosSizePixel( Point( aSize.Width() - nScrBarSize, 0 ), + Size( nScrBarSize, aSize.Height() ) ); + m_pScrollBar->SetRangeMax( nTotalHeight ); + m_pScrollBar->SetVisibleSize( aSize.Height() ); + m_pScrollBar->SetPageSize( ( aSize.Height() * 4 ) / 5 ); + m_pScrollBar->SetLineSize( m_nStdHeight ); + m_pScrollBar->SetThumbPos( m_nTopIndex ); + + if ( !m_bHasScrollBar ) + m_pScrollBar->Show(); + } + else if ( m_bHasScrollBar ) + { + m_pScrollBar->Hide(); + m_nTopIndex = 0; + } + + m_bHasScrollBar = bNeedsScrollBar; +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::Resize() +{ + RecalcAll(); +} + +//------------------------------------------------------------------------------ +long ExtensionBox_Impl::PointToPos( const Point& rPos ) +{ + long nPos = ( rPos.Y() + m_nTopIndex ) / m_nStdHeight; + + if ( m_bHasActive && ( nPos > m_nActive ) ) + { + if ( rPos.Y() + m_nTopIndex <= m_nActive*m_nStdHeight + m_nActiveHeight ) + nPos = m_nActive; + else + nPos = ( rPos.Y() + m_nTopIndex - (m_nActiveHeight - m_nStdHeight) ) / m_nStdHeight; + } + + return nPos; +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::MouseButtonDown( const MouseEvent& rMEvt ) +{ + long nPos = PointToPos( rMEvt.GetPosPixel() ); + + if ( rMEvt.IsLeft() ) + { + if ( rMEvt.IsMod1() && m_bHasActive ) + selectEntry( m_vEntries.size() ); // Selecting an not existing entry will deselect the current one + else + selectEntry( nPos ); + } +} + +//------------------------------------------------------------------------------ +long ExtensionBox_Impl::Notify( NotifyEvent& rNEvt ) +{ + if ( !m_bInDelete ) + DeleteRemoved(); + + bool bHandled = false; + + if ( rNEvt.GetType() == EVENT_KEYINPUT ) + { + const KeyEvent* pKEvt = rNEvt.GetKeyEvent(); + KeyCode aKeyCode = pKEvt->GetKeyCode(); + USHORT nKeyCode = aKeyCode.GetCode(); + + if ( nKeyCode == KEY_TAB ) + bHandled = HandleTabKey( aKeyCode.IsShift() ); + else if ( aKeyCode.GetGroup() == KEYGROUP_CURSOR ) + bHandled = HandleCursorKey( nKeyCode ); + } + + if ( rNEvt.GetType() == EVENT_COMMAND ) + { + if ( m_bHasScrollBar && + ( rNEvt.GetCommandEvent()->GetCommand() == COMMAND_WHEEL ) ) + { + const CommandWheelData* pData = rNEvt.GetCommandEvent()->GetWheelData(); + if ( pData->GetMode() == COMMAND_WHEEL_SCROLL ) + { + long nThumbPos = m_pScrollBar->GetThumbPos(); + if ( pData->GetDelta() < 0 ) + m_pScrollBar->DoScroll( nThumbPos + m_nStdHeight ); + else + m_pScrollBar->DoScroll( nThumbPos - m_nStdHeight ); + bHandled = true; + } + } + } + + if ( !bHandled ) + return Control::Notify( rNEvt ); + else + return true; +} + +//------------------------------------------------------------------------------ +bool ExtensionBox_Impl::FindEntryPos( const TEntry_Impl pEntry, const long nStart, + const long nEnd, long &nPos ) +{ + nPos = nStart; + if ( nStart > nEnd ) + return false; + + StringCompare eCompare; + + if ( nStart == nEnd ) + { + eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nStart ] ); + if ( eCompare == COMPARE_LESS ) + return false; + else if ( eCompare == COMPARE_EQUAL ) + { + //Workaround. See i86963. + if (pEntry->m_xPackage != m_vEntries[nStart]->m_xPackage) + return false; + + if ( m_bInCheckMode ) + m_vEntries[ nStart ]->m_bChecked = true; + return true; + } + else + { + nPos = nStart + 1; + return false; + } + } + + const long nMid = nStart + ( ( nEnd - nStart ) / 2 ); + eCompare = pEntry->CompareTo( m_pCollator, m_vEntries[ nMid ] ); + + if ( eCompare == COMPARE_LESS ) + return FindEntryPos( pEntry, nStart, nMid-1, nPos ); + else if ( eCompare == COMPARE_GREATER ) + return FindEntryPos( pEntry, nMid+1, nEnd, nPos ); + else + { + //Workaround.See i86963. + if (pEntry->m_xPackage != m_vEntries[nMid]->m_xPackage) + return false; + + if ( m_bInCheckMode ) + m_vEntries[ nMid ]->m_bChecked = true; + nPos = nMid; + return true; + } +} + +//------------------------------------------------------------------------------ +long ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage, + const uno::Reference< deployment::XPackageManager > &xPackageManager ) +{ + long nPos = 0; + PackageState eState = m_pManager->getPackageState( xPackage ); + + TEntry_Impl pEntry( new Entry_Impl( xPackage, xPackageManager, eState ) ); + xPackage->addEventListener( uno::Reference< lang::XEventListener > ( m_xRemoveListener, uno::UNO_QUERY ) ); + + ::osl::ClearableMutexGuard guard(m_entriesMutex); + if ( m_vEntries.empty() ) + { + pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); + pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bNew = m_bInCheckMode; + m_vEntries.push_back( pEntry ); + } + else + { + if ( !FindEntryPos( pEntry, 0, m_vEntries.size()-1, nPos ) ) + { + pEntry->m_bHasOptions = m_pManager->supportsOptions( xPackage ); + pEntry->m_bShared = ( m_pManager->getSharedPkgMgr() == xPackageManager ); + pEntry->m_bNew = m_bInCheckMode; + m_vEntries.insert( m_vEntries.begin()+nPos, pEntry ); + } + else if ( !m_bInCheckMode ) + { + OSL_ENSURE( 0, "ExtensionBox_Impl::addEntry(): Will not add duplicate entries" ); + } + } + //access to m_nActive must be guarded + if ( !m_bInCheckMode && m_bHasActive && ( m_nActive >= nPos ) ) + m_nActive += 1; + + guard.clear(); + + if ( IsReallyVisible() ) + Invalidate(); + + m_bNeedsRecalc = true; + + return nPos; +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::updateEntry( const uno::Reference< deployment::XPackage > &xPackage ) +{ + typedef std::vector< TEntry_Impl >::iterator ITER; + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + if ( (*iIndex)->m_xPackage == xPackage ) + { + PackageState eState = m_pManager->getPackageState( xPackage ); + (*iIndex)->m_bHasOptions = m_pManager->supportsOptions( xPackage ); + (*iIndex)->m_eState = eState; + (*iIndex)->m_sTitle = xPackage->getDisplayName(); + (*iIndex)->m_sVersion = xPackage->getVersion(); + (*iIndex)->m_sDescription = xPackage->getDescription(); + + if ( eState == AMBIGUOUS ) + (*iIndex)->m_sErrorText = DialogHelper::getResourceString( RID_STR_ERROR_UNKNOWN_STATUS ); + else + (*iIndex)->m_sErrorText = String(); + + if ( IsReallyVisible() ) + Invalidate(); + break; + } + } +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::removeEntry( const uno::Reference< deployment::XPackage > &xPackage ) +{ + if ( ! m_bInDelete ) + { + ::osl::ClearableMutexGuard aGuard( m_entriesMutex ); + + typedef std::vector< TEntry_Impl >::iterator ITER; + + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + if ( (*iIndex)->m_xPackage == xPackage ) + { + long nPos = iIndex - m_vEntries.begin(); + + // Entries mustn't removed here, because they contain a hyperlink control + // which can only be deleted when the thread has the solar mutex. Therefor + // the entry will be moved into the m_vRemovedEntries list which will be + // cleared on the next paint event + m_vRemovedEntries.push_back( *iIndex ); + m_vEntries.erase( iIndex ); + + m_bNeedsRecalc = true; + + if ( IsReallyVisible() ) + Invalidate(); + + if ( m_bHasActive ) + { + if ( nPos < m_nActive ) + m_nActive -= 1; + else if ( ( nPos == m_nActive ) && + ( nPos == (long) m_vEntries.size() ) ) + m_nActive -= 1; + + m_bHasActive = false; + //clear before calling out of this method + aGuard.clear(); + selectEntry( m_nActive ); + } + break; + } + } + } +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::RemoveUnlocked() +{ + bool bAllRemoved = false; + + while ( ! bAllRemoved ) + { + bAllRemoved = true; + + ::osl::ClearableMutexGuard aGuard( m_entriesMutex ); + + typedef std::vector< TEntry_Impl >::iterator ITER; + + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + if ( !(*iIndex)->m_bLocked ) + { + bAllRemoved = false; + uno::Reference< deployment::XPackage> xPackage = (*iIndex)->m_xPackage; + aGuard.clear(); + removeEntry( xPackage ); + break; + } + } + } +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::prepareChecking( const uno::Reference< deployment::XPackageManager > &xPackageMgr ) +{ + m_bInCheckMode = true; + typedef std::vector< TEntry_Impl >::iterator ITER; + for ( ITER iIndex = m_vEntries.begin(); iIndex < m_vEntries.end(); ++iIndex ) + { + if ( (*iIndex)->m_xPackageManager == xPackageMgr ) + (*iIndex)->m_bChecked = false; + else + (*iIndex)->m_bChecked = true; + (*iIndex)->m_bNew = false; + } +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::checkEntries() +{ + long nNewPos = -1; + long nPos = 0; + bool bNeedsUpdate = false; + + ::osl::ClearableMutexGuard guard(m_entriesMutex); + typedef std::vector< TEntry_Impl >::iterator ITER; + ITER iIndex = m_vEntries.begin(); + while ( iIndex < m_vEntries.end() ) + { + if ( (*iIndex)->m_bChecked == false ) + { + bNeedsUpdate = true; + nPos = iIndex-m_vEntries.begin(); + if ( (*iIndex)->m_bNew ) + { + if ( nNewPos == - 1) + nNewPos = nPos; + if ( nPos <= m_nActive ) + m_nActive += 1; + } + } + iIndex++; + } + guard.clear(); + + m_bInCheckMode = false; + + if ( nNewPos != - 1) + selectEntry( nNewPos ); + + if ( bNeedsUpdate ) + { + m_bNeedsRecalc = true; + if ( IsReallyVisible() ) + Invalidate(); + } +} +//------------------------------------------------------------------------------ +bool ExtensionBox_Impl::isHCMode() +{ + return (bool)GetSettings().GetStyleSettings().GetHighContrastMode(); +} + +//------------------------------------------------------------------------------ +void ExtensionBox_Impl::SetScrollHdl( const Link& rLink ) +{ + if ( m_pScrollBar ) + m_pScrollBar->SetScrollHdl( rLink ); +} + +// ----------------------------------------------------------------------- +void ExtensionBox_Impl::DoScroll( long nDelta ) +{ + m_nTopIndex += nDelta; + Point aNewSBPt( m_pScrollBar->GetPosPixel() ); + + Rectangle aScrRect( Point(), GetOutputSizePixel() ); + aScrRect.Right() -= m_pScrollBar->GetSizePixel().Width(); + Scroll( 0, -nDelta, aScrRect ); + + m_pScrollBar->SetPosPixel( aNewSBPt ); +} + +// ----------------------------------------------------------------------- +IMPL_LINK( ExtensionBox_Impl, ScrollHdl, ScrollBar*, pScrBar ) +{ + DoScroll( pScrBar->GetDelta() ); + + return 1; +} + +} //namespace dp_gui diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx index e1a17bb06dc9..ad62bfd1a2d8 100644 --- a/desktop/source/deployment/gui/dp_gui_extlistbox.hxx +++ b/desktop/source/deployment/gui/dp_gui_extlistbox.hxx @@ -1,271 +1,268 @@ -/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2008 by Sun Microsystems, Inc.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * $RCSfile: dp_gui_dialog2.cxx,v $
- *
- * $Revision: 1.8.4.8 $
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#include "rtl/ustring.hxx"
-#include "vcl/scrbar.hxx"
-#include "vcl/fixed.hxx"
-#include "vcl/dialog.hxx"
-
-#include "svtools/extensionlistbox.hxx"
-#include "svtools/fixedhyper.hxx"
-#include "cppuhelper/implbase1.hxx"
-#include "unotools/collatorwrapper.hxx"
-
-#include "com/sun/star/lang/Locale.hpp"
-#include "com/sun/star/lang/XEventListener.hpp"
-#include "com/sun/star/deployment/XPackage.hpp"
-#include "com/sun/star/deployment/XPackageManager.hpp"
-
-#include <boost/shared_ptr.hpp>
-
-namespace dp_gui {
-
-#define SMALL_ICON_SIZE 16
-#define TOP_OFFSET 3
-#define ICON_HEIGHT 42
-#define ICON_OFFSET 50
-#define RIGHT_ICON_OFFSET 5
-#define SPACE_BETWEEN 3
-
-class TheExtensionManager;
-
-typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink;
-
-//------------------------------------------------------------------------------
-// struct Entry_Impl
-//------------------------------------------------------------------------------
-struct Entry_Impl;
-
-typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl;
-
-struct Entry_Impl
-{
- bool m_bActive;
- bool m_bLocked;
- bool m_bHasOptions;
- bool m_bShared;
- bool m_bNew;
- bool m_bChecked;
- bool m_bMissingDeps;
- PackageState m_eState;
- String m_sTitle;
- String m_sVersion;
- String m_sDescription;
- String m_sPublisher;
- String m_sPublisherURL;
- String m_sErrorText;
- Image m_aIcon;
- Image m_aIconHC;
- svt::FixedHyperlink *m_pPublisher;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage;
- ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager;
-
- Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager,
- PackageState eState );
- ~Entry_Impl();
-
- StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const;
- void checkDependencies();
-};
-
-//------------------------------------------------------------------------------
-// class ExtensionBox_Impl
-//------------------------------------------------------------------------------
-
-class ExtensionBox_Impl;
-
-//------------------------------------------------------------------------------
-class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener >
-{
- ExtensionBox_Impl *m_pParent;
-
-public:
-
- ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; }
- ~ExtensionRemovedListener();
-
- //===================================================================================
- // XEventListener
- virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt )
- throw (::com::sun::star::uno::RuntimeException);
-};
-
-//------------------------------------------------------------------------------
-class ExtensionBox_Impl : public ::svt::IExtensionListBox
-{
- bool m_bHasScrollBar;
- bool m_bHasActive;
- bool m_bNeedsRecalc;
- bool m_bHasNew;
- bool m_bInCheckMode;
- bool m_bAdjustActive;
- bool m_bInDelete;
- //Must be guarded together with m_vEntries to ensure a valid index at all times.
- //Use m_entriesMutex as guard.
- long m_nActive;
- long m_nTopIndex;
- long m_nStdHeight;
- long m_nActiveHeight;
- long m_nExtraHeight;
- Size m_aOutputSize;
- Image m_aLockedImage;
- Image m_aLockedImageHC;
- Image m_aWarningImage;
- Image m_aWarningImageHC;
- Image m_aDefaultImage;
- Image m_aDefaultImageHC;
- Link m_aClickHdl;
-
- ScrollBar *m_pScrollBar;
-
- com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener;
-
- TheExtensionManager *m_pManager;
- //This mutex is used for synchronizing access to m_vEntries.
- //Currently it is used to synchronize adding, removing entries and
- //functions like getItemName, getItemDescription, etc. to prevent
- //that m_vEntries is accessed at an invalid index.
- //ToDo: There are many more places where m_vEntries is read and which may
- //fail. For example the Paint method is probable called from the main thread
- //while new entries are added / removed in a separate thread.
- mutable ::osl::Mutex m_entriesMutex;
- std::vector< TEntry_Impl > m_vEntries;
- std::vector< TEntry_Impl > m_vRemovedEntries;
-
- ::com::sun::star::lang::Locale *m_pLocale;
- CollatorWrapper *m_pCollator;
-
- void CalcActiveHeight( const long nPos );
- long GetTotalHeight() const;
- void SetupScrollBar();
- void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry );
- bool HandleTabKey( bool bReverse );
- bool HandleCursorKey( USHORT nKeyCode );
- bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound );
- bool isHCMode();
- void DeleteRemoved();
-
- //-----------------
- DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * );
-
- //Index starts with 1.
- //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid.
- void checkIndex(sal_Int32 pos) const;
-
-
-public:
- ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager );
- ~ExtensionBox_Impl();
-
- virtual void MouseButtonDown( const MouseEvent& rMEvt );
- virtual void Paint( const Rectangle &rPaintRect );
- virtual void Resize();
- virtual long Notify( NotifyEvent& rNEvt );
-
- const Size GetMinOutputSizePixel() const;
- void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; }
- TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; }
- long GetEntryCount() { return (long) m_vEntries.size(); }
- Rectangle GetEntryRect( const long nPos ) const;
- bool HasActive() { return m_bHasActive; }
- long PointToPos( const Point& rPos );
- void SetScrollHdl( const Link& rLink );
- void DoScroll( long nDelta );
- void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; }
- virtual void RecalcAll();
- void RemoveUnlocked();
-
- //-----------------
- virtual void selectEntry( const long nPos );
- long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager );
- void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
- void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage );
-
- void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr );
- void checkEntries();
-
- TheExtensionManager* getExtensionManager() const { return m_pManager; }
-
- //===================================================================================
- //These functions are used for automatic testing
-
- /** @return The count of the entries in the list box. */
- virtual sal_Int32 getItemCount() const;
-
- /** @return The index of the first selected entry in the list box.
- When nothing is selected, which is the case when getItemCount returns '0',
- then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */
- virtual sal_Int32 getSelIndex() const;
-
- /** @return The item name of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemName( sal_Int32 index ) const;
-
- /** @return The version string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const;
-
- /** @return The description string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const;
-
- /** @return The publisher string of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const;
-
- /** @return The link behind the publisher text of the entry with the given index
- The index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const;
-
- /** The entry at the given position will be selected
- Index starts with 0.
- Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */
- virtual void select( sal_Int32 pos );
-
- /** The first found entry with the given name will be selected
- When there was no entry found with the name, the selection doesn't change.
- Please note that there might be more than one entry with the same
- name, because:
- 1. the name is not unique
- 2. one extension can be installed as user and shared extension.
- */
- virtual void select( const ::rtl::OUString & sName );
-};
-
-}
+/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "rtl/ustring.hxx" +#include "vcl/scrbar.hxx" +#include "vcl/fixed.hxx" +#include "vcl/dialog.hxx" + +#include "svtools/extensionlistbox.hxx" +#include "svtools/fixedhyper.hxx" +#include "cppuhelper/implbase1.hxx" +#include "unotools/collatorwrapper.hxx" + +#include "com/sun/star/lang/Locale.hpp" +#include "com/sun/star/lang/XEventListener.hpp" +#include "com/sun/star/deployment/XPackage.hpp" +#include "com/sun/star/deployment/XPackageManager.hpp" + +#include <boost/shared_ptr.hpp> + +namespace dp_gui { + +#define SMALL_ICON_SIZE 16 +#define TOP_OFFSET 5 +#define ICON_HEIGHT 42 +#define ICON_WIDTH 47 +#define ICON_OFFSET 72 +#define RIGHT_ICON_OFFSET 5 +#define SPACE_BETWEEN 3 + +class TheExtensionManager; + +typedef ::boost::shared_ptr< svt::FixedHyperlink > TFixedHyperlink; + +//------------------------------------------------------------------------------ +// struct Entry_Impl +//------------------------------------------------------------------------------ +struct Entry_Impl; + +typedef ::boost::shared_ptr< Entry_Impl > TEntry_Impl; + +struct Entry_Impl +{ + bool m_bActive; + bool m_bLocked; + bool m_bHasOptions; + bool m_bShared; + bool m_bNew; + bool m_bChecked; + bool m_bMissingDeps; + PackageState m_eState; + String m_sTitle; + String m_sVersion; + String m_sDescription; + String m_sPublisher; + String m_sPublisherURL; + String m_sErrorText; + Image m_aIcon; + Image m_aIconHC; + svt::FixedHyperlink *m_pPublisher; + + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage> m_xPackage; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager> m_xPackageManager; + + Entry_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager, + PackageState eState ); + ~Entry_Impl(); + + StringCompare CompareTo( const CollatorWrapper *pCollator, const TEntry_Impl pEntry ) const; + void checkDependencies(); +}; + +//------------------------------------------------------------------------------ +// class ExtensionBox_Impl +//------------------------------------------------------------------------------ + +class ExtensionBox_Impl; + +//------------------------------------------------------------------------------ +class ExtensionRemovedListener : public ::cppu::WeakImplHelper1< ::com::sun::star::lang::XEventListener > +{ + ExtensionBox_Impl *m_pParent; + +public: + + ExtensionRemovedListener( ExtensionBox_Impl *pParent ) { m_pParent = pParent; } + ~ExtensionRemovedListener(); + + //=================================================================================== + // XEventListener + virtual void SAL_CALL disposing( ::com::sun::star::lang::EventObject const & evt ) + throw (::com::sun::star::uno::RuntimeException); +}; + +//------------------------------------------------------------------------------ +class ExtensionBox_Impl : public ::svt::IExtensionListBox +{ + bool m_bHasScrollBar; + bool m_bHasActive; + bool m_bNeedsRecalc; + bool m_bHasNew; + bool m_bInCheckMode; + bool m_bAdjustActive; + bool m_bInDelete; + //Must be guarded together with m_vEntries to ensure a valid index at all times. + //Use m_entriesMutex as guard. + long m_nActive; + long m_nTopIndex; + long m_nStdHeight; + long m_nActiveHeight; + long m_nExtraHeight; + Size m_aOutputSize; + Image m_aLockedImage; + Image m_aLockedImageHC; + Image m_aWarningImage; + Image m_aWarningImageHC; + Image m_aDefaultImage; + Image m_aDefaultImageHC; + Link m_aClickHdl; + + ScrollBar *m_pScrollBar; + + com::sun::star::uno::Reference< ExtensionRemovedListener > m_xRemoveListener; + + TheExtensionManager *m_pManager; + //This mutex is used for synchronizing access to m_vEntries. + //Currently it is used to synchronize adding, removing entries and + //functions like getItemName, getItemDescription, etc. to prevent + //that m_vEntries is accessed at an invalid index. + //ToDo: There are many more places where m_vEntries is read and which may + //fail. For example the Paint method is probable called from the main thread + //while new entries are added / removed in a separate thread. + mutable ::osl::Mutex m_entriesMutex; + std::vector< TEntry_Impl > m_vEntries; + std::vector< TEntry_Impl > m_vRemovedEntries; + + ::com::sun::star::lang::Locale *m_pLocale; + CollatorWrapper *m_pCollator; + + void CalcActiveHeight( const long nPos ); + long GetTotalHeight() const; + void SetupScrollBar(); + void DrawRow( const Rectangle& rRect, const TEntry_Impl pEntry ); + bool HandleTabKey( bool bReverse ); + bool HandleCursorKey( USHORT nKeyCode ); + bool FindEntryPos( const TEntry_Impl pEntry, long nStart, long nEnd, long &nFound ); + bool isHCMode(); + void DeleteRemoved(); + + //----------------- + DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar * ); + + //Index starts with 1. + //Throws an com::sun::star::lang::IllegalArgumentException, when the index is invalid. + void checkIndex(sal_Int32 pos) const; + + +public: + ExtensionBox_Impl( Dialog* pParent, TheExtensionManager *pManager ); + ~ExtensionBox_Impl(); + + virtual void MouseButtonDown( const MouseEvent& rMEvt ); + virtual void Paint( const Rectangle &rPaintRect ); + virtual void Resize(); + virtual long Notify( NotifyEvent& rNEvt ); + + const Size GetMinOutputSizePixel() const; + void SetExtraSize( long nSize ) { m_nExtraHeight = nSize; } + TEntry_Impl GetEntryData( long nPos ) { return m_vEntries[ nPos ]; } + long GetEntryCount() { return (long) m_vEntries.size(); } + Rectangle GetEntryRect( const long nPos ) const; + bool HasActive() { return m_bHasActive; } + long PointToPos( const Point& rPos ); + void SetScrollHdl( const Link& rLink ); + void DoScroll( long nDelta ); + void SetHyperlinkHdl( const Link& rLink ){ m_aClickHdl = rLink; } + virtual void RecalcAll(); + void RemoveUnlocked(); + + //----------------- + virtual void selectEntry( const long nPos ); + long addEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage, + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageManager ); + void updateEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + void removeEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > &xPackage ); + + void prepareChecking( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > &xPackageMgr ); + void checkEntries(); + + TheExtensionManager* getExtensionManager() const { return m_pManager; } + + //=================================================================================== + //These functions are used for automatic testing + + /** @return The count of the entries in the list box. */ + virtual sal_Int32 getItemCount() const; + + /** @return The index of the first selected entry in the list box. + When nothing is selected, which is the case when getItemCount returns '0', + then this function returns EXTENSION_LISTBOX_ENTRY_NOTFOUND */ + virtual sal_Int32 getSelIndex() const; + + /** @return The item name of the entry with the given index + The index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual ::rtl::OUString getItemName( sal_Int32 index ) const; + + /** @return The version string of the entry with the given index + The index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual ::rtl::OUString getItemVersion( sal_Int32 index ) const; + + /** @return The description string of the entry with the given index + The index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual ::rtl::OUString getItemDescription( sal_Int32 index ) const; + + /** @return The publisher string of the entry with the given index + The index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual ::rtl::OUString getItemPublisher( sal_Int32 index ) const; + + /** @return The link behind the publisher text of the entry with the given index + The index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual ::rtl::OUString getItemPublisherLink( sal_Int32 index ) const; + + /** The entry at the given position will be selected + Index starts with 0. + Throws an com::sun::star::lang::IllegalArgumentException, when the position is invalid. */ + virtual void select( sal_Int32 pos ); + + /** The first found entry with the given name will be selected + When there was no entry found with the name, the selection doesn't change. + Please note that there might be more than one entry with the same + name, because: + 1. the name is not unique + 2. one extension can be installed as user and shared extension. + */ + virtual void select( const ::rtl::OUString & sName ); +}; + +} diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index ee8c5d26c24f..061988d5b04d 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -2,13 +2,10 @@ * * 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_gui_service.cxx,v $ - * $Revision: 1.23.86.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_shared.hxx b/desktop/source/deployment/gui/dp_gui_shared.hxx index 0b23ccbd5f4c..4fa94c5ca17c 100644 --- a/desktop/source/deployment/gui/dp_gui_shared.hxx +++ b/desktop/source/deployment/gui/dp_gui_shared.hxx @@ -2,13 +2,10 @@ * * 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_gui_shared.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_system.cxx b/desktop/source/deployment/gui/dp_gui_system.cxx index 15f9597ce2df..740f598499fe 100644 --- a/desktop/source/deployment/gui/dp_gui_system.cxx +++ b/desktop/source/deployment/gui/dp_gui_system.cxx @@ -2,13 +2,10 @@ * * 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_gui_system.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_system.hxx b/desktop/source/deployment/gui/dp_gui_system.hxx index 68eb0fe28f32..dfdbbdfc0831 100644 --- a/desktop/source/deployment/gui/dp_gui_system.hxx +++ b/desktop/source/deployment/gui/dp_gui_system.hxx @@ -2,13 +2,10 @@ * * 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_gui_system.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx index 3d994f31c395..796918202a52 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.cxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.cxx @@ -2,14 +2,10 @@ * * 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_gui_theextmgr.cxx,v $ - * - * $Revision: 1.3.14.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -71,14 +67,6 @@ TheExtensionManager::TheExtensionManager( Window *pParent, m_pExtMgrDialog( NULL ), m_pUpdReqDialog( NULL ) { - if ( dp_misc::office_is_running() ) - { - m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); - if ( m_xDesktop.is() ) - m_xDesktop->addTerminateListener( this ); - } - m_sPackageManagers.realloc(2); m_sPackageManagers[0] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("user") ); m_sPackageManagers[1] = deployment::thePackageManagerFactory::get( m_xContext )->getPackageManager( OUSTR("shared") );; @@ -114,6 +102,16 @@ TheExtensionManager::TheExtensionManager( Window *pParent, } catch ( uno::Exception& ) {} + + if ( dp_misc::office_is_running() ) + { + // the registration should be done after the construction has been ended + // otherwise an exception prevents object creation, but it is registered as a listener + m_xDesktop.set( xContext->getServiceManager()->createInstanceWithContext( + OUSTR("com.sun.star.frame.Desktop"), xContext ), uno::UNO_QUERY ); + if ( m_xDesktop.is() ) + m_xDesktop->addTerminateListener( this ); + } } //------------------------------------------------------------------------------ diff --git a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx index 4ce6005a9346..1cdd1851d59e 100644 --- a/desktop/source/deployment/gui/dp_gui_theextmgr.hxx +++ b/desktop/source/deployment/gui/dp_gui_theextmgr.hxx @@ -2,14 +2,10 @@ * * 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_gui_theextmgr.hxx,v $ - * - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_thread.cxx b/desktop/source/deployment/gui/dp_gui_thread.cxx index d8a60b0ca4e5..24055fae72f6 100644 --- a/desktop/source/deployment/gui/dp_gui_thread.cxx +++ b/desktop/source/deployment/gui/dp_gui_thread.cxx @@ -2,13 +2,10 @@ * * 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_gui_thread.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_thread.hxx b/desktop/source/deployment/gui/dp_gui_thread.hxx index a58469c41c3b..ffcc2a5ddc54 100644 --- a/desktop/source/deployment/gui/dp_gui_thread.hxx +++ b/desktop/source/deployment/gui/dp_gui_thread.hxx @@ -2,13 +2,10 @@ * * 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_gui_thread.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_updatability.cxx b/desktop/source/deployment/gui/dp_gui_updatability.cxx deleted file mode 100644 index 4d3d8efbce2b..000000000000 --- a/desktop/source/deployment/gui/dp_gui_updatability.cxx +++ /dev/null @@ -1,280 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: dp_gui_updatability.cxx,v $ - * $Revision: 1.6.86.1 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_desktop.hxx" - -#include "sal/config.h" - -#include <cstddef> - -#include "com/sun/star/deployment/DeploymentException.hpp" -#include "com/sun/star/deployment/UpdateInformationProvider.hpp" -#include "com/sun/star/deployment/XPackage.hpp" -#include "com/sun/star/deployment/XPackageManager.hpp" -#include "com/sun/star/deployment/XUpdateInformationProvider.hpp" -#include "com/sun/star/task/XAbortChannel.hpp" -#include "com/sun/star/ucb/CommandAbortedException.hpp" -#include "com/sun/star/ucb/CommandFailedException.hpp" -#include "com/sun/star/ucb/XCommandEnvironment.hpp" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/RuntimeException.hpp" -#include "com/sun/star/uno/Sequence.hxx" -#include "com/sun/star/uno/XInterface.hpp" -#include "osl/conditn.hxx" -#include "osl/diagnose.h" -#include "osl/mutex.hxx" -#include "rtl/ref.hxx" -#include "rtl/ustring.h" -#include "rtl/ustring.hxx" -#include "sal/types.h" -#include "vcl/svapp.hxx" -#include "vcl/window.hxx" -#include "vos/mutex.hxx" - -#include "dp_misc.h" -#include "dp_gui_thread.hxx" -#include "dp_gui_updatability.hxx" - -namespace com { namespace sun { namespace star { namespace uno { - class XComponentContext; -} } } } - -using dp_gui::Updatability; - -namespace { - -namespace css = com::sun::star; - -} - -class Updatability::Thread: public dp_gui::Thread { -public: - Thread( - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > const & packageManagers, - Window & enabled); - - void start(); - - void stop(); - -private: - Thread(Thread &); // not defined - void operator =(Thread &); // not defined - - virtual ~Thread(); - - virtual void execute(); - - enum Input { NONE, START, STOP }; - - bool m_predeterminedUpdateUrl; - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > m_packageManagers; - - osl::Condition m_wakeup; - osl::Mutex m_mutex; - Window * m_enabled; - Input m_input; - css::uno::Reference< css::task::XAbortChannel > m_abort; -}; - -Updatability::Thread::Thread( - css::uno::Sequence< css::uno::Reference< - css::deployment::XPackageManager > > const & packageManagers, - Window & enabled): - m_predeterminedUpdateUrl(dp_misc::getExtensionDefaultUpdateURL().getLength() > 0), - m_packageManagers(packageManagers), - m_enabled(&enabled), - m_input(NONE) -{} - -void Updatability::Thread::start() { - css::uno::Reference< css::task::XAbortChannel > abort; - { - osl::MutexGuard g(m_mutex); - m_input = START; - abort = m_abort; - m_abort.clear(); - } - m_wakeup.set(); - if (abort.is()) { - abort->sendAbort(); - } -} - -void Updatability::Thread::stop() { - css::uno::Reference< css::task::XAbortChannel > abort; - { - vos::OGuard g1(Application::GetSolarMutex()); - osl::MutexGuard g2(m_mutex); - m_input = STOP; - m_enabled = NULL; - abort = m_abort; - m_abort.clear(); - } - m_wakeup.set(); - if (abort.is()) { - abort->sendAbort(); - } -} - -Updatability::Thread::~Thread() {} - -void Updatability::Thread::execute() { - for (;;) { - - if (m_wakeup.wait() != osl::Condition::result_ok) { - dp_misc::TRACE("dp_gui::Updatability::Thread::run: ignored \n"); - dp_misc::TRACE("osl::Condition::wait failure\n"); - } - m_wakeup.reset(); - Input input; - { - osl::MutexGuard g(m_mutex); - input = m_input; - m_input = NONE; - } - if (input == NONE) { - continue; - } - start: - if (input == STOP) { - break; - } - bool enabled = false; - for (sal_Int32 i = 0; !enabled && i < m_packageManagers.getLength(); - ++i) - { - css::uno::Reference< css::task::XAbortChannel > abort( - m_packageManagers[i]->createAbortChannel()); - { - osl::MutexGuard g(m_mutex); - input = m_input; - m_input = NONE; - if (input == NONE) { - //In case input would be STOP then we would later break out of the loop - //before further calls to the XPackageManger are done. That is, the abort - //channel would not be used anyway. - m_abort = abort; - } - if (input != NONE) { - goto start; - } - } - css::uno::Sequence< - css::uno::Reference< css::deployment::XPackage > > ps; - try { - ps = m_packageManagers[i]->getDeployedPackages( - abort, - css::uno::Reference< css::ucb::XCommandEnvironment >()); - } catch (css::deployment::DeploymentException &) { - // If there are any problematic package managers, enable the - // update button and let the update process report any problems - // to the user: - enabled = true; - continue; - } catch (css::ucb::CommandFailedException &) { - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "CommandFailedException: cannot happen")), - css::uno::Reference< css::uno::XInterface >()); - } catch (css::ucb::CommandAbortedException &) { - osl::MutexGuard g(m_mutex); - input = m_input; - m_input = NONE; - OSL_ASSERT(input != NONE); - goto start; - } catch (css::lang::IllegalArgumentException &) { - throw css::uno::RuntimeException( - rtl::OUString( - RTL_CONSTASCII_USTRINGPARAM( - "IllegalArgumentException: cannot happen")), - css::uno::Reference< css::uno::XInterface >()); - } - if (m_predeterminedUpdateUrl && ps.getLength() != 0) { - enabled = true; - } else { - for (sal_Int32 j = 0; j < ps.getLength(); ++j) { - if (ps[j]->getUpdateInformationURLs().getLength() != 0) { - enabled = true; - break; - } - { - osl::MutexGuard g(m_mutex); - input = m_input; - m_input = NONE; - } - if (input != NONE) { - goto start; - } - } - } - } - vos::OGuard g1(Application::GetSolarMutex()); - Window * e; - { - osl::MutexGuard g2(m_mutex); - e = m_enabled; - } - if (e != NULL) { - e->Enable(enabled); - } - } -} - -Updatability::Updatability( - css::uno::Sequence< - css::uno::Reference< css::deployment::XPackageManager > > const & - packageManagers, - Window & enabled): - m_thread(new Thread(packageManagers, enabled)) -{ - m_thread->launch(); -} - -Updatability::~Updatability() { - -} - -void Updatability::start() { - m_thread->start(); -} - -void Updatability::stop() { - m_thread->stop(); - // Bad hack; m_thread calls Application::GetSolarMutex, which only works - // as long as DeInitVCL has not been called: - ULONG n = Application::ReleaseSolarMutex(); - m_thread->join(); - Application::AcquireSolarMutex(n); -} diff --git a/desktop/source/deployment/gui/dp_gui_updatability.hxx b/desktop/source/deployment/gui/dp_gui_updatability.hxx deleted file mode 100644 index 3cefdb019f6d..000000000000 --- a/desktop/source/deployment/gui/dp_gui_updatability.hxx +++ /dev/null @@ -1,104 +0,0 @@ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2008 by Sun Microsystems, Inc. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * $RCSfile: dp_gui_updatability.hxx,v $ - * $Revision: 1.4 $ - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATABILITY_HXX -#define INCLUDED_DESKTOP_SOURCE_DEPLOYMENT_GUI_DP_GUI_UPDATABILITY_HXX - -#include "sal/config.h" -#include "com/sun/star/uno/Reference.hxx" -#include "com/sun/star/uno/Sequence.hxx" -#include "rtl/ref.hxx" - -/// @HTML - -class Window; -namespace com { namespace sun { namespace star { - namespace deployment { class XPackageManager; } - namespace uno { class XComponentContext; } -} } } - -namespace dp_gui { - -/** - Asynchronously determine whether <code>dp_gui::DialogImpl</code>'s - “Check for Updates...” button shall be enabled (which - theoretically can take some time). - - <p>Note that, due to the asynchronous operation, the button may be enabled - even if there are no updatable extensions.</p> - - <p>Each instance of this class must be called from a single thread in order - to adhere to the following protocol: <code>stop</code> must be called exactly - once, with no intervening calls to <code>start</code>, before the destructor - is called.</p> -*/ -class Updatability { -public: - /** - Create an instance. - - @param packageManagers - a list of non-null package managers - - @param enabled - <code>dp_gui::DialogImpl</code>'s “Check for Updates...” - button; will only be accessed with the solar mutex locked - */ - Updatability( - com::sun::star::uno::Sequence< com::sun::star::uno::Reference< - com::sun::star::deployment::XPackageManager > > const & - packageManagers, - Window & enabled); - - ~Updatability(); - - /** - (Re-)start determining whether <code>dp_gui::DialogImpl</code>'s - “Check for Updates...” button shall be enabled. - */ - void start(); - - /** - Orderly shut down this instance. - */ - void stop(); - -private: - Updatability(Updatability &); // not defined - void operator =(Updatability &); // not defined - - class Thread; - - rtl::Reference< Thread > m_thread; -}; - -} - -#endif diff --git a/desktop/source/deployment/gui/dp_gui_updatedata.hxx b/desktop/source/deployment/gui/dp_gui_updatedata.hxx index 610960b99734..dda6126f70d0 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedata.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedata.hxx @@ -2,13 +2,10 @@ * * 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_gui_updatedata.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx index 58e2cbd9bd0a..61479f799e6f 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.cxx @@ -2,7 +2,7 @@ * * 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 * @@ -256,9 +256,9 @@ private: virtual ~Thread(); virtual void execute(); - +#if 0 void handleGeneralError(css::uno::Any const & exception) const; - +#endif void handleSpecificError( css::uno::Reference< css::deployment::XPackage > const & package, css::uno::Any const & exception) const; @@ -413,7 +413,7 @@ void UpdateDialog::Thread::execute() m_dialog.checkingDone(); } } - +#if 0 void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) const { @@ -427,7 +427,7 @@ void UpdateDialog::Thread::handleGeneralError(css::uno::Any const & exception) m_dialog.addGeneralError(message); } } - +#endif //Parameter package can be null void UpdateDialog::Thread::handleSpecificError( css::uno::Reference< css::deployment::XPackage > const & package, @@ -782,7 +782,7 @@ void UpdateDialog::addDisabledUpdate(UpdateDialog::DisabledUpdate const & data) SvLBoxButtonKind_disabledCheckbox); // position overflow is rather harmless } - +#if 0 void UpdateDialog::addGeneralError(rtl::OUString const & message) { std::vector< rtl::OUString >::size_type n = m_generalErrors.size(); m_generalErrors.push_back(message); @@ -793,7 +793,7 @@ void UpdateDialog::addGeneralError(rtl::OUString const & message) { UpdateDialog::Index::newGeneralError(n), SvLBoxButtonKind_staticImage); // position overflow is rather harmless } - +#endif void UpdateDialog::addSpecificError(UpdateDialog::SpecificError const & data) { std::vector< UpdateDialog::SpecificError >::size_type n = m_specificErrors.size(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx index 578ad6b6f01d..1a8484e2c20f 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.hxx @@ -2,7 +2,7 @@ * * 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 * @@ -157,9 +157,9 @@ private: rtl::OUString const & name, dp_gui::UpdateData const & data); void addDisabledUpdate(UpdateDialog::DisabledUpdate const & data); - +#if 0 void addGeneralError(rtl::OUString const & message); - +#endif void addSpecificError(UpdateDialog::SpecificError const & data); void checkingDone(); diff --git a/desktop/source/deployment/gui/dp_gui_updatedialog.src b/desktop/source/deployment/gui/dp_gui_updatedialog.src index 49d3c1c0cf8e..b86a8ad66f08 100644 --- a/desktop/source/deployment/gui/dp_gui_updatedialog.src +++ b/desktop/source/deployment/gui/dp_gui_updatedialog.src @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx index 76e182825397..113e6d2069ac 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.cxx @@ -2,13 +2,10 @@ * * 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_gui_updateinstalldialog.cxx,v $ - * $Revision: 1.9.76.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx index 9c755354fbf6..c3d01c8ee6d9 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.hxx @@ -2,13 +2,10 @@ * * 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_gui_updateinstalldialog.hxx,v $ - * $Revision: 1.4.126.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src index 873eaabbf23f..d77dd256582c 100644 --- a/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src +++ b/desktop/source/deployment/gui/dp_gui_updateinstalldialog.src @@ -2,13 +2,10 @@ * * 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_gui_updateinstalldialog.src,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/dp_gui_versionboxes.src b/desktop/source/deployment/gui/dp_gui_versionboxes.src index 1e154c017328..878521ad6dd2 100644 --- a/desktop/source/deployment/gui/dp_gui_versionboxes.src +++ b/desktop/source/deployment/gui/dp_gui_versionboxes.src @@ -2,13 +2,10 @@ * * 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_gui_versionboxes.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index 5a503b57c89d..50992eb07a97 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -2,13 +2,10 @@ * * 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: license_dialog.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/license_dialog.hxx b/desktop/source/deployment/gui/license_dialog.hxx index 76bba106917f..4733922dc607 100644 --- a/desktop/source/deployment/gui/license_dialog.hxx +++ b/desktop/source/deployment/gui/license_dialog.hxx @@ -2,13 +2,10 @@ * * 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: license_dialog.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/gui/makefile.mk b/desktop/source/deployment/gui/makefile.mk index 4d563ae1591a..6a9c7b6bbb38 100644 --- a/desktop/source/deployment/gui/makefile.mk +++ b/desktop/source/deployment/gui/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.20.30.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -56,7 +52,6 @@ SLOFILES = \ $(SLO)$/license_dialog.obj \ $(SLO)$/dp_gui_dependencydialog.obj \ $(SLO)$/dp_gui_thread.obj \ - $(SLO)$/dp_gui_updatability.obj \ $(SLO)$/dp_gui_updatedialog.obj \ $(SLO)$/dp_gui_updateinstalldialog.obj \ $(SLO)$/dp_gui_autoscrolledit.obj \ @@ -65,7 +60,7 @@ SLOFILES = \ $(SLO)$/descedit.obj SHL1TARGET = $(TARGET)$(DLLPOSTFIX).uno -SHL1VERSIONMAP = ..$/deployment.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS = \ $(SALLIB) \ diff --git a/desktop/source/deployment/inc/db.hxx b/desktop/source/deployment/inc/db.hxx index 42c0e734cf0f..75dbd942a7cd 100644 --- a/desktop/source/deployment/inc/db.hxx +++ b/desktop/source/deployment/inc/db.hxx @@ -2,13 +2,10 @@ * * 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: db.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_dependencies.hxx b/desktop/source/deployment/inc/dp_dependencies.hxx index bff5e2c8a89f..13be1e8612fb 100644 --- a/desktop/source/deployment/inc/dp_dependencies.hxx +++ b/desktop/source/deployment/inc/dp_dependencies.hxx @@ -2,13 +2,10 @@ * * 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_dependencies.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -66,20 +63,6 @@ namespace Dependencies { check(::dp_misc::DescriptionInfoset const & infoset); /** - Obtain the (human-readable) name of a dependency. - - @param dependency - a dependency represented as a non-null XML element - - @return - the name of the dependency; will never be empty, as a localized - “unknown” is substituted for an empty/missing name - */ - DESKTOP_DEPLOYMENTMISC_DLLPUBLIC ::rtl::OUString name( - ::com::sun::star::uno::Reference< - ::com::sun::star::xml::dom::XElement > const & dependency); - - /** Obtain the (human-readable) error message of a failed dependency. @param dependency diff --git a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx index 0ad48316e0fa..38a1870782ed 100644 --- a/desktop/source/deployment/inc/dp_descriptioninfoset.hxx +++ b/desktop/source/deployment/inc/dp_descriptioninfoset.hxx @@ -2,13 +2,10 @@ * * 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_descriptioninfoset.hxx,v $ - * $Revision: 1.9.34.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -56,6 +53,15 @@ namespace rtl { class OUString; } namespace dp_misc { +struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC SimpleLicenseAttributes +{ + ::rtl::OUString acceptBy; + //Attribute suppress-on-update. Default is false. + bool suppressOnUpdate; + //Attribute suppress-if-required. Default is false. + bool suppressIfRequired; +}; + /** Access to the content of an XML <code>description</code> element. @@ -135,6 +141,13 @@ public: */ ::rtl::OUString getLocalizedLicenseURL() const; + /** returns the attributes of the simple-license element + + As long as there is a simple-license element, the function will return + the structure. If it does not exist, then the optional object is uninitialized. + */ + ::boost::optional<SimpleLicenseAttributes> getSimpleLicenseAttributes() const; + /** returns the localized display name of the extensions. In case there is no localized display-name then an empty string is returned. diff --git a/desktop/source/deployment/inc/dp_identifier.hxx b/desktop/source/deployment/inc/dp_identifier.hxx index ac7b89ba6fbd..6fc49c30085c 100644 --- a/desktop/source/deployment/inc/dp_identifier.hxx +++ b/desktop/source/deployment/inc/dp_identifier.hxx @@ -2,13 +2,10 @@ * * 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_identifier.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_interact.h b/desktop/source/deployment/inc/dp_interact.h index dd93cf2baf1a..b6116b9a1266 100644 --- a/desktop/source/deployment/inc/dp_interact.h +++ b/desktop/source/deployment/inc/dp_interact.h @@ -2,13 +2,10 @@ * * 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_interact.h,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_misc.h b/desktop/source/deployment/inc/dp_misc.h index 0c90ed25375a..a717e7797c8a 100644 --- a/desktop/source/deployment/inc/dp_misc.h +++ b/desktop/source/deployment/inc/dp_misc.h @@ -2,13 +2,10 @@ * * 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_misc.h,v $ - * $Revision: 1.13.86.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_misc.mk b/desktop/source/deployment/inc/dp_misc.mk index 29ba4d489860..829a6bb96bbf 100644 --- a/desktop/source/deployment/inc/dp_misc.mk +++ b/desktop/source/deployment/inc/dp_misc.mk @@ -2,14 +2,10 @@ # # 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_misc.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_misc_api.hxx b/desktop/source/deployment/inc/dp_misc_api.hxx index ba95bdcc1135..ef34ef06872c 100644 --- a/desktop/source/deployment/inc/dp_misc_api.hxx +++ b/desktop/source/deployment/inc/dp_misc_api.hxx @@ -2,13 +2,10 @@ * * 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_misc_api.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_persmap.h b/desktop/source/deployment/inc/dp_persmap.h index 3a0873e5c05b..bb3f58269e62 100644 --- a/desktop/source/deployment/inc/dp_persmap.h +++ b/desktop/source/deployment/inc/dp_persmap.h @@ -2,13 +2,10 @@ * * 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_persmap.h,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -56,8 +53,6 @@ public: /** in mem db */ PersistentMap(); - void flush() const; - bool has( ::rtl::OString const & key ) const; bool get( ::rtl::OString * value, ::rtl::OString const & key ) const; t_string2string_map getEntries() const; diff --git a/desktop/source/deployment/inc/dp_platform.hxx b/desktop/source/deployment/inc/dp_platform.hxx index 51c33f49dffe..95853746bef2 100644 --- a/desktop/source/deployment/inc/dp_platform.hxx +++ b/desktop/source/deployment/inc/dp_platform.hxx @@ -2,14 +2,10 @@ * * 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_platform.hxx,v $ - * - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_resource.h b/desktop/source/deployment/inc/dp_resource.h index c7b5045d268a..7dcdd7df7fbb 100644 --- a/desktop/source/deployment/inc/dp_resource.h +++ b/desktop/source/deployment/inc/dp_resource.h @@ -2,13 +2,10 @@ * * 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_resource.h,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_ucb.h b/desktop/source/deployment/inc/dp_ucb.h index 1d8aabb72a50..6f9127504860 100644 --- a/desktop/source/deployment/inc/dp_ucb.h +++ b/desktop/source/deployment/inc/dp_ucb.h @@ -2,13 +2,10 @@ * * 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_ucb.h,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_version.hxx b/desktop/source/deployment/inc/dp_version.hxx index 94a01fa6601f..9808ebaab388 100644 --- a/desktop/source/deployment/inc/dp_version.hxx +++ b/desktop/source/deployment/inc/dp_version.hxx @@ -2,13 +2,10 @@ * * 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_version.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/inc/dp_xml.h b/desktop/source/deployment/inc/dp_xml.h index 4f175010306e..41c12f282428 100644 --- a/desktop/source/deployment/inc/dp_xml.h +++ b/desktop/source/deployment/inc/dp_xml.h @@ -2,13 +2,10 @@ * * 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_xml.h,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/makefile.mk b/desktop/source/deployment/makefile.mk index f63661df4cd5..7eda0f582e15 100644 --- a/desktop/source/deployment/makefile.mk +++ b/desktop/source/deployment/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.18 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -53,7 +49,7 @@ INCPRE += inc DLLPRE = SHL1TARGET = $(TARGET)$(DLLPOSTFIX).uno -SHL1VERSIONMAP = deployment.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1LIBS = \ $(SLB)$/deployment_manager.lib \ @@ -84,7 +80,8 @@ SHL1STDLIBS = \ $(SVLLIB) \ $(UNOTOOLSLIB) \ $(DEPLOYMENTMISCLIB) \ - $(HELPLINKERLIB) + $(HELPLINKERLIB) \ + $(CONFIGMGRLIB) SHL1DEPN = SHL1IMPLIB = i$(TARGET) diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index d97b94d62acb..04dc22b77a77 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -2,13 +2,10 @@ * * 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_activepackages.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/manager/dp_activepackages.hxx b/desktop/source/deployment/manager/dp_activepackages.hxx index 8ef57c3fe56d..1c58f76be245 100644 --- a/desktop/source/deployment/manager/dp_activepackages.hxx +++ b/desktop/source/deployment/manager/dp_activepackages.hxx @@ -2,13 +2,10 @@ * * 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_activepackages.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index a769d083e75f..9f2e0c9e1177 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index f0635eec3d72..165efbaeca5a 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -2,13 +2,10 @@ * * 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.cxx,v $ - * $Revision: 1.33.8.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -314,18 +311,6 @@ Reference<deployment::XPackageManager> PackageManagerImpl::create( } } - //Workaround. See issue http://www.openoffice.org/issues/show_bug.cgi?id=99257 - //This prevents the copying of the common.rdbf and native rdbs. It disables the - //feature to add shared extensions in a running office. - if (!that->m_readOnly && context.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("shared") )) - { - OUString sNoRdb; - ::rtl::Bootstrap::get(OUSTR("NORDBCOPY"), sNoRdb); - if (sNoRdb.equalsIgnoreAsciiCase(OUSTR("true")) - && dp_misc::office_is_running()) - that->m_readOnly = true; - } - if (!that->m_readOnly && logFile.getLength() > 0) { const Any any_logFile(logFile); diff --git a/desktop/source/deployment/manager/dp_manager.h b/desktop/source/deployment/manager/dp_manager.h index 6051eea9f757..ffa7252d7883 100644 --- a/desktop/source/deployment/manager/dp_manager.h +++ b/desktop/source/deployment/manager/dp_manager.h @@ -2,13 +2,10 @@ * * 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 diff --git a/desktop/source/deployment/manager/dp_manager.hrc b/desktop/source/deployment/manager/dp_manager.hrc index fc5ddf95fc50..bdbfc079cda6 100644 --- a/desktop/source/deployment/manager/dp_manager.hrc +++ b/desktop/source/deployment/manager/dp_manager.hrc @@ -2,13 +2,10 @@ * * 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.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/manager/dp_manager.src b/desktop/source/deployment/manager/dp_manager.src index 34a8bfa3ac5e..95ede4aa6227 100644 --- a/desktop/source/deployment/manager/dp_manager.src +++ b/desktop/source/deployment/manager/dp_manager.src @@ -2,13 +2,10 @@ * * 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.src,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/manager/dp_managerfac.cxx b/desktop/source/deployment/manager/dp_managerfac.cxx index a96284d2ff1a..d4c9df1d57af 100644 --- a/desktop/source/deployment/manager/dp_managerfac.cxx +++ b/desktop/source/deployment/manager/dp_managerfac.cxx @@ -2,13 +2,10 @@ * * 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_managerfac.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/manager/makefile.mk b/desktop/source/deployment/manager/makefile.mk index 6e4c282b3573..a9ff47881fc3 100644 --- a/desktop/source/deployment/manager/makefile.mk +++ b/desktop/source/deployment/manager/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.10 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/migration/dp_migration.cxx b/desktop/source/deployment/migration/dp_migration.cxx index c09abd5e89cb..49362f7e2f5f 100644 --- a/desktop/source/deployment/migration/dp_migration.cxx +++ b/desktop/source/deployment/migration/dp_migration.cxx @@ -2,13 +2,10 @@ * * 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_migration.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/migration/makefile.mk b/desktop/source/deployment/migration/makefile.mk index 8eaccc68cd8b..a37b7e5bebf8 100644 --- a/desktop/source/deployment/migration/makefile.mk +++ b/desktop/source/deployment/migration/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/db.cxx b/desktop/source/deployment/misc/db.cxx index c51c0bcadc8c..a394731921c8 100644 --- a/desktop/source/deployment/misc/db.cxx +++ b/desktop/source/deployment/misc/db.cxx @@ -2,13 +2,10 @@ * * 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: db.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_dependencies.cxx b/desktop/source/deployment/misc/dp_dependencies.cxx index 6ddadcf7c24a..63badbb0c211 100644 --- a/desktop/source/deployment/misc/dp_dependencies.cxx +++ b/desktop/source/deployment/misc/dp_dependencies.cxx @@ -2,7 +2,7 @@ * * 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 * @@ -127,18 +127,6 @@ check(::dp_misc::DescriptionInfoset const & infoset) { return unsatisfied; } -::rtl::OUString -name(css::uno::Reference< css::xml::dom::XElement > const & dependency) { - ::rtl::OUString n( - dependency->getAttributeNS( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(xmlNamespace)), - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("name")))); - return n.getLength() == 0 - ? ::rtl::OUString( - ::String(::dp_misc::getResId(RID_DEPLYOMENT_DEPENDENCIES_UNKNOWN))) - : n; -} - ::rtl::OUString getErrorText( css::uno::Reference< css::xml::dom::XElement > const & dependency ) { ::rtl::OUString sReason; diff --git a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx index 2d5d8835b7f3..28f45918e9e2 100644 --- a/desktop/source/deployment/misc/dp_descriptioninfoset.cxx +++ b/desktop/source/deployment/misc/dp_descriptioninfoset.cxx @@ -2,13 +2,10 @@ * * 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_descriptioninfoset.cxx,v $ - * $Revision: 1.7.34.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -373,6 +370,50 @@ css::uno::Sequence< ::rtl::OUString > DescriptionInfoset::getUrls( } +::boost::optional<SimpleLicenseAttributes> +DescriptionInfoset::getSimpleLicenseAttributes() const +{ + //Check if the node exist + css::uno::Reference< css::xml::dom::XNode > n; + if (m_element.is()) { + try { + n = m_xpath->selectSingleNode(m_element, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + } catch (css::xml::xpath::XPathException &) { + // ignore + } + if (n.is()) + { + SimpleLicenseAttributes attributes; + attributes.acceptBy = + getNodeValueFromExpression(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@accept-by"))); + + ::boost::optional< ::rtl::OUString > suppressOnUpdate = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-on-update"))); + if (suppressOnUpdate) + attributes.suppressOnUpdate = (*suppressOnUpdate).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressOnUpdate = false; + + ::boost::optional< ::rtl::OUString > suppressIfRequired = getOptionalValue( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( + "/desc:description/desc:registration/desc:simple-license/@suppress-if-required"))); + if (suppressIfRequired) + attributes.suppressIfRequired = (*suppressIfRequired).trim().equalsIgnoreAsciiCase( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("true"))); + else + attributes.suppressIfRequired = false; + + return ::boost::optional<SimpleLicenseAttributes>(attributes); + } + } + return ::boost::optional<SimpleLicenseAttributes>(); +} + ::rtl::OUString DescriptionInfoset::getLocalizedDescriptionURL() const { return getLocalizedHREFAttrFromChild(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( diff --git a/desktop/source/deployment/misc/dp_identifier.cxx b/desktop/source/deployment/misc/dp_identifier.cxx index 639672449454..9659bc6759fd 100644 --- a/desktop/source/deployment/misc/dp_identifier.cxx +++ b/desktop/source/deployment/misc/dp_identifier.cxx @@ -2,13 +2,10 @@ * * 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_identifier.cxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_interact.cxx b/desktop/source/deployment/misc/dp_interact.cxx index 76688ff2ae58..36e7fd037ccf 100644 --- a/desktop/source/deployment/misc/dp_interact.cxx +++ b/desktop/source/deployment/misc/dp_interact.cxx @@ -2,13 +2,10 @@ * * 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_interact.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_misc.cxx b/desktop/source/deployment/misc/dp_misc.cxx index d63d901290a0..3ed2d554b59f 100644 --- a/desktop/source/deployment/misc/dp_misc.cxx +++ b/desktop/source/deployment/misc/dp_misc.cxx @@ -2,13 +2,10 @@ * * 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_misc.cxx,v $ - * $Revision: 1.19.8.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -439,19 +436,19 @@ OUString readConsole() { OSL_ASSERT((dwRead % 2) == 0); OUString value( aBuffer, dwRead / 2); - value = value.trim(); - return value; + return value.trim(); } - return OUString(); - #else char buf[1024]; rtl_zeroMemory(buf, 1024); // read one char less so that the last char in buf is always zero - fgets(buf, 1024, stdin); - OUString value = ::rtl::OStringToOUString(::rtl::OString(buf), osl_getThreadTextEncoding()); - return value.trim(); + if (fgets(buf, 1024, stdin) != NULL) + { + OUString value = ::rtl::OStringToOUString(::rtl::OString(buf), osl_getThreadTextEncoding()); + return value.trim(); + } #endif + return OUString(); } void TRACE(::rtl::OUString const & sText) diff --git a/desktop/source/deployment/misc/dp_misc.hrc b/desktop/source/deployment/misc/dp_misc.hrc index 287ce3d99def..55fabac5c5b5 100644 --- a/desktop/source/deployment/misc/dp_misc.hrc +++ b/desktop/source/deployment/misc/dp_misc.hrc @@ -2,13 +2,10 @@ * * 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_misc.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_misc.src b/desktop/source/deployment/misc/dp_misc.src index 98f3d8bc2211..0d341122af16 100644 --- a/desktop/source/deployment/misc/dp_misc.src +++ b/desktop/source/deployment/misc/dp_misc.src @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/source/deployment/misc/dp_platform.cxx b/desktop/source/deployment/misc/dp_platform.cxx index 218eb0a98113..bb93f78689b6 100644 --- a/desktop/source/deployment/misc/dp_platform.cxx +++ b/desktop/source/deployment/misc/dp_platform.cxx @@ -2,14 +2,10 @@ * * 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_platform.cxx,v $ - * - * $Revision: 1.2.86.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_resource.cxx b/desktop/source/deployment/misc/dp_resource.cxx index e89fb9358b26..10ee436ff60c 100644 --- a/desktop/source/deployment/misc/dp_resource.cxx +++ b/desktop/source/deployment/misc/dp_resource.cxx @@ -2,13 +2,10 @@ * * 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_resource.cxx,v $ - * $Revision: 1.19 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/dp_ucb.cxx b/desktop/source/deployment/misc/dp_ucb.cxx index 8a4f55caae1a..571aef9c1b95 100644 --- a/desktop/source/deployment/misc/dp_ucb.cxx +++ b/desktop/source/deployment/misc/dp_ucb.cxx @@ -2,13 +2,10 @@ * * 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_ucb.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -40,7 +37,6 @@ #include "xmlscript/xml_helper.hxx" #include "com/sun/star/io/XInputStream.hpp" #include "com/sun/star/ucb/CommandFailedException.hpp" -#include "com/sun/star/ucb/XContentCreator.hpp" #include "com/sun/star/ucb/ContentInfo.hpp" #include "com/sun/star/ucb/ContentInfoAttribute.hpp" @@ -130,50 +126,46 @@ bool create_folder( if (! create_folder( &parentContent, url.copy( 0, slash ), xCmdEnv, throw_exc )) return false; - Reference<XContentCreator> xCreator( parentContent.get(), UNO_QUERY ); - if (xCreator.is()) + const Any title( ::rtl::Uri::decode( url.copy( slash + 1 ), + rtl_UriDecodeWithCharset, + RTL_TEXTENCODING_UTF8 ) ); + const Sequence<ContentInfo> infos( + parentContent.queryCreatableContentsInfo() ); + for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos ) { - const Any title( ::rtl::Uri::decode( url.copy( slash + 1 ), - rtl_UriDecodeWithCharset, - RTL_TEXTENCODING_UTF8 ) ); - const Sequence<ContentInfo> infos( - xCreator->queryCreatableContentsInfo() ); - for ( sal_Int32 pos = 0; pos < infos.getLength(); ++pos ) + // look KIND_FOLDER: + ContentInfo const & info = infos[ pos ]; + if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0) { - // look KIND_FOLDER: - ContentInfo const & info = infos[ pos ]; - if ((info.Attributes & ContentInfoAttribute::KIND_FOLDER) != 0) - { - // make sure the only required bootstrap property is "Title": - Sequence<beans::Property> const & rProps = info.Properties; - if (rProps.getLength() != 1 || - !rProps[ 0 ].Name.equalsAsciiL( - RTL_CONSTASCII_STRINGPARAM("Title") )) - continue; + // make sure the only required bootstrap property is "Title": + Sequence<beans::Property> const & rProps = info.Properties; + if (rProps.getLength() != 1 || + !rProps[ 0 ].Name.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("Title") )) + continue; - try { - if (parentContent.insertNewContent( - info.Type, - Sequence<OUString>( &StrTitle::get(), 1 ), - Sequence<Any>( &title, 1 ), - ucb_content )) { - if (ret_ucb_content != 0) - *ret_ucb_content = ucb_content; - return true; - } + try { + if (parentContent.insertNewContent( + info.Type, + Sequence<OUString>( &StrTitle::get(), 1 ), + Sequence<Any>( &title, 1 ), + ucb_content )) { + if (ret_ucb_content != 0) + *ret_ucb_content = ucb_content; + return true; } - catch (RuntimeException &) { + } + catch (RuntimeException &) { + throw; + } + catch (CommandFailedException &) { + // Interaction Handler already handled the error + // that has occured... + } + catch (Exception &) { + if (throw_exc) throw; - } - catch (CommandFailedException &) { - // Interaction Handler already handled the error - // that has occured... - } - catch (Exception &) { - if (throw_exc) - throw; - return false; - } + return false; } } } diff --git a/desktop/source/deployment/misc/dp_version.cxx b/desktop/source/deployment/misc/dp_version.cxx index dac726583693..1668ebe4a0b7 100644 --- a/desktop/source/deployment/misc/dp_version.cxx +++ b/desktop/source/deployment/misc/dp_version.cxx @@ -2,13 +2,10 @@ * * 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_version.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/misc/makefile.mk b/desktop/source/deployment/misc/makefile.mk index b06788de8d8b..e191169202fd 100644 --- a/desktop/source/deployment/misc/makefile.mk +++ b/desktop/source/deployment/misc/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.17 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 361004b353a3..e6781e2a1746 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -2,13 +2,10 @@ * * 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_component.cxx,v $ - * $Revision: 1.24 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -125,7 +122,7 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend Reference<XComponentContext> m_xRemoteContext; enum reg { - REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED + REG_UNINIT, REG_VOID, REG_REGISTERED, REG_NOT_REGISTERED, REG_MAYBE_REGISTERED } m_registered; Reference<loader::XImplementationLoader> getComponentInfo( @@ -147,6 +144,10 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend const Reference<registry::XSimpleRegistry> getRDB() const; + //Provides the read-only registry (e.g. not the one based on the duplicated + //rdb files + const Reference<registry::XSimpleRegistry> getRDB_RO() const; + public: inline ComponentPackageImpl( ::rtl::Reference<PackageRegistryBackend> const & myBackend, @@ -224,9 +225,22 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend OUString m_commonRDB; OUString m_nativeRDB; + + //URLs of the read-only rdbs (e.g. not the ones of the duplicated files) + OUString m_commonRDB_RO; + OUString m_nativeRDB_RO; + + //These rdbs are for writing new service entries. The rdb files are copies + //which are created when services are added or removed. Reference<registry::XSimpleRegistry> m_xCommonRDB; Reference<registry::XSimpleRegistry> m_xNativeRDB; + //These rdbs are created on the read-only rdbs which are already used + //by UNO since the startup of the current session. + Reference<registry::XSimpleRegistry> m_xCommonRDB_RO; + Reference<registry::XSimpleRegistry> m_xNativeRDB_RO; + + void unorc_verify_init( Reference<XCommandEnvironment> const & xCmdEnv ); void unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ); @@ -255,6 +269,9 @@ public: //Will be called from ComponentPackageImpl void initServiceRdbFiles(); + + //Creates the READ ONLY registries (m_xCommonRDB_RO,m_xNativeRDB_RO) + void initServiceRdbFiles_RO(); }; //______________________________________________________________________________ @@ -262,12 +279,12 @@ const Reference<registry::XSimpleRegistry> BackendImpl::ComponentPackageImpl::getRDB() const { BackendImpl * that = getMyBackend(); + //Late "initialization" of the services rdb files //This is to prevent problems when running several //instances of OOo with root rights in parallel. This //would otherwise cause problems when copying the rdbs. - //Now this code is only performed if isRegistered or processPackage - //is called. + //See http://qa.openoffice.org/issues/show_bug.cgi?id=99257 { const ::osl::MutexGuard guard( getMutex() ); if (!that->bSwitchedRdbFiles) @@ -276,7 +293,6 @@ BackendImpl::ComponentPackageImpl::getRDB() const that->initServiceRdbFiles(); } } - if (m_loader.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.SharedLibrary") )) return that->m_xNativeRDB; @@ -284,6 +300,19 @@ BackendImpl::ComponentPackageImpl::getRDB() const return that->m_xCommonRDB; } +//Returns the read only RDB. +const Reference<registry::XSimpleRegistry> +BackendImpl::ComponentPackageImpl::getRDB_RO() const +{ + BackendImpl * that = getMyBackend(); + + if (m_loader.equalsAsciiL( + RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.SharedLibrary") )) + return that->m_xNativeRDB_RO; + else + return that->m_xCommonRDB_RO; +} + BackendImpl * BackendImpl::ComponentPackageImpl::getMyBackend() const { BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); @@ -345,20 +374,22 @@ void BackendImpl::disposing() void BackendImpl::initServiceRdbFiles() { const Reference<XCommandEnvironment> xCmdEnv; - if (! m_readOnly) { + if (! m_readOnly) + { ::ucbhelper::Content cacheDir( getCachePath(), xCmdEnv ); ::ucbhelper::Content oldRDB; // switch common rdb: - if (m_commonRDB.getLength() > 0) + if (m_commonRDB_RO.getLength() > 0) + { create_ucb_content( - &oldRDB, makeURL( getCachePath(), m_commonRDB ), - xCmdEnv, false /* no throw */ ); - m_commonRDB = m_commonRDB.equalsAsciiL( + &oldRDB, makeURL( getCachePath(), m_commonRDB_RO), + xCmdEnv, false /* no throw */ ); + } + m_commonRDB = m_commonRDB_RO.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("common.rdb") ) - ? OUSTR("common_.rdb") : OUSTR("common.rdb"); + ? OUSTR("common_.rdb") : OUSTR("common.rdb"); if (oldRDB.get().is()) { - if (! cacheDir.transferContent( oldRDB, ::ucbhelper::InsertOperation_COPY, m_commonRDB, NameClash::OVERWRITE )) @@ -370,13 +401,15 @@ void BackendImpl::initServiceRdbFiles() oldRDB = ::ucbhelper::Content(); } // switch native rdb: - if (m_nativeRDB.getLength() > 0) + if (m_nativeRDB_RO.getLength() > 0) + { create_ucb_content( - &oldRDB, makeURL( getCachePath(), m_nativeRDB ), - xCmdEnv, false /* no throw */ ); + &oldRDB, makeURL(getCachePath(), m_nativeRDB_RO), + xCmdEnv, false /* no throw */ ); + } const OUString plt_rdb( getPlatformString() + OUSTR(".rdb") ); const OUString plt_rdb_( getPlatformString() + OUSTR("_.rdb") ); - m_nativeRDB = m_nativeRDB.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; + m_nativeRDB = m_nativeRDB_RO.equals( plt_rdb ) ? plt_rdb_ : plt_rdb; if (oldRDB.get().is()) { if (! cacheDir.transferContent( @@ -414,6 +447,37 @@ void BackendImpl::initServiceRdbFiles() } } +void BackendImpl::initServiceRdbFiles_RO() +{ + const Reference<XCommandEnvironment> xCmdEnv; + + // common rdb for java, native rdb for shared lib components + if (m_commonRDB_RO.getLength() > 0) + { + m_xCommonRDB_RO.set( + m_xComponentContext->getServiceManager() + ->createInstanceWithContext( + OUSTR("com.sun.star.registry.SimpleRegistry"), + m_xComponentContext), UNO_QUERY_THROW); + m_xCommonRDB_RO->open( + makeURL(expandUnoRcUrl(getCachePath()), m_commonRDB_RO), + sal_True, //read-only + sal_True); // create data source if necessary + } + if (m_nativeRDB_RO.getLength() > 0) + { + m_xNativeRDB_RO.set( + m_xComponentContext->getServiceManager() + ->createInstanceWithContext( + OUSTR("com.sun.star.registry.SimpleRegistry"), + m_xComponentContext), UNO_QUERY_THROW); + m_xNativeRDB_RO->open( + makeURL(expandUnoRcUrl(getCachePath()), m_nativeRDB_RO), + sal_True, //read-only + sal_True); // create data source if necessary + } +} + //______________________________________________________________________________ BackendImpl::BackendImpl( Sequence<Any> const & args, @@ -492,7 +556,12 @@ BackendImpl::BackendImpl( } else { + //do this before initServiceRdbFiles_RO, because it determines + //m_commonRDB and m_nativeRDB unorc_verify_init( xCmdEnv ); + + initServiceRdbFiles_RO(); + } } @@ -687,7 +756,7 @@ void BackendImpl::unorc_verify_init( sal_Int32 start = sizeof ("UNO_SERVICES=?$ORIGIN/") - 1; sal_Int32 sep = line.indexOf( ' ', start ); OSL_ASSERT( sep > 0 ); - m_commonRDB = line.copy( start, sep - start ); + m_commonRDB_RO = line.copy( start, sep - start ); } // native rc: @@ -697,7 +766,7 @@ void BackendImpl::unorc_verify_init( xCmdEnv, false /* no throw */ )) { if (readLine( &line, OUSTR("UNO_SERVICES="), ucb_content, RTL_TEXTENCODING_UTF8 )) { - m_nativeRDB = line.copy( + m_nativeRDB_RO = line.copy( sizeof ("UNO_SERVICES=?$ORIGIN/") - 1 ); } } @@ -763,12 +832,19 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) } buf.append(LF); } - if (m_commonRDB.getLength() > 0 || m_nativeRDB.getLength() > 0) + + // If we duplicated the common or native rdb then we must use those urls + //otherwise we use those of the original files. That is, m_commonRDB_RO and + //m_nativeRDB_RO; + OUString sCommonRDB(m_commonRDB.getLength() > 0 ? m_commonRDB : m_commonRDB_RO); + OUString sNativeRDB(m_nativeRDB.getLength() > 0 ? m_nativeRDB : m_nativeRDB_RO); + + if (sCommonRDB.getLength() > 0 || sNativeRDB.getLength() > 0) { buf.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); buf.append( ::rtl::OUStringToOString( - m_commonRDB, RTL_TEXTENCODING_ASCII_US ) ); - if (m_nativeRDB.getLength() > 0) + sCommonRDB, RTL_TEXTENCODING_ASCII_US ) ); + if (sNativeRDB.getLength() > 0) { buf.append( RTL_CONSTASCII_STRINGPARAM( " ${$ORIGIN/${_OS}_${_ARCH}rc:UNO_SERVICES}") ); @@ -778,7 +854,7 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) ::rtl::OStringBuffer buf2; buf2.append( RTL_CONSTASCII_STRINGPARAM("UNO_SERVICES=?$ORIGIN/") ); buf2.append( ::rtl::OUStringToOString( - m_nativeRDB, RTL_TEXTENCODING_ASCII_US ) ); + sNativeRDB, RTL_TEXTENCODING_ASCII_US ) ); buf2.append(LF); const Reference<io::XInputStream> xData( @@ -1026,7 +1102,8 @@ BackendImpl::ComponentPackageImpl::isRegistered_( if (m_registered == REG_UNINIT) { m_registered = REG_NOT_REGISTERED; - const Reference<registry::XSimpleRegistry> xRDB( getRDB() ); + bool bAmbiguousComponentName = false; + const Reference<registry::XSimpleRegistry> xRDB( getRDB_RO() ); if (xRDB.is()) { // lookup rdb for location URL: @@ -1046,21 +1123,51 @@ BackendImpl::ComponentPackageImpl::isRegistered_( pImplNames[ pos ] + OUSTR("/UNO/LOCATION") ); const Reference<registry::XRegistryKey> xKey( xRootKey->openKey(key) ); - if (xKey.is() && xKey->isValid()) { + if (xKey.is() && xKey->isValid()) + { const OUString location( xKey->getAsciiValue() ); if (location.equalsIgnoreAsciiCase( getURL() )) + { break; + } + else + { + //try to match only the file name + OUString thisUrl(getURL()); + OUString thisFileName(thisUrl.copy(thisUrl.lastIndexOf('/'))); + + OUString locationFileName(location.copy(location.lastIndexOf('/'))); + if (locationFileName.equalsIgnoreAsciiCase(thisFileName)) + bAmbiguousComponentName = true; + } } } if (pos >= 0) m_registered = REG_REGISTERED; + else if (bAmbiguousComponentName) + m_registered = REG_MAYBE_REGISTERED; } } + + //Different extensions can use the same service implementations. Then the extensions + //which was installed last will overwrite the one from the other extension. That is + //the registry will contain the path (the location) of the library or jar of the + //second extension. In this case isRegistered called for the lib of the first extension + //would return "not registered". That would mean that during uninstallation + //XPackage::registerPackage is not called, because it just was not registered. This is, + //however, necessary for jar files. Registering and unregistering update + //uno_packages/cache/registry/com.sun.star.comp.deployment.component.PackageRegistryBackend/unorc + //Therefore, we will return always "is ambiguous" if the path of this component cannot + //be found in the registry and if there is another path and both have the same file name (but + //the rest of the path is different). + //If the caller cannot precisely determine that this package was registered, then it must + //call registerPackage. + sal_Bool bAmbiguous = m_registered == REG_VOID // REG_VOID == we are in the progress of unregistration + || m_registered == REG_MAYBE_REGISTERED; return beans::Optional< beans::Ambiguous<sal_Bool> >( true /* IsPresent */, beans::Ambiguous<sal_Bool>( - m_registered == REG_REGISTERED, - m_registered == REG_VOID /* IsAmbiguous */ ) ); + m_registered == REG_REGISTERED, bAmbiguous) ); } //______________________________________________________________________________ @@ -1071,6 +1178,8 @@ void BackendImpl::ComponentPackageImpl::processPackage_( Reference<XCommandEnvironment> const & xCmdEnv ) { BackendImpl * that = getMyBackend(); + + const bool java = m_loader.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.loader.Java2") ); const OUString url( getURL() ); @@ -1079,9 +1188,6 @@ void BackendImpl::ComponentPackageImpl::processPackage_( if (doRegisterPackage) { - if (isJavaTypelib) - that->addToUnoRc( java, url, xCmdEnv ); - if (! m_xRemoteContext.is()) { m_xRemoteContext.set( that->getObject( url ), UNO_QUERY ); @@ -1099,7 +1205,12 @@ void BackendImpl::ComponentPackageImpl::processPackage_( m_xRemoteContext->getServiceManager()->createInstanceWithContext( OUSTR("com.sun.star.registry.ImplementationRegistration"), m_xRemoteContext ), UNO_QUERY_THROW ); + xImplReg->registerImplementation( m_loader, url, xServicesRDB ); + //only write to unorc if registration was successful. + //It may fail if there is no suitable java. + if (isJavaTypelib) + that->addToUnoRc( java, url, xCmdEnv ); t_stringlist implNames; t_stringpairvec singletons; diff --git a/desktop/source/deployment/registry/component/dp_component.hrc b/desktop/source/deployment/registry/component/dp_component.hrc index 9324eb0eed1a..53085a48d185 100644 --- a/desktop/source/deployment/registry/component/dp_component.hrc +++ b/desktop/source/deployment/registry/component/dp_component.hrc @@ -2,13 +2,10 @@ * * 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_component.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/component/dp_component.src b/desktop/source/deployment/registry/component/dp_component.src index 2f2b04610610..36f2a1cc4a5c 100644 --- a/desktop/source/deployment/registry/component/dp_component.src +++ b/desktop/source/deployment/registry/component/dp_component.src @@ -2,13 +2,10 @@ * * 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_component.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/component/makefile.mk b/desktop/source/deployment/registry/component/makefile.mk index af5e4c6d49ea..4c4016f9bf6c 100644 --- a/desktop/source/deployment/registry/component/makefile.mk +++ b/desktop/source/deployment/registry/component/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index b1c67f642efb..460ba5e9fed0 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -2,13 +2,10 @@ * * 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_configuration.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -31,6 +28,9 @@ // MARKER(update_precomp.py): autogen include statement, do not remove #include "precompiled_desktop.hxx" +//TODO: Large parts of this file were copied from dp_component.cxx; those parts +// should be consolidated. + #include "dp_configuration.hrc" #include "dp_backend.h" #include "dp_persmap.h" @@ -41,16 +41,18 @@ #include "rtl/uri.hxx" #include "rtl/memory.h" #include "osl/file.hxx" +#include "cppuhelper/exc_hlp.hxx" #include "ucbhelper/content.hxx" #include "comphelper/anytostring.hxx" #include "comphelper/servicedecl.hxx" +#include "configmgr/update.hxx" #include "xmlscript/xml_helper.hxx" #include "svl/inettype.hxx" #include "com/sun/star/ucb/NameClash.hpp" #include "com/sun/star/io/XActiveDataSink.hpp" #include "com/sun/star/lang/WrappedTargetRuntimeException.hpp" #include "com/sun/star/util/XRefreshable.hpp" -#include "com/sun/star/configuration/backend/XLayerImporter.hpp" +#include <list> #include <memory> @@ -65,6 +67,8 @@ namespace backend { namespace configuration { namespace { +typedef ::std::list<OUString> t_stringlist; + //============================================================================== class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend { @@ -98,27 +102,39 @@ class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend }; friend class PackageImpl; - Reference< ::com::sun::star::configuration::backend::XLayerImporter > - m_xMergeImporter; - OUString m_configLayer; + t_stringlist m_xcs_files; + t_stringlist m_xcu_files; + t_stringlist & getFiles( bool xcs ) { + return xcs ? m_xcs_files : m_xcu_files; + } + + bool m_configmgrini_inited; + bool m_configmgrini_modified; // PackageRegistryBackend virtual Reference<deployment::XPackage> bindPackage_( OUString const & url, OUString const & mediaType, Reference<XCommandEnvironment> const & xCmdEnv ); - void xcu_merge_in( OUString const & url, - Reference< XCommandEnvironment > const & xCmdEnv ); - void xcs_merge_in( OUString const & url, - Reference< XCommandEnvironment > const & xCmdEnv ); ::std::auto_ptr<PersistentMap> m_registeredPackages; - OUString const & getConfigLayer(); - Reference<util::XRefreshable> m_defaultProvider; + // for backwards compatibility + + virtual void SAL_CALL disposing(); const Reference<deployment::XPackageTypeInfo> m_xConfDataTypeInfo; const Reference<deployment::XPackageTypeInfo> m_xConfSchemaTypeInfo; Sequence< Reference<deployment::XPackageTypeInfo> > m_typeInfos; + void configmgrini_verify_init( + Reference<XCommandEnvironment> const & xCmdEnv ); + void configmgrini_flush( Reference<XCommandEnvironment> const & xCmdEnv ); + + bool addToConfigmgrIni( bool isSchema, OUString const & url, + Reference<XCommandEnvironment> const & xCmdEnv ); + bool removeFromConfigmgrIni( bool isSchema, OUString const & url, + Reference<XCommandEnvironment> const & xCmdEnv ); + bool hasInConfigmgrIni( bool isSchema, OUString const & url ); + public: BackendImpl( Sequence<Any> const & args, Reference<XComponentContext> const & xComponentContext ); @@ -126,17 +142,36 @@ public: // XPackageRegistry virtual Sequence< Reference<deployment::XPackageTypeInfo> > SAL_CALL getSupportedPackageTypes() throw (RuntimeException); + + using PackageRegistryBackend::disposing; }; //______________________________________________________________________________ +void BackendImpl::disposing() +{ + try { + configmgrini_flush( Reference<XCommandEnvironment>() ); + + PackageRegistryBackend::disposing(); + } + catch (RuntimeException &) { + throw; + } + catch (Exception &) { + Any exc( ::cppu::getCaughtException() ); + throw lang::WrappedTargetRuntimeException( + OUSTR("caught unexpected exception while disposing..."), + static_cast<OWeakObject *>(this), exc ); + } +} + +//______________________________________________________________________________ BackendImpl::BackendImpl( Sequence<Any> const & args, Reference<XComponentContext> const & xComponentContext ) : PackageRegistryBackend( args, xComponentContext ), - m_defaultProvider( xComponentContext->getValueByName( - OUSTR("/singletons/com.sun.star." - "configuration.theDefaultProvider") ), - UNO_QUERY ), + m_configmgrini_inited( false ), + m_configmgrini_modified( false ), m_xConfDataTypeInfo( new Package::TypeInfo( OUSTR("application/" "vnd.sun.star.configuration-data"), @@ -154,19 +189,17 @@ BackendImpl::BackendImpl( m_typeInfos[ 0 ] = m_xConfDataTypeInfo; m_typeInfos[ 1 ] = m_xConfSchemaTypeInfo; - OSL_ASSERT( m_defaultProvider.is() ); + const Reference<XCommandEnvironment> xCmdEnv; if (transientMode()) { - m_registeredPackages.reset( new PersistentMap ); + //TODO } else { + configmgrini_verify_init( xCmdEnv ); m_registeredPackages.reset( new PersistentMap( makeURL( getCachePath(), OUSTR("registered_packages.db") ), m_readOnly ) ); - if (! m_readOnly) - create_folder( 0, getConfigLayer(), - Reference<XCommandEnvironment>() ); } } @@ -239,103 +272,253 @@ Reference<deployment::XPackage> BackendImpl::bindPackage_( static_cast<sal_Int16>(-1) ); } +//############################################################################## + //______________________________________________________________________________ -OUString const & BackendImpl::getConfigLayer() +void BackendImpl::configmgrini_verify_init( + Reference<XCommandEnvironment> const & xCmdEnv ) { - if (m_configLayer.getLength() == 0) + if (transientMode()) + return; + const ::osl::MutexGuard guard( getMutex() ); + if (! m_configmgrini_inited) { - OUString path( - makeURL( expandUnoRcUrl( getCachePath() ), OUSTR("registry") ) ); - ::osl::FileBase::RC rc = ::osl::File::getAbsoluteFileURL( - OUString(), path, m_configLayer ); - if (rc != ::osl::FileBase::E_None) - throw RuntimeException( - OUSTR("making file URL absolute failed: ") + path, - static_cast<OWeakObject *>(this) ); + // common rc: + ::ucbhelper::Content ucb_content; + if (create_ucb_content( + &ucb_content, + makeURL( getCachePath(), OUSTR("configmgr.ini") ), + xCmdEnv, false /* no throw */ )) + { + OUString line; + if (readLine( &line, OUSTR("SCHEMA="), ucb_content, + RTL_TEXTENCODING_UTF8 )) + { + sal_Int32 index = sizeof ("SCHEMA=") - 1; + 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 */ )) { + m_xcs_files.push_back( token ); + } + else + OSL_ENSURE( + 0, "### invalid SCHEMA entry!" ); + } + } + while (index >= 0); + } + if (readLine( &line, OUSTR("DATA="), ucb_content, + RTL_TEXTENCODING_UTF8 )) { + sal_Int32 index = sizeof ("DATA=") - 1; + do { + OUString token( line.getToken( 0, ' ', index ).trim() ); + 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 */ )) { + m_xcu_files.push_back( token ); + } + else + OSL_ENSURE( 0, "### invalid DATA entry!" ); + } + } + while (index >= 0); + } + } + m_configmgrini_modified = false; + m_configmgrini_inited = true; } - return m_configLayer; } -//============================================================================== -class SchemaFileRoot : public ::dp_misc::XmlRootElement +//______________________________________________________________________________ +void BackendImpl::configmgrini_flush( + Reference<XCommandEnvironment> const & xCmdEnv ) { -public: - OUString m_name; - OUString m_package; - - inline SchemaFileRoot() - : XmlRootElement( OUSTR("http://openoffice.org/2001/registry"), - OUSTR("component-schema") ) - {} - - // XRoot - virtual Reference< xml::input::XElement > SAL_CALL startRootElement( - sal_Int32 uid, OUString const & localname, - Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException); -}; + if (transientMode()) + return; + if (!m_configmgrini_inited || !m_configmgrini_modified) + return; + + ::rtl::OStringBuffer buf; + // UNO_USER_PACKAGES_CACHE, UNO_SHARED_PACKAGES_CACHE have to be resolved + // locally: + if (m_eContext == CONTEXT_USER) { + buf.append( RTL_CONSTASCII_STRINGPARAM( + "UNO_USER_PACKAGES_CACHE=$ORIGIN/../..") ); + } + else if (m_eContext == CONTEXT_SHARED) { + buf.append( RTL_CONSTASCII_STRINGPARAM( + "UNO_SHARED_PACKAGES_CACHE=$ORIGIN/../..") ); + } + else + OSL_ASSERT(0); + buf.append(LF); + + if (! m_xcs_files.empty()) + { + t_stringlist::const_iterator iPos( m_xcs_files.begin() ); + t_stringlist::const_iterator const iEnd( m_xcs_files.end() ); + buf.append( RTL_CONSTASCII_STRINGPARAM("SCHEMA=") ); + while (iPos != iEnd) { + // encoded ASCII file-urls: + const ::rtl::OString item( + ::rtl::OUStringToOString( *iPos, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( item ); + ++iPos; + if (iPos != iEnd) + buf.append( ' ' ); + } + buf.append(LF); + } + if (! m_xcu_files.empty()) + { + t_stringlist::const_iterator iPos( m_xcu_files.begin() ); + t_stringlist::const_iterator const iEnd( m_xcu_files.end() ); + buf.append( RTL_CONSTASCII_STRINGPARAM("DATA=") ); + while (iPos != iEnd) { + // encoded ASCII file-urls: + const ::rtl::OString item( + ::rtl::OUStringToOString( *iPos, RTL_TEXTENCODING_ASCII_US ) ); + buf.append( item ); + ++iPos; + if (iPos != iEnd) + buf.append( ' ' ); + } + buf.append(LF); + } + + // write configmgr.ini: + const Reference<io::XInputStream> xData( + ::xmlscript::createInputStream( + ::rtl::ByteSequence( + reinterpret_cast<sal_Int8 const *>(buf.getStr()), + buf.getLength() ) ) ); + ::ucbhelper::Content ucb_content( + makeURL( getCachePath(), OUSTR("configmgr.ini") ), xCmdEnv ); + ucb_content.writeStream( xData, true /* replace existing */ ); + + m_configmgrini_modified = false; +} + +//------------------------------------------------------------------------------ +inline OUString makeRcTerm( OUString const & url ) +{ + OSL_ASSERT( url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( + "vnd.sun.star.expand:") ) ); + if (url.matchAsciiL( RTL_CONSTASCII_STRINGPARAM("vnd.sun.star.expand:") )) { + // cut protocol: + OUString rcterm( url.copy( sizeof ("vnd.sun.star.expand:") - 1 ) ); + // decode uric class chars: + rcterm = ::rtl::Uri::decode( + rcterm, rtl_UriDecodeWithCharset, RTL_TEXTENCODING_UTF8 ); + return rcterm; + } + else + return url; +} //______________________________________________________________________________ -Reference< xml::input::XElement > SchemaFileRoot::startRootElement( - sal_Int32 uid, OUString const & localname, - Reference< xml::input::XAttributes > const & xAttributes ) - throw (xml::sax::SAXException, RuntimeException) +bool BackendImpl::addToConfigmgrIni( bool isSchema, OUString const & url_, + Reference<XCommandEnvironment> const & xCmdEnv ) { - // check root element: - XmlRootElement::startRootElement( uid, localname, xAttributes ); - - // "name" attribute - m_name = xAttributes->getValueByUidName( getUid(), OUSTR("name") ); - if (m_name.getLength() == 0) - throw xml::sax::SAXException( - OUSTR("missing schema name attribute!"), - static_cast< OWeakObject * >(this), Any() ); - - // "package" attribute - m_package = xAttributes->getValueByUidName( getUid(), OUSTR("package") ); - if (m_package.getLength() == 0) - throw xml::sax::SAXException( - OUSTR("missing schema package attribute!"), - static_cast<OWeakObject *>(this), Any() ); - - // don't go deeper... - return Reference<xml::input::XElement>(); + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + configmgrini_verify_init( xCmdEnv ); + t_stringlist & rSet = getFiles(isSchema); + if (::std::find( rSet.begin(), rSet.end(), rcterm ) == rSet.end()) { + rSet.push_front( rcterm ); // prepend to list, thus overriding + // write immediately: + m_configmgrini_modified = true; + configmgrini_flush( xCmdEnv ); + return true; + } + else + return false; } //______________________________________________________________________________ -void BackendImpl::xcs_merge_in( - OUString const & url, +bool BackendImpl::removeFromConfigmgrIni( + bool isSchema, OUString const & url_, Reference<XCommandEnvironment> const & xCmdEnv ) { - // parse out schema package: - SchemaFileRoot * root = new SchemaFileRoot; - Reference<xml::input::XRoot> xRoot( root ); - ::ucbhelper::Content ucb_content( url, xCmdEnv ); - xml_parse( xRoot, ucb_content, getComponentContext() ); - - OUString dest_folder( - makeURL( getConfigLayer(), OUSTR("schema/") + ::rtl::Uri::encode( - root->m_package, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ).replace( '.', '/' ) ) ); - OUString title( root->m_name + OUSTR(".xcs") ); - OUString dest_url( makeURL( dest_folder, ::rtl::Uri::encode( - title, rtl_UriCharClassPchar, - rtl_UriEncodeIgnoreEscapes, - RTL_TEXTENCODING_UTF8 ) ) ); - // assure dest folder is existing: - ::ucbhelper::Content ucb_dest_folder; - create_folder( &ucb_dest_folder, dest_folder, xCmdEnv ); - if (! ucb_dest_folder.transferContent( - ::ucbhelper::Content( url, xCmdEnv ), - ::ucbhelper::InsertOperation_COPY, - title, NameClash::OVERWRITE )) - throw RuntimeException( - OUSTR("::ucb::Content::transferContent() failed!"), 0 ); + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + configmgrini_verify_init( xCmdEnv ); + t_stringlist & rSet = getFiles(isSchema); + t_stringlist::iterator i(std::find(rSet.begin(), rSet.end(), rcterm)); + if (i == rSet.end() && !isSchema) { //TODO: see replaceOrigin() + i = std::find( + rSet.begin(), rSet.end(), + rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); + } + if (i == rSet.end()) { + return false; + } + rSet.erase(i); + // write immediately: + m_configmgrini_modified = true; + configmgrini_flush( xCmdEnv ); + return true; +} + +//______________________________________________________________________________ +bool BackendImpl::hasInConfigmgrIni( + bool isSchema, OUString const & url_ ) +{ + const OUString rcterm( makeRcTerm(url_) ); + const ::osl::MutexGuard guard( getMutex() ); + t_stringlist const & rSet = getFiles(isSchema); + return ::std::find( rSet.begin(), rSet.end(), rcterm ) != rSet.end() + || (!isSchema && //TODO: see replaceOrigin() + ::std::find( + rSet.begin(), rSet.end(), + rcterm + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))) != + rSet.end()); } //############################################################################## +// Package +//______________________________________________________________________________ +BackendImpl * BackendImpl::PackageImpl::getMyBackend() const +{ + BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); + if (NULL == pBackend) + { + //May throw a DisposedException + check(); + //We should never get here... + throw RuntimeException( + OUSTR("Failed to get the BackendImpl"), + static_cast<OWeakObject*>(const_cast<PackageImpl *>(this))); + } + return pBackend; +} + +beans::Optional< beans::Ambiguous<sal_Bool> > +BackendImpl::PackageImpl::isRegistered_( + ::osl::ResettableMutexGuard &, + ::rtl::Reference<AbortChannel> const &, + Reference<XCommandEnvironment> const & ) +{ + BackendImpl * that = getMyBackend(); + rtl::OUString url(getURL()); + return beans::Optional< beans::Ambiguous<sal_Bool> >( + true /* IsPresent */, + beans::Ambiguous<sal_Bool>( + that->hasInConfigmgrIni( m_isSchema, url ) || + that->m_registeredPackages->has( + rtl::OUStringToOString( url, RTL_TEXTENCODING_UTF8 ) ), + false /* IsAmbiguous */ ) ); +} + //------------------------------------------------------------------------------ OUString encodeForXml( OUString const & text ) { @@ -370,7 +553,7 @@ OUString encodeForXml( OUString const & text ) } //______________________________________________________________________________ -void BackendImpl::xcu_merge_in( +OUString replaceOrigin( OUString const & url, Reference< XCommandEnvironment > const & xCmdEnv ) { // looking for %origin%: @@ -437,199 +620,70 @@ void BackendImpl::xcu_merge_in( rtl_copyMemory( filtered.getArray() + write_pos, pAdd, nAdd ); write_pos += nAdd; } - if (use_filtered && write_pos < filtered.getLength()) + if (!use_filtered) + return url; + if (write_pos < filtered.getLength()) filtered.realloc( write_pos ); - - Reference<XComponentContext> const & xContext = getComponentContext(); - if (! m_xMergeImporter.is()) { - m_xMergeImporter.set( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.configuration.backend.MergeImporter"), - xContext ), UNO_QUERY_THROW ); - } - - Reference< ::com::sun::star::configuration::backend::XLayer > xLayer( - xContext->getServiceManager()->createInstanceWithContext( - OUSTR("com.sun.star.configuration.backend.xml.LayerParser"), - xContext ), UNO_QUERY_THROW ); - - Reference< io::XActiveDataSink > xActiveDataSink( xLayer, UNO_QUERY_THROW ); - if (use_filtered) - xActiveDataSink->setInputStream( ::xmlscript::createInputStream( - filtered ) ); - else - ucb_content.openStream( xActiveDataSink ); - - if (transientMode()) - m_xMergeImporter->importLayer( xLayer ); - else - m_xMergeImporter->importLayerForEntity( xLayer, getConfigLayer() ); -} - -//############################################################################## - -// Package -//______________________________________________________________________________ -BackendImpl * BackendImpl::PackageImpl::getMyBackend() const -{ - BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); - if (NULL == pBackend) - { - //May throw a DisposedException - check(); - //We should never get here... - throw RuntimeException( - OUSTR("Failed to get the BackendImpl"), - static_cast<OWeakObject*>(const_cast<PackageImpl *>(this))); - } - return pBackend; -} - -beans::Optional< beans::Ambiguous<sal_Bool> > -BackendImpl::PackageImpl::isRegistered_( - ::osl::ResettableMutexGuard &, - ::rtl::Reference<AbortChannel> const &, - Reference<XCommandEnvironment> const & ) -{ - BackendImpl * that = getMyBackend(); - return beans::Optional< beans::Ambiguous<sal_Bool> >( - true /* IsPresent */, - beans::Ambiguous<sal_Bool>( - that->m_registeredPackages->has( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ), - false /* IsAmbiguous */ ) ); + rtl::OUString newUrl(url + OUString(RTL_CONSTASCII_USTRINGPARAM(".mod"))); + //TODO: unique name + ucbhelper::Content(newUrl, xCmdEnv).writeStream( + xmlscript::createInputStream(filtered), true); + return newUrl; } //______________________________________________________________________________ void BackendImpl::PackageImpl::processPackage_( ::osl::ResettableMutexGuard &, bool doRegisterPackage, - ::rtl::Reference<AbortChannel> const & abortChannel, + ::rtl::Reference<AbortChannel> const &, Reference<XCommandEnvironment> const & xCmdEnv ) { BackendImpl * that = getMyBackend(); + OUString url( getURL() ); + if (doRegisterPackage) { if (m_isSchema) { - OSL_ENSURE( ! that->transientMode(), - "### schema cannot be deployed transiently!" ); - if (! that->transientMode()) { - that->xcs_merge_in( m_url, xCmdEnv ); - that->m_registeredPackages->put( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8), - rtl::OString( - RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.configuration-schema" ) ) ); - } + configmgr::update::insertExtensionXcsFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); } else { - that->xcu_merge_in( m_url, xCmdEnv ); - that->m_registeredPackages->put( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ), - rtl::OString( - RTL_CONSTASCII_STRINGPARAM( - "vnd.sun.star.configuration-data" ) ) ); + url = replaceOrigin(url, xCmdEnv); + configmgr::update::insertExtensionXcuFile( + that->m_eContext == CONTEXT_SHARED, expandUnoRcUrl(url)); } + + that->addToConfigmgrIni( m_isSchema, url, xCmdEnv ); } else // revoke { - OSL_ASSERT( - that->m_registeredPackages->has( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ) ); - t_string2string_map entries( that->m_registeredPackages->getEntries() ); - t_string2string_map::const_iterator iPos( entries.begin() ); - t_string2string_map::const_iterator const iEnd( entries.end() ); - - if (m_isSchema) - { - if (! that->transientMode()) + if (!that->removeFromConfigmgrIni(m_isSchema, url, xCmdEnv)) { + t_string2string_map entries( + that->m_registeredPackages->getEntries()); + for (t_string2string_map::iterator i(entries.begin()); + i != entries.end(); ++i) { - ::ucbhelper::Content ucbSaveLayer( - makeURL( that->getConfigLayer(), OUSTR("schema") ), - xCmdEnv ); - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("schema.bak") ) ); - try { - for ( ; iPos != iEnd; ++iPos ) - { - checkAborted( abortChannel ); - if (iPos->second == "vnd.sun.star.configuration-schema") - { - OUString url( - rtl::OStringToOUString( - iPos->first, RTL_TEXTENCODING_UTF8 ) ); - if (!url.equals( m_url )) { - that->xcs_merge_in( url, xCmdEnv ); - } - } + rtl::OUString url2( + rtl::OStringToOUString(i->first, RTL_TEXTENCODING_UTF8)); + if (url2 != url) { + bool schema = i->second.equalsIgnoreAsciiCase( + "vnd.sun.star.configuration-schema"); + if (!schema) { + url2 = replaceOrigin(url2, xCmdEnv); } + that->addToConfigmgrIni(schema, url2, xCmdEnv); } - catch (RuntimeException &) { - throw; - } - catch (Exception &) { - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("schema") ) ); - throw; - } - that->m_registeredPackages->erase( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ); - ucbSaveLayer.executeCommand( - OUSTR("delete"), Any( true /* delete physically */ ) ); + that->m_registeredPackages->erase(i->first); } - } - else // data - { - if (! that->transientMode()) - { - ::ucbhelper::Content ucbSaveLayer( - makeURL( that->getConfigLayer(), OUSTR("data") ), - xCmdEnv ); - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("data.bak") ) ); - try { - for ( ; iPos != iEnd; ++iPos ) - { - checkAborted( abortChannel ); - if (iPos->second == "vnd.sun.star.configuration-data") { - OUString url( - rtl::OStringToOUString( - iPos->first, RTL_TEXTENCODING_UTF8 ) ); - if (!url.equals( m_url )) { - that->xcu_merge_in( url, xCmdEnv ); - } - } - } - } - catch (RuntimeException &) { - throw; - } - catch (Exception &) { - ucbSaveLayer.setPropertyValue( - StrTitle::get(), Any( OUSTR("data") ) ); - throw; - } - that->m_registeredPackages->erase( - rtl::OUStringToOString( m_url, RTL_TEXTENCODING_UTF8 ) ); - ucbSaveLayer.executeCommand( + ::ucbhelper::Content( + makeURL( that->getCachePath(), OUSTR("registry") ), + xCmdEnv ).executeCommand( OUSTR("delete"), Any( true /* delete physically */ ) ); - } } - } - if (!m_isSchema && getMyBackend()->m_defaultProvider.is()) { - // temp workaround for config bug: - try { - getMyBackend()->m_defaultProvider->refresh(); - } - catch (lang::WrappedTargetRuntimeException & exc) { - (void) exc; - OSL_ENSURE( 0, ::rtl::OUStringToOString( - ::comphelper::anyToString(exc.TargetException), - RTL_TEXTENCODING_UTF8 ).getStr() ); - } + //TODO: revoking at runtime, possible, sensible? } } diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.hrc b/desktop/source/deployment/registry/configuration/dp_configuration.hrc index 4dfb8db84a24..01e1905228b3 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.hrc +++ b/desktop/source/deployment/registry/configuration/dp_configuration.hrc @@ -2,13 +2,10 @@ * * 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_configuration.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.src b/desktop/source/deployment/registry/configuration/dp_configuration.src index 13f8ff08556d..7ff749b18459 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.src +++ b/desktop/source/deployment/registry/configuration/dp_configuration.src @@ -2,13 +2,10 @@ * * 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_configuration.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/configuration/makefile.mk b/desktop/source/deployment/registry/configuration/makefile.mk index 433b1e638f49..f549b0e7b0f8 100644 --- a/desktop/source/deployment/registry/configuration/makefile.mk +++ b/desktop/source/deployment/registry/configuration/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/dp_backend.cxx b/desktop/source/deployment/registry/dp_backend.cxx index aa67536bd425..c06b30be1669 100644 --- a/desktop/source/deployment/registry/dp_backend.cxx +++ b/desktop/source/deployment/registry/dp_backend.cxx @@ -2,13 +2,10 @@ * * 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.cxx,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -137,7 +134,7 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage( { ::osl::ResettableMutexGuard guard( getMutex() ); check(); - t_string2weakref::const_iterator const iFind( m_bound.find( url ) ); + t_string2ref::const_iterator const iFind( m_bound.find( url ) ); if (iFind != m_bound.end()) { Reference<deployment::XPackage> xPackage( iFind->second ); if (xPackage.is()) @@ -169,8 +166,8 @@ Reference<deployment::XPackage> PackageRegistryBackend::bindPackage( } guard.reset(); - ::std::pair< t_string2weakref::iterator, bool > insertion( - m_bound.insert( t_string2weakref::value_type( url, xNewPackage ) ) ); + ::std::pair< t_string2ref::iterator, bool > insertion( + m_bound.insert( t_string2ref::value_type( url, xNewPackage ) ) ); if (insertion.second) { // first insertion OSL_ASSERT( Reference<XInterface>(insertion.first->second) diff --git a/desktop/source/deployment/registry/dp_registry.cxx b/desktop/source/deployment/registry/dp_registry.cxx index 0c3e8bd214d4..c6572364aac0 100644 --- a/desktop/source/deployment/registry/dp_registry.cxx +++ b/desktop/source/deployment/registry/dp_registry.cxx @@ -2,13 +2,10 @@ * * 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_registry.cxx,v $ - * $Revision: 1.12.86.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/dp_registry.src b/desktop/source/deployment/registry/dp_registry.src index 7a29c802f03e..68a52621741f 100644 --- a/desktop/source/deployment/registry/dp_registry.src +++ b/desktop/source/deployment/registry/dp_registry.src @@ -2,13 +2,10 @@ * * 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_registry.src,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/executable/dp_executable.cxx b/desktop/source/deployment/registry/executable/dp_executable.cxx index 690549db0119..8c95d5874b4c 100644 --- a/desktop/source/deployment/registry/executable/dp_executable.cxx +++ b/desktop/source/deployment/registry/executable/dp_executable.cxx @@ -2,13 +2,10 @@ * * 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_executable.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/executable/makefile.mk b/desktop/source/deployment/registry/executable/makefile.mk index 7ad5289655a6..1e57f5ecf3b1 100644 --- a/desktop/source/deployment/registry/executable/makefile.mk +++ b/desktop/source/deployment/registry/executable/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx index 7daa9adb277e..2b0d91250e4a 100644 --- a/desktop/source/deployment/registry/help/dp_help.cxx +++ b/desktop/source/deployment/registry/help/dp_help.cxx @@ -2,13 +2,10 @@ * * 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_help.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,7 +38,7 @@ #include "svl/inettype.hxx" #include "unotools/pathoptions.hxx" -#include <transex3/compilehelp.hxx> +#include <l10ntools/compilehelp.hxx> #include <com/sun/star/ucb/XSimpleFileAccess.hpp> #include <com/sun/star/util/XMacroExpander.hpp> #include <com/sun/star/uri/XUriReferenceFactory.hpp> diff --git a/desktop/source/deployment/registry/help/dp_help.hrc b/desktop/source/deployment/registry/help/dp_help.hrc index 3cdd12cb5bdb..c1e10547ccdd 100644 --- a/desktop/source/deployment/registry/help/dp_help.hrc +++ b/desktop/source/deployment/registry/help/dp_help.hrc @@ -2,13 +2,10 @@ * * 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_help.hrc,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/help/dp_help.src b/desktop/source/deployment/registry/help/dp_help.src index be85542dc3b0..6b6a3f9a6508 100644 --- a/desktop/source/deployment/registry/help/dp_help.src +++ b/desktop/source/deployment/registry/help/dp_help.src @@ -2,13 +2,10 @@ * * 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_help.src,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/help/makefile.mk b/desktop/source/deployment/registry/help/makefile.mk index 9e11f82d3a02..ba904bb7f28a 100644 --- a/desktop/source/deployment/registry/help/makefile.mk +++ b/desktop/source/deployment/registry/help/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/inc/dp_backend.h b/desktop/source/deployment/registry/inc/dp_backend.h index 256d4680d795..fe52c8ffc7e3 100644 --- a/desktop/source/deployment/registry/inc/dp_backend.h +++ b/desktop/source/deployment/registry/inc/dp_backend.h @@ -2,13 +2,10 @@ * * 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 @@ -247,11 +244,17 @@ class PackageRegistryBackend : protected ::dp_misc::MutexHolder, public t_BackendBase { ::rtl::OUString m_cachePath; - + //The map held originally WeakReferences. The map entries are removed in the disposing + //function, which is called when the XPackages are destructed or they are + //explicitely disposed. The latter happens, for example, when a extension is + //removed (see dp_manager.cxx). However, because of how the help systems work, now + // XPackageManager::getDeployedPackages is called often. This results in a lot + //of bindPackage calls which are costly. Therefore we keep hard references in + //the map now. typedef ::std::hash_map< - ::rtl::OUString, css::uno::WeakReference<css::deployment::XPackage>, - ::rtl::OUStringHash > t_string2weakref; - t_string2weakref m_bound; + ::rtl::OUString, css::uno::Reference<css::deployment::XPackage>, + ::rtl::OUStringHash > t_string2ref; + t_string2ref m_bound; protected: css::uno::Reference<css::uno::XComponentContext> m_xComponentContext; diff --git a/desktop/source/deployment/registry/inc/dp_registry.hrc b/desktop/source/deployment/registry/inc/dp_registry.hrc index 12dd5c5ba8c3..4a3b1d0b1a4a 100644 --- a/desktop/source/deployment/registry/inc/dp_registry.hrc +++ b/desktop/source/deployment/registry/inc/dp_registry.hrc @@ -2,13 +2,10 @@ * * 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_registry.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/makefile.mk b/desktop/source/deployment/registry/makefile.mk index 7741583d930a..de0e943654d9 100644 --- a/desktop/source/deployment/registry/makefile.mk +++ b/desktop/source/deployment/registry/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/dp_description.cxx b/desktop/source/deployment/registry/package/dp_description.cxx index 846205a5faf0..7c05bfd90a5b 100644 --- a/desktop/source/deployment/registry/package/dp_description.cxx +++ b/desktop/source/deployment/registry/package/dp_description.cxx @@ -2,13 +2,10 @@ * * 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_description.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/dp_description.hxx b/desktop/source/deployment/registry/package/dp_description.hxx index 154cd3c8d562..eb74c454af75 100644 --- a/desktop/source/deployment/registry/package/dp_description.hxx +++ b/desktop/source/deployment/registry/package/dp_description.hxx @@ -2,13 +2,10 @@ * * 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_description.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/dp_package.cxx b/desktop/source/deployment/registry/package/dp_package.cxx index 1771cc93ec07..e45f7fb7ef73 100644 --- a/desktop/source/deployment/registry/package/dp_package.cxx +++ b/desktop/source/deployment/registry/package/dp_package.cxx @@ -2,13 +2,10 @@ * * 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 @@ -73,7 +70,7 @@ #include "com/sun/star/xml/dom/XDocumentBuilder.hpp" #include "com/sun/star/xml/xpath/XXPathAPI.hpp" #include "com/sun/star/deployment/XPackageManager.hpp" - +#include "boost/optional.hpp" #include <vector> #include <stdio.h> @@ -446,12 +443,19 @@ BackendImpl::PackageImpl::isRegistered_( AbortChannel::Chain chain( abortChannel, xSubAbortChannel ); beans::Optional< beans::Ambiguous<sal_Bool> > option( xPackage->isRegistered( xSubAbortChannel, xCmdEnv ) ); + + //present = true if at least one bundle item has this value. + //reg = true if all bundle items have an option value (option.IsPresent == 1) + //and all have value of true (option.Value.Value == true) + //If not, then the bundle has the status of not registered and ambiguous. if (option.IsPresent) { beans::Ambiguous<sal_Bool> const & status = option.Value; if (present) { + //we never come here in the first iteration if (reg != (status.Value != sal_False)) { + ambig = true; reg = false; break; @@ -459,6 +463,7 @@ BackendImpl::PackageImpl::isRegistered_( } else { + //we always come here in the first iteration reg = status.Value; present = true; } @@ -578,21 +583,12 @@ bool BackendImpl::PackageImpl::checkDependencies( { try { - css::uno::Reference<css::xml::dom::XNode> xRoot = desc.getRootElement(); - css::uno::Reference<css::xml::xpath::XXPathAPI> xPath = - getDescriptionInfoset().getXpath(); - - css::uno::Reference<css::xml::dom::XNode> nodeSimpleLic; - try { - nodeSimpleLic = xPath->selectSingleNode(xRoot, - OUSTR("/desc:description/desc:registration/desc:simple-license")); - } catch (css::xml::xpath::XPathException &) { - // ignore - } - - if (!nodeSimpleLic.is()) + DescriptionInfoset info = getDescriptionInfoset(); + ::boost::optional<SimpleLicenseAttributes> simplLicAttr + = info.getSimpleLicenseAttributes(); + if (! simplLicAttr) return true; - OUString sLic = getDescriptionInfoset().getLocalizedLicenseURL(); + OUString sLic = info.getLocalizedLicenseURL(); //If we do not get a localized licence then there is an error in the description.xml //This should be handled by using a validating parser. Therefore we assume that no //license is available. @@ -601,23 +597,20 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not obtain path to license. Possible error in description.xml"), 0, Any()); OUString sHref = desc.getExtensionRootUrl() + OUSTR("/") + sLic; OUString sLicense = getTextFromURL(xCmdEnv, sHref); - //determine who has to agree to the license - css::uno::Reference<css::xml::xpath::XXPathObject> nodeAttribWho3 = - xPath->eval(nodeSimpleLic, - OUSTR("@accept-by")); - OUString sAccept = nodeAttribWho3->getString().trim(); + ////determine who has to agree to the license //check correct value for attribute - if ( ! (sAccept.equals(OUSTR("user")) || sAccept.equals(OUSTR("admin")))) + if ( ! (simplLicAttr->acceptBy.equals(OUSTR("user")) || simplLicAttr->acceptBy.equals(OUSTR("admin")))) throw css::deployment::DeploymentException( OUSTR("Could not obtain attribute simple-lincense@accept-by or it has no valid value"), 0, Any()); //If if @accept-by="user" then every user needs to accept the license before it can be installed. - //Therefore we must prevent the installation as shared extension. + //Therefore we must prevent the installation as shared extension unless suppress-if-required="true" OSL_ASSERT(aContextName.getLength()); - if (sAccept.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) + if (simplLicAttr->acceptBy.equals(OUSTR("user")) && aContextName.equals(OUSTR("shared"))) { - css::deployment::LicenseIndividualAgreementException exc = - css::deployment::LicenseIndividualAgreementException(OUString(), 0, m_name); + css::deployment::LicenseIndividualAgreementException + exc = css::deployment::LicenseIndividualAgreementException( + OUString(), 0, m_name, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; @@ -627,32 +620,24 @@ bool BackendImpl::PackageImpl::checkDependencies( OUSTR("Could not interact with user."), 0, Any()); if (abort == true) return false; - //We should always prevent installation - OSL_ASSERT(0); - } - //determine optional attribute simple-license@suppressOnUpdate - css::uno::Reference<css::xml::dom::XElement> elemSimpleLic(nodeSimpleLic, css::uno::UNO_QUERY_THROW); - sal_Bool bSuppress = sal_False; - if (elemSimpleLic->hasAttribute(OUSTR("suppress-on-update"))) - { - if (elemSimpleLic->getAttribute(OUSTR("suppress-on-update")).equals(OUSTR("true"))) - bSuppress = sal_True; + //If the unopkg --suppress-license was used and simplLicAttr->suppressIfRequired == true, + //then the user implicitely accepts the license } //Only use interaction if there is no version of this extension already installed //and the suppress-on-update flag is not set for the new extension - // bInstalled | bSuppress | show license + // bInstalled | bSuppressOnUpdate | show license //---------------------------------------- - // 0 | 0 | 1 - // 0 | 1 | 1 - // 1 | 0 | 1 - // 1 | 1 | 0 + // 0 | 0 | 1 + // 0 | 1 | 1 + // 1 | 0 | 1 + // 1 | 1 | 0 - if ( !(bInstalled && bSuppress)) + if ( !(bInstalled && simplLicAttr->suppressOnUpdate)) { - css::deployment::LicenseException licExc = - css::deployment::LicenseException(OUString(), 0, m_name, sLicense); + css::deployment::LicenseException licExc( + OUString(), 0, m_name, sLicense, simplLicAttr->suppressIfRequired); bool approve = false; bool abort = false; if (! interactContinuation( diff --git a/desktop/source/deployment/registry/package/dp_package.hrc b/desktop/source/deployment/registry/package/dp_package.hrc index df73bcdb80c4..3a840b64f0b6 100644 --- a/desktop/source/deployment/registry/package/dp_package.hrc +++ b/desktop/source/deployment/registry/package/dp_package.hrc @@ -2,13 +2,10 @@ * * 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.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/dp_package.src b/desktop/source/deployment/registry/package/dp_package.src index 6e77f8ae8934..57307040bba4 100644 --- a/desktop/source/deployment/registry/package/dp_package.src +++ b/desktop/source/deployment/registry/package/dp_package.src @@ -2,13 +2,10 @@ * * 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.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/package/makefile.mk b/desktop/source/deployment/registry/package/makefile.mk index 007574eeff42..ccadc2070301 100644 --- a/desktop/source/deployment/registry/package/makefile.mk +++ b/desktop/source/deployment/registry/package/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_lib_container.cxx b/desktop/source/deployment/registry/script/dp_lib_container.cxx index c9bf36dc68ec..be6170cdf5d8 100644 --- a/desktop/source/deployment/registry/script/dp_lib_container.cxx +++ b/desktop/source/deployment/registry/script/dp_lib_container.cxx @@ -2,13 +2,10 @@ * * 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_lib_container.cxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_lib_container.h b/desktop/source/deployment/registry/script/dp_lib_container.h index 3546dba7352d..3e7cbf54cbae 100644 --- a/desktop/source/deployment/registry/script/dp_lib_container.h +++ b/desktop/source/deployment/registry/script/dp_lib_container.h @@ -2,13 +2,10 @@ * * 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_lib_container.h,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_script.cxx b/desktop/source/deployment/registry/script/dp_script.cxx index dbc644e60f44..4af0cbb84130 100644 --- a/desktop/source/deployment/registry/script/dp_script.cxx +++ b/desktop/source/deployment/registry/script/dp_script.cxx @@ -2,13 +2,10 @@ * * 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_script.cxx,v $ - * $Revision: 1.15 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_script.hrc b/desktop/source/deployment/registry/script/dp_script.hrc index df37ed091fec..8ddfa6f51ffc 100644 --- a/desktop/source/deployment/registry/script/dp_script.hrc +++ b/desktop/source/deployment/registry/script/dp_script.hrc @@ -2,13 +2,10 @@ * * 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_script.hrc,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/dp_script.src b/desktop/source/deployment/registry/script/dp_script.src index 7a8f10cd6f48..117f4eac945a 100644 --- a/desktop/source/deployment/registry/script/dp_script.src +++ b/desktop/source/deployment/registry/script/dp_script.src @@ -2,13 +2,10 @@ * * 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_script.src,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/script/makefile.mk b/desktop/source/deployment/registry/script/makefile.mk index 76195895b227..ae159914a548 100644 --- a/desktop/source/deployment/registry/script/makefile.mk +++ b/desktop/source/deployment/registry/script/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx b/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx index 23d7c36cda79..bf35aa2f50a5 100644 --- a/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_parceldesc.cxx @@ -2,13 +2,10 @@ * * 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_parceldesc.cxx,v $ - * $Revision: 1.7.86.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/dp_parceldesc.hxx b/desktop/source/deployment/registry/sfwk/dp_parceldesc.hxx index c7d15a297996..a23e9f865894 100644 --- a/desktop/source/deployment/registry/sfwk/dp_parceldesc.hxx +++ b/desktop/source/deployment/registry/sfwk/dp_parceldesc.hxx @@ -2,13 +2,10 @@ * * 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_parceldesc.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index de515dd78372..52ced6908bd8 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -2,13 +2,10 @@ * * 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_sfwk.cxx,v $ - * $Revision: 1.16.66.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.hrc b/desktop/source/deployment/registry/sfwk/dp_sfwk.hrc index 922affecf252..0eb619e839e3 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.hrc +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.hrc @@ -2,13 +2,10 @@ * * 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_sfwk.hrc,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.src b/desktop/source/deployment/registry/sfwk/dp_sfwk.src index bd9994693b36..c8d37ce067ac 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.src +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.src @@ -2,13 +2,10 @@ * * 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_sfwk.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/registry/sfwk/makefile.mk b/desktop/source/deployment/registry/sfwk/makefile.mk index 2884e7986140..a052296d5c21 100644 --- a/desktop/source/deployment/registry/sfwk/makefile.mk +++ b/desktop/source/deployment/registry/sfwk/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/target.pmk b/desktop/source/deployment/target.pmk index 067db401b150..82b41766b253 100644 --- a/desktop/source/deployment/target.pmk +++ b/desktop/source/deployment/target.pmk @@ -2,14 +2,10 @@ # # 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: target.pmk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/unopkg/makefile.mk b/desktop/source/deployment/unopkg/makefile.mk index c34f7e18253e..06b39cd2d04e 100644 --- a/desktop/source/deployment/unopkg/makefile.mk +++ b/desktop/source/deployment/unopkg/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/deployment/unopkg/unopkg.src b/desktop/source/deployment/unopkg/unopkg.src index bb5be7e8bbd6..79c578628676 100644 --- a/desktop/source/deployment/unopkg/unopkg.src +++ b/desktop/source/deployment/unopkg/unopkg.src @@ -2,13 +2,10 @@ * * 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: unopkg.src,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/inc/exithelper.hxx b/desktop/source/inc/exithelper.hxx index 59cdf68814cb..2e6d7e774d98 100644 --- a/desktop/source/inc/exithelper.hxx +++ b/desktop/source/inc/exithelper.hxx @@ -2,13 +2,10 @@ * * 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: exithelper.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -59,12 +56,8 @@ class ExitHelper E_SECOND_OFFICE = 1, /// an uno exception was catched during startup E_FATAL_ERROR = 333, // Only the low 8 bits are significant 333 % 256 = 77 - /// crash during runtime - E_CRASH = 78, /// user force automatic restart after crash E_CRASH_WITH_RESTART = 79, - /// ??? - E_LOCKFILE = 80 }; }; diff --git a/desktop/source/inc/helpid.hrc b/desktop/source/inc/helpid.hrc index c6c18e4bfc01..2619c4398881 100644 --- a/desktop/source/inc/helpid.hrc +++ b/desktop/source/inc/helpid.hrc @@ -2,13 +2,10 @@ * * 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: helpid.hrc,v $ - * $Revision: 1.11 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/cfgfilter.cxx b/desktop/source/migration/cfgfilter.cxx index fc49fbb76228..e4589e1a10e1 100644 --- a/desktop/source/migration/cfgfilter.cxx +++ b/desktop/source/migration/cfgfilter.cxx @@ -2,13 +2,10 @@ * * 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: cfgfilter.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/makefile.mk b/desktop/source/migration/makefile.mk index 31af71f83fee..bc0cd9a62b10 100644 --- a/desktop/source/migration/makefile.mk +++ b/desktop/source/migration/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/migration.cxx b/desktop/source/migration/migration.cxx index dab464845ddd..2181daab7454 100644 --- a/desktop/source/migration/migration.cxx +++ b/desktop/source/migration/migration.cxx @@ -2,13 +2,10 @@ * * 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: migration.cxx,v $ - * $Revision: 1.13 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -16,7 +13,7 @@ * only, as published by the Free Software Foundation. * * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT uno::Any WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License version 3 for more details * (a copy is included in the LICENSE file that accompanied this code). @@ -37,6 +34,7 @@ #include <unotools/textsearch.hxx> #include <comphelper/processfactory.hxx> +#include <comphelper/sequence.hxx> #include <unotools/bootstrap.hxx> #include <rtl/bootstrap.hxx> #include <tools/config.hxx> @@ -94,7 +92,6 @@ static void releaseImpl() } } - // static main entry point for the migration process void Migration::doMigration() { @@ -143,11 +140,11 @@ sal_Bool MigrationImpl::checkMigration() MigrationImpl::MigrationImpl(const uno::Reference< XMultiServiceFactory >& xFactory) : m_vrVersions(new strings_v) , m_xFactory(xFactory) - , m_vrMigrations(readMigrationSteps()) - , m_aInfo(findInstallation()) - , m_vrFileList(compileFileList()) - , m_vrServiceList(compileServiceList()) { + readAvailableMigrations(m_vMigrationsAvailable); + sal_Int32 nIndex = findPreferedMigrationProcess(m_vMigrationsAvailable); + if ( nIndex >= 0 ) + m_vrMigrations = readMigrationSteps(m_vMigrationsAvailable[nIndex].name); } MigrationImpl::~MigrationImpl() @@ -157,6 +154,10 @@ MigrationImpl::~MigrationImpl() sal_Bool MigrationImpl::doMigration() { + // compile file and service list for migration + m_vrFileList = compileFileList(); + m_vrServiceList = compileServiceList(); + sal_Bool result = sal_False; try{ copyFiles(); @@ -221,20 +222,61 @@ sal_Bool MigrationImpl::checkMigrationCompleted() return bMigrationCompleted; } - -migrations_vr MigrationImpl::readMigrationSteps() +static void insertSorted(migrations_available& rAvailableMigrations, supported_migration& aSupportedMigration) { + bool bInserted( false ); + migrations_available::iterator pIter = rAvailableMigrations.begin(); + while ( !bInserted && pIter != rAvailableMigrations.end()) + { + if ( pIter->nPriority < aSupportedMigration.nPriority ) + { + rAvailableMigrations.insert(pIter, aSupportedMigration ); + bInserted = true; + } + ++pIter; + } + if ( !bInserted ) + rAvailableMigrations.push_back( aSupportedMigration ); +} +bool MigrationImpl::readAvailableMigrations(migrations_available& rAvailableMigrations) +{ // get supported version names - uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration"), uno::UNO_QUERY_THROW); - uno::Sequence< OUString > seqVersions; - aMigrationAccess->getByName(OUString::createFromAscii("SupportedVersions")) >>= seqVersions; - for (sal_Int32 i=0; i<seqVersions.getLength(); i++) - m_vrVersions->push_back(seqVersions[i].trim()); + uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); + uno::Sequence< OUString > seqSupportedVersions = aMigrationAccess->getElementNames(); + + const OUString aVersionIdentifiers( RTL_CONSTASCII_USTRINGPARAM( "VersionIdentifiers" )); + const OUString aPriorityIdentifier( RTL_CONSTASCII_USTRINGPARAM( "Priority" )); + + for (sal_Int32 i=0; i<seqSupportedVersions.getLength(); i++) + { + sal_Int32 nPriority( 0 ); + uno::Sequence< OUString > seqVersions; + uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(seqSupportedVersions[i]), uno::UNO_QUERY_THROW ); + xMigrationData->getByName( aVersionIdentifiers ) >>= seqVersions; + xMigrationData->getByName( aPriorityIdentifier ) >>= nPriority; + + supported_migration aSupportedMigration; + aSupportedMigration.name = seqSupportedVersions[i]; + aSupportedMigration.nPriority = nPriority; + for (sal_Int32 j=0; j<seqVersions.getLength(); j++) + aSupportedMigration.supported_versions.push_back(seqVersions[j].trim()); + insertSorted( rAvailableMigrations, aSupportedMigration ); + } + + return true; +} + +migrations_vr MigrationImpl::readMigrationSteps(const ::rtl::OUString& rMigrationName) +{ + // get migration access + uno::Reference< XNameAccess > aMigrationAccess(getConfigAccess("org.openoffice.Setup/Migration/SupportedVersions"), uno::UNO_QUERY_THROW); + uno::Reference< XNameAccess > xMigrationData( aMigrationAccess->getByName(rMigrationName), uno::UNO_QUERY_THROW ); // get migration description from from org.openoffice.Setup/Migration // and build vector of migration steps - uno::Reference< XNameAccess > theNameAccess(getConfigAccess("org.openoffice.Setup/Migration/MigrationSteps"), uno::UNO_QUERY_THROW); + OUString aMigrationSteps( RTL_CONSTASCII_USTRINGPARAM( "MigrationSteps" )); + uno::Reference< XNameAccess > theNameAccess(xMigrationData->getByName(aMigrationSteps), uno::UNO_QUERY_THROW); uno::Sequence< OUString > seqMigrations = theNameAccess->getElementNames(); uno::Reference< XNameAccess > tmpAccess; uno::Reference< XNameAccess > tmpAccess2; @@ -276,6 +318,20 @@ migrations_vr MigrationImpl::readMigrationSteps() tmpStep.excludeConfig.push_back(tmpSeq[j]); } + // included extensions... + if (tmpAccess->getByName(OUString::createFromAscii("IncludedExtensions")) >>= tmpSeq) + { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) + tmpStep.includeExtensions.push_back(tmpSeq[j]); + } + + // excluded extensions... + if (tmpAccess->getByName(OUString::createFromAscii("ExcludedExtensions")) >>= tmpSeq) + { + for (sal_Int32 j=0; j<tmpSeq.getLength(); j++) + tmpStep.excludeExtensions.push_back(tmpSeq[j]); + } + // config components if (tmpAccess->getByName(OUString::createFromAscii("ServiceConfigComponents")) >>= tmpSeq) { @@ -283,7 +339,6 @@ migrations_vr MigrationImpl::readMigrationSteps() tmpStep.configComponents.push_back(tmpSeq[j]); } - // generic service tmpAccess->getByName(OUString::createFromAscii("MigrationService")) >>= tmpStep.service; @@ -305,7 +360,7 @@ static FileBase::RC _checkAndCreateDirectory(INetURLObject& dirURL) return result; } -install_info MigrationImpl::findInstallation() +install_info MigrationImpl::findInstallation(const strings_v& rVersions) { rtl::OUString aProductName; uno::Any aRet = ::utl::ConfigManager::GetDirectConfigProperty( ::utl::ConfigManager::PRODUCTNAME ); @@ -313,9 +368,9 @@ install_info MigrationImpl::findInstallation() aProductName = aProductName.toAsciiLowerCase(); install_info aInfo; - strings_v::const_iterator i_ver = m_vrVersions->begin(); + strings_v::const_iterator i_ver = rVersions.begin(); uno::Reference < util::XStringSubstitution > xSubst( ::comphelper::getProcessServiceFactory()->createInstance(::rtl::OUString::createFromAscii("com.sun.star.util.PathSubstitution")), uno::UNO_QUERY ); - while (i_ver != m_vrVersions->end()) + while (i_ver != rVersions.end()) { ::rtl::OUString aVersion, aProfileName; sal_Int32 nSeparatorIndex = (*i_ver).indexOf('='); @@ -333,7 +388,7 @@ install_info MigrationImpl::findInstallation() osl::Security().getConfigDir( aUserInst ); if ( aUserInst.getLength() && aUserInst[ aUserInst.getLength()-1 ] != '/' ) aUserInst += ::rtl::OUString::createFromAscii("/"); -#ifdef UNX +#if defined UNX && ! defined MACOSX // tribute to whoever had the "great" idea to use different names on Windows and Unix aUserInst += ::rtl::OUString::createFromAscii("."); #endif @@ -348,12 +403,34 @@ install_info MigrationImpl::findInstallation() } catch( uno::Exception& ){} } - i_ver++; + ++i_ver; } return aInfo; } +sal_Int32 MigrationImpl::findPreferedMigrationProcess(const migrations_available& rAvailableMigrations) +{ + sal_Int32 nIndex( -1 ); + sal_Int32 i( 0 ); + + migrations_available::const_iterator rIter = rAvailableMigrations.begin(); + while ( rIter != rAvailableMigrations.end() ) + { + install_info aInstallInfo = findInstallation(rIter->supported_versions); + if (aInstallInfo.productname.getLength() > 0 ) + { + m_aInfo = aInstallInfo; + nIndex = i; + break; + } + ++i; + ++rIter; + } + + return nIndex; +} + strings_vr MigrationImpl::applyPatterns(const strings_v& vSet, const strings_v& vPatterns) const { using namespace utl; @@ -520,8 +597,6 @@ void MigrationImpl::copyConfig() aMsg += OUStringToOString(e.Message, RTL_TEXTENCODING_ASCII_US); OSL_ENSURE(sal_False, aMsg.getStr()); } - - } // removes elements of vector 2 in vector 1 @@ -629,7 +704,6 @@ void MigrationImpl::copyFiles() void MigrationImpl::runServices() { - //create stratum for old user layer OUString aOldLayerURL = m_aInfo.userdata; aOldLayerURL += OUString::createFromAscii("/user/registry"); @@ -640,7 +714,7 @@ void MigrationImpl::runServices() aStratumSvc, stratumArgs), uno::UNO_QUERY); // Build argument array - uno::Sequence< uno::Any > seqArguments(3); + uno::Sequence< uno::Any > seqArguments(4); seqArguments[0] = uno::makeAny(NamedValue( OUString::createFromAscii("Productname"), uno::makeAny(m_aInfo.productname))); @@ -676,11 +750,22 @@ void MigrationImpl::runServices() i_comp++; i++; } + // set old config argument seqArguments[2] = uno::makeAny(NamedValue( OUString::createFromAscii("OldConfiguration"), uno::makeAny(seqComponents))); + // set black list for extension migration + uno::Sequence< rtl::OUString > seqExtBlackList; + sal_uInt32 nSize = i_mig->excludeExtensions.size(); + if ( nSize > 0 ) + seqExtBlackList = comphelper::arrayToSequence< ::rtl::OUString >( + &i_mig->excludeExtensions[0], nSize ); + seqArguments[3] = uno::makeAny(NamedValue( + OUString::createFromAscii("ExtensionBlackList"), + uno::makeAny( seqExtBlackList ))); + xMigrationJob = uno::Reference< XJob >(m_xFactory->createInstanceWithArguments( i_mig->service, seqArguments), uno::UNO_QUERY_THROW); diff --git a/desktop/source/migration/migration.hrc b/desktop/source/migration/migration.hrc deleted file mode 100644 index 9c558e357c41..000000000000 --- a/desktop/source/migration/migration.hrc +++ /dev/null @@ -1 +0,0 @@ -. diff --git a/desktop/source/migration/migration.hxx b/desktop/source/migration/migration.hxx index cbd4b7757998..5ac8c5f5702c 100644 --- a/desktop/source/migration/migration.hxx +++ b/desktop/source/migration/migration.hxx @@ -2,13 +2,10 @@ * * 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: migration.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/migration.src b/desktop/source/migration/migration.src deleted file mode 100644 index e69de29bb2d1..000000000000 --- a/desktop/source/migration/migration.src +++ /dev/null diff --git a/desktop/source/migration/migration_impl.hxx b/desktop/source/migration/migration_impl.hxx index b9577daa0a08..b40de510261d 100644 --- a/desktop/source/migration/migration_impl.hxx +++ b/desktop/source/migration/migration_impl.hxx @@ -2,13 +2,10 @@ * * 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: migration_impl.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -68,11 +65,21 @@ struct migration_step strings_v includeConfig; strings_v excludeConfig; strings_v configComponents; + strings_v includeExtensions; + strings_v excludeExtensions; rtl::OUString service; }; +struct supported_migration +{ + rtl::OUString name; + sal_Int32 nPriority; + strings_v supported_versions; +}; + typedef std::vector< migration_step > migrations_v; typedef std::auto_ptr< migrations_v > migrations_vr; +typedef std::vector< supported_migration > migrations_available; class MigrationImpl { @@ -80,18 +87,22 @@ class MigrationImpl private: strings_vr m_vrVersions; NS_UNO::Reference< NS_CSS::lang::XMultiServiceFactory > m_xFactory; - migrations_vr m_vrMigrations; // list of all migration specs from config - install_info m_aInfo; // info about the version being migrated - strings_vr m_vrFileList; // final list of files to be copied - strings_vr m_vrConfigList; // final list of nodes to be copied - strings_vr m_vrServiceList; // final list of services to be called - - // initializer functions... - migrations_vr readMigrationSteps(); - install_info findInstallation(); - strings_vr compileFileList(); - strings_vr compileConfigList(); - strings_vr compileServiceList(); + + migrations_available m_vMigrationsAvailable; // list of all available migrations + migrations_vr m_vrMigrations; // list of all migration specs from config + install_info m_aInfo; // info about the version being migrated + strings_vr m_vrFileList; // final list of files to be copied + strings_vr m_vrConfigList; // final list of nodes to be copied + strings_vr m_vrServiceList; // final list of services to be called + + // functions to control the migration process + bool readAvailableMigrations(migrations_available&); + migrations_vr readMigrationSteps(const ::rtl::OUString& rMigrationName); + sal_Int32 findPreferedMigrationProcess(const migrations_available&); + install_info findInstallation(const strings_v& rVersions); + strings_vr compileFileList(); + strings_vr compileConfigList(); + strings_vr compileServiceList(); // helpers void substract(strings_v& va, const strings_v& vb_c) const; diff --git a/desktop/source/migration/pages.cxx b/desktop/source/migration/pages.cxx index c21767a0f83d..11cc61ed84ff 100644 --- a/desktop/source/migration/pages.cxx +++ b/desktop/source/migration/pages.cxx @@ -2,13 +2,10 @@ * * 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: pages.cxx,v $ - * $Revision: 1.23 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -58,6 +55,7 @@ #include <rtl/bootstrap.hxx> #include <rtl/ustrbuf.hxx> #include <osl/file.hxx> +#include <osl/thread.hxx> #include <unotools/bootstrap.hxx> #include <tools/config.hxx> @@ -65,6 +63,7 @@ using namespace rtl; using namespace osl; using namespace utl; using namespace svt; +using namespace com::sun::star; using namespace com::sun::star::frame; using namespace com::sun::star::lang; using namespace com::sun::star::util; @@ -97,27 +96,20 @@ WelcomePage::WelcomePage( svt::OWizardMachine* parent, const ResId& resid, sal_B _setBold(m_ftHead); checkEval(); - // we need to choose the welcome text that is diplayed - // choices are the default text, default text+migradtion, - // OEM and extended OEM - // No OEM is built, remove the check -// switch (checkOEM()) -// { -// case OEM_NONE: - // check for migration - if (Migration::checkMigration()) - { - String aText(WizardResId(STR_WELCOME_MIGRATION)); - // replace %OLDPRODUCT with found version name - aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName()); - m_ftBody.SetText( aText ); - } - else - if ( ! m_bLicenseNeedsAcceptance ) - { - String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE)); - m_ftBody.SetText( aText ); - } + + // check for migration + if (Migration::checkMigration()) + { + String aText(WizardResId(STR_WELCOME_MIGRATION)); + // replace %OLDPRODUCT with found version name + aText.SearchAndReplaceAll( UniString::CreateFromAscii("%OLD_VERSION"), Migration::getOldVersionName()); + m_ftBody.SetText( aText ); + } + else if ( ! m_bLicenseNeedsAcceptance ) + { + String aText(WizardResId(STR_WELCOME_WITHOUT_LICENSE)); + m_ftBody.SetText( aText ); + } } @@ -315,12 +307,46 @@ void LicenseView::Notify( SfxBroadcaster&, const SfxHint& rHint ) // ------------------------------------------------------------------- -MigrationPage::MigrationPage( svt::OWizardMachine* parent, const ResId& resid) +class MigrationThread : public ::osl::Thread +{ + public: + MigrationThread(); + + virtual void SAL_CALL run(); + virtual void SAL_CALL onTerminated(); +}; + +MigrationThread::MigrationThread() +{ +} + +void MigrationThread::run() +{ + try + { + Migration::doMigration(); + } + catch ( uno::Exception& ) + { + } +} + +void MigrationThread::onTerminated() +{ +} + +// ------------------------------------------------------------------- + +MigrationPage::MigrationPage( + svt::OWizardMachine* parent, + const ResId& resid, + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber) : OWizardPage(parent, resid) , m_ftHead(this, WizardResId(FT_MIGRATION_HEADER)) , m_ftBody(this, WizardResId(FT_MIGRATION_BODY)) , m_cbMigration(this, WizardResId(CB_MIGRATION)) , m_bMigrationDone(sal_False) + , m_xThrobber(xThrobber) { FreeResource(); _setBold(m_ftHead); @@ -335,9 +361,28 @@ sal_Bool MigrationPage::commitPage( CommitPageReason _eReason ) { if (_eReason == eTravelForward && m_cbMigration.IsChecked() && !m_bMigrationDone) { - EnterWait(); - Migration::doMigration(); - LeaveWait(); + GetParent()->EnterWait(); + FirstStartWizard* pWizard = dynamic_cast< FirstStartWizard* >( GetParent() ); + if ( pWizard ) + pWizard->DisableButtonsWhileMigration(); + + uno::Reference< awt::XWindow > xWin( m_xThrobber, uno::UNO_QUERY ); + xWin->setVisible( true ); + m_xThrobber->start(); + MigrationThread* pMigThread = new MigrationThread(); + pMigThread->create(); + + while ( pMigThread->isRunning() ) + { + Application::Reschedule(); + } + + m_xThrobber->stop(); + GetParent()->LeaveWait(); + // Next state will enable buttons - so no EnableButtons necessary! + xWin->setVisible( false ); + pMigThread->join(); + delete pMigThread; m_bMigrationDone = sal_True; } else @@ -625,84 +670,4 @@ void RegistrationPage::executeSingleMode() ::utl::RegOptions().removeReminder(); } -// ----------------------------------------------------------------------- - -static char const OEM_PRELOAD_SECTION[] = "Bootstrap"; -static char const OEM_PRELOAD[] = "Preload"; -static char const STR_TRUE[] = "1"; -static char const STR_FALSE[] = "0"; - -static sal_Bool existsURL( OUString const& _sURL ) -{ - using namespace osl; - DirectoryItem aDirItem; - - if (_sURL.getLength() != 0) - return ( DirectoryItem::get( _sURL, aDirItem ) == DirectoryItem::E_None ); - - return sal_False; -} - - -// locate soffice.ini/.rc file -static OUString locateIniFile() -{ - OUString aUserDataPath; - OUString aSofficeIniFileURL; - - // Retrieve the default file URL for the soffice.ini/rc - rtl::Bootstrap().getIniName( aSofficeIniFileURL ); - - if ( utl::Bootstrap::locateUserData( aUserDataPath ) == utl::Bootstrap::PATH_EXISTS ) - { - const char CONFIG_DIR[] = "/config"; - - sal_Int32 nIndex = aSofficeIniFileURL.lastIndexOf( '/'); - if ( nIndex > 0 ) - { - OUString aUserSofficeIniFileURL; - OUStringBuffer aBuffer( aUserDataPath ); - aBuffer.appendAscii( CONFIG_DIR ); - aBuffer.append( aSofficeIniFileURL.copy( nIndex )); - aUserSofficeIniFileURL = aBuffer.makeStringAndClear(); - - if ( existsURL( aUserSofficeIniFileURL )) - return aUserSofficeIniFileURL; - } - } - // Fallback try to use the soffice.ini/rc from program folder - return aSofficeIniFileURL; -} - -// check whether the OEMPreload flag was set in soffice.ini/.rc -static sal_Int32 checkOEMPreloadFlag() -{ - OUString aSofficeIniFileURL; - aSofficeIniFileURL = locateIniFile(); - Config aConfig(aSofficeIniFileURL); - aConfig.SetGroup( OEM_PRELOAD_SECTION ); - ByteString sResult = aConfig.ReadKey( OEM_PRELOAD ); - return sResult.ToInt32(); - /* - if ( sResult == STR_TRUE ) - return sal_True; - else - return sal_False; - */ -} - -WelcomePage::OEMType WelcomePage::checkOEM() -{ - sal_Int32 oemResult = checkOEMPreloadFlag(); - switch (oemResult) { - case 1: - return OEM_NORMAL; - case 2: - return OEM_EXTENDED; - default: - return OEM_NONE; - } -} - } // namespace desktop - diff --git a/desktop/source/migration/pages.hxx b/desktop/source/migration/pages.hxx index b5e89860792c..9740773fe602 100644 --- a/desktop/source/migration/pages.hxx +++ b/desktop/source/migration/pages.hxx @@ -2,13 +2,10 @@ * * 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: pages.hxx,v $ - * $Revision: 1.14 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -41,6 +38,8 @@ #include <svl/lstner.hxx> #include <svtools/xtextedt.hxx> +#include <com/sun/star/awt/XThrobber.hpp> + namespace desktop { class WelcomePage : public svt::OWizardPage @@ -54,7 +53,6 @@ private: { OEM_NONE, OEM_NORMAL, OEM_EXTENDED }; - OEMType checkOEM(); bool bIsEvalVersion; bool bNoEvalText; void checkEval(); @@ -124,8 +122,9 @@ private: FixedText m_ftBody; CheckBox m_cbMigration; sal_Bool m_bMigrationDone; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber; public: - MigrationPage( svt::OWizardMachine* parent, const ResId& resid); + MigrationPage( svt::OWizardMachine* parent, const ResId& resid, ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > xThrobber ); virtual sal_Bool commitPage( CommitPageReason _eReason ); protected: diff --git a/desktop/source/migration/services/autocorrmigration.cxx b/desktop/source/migration/services/autocorrmigration.cxx index e7ff4833ffa8..c416992da13c 100644 --- a/desktop/source/migration/services/autocorrmigration.cxx +++ b/desktop/source/migration/services/autocorrmigration.cxx @@ -2,13 +2,10 @@ * * 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: autocorrmigration.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/autocorrmigration.hxx b/desktop/source/migration/services/autocorrmigration.hxx index 13b1b7488875..715baa6bca12 100644 --- a/desktop/source/migration/services/autocorrmigration.hxx +++ b/desktop/source/migration/services/autocorrmigration.hxx @@ -2,13 +2,10 @@ * * 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: autocorrmigration.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/basicmigration.cxx b/desktop/source/migration/services/basicmigration.cxx index dbaa2bb839f7..3e7384f2262f 100644 --- a/desktop/source/migration/services/basicmigration.cxx +++ b/desktop/source/migration/services/basicmigration.cxx @@ -2,13 +2,10 @@ * * 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: basicmigration.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/basicmigration.hxx b/desktop/source/migration/services/basicmigration.hxx index f5bf7a0c5af3..9b6433ba88e8 100644 --- a/desktop/source/migration/services/basicmigration.hxx +++ b/desktop/source/migration/services/basicmigration.hxx @@ -2,13 +2,10 @@ * * 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: basicmigration.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/cexports.cxx b/desktop/source/migration/services/cexports.cxx index b64cc242fa52..c1971e9d4d00 100644 --- a/desktop/source/migration/services/cexports.cxx +++ b/desktop/source/migration/services/cexports.cxx @@ -2,13 +2,10 @@ * * 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 diff --git a/desktop/source/migration/services/cexportsoo3.cxx b/desktop/source/migration/services/cexportsoo3.cxx new file mode 100755 index 000000000000..20b8232044e9 --- /dev/null +++ b/desktop/source/migration/services/cexportsoo3.cxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: 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 + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "cppuhelper/implementationentry.hxx" +#include "oo3extensionmigration.hxx" + +extern "C" +{ + +::cppu::ImplementationEntry entries [] = +{ + { + migration::OO3ExtensionMigration_create, migration::OO3ExtensionMigration_getImplementationName, + migration::OO3ExtensionMigration_getSupportedServiceNames, ::cppu::createSingleComponentFactory, + 0, 0 + }, + { 0, 0, 0, 0, 0, 0 } +}; + + +void SAL_CALL component_getImplementationEnvironment( + const sal_Char ** ppEnvTypeName, uno_Environment ** ) +{ + *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME; +} + +sal_Bool SAL_CALL component_writeInfo( + void * pServiceManager, void * pRegistryKey ) +{ + return ::cppu::component_writeInfoHelper( + pServiceManager, pRegistryKey, entries ); +} + +void * SAL_CALL component_getFactory( + const sal_Char * pImplName, void * pServiceManager, void * pRegistryKey ) +{ + return ::cppu::component_getFactoryHelper( + pImplName, pServiceManager, pRegistryKey, entries ); +} + +} diff --git a/desktop/source/migration/services/cppumaker.mk b/desktop/source/migration/services/cppumaker.mk index c1d1fedcfb20..5ab16ed1e3fe 100644 --- a/desktop/source/migration/services/cppumaker.mk +++ b/desktop/source/migration/services/cppumaker.mk @@ -2,14 +2,10 @@ # # 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: cppumaker.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/extensionmigration.cxx b/desktop/source/migration/services/extensionmigration.cxx index fc92ed805ca7..a926f17c0c19 100755 --- a/desktop/source/migration/services/extensionmigration.cxx +++ b/desktop/source/migration/services/extensionmigration.cxx @@ -2,13 +2,10 @@ * * 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 @@ -244,16 +241,6 @@ namespace migration } } - void ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) - { - const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); - if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) - { - xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); - } - } - bool ExtensionMigration::processExtensions( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) { if (!copy(sSourceDir, sTargetDir)) diff --git a/desktop/source/migration/services/extensionmigration.hxx b/desktop/source/migration/services/extensionmigration.hxx index 55c66a7beea0..70f6a4c44c9b 100755 --- a/desktop/source/migration/services/extensionmigration.hxx +++ b/desktop/source/migration/services/extensionmigration.hxx @@ -2,13 +2,10 @@ * * 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 @@ -101,8 +98,6 @@ namespace migration ::com::sun::star::deployment::XPackage > & xPkg); void registerBasicPackage( const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); - void registerConfigurationPackage( - const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); public: ExtensionMigration(::com::sun::star::uno::Reference< diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index ff0cd6021c13..381b6cb378c1 100644 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx @@ -2,13 +2,10 @@ * * 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: jvmfwk.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -241,15 +238,6 @@ css::uno::Sequence< OUString > jvmfwk_getSupportedServiceNames() return css::uno::Sequence< OUString >( &str_name, 1 ); } -css::uno::Reference< css::uno::XInterface > SAL_CALL jvmfwk_create( - css::uno::Reference< css::uno::XComponentContext > const & ) - throw (css::uno::Exception) -{ - return static_cast< ::cppu::OWeakObject * >(new JavaMigration); - -} - - // XServiceInfo OUString SAL_CALL JavaMigration::getImplementationName() throw (css::uno::RuntimeException) diff --git a/desktop/source/migration/services/jvmfwk.hxx b/desktop/source/migration/services/jvmfwk.hxx index aad72ea911a3..a79d36b8b86b 100644 --- a/desktop/source/migration/services/jvmfwk.hxx +++ b/desktop/source/migration/services/jvmfwk.hxx @@ -2,13 +2,10 @@ * * 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: jvmfwk.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -45,16 +42,9 @@ namespace css = com::sun::star; namespace migration { - rtl::OUString jvmfwk_getImplementationName(); css::uno::Sequence< rtl::OUString > jvmfwk_getSupportedServiceNames(); - -css::uno::Reference< css::uno::XInterface > SAL_CALL jvmfwk_create( - css::uno::Reference< css::uno::XComponentContext > const & ) - throw (css::uno::Exception); - - } //end blind namespace diff --git a/desktop/source/migration/services/makefile.mk b/desktop/source/migration/services/makefile.mk index 22d28ee00c73..55ecff6bc06f 100644 --- a/desktop/source/migration/services/makefile.mk +++ b/desktop/source/migration/services/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,6 +31,7 @@ PRJNAME=desktop TARGET = migrationoo2.uno ENABLE_EXCEPTIONS=TRUE COMP1TYPELIST = migrationoo2 +LIBTARGET=NO # --- Settings ----------------------------------------------------- .INCLUDE : ..$/..$/deployment/inc/dp_misc.mk @@ -55,10 +52,20 @@ SLOFILES= \ $(SLO)$/basicmigration.obj \ $(SLO)$/wordbookmigration.obj \ $(SLO)$/extensionmigration.obj \ + $(SLO)$/autocorrmigration.obj \ + $(SLO)$/oo3extensionmigration.obj \ + $(SLO)$/cexportsoo3.obj + +SHL1OBJS= \ + $(SLO)$/jvmfwk.obj \ + $(SLO)$/cexports.obj \ + $(SLO)$/basicmigration.obj \ + $(SLO)$/wordbookmigration.obj \ + $(SLO)$/extensionmigration.obj \ $(SLO)$/autocorrmigration.obj SHL1TARGET=$(TARGET) -SHL1VERSIONMAP = migrationoo2.map +SHL1VERSIONMAP = $(SOLARENV)/src/component.map SHL1STDLIBS= \ $(DEPLOYMENTMISCLIB) \ @@ -72,16 +79,42 @@ SHL1STDLIBS= \ $(JVMFWKLIB) \ $(XMLSCRIPTLIB) \ $(BERKELEYLIB) - - SHL1DEPN= -SHL1IMPLIB=i$(TARGET) -SHL1LIBS=$(SLB)$/$(TARGET).lib +SHL1IMPLIB=imigrationoo2 +#SHL1LIBS=$(SLB)$/$(TARGET).lib SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) +COMP2TYPELIST = migrationoo3 +SHL2TARGET=migrationoo3.uno +SHL2VERSIONMAP = migrationoo3.map + +SHL2OBJS= \ + $(SLO)$/cexportsoo3.obj \ + $(SLO)$/oo3extensionmigration.obj + +SHL2STDLIBS= \ + $(DEPLOYMENTMISCLIB) \ + $(CPPULIB) \ + $(CPPUHELPERLIB) \ + $(SALLIB) \ + $(UCBHELPERLIB) \ + $(UNOTOOLSLIB) \ + $(TOOLSLIB) \ + $(I18NISOLANGLIB) \ + $(JVMFWKLIB) \ + $(XMLSCRIPTLIB) \ + $(BERKELEYLIB) + +SHL2DEPN= +SHL2IMPLIB=imigrationoo3 +#SHL2LIBS=$(SLB)$/$(SHL2TARGET).lib +SHL2DEF=$(MISC)$/$(SHL2TARGET).def + +DEF2NAME=$(SHL2TARGET) + # --- Targets ------------------------------------------------------ .INCLUDE : target.mk diff --git a/desktop/source/migration/services/migrationoo2.map b/desktop/source/migration/services/migrationoo3.map index ac2c3750bfe0..ac2c3750bfe0 100644..100755 --- a/desktop/source/migration/services/migrationoo2.map +++ b/desktop/source/migration/services/migrationoo3.map diff --git a/desktop/source/migration/services/misc.hxx b/desktop/source/migration/services/misc.hxx index 16fbce184693..8bab95c09a57 100644 --- a/desktop/source/migration/services/misc.hxx +++ b/desktop/source/migration/services/misc.hxx @@ -2,13 +2,10 @@ * * 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: misc.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx new file mode 100755 index 000000000000..11bf8129cc04 --- /dev/null +++ b/desktop/source/migration/services/oo3extensionmigration.cxx @@ -0,0 +1,656 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: 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 + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +// MARKER(update_precomp.py): autogen include statement, do not remove +#include "precompiled_desktop.hxx" + +#include "oo3extensionmigration.hxx" +#include <rtl/instance.hxx> +#include <osl/file.hxx> +#include <osl/thread.h> +#include <tools/urlobj.hxx> +#include <unotools/bootstrap.hxx> +#include <unotools/ucbstreamhelper.hxx> +#include <unotools/textsearch.hxx> +#include <comphelper/sequence.hxx> +#include <comphelper/processfactory.hxx> +#include <ucbhelper/content.hxx> + +#include <com/sun/star/deployment/thePackageManagerFactory.hpp> +#include <com/sun/star/deployment/XPackageManagerFactory.hpp> +#include <com/sun/star/task/XInteractionApprove.hpp> +#include <com/sun/star/task/XInteractionAbort.hpp> +#include <com/sun/star/ucb/XCommandInfo.hpp> +#include <com/sun/star/ucb/TransferInfo.hpp> +#include <com/sun/star/ucb/NameClash.hpp> +#include <com/sun/star/ucb/XCommandEnvironment.hpp> +#include <com/sun/star/xml/xpath/XXPathAPI.hpp> + +using namespace ::com::sun::star; +using namespace ::com::sun::star::uno; + +namespace migration +{ + +static ::rtl::OUString sExtensionSubDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/uno_packages/" ) ); +static ::rtl::OUString sSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "cache" ) ); +static ::rtl::OUString sConfigDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data" ) ); +static ::rtl::OUString sOrgDir = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); +static ::rtl::OUString sExcludeDir1 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org" ) ); +static ::rtl::OUString sExcludeDir2 = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/user/registry/data/org/openoffice" ) ); +static ::rtl::OUString sDescriptionXmlFile = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/description.xml" ) ); +static ::rtl::OUString sExtensionRootSubDirName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "/uno_packages" ) ); + +static ::rtl::OUString sConfigurationDataType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-data")); +static ::rtl::OUString sConfigurationSchemaType = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("application/vnd.sun.star.configuration-schema")); + +// ============================================================================= +// component operations +// ============================================================================= + +::rtl::OUString OO3ExtensionMigration_getImplementationName() +{ + static ::rtl::OUString* pImplName = 0; + if ( !pImplName ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pImplName ) + { + static ::rtl::OUString aImplName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.desktop.migration.OOo3Extensions" ) ); + pImplName = &aImplName; + } + } + return *pImplName; +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > OO3ExtensionMigration_getSupportedServiceNames() +{ + static Sequence< ::rtl::OUString >* pNames = 0; + if ( !pNames ) + { + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if ( !pNames ) + { + static Sequence< ::rtl::OUString > aNames(1); + aNames.getArray()[0] = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.migration.Extensions" ) ); + pNames = &aNames; + } + } + return *pNames; +} + +// ============================================================================= +// ExtensionMigration +// ============================================================================= + +OO3ExtensionMigration::OO3ExtensionMigration(Reference< XComponentContext > const & ctx) : +m_ctx(ctx) +{ +} + +// ----------------------------------------------------------------------------- + +OO3ExtensionMigration::~OO3ExtensionMigration() +{ +} + +::osl::FileBase::RC OO3ExtensionMigration::checkAndCreateDirectory( INetURLObject& rDirURL ) +{ + ::osl::FileBase::RC aResult = ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); + if ( aResult == ::osl::FileBase::E_NOENT ) + { + INetURLObject aBaseURL( rDirURL ); + aBaseURL.removeSegment(); + checkAndCreateDirectory( aBaseURL ); + return ::osl::Directory::create( rDirURL.GetMainURL( INetURLObject::DECODE_TO_IURI ) ); + } + else + { + return aResult; + } +} + +void OO3ExtensionMigration::registerConfigurationPackage( const uno::Reference< deployment::XPackage > & xPkg) +{ + const ::rtl::OUString sMediaType = xPkg->getPackageType()->getMediaType(); + if ( (sMediaType.equals(sConfigurationDataType) || sMediaType.equals(sConfigurationSchemaType) ) ) + { + xPkg->revokePackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + xPkg->registerPackage(uno::Reference< task::XAbortChannel >(), uno::Reference< ucb::XCommandEnvironment> ()); + } +} + + void OO3ExtensionMigration::scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ) +{ + osl::Directory aScanRootDir( sSourceDir ); + osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); + osl::FileBase::RC nRetCode = aScanRootDir.open(); + if ( nRetCode == osl::Directory::E_None ) + { + sal_uInt32 nHint( 0 ); + osl::DirectoryItem aItem; + while ( aScanRootDir.getNextItem( aItem, nHint ) == osl::Directory::E_None ) + { + if (( aItem.getFileStatus(fs) == osl::FileBase::E_None ) && + ( fs.getFileType() == osl::FileStatus::Directory )) + { + //Check next folder as the "real" extension folder is below a temp folder! + ::rtl::OUString sExtensionFolderURL = fs.getFileURL(); + + osl::DirectoryItem aExtDirItem; + osl::Directory aExtensionRootDir( sExtensionFolderURL ); + + nRetCode = aExtensionRootDir.open(); + if (( nRetCode == osl::Directory::E_None ) && + ( aExtensionRootDir.getNextItem( aExtDirItem, nHint ) == osl::Directory::E_None )) + { + bool bFileStatus = aExtDirItem.getFileStatus(fs) == osl::FileBase::E_None; + bool bIsDir = fs.getFileType() == osl::FileStatus::Directory; + + if ( bFileStatus && bIsDir ) + { + sExtensionFolderURL = fs.getFileURL(); + ScanResult eResult = scanExtensionFolder( sExtensionFolderURL ); + if ( eResult == SCANRESULT_MIGRATE_EXTENSION ) + aMigrateExtensions.push_back( sExtensionFolderURL ); + } + } + } + } + } +} + +OO3ExtensionMigration::ScanResult OO3ExtensionMigration::scanExtensionFolder( const ::rtl::OUString& sExtFolder ) +{ + ScanResult aResult = SCANRESULT_NOTFOUND; + osl::Directory aDir(sExtFolder); + + // get sub dirs + if (aDir.open() == osl::FileBase::E_None) + { + // work through directory contents... + osl::DirectoryItem item; + osl::FileStatus fs(FileStatusMask_Type | FileStatusMask_FileURL); + TStringVector aDirectories; + while ((aDir.getNextItem(item) == osl::FileBase::E_None ) && + ( aResult == SCANRESULT_NOTFOUND )) + { + if (item.getFileStatus(fs) == osl::FileBase::E_None) + { + ::rtl::OUString aDirEntryURL; + if (fs.getFileType() == osl::FileStatus::Directory) + aDirectories.push_back( fs.getFileURL() ); + else + { + aDirEntryURL = fs.getFileURL(); + if ( aDirEntryURL.indexOf( sDescriptionXmlFile ) > 0 ) + aResult = scanDescriptionXml( aDirEntryURL ) ? SCANRESULT_MIGRATE_EXTENSION : SCANRESULT_DONTMIGRATE_EXTENSION; + } + } + } + + TStringVector::const_iterator pIter = aDirectories.begin(); + while ( pIter != aDirectories.end() && aResult == SCANRESULT_NOTFOUND ) + { + aResult = scanExtensionFolder( *pIter ); + ++pIter; + } + } + return aResult; +} + +bool OO3ExtensionMigration::scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlURL ) +{ + if ( !m_xDocBuilder.is() ) + { + m_xDocBuilder = uno::Reference< xml::dom::XDocumentBuilder >( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.dom.DocumentBuilder")), + m_ctx ), uno::UNO_QUERY ); + } + + if ( !m_xSimpleFileAccess.is() ) + { + m_xSimpleFileAccess = uno::Reference< ucb::XSimpleFileAccess >( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess")), + m_ctx ), uno::UNO_QUERY ); + } + + ::rtl::OUString aExtIdentifier; + if ( m_xDocBuilder.is() && m_xSimpleFileAccess.is() ) + { + try + { + uno::Reference< io::XInputStream > xIn = + m_xSimpleFileAccess->openFileRead( sDescriptionXmlURL ); + + if ( xIn.is() ) + { + uno::Reference< xml::dom::XDocument > xDoc = m_xDocBuilder->parse( xIn ); + if ( xDoc.is() ) + { + uno::Reference< xml::dom::XElement > xRoot = xDoc->getDocumentElement(); + if ( xRoot.is() && + xRoot->getTagName().equals(::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("description"))) ) + { + uno::Reference< xml::xpath::XXPathAPI > xPath( + m_ctx->getServiceManager()->createInstanceWithContext( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.xml.xpath.XPathAPI")), + m_ctx), + uno::UNO_QUERY); + + xPath->registerNS( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc")), + xRoot->getNamespaceURI()); + xPath->registerNS( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("xlink")), + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("http://www.w3.org/1999/xlink"))); + + try + { + uno::Reference< xml::dom::XNode > xRootNode( xRoot, uno::UNO_QUERY ); + uno::Reference< xml::dom::XNode > xNode( + xPath->selectSingleNode( + xRootNode, + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("desc:identifier/@value")) )); + if ( xNode.is() ) + aExtIdentifier = xNode->getNodeValue(); + } + catch ( xml::xpath::XPathException& ) + { + } + catch ( xml::dom::DOMException& ) + { + } + } + } + } + + if ( aExtIdentifier.getLength() > 0 ) + { + // scan extension identifier and try to match with our black list entries + for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) + { + utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::TextSearch ts(param, LANGUAGE_DONTKNOW); + + xub_StrLen start = 0; + xub_StrLen end = static_cast<USHORT>(aExtIdentifier.getLength()); + if (ts.SearchFrwrd(aExtIdentifier, &start, &end)) + return false; + } + } + } + catch ( ucb::CommandAbortedException& ) + { + } + catch ( uno::RuntimeException& ) + { + } + + if ( aExtIdentifier.getLength() == 0 ) + { + // Fallback: + // Try to use the folder name to match our black list + // as some extensions don't provide an identifier in the + // description.xml! + for ( sal_uInt32 i = 0; i < m_aBlackList.size(); i++ ) + { + utl::SearchParam param(m_aBlackList[i], utl::SearchParam::SRCH_REGEXP); + utl::TextSearch ts(param, LANGUAGE_DONTKNOW); + + xub_StrLen start = 0; + xub_StrLen end = static_cast<USHORT>(sDescriptionXmlURL.getLength()); + if (ts.SearchFrwrd(sDescriptionXmlURL, &start, &end)) + return false; + } + } + } + + return true; +} + +bool OO3ExtensionMigration::migrateExtension( const ::rtl::OUString& sSourceDir ) +{ + if ( !m_xPackageManager.is() ) + { + try + { + m_xPackageManager = deployment::thePackageManagerFactory::get( m_ctx )->getPackageManager( + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "user" )) ); + } + catch ( ucb::CommandFailedException & ){} + catch ( uno::RuntimeException & ) {} + } + + if ( m_xPackageManager.is() ) + { + try + { + TmpRepositoryCommandEnv* pCmdEnv = new TmpRepositoryCommandEnv(); + + uno::Reference< ucb::XCommandEnvironment > xCmdEnv( + static_cast< cppu::OWeakObject* >( pCmdEnv ), uno::UNO_QUERY ); + uno::Reference< task::XAbortChannel > xAbortChannel; + uno::Reference< deployment::XPackage > xPackage = + m_xPackageManager->addPackage( sSourceDir, ::rtl::OUString(), xAbortChannel, xCmdEnv ); + + if ( xPackage.is() ) + return true; + } + catch ( ucb::CommandFailedException& ) + { + } + catch ( ucb::CommandAbortedException& ) + { + } + catch ( lang::IllegalArgumentException& ) + { + } + } + + return false; +} + +bool OO3ExtensionMigration::copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) +{ + bool bRet = false; + + INetURLObject aSourceObj( sSourceDir ); + INetURLObject aDestObj( sTargetDir ); + String aName = aDestObj.getName(); + aDestObj.removeSegment(); + aDestObj.setFinalSlash(); + + try + { + ::ucbhelper::Content aDestPath( aDestObj.GetMainURL( INetURLObject::NO_DECODE ), uno::Reference< ucb::XCommandEnvironment > () ); + uno::Reference< ucb::XCommandInfo > xInfo = aDestPath.getCommands(); + ::rtl::OUString aTransferName = ::rtl::OUString::createFromAscii( "transfer" ); + if ( xInfo->hasCommandByName( aTransferName ) ) + { + aDestPath.executeCommand( aTransferName, uno::makeAny( + ucb::TransferInfo( sal_False, aSourceObj.GetMainURL( INetURLObject::NO_DECODE ), aName, ucb::NameClash::OVERWRITE ) ) ); + bRet = true; + } + } + catch( uno::Exception& ) + { + } + + return bRet; +} + + +// ----------------------------------------------------------------------------- +// XServiceInfo +// ----------------------------------------------------------------------------- + +::rtl::OUString OO3ExtensionMigration::getImplementationName() throw (RuntimeException) +{ + return OO3ExtensionMigration_getImplementationName(); +} + +// ----------------------------------------------------------------------------- + +sal_Bool OO3ExtensionMigration::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException) +{ + Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() ); + const ::rtl::OUString* pNames = aNames.getConstArray(); + const ::rtl::OUString* pEnd = pNames + aNames.getLength(); + for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames ) + ; + + return pNames != pEnd; +} + +// ----------------------------------------------------------------------------- + +Sequence< ::rtl::OUString > OO3ExtensionMigration::getSupportedServiceNames() throw (RuntimeException) +{ + return OO3ExtensionMigration_getSupportedServiceNames(); +} + +// ----------------------------------------------------------------------------- +// XInitialization +// ----------------------------------------------------------------------------- + +void OO3ExtensionMigration::initialize( const Sequence< Any >& aArguments ) throw (Exception, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + const Any* pIter = aArguments.getConstArray(); + const Any* pEnd = pIter + aArguments.getLength(); + for ( ; pIter != pEnd ; ++pIter ) + { + beans::NamedValue aValue; + *pIter >>= aValue; + if ( aValue.Name.equalsAscii( "UserData" ) ) + { + if ( !(aValue.Value >>= m_sSourceDir) ) + { + OSL_ENSURE( false, "ExtensionMigration::initialize: argument UserData has wrong type!" ); + } + } + else if ( aValue.Name.equalsAscii( "ExtensionBlackList" ) ) + { + Sequence< ::rtl::OUString > aBlackList; + if ( (aValue.Value >>= aBlackList ) && ( aBlackList.getLength() > 0 )) + { + m_aBlackList.resize( aBlackList.getLength() ); + ::comphelper::sequenceToArray< ::rtl::OUString >( &m_aBlackList[0], aBlackList ); + } + } + } +} + +// ----------------------------------------------------------------------------- + +TStringVectorPtr getContent( const ::rtl::OUString& rBaseURL ) +{ + TStringVectorPtr aResult( new TStringVector ); + ::osl::Directory aDir( rBaseURL); + if ( aDir.open() == ::osl::FileBase::E_None ) + { + // iterate over directory content + TStringVector aSubDirs; + ::osl::DirectoryItem aItem; + while ( aDir.getNextItem( aItem ) == ::osl::FileBase::E_None ) + { + ::osl::FileStatus aFileStatus( FileStatusMask_Type | FileStatusMask_FileURL ); + if ( aItem.getFileStatus( aFileStatus ) == ::osl::FileBase::E_None ) + aResult->push_back( aFileStatus.getFileURL() ); + } + } + + return aResult; +} + +// ----------------------------------------------------------------------------- +// XJob +// ----------------------------------------------------------------------------- + +void OO3ExtensionMigration::copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ) +{ + ::rtl::OUString sEx1( m_sSourceDir ); + sEx1 += sExcludeDir1; + ::rtl::OUString sEx2( m_sSourceDir ); + sEx2 += sExcludeDir2; + + TStringVectorPtr aList = getContent( sSourceDir ); + TStringVector::const_iterator aI = aList->begin(); + while ( aI != aList->end() ) + { + ::rtl::OUString sSourceLocalName = aI->copy( sSourceDir.getLength() ); + ::rtl::OUString aTemp = aI->copy( m_sSourceDir.getLength() ); + if ( aTemp != sExcludeDir1 && aTemp != sExcludeDir2 ) + { + ::rtl::OUString sTargetName = sTargetDir + sSourceLocalName; + copy( (*aI), sTargetName ); + } + ++aI; + } +} + +Any OO3ExtensionMigration::execute( const Sequence< beans::NamedValue >& ) + throw (lang::IllegalArgumentException, Exception, RuntimeException) +{ + ::osl::MutexGuard aGuard( m_aMutex ); + + ::utl::Bootstrap::PathStatus aStatus = ::utl::Bootstrap::locateUserInstallation( m_sTargetDir ); + if ( aStatus == ::utl::Bootstrap::PATH_EXISTS ) + { + // copy all extensions + ::rtl::OUString sSourceDir( m_sSourceDir ); + sSourceDir += sExtensionSubDir; + sSourceDir += sSubDirName; + sSourceDir += sExtensionRootSubDirName; + TStringVector aExtensionToMigrate; + scanUserExtensions( sSourceDir, aExtensionToMigrate ); + if ( aExtensionToMigrate.size() > 0 ) + { + TStringVector::iterator pIter = aExtensionToMigrate.begin(); + while ( pIter != aExtensionToMigrate.end() ) + { + migrateExtension( *pIter ); + ++pIter; + } + } + } + + return Any(); +} + +// ----------------------------------------------------------------------------- +// TmpRepositoryCommandEnv +// ----------------------------------------------------------------------------- + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv() +{ +} + +TmpRepositoryCommandEnv::TmpRepositoryCommandEnv( + uno::Reference< task::XInteractionHandler> const & handler) + : m_forwardHandler(handler) +{ +} + +TmpRepositoryCommandEnv::~TmpRepositoryCommandEnv() +{ +} +// XCommandEnvironment +//______________________________________________________________________________ +uno::Reference< task::XInteractionHandler > TmpRepositoryCommandEnv::getInteractionHandler() +throw ( uno::RuntimeException ) +{ + return this; +} + +//______________________________________________________________________________ +uno::Reference< ucb::XProgressHandler > TmpRepositoryCommandEnv::getProgressHandler() +throw ( uno::RuntimeException ) +{ + return this; +} + +// XInteractionHandler +void TmpRepositoryCommandEnv::handle( + uno::Reference< task::XInteractionRequest> const & xRequest ) + throw ( uno::RuntimeException ) +{ + uno::Any request( xRequest->getRequest() ); + OSL_ASSERT( request.getValueTypeClass() == uno::TypeClass_EXCEPTION ); + + bool approve = true; + bool abort = false; + + // select: + uno::Sequence< Reference< task::XInteractionContinuation > > conts( + xRequest->getContinuations() ); + Reference< task::XInteractionContinuation > const * pConts = + conts.getConstArray(); + sal_Int32 len = conts.getLength(); + for ( sal_Int32 pos = 0; pos < len; ++pos ) + { + if (approve) { + uno::Reference< task::XInteractionApprove > xInteractionApprove( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionApprove.is()) { + xInteractionApprove->select(); + // don't query again for ongoing continuations: + approve = false; + } + } + else if (abort) { + uno::Reference< task::XInteractionAbort > xInteractionAbort( + pConts[ pos ], uno::UNO_QUERY ); + if (xInteractionAbort.is()) { + xInteractionAbort->select(); + // don't query again for ongoing continuations: + abort = false; + } + } + } +} + +// XProgressHandler +void TmpRepositoryCommandEnv::push( uno::Any const & /*Status*/ ) +throw (uno::RuntimeException) +{ +} + + +void TmpRepositoryCommandEnv::update( uno::Any const & /*Status */) +throw (uno::RuntimeException) +{ +} + +void TmpRepositoryCommandEnv::pop() throw (uno::RuntimeException) +{ +} + +// ============================================================================= +// component operations +// ============================================================================= + +Reference< XInterface > SAL_CALL OO3ExtensionMigration_create( + Reference< XComponentContext > const & ctx ) + SAL_THROW( () ) +{ + return static_cast< lang::XTypeProvider * >( new OO3ExtensionMigration( + ctx) ); +} + +// ----------------------------------------------------------------------------- + +} // namespace migration diff --git a/desktop/source/migration/services/oo3extensionmigration.hxx b/desktop/source/migration/services/oo3extensionmigration.hxx new file mode 100755 index 000000000000..a001f41d92c5 --- /dev/null +++ b/desktop/source/migration/services/oo3extensionmigration.hxx @@ -0,0 +1,171 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2008 by Sun Microsystems, Inc. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * $RCSfile: 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 + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ +#define _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ + +#include "misc.hxx" +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/task/XJob.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/xml/dom/XDocumentBuilder.hpp> +#include <com/sun/star/ucb/XSimpleFileAccess.hpp> +#include <com/sun/star/deployment/XPackageManager.hpp> + +#include <osl/mutex.hxx> +#include <osl/file.hxx> +#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/compbase3.hxx> +#include <ucbhelper/content.hxx> +#include <xmlscript/xmllib_imexp.hxx> + +namespace com { namespace sun { namespace star { + namespace uno { + class XComponentContext; + } + namespace deployment { + class XPackage; + } +}}} + +class INetURLObject; + + +namespace migration +{ + + ::rtl::OUString SAL_CALL OO3ExtensionMigration_getImplementationName(); + ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL OO3ExtensionMigration_getSupportedServiceNames(); + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL OO3ExtensionMigration_create( + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > const & xContext ) + SAL_THROW( (::com::sun::star::uno::Exception) ); + + + // ============================================================================= + // class ExtensionMigration + // ============================================================================= + + typedef ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::task::XJob > ExtensionMigration_BASE; + + class OO3ExtensionMigration : public ExtensionMigration_BASE + { + private: + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_ctx; + ::com::sun::star::uno::Reference< ::com::sun::star::xml::dom::XDocumentBuilder > m_xDocBuilder; + ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XSimpleFileAccess > m_xSimpleFileAccess; + ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackageManager > m_xPackageManager; + ::osl::Mutex m_aMutex; + ::rtl::OUString m_sSourceDir; + ::rtl::OUString m_sTargetDir; + TStringVector m_aBlackList; + + enum ScanResult + { + SCANRESULT_NOTFOUND, + SCANRESULT_MIGRATE_EXTENSION, + SCANRESULT_DONTMIGRATE_EXTENSION + }; + + ::osl::FileBase::RC checkAndCreateDirectory( INetURLObject& rDirURL ); + void copyConfig( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); + bool copy( const ::rtl::OUString& sSourceDir, const ::rtl::OUString& sTargetDir ); + ScanResult scanExtensionFolder( const ::rtl::OUString& sExtFolder ); + void scanUserExtensions( const ::rtl::OUString& sSourceDir, TStringVector& aMigrateExtensions ); + bool scanDescriptionXml( const ::rtl::OUString& sDescriptionXmlFilePath ); + bool migrateExtension( const ::rtl::OUString& sSourceDir ); + /* fills m_scriptElements and m_dialogElements + */ + void registerConfigurationPackage( + const ::com::sun::star::uno::Reference< ::com::sun::star::deployment::XPackage > & xPkg); + + public: + OO3ExtensionMigration(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & ctx); + virtual ~OO3ExtensionMigration(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName() + throw (::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() + throw (::com::sun::star::uno::RuntimeException); + + // XInitialization + virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) + throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); + + // XJob + virtual ::com::sun::star::uno::Any SAL_CALL execute( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& Arguments ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::Exception, + ::com::sun::star::uno::RuntimeException); + }; + + class TmpRepositoryCommandEnv + : public ::cppu::WeakImplHelper3< ::com::sun::star::ucb::XCommandEnvironment, + ::com::sun::star::task::XInteractionHandler, + ::com::sun::star::ucb::XProgressHandler > + { + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> m_forwardHandler; + public: + virtual ~TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv(); + TmpRepositoryCommandEnv( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler> const & handler); + + // XCommandEnvironment + virtual ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionHandler > SAL_CALL + getInteractionHandler() throw ( ::com::sun::star::uno::RuntimeException ); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::ucb::XProgressHandler > + SAL_CALL getProgressHandler() throw ( ::com::sun::star::uno::RuntimeException ); + + // XInteractionHandler + virtual void SAL_CALL handle( + ::com::sun::star::uno::Reference< ::com::sun::star::task::XInteractionRequest > const & xRequest ) + throw (::com::sun::star::uno::RuntimeException); + + // XProgressHandler + virtual void SAL_CALL push( ::com::sun::star::uno::Any const & Status ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL update( ::com::sun::star::uno::Any const & Status ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL pop() throw (::com::sun::star::uno::RuntimeException); + }; + +//......................................................................... +} // namespace migration +//......................................................................... + +#endif // _DESKTOP_OO3EXTENSIONMIGRATION_HXX_ diff --git a/desktop/source/migration/services/wordbookmigration.cxx b/desktop/source/migration/services/wordbookmigration.cxx index f64e860ab654..1ac8f38dca56 100755 --- a/desktop/source/migration/services/wordbookmigration.cxx +++ b/desktop/source/migration/services/wordbookmigration.cxx @@ -2,13 +2,10 @@ * * 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: wordbookmigration.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/services/wordbookmigration.hxx b/desktop/source/migration/services/wordbookmigration.hxx index 73cebb0dc403..f4dc4c0d2628 100755 --- a/desktop/source/migration/services/wordbookmigration.hxx +++ b/desktop/source/migration/services/wordbookmigration.hxx @@ -2,13 +2,10 @@ * * 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: wordbookmigration.hxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/migration/wizard.cxx b/desktop/source/migration/wizard.cxx index c6ddd83a626b..48ee2abc71ca 100644 --- a/desktop/source/migration/wizard.cxx +++ b/desktop/source/migration/wizard.cxx @@ -2,13 +2,10 @@ * * 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: wizard.cxx,v $ - * $Revision: 1.22 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -64,11 +61,14 @@ #include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/util/XChangesBatch.hpp> #include <com/sun/star/container/XNameReplace.hpp> +#include <com/sun/star/awt/WindowDescriptor.hpp> +#include <com/sun/star/awt/WindowAttribute.hpp> using namespace svt; using namespace rtl; using namespace osl; using namespace utl; +using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; using namespace com::sun::star::beans; @@ -80,13 +80,38 @@ using namespace com::sun::star::container; namespace desktop { -const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; -const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; -const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; -const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; +const FirstStartWizard::WizardState FirstStartWizard::STATE_WELCOME = 0; +const FirstStartWizard::WizardState FirstStartWizard::STATE_LICENSE = 1; +const FirstStartWizard::WizardState FirstStartWizard::STATE_MIGRATION = 2; +const FirstStartWizard::WizardState FirstStartWizard::STATE_USER = 3; const FirstStartWizard::WizardState FirstStartWizard::STATE_UPDATE_CHECK = 4; const FirstStartWizard::WizardState FirstStartWizard::STATE_REGISTRATION = 5; +static uno::Reference< uno::XComponentContext > getComponentContext( const uno::Reference< lang::XMultiServiceFactory >& rFactory ) +{ + uno::Reference< uno::XComponentContext > rContext; + uno::Reference< beans::XPropertySet > rPropSet( rFactory, uno::UNO_QUERY ); + uno::Any a = rPropSet->getPropertyValue( + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ) ) ); + a >>= rContext; + return rContext; +} + +static sal_Int32 getBuildId() +{ + ::rtl::OUString aDefault; + ::rtl::OUString aBuildIdData = utl::Bootstrap::getBuildIdData( aDefault ); + sal_Int32 nBuildId( 0 ); + sal_Int32 nIndex1 = aBuildIdData.indexOf(':'); + sal_Int32 nIndex2 = aBuildIdData.indexOf(')'); + if (( nIndex1 > 0 ) && ( nIndex2 > 0 ) && ( nIndex2-1 > nIndex1+1 )) + { + ::rtl::OUString aBuildId = aBuildIdData.copy( nIndex1+1, nIndex2-nIndex1-1 ); + nBuildId = aBuildId.toInt32(); + } + return nBuildId; +} + WizardResId::WizardResId( USHORT nId ) : ResId( nId, *FirstStartWizard::GetResManager() ) { @@ -121,7 +146,47 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep // enableState(STATE_USER, sal_False); // enableState(STATE_REGISTRATION, sal_False); - ShowButtonFixedLine(sal_True); + try + { + Point pos(5, 210 ); + Size size(11, 11 ); + + pos = LogicToPixel( pos, MAP_APPFONT ); + size = LogicToPixel( size, MAP_APPFONT ); + + uno::Reference< lang::XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + uno::Reference< awt::XToolkit > xToolkit( + uno::Reference< lang::XMultiComponentFactory >( + xFactory, uno::UNO_QUERY_THROW)-> + createInstanceWithContext( + rtl::OUString( + RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.Toolkit")), + getComponentContext(xFactory)), + uno::UNO_QUERY_THROW); + + m_xThrobber = uno::Reference< awt::XThrobber >( + xToolkit->createWindow( + awt::WindowDescriptor( + awt::WindowClass_SIMPLE, + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Throbber")), + GetComponentInterface(), 0, + awt::Rectangle( + pos.X(), pos.Y(), size.Width(), size.Height()), + awt::WindowAttribute::SHOW)), + uno::UNO_QUERY_THROW); + } + catch (uno::RuntimeException &) + { + throw; + } + catch (Exception& ) + { + } + + uno::Reference< awt::XWindow > xThrobberWin( m_xThrobber, uno::UNO_QUERY ); + if ( xThrobberWin.is() ) + xThrobberWin->setVisible( false ); + Size aTPSize(TP_WIDTH, TP_HEIGHT); SetPageSizePixel(LogicToPixel(aTPSize, MAP_APPFONT)); @@ -154,6 +219,16 @@ FirstStartWizard::FirstStartWizard( Window* pParent, sal_Bool bLicenseNeedsAccep defaultButton(WZB_NEXT); } +void FirstStartWizard::EnableButtonsWhileMigration() +{ + enableButtons(0xff, sal_True); +} + +void FirstStartWizard::DisableButtonsWhileMigration() +{ + enableButtons(0xff, sal_False); +} + ::svt::RoadmapWizardTypes::PathId FirstStartWizard::defineWizardPagesDependingFromContext() { ::svt::RoadmapWizardTypes::PathId aDefaultPath = 0; @@ -283,7 +358,7 @@ TabPage* FirstStartWizard::createPage(WizardState _nState) pTabPage = new LicensePage(this, WizardResId(TP_LICENSE), m_aLicensePath); break; case STATE_MIGRATION: - pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION)); + pTabPage = new MigrationPage(this, WizardResId(TP_MIGRATION), m_xThrobber ); break; case STATE_USER: pTabPage = new UserPage(this, WizardResId(TP_USER)); @@ -353,6 +428,14 @@ sal_Bool FirstStartWizard::prepareLeaveCurrentState( CommitPageReason _eReason ) sal_Bool FirstStartWizard::leaveState(WizardState) { + if (( getCurrentState() == STATE_MIGRATION ) && m_bLicenseWasAccepted ) + { + // Store accept date and patch level now as it has been + // overwritten by the migration process! + storeAcceptDate(); + setPatchLevel(); + } + return sal_True; } @@ -439,6 +522,30 @@ void FirstStartWizard::storeAcceptDate() } +void FirstStartWizard::setPatchLevel() +{ + try { + Reference < XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory(); + // 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.Office.Common/Help/Registration"))); + theArgs[0] <<= v; + Reference< XPropertySet > pset = Reference< XPropertySet >( + theConfigProvider->createInstanceWithArguments(sAccessSrvc, theArgs), UNO_QUERY_THROW); + Any result = pset->getPropertyValue(OUString::createFromAscii("ReminderDate")); + + OUString aPatchLevel( RTL_CONSTASCII_USTRINGPARAM( "Patch" )); + aPatchLevel += OUString::valueOf( getBuildId(), 10 ); + pset->setPropertyValue(OUString::createFromAscii("ReminderDate"), makeAny(aPatchLevel)); + Reference< XChangesBatch >(pset, UNO_QUERY_THROW)->commitChanges(); + } catch (const Exception&) + { + } +} + #ifdef WNT typedef int ( __stdcall * CleanCurUserRegProc ) ( wchar_t* ); #endif diff --git a/desktop/source/migration/wizard.hrc b/desktop/source/migration/wizard.hrc index cdd045164123..fdad97a8174b 100644 --- a/desktop/source/migration/wizard.hrc +++ b/desktop/source/migration/wizard.hrc @@ -2,13 +2,10 @@ * * 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: wizard.hrc,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -81,6 +78,7 @@ #define ED_USER_LAST 17 #define ED_USER_FATHER 18 #define ED_USER_INITIALS 19 +#define TR_WAITING 20 // global strings #define STR_STATE_WELCOME RID_FIRSTSTSTART_START+100 diff --git a/desktop/source/migration/wizard.hxx b/desktop/source/migration/wizard.hxx index 6f67abd46a1b..e41bfe373cde 100644 --- a/desktop/source/migration/wizard.hxx +++ b/desktop/source/migration/wizard.hxx @@ -2,13 +2,10 @@ * * 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: wizard.hxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -35,6 +32,7 @@ #include <svtools/roadmapwizard.hxx> #include <vcl/window.hxx> #include <tools/resid.hxx> +#include <com/sun/star/awt/XThrobber.hpp> namespace desktop { @@ -64,6 +62,9 @@ public: virtual short Execute(); virtual long PreNotify( NotifyEvent& rNEvt ); + void EnableButtonsWhileMigration(); + void DisableButtonsWhileMigration(); + private: sal_Bool m_bOverride; WizardState _currentState; @@ -76,10 +77,12 @@ private: sal_Bool m_bLicenseWasAccepted; sal_Bool m_bAutomaticUpdChk; Link m_lnkCancel; + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XThrobber > m_xThrobber; rtl::OUString m_aLicensePath; void storeAcceptDate(); + void setPatchLevel(); void disableWizard(); void enableQuickstart(); diff --git a/desktop/source/migration/wizard.src b/desktop/source/migration/wizard.src index 634c8fe12dcb..9c1ab5496d39 100644 --- a/desktop/source/migration/wizard.src +++ b/desktop/source/migration/wizard.src @@ -2,13 +2,10 @@ * * 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: wizard.src,v $ - * $Revision: 1.20 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/offacc/acceptor.cxx b/desktop/source/offacc/acceptor.cxx index 39620534bcdf..4eee12f5949a 100644 --- a/desktop/source/offacc/acceptor.cxx +++ b/desktop/source/offacc/acceptor.cxx @@ -2,13 +2,10 @@ * * 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: acceptor.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/offacc/acceptor.hxx b/desktop/source/offacc/acceptor.hxx index 8cb3bcd9717d..1693dd8b75d0 100644 --- a/desktop/source/offacc/acceptor.hxx +++ b/desktop/source/offacc/acceptor.hxx @@ -2,13 +2,10 @@ * * 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: acceptor.hxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/offacc/exports.map b/desktop/source/offacc/exports.map deleted file mode 100644 index ba501f9ae076..000000000000 --- a/desktop/source/offacc/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/desktop/source/offacc/makefile.mk b/desktop/source/offacc/makefile.mk index e269ec44d949..c2d53930b580 100644 --- a/desktop/source/offacc/makefile.mk +++ b/desktop/source/offacc/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.9 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -51,7 +47,7 @@ SHL1OBJS= $(SLOFILES) SHL1TARGET= $(TARGET)$(DLLPOSTFIX) SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/desktop/source/pagein/file_image.h b/desktop/source/pagein/file_image.h index 54309b1b4c26..42054291b5fb 100644 --- a/desktop/source/pagein/file_image.h +++ b/desktop/source/pagein/file_image.h @@ -2,13 +2,10 @@ * * 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: file_image.h,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pagein/file_image_unx.c b/desktop/source/pagein/file_image_unx.c index 1be70d68a860..92b8f49f0e34 100644 --- a/desktop/source/pagein/file_image_unx.c +++ b/desktop/source/pagein/file_image_unx.c @@ -2,13 +2,10 @@ * * 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: file_image_unx.c,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pagein/makefile.mk b/desktop/source/pagein/makefile.mk index 626412877250..01452a858e66 100644 --- a/desktop/source/pagein/makefile.mk +++ b/desktop/source/pagein/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -123,7 +119,7 @@ $(MISC)$/$(TARGET)-common : makefile.mk @-echo $(DLLPRE)package2$(DLLPOST) >> $@ @-echo $(DLLPRE)ucpfile1$(DLLPOST) >> $@ @-echo $(DLLPRE)ucb1$(DLLPOST) >> $@ - @-echo configmgr2$(UNODLLPOST) >> $@ + @-echo $(DLLPRE)configmgr$(DLLPOST) >> $@ # @-echo $(DLLPRE)dtrans$(DLLPOST) >> $@ @-echo $(DLLPRE)vclplug_gen$(DFTDLLPOST) >> $@ diff --git a/desktop/source/pagein/pagein.c b/desktop/source/pagein/pagein.c index 8b6358dbea42..0b93eecab7cf 100644 --- a/desktop/source/pagein/pagein.c +++ b/desktop/source/pagein/pagein.c @@ -2,13 +2,10 @@ * * 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: pagein.c,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pkgchk/unopkg/makefile.mk b/desktop/source/pkgchk/unopkg/makefile.mk index 4a1f409f4564..8384f1b24372 100644 --- a/desktop/source/pkgchk/unopkg/makefile.mk +++ b/desktop/source/pkgchk/unopkg/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.17 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pkgchk/unopkg/unopkg_app.cxx b/desktop/source/pkgchk/unopkg/unopkg_app.cxx index 5fc4136a9501..2acd4f79a781 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_app.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_app.cxx @@ -2,13 +2,10 @@ * * 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: unopkg_app.cxx,v $ - * $Revision: 1.14.58.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -85,6 +82,8 @@ const char s_usingText [] = " -V, --version version information\n" " -v, --verbose verbose output to stdout\n" " -f, --force force overwriting existing extensions\n" +" -s, --suppress-license prevents showing the license provided that\n" +" the extension allows it\n" " --log-file <file> custom log file; default: <cache-dir>/log.txt\n" " --shared expert feature: operate on shared installation\n" " deployment context;\n" @@ -106,6 +105,7 @@ const OptionInfo s_option_infos [] = { { RTL_CONSTASCII_STRINGPARAM("shared"), '\0', false }, { RTL_CONSTASCII_STRINGPARAM("deployment-context"), '\0', true }, { RTL_CONSTASCII_STRINGPARAM("bundled"), '\0', false}, + { RTL_CONSTASCII_STRINGPARAM("suppress-license"), 's', false}, { 0, 0, '\0', false } }; @@ -210,6 +210,7 @@ extern "C" int unopkg_main() bool option_force = false; bool option_verbose = false; bool option_bundled = false; + bool option_suppressLicense = false; bool subcmd_add = false; bool subcmd_gui = false; OUString logFile; @@ -233,6 +234,9 @@ extern "C" int unopkg_main() s_option_infos, OUSTR("version") ); OptionInfo const * info_bundled = getOptionInfo( s_option_infos, OUSTR("bundled") ); + OptionInfo const * info_suppressLicense = getOptionInfo( + s_option_infos, OUSTR("suppress-license") ); + Reference<XComponentContext> xComponentContext; Reference<XComponentContext> xLocalComponentContext; @@ -274,6 +278,7 @@ extern "C" int unopkg_main() !readOption( &option_shared, info_shared, &nPos ) && !readOption( &option_force, info_force, &nPos ) && !readOption( &option_bundled, info_bundled, &nPos ) && + !readOption( &option_suppressLicense, info_suppressLicense, &nPos ) && !readArgument( &deploymentContext, info_context, &nPos ) && !isBootstrapVariable(&nPos)) { @@ -345,7 +350,8 @@ extern "C" int unopkg_main() Reference< ::com::sun::star::ucb::XCommandEnvironment > xCmdEnv( createCmdEnv( xComponentContext, logFile, - option_force, option_verbose, option_bundled) ); + option_force, option_verbose, option_bundled, + option_suppressLicense) ); if (subcmd_add || subCommand.equalsAsciiL( diff --git a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx index ea0659c63874..e4a503d98732 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_cmdenv.cxx @@ -2,13 +2,10 @@ * * 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: unopkg_cmdenv.cxx,v $ - * $Revision: 1.12.8.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -89,6 +86,7 @@ class CommandEnvironmentImpl bool m_option_force_overwrite; bool m_option_verbose; bool m_option_bundled; + bool m_option_suppressLicense; Reference< XComponentContext > m_xComponentContext; Reference< XProgressHandler > m_xLogFile; @@ -102,7 +100,8 @@ public: OUString const & log_file, bool option_force_overwrite, bool option_verbose, - bool option_bundled); + bool option_bundled, + bool option_suppressLicense); // XCommandEnvironment virtual Reference< task::XInteractionHandler > SAL_CALL @@ -127,11 +126,13 @@ CommandEnvironmentImpl::CommandEnvironmentImpl( OUString const & log_file, bool option_force_overwrite, bool option_verbose, - bool option_bundled) + bool option_bundled, + bool option_suppressLicense) : m_logLevel(0), m_option_force_overwrite( option_force_overwrite ), m_option_verbose( option_verbose ), m_option_bundled( option_bundled), + m_option_suppressLicense( option_suppressLicense), m_xComponentContext(xComponentContext) { if (log_file.getLength() > 0) { @@ -282,15 +283,25 @@ void CommandEnvironmentImpl::handle( } else if (request >>= licAgreementExc) { - String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) ); - sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName ); - dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n")); - abort = true; + if (m_option_suppressLicense && licAgreementExc.SuppressIfRequired) + { + approve = true; + } + else + { + String sResMsg( ResId( RID_STR_UNOPKG_NO_SHARED_ALLOWED, *DeploymentResMgr::get() ) ); + sResMsg.SearchAndReplaceAllAscii( "%NAME", licAgreementExc.ExtensionName ); + dp_misc::writeConsole(OUSTR("\n") + sResMsg + OUSTR("\n\n")); + abort = true; + } } else if (request >>= licExc) { bLicenseException = true; - printLicense(licExc.Text, approve, abort); + if (m_option_suppressLicense && licExc.SuppressIfRequired) + approve = true; + else + printLicense(licExc.Text, approve, abort); } else if (request >>= instExc) { @@ -435,10 +446,12 @@ Reference< XCommandEnvironment > createCmdEnv( OUString const & logFile, bool option_force_overwrite, bool option_verbose, - bool option_bundled) + bool option_bundled, + bool option_suppressLicense) { return new CommandEnvironmentImpl( - xContext, logFile, option_force_overwrite, option_verbose, option_bundled); + xContext, logFile, option_force_overwrite, option_verbose, option_bundled, + option_suppressLicense); } } // unopkg diff --git a/desktop/source/pkgchk/unopkg/unopkg_main.c b/desktop/source/pkgchk/unopkg/unopkg_main.c index 5b715f7aeb59..6a6cb846972d 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_main.c +++ b/desktop/source/pkgchk/unopkg/unopkg_main.c @@ -2,13 +2,10 @@ * * 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: unopkg_main.c,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pkgchk/unopkg/unopkg_main.h b/desktop/source/pkgchk/unopkg/unopkg_main.h index 78cb8ac5a3f7..08f02612a818 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_main.h +++ b/desktop/source/pkgchk/unopkg/unopkg_main.h @@ -2,13 +2,10 @@ * * 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: unopkg_main.h,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index 70b469fa58fa..b25176e1dcee 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -2,13 +2,10 @@ * * 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: unopkg_misc.cxx,v $ - * $Revision: 1.15.52.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/pkgchk/unopkg/unopkg_shared.h b/desktop/source/pkgchk/unopkg/unopkg_shared.h index 18314811f63f..6e9d30cf0d42 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_shared.h +++ b/desktop/source/pkgchk/unopkg/unopkg_shared.h @@ -2,13 +2,10 @@ * * 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: unopkg_shared.h,v $ - * $Revision: 1.9.8.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -166,7 +163,8 @@ css::uno::Reference<css::ucb::XCommandEnvironment> createCmdEnv( ::rtl::OUString const & logFile, bool option_force_overwrite, bool option_verbose, - bool option_bundled); + bool option_bundled, + bool option_suppressLicense); //============================================================================== void printf_packages( diff --git a/desktop/source/pkgchk/unopkg/version.map b/desktop/source/pkgchk/unopkg/version.map index b770ff129565..6d34cb662d2c 100644 --- a/desktop/source/pkgchk/unopkg/version.map +++ b/desktop/source/pkgchk/unopkg/version.map @@ -2,14 +2,10 @@ # # 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: version.map,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -29,7 +25,7 @@ # #************************************************************************* -unopkg.3 { +UDK_3_0_0 { global: unopkg_main; diff --git a/desktop/source/registration/com/sun/star/registration/Registration.java b/desktop/source/registration/com/sun/star/registration/Registration.java index afcb1b99660e..7fc24b80398f 100644 --- a/desktop/source/registration/com/sun/star/registration/Registration.java +++ b/desktop/source/registration/com/sun/star/registration/Registration.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/registration/makefile.mk b/desktop/source/registration/com/sun/star/registration/makefile.mk index f20eaf71adce..9784166eb91b 100644 --- a/desktop/source/registration/com/sun/star/registration/makefile.mk +++ b/desktop/source/registration/com/sun/star/registration/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java b/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java index 060ef6cb7f6d..87d83d5339ac 100644 --- a/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java +++ b/desktop/source/registration/com/sun/star/servicetag/BrowserSupport.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/Installer.java b/desktop/source/registration/com/sun/star/servicetag/Installer.java index e4daf959c19d..ba1b5c4b86d5 100644 --- a/desktop/source/registration/com/sun/star/servicetag/Installer.java +++ b/desktop/source/registration/com/sun/star/servicetag/Installer.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java index 4129e440099f..6f9cc022d223 100644 --- a/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java +++ b/desktop/source/registration/com/sun/star/servicetag/LinuxSystemEnvironment.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java index c58d83a33dd8..66eb1933210a 100644 --- a/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java +++ b/desktop/source/registration/com/sun/star/servicetag/RegistrationData.java @@ -1,531 +1,531 @@ -
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.UnknownHostException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import static com.sun.star.servicetag.RegistrationDocument.*;
-
-/**
- * A {@code RegistrationData} object is a container of one or more
- * {@link #getServiceTags service tags} that identify the
- * components for product registration.
- * Each {@code RegistrationData} object has a {@link #getRegistrationURN
- * uniform resource name} (URN) as its identifier.
- * <a name="EnvMap"></a>
- * It also has an <i>environment map</i> with
- * the following elements:
- * <blockquote>
- * <table border=0>
- * <tr>
- * <td><tt>hostname</tt></td>
- * <td>Hostname of the system</td>
- * <td>e.g. woody</td>
- * </tr>
- * <tr>
- * <td><tt>hostId</tt></td>
- * <td>Host ID of the system</td>
- * <td>e.g. 83abc1ab</td>
- * </tr>
- * <tr>
- * <td><tt>osName</tt></td>
- * <td>Operating system name</td>
- * <td> e.g. SunOS</td>
- * </tr>
- * <tr>
- * <td><tt>osVersion</tt></td>
- * <td>Operating system version</td>
- * <td> e.g. 5.10</td>
- * </tr>
- * <tr>
- * <td><tt>osArchitecture</tt></td>
- * <td>Operating system architecture</td>
- * <td> e.g. sparc</td>
- * </tr>
- * <tr>
- * <td><tt>systemModel</tt></td>
- * <td>System model</td>
- * <td> e.g. SUNW,Sun-Fire-V440</td>
- * </tr>
- * <tr>
- * <td><tt>systemManufacturer</tt></td>
- * <td>System manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>cpuManufacturer</tt></td>
- * <td>CPU manufacturer</td>
- * <td> e.g. Sun Microsystems</td>
- * </tr>
- * <tr>
- * <td><tt>serialNumber</tt></td>
- * <td>System serial number</td>
- * <td> e.g. BEL078932</td>
- * </tr>
- * <tr>
- * <td><tt>physmem</tt></td>
- * <td>Physical memory for the system (in MB)</td>
- * <td> e.g. 4096</td>
- * </tr>
- * </table>
- * </blockquote>
- * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value.
- * If an element is not available on a system and their value will be
- * empty.
- * <p>
- * <a name="XMLSchema">
- * <b>Registration XML Schema</b></a>
- * <p>
- * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from
- * and {@link #storeToXML stored} into an XML file in the format described
- * by the
- * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd">
- * registration data schema</a>. The registration data schema is defined by the
- * Service Tags Technology.
- * <p>
- * Typically the registration data is constructed at installation time
- * and stored in an XML file for later service tag lookup or registration.
- *
- * <p>
- * <b>Example Usage</b>
- * <p>
- * The examples below show how the {@code RegistrationData} can be
- * used for product registration.
- * Exception handling is not shown in these examples for clarity.
- * <ol>
- * <li>This example shows how the JDK creates a JDK service tag, installs it
- * in the system service tag registry and adds it to the registration data.
- * <br>
- * <blockquote><pre>
- * // create a service tag object with an instance_urn
- * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(),
- * ....);
- * // Adds to the system service tag registry if supported
- * if (Registry.isSupported()) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- *
- * // add to the registration data
- * RegistrationData registration = new RegistrationData();
- * registration.addServiceTag(st);
- * </pre></blockquote>
- * </li>
- * <li>At this point, the registration data is ready to
- * send to Sun Connection for registration. This example shows how to register
- * the JDK via the <i>Registration Relay Service</i>.
- * <p>
- * There are several registration services for Sun Connection. For example,
- * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService">
- * Registration Relay Service</a> is a web application interface that
- * processes the registration data payload sent via HTTP post
- * and hosts the registration user interface for a specified
- * registration URL. Refer to the
- * Registration Relay Service Specification for details.
- * <p>
- * <blockquote><pre>
- * // Open the connection to the URL of the registration service
- * HttpsURLConnection con = (HttpsURLConnection) url.openConnection();
- * con.setDoInput(true);
- * con.setDoOutput(true);
- * con.setUseCaches(false);
- * con.setAllowUserInteraction(false);
- * con.setRequestMethod("POST");
- * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\"");
- * con.connect();
- *
- * // send the registration data to the registration service
- * OutputStream out = con.getOutputStream();
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to store the registration data in an XML file.
- * for later service tag lookup or registration.
- * <br>
- * <blockquote><pre>
- * BufferedOutputStream out = new BufferedOutputStream(
- * new FileOutputStream(""<JAVA_HOME>/lib/servicetag/registration.xml"));
- * registration.storeToXML(out);
- * out.close();
- * </pre></blockquote>
- * </li>
- * <li>This example shows how to install service tags that are in the
- * registration data in the system service tag registry when determined
- * to be available. The system service tag registry might not have existed
- * when the registration data was constructed.
- * <br>
- * <blockquote><pre>
- * if (Registry.isSupported()) {
- * Set<ServiceTag> svctags = registration.getServiceTags();
- * for (ServiceTag st : svctags) {
- * Registry.getSystemRegistry().addServiceTag(st);
- * }
- * }
- * </pre></blockquote>
- * </li>
- * </ol>
- *
- * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a>
- */
-public class RegistrationData {
- private final Map<String, String> environment;
- private final Map<String, String> cpuInfo;
- private final Map<String, ServiceTag> svcTagMap;
- private final String urn;
-
- /**
- * Creates a {@code RegistrationData} object with a generated
- * {@link #getRegistrationURN registration URN}.
- * The following keys in the {@link #getEnvironmentMap environment map}
- * will be initialized for the configuration of the
- * running system:
- * <blockquote>
- * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and
- * <tt>osArchitecture</tt>
- * </blockquote>
- * and the value of other keys may be empty.
- */
- public RegistrationData() {
- this(Util.generateURN());
- }
-
- // package private
- RegistrationData(String urn) {
- this.urn = urn;
- SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment();
- this.environment = initEnvironment(sysEnv);
- this.cpuInfo = initCpuInfo(sysEnv);
- this.svcTagMap = new LinkedHashMap<String, ServiceTag>();
- }
-
- private Map<String, String> initEnvironment(SystemEnvironment sysEnv) {
- Map<String, String> map = new LinkedHashMap<String, String>();
- map.put(ST_NODE_HOSTNAME, sysEnv.getHostname());
- map.put(ST_NODE_HOST_ID, sysEnv.getHostId());
- map.put(ST_NODE_OS_NAME, sysEnv.getOsName());
- map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion());
- map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture());
- map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel());
- map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer());
- map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer());
- map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber());
- map.put(ST_NODE_PHYS_MEM, sysEnv.getPhysMem());
- return map;
- }
-
- private Map<String, String> initCpuInfo(SystemEnvironment sysEnv) {
- Map<String, String> map = new LinkedHashMap<String, String>();
- map.put(ST_NODE_SOCKETS, sysEnv.getSockets());
- map.put(ST_NODE_CORES, sysEnv.getCores());
- map.put(ST_NODE_VIRT_CPUS, sysEnv.getVirtCpus());
- map.put(ST_NODE_CPU_NAME, sysEnv.getCpuName());
- map.put(ST_NODE_CLOCK_RATE, sysEnv.getClockRate());
- return map;
- }
-
- /**
- * Returns the uniform resource name of this registration data
- * in this format:
- * <tt>urn:st:<32-char {@link java.util.UUID uuid}></tt>
- *
- * @return the URN of this registration data.
- */
- public String getRegistrationURN() {
- return urn;
- }
-
- /**
- * Returns a map containing the environment information for this
- * registration data. See the set of <a href="#EnvMap">keys</a>
- * in the environment map. Subsequent update to the environment
- * map via the {@link #setEnvironment setEnvironment} method will not be reflected
- * in the returned map.
- *
- * @return an environment map for this registration data.
- */
- public Map<String, String> getEnvironmentMap() {
- return new LinkedHashMap<String,String>(environment);
- }
-
- /**
- * Returns a map containing the cpu information for this
- * registration data. Subsequent update to the cpu info
- * map via the {@link #setCpuInfo setCpuInfo} method will not be reflected
- * in the returned map.
- *
- * @return a cpu info map for this registration data.
- */
- public Map<String, String> getCpuInfoMap() {
- return new LinkedHashMap<String,String>(cpuInfo);
- }
-
- /**
- * Sets an element of the specified {@code name} in the environment map
- * with the given {@code value}.
- *
- * @throws IllegalArgumentException if {@code name} is not a valid key
- * in the environment map, or {@code value} is not valid.
- */
- public void setEnvironment(String name, String value) {
- if (name == null) {
- throw new NullPointerException("name is null");
- }
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- if (environment.containsKey(name)) {
- if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) {
- if (value.length() == 0) {
- throw new IllegalArgumentException("\"" +
- name + "\" requires non-empty value.");
- }
- }
- environment.put(name, value);
- } else {
- throw new IllegalArgumentException("\"" +
- name + "\" is not an environment element.");
- }
- }
-
- /**
- * Sets an element of the specified {@code name} in the cpu info map
- * with the given {@code value}.
- *
- * @throws IllegalArgumentException if {@code name} is not a valid key
- * in the cpu info map, or {@code value} is not valid.
- */
- public void setCpuInfo(String name, String value) {
- if (name == null) {
- throw new NullPointerException("name is null");
- }
- if (value == null) {
- throw new NullPointerException("value is null");
- }
- if (cpuInfo.containsKey(name)) {
- cpuInfo.put(name, value);
- } else {
- throw new IllegalArgumentException("\"" +
- name + "\" is not an cpuinfo element.");
- }
- }
-
- /**
- * Returns all service tags in this registration data.
- *
- * @return a {@link Set Set} of the service tags
- * in this registration data.
- */
- public Set<ServiceTag> getServiceTags() {
- return new HashSet<ServiceTag>(svcTagMap.values());
- }
-
- /**
- * Adds a service tag to this registration data.
- * If the given service tag has an empty <tt>instance_urn</tt>,
- * this method will generate a URN and place it in the copy
- * of the service tag in this registration data.
- * This method will return the {@code ServiceTag} object
- * added to this registration data.
- *
- * @param st {@code ServiceTag} object to be added.
- * @return a {@code ServiceTag} object added to this registration data.
- *
- * @throws IllegalArgumentException if
- * a service tag of the same {@link ServiceTag#getInstanceURN
- * <tt>instance_urn</tt>} already exists in the registry.
- */
- public synchronized ServiceTag addServiceTag(ServiceTag st) {
- ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st);
-
- String instanceURN = svcTag.getInstanceURN();
- if (svcTagMap.containsKey(instanceURN)) {
- throw new IllegalArgumentException("Instance_urn = " + instanceURN +
- " already exists in the registration data.");
- } else {
- svcTagMap.put(instanceURN, svcTag);
- }
- return svcTag;
- }
-
- /**
- * Returns a service tag of the given <tt>instance_urn</tt> in this registration
- * data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag
- * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt>
- * if exists; otherwise return {@code null}.
- */
- public synchronized ServiceTag getServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
- return svcTagMap.get(instanceURN);
- }
-
- /**
- * Removes a service tag of the given <tt>instance_urn</tt> from this
- * registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of
- * the service tag to be removed.
- *
- * @return the removed {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag removeServiceTag(String instanceURN) {
- if (instanceURN == null) {
- throw new NullPointerException("instanceURN is null");
- }
-
- ServiceTag svcTag = null;
- if (svcTagMap.containsKey(instanceURN)) {
- svcTag = svcTagMap.remove(instanceURN);
- }
- return svcTag;
- }
-
- /**
- * Updates the <tt>product_defined_instance_id</tt> in the service tag
- * of the given <tt>instance_urn</tt> in this registration data.
- *
- * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated.
- * @param productDefinedInstanceID the value of the
- * <tt>product_defined_instance_id</tt> to be set.
- *
- * @return the updated {@code ServiceTag} object;
- * or {@code null} if the service tag does not exist in this
- * registration data.
- */
- public synchronized ServiceTag updateServiceTag(String instanceURN,
- String productDefinedInstanceID) {
- ServiceTag svcTag = getServiceTag(instanceURN);
- if (svcTag == null) {
- return null;
- }
-
- svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag);
- // update the product defined instance ID field
- svcTag.setProductDefinedInstanceID(productDefinedInstanceID);
- svcTagMap.put(instanceURN, svcTag);
- return svcTag;
- }
-
- /**
- * Reads the registration data from the XML document on the
- * specified input stream. The XML document must be
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a>.
- * The specified stream is closed after this method returns.
- *
- * @param in the input stream from which to read the XML document.
- * @return a {@code RegistrationData} object read from the input
- * stream.
- *
- * @throws IllegalArgumentException if the input stream
- * contains an invalid registration data.
- *
- * @throws IOException if an error occurred when reading from the input stream.
- */
- public static RegistrationData loadFromXML(InputStream in) throws IOException {
- try {
- return RegistrationDocument.load(in);
- } finally {
- in.close();
- }
- }
-
- /**
- * Writes the registration data to the specified output stream
- * in the format described by the <a href="#XMLSchema">
- * registration data schema</a> with "UTF-8" encoding.
- * The specified stream remains open after this method returns.
- *
- * @param os the output stream on which to write the XML document.
- *
- * @throws IOException if an error occurred when writing to the output stream.
- */
- public void storeToXML(OutputStream os) throws IOException {
- RegistrationDocument.store(os, this);
- os.flush();
- }
-
- /**
- * Returns a newly allocated byte array containing the registration
- * data in XML format.
- *
- * @return a newly allocated byte array containing the registration
- * data in XML format.
- */
- public byte[] toXML() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toByteArray();
- } catch (IOException e) {
- // should not reach here
- return new byte[0];
- }
- }
-
- /**
- * Returns a string representation of this registration data in XML
- * format.
- *
- * @return a string representation of this registration data in XML
- * format.
- */
- @Override
- public String toString() {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- storeToXML(out);
- return out.toString("UTF-8");
- } catch (IOException e) {
- // should not reach here
- return "Error creating the return string.";
- }
- }
-}
+ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can obtain + * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html + * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. + * Sun designates this particular file as subject to the "Classpath" exception + * as provided by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the License + * Header, with the fields enclosed by brackets [] replaced by your own + * identifying information: "Portions Copyrighted [year] + * [name of copyright owner]" + * + * Contributor(s): + * + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ + +package com.sun.star.servicetag; + +import java.io.*; +import java.net.UnknownHostException; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Set; + +import static com.sun.star.servicetag.RegistrationDocument.*; + +/** + * A {@code RegistrationData} object is a container of one or more + * {@link #getServiceTags service tags} that identify the + * components for product registration. + * Each {@code RegistrationData} object has a {@link #getRegistrationURN + * uniform resource name} (URN) as its identifier. + * <a name="EnvMap"></a> + * It also has an <i>environment map</i> with + * the following elements: + * <blockquote> + * <table border=0> + * <tr> + * <td><tt>hostname</tt></td> + * <td>Hostname of the system</td> + * <td>e.g. woody</td> + * </tr> + * <tr> + * <td><tt>hostId</tt></td> + * <td>Host ID of the system</td> + * <td>e.g. 83abc1ab</td> + * </tr> + * <tr> + * <td><tt>osName</tt></td> + * <td>Operating system name</td> + * <td> e.g. SunOS</td> + * </tr> + * <tr> + * <td><tt>osVersion</tt></td> + * <td>Operating system version</td> + * <td> e.g. 5.10</td> + * </tr> + * <tr> + * <td><tt>osArchitecture</tt></td> + * <td>Operating system architecture</td> + * <td> e.g. sparc</td> + * </tr> + * <tr> + * <td><tt>systemModel</tt></td> + * <td>System model</td> + * <td> e.g. SUNW,Sun-Fire-V440</td> + * </tr> + * <tr> + * <td><tt>systemManufacturer</tt></td> + * <td>System manufacturer</td> + * <td> e.g. Sun Microsystems</td> + * </tr> + * <tr> + * <td><tt>cpuManufacturer</tt></td> + * <td>CPU manufacturer</td> + * <td> e.g. Sun Microsystems</td> + * </tr> + * <tr> + * <td><tt>serialNumber</tt></td> + * <td>System serial number</td> + * <td> e.g. BEL078932</td> + * </tr> + * <tr> + * <td><tt>physmem</tt></td> + * <td>Physical memory for the system (in MB)</td> + * <td> e.g. 4096</td> + * </tr> + * </table> + * </blockquote> + * The <tt>hostname</tt> and <tt>osName</tt> element must have a non-empty value. + * If an element is not available on a system and their value will be + * empty. + * <p> + * <a name="XMLSchema"> + * <b>Registration XML Schema</b></a> + * <p> + * A {@code RegistrationData} object can be {@link #loadFromXML loaded} from + * and {@link #storeToXML stored} into an XML file in the format described + * by the + * <a href="https://sn-tools.central.sun.com/twiki/pub/ServiceTags/RegistrationRelayService/product_registration.xsd"> + * registration data schema</a>. The registration data schema is defined by the + * Service Tags Technology. + * <p> + * Typically the registration data is constructed at installation time + * and stored in an XML file for later service tag lookup or registration. + * + * <p> + * <b>Example Usage</b> + * <p> + * The examples below show how the {@code RegistrationData} can be + * used for product registration. + * Exception handling is not shown in these examples for clarity. + * <ol> + * <li>This example shows how the JDK creates a JDK service tag, installs it + * in the system service tag registry and adds it to the registration data. + * <br> + * <blockquote><pre> + * // create a service tag object with an instance_urn + * ServiceTag st = ServiceTag.newInstance(ServiceTag.generateInstanceURN(), + * ....); + * // Adds to the system service tag registry if supported + * if (Registry.isSupported()) { + * Registry.getSystemRegistry().addServiceTag(st); + * } + * + * // add to the registration data + * RegistrationData registration = new RegistrationData(); + * registration.addServiceTag(st); + * </pre></blockquote> + * </li> + * <li>At this point, the registration data is ready to + * send to Sun Connection for registration. This example shows how to register + * the JDK via the <i>Registration Relay Service</i>. + * <p> + * There are several registration services for Sun Connection. For example, + * the <a href="https://sn-tools.central.sun.com/twiki/bin/view/ServiceTags/RegistrationRelayService"> + * Registration Relay Service</a> is a web application interface that + * processes the registration data payload sent via HTTP post + * and hosts the registration user interface for a specified + * registration URL. Refer to the + * Registration Relay Service Specification for details. + * <p> + * <blockquote><pre> + * // Open the connection to the URL of the registration service + * HttpsURLConnection con = (HttpsURLConnection) url.openConnection(); + * con.setDoInput(true); + * con.setDoOutput(true); + * con.setUseCaches(false); + * con.setAllowUserInteraction(false); + * con.setRequestMethod("POST"); + * con.setRequestProperty("Content-Type", "text/xml;charset=\"utf-8\""); + * con.connect(); + * + * // send the registration data to the registration service + * OutputStream out = con.getOutputStream(); + * registration.storeToXML(out); + * out.close(); + * </pre></blockquote> + * </li> + * <li>This example shows how to store the registration data in an XML file. + * for later service tag lookup or registration. + * <br> + * <blockquote><pre> + * BufferedOutputStream out = new BufferedOutputStream( + * new FileOutputStream(""<JAVA_HOME>/lib/servicetag/registration.xml")); + * registration.storeToXML(out); + * out.close(); + * </pre></blockquote> + * </li> + * <li>This example shows how to install service tags that are in the + * registration data in the system service tag registry when determined + * to be available. The system service tag registry might not have existed + * when the registration data was constructed. + * <br> + * <blockquote><pre> + * if (Registry.isSupported()) { + * Set<ServiceTag> svctags = registration.getServiceTags(); + * for (ServiceTag st : svctags) { + * Registry.getSystemRegistry().addServiceTag(st); + * } + * } + * </pre></blockquote> + * </li> + * </ol> + * + * @see <a href="https://sunconnection.sun.com/inventory">Sun Connection Inventory Channel</a> + */ +public class RegistrationData { + private final Map<String, String> environment; + private final Map<String, String> cpuInfo; + private final Map<String, ServiceTag> svcTagMap; + private final String urn; + + /** + * Creates a {@code RegistrationData} object with a generated + * {@link #getRegistrationURN registration URN}. + * The following keys in the {@link #getEnvironmentMap environment map} + * will be initialized for the configuration of the + * running system: + * <blockquote> + * <tt>hostname</tt>, <tt>osName</tt>, <tt>osVersion</tt> and + * <tt>osArchitecture</tt> + * </blockquote> + * and the value of other keys may be empty. + */ + public RegistrationData() { + this(Util.generateURN()); + } + + // package private + RegistrationData(String urn) { + this.urn = urn; + SystemEnvironment sysEnv = SystemEnvironment.getSystemEnvironment(); + this.environment = initEnvironment(sysEnv); + this.cpuInfo = initCpuInfo(sysEnv); + this.svcTagMap = new LinkedHashMap<String, ServiceTag>(); + } + + private Map<String, String> initEnvironment(SystemEnvironment sysEnv) { + Map<String, String> map = new LinkedHashMap<String, String>(); + map.put(ST_NODE_HOSTNAME, sysEnv.getHostname()); + map.put(ST_NODE_HOST_ID, sysEnv.getHostId()); + map.put(ST_NODE_OS_NAME, sysEnv.getOsName()); + map.put(ST_NODE_OS_VERSION, sysEnv.getOsVersion()); + map.put(ST_NODE_OS_ARCH, sysEnv.getOsArchitecture()); + map.put(ST_NODE_SYSTEM_MODEL, sysEnv.getSystemModel()); + map.put(ST_NODE_SYSTEM_MANUFACTURER, sysEnv.getSystemManufacturer()); + map.put(ST_NODE_CPU_MANUFACTURER, sysEnv.getCpuManufacturer()); + map.put(ST_NODE_SERIAL_NUMBER, sysEnv.getSerialNumber()); + map.put(ST_NODE_PHYS_MEM, sysEnv.getPhysMem()); + return map; + } + + private Map<String, String> initCpuInfo(SystemEnvironment sysEnv) { + Map<String, String> map = new LinkedHashMap<String, String>(); + map.put(ST_NODE_SOCKETS, sysEnv.getSockets()); + map.put(ST_NODE_CORES, sysEnv.getCores()); + map.put(ST_NODE_VIRT_CPUS, sysEnv.getVirtCpus()); + map.put(ST_NODE_CPU_NAME, sysEnv.getCpuName()); + map.put(ST_NODE_CLOCK_RATE, sysEnv.getClockRate()); + return map; + } + + /** + * Returns the uniform resource name of this registration data + * in this format: + * <tt>urn:st:<32-char {@link java.util.UUID uuid}></tt> + * + * @return the URN of this registration data. + */ + public String getRegistrationURN() { + return urn; + } + + /** + * Returns a map containing the environment information for this + * registration data. See the set of <a href="#EnvMap">keys</a> + * in the environment map. Subsequent update to the environment + * map via the {@link #setEnvironment setEnvironment} method will not be reflected + * in the returned map. + * + * @return an environment map for this registration data. + */ + public Map<String, String> getEnvironmentMap() { + return new LinkedHashMap<String,String>(environment); + } + + /** + * Returns a map containing the cpu information for this + * registration data. Subsequent update to the cpu info + * map via the {@link #setCpuInfo setCpuInfo} method will not be reflected + * in the returned map. + * + * @return a cpu info map for this registration data. + */ + public Map<String, String> getCpuInfoMap() { + return new LinkedHashMap<String,String>(cpuInfo); + } + + /** + * Sets an element of the specified {@code name} in the environment map + * with the given {@code value}. + * + * @throws IllegalArgumentException if {@code name} is not a valid key + * in the environment map, or {@code value} is not valid. + */ + public void setEnvironment(String name, String value) { + if (name == null) { + throw new NullPointerException("name is null"); + } + if (value == null) { + throw new NullPointerException("value is null"); + } + if (environment.containsKey(name)) { + if (name.equals(ST_NODE_HOSTNAME) || name.equals(ST_NODE_OS_NAME)) { + if (value.length() == 0) { + throw new IllegalArgumentException("\"" + + name + "\" requires non-empty value."); + } + } + environment.put(name, value); + } else { + throw new IllegalArgumentException("\"" + + name + "\" is not an environment element."); + } + } + + /** + * Sets an element of the specified {@code name} in the cpu info map + * with the given {@code value}. + * + * @throws IllegalArgumentException if {@code name} is not a valid key + * in the cpu info map, or {@code value} is not valid. + */ + public void setCpuInfo(String name, String value) { + if (name == null) { + throw new NullPointerException("name is null"); + } + if (value == null) { + throw new NullPointerException("value is null"); + } + if (cpuInfo.containsKey(name)) { + cpuInfo.put(name, value); + } else { + throw new IllegalArgumentException("\"" + + name + "\" is not an cpuinfo element."); + } + } + + /** + * Returns all service tags in this registration data. + * + * @return a {@link Set Set} of the service tags + * in this registration data. + */ + public Set<ServiceTag> getServiceTags() { + return new HashSet<ServiceTag>(svcTagMap.values()); + } + + /** + * Adds a service tag to this registration data. + * If the given service tag has an empty <tt>instance_urn</tt>, + * this method will generate a URN and place it in the copy + * of the service tag in this registration data. + * This method will return the {@code ServiceTag} object + * added to this registration data. + * + * @param st {@code ServiceTag} object to be added. + * @return a {@code ServiceTag} object added to this registration data. + * + * @throws IllegalArgumentException if + * a service tag of the same {@link ServiceTag#getInstanceURN + * <tt>instance_urn</tt>} already exists in the registry. + */ + public synchronized ServiceTag addServiceTag(ServiceTag st) { + ServiceTag svcTag = ServiceTag.newInstanceWithUrnTimestamp(st); + + String instanceURN = svcTag.getInstanceURN(); + if (svcTagMap.containsKey(instanceURN)) { + throw new IllegalArgumentException("Instance_urn = " + instanceURN + + " already exists in the registration data."); + } else { + svcTagMap.put(instanceURN, svcTag); + } + return svcTag; + } + + /** + * Returns a service tag of the given <tt>instance_urn</tt> in this registration + * data. + * + * @param instanceURN the <tt>instance_urn</tt> of the service tag + * @return the {@code ServiceTag} object of the given <tt>instance_urn</tt> + * if exists; otherwise return {@code null}. + */ + public synchronized ServiceTag getServiceTag(String instanceURN) { + if (instanceURN == null) { + throw new NullPointerException("instanceURN is null"); + } + return svcTagMap.get(instanceURN); + } + + /** + * Removes a service tag of the given <tt>instance_urn</tt> from this + * registration data. + * + * @param instanceURN the <tt>instance_urn</tt> of + * the service tag to be removed. + * + * @return the removed {@code ServiceTag} object; + * or {@code null} if the service tag does not exist in this + * registration data. + */ + public synchronized ServiceTag removeServiceTag(String instanceURN) { + if (instanceURN == null) { + throw new NullPointerException("instanceURN is null"); + } + + ServiceTag svcTag = null; + if (svcTagMap.containsKey(instanceURN)) { + svcTag = svcTagMap.remove(instanceURN); + } + return svcTag; + } + + /** + * Updates the <tt>product_defined_instance_id</tt> in the service tag + * of the given <tt>instance_urn</tt> in this registration data. + * + * @param instanceURN the <tt>instance_urn</tt> of the service tag to be updated. + * @param productDefinedInstanceID the value of the + * <tt>product_defined_instance_id</tt> to be set. + * + * @return the updated {@code ServiceTag} object; + * or {@code null} if the service tag does not exist in this + * registration data. + */ + public synchronized ServiceTag updateServiceTag(String instanceURN, + String productDefinedInstanceID) { + ServiceTag svcTag = getServiceTag(instanceURN); + if (svcTag == null) { + return null; + } + + svcTag = ServiceTag.newInstanceWithUrnTimestamp(svcTag); + // update the product defined instance ID field + svcTag.setProductDefinedInstanceID(productDefinedInstanceID); + svcTagMap.put(instanceURN, svcTag); + return svcTag; + } + + /** + * Reads the registration data from the XML document on the + * specified input stream. The XML document must be + * in the format described by the <a href="#XMLSchema"> + * registration data schema</a>. + * The specified stream is closed after this method returns. + * + * @param in the input stream from which to read the XML document. + * @return a {@code RegistrationData} object read from the input + * stream. + * + * @throws IllegalArgumentException if the input stream + * contains an invalid registration data. + * + * @throws IOException if an error occurred when reading from the input stream. + */ + public static RegistrationData loadFromXML(InputStream in) throws IOException { + try { + return RegistrationDocument.load(in); + } finally { + in.close(); + } + } + + /** + * Writes the registration data to the specified output stream + * in the format described by the <a href="#XMLSchema"> + * registration data schema</a> with "UTF-8" encoding. + * The specified stream remains open after this method returns. + * + * @param os the output stream on which to write the XML document. + * + * @throws IOException if an error occurred when writing to the output stream. + */ + public void storeToXML(OutputStream os) throws IOException { + RegistrationDocument.store(os, this); + os.flush(); + } + + /** + * Returns a newly allocated byte array containing the registration + * data in XML format. + * + * @return a newly allocated byte array containing the registration + * data in XML format. + */ + public byte[] toXML() { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + storeToXML(out); + return out.toByteArray(); + } catch (IOException e) { + // should not reach here + return new byte[0]; + } + } + + /** + * Returns a string representation of this registration data in XML + * format. + * + * @return a string representation of this registration data in XML + * format. + */ + @Override + public String toString() { + try { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + storeToXML(out); + return out.toString("UTF-8"); + } catch (IOException e) { + // should not reach here + return "Error creating the return string."; + } + } +} diff --git a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java b/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java index 93a1f25a6c2f..fb13b581c0ce 100644 --- a/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java +++ b/desktop/source/registration/com/sun/star/servicetag/RegistrationDocument.java @@ -1,440 +1,440 @@ -
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-
-package com.sun.star.servicetag;
-
-import java.io.*;
-import java.net.URL;
-import java.util.Collection;
-import java.util.Map;
-import java.util.Set;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.validation.Schema;
-import javax.xml.validation.SchemaFactory;
-import javax.xml.validation.Validator;
-
-// For write operation
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-/**
- * XML Support Class for Product Registration.
- */
-class RegistrationDocument {
-
- private static final String REGISTRATION_DATA_SCHEMA =
- "/com/sun/star/servicetag/resources/product_registration.xsd";
- private static final String REGISTRATION_DATA_VERSION = "1.0";
- private static final String SERVICE_TAG_VERSION = "1.0";
- final static String ST_NODE_REGISTRATION_DATA = "registration_data";
- final static String ST_ATTR_REGISTRATION_VERSION = "version";
- final static String ST_NODE_ENVIRONMENT = "environment";
- final static String ST_NODE_HOSTNAME = "hostname";
- final static String ST_NODE_HOST_ID = "hostId";
- final static String ST_NODE_OS_NAME = "osName";
- final static String ST_NODE_OS_VERSION = "osVersion";
- final static String ST_NODE_OS_ARCH = "osArchitecture";
- final static String ST_NODE_SYSTEM_MODEL = "systemModel";
- final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer";
- final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer";
- final static String ST_NODE_SERIAL_NUMBER = "serialNumber";
- final static String ST_NODE_PHYS_MEM = "physmem";
- final static String ST_NODE_CPU_INFO = "cpuinfo";
- final static String ST_NODE_SOCKETS = "sockets";
- final static String ST_NODE_CORES = "cores";
- final static String ST_NODE_VIRT_CPUS = "virtcpus";
- final static String ST_NODE_CPU_NAME = "name";
- final static String ST_NODE_CLOCK_RATE = "clockrate";
- final static String ST_NODE_REGISTRY = "registry";
- final static String ST_ATTR_REGISTRY_URN = "urn";
- final static String ST_ATTR_REGISTRY_VERSION = "version";
- final static String ST_NODE_SERVICE_TAG = "service_tag";
- final static String ST_NODE_INSTANCE_URN = "instance_urn";
- final static String ST_NODE_PRODUCT_NAME = "product_name";
- final static String ST_NODE_PRODUCT_VERSION = "product_version";
- final static String ST_NODE_PRODUCT_URN = "product_urn";
- final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn";
- final static String ST_NODE_PRODUCT_PARENT = "product_parent";
- final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id";
- final static String ST_NODE_PRODUCT_VENDOR = "product_vendor";
- final static String ST_NODE_PLATFORM_ARCH = "platform_arch";
- final static String ST_NODE_TIMESTAMP = "timestamp";
- final static String ST_NODE_CONTAINER = "container";
- final static String ST_NODE_SOURCE = "source";
- final static String ST_NODE_INSTALLER_UID = "installer_uid";
-
- static RegistrationData load(InputStream in) throws IOException {
- Document document = initializeDocument(in);
-
- // Gets the registration URN
- Element root = getRegistrationDataRoot(document);
- Element registryRoot =
- getSingletonElementFromRoot(root, ST_NODE_REGISTRY);
- String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN);
-
- // Construct a new RegistrationData object from the DOM tree
- // Initialize the environment map and service tags
- RegistrationData regData = new RegistrationData(urn);
- addServiceTags(registryRoot, regData);
-
- Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT);
- buildEnvironmentMap(envRoot, regData);
-
- Element cpuInfo = getSingletonElementFromRoot(envRoot, ST_NODE_CPU_INFO);
- buildCpuInfoMap(cpuInfo, regData);
- return regData;
- }
-
- static void store(OutputStream os, RegistrationData registration)
- throws IOException {
- // create a new document with the root node
- Document document = initializeDocument();
-
- // create the nodes for the environment map and the service tags
- // in the registration data
- addEnvironmentNodes(document,
- registration.getEnvironmentMap(),
- registration.getCpuInfoMap());
- addServiceTagRegistry(document,
- registration.getRegistrationURN(),
- registration.getServiceTags());
- transform(document, os);
- }
-
- // initialize a document from an input stream
- private static Document initializeDocument(InputStream in) throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- SchemaFactory sf = null;
- try {
- // Some Java versions (e.g., 1.5.0_06-b05) fail with a
- // NullPointerException if SchemaFactory.newInstance is called with
- // a null context class loader, so work around that here (and the
- // class loader of this class hopefully is not the null bootstrap
- // class loader):
- ClassLoader cl = Thread.currentThread().getContextClassLoader();
- if (cl == null) {
- Thread.currentThread().setContextClassLoader(
- RegistrationDocument.class.getClassLoader());
- }
- try {
- sf = SchemaFactory.newInstance(
- XMLConstants.W3C_XML_SCHEMA_NS_URI);
- } finally {
- Thread.currentThread().setContextClassLoader(cl);
- }
-
- Schema schema = null;
- try {
- // Even using the workaround above is not enough on some
- // Java versions. Therefore try to workaround the validation
- // completely!
- URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA);
- schema = sf.newSchema(xsdUrl);
- }
- catch (NullPointerException nex) {
- }
-
- Validator validator = null;
- if (schema != null)
- validator = schema.newValidator();
-
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.parse(new InputSource(in));
-
- if (validator != null)
- validator.validate(new DOMSource(doc));
-
- return doc;
- } catch (SAXException sxe) {
- IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing");
- e.initCause(sxe);
- throw e;
- } catch (ParserConfigurationException pce) {
- // Parser with specific options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // initialize a new document for the registration data
- private static Document initializeDocument() throws IOException {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- DocumentBuilder builder = factory.newDocumentBuilder();
- Document doc = builder.newDocument();
-
- // initialize the document with the registration_data root
- Element root = doc.createElement(ST_NODE_REGISTRATION_DATA);
- doc.appendChild(root);
- root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION);
-
- return doc;
- } catch (ParserConfigurationException pce) {
- // Parser with specified options can't be built
- // should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(pce);
- throw x;
- }
- }
-
- // Transform the current DOM tree with the given output stream.
- private static void transform(Document document, OutputStream os) {
- try {
- // Use a Transformer for output
- TransformerFactory tFactory = TransformerFactory.newInstance();
- tFactory.setAttribute("indent-number", new Integer(3));
-
- Transformer transformer = tFactory.newTransformer();
-
- transformer.setOutputProperty(OutputKeys.INDENT, "yes");
- transformer.setOutputProperty(OutputKeys.METHOD, "xml");
- transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
- transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
- transformer.transform(new DOMSource(document),
- new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8"))));
- } catch (UnsupportedEncodingException ue) {
- // Should not reach here
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(ue);
- throw x;
- } catch (TransformerConfigurationException tce) {
- // Error generated by the parser
- // Should not reach here
- InternalError x = new InternalError("Error in creating the new document");
- x.initCause(tce);
- throw x;
- } catch (TransformerException te) {
- // Error generated by the transformer
- InternalError x = new InternalError("Error generated during transformation");
- x.initCause(te);
- throw x;
- }
- }
-
- private static void addServiceTagRegistry(Document document,
- String registryURN,
- Set<ServiceTag> svcTags) {
- // add service tag registry node and its attributes
- Element reg = document.createElement(ST_NODE_REGISTRY);
- reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN);
- reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION);
-
- Element root = getRegistrationDataRoot(document);
- root.appendChild(reg);
-
- // adds the elements for the service tags
- for (ServiceTag st : svcTags) {
- addServiceTagElement(document, reg, st);
- }
- }
-
- private static void addServiceTagElement(Document document,
- Element registryRoot,
- ServiceTag st) {
- Element svcTag = document.createElement(ST_NODE_SERVICE_TAG);
- registryRoot.appendChild(svcTag);
- addChildElement(document, svcTag,
- ST_NODE_INSTANCE_URN, st.getInstanceURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_NAME, st.getProductName());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VERSION, st.getProductVersion());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_URN, st.getProductURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_PARENT, st.getProductParent());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_DEFINED_INST_ID,
- st.getProductDefinedInstanceID());
- addChildElement(document, svcTag,
- ST_NODE_PRODUCT_VENDOR, st.getProductVendor());
- addChildElement(document, svcTag,
- ST_NODE_PLATFORM_ARCH, st.getPlatformArch());
- addChildElement(document, svcTag,
- ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp()));
- addChildElement(document, svcTag,
- ST_NODE_CONTAINER, st.getContainer());
- addChildElement(document, svcTag,
- ST_NODE_SOURCE, st.getSource());
- addChildElement(document, svcTag,
- ST_NODE_INSTALLER_UID,
- String.valueOf(st.getInstallerUID()));
- }
-
- private static void addChildElement(Document document, Element root,
- String element, String text) {
- Element node = document.createElement(element);
- node.appendChild(document.createTextNode(text));
- root.appendChild(node);
- }
-
- // Constructs service tags from the document
- private static void addServiceTags(Element registryRoot,
- RegistrationData registration) {
- NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG);
- int length = (children == null ? 0 : children.getLength());
- for (int i = 0; i < length; i++) {
- Element svcTagElement = (Element) children.item(i);
- ServiceTag st = getServiceTag(svcTagElement);
- registration.addServiceTag(st);
- }
- }
-
- // build environment map from the document
- private static void buildEnvironmentMap(Element envRoot,
- RegistrationData registration) {
- registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME));
- registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID));
- registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME));
- registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION));
- registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH));
- registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL));
- registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER));
- registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER));
- registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER));
- registration.setEnvironment(ST_NODE_PHYS_MEM, getTextValue(envRoot, ST_NODE_PHYS_MEM));
- }
-
- private static void buildCpuInfoMap(Element cpuInfoRoot,
- RegistrationData registration) {
- registration.setCpuInfo(ST_NODE_SOCKETS, getTextValue(cpuInfoRoot, ST_NODE_SOCKETS));
- registration.setCpuInfo(ST_NODE_CORES, getTextValue(cpuInfoRoot, ST_NODE_CORES));
- registration.setCpuInfo(ST_NODE_VIRT_CPUS, getTextValue(cpuInfoRoot, ST_NODE_VIRT_CPUS));
- registration.setCpuInfo(ST_NODE_CPU_NAME, getTextValue(cpuInfoRoot, ST_NODE_CPU_NAME));
- registration.setCpuInfo(ST_NODE_CLOCK_RATE, getTextValue(cpuInfoRoot, ST_NODE_CLOCK_RATE));
- }
-
- // add the nodes representing the environment map in the document
- private static void addEnvironmentNodes(Document document,
- Map<String, String> envMap,
- Map<String, String> cpuInfoMap) {
- Element root = getRegistrationDataRoot(document);
-
- Element env = document.createElement(ST_NODE_ENVIRONMENT);
- root.appendChild(env);
- Set<Map.Entry<String, String>> keys = envMap.entrySet();
- for (Map.Entry<String, String> entry : keys) {
- addChildElement(document, env, entry.getKey(), entry.getValue());
- }
-
- Element cpuInfo = document.createElement(ST_NODE_CPU_INFO);
- env.appendChild(cpuInfo);
- keys = cpuInfoMap.entrySet();
- for (Map.Entry<String, String> entry : keys) {
- addChildElement(document, cpuInfo, entry.getKey(), entry.getValue());
- }
- }
-
- private static Element getRegistrationDataRoot(Document doc) {
- Element root = doc.getDocumentElement();
- if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) {
- throw new IllegalArgumentException("Not a " +
- ST_NODE_REGISTRATION_DATA +
- " node \"" + root.getNodeName() + "\"");
- }
- return root;
- }
-
- private static Element getSingletonElementFromRoot(Element root, String name) {
- NodeList children = root.getElementsByTagName(name);
- int length = (children == null ? 0 : children.getLength());
- if (length != 1) {
- throw new IllegalArgumentException("Invalid number of " + name +
- " nodes = " + length);
- }
- Element e = (Element) children.item(0);
- if (!e.getNodeName().equals(name)) {
- throw new IllegalArgumentException("Not a " + name +
- " node \"" + e.getNodeName() + "\"");
- }
- return e;
- }
-
- // Constructs one ServiceTag instance from a service tag element root
- private static ServiceTag getServiceTag(Element svcTagElement) {
- return new ServiceTag(
- getTextValue(svcTagElement, ST_NODE_INSTANCE_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID),
- getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR),
- getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH),
- getTextValue(svcTagElement, ST_NODE_CONTAINER),
- getTextValue(svcTagElement, ST_NODE_SOURCE),
- Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)),
- Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP))
- );
- }
-
- private static String getTextValue(Element e, String tagName) {
- String value = "";
- NodeList nl = e.getElementsByTagName(tagName);
- if (nl != null && nl.getLength() > 0) {
- Element el = (Element) nl.item(0);
- Node node = el.getFirstChild();
- if (node != null) {
- value = node.getNodeValue();
- }
- }
- return value;
- }
-}
+ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2008 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common Development + * and Distribution License("CDDL") (collectively, the "License"). You + * may not use this file except in compliance with the License. You can obtain + * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html + * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific + * language governing permissions and limitations under the License. + * + * When distributing the software, include this License Header Notice in each + * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt. + * Sun designates this particular file as subject to the "Classpath" exception + * as provided by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the License + * Header, with the fields enclosed by brackets [] replaced by your own + * identifying information: "Portions Copyrighted [year] + * [name of copyright owner]" + * + * Contributor(s): + * + * If you wish your version of this file to be governed by only the CDDL or + * only the GPL Version 2, indicate your decision by adding "[Contributor] + * elects to include this software in this distribution under the [CDDL or GPL + * Version 2] license." If you don't indicate a single choice of license, a + * recipient has the option to distribute your version of this file under + * either the CDDL, the GPL Version 2 or to extend the choice of license to + * its licensees as provided above. However, if you add GPL Version 2 code + * and therefore, elected the GPL Version 2 license, then the option applies + * only if the new code is made subject to such option by the copyright + * holder. + */ + +package com.sun.star.servicetag; + +import java.io.*; +import java.net.URL; +import java.util.Collection; +import java.util.Map; +import java.util.Set; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; +import org.xml.sax.InputSource; + +import javax.xml.XMLConstants; +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.validation.Schema; +import javax.xml.validation.SchemaFactory; +import javax.xml.validation.Validator; + +// For write operation +import javax.xml.transform.OutputKeys; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.TransformerConfigurationException; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; + +/** + * XML Support Class for Product Registration. + */ +class RegistrationDocument { + + private static final String REGISTRATION_DATA_SCHEMA = + "/com/sun/star/servicetag/resources/product_registration.xsd"; + private static final String REGISTRATION_DATA_VERSION = "1.0"; + private static final String SERVICE_TAG_VERSION = "1.0"; + final static String ST_NODE_REGISTRATION_DATA = "registration_data"; + final static String ST_ATTR_REGISTRATION_VERSION = "version"; + final static String ST_NODE_ENVIRONMENT = "environment"; + final static String ST_NODE_HOSTNAME = "hostname"; + final static String ST_NODE_HOST_ID = "hostId"; + final static String ST_NODE_OS_NAME = "osName"; + final static String ST_NODE_OS_VERSION = "osVersion"; + final static String ST_NODE_OS_ARCH = "osArchitecture"; + final static String ST_NODE_SYSTEM_MODEL = "systemModel"; + final static String ST_NODE_SYSTEM_MANUFACTURER = "systemManufacturer"; + final static String ST_NODE_CPU_MANUFACTURER = "cpuManufacturer"; + final static String ST_NODE_SERIAL_NUMBER = "serialNumber"; + final static String ST_NODE_PHYS_MEM = "physmem"; + final static String ST_NODE_CPU_INFO = "cpuinfo"; + final static String ST_NODE_SOCKETS = "sockets"; + final static String ST_NODE_CORES = "cores"; + final static String ST_NODE_VIRT_CPUS = "virtcpus"; + final static String ST_NODE_CPU_NAME = "name"; + final static String ST_NODE_CLOCK_RATE = "clockrate"; + final static String ST_NODE_REGISTRY = "registry"; + final static String ST_ATTR_REGISTRY_URN = "urn"; + final static String ST_ATTR_REGISTRY_VERSION = "version"; + final static String ST_NODE_SERVICE_TAG = "service_tag"; + final static String ST_NODE_INSTANCE_URN = "instance_urn"; + final static String ST_NODE_PRODUCT_NAME = "product_name"; + final static String ST_NODE_PRODUCT_VERSION = "product_version"; + final static String ST_NODE_PRODUCT_URN = "product_urn"; + final static String ST_NODE_PRODUCT_PARENT_URN = "product_parent_urn"; + final static String ST_NODE_PRODUCT_PARENT = "product_parent"; + final static String ST_NODE_PRODUCT_DEFINED_INST_ID = "product_defined_inst_id"; + final static String ST_NODE_PRODUCT_VENDOR = "product_vendor"; + final static String ST_NODE_PLATFORM_ARCH = "platform_arch"; + final static String ST_NODE_TIMESTAMP = "timestamp"; + final static String ST_NODE_CONTAINER = "container"; + final static String ST_NODE_SOURCE = "source"; + final static String ST_NODE_INSTALLER_UID = "installer_uid"; + + static RegistrationData load(InputStream in) throws IOException { + Document document = initializeDocument(in); + + // Gets the registration URN + Element root = getRegistrationDataRoot(document); + Element registryRoot = + getSingletonElementFromRoot(root, ST_NODE_REGISTRY); + String urn = registryRoot.getAttribute(ST_ATTR_REGISTRY_URN); + + // Construct a new RegistrationData object from the DOM tree + // Initialize the environment map and service tags + RegistrationData regData = new RegistrationData(urn); + addServiceTags(registryRoot, regData); + + Element envRoot = getSingletonElementFromRoot(root, ST_NODE_ENVIRONMENT); + buildEnvironmentMap(envRoot, regData); + + Element cpuInfo = getSingletonElementFromRoot(envRoot, ST_NODE_CPU_INFO); + buildCpuInfoMap(cpuInfo, regData); + return regData; + } + + static void store(OutputStream os, RegistrationData registration) + throws IOException { + // create a new document with the root node + Document document = initializeDocument(); + + // create the nodes for the environment map and the service tags + // in the registration data + addEnvironmentNodes(document, + registration.getEnvironmentMap(), + registration.getCpuInfoMap()); + addServiceTagRegistry(document, + registration.getRegistrationURN(), + registration.getServiceTags()); + transform(document, os); + } + + // initialize a document from an input stream + private static Document initializeDocument(InputStream in) throws IOException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + SchemaFactory sf = null; + try { + // Some Java versions (e.g., 1.5.0_06-b05) fail with a + // NullPointerException if SchemaFactory.newInstance is called with + // a null context class loader, so work around that here (and the + // class loader of this class hopefully is not the null bootstrap + // class loader): + ClassLoader cl = Thread.currentThread().getContextClassLoader(); + if (cl == null) { + Thread.currentThread().setContextClassLoader( + RegistrationDocument.class.getClassLoader()); + } + try { + sf = SchemaFactory.newInstance( + XMLConstants.W3C_XML_SCHEMA_NS_URI); + } finally { + Thread.currentThread().setContextClassLoader(cl); + } + + Schema schema = null; + try { + // Even using the workaround above is not enough on some + // Java versions. Therefore try to workaround the validation + // completely! + URL xsdUrl = RegistrationDocument.class.getResource(REGISTRATION_DATA_SCHEMA); + schema = sf.newSchema(xsdUrl); + } + catch (NullPointerException nex) { + } + + Validator validator = null; + if (schema != null) + validator = schema.newValidator(); + + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.parse(new InputSource(in)); + + if (validator != null) + validator.validate(new DOMSource(doc)); + + return doc; + } catch (SAXException sxe) { + IllegalArgumentException e = new IllegalArgumentException("Error generated in parsing"); + e.initCause(sxe); + throw e; + } catch (ParserConfigurationException pce) { + // Parser with specific options can't be built + // should not reach here + InternalError x = new InternalError("Error in creating the new document"); + x.initCause(pce); + throw x; + } + } + + // initialize a new document for the registration data + private static Document initializeDocument() throws IOException { + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + try { + DocumentBuilder builder = factory.newDocumentBuilder(); + Document doc = builder.newDocument(); + + // initialize the document with the registration_data root + Element root = doc.createElement(ST_NODE_REGISTRATION_DATA); + doc.appendChild(root); + root.setAttribute(ST_ATTR_REGISTRATION_VERSION, REGISTRATION_DATA_VERSION); + + return doc; + } catch (ParserConfigurationException pce) { + // Parser with specified options can't be built + // should not reach here + InternalError x = new InternalError("Error in creating the new document"); + x.initCause(pce); + throw x; + } + } + + // Transform the current DOM tree with the given output stream. + private static void transform(Document document, OutputStream os) { + try { + // Use a Transformer for output + TransformerFactory tFactory = TransformerFactory.newInstance(); + tFactory.setAttribute("indent-number", new Integer(3)); + + Transformer transformer = tFactory.newTransformer(); + + transformer.setOutputProperty(OutputKeys.INDENT, "yes"); + transformer.setOutputProperty(OutputKeys.METHOD, "xml"); + transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); + transformer.setOutputProperty(OutputKeys.STANDALONE, "yes"); + transformer.transform(new DOMSource(document), + new StreamResult(new BufferedWriter(new OutputStreamWriter(os, "UTF-8")))); + } catch (UnsupportedEncodingException ue) { + // Should not reach here + InternalError x = new InternalError("Error generated during transformation"); + x.initCause(ue); + throw x; + } catch (TransformerConfigurationException tce) { + // Error generated by the parser + // Should not reach here + InternalError x = new InternalError("Error in creating the new document"); + x.initCause(tce); + throw x; + } catch (TransformerException te) { + // Error generated by the transformer + InternalError x = new InternalError("Error generated during transformation"); + x.initCause(te); + throw x; + } + } + + private static void addServiceTagRegistry(Document document, + String registryURN, + Set<ServiceTag> svcTags) { + // add service tag registry node and its attributes + Element reg = document.createElement(ST_NODE_REGISTRY); + reg.setAttribute(ST_ATTR_REGISTRY_URN, registryURN); + reg.setAttribute(ST_ATTR_REGISTRY_VERSION, SERVICE_TAG_VERSION); + + Element root = getRegistrationDataRoot(document); + root.appendChild(reg); + + // adds the elements for the service tags + for (ServiceTag st : svcTags) { + addServiceTagElement(document, reg, st); + } + } + + private static void addServiceTagElement(Document document, + Element registryRoot, + ServiceTag st) { + Element svcTag = document.createElement(ST_NODE_SERVICE_TAG); + registryRoot.appendChild(svcTag); + addChildElement(document, svcTag, + ST_NODE_INSTANCE_URN, st.getInstanceURN()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_NAME, st.getProductName()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_VERSION, st.getProductVersion()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_URN, st.getProductURN()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_PARENT_URN, st.getProductParentURN()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_PARENT, st.getProductParent()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_DEFINED_INST_ID, + st.getProductDefinedInstanceID()); + addChildElement(document, svcTag, + ST_NODE_PRODUCT_VENDOR, st.getProductVendor()); + addChildElement(document, svcTag, + ST_NODE_PLATFORM_ARCH, st.getPlatformArch()); + addChildElement(document, svcTag, + ST_NODE_TIMESTAMP, Util.formatTimestamp(st.getTimestamp())); + addChildElement(document, svcTag, + ST_NODE_CONTAINER, st.getContainer()); + addChildElement(document, svcTag, + ST_NODE_SOURCE, st.getSource()); + addChildElement(document, svcTag, + ST_NODE_INSTALLER_UID, + String.valueOf(st.getInstallerUID())); + } + + private static void addChildElement(Document document, Element root, + String element, String text) { + Element node = document.createElement(element); + node.appendChild(document.createTextNode(text)); + root.appendChild(node); + } + + // Constructs service tags from the document + private static void addServiceTags(Element registryRoot, + RegistrationData registration) { + NodeList children = registryRoot.getElementsByTagName(ST_NODE_SERVICE_TAG); + int length = (children == null ? 0 : children.getLength()); + for (int i = 0; i < length; i++) { + Element svcTagElement = (Element) children.item(i); + ServiceTag st = getServiceTag(svcTagElement); + registration.addServiceTag(st); + } + } + + // build environment map from the document + private static void buildEnvironmentMap(Element envRoot, + RegistrationData registration) { + registration.setEnvironment(ST_NODE_HOSTNAME, getTextValue(envRoot, ST_NODE_HOSTNAME)); + registration.setEnvironment(ST_NODE_HOST_ID, getTextValue(envRoot, ST_NODE_HOST_ID)); + registration.setEnvironment(ST_NODE_OS_NAME, getTextValue(envRoot, ST_NODE_OS_NAME)); + registration.setEnvironment(ST_NODE_OS_VERSION, getTextValue(envRoot, ST_NODE_OS_VERSION)); + registration.setEnvironment(ST_NODE_OS_ARCH, getTextValue(envRoot, ST_NODE_OS_ARCH)); + registration.setEnvironment(ST_NODE_SYSTEM_MODEL, getTextValue(envRoot, ST_NODE_SYSTEM_MODEL)); + registration.setEnvironment(ST_NODE_SYSTEM_MANUFACTURER, getTextValue(envRoot, ST_NODE_SYSTEM_MANUFACTURER)); + registration.setEnvironment(ST_NODE_CPU_MANUFACTURER, getTextValue(envRoot, ST_NODE_CPU_MANUFACTURER)); + registration.setEnvironment(ST_NODE_SERIAL_NUMBER, getTextValue(envRoot, ST_NODE_SERIAL_NUMBER)); + registration.setEnvironment(ST_NODE_PHYS_MEM, getTextValue(envRoot, ST_NODE_PHYS_MEM)); + } + + private static void buildCpuInfoMap(Element cpuInfoRoot, + RegistrationData registration) { + registration.setCpuInfo(ST_NODE_SOCKETS, getTextValue(cpuInfoRoot, ST_NODE_SOCKETS)); + registration.setCpuInfo(ST_NODE_CORES, getTextValue(cpuInfoRoot, ST_NODE_CORES)); + registration.setCpuInfo(ST_NODE_VIRT_CPUS, getTextValue(cpuInfoRoot, ST_NODE_VIRT_CPUS)); + registration.setCpuInfo(ST_NODE_CPU_NAME, getTextValue(cpuInfoRoot, ST_NODE_CPU_NAME)); + registration.setCpuInfo(ST_NODE_CLOCK_RATE, getTextValue(cpuInfoRoot, ST_NODE_CLOCK_RATE)); + } + + // add the nodes representing the environment map in the document + private static void addEnvironmentNodes(Document document, + Map<String, String> envMap, + Map<String, String> cpuInfoMap) { + Element root = getRegistrationDataRoot(document); + + Element env = document.createElement(ST_NODE_ENVIRONMENT); + root.appendChild(env); + Set<Map.Entry<String, String>> keys = envMap.entrySet(); + for (Map.Entry<String, String> entry : keys) { + addChildElement(document, env, entry.getKey(), entry.getValue()); + } + + Element cpuInfo = document.createElement(ST_NODE_CPU_INFO); + env.appendChild(cpuInfo); + keys = cpuInfoMap.entrySet(); + for (Map.Entry<String, String> entry : keys) { + addChildElement(document, cpuInfo, entry.getKey(), entry.getValue()); + } + } + + private static Element getRegistrationDataRoot(Document doc) { + Element root = doc.getDocumentElement(); + if (!root.getNodeName().equals(ST_NODE_REGISTRATION_DATA)) { + throw new IllegalArgumentException("Not a " + + ST_NODE_REGISTRATION_DATA + + " node \"" + root.getNodeName() + "\""); + } + return root; + } + + private static Element getSingletonElementFromRoot(Element root, String name) { + NodeList children = root.getElementsByTagName(name); + int length = (children == null ? 0 : children.getLength()); + if (length != 1) { + throw new IllegalArgumentException("Invalid number of " + name + + " nodes = " + length); + } + Element e = (Element) children.item(0); + if (!e.getNodeName().equals(name)) { + throw new IllegalArgumentException("Not a " + name + + " node \"" + e.getNodeName() + "\""); + } + return e; + } + + // Constructs one ServiceTag instance from a service tag element root + private static ServiceTag getServiceTag(Element svcTagElement) { + return new ServiceTag( + getTextValue(svcTagElement, ST_NODE_INSTANCE_URN), + getTextValue(svcTagElement, ST_NODE_PRODUCT_NAME), + getTextValue(svcTagElement, ST_NODE_PRODUCT_VERSION), + getTextValue(svcTagElement, ST_NODE_PRODUCT_URN), + getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT), + getTextValue(svcTagElement, ST_NODE_PRODUCT_PARENT_URN), + getTextValue(svcTagElement, ST_NODE_PRODUCT_DEFINED_INST_ID), + getTextValue(svcTagElement, ST_NODE_PRODUCT_VENDOR), + getTextValue(svcTagElement, ST_NODE_PLATFORM_ARCH), + getTextValue(svcTagElement, ST_NODE_CONTAINER), + getTextValue(svcTagElement, ST_NODE_SOURCE), + Util.getIntValue(getTextValue(svcTagElement, ST_NODE_INSTALLER_UID)), + Util.parseTimestamp(getTextValue(svcTagElement, ST_NODE_TIMESTAMP)) + ); + } + + private static String getTextValue(Element e, String tagName) { + String value = ""; + NodeList nl = e.getElementsByTagName(tagName); + if (nl != null && nl.getLength() > 0) { + Element el = (Element) nl.item(0); + Node node = el.getFirstChild(); + if (node != null) { + value = node.getNodeValue(); + } + } + return value; + } +} diff --git a/desktop/source/registration/com/sun/star/servicetag/Registry.java b/desktop/source/registration/com/sun/star/servicetag/Registry.java index 81e4ed41142d..932b0d7e1cb5 100644 --- a/desktop/source/registration/com/sun/star/servicetag/Registry.java +++ b/desktop/source/registration/com/sun/star/servicetag/Registry.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java b/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java index 73e83b172008..4adb36772517 100644 --- a/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java +++ b/desktop/source/registration/com/sun/star/servicetag/ServiceTag.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java b/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java index 8d38e70f8b7e..4f99d890577f 100644 --- a/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java +++ b/desktop/source/registration/com/sun/star/servicetag/SolarisServiceTag.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java index 684b8224d2af..fa98580fd6b5 100644 --- a/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java +++ b/desktop/source/registration/com/sun/star/servicetag/SolarisSystemEnvironment.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/SunConnection.java b/desktop/source/registration/com/sun/star/servicetag/SunConnection.java index 417489410148..db525ea637f4 100644 --- a/desktop/source/registration/com/sun/star/servicetag/SunConnection.java +++ b/desktop/source/registration/com/sun/star/servicetag/SunConnection.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java b/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java index 0af25ec35d58..ca0a16858670 100644 --- a/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java +++ b/desktop/source/registration/com/sun/star/servicetag/SysnetRegistryHelper.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java index 4628034723e1..76eaca37e39a 100644 --- a/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java +++ b/desktop/source/registration/com/sun/star/servicetag/SystemEnvironment.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -95,12 +92,12 @@ public class SystemEnvironment { this.systemManufacturer = ""; this.cpuManufacturer = ""; this.serialNumber = ""; - this.physmem = ""; - this.sockets = ""; - this.cores = ""; - this.virtcpus = ""; + this.physmem = "0"; + this.sockets = "0"; + this.cores = "0"; + this.virtcpus = "0"; this.cpuname = ""; - this.clockrate = ""; + this.clockrate = "0"; } @@ -173,6 +170,8 @@ public class SystemEnvironment { * @param physmem The physmem to set. */ public void setPhysMem(String physmem) { + if (physmem.length() == 0) + physmem = "0"; this.physmem = physmem; } @@ -181,6 +180,8 @@ public class SystemEnvironment { * @param sockets The sockets to set. */ public void setSockets(String sockets) { + if (sockets.length() == 0) + sockets = "0"; this.sockets = sockets; } @@ -189,6 +190,8 @@ public class SystemEnvironment { * @param cores The cores to set. */ public void setCores(String cores) { + if (cores.length() == 0) + cores ="0"; this.cores = cores; } @@ -197,6 +200,8 @@ public class SystemEnvironment { * @param virtcpus The virtcpus to set. */ public void setVirtCpus(String virtcpus) { + if (virtcpus.length() == 0) + virtcpus = "0"; this.virtcpus = virtcpus; } @@ -213,9 +218,14 @@ public class SystemEnvironment { * @param clockrate The clockrate to set. */ public void setClockRate(String clockrate) { - Float f = Float.parseFloat(clockrate); - Integer nClockrate = f.intValue(); - this.clockrate = nClockrate.toString(); + if (clockrate.length() == 0) + this.clockrate = "0"; + else + { + Float f = Float.parseFloat(clockrate); + Integer nClockrate = f.intValue(); + this.clockrate = nClockrate.toString(); + } } /** diff --git a/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java b/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java index fe2762fc560b..898fb614c267 100644 --- a/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java +++ b/desktop/source/registration/com/sun/star/servicetag/UnauthorizedAccessException.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/Util.java b/desktop/source/registration/com/sun/star/servicetag/Util.java index 3e9ad224ba97..1f54775e7d3c 100644 --- a/desktop/source/registration/com/sun/star/servicetag/Util.java +++ b/desktop/source/registration/com/sun/star/servicetag/Util.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java b/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java index 6d78357074fb..3aa799e16d5e 100644 --- a/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java +++ b/desktop/source/registration/com/sun/star/servicetag/WindowsSystemEnvironment.java @@ -2,13 +2,10 @@ * * 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: Registration.java,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/makefile.mk b/desktop/source/registration/com/sun/star/servicetag/makefile.mk index d4ebbed2f0c4..784964652950 100644 --- a/desktop/source/registration/com/sun/star/servicetag/makefile.mk +++ b/desktop/source/registration/com/sun/star/servicetag/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd b/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd index bb48ba90844d..6681a563a01e 100644 --- a/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd +++ b/desktop/source/registration/com/sun/star/servicetag/resources/product_registration.xsd @@ -1,366 +1,366 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
-<xs:element name="registration_data">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="environment"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="hostname"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="hostId"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osName"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osVersion"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="osArchitecture"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemModel"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="systemManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="cpuManufacturer"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="serialNumber"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="physmem"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element name="cpuinfo"
- minOccurs='0'
- maxOccurs='1'>
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="sockets"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="cores"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="virtcpus"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="name"
- minOccurs='0'
- maxOccurs='1'/>
- <xs:element ref="clockrate"
- minOccurs='0'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- <xs:element name="registry"
- minOccurs="1"
- maxOccurs="1">
- <xs:complexType>
- <xs:sequence>
- <xs:element name="service_tag"
- minOccurs="0"
- maxOccurs="1024">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="instance_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_name"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_version"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent_urn"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_parent"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_defined_inst_id"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="product_vendor"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="platform_arch"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="timestamp"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="container"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="source"
- minOccurs='1'
- maxOccurs='1'/>
- <xs:element ref="installer_uid"
- minOccurs='1'
- maxOccurs='1'/>
- </xs:sequence>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="urn"
- type="xs:string"
- use="required"/>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
- </xs:element>
- </xs:sequence>
- <xs:attribute name="version"
- type="xs:string"
- use="required"/>
- </xs:complexType>
-</xs:element>
-
- <!-- definition of simple elements -->
- <xs:element name="hostname">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="hostId">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="16"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osName">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osVersion">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="osArchitecture">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemModel">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="systemManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="cpuManufacturer">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="50"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="serialNumber">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="256"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="instance_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_name">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_version">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="1"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent_urn">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_parent">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_defined_inst_id">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="255"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="product_vendor">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="platform_arch">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:minLength value="0"/>
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="timestamp">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="24"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="container">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="source">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="63"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="installer_uid">
- <xs:simpleType>
- <xs:restriction base="xs:integer">
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="physmem">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="sockets">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="cores">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="virtcpus">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="name">
- <xs:simpleType>
- <xs:restriction base="xs:string">
- <xs:maxLength value="128"/>
- </xs:restriction>
- </xs:simpleType>
- </xs:element>
-
- <xs:element name="clockrate">
- <xs:simpleType>
- <xs:restriction base="xs:integer"/>
- </xs:simpleType>
- </xs:element>
-
-</xs:schema>
+<?xml version="1.0" encoding="UTF-8"?> +<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> + +<xs:element name="registration_data"> + <xs:complexType> + <xs:sequence> + <xs:element name="environment" + minOccurs="1" + maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element ref="hostname" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="hostId" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="osName" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="osVersion" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="osArchitecture" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="systemModel" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="systemManufacturer" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="cpuManufacturer" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="serialNumber" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="physmem" + minOccurs='0' + maxOccurs='1'/> + <xs:element name="cpuinfo" + minOccurs='0' + maxOccurs='1'> + <xs:complexType> + <xs:sequence> + <xs:element ref="sockets" + minOccurs='0' + maxOccurs='1'/> + <xs:element ref="cores" + minOccurs='0' + maxOccurs='1'/> + <xs:element ref="virtcpus" + minOccurs='0' + maxOccurs='1'/> + <xs:element ref="name" + minOccurs='0' + maxOccurs='1'/> + <xs:element ref="clockrate" + minOccurs='0' + maxOccurs='1'/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="registry" + minOccurs="1" + maxOccurs="1"> + <xs:complexType> + <xs:sequence> + <xs:element name="service_tag" + minOccurs="0" + maxOccurs="1024"> + <xs:complexType> + <xs:sequence> + <xs:element ref="instance_urn" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_name" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_version" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_urn" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_parent_urn" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_parent" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_defined_inst_id" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="product_vendor" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="platform_arch" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="timestamp" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="container" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="source" + minOccurs='1' + maxOccurs='1'/> + <xs:element ref="installer_uid" + minOccurs='1' + maxOccurs='1'/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="urn" + type="xs:string" + use="required"/> + <xs:attribute name="version" + type="xs:string" + use="required"/> + </xs:complexType> + </xs:element> + </xs:sequence> + <xs:attribute name="version" + type="xs:string" + use="required"/> + </xs:complexType> +</xs:element> + + <!-- definition of simple elements --> + <xs:element name="hostname"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="hostId"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="16"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="osName"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:maxLength value="256"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="osVersion"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="50"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="osArchitecture"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="256"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="systemModel"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="50"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="systemManufacturer"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="50"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="cpuManufacturer"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="50"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="serialNumber"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="256"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="instance_urn"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_name"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_version"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="63"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_urn"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="1"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_parent_urn"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_parent"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_defined_inst_id"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="255"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="product_vendor"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="63"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="platform_arch"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:minLength value="0"/> + <xs:maxLength value="63"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="timestamp"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="24"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="container"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="63"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="source"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="63"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="installer_uid"> + <xs:simpleType> + <xs:restriction base="xs:integer"> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="physmem"> + <xs:simpleType> + <xs:restriction base="xs:integer"/> + </xs:simpleType> + </xs:element> + + <xs:element name="sockets"> + <xs:simpleType> + <xs:restriction base="xs:integer"/> + </xs:simpleType> + </xs:element> + + <xs:element name="cores"> + <xs:simpleType> + <xs:restriction base="xs:integer"/> + </xs:simpleType> + </xs:element> + + <xs:element name="virtcpus"> + <xs:simpleType> + <xs:restriction base="xs:integer"/> + </xs:simpleType> + </xs:element> + + <xs:element name="name"> + <xs:simpleType> + <xs:restriction base="xs:string"> + <xs:maxLength value="128"/> + </xs:restriction> + </xs:simpleType> + </xs:element> + + <xs:element name="clockrate"> + <xs:simpleType> + <xs:restriction base="xs:integer"/> + </xs:simpleType> + </xs:element> + +</xs:schema> diff --git a/desktop/source/so_comp/evaluation.cxx b/desktop/source/so_comp/evaluation.cxx index a4c721186f98..4cbb38931d37 100644 --- a/desktop/source/so_comp/evaluation.cxx +++ b/desktop/source/so_comp/evaluation.cxx @@ -2,13 +2,10 @@ * * 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: evaluation.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/so_comp/evaluation.hxx b/desktop/source/so_comp/evaluation.hxx index d778933bc7ba..a1225029b297 100644 --- a/desktop/source/so_comp/evaluation.hxx +++ b/desktop/source/so_comp/evaluation.hxx @@ -2,13 +2,10 @@ * * 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: evaluation.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/so_comp/exports.map b/desktop/source/so_comp/exports.map deleted file mode 100644 index ba501f9ae076..000000000000 --- a/desktop/source/so_comp/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/desktop/source/so_comp/makefile.mk b/desktop/source/so_comp/makefile.mk index 4886c3701e05..590f99518c68 100644 --- a/desktop/source/so_comp/makefile.mk +++ b/desktop/source/so_comp/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.17 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -59,7 +55,7 @@ SHL1OBJS= $(SLOFILES) SHL1TARGET= $(TARGET) SHL1IMPLIB= i$(TARGET) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/desktop/source/so_comp/oemjob.cxx b/desktop/source/so_comp/oemjob.cxx index dd25b6bb04fe..1b78da694ff7 100644 --- a/desktop/source/so_comp/oemjob.cxx +++ b/desktop/source/so_comp/oemjob.cxx @@ -2,13 +2,10 @@ * * 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: oemjob.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/so_comp/oemjob.hxx b/desktop/source/so_comp/oemjob.hxx index fe5dd60d491e..16a111badab9 100644 --- a/desktop/source/so_comp/oemjob.hxx +++ b/desktop/source/so_comp/oemjob.hxx @@ -2,13 +2,10 @@ * * 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: oemjob.hxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/so_comp/services.cxx b/desktop/source/so_comp/services.cxx index 22953a8e1b7f..d1a2b3139e91 100644 --- a/desktop/source/so_comp/services.cxx +++ b/desktop/source/so_comp/services.cxx @@ -2,13 +2,10 @@ * * 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: services.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/splash/exports.map b/desktop/source/splash/exports.map deleted file mode 100644 index ba501f9ae076..000000000000 --- a/desktop/source/splash/exports.map +++ /dev/null @@ -1,10 +0,0 @@ -UDK_3_0_0 { - global: - GetVersionInfo; - component_getImplementationEnvironment; - component_getFactory; - component_writeInfo; - - local: - *; -}; diff --git a/desktop/source/splash/firststart.cxx b/desktop/source/splash/firststart.cxx index 8c6b3efc2061..21a0a562269a 100755 --- a/desktop/source/splash/firststart.cxx +++ b/desktop/source/splash/firststart.cxx @@ -2,13 +2,10 @@ * * 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: firststart.cxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/splash/firststart.hxx b/desktop/source/splash/firststart.hxx index f602def4691c..fe45833cfae7 100755 --- a/desktop/source/splash/firststart.hxx +++ b/desktop/source/splash/firststart.hxx @@ -2,13 +2,10 @@ * * 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: firststart.hxx,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/splash/makefile.mk b/desktop/source/splash/makefile.mk index 3ca31875c937..89609687438c 100644 --- a/desktop/source/splash/makefile.mk +++ b/desktop/source/splash/makefile.mk @@ -1,15 +1,11 @@ #************************************************************************* # # 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: makefile.mk,v $ -# -# $Revision: 1.15 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -58,7 +54,7 @@ SHL1OBJS= $(SLOFILES) \ SHL1TARGET=$(TARGET)$(DLLPOSTFIX) SHL1IMPLIB=i$(TARGET) -SHL1VERSIONMAP=exports.map +SHL1VERSIONMAP=$(SOLARENV)/src/component.map SHL1DEF=$(MISC)$/$(SHL1TARGET).def DEF1NAME=$(SHL1TARGET) diff --git a/desktop/source/splash/services_spl.cxx b/desktop/source/splash/services_spl.cxx index ac21e801d7ca..349ec2ec0a78 100755 --- a/desktop/source/splash/services_spl.cxx +++ b/desktop/source/splash/services_spl.cxx @@ -2,13 +2,10 @@ * * 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: services_spl.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index 4e2bb3d73742..5fee3028b4f6 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -2,13 +2,10 @@ * * 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: splash.cxx,v $ - * $Revision: 1.32 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -47,6 +44,8 @@ #include <rtl/logfile.hxx> #include <rtl/ustrbuf.hxx> #include <rtl/math.hxx> +#include <vcl/graph.hxx> +#include <svtools/filter.hxx> #define NOT_LOADED ((long)-1) @@ -61,6 +60,7 @@ SplashScreen::SplashScreen(const Reference< XMultiServiceFactory >& rSMgr) , _vdev(*((IntroWindow*)this)) , _cProgressFrameColor(sal::static_int_cast< ColorData >(NOT_LOADED)) , _cProgressBarColor(sal::static_int_cast< ColorData >(NOT_LOADED)) + , _bNativeProgress(true) , _iMax(100) , _iProgress(0) , _eBitmapMode(BM_DEFAULTMODE) @@ -298,6 +298,9 @@ void SplashScreen::loadConfig() OUString( RTL_CONSTASCII_USTRINGPARAM( "ProgressPosition" ) ) ); OUString sFullScreenSplash = implReadBootstrapKey( OUString( RTL_CONSTASCII_USTRINGPARAM( "FullScreenSplash" ) ) ); + OUString sNativeProgress = implReadBootstrapKey( + OUString( RTL_CONSTASCII_USTRINGPARAM( "NativeProgress" ) ) ); + // Determine full screen splash mode _bFullScreenSplash = (( sFullScreenSplash.getLength() > 0 ) && @@ -348,6 +351,11 @@ void SplashScreen::loadConfig() } } + if( sNativeProgress.getLength() ) + { + _bNativeProgress = sNativeProgress.toBoolean(); + } + if ( sSize.getLength() ) { sal_Int32 idx = 0; @@ -421,9 +429,15 @@ bool SplashScreen::loadBitmap( SvFileStream aStrm( aObj.PathToFileName(), STREAM_STD_READ ); if ( !aStrm.GetError() ) { + // Use graphic class to also support more graphic formats (bmp,png,...) + Graphic aGraphic; + + GraphicFilter* pGF = GraphicFilter::GetGraphicFilter(); + pGF->ImportGraphic( aGraphic, String(), aStrm, GRFILTER_FORMAT_DONTKNOW ); + // Default case, we load the intro bitmap from a seperate file // (e.g. staroffice_intro.bmp or starsuite_intro.bmp) - aStrm >> _aIntroBmp; + _aIntroBmp = aGraphic.GetBitmapEx(); return true; } @@ -441,8 +455,14 @@ bool SplashScreen::findBitmap(rtl::OUString const & path) { haveBitmap = findAppBitmap(path); } if ( !haveBitmap ) + { haveBitmap = loadBitmap( - path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.png"))); + if ( !haveBitmap ) + haveBitmap = loadBitmap( + path, rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("intro.bmp"))); + } + return haveBitmap; } @@ -472,21 +492,34 @@ bool SplashScreen::findScreenBitmap(rtl::OUString const & path) aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); bool haveBitmap = loadBitmap( path, aBmpFileName ); if ( !haveBitmap ) { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } + + if ( !haveBitmap ) + { aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( OUString::valueOf( nWidth )); aStrBuf.appendAscii( "x" ); aStrBuf.append( OUString::valueOf( nHeight )); - aStrBuf.appendAscii( ".bmp" ); - aBmpFileName = aStrBuf.makeStringAndClear(); + + aRootIntroFileName = aStrBuf.makeStringAndClear(); + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".png"); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii(".bmp"); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } @@ -501,9 +534,16 @@ bool SplashScreen::findAppBitmap(rtl::OUString const & path) aStrBuf.appendAscii( "intro_" ); aStrBuf.appendAscii( "_" ); aStrBuf.append( _sAppName ); - aStrBuf.appendAscii( ".bmp" ); - OUString aBmpFileName = aStrBuf.makeStringAndClear(); + + OUString aRootIntroFileName = aStrBuf.makeStringAndClear(); + + OUString aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".png" ); haveBitmap = loadBitmap( path, aBmpFileName ); + if ( !haveBitmap ) + { + aBmpFileName = aRootIntroFileName + OUString::createFromAscii( ".bmp" ); + haveBitmap = loadBitmap( path, aBmpFileName ); + } } return haveBitmap; } @@ -587,9 +627,9 @@ void SplashScreen::Paint( const Rectangle&) BOOL bNativeOK = FALSE; // in case of native controls we need to draw directly to the window - if( IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) + if( _bNativeProgress && IsNativeControlSupported( CTRL_INTROPROGRESS, PART_ENTIRE_CONTROL ) ) { - DrawBitmap( Point(), _aIntroBmp ); + DrawBitmapEx( Point(), _aIntroBmp ); ImplControlValue aValue( _iProgress * _barwidth / _iMax); Rectangle aDrawRect( Point(_tlx, _tly), Size( _barwidth, _barheight ) ); @@ -615,7 +655,7 @@ void SplashScreen::Paint( const Rectangle&) //non native drawing // draw bitmap if (_bPaintBitmap) - _vdev.DrawBitmap( Point(), _aIntroBmp ); + _vdev.DrawBitmapEx( Point(), _aIntroBmp ); if (_bPaintProgress) { // draw progress... diff --git a/desktop/source/splash/splash.hxx b/desktop/source/splash/splash.hxx index 51f68d44d830..99677aa107f1 100644 --- a/desktop/source/splash/splash.hxx +++ b/desktop/source/splash/splash.hxx @@ -2,13 +2,10 @@ * * 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: splash.hxx,v $ - * $Revision: 1.17 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -37,7 +34,7 @@ #include <cppuhelper/implbase2.hxx> #include <cppuhelper/interfacecontainer.h> #include <vcl/introwin.hxx> -#include <vcl/bitmap.hxx> +#include <vcl/bitmapex.hxx> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #include <osl/mutex.hxx> #include <vcl/virdev.hxx> @@ -89,9 +86,10 @@ private: Reference< XMultiServiceFactory > _rFactory; VirtualDevice _vdev; - Bitmap _aIntroBmp; + BitmapEx _aIntroBmp; Color _cProgressFrameColor; Color _cProgressBarColor; + bool _bNativeProgress; OUString _sAppName; std::vector< FullScreenProgressRatioValue > _sFullScreenProgressRatioValues; diff --git a/desktop/test/deployment/dependencies/readme.txt b/desktop/test/deployment/dependencies/readme.txt index 751ab31eacd9..a99fade00225 100644 --- a/desktop/test/deployment/dependencies/readme.txt +++ b/desktop/test/deployment/dependencies/readme.txt @@ -2,14 +2,10 @@ # # 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: readme.txt,v $ -# -# $Revision: 1.7.134.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/executable_content/build/hello.c b/desktop/test/deployment/executable_content/build/hello.c index 79a7f4cd01ef..e9442450923a 100644 --- a/desktop/test/deployment/executable_content/build/hello.c +++ b/desktop/test/deployment/executable_content/build/hello.c @@ -2,13 +2,10 @@ * * 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: hello.c,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/executable_content/build/makefile.mk b/desktop/test/deployment/executable_content/build/makefile.mk index 434a4359cccb..038051c97499 100644 --- a/desktop/test/deployment/executable_content/build/makefile.mk +++ b/desktop/test/deployment/executable_content/build/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/identifier/readme.txt b/desktop/test/deployment/identifier/readme.txt index 91baf0173909..8a791c586a78 100644 --- a/desktop/test/deployment/identifier/readme.txt +++ b/desktop/test/deployment/identifier/readme.txt @@ -2,14 +2,10 @@ # # 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: readme.txt,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/locationtest/LocationTest.idl b/desktop/test/deployment/locationtest/LocationTest.idl index ab098239f724..2bcc6818c168 100644 --- a/desktop/test/deployment/locationtest/LocationTest.idl +++ b/desktop/test/deployment/locationtest/LocationTest.idl @@ -2,14 +2,10 @@ * * 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: LocationTest.idl,v $ - * - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/locationtest/LocationTest.java b/desktop/test/deployment/locationtest/LocationTest.java index d3a694635802..c5d24f4b0ecc 100644 --- a/desktop/test/deployment/locationtest/LocationTest.java +++ b/desktop/test/deployment/locationtest/LocationTest.java @@ -2,14 +2,10 @@ * * 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: LocationTest.java,v $ - * - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/locationtest/makefile.mk b/desktop/test/deployment/locationtest/makefile.mk index c8f9f4c6525a..8fe189791961 100644 --- a/desktop/test/deployment/locationtest/makefile.mk +++ b/desktop/test/deployment/locationtest/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java index e1786c856b72..bb38108e5eea 100644 --- a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java +++ b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/OptionsEventHandler.java @@ -2,14 +2,10 @@ * * 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: OptionsEventHandler.java,v $ - * - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/makefile.mk b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/makefile.mk index d6a000274e3d..662fffce407c 100644 --- a/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/makefile.mk +++ b/desktop/test/deployment/options/handler/com/sun/star/comp/extensionoptions/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.3 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/simple_license/suppress_license.oxt b/desktop/test/deployment/simple_license/suppress_license.oxt Binary files differnew file mode 100755 index 000000000000..2bacd6aa378b --- /dev/null +++ b/desktop/test/deployment/simple_license/suppress_license.oxt diff --git a/desktop/test/deployment/simple_license/tests_simple_license.odt b/desktop/test/deployment/simple_license/tests_simple_license.odt Binary files differindex b0f5410d9987..b0c86e11c69b 100644 --- a/desktop/test/deployment/simple_license/tests_simple_license.odt +++ b/desktop/test/deployment/simple_license/tests_simple_license.odt diff --git a/desktop/test/deployment/update/dependencies/readme.txt b/desktop/test/deployment/update/dependencies/readme.txt index b56d4cc7f1f9..3c71da24884d 100644 --- a/desktop/test/deployment/update/dependencies/readme.txt +++ b/desktop/test/deployment/update/dependencies/readme.txt @@ -2,14 +2,10 @@ # # 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: header.hxx,v $ -# -# $Revision: 1.1 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/update/dependencies/update/update-dependencies.update.xml b/desktop/test/deployment/update/dependencies/update/update-dependencies.update.xml index f9f687ac1ae5..bf8a399da116 100644 --- a/desktop/test/deployment/update/dependencies/update/update-dependencies.update.xml +++ b/desktop/test/deployment/update/dependencies/update/update-dependencies.update.xml @@ -1,16 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!--*********************************************************************** - * + 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: update-dependencies.update.xml,v $ - - $Revision: 1.4 $ - This file is part of OpenOffice.org. OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/update/readme.txt b/desktop/test/deployment/update/readme.txt index cdda759f12b6..b3fd9126cae3 100644 --- a/desktop/test/deployment/update/readme.txt +++ b/desktop/test/deployment/update/readme.txt @@ -2,13 +2,10 @@ * * 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: readme.txt,v $ - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/update/updateinfocreation/build/TestExtension.idl b/desktop/test/deployment/update/updateinfocreation/build/TestExtension.idl index 3b1f1d00fb0a..3f5fc3b53bbe 100755 --- a/desktop/test/deployment/update/updateinfocreation/build/TestExtension.idl +++ b/desktop/test/deployment/update/updateinfocreation/build/TestExtension.idl @@ -2,14 +2,10 @@ * * 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: TestExtension.idl,v $ - * - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/update/updateinfocreation/build/TestExtension.java b/desktop/test/deployment/update/updateinfocreation/build/TestExtension.java index 9a703abb2d4b..059715845c32 100755 --- a/desktop/test/deployment/update/updateinfocreation/build/TestExtension.java +++ b/desktop/test/deployment/update/updateinfocreation/build/TestExtension.java @@ -2,14 +2,10 @@ * * 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: TestExtension.java,v $ - * - * $Revision: 1.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk index bf6bd4836c7d..6af3928279e0 100755 --- a/desktop/test/deployment/update/updateinfocreation/build/makefile.mk +++ b/desktop/test/deployment/update/updateinfocreation/build/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.5 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/test/deployment/version/readme.txt b/desktop/test/deployment/version/readme.txt index 7d452fcc3603..c2ba28afd916 100644 --- a/desktop/test/deployment/version/readme.txt +++ b/desktop/test/deployment/version/readme.txt @@ -2,14 +2,10 @@ * * 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: readme.txt,v $ - * - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/unx/source/officeloader/makefile.mk b/desktop/unx/source/officeloader/makefile.mk index 46e5911c569b..050da981e88d 100644 --- a/desktop/unx/source/officeloader/makefile.mk +++ b/desktop/unx/source/officeloader/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.2 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/unx/source/officeloader/officeloader.cxx b/desktop/unx/source/officeloader/officeloader.cxx index 56a5023a03a4..de84985cdea6 100755 --- a/desktop/unx/source/officeloader/officeloader.cxx +++ b/desktop/unx/source/officeloader/officeloader.cxx @@ -2,13 +2,10 @@ * * 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: officeloader.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/util/hidother.src b/desktop/util/hidother.src index 6f5a86159d75..a7ca7c09874e 100644 --- a/desktop/util/hidother.src +++ b/desktop/util/hidother.src @@ -2,13 +2,10 @@ * * 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: hidother.src,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/util/makefile.mk b/desktop/util/makefile.mk index 82cad8c095ad..c669206bb3f3 100644 --- a/desktop/util/makefile.mk +++ b/desktop/util/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.83 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/util/ooverinfo.rc b/desktop/util/ooverinfo.rc index 0e9f01ddc317..28b1e0d4a811 100644 --- a/desktop/util/ooverinfo.rc +++ b/desktop/util/ooverinfo.rc @@ -2,7 +2,7 @@ * * 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 * @@ -69,7 +69,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" @@ -81,7 +81,7 @@ VS_VERSION_INFO versioninfo value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } @@ -96,44 +96,43 @@ VS_VERSION_INFO versioninfo } } - -2 ICON "icons\\ooo3_writer_doc.ico" -3 ICON "icons\\ooo3_writer_tem.ico" -4 ICON "icons\\ooo3_calc_doc.ico" -5 ICON "icons\\ooo3_calc_tem.ico" -6 ICON "icons\\ooo3_draw_doc.ico" -7 ICON "icons\\ooo3_draw_tem.ico" -8 ICON "icons\\ooo3_impress_doc.ico" -9 ICON "icons\\ooo3_impress_tem.ico" -10 ICON "icons\\ooo3_impress_doc.ico" -11 ICON "icons\\ooo3_global_doc.ico" -12 ICON "icons\\ooo3_html_doc.ico" -13 ICON "icons\\ooo3_chart_doc.ico" -14 ICON "icons\\ooo3_base_doc.ico" -15 ICON "icons\\ooo3_math_doc.ico" -16 ICON "icons\\ooo3_empty_tem.ico" -17 ICON "icons\\ooo3_macro_doc.ico" +2 ICON "icons\\oasis-text.ico" +3 ICON "icons\\oasis-text-template.ico" +4 ICON "icons\\oasis-spreadsheet.ico" +5 ICON "icons\\oasis-spreadsheet-template.ico" +6 ICON "icons\\oasis-drawing.ico" +7 ICON "icons\\oasis-drawing-template.ico" +8 ICON "icons\\oasis-presentation.ico" +9 ICON "icons\\oasis-presentation-template.ico" +10 ICON "icons\\oasis-presentation-template.ico" +11 ICON "icons\\oasis-master-document.ico" +12 ICON "icons\\oasis-web-template.ico" +13 ICON "icons\\oasis-empty-document.ico" +14 ICON "icons\\oasis-database.ico" +15 ICON "icons\\oasis-formula.ico" +16 ICON "icons\\empty-template.ico" +17 ICON "icons\\empty-document.ico" 18 ICON "icons\\ooo-configuration.ico" 19 ICON "icons\\ooo-open.ico" -20 ICON "icons\\ooo-image-doc.ico" +20 ICON "icons\\empty-document.ico" 21 ICON "icons\\ooo3_writer_app.ico" 22 ICON "icons\\ooo3_calc_app.ico" 23 ICON "icons\\ooo3_draw_app.ico" 24 ICON "icons\\ooo3_impress_app.ico" 25 ICON "icons\\ooo3_math_app.ico" 26 ICON "icons\\ooo3_base_app.ico" -27 ICON "icons\\ooo3_empty_doc.ico" -28 ICON "icons\\ooo11-writer-doc.ico" -29 ICON "icons\\ooo11-writer-tem.ico" -30 ICON "icons\\ooo11-calc-doc.ico" -31 ICON "icons\\ooo11-calc-tem.ico" -32 ICON "icons\\ooo11-draw-doc.ico" -33 ICON "icons\\ooo11-draw-tem.ico" -34 ICON "icons\\ooo11-impress-doc.ico" -35 ICON "icons\\ooo11-impress-tem.ico" -36 ICON "icons\\ooo11-master-doc.ico" -37 ICON "icons\\ooo11-chart-doc.ico" -38 ICON "icons\\ooo11-base-doc.ico" -39 ICON "icons\\ooo11-math-doc.ico" +27 ICON "icons\\oasis-empty-document.ico" +28 ICON "icons\\text.ico" +29 ICON "icons\\text-template.ico" +30 ICON "icons\\spreadsheet.ico" +31 ICON "icons\\spreadsheet-template.ico" +32 ICON "icons\\drawing.ico" +33 ICON "icons\\drawing-template.ico" +34 ICON "icons\\presentation.ico" +35 ICON "icons\\presentation-template.ico" +36 ICON "icons\\master-document.ico" +37 ICON "icons\\empty-document.ico" +38 ICON "icons\\database.ico" +39 ICON "icons\\formula.ico" 40 ICON "icons\\oxt-extension.ico" diff --git a/desktop/util/ooverinfo2.rc b/desktop/util/ooverinfo2.rc index 27fb7ae5c1d0..d19603d54855 100644 --- a/desktop/util/ooverinfo2.rc +++ b/desktop/util/ooverinfo2.rc @@ -2,7 +2,7 @@ * * 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 * @@ -48,42 +48,43 @@ // ----------------------------------------------------------------------- -ICON 2 "icons/ooo-writer-doc.ico" -ICON 3 "icons/ooo-writer-tem.ico" -ICON 4 "icons/ooo-calc-doc.ico" -ICON 5 "icons/ooo-calc-tem.ico" -ICON 6 "icons/ooo-draw-doc.ico" -ICON 7 "icons/ooo-draw-tem.ico" -ICON 8 "icons/ooo-impress-doc.ico" -ICON 9 "icons/ooo-impress-tem.ico" -ICON 10 "icons/ooo-impress-doc.ico" -//ICON 11 "icons/ooo-global-doc.ico" -//ICON 12 "icons/ooo-html-doc.ico" -ICON 13 "icons/ooo-chart-doc.ico" -ICON 14 "icons/ooo-base-doc.ico" -ICON 15 "icons/ooo-math-doc.ico" -ICON 16 "icons/ooo-empty-tem.ico" -ICON 17 "icons/ooo-macro-doc.ico" +ICON 2 "icons/oasis-text.ico" +ICON 3 "icons/oasis-text-template.ico" +ICON 4 "icons/oasis-spreadsheet.ico" +ICON 5 "icons/oasis-spreadsheet-template.ico" +ICON 6 "icons/oasis-drawing.ico" +ICON 7 "icons/oasis-drawing-template.ico" +ICON 8 "icons/oasis-presentation.ico" +ICON 9 "icons/oasis-presentation-template.ico" +ICON 10 "icons/oasis-presentation-template.ico" +// ICON 11 "icons/oasis-master-document.ico" +// ICON 12 "icons/oasis-web-template.ico" +ICON 13 "icons/oasis-empty-document.ico" +ICON 14 "icons/oasis-database.ico" +ICON 15 "icons/oasis-formula.ico" +ICON 16 "icons/empty-template.ico" +ICON 17 "icons/empty-document.ico" ICON 18 "icons/ooo-configuration.ico" ICON 19 "icons/ooo-open.ico" -ICON 20 "icons/ooo-image-doc.ico" +ICON 20 "icons/empty-document.ico" ICON 21 "icons/ooo-writer-app.ico" ICON 22 "icons/ooo-calc-app.ico" ICON 23 "icons/ooo-draw-app.ico" ICON 24 "icons/ooo-impress-app.ico" ICON 25 "icons/ooo-math-app.ico" ICON 26 "icons/ooo-base-app.ico" -ICON 27 "icons/ooo-empty-doc.ico" -ICON 28 "icons/ooo11-writer-doc.ico" -ICON 29 "icons/ooo11-writer-tem.ico" -ICON 30 "icons/ooo11-calc-doc.ico" -ICON 31 "icons/ooo11-calc-tem.ico" -ICON 32 "icons/ooo11-draw-doc.ico" -ICON 33 "icons/ooo11-draw-tem.ico" -ICON 34 "icons/ooo11-impress-doc.ico" -ICON 35 "icons/ooo11-impress-tem.ico" -ICON 36 "icons/ooo11-master-doc.ico" -ICON 37 "icons/ooo11-chart-doc.ico" -ICON 38 "icons/ooo11-base-doc.ico" -ICON 39 "icons/ooo11-math-doc.ico" +ICON 27 "icons/oasis-empty-document.ico" +ICON 28 "icons/text.ico" +ICON 29 "icons/text-template.ico" +ICON 30 "icons/spreadsheet.ico" +ICON 31 "icons/spreadsheet-template.ico" +ICON 32 "icons/drawing.ico" +ICON 33 "icons/drawing-template.ico" +ICON 34 "icons/presentation.ico" +ICON 35 "icons/presentation-template.ico" +ICON 36 "icons/master-document.ico" +ICON 37 "icons/empty-document.ico" +ICON 38 "icons/database.ico" +ICON 39 "icons/formula.ico" +ICON 40 "icons/oxt-extension.ico" diff --git a/desktop/util/verinfo.rc b/desktop/util/verinfo.rc index 105933ff130d..d61493568490 100644 --- a/desktop/util/verinfo.rc +++ b/desktop/util/verinfo.rc @@ -2,7 +2,7 @@ * * 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 * @@ -68,25 +68,25 @@ VS_VERSION_INFO versioninfo block "040704E4" { // German StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #else block "040904E4" { // International StringTable - value "CompanyName", "Sun Microsystems, Inc.\0" + value "CompanyName", "Oracle, Inc.\0" value "FileDescription", "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\0" value "FileVersion", PPS(VER_LEVEL) "\0" value "ProductVersion", PPS(VER_LEVEL) "\0" value "OriginalFilename", "SOFFICE.EXE\0" value "InternalName", "SOFFICE\0" - value "LegalCopyright", S_CRIGHT " Sun Microsystems, Inc.\0" + value "LegalCopyright", S_CRIGHT " Oracle, Inc.\0" } #endif } diff --git a/desktop/win32/source/applauncher/launcher.cxx b/desktop/win32/source/applauncher/launcher.cxx index 107f4db0cab9..386fb7500655 100644 --- a/desktop/win32/source/applauncher/launcher.cxx +++ b/desktop/win32/source/applauncher/launcher.cxx @@ -2,13 +2,10 @@ * * 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: launcher.cxx,v $ - * $Revision: 1.10 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/makefile.mk b/desktop/win32/source/applauncher/makefile.mk index 278c8e23e95f..4285476475ca 100644 --- a/desktop/win32/source/applauncher/makefile.mk +++ b/desktop/win32/source/applauncher/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/ooo/makefile.mk b/desktop/win32/source/applauncher/ooo/makefile.mk index ad4c7c96b705..9c60ad1b48e4 100644 --- a/desktop/win32/source/applauncher/ooo/makefile.mk +++ b/desktop/win32/source/applauncher/ooo/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.8 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/ooo/verinfo.rc b/desktop/win32/source/applauncher/ooo/verinfo.rc index b96dc400c54d..ce698ba80333 100644 --- a/desktop/win32/source/applauncher/ooo/verinfo.rc +++ b/desktop/win32/source/applauncher/ooo/verinfo.rc @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2009 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * diff --git a/desktop/win32/source/applauncher/sbase.cxx b/desktop/win32/source/applauncher/sbase.cxx index db4b992f2d6d..8f50963ca3ff 100644 --- a/desktop/win32/source/applauncher/sbase.cxx +++ b/desktop/win32/source/applauncher/sbase.cxx @@ -2,13 +2,10 @@ * * 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: sbase.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/scalc.cxx b/desktop/win32/source/applauncher/scalc.cxx index ea8b1b464654..5795cb91d491 100644 --- a/desktop/win32/source/applauncher/scalc.cxx +++ b/desktop/win32/source/applauncher/scalc.cxx @@ -2,13 +2,10 @@ * * 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: scalc.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/sdraw.cxx b/desktop/win32/source/applauncher/sdraw.cxx index e2b47d461c5b..63061aa4994b 100644 --- a/desktop/win32/source/applauncher/sdraw.cxx +++ b/desktop/win32/source/applauncher/sdraw.cxx @@ -2,13 +2,10 @@ * * 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: sdraw.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/simpress.cxx b/desktop/win32/source/applauncher/simpress.cxx index 3305a04fa751..c3ff3f697225 100644 --- a/desktop/win32/source/applauncher/simpress.cxx +++ b/desktop/win32/source/applauncher/simpress.cxx @@ -2,13 +2,10 @@ * * 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: simpress.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/smath.cxx b/desktop/win32/source/applauncher/smath.cxx index ee81897bc499..c5574cdb26be 100644 --- a/desktop/win32/source/applauncher/smath.cxx +++ b/desktop/win32/source/applauncher/smath.cxx @@ -2,13 +2,10 @@ * * 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: smath.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/sweb.cxx b/desktop/win32/source/applauncher/sweb.cxx index 6490fc0522e0..a8728f0a1f72 100644 --- a/desktop/win32/source/applauncher/sweb.cxx +++ b/desktop/win32/source/applauncher/sweb.cxx @@ -2,13 +2,10 @@ * * 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: sweb.cxx,v $ - * $Revision: 1.2 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/swriter.cxx b/desktop/win32/source/applauncher/swriter.cxx index 058e72fbe8e2..21919e0f3bca 100644 --- a/desktop/win32/source/applauncher/swriter.cxx +++ b/desktop/win32/source/applauncher/swriter.cxx @@ -2,13 +2,10 @@ * * 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: swriter.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/applauncher/verinfo.rc b/desktop/win32/source/applauncher/verinfo.rc index f1e1bbcefe87..0db55c58c4b2 100644 --- a/desktop/win32/source/applauncher/verinfo.rc +++ b/desktop/win32/source/applauncher/verinfo.rc @@ -2,7 +2,7 @@ * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright 2009 by Sun Microsystems, Inc. + * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite * diff --git a/desktop/win32/source/extendloaderenvironment.cxx b/desktop/win32/source/extendloaderenvironment.cxx index e5b33f5aa2be..0092f04549f9 100644 --- a/desktop/win32/source/extendloaderenvironment.cxx +++ b/desktop/win32/source/extendloaderenvironment.cxx @@ -2,13 +2,10 @@ * * 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: extendloaderenvironment.cxx,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/extendloaderenvironment.hxx b/desktop/win32/source/extendloaderenvironment.hxx index f819047401c9..ba90a1b7bd7e 100644 --- a/desktop/win32/source/extendloaderenvironment.hxx +++ b/desktop/win32/source/extendloaderenvironment.hxx @@ -2,13 +2,10 @@ * * 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: extendloaderenvironment.hxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guiloader/genericloader.cxx b/desktop/win32/source/guiloader/genericloader.cxx index f190c6fd4468..1322c196d8a0 100644 --- a/desktop/win32/source/guiloader/genericloader.cxx +++ b/desktop/win32/source/guiloader/genericloader.cxx @@ -2,13 +2,10 @@ * * 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: genericloader.cxx,v $ - * $Revision: 1.6 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guiloader/makefile.mk b/desktop/win32/source/guiloader/makefile.mk index ff2a3ac1b0e1..5bb1c523ff19 100644 --- a/desktop/win32/source/guiloader/makefile.mk +++ b/desktop/win32/source/guiloader/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.7 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guistdio/guistdio.cxx b/desktop/win32/source/guistdio/guistdio.cxx index af0503bbe9c9..4a0518a75736 100644 --- a/desktop/win32/source/guistdio/guistdio.cxx +++ b/desktop/win32/source/guistdio/guistdio.cxx @@ -2,13 +2,10 @@ * * 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: guistdio.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guistdio/guistdio.inc b/desktop/win32/source/guistdio/guistdio.inc index 024b456efa99..7f2bbe9002d8 100644 --- a/desktop/win32/source/guistdio/guistdio.inc +++ b/desktop/win32/source/guistdio/guistdio.inc @@ -2,13 +2,10 @@ * * 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: guistdio.inc,v $ - * $Revision: 1.3.86.3 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guistdio/makefile.mk b/desktop/win32/source/guistdio/makefile.mk index 24772fb1ea52..660a48bcdca9 100644 --- a/desktop/win32/source/guistdio/makefile.mk +++ b/desktop/win32/source/guistdio/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/guistdio/unopkgio.cxx b/desktop/win32/source/guistdio/unopkgio.cxx index 71adec3914d3..59701d08e1ff 100644 --- a/desktop/win32/source/guistdio/unopkgio.cxx +++ b/desktop/win32/source/guistdio/unopkgio.cxx @@ -2,13 +2,10 @@ * * 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: unopkgio.cxx,v $ - * $Revision: 1.3.86.1 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/lwrapa.cxx b/desktop/win32/source/lwrapa.cxx index 1827f7ec419e..0d1931aafb75 100644 --- a/desktop/win32/source/lwrapa.cxx +++ b/desktop/win32/source/lwrapa.cxx @@ -2,13 +2,10 @@ * * 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: lwrapa.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/lwrapw.cxx b/desktop/win32/source/lwrapw.cxx index 5b7a3f50874d..734ae4497a39 100644 --- a/desktop/win32/source/lwrapw.cxx +++ b/desktop/win32/source/lwrapw.cxx @@ -2,13 +2,10 @@ * * 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: lwrapw.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/makefile.mk b/desktop/win32/source/makefile.mk index ccb165398c18..564ba319eb56 100644 --- a/desktop/win32/source/makefile.mk +++ b/desktop/win32/source/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/officeloader/makefile.mk b/desktop/win32/source/officeloader/makefile.mk index 8700867f8a04..10758727b743 100644 --- a/desktop/win32/source/officeloader/makefile.mk +++ b/desktop/win32/source/officeloader/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/officeloader/officeloader.cxx b/desktop/win32/source/officeloader/officeloader.cxx index 3f5af626e0fc..f36bfc134ded 100644 --- a/desktop/win32/source/officeloader/officeloader.cxx +++ b/desktop/win32/source/officeloader/officeloader.cxx @@ -2,13 +2,10 @@ * * 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: officeloader.cxx,v $ - * $Revision: 1.18 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/rebase/Resource.h b/desktop/win32/source/rebase/Resource.h index 2ebbc5c5bfb7..b8ad7b0f824a 100644 --- a/desktop/win32/source/rebase/Resource.h +++ b/desktop/win32/source/rebase/Resource.h @@ -2,13 +2,10 @@ * * 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: Resource.h,v $ - * $Revision: 1.7 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/rebase/makefile.mk b/desktop/win32/source/rebase/makefile.mk index dbab5a5d0921..724ea0edf465 100644 --- a/desktop/win32/source/rebase/makefile.mk +++ b/desktop/win32/source/rebase/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.4 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/rebase/rebase.cxx b/desktop/win32/source/rebase/rebase.cxx index e651ad0affcc..98d31a337d4f 100644 --- a/desktop/win32/source/rebase/rebase.cxx +++ b/desktop/win32/source/rebase/rebase.cxx @@ -2,13 +2,10 @@ * * 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: md5.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -27,164 +24,164 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -
-#include "precompiled_desktop.hxx"
-#define UNICODE
-#define _UNICODE
-
-#define WIN32_LEAN_AND_MEAN
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-#include <windows.h>
-#include <shellapi.h>
-#include <imagehlp.h>
-#include <wchar.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#include <time.h>
-#include "sal/config.h"
-#include "tools/pathutils.hxx"
-
-#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
-#define MY_STRING(s) (s), MY_LENGTH(s)
-
-const int FORMAT_MESSAGE_SIZE = 4096;
-const DWORD PE_Signature = 0x00004550;
-const DWORD BASEVIRTUALADDRESS = 0x10000000;
-
-namespace
-{
-
-bool IsValidHandle( HANDLE handle )
-{
- return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle));
-}
-
-void fail()
-{
- LPWSTR buf = NULL;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
- MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
- LocalFree(buf);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase)
-{
- ULONG ulOldImageSize;
- ULONG_PTR lpOldImageBase;
- ULONG ulNewImageSize;
- ULONG_PTR lpNewImageBase = nNewImageBase;
- ULONG ulDateTimeStamp = 0;
- bool bResult(false);
-
- char cszFilePath[_MAX_PATH+1] = {0};
- int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL);
-
- if (nResult != 0)
- {
- BOOL bResult = ReBaseImage(
- cszFilePath,
- "",
- TRUE,
- FALSE,
- FALSE,
- 0,
- &ulOldImageSize,
- &lpOldImageBase,
- &ulNewImageSize,
- &lpNewImageBase,
- ulDateTimeStamp );
- }
-
- return bResult;
-}
-
-wchar_t* getBrandPath(wchar_t * path)
-{
- DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
- if (n == 0 || n >= MAX_PATH) {
- exit(EXIT_FAILURE);
- }
- return tools::filename(path);
-}
-
-void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase )
-{
- wchar_t szPattern[MAX_PATH];
- wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
- if ( lpLastSlash )
- {
- size_t len = lpLastSlash - pszFolder + 1;
- wcsncpy( szPattern, pszFolder, len );
- wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len );
- }
-
- WIN32_FIND_DATA aFindFileData;
- HANDLE hFind = FindFirstFile( szPattern, &aFindFileData );
-
- if ( IsValidHandle(hFind) )
- {
- BOOL fSuccess = false;
-
- do
- {
- wchar_t szLibFilePath[MAX_PATH];
- wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' );
- if ( lpLastSlash )
- {
- size_t len = lpLastSlash - pszFolder + 1;
- wcsncpy( szLibFilePath, pszFolder, len );
- wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len );
- }
-
- rebaseImage( szLibFilePath, nNewImageBase );
- fSuccess = FindNextFile( hFind, &aFindFileData );
- }
- while ( fSuccess );
-
- FindClose( hFind );
- }
-}
-
-}
-
-extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int )
-{
- wchar_t path[MAX_PATH];
-
- wchar_t * pathEnd = getBrandPath(path);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if ( pathEnd == NULL )
- return 0;
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if ( pathEnd == NULL )
- return 0;
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL)
- fail();
- rebaseImagesInFolder(path, BASEVIRTUALADDRESS);
-
- return 0;
-}
+ +#include "precompiled_desktop.hxx" +#define UNICODE +#define _UNICODE + +#define WIN32_LEAN_AND_MEAN +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +#include <windows.h> +#include <shellapi.h> +#include <imagehlp.h> +#include <wchar.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif + +#include <time.h> +#include "sal/config.h" +#include "tools/pathutils.hxx" + +#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) +#define MY_STRING(s) (s), MY_LENGTH(s) + +const int FORMAT_MESSAGE_SIZE = 4096; +const DWORD PE_Signature = 0x00004550; +const DWORD BASEVIRTUALADDRESS = 0x10000000; + +namespace +{ + +bool IsValidHandle( HANDLE handle ) +{ + return ((NULL != handle) && (INVALID_HANDLE_VALUE != handle)); +} + +void fail() +{ + LPWSTR buf = NULL; + FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, + GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL); + MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR); + LocalFree(buf); + TerminateProcess(GetCurrentProcess(), 255); +} + +bool rebaseImage( wchar_t* pszFilePath, ULONG nNewImageBase) +{ + ULONG ulOldImageSize; + ULONG_PTR lpOldImageBase; + ULONG ulNewImageSize; + ULONG_PTR lpNewImageBase = nNewImageBase; + ULONG ulDateTimeStamp = 0; + bool bResult(false); + + char cszFilePath[_MAX_PATH+1] = {0}; + int nResult = WideCharToMultiByte(CP_ACP, 0, pszFilePath, -1, cszFilePath, _MAX_PATH, NULL, NULL); + + if (nResult != 0) + { + BOOL bResult = ReBaseImage( + cszFilePath, + "", + TRUE, + FALSE, + FALSE, + 0, + &ulOldImageSize, + &lpOldImageBase, + &ulNewImageSize, + &lpNewImageBase, + ulDateTimeStamp ); + } + + return bResult; +} + +wchar_t* getBrandPath(wchar_t * path) +{ + DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH); + if (n == 0 || n >= MAX_PATH) { + exit(EXIT_FAILURE); + } + return tools::filename(path); +} + +void rebaseImagesInFolder( wchar_t* pszFolder, DWORD nNewImageBase ) +{ + wchar_t szPattern[MAX_PATH]; + wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); + if ( lpLastSlash ) + { + size_t len = lpLastSlash - pszFolder + 1; + wcsncpy( szPattern, pszFolder, len ); + wcsncpy( szPattern + len, TEXT("*.dll"), sizeof(szPattern)/sizeof(szPattern[0]) - len ); + } + + WIN32_FIND_DATA aFindFileData; + HANDLE hFind = FindFirstFile( szPattern, &aFindFileData ); + + if ( IsValidHandle(hFind) ) + { + BOOL fSuccess = false; + + do + { + wchar_t szLibFilePath[MAX_PATH]; + wchar_t *lpLastSlash = wcsrchr( pszFolder, '\\' ); + if ( lpLastSlash ) + { + size_t len = lpLastSlash - pszFolder + 1; + wcsncpy( szLibFilePath, pszFolder, len ); + wcsncpy( szLibFilePath + len, aFindFileData.cFileName, sizeof(szLibFilePath)/sizeof(szLibFilePath[0]) - len ); + } + + rebaseImage( szLibFilePath, nNewImageBase ); + fSuccess = FindNextFile( hFind, &aFindFileData ); + } + while ( fSuccess ); + + FindClose( hFind ); + } +} + +} + +extern "C" int APIENTRY WinMain( HINSTANCE, HINSTANCE, LPSTR, int ) +{ + wchar_t path[MAX_PATH]; + + wchar_t * pathEnd = getBrandPath(path); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"")) == NULL) + fail(); + rebaseImagesInFolder(path, BASEVIRTUALADDRESS); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL) + fail(); + pathEnd = tools::resolveLink(path); + + if ( pathEnd == NULL ) + return 0; + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\")) == NULL) + fail(); + rebaseImagesInFolder(path, BASEVIRTUALADDRESS); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) + fail(); + pathEnd = tools::resolveLink(path); + + if ( pathEnd == NULL ) + return 0; + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\")) == NULL) + fail(); + rebaseImagesInFolder(path, BASEVIRTUALADDRESS); + + return 0; +} diff --git a/desktop/win32/source/rebase/rebasegui.cxx b/desktop/win32/source/rebase/rebasegui.cxx index feba7556b74c..99585c105b64 100644 --- a/desktop/win32/source/rebase/rebasegui.cxx +++ b/desktop/win32/source/rebase/rebasegui.cxx @@ -2,13 +2,10 @@ * * 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: md5.cxx,v $ - * $Revision: 1.8 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -27,174 +24,174 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -
-#include "precompiled_desktop.hxx"
-
-#define UNICODE 1
-#define _UNICODE 1
-
-#ifndef _WINDOWS_
-# define WIN32_LEAN_AND_MEAN
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#endif
-# include <windows.h>
-# include <shellapi.h>
-# include <wchar.h>
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-#endif
-
-#include "Resource.h"
-#include <time.h>
-#include "sal/config.h"
-#include "tools/pathutils.hxx"
-
-const DWORD PE_Signature = 0x00004550;
-
-#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
-#define MY_STRING(s) (s), MY_LENGTH(s)
-#define MAX_STR_CAPTION 256
-#define MAX_TEXT_LENGTH 1024
-
-static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg)
-{
- MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-static void fail()
-{
- LPWSTR buf = NULL;
- FormatMessageW(
- FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL,
- GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL);
- MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR);
- LocalFree(buf);
- TerminateProcess(GetCurrentProcess(), 255);
-}
-
-static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath )
-{
- HANDLE hFile;
- HANDLE hFileMapping;
- LPVOID lpFileBase = 0;
- PIMAGE_DOS_HEADER lpDosHeader;
- PIMAGE_NT_HEADERS lpNTHeader;
-
- hFile = CreateFile(pszFilePath,
- GENERIC_READ, FILE_SHARE_READ, NULL,
- OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
- 0);
-
- if ( hFile == INVALID_HANDLE_VALUE )
- {
- return NULL;
- }
-
- hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
- if ( hFileMapping == 0 )
- {
- CloseHandle(hFile);
- return NULL;
- }
-
- lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0);
- if ( lpFileBase == 0 )
- {
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
- return NULL;
- }
-
- lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase;
- if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE )
- {
- lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew);
- if (lpNTHeader->Signature == PE_Signature )
- lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase );
- }
-
- UnmapViewOfFile(lpFileBase);
- CloseHandle(hFileMapping);
- CloseHandle(hFile);
-
- return lpFileBase;
-}
-
-static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA)
-{
- LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath);
- if ( lpImageVBA == lpVBA )
- return true;
- else
- return false;
-}
-
-static wchar_t* getBrandPath(wchar_t * pszPath)
-{
- DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH);
- if (n == 0 || n >= MAX_PATH) {
- exit(EXIT_FAILURE);
- }
- return tools::filename(pszPath);
-}
-
-extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int )
-{
- wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ];
- pAppTitle[0] = '\0';
- LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION );
-
- wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextServer[0] = '\0';
- LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH );
-
- wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextClient[0] = '\0';
- LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH );
-
- wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ];
- pTextNoInstallation[0] = '\0';
- LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH );
-
- LPVOID VBA = (void*)0x10000000;
- wchar_t path[MAX_PATH];
-
- wchar_t * pathEnd = getBrandPath(path);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL)
- fail();
- bool bFast = checkImageVirtualBaseAddress(path, VBA);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if (pathEnd == NULL)
- failPath(pAppTitle, pTextNoInstallation);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL)
- fail();
- bFast &= checkImageVirtualBaseAddress(path, VBA);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL)
- fail();
- pathEnd = tools::resolveLink(path);
-
- if (pathEnd == NULL)
- failPath(pAppTitle, pTextNoInstallation);
-
- if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL)
- fail();
- bFast &= checkImageVirtualBaseAddress(path, VBA);
-
- const wchar_t* pOutput = pTextClient;
- if (!bFast)
- pOutput = pTextServer;
-
- MessageBoxW( NULL, pOutput, pAppTitle, MB_OK );
-
- return 0;
-}
+ +#include "precompiled_desktop.hxx" + +#define UNICODE 1 +#define _UNICODE 1 + +#ifndef _WINDOWS_ +# define WIN32_LEAN_AND_MEAN +#if defined _MSC_VER +#pragma warning(push, 1) +#endif +# include <windows.h> +# include <shellapi.h> +# include <wchar.h> +#if defined _MSC_VER +#pragma warning(pop) +#endif +#endif + +#include "Resource.h" +#include <time.h> +#include "sal/config.h" +#include "tools/pathutils.hxx" + +const DWORD PE_Signature = 0x00004550; + +#define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1) +#define MY_STRING(s) (s), MY_LENGTH(s) +#define MAX_STR_CAPTION 256 +#define MAX_TEXT_LENGTH 1024 + +static void failPath(wchar_t* pszAppTitle, wchar_t* pszMsg) +{ + MessageBoxW(NULL, pszMsg, pszAppTitle, MB_OK | MB_ICONERROR); + TerminateProcess(GetCurrentProcess(), 255); +} + +static void fail() +{ + LPWSTR buf = NULL; + FormatMessageW( + FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, + GetLastError(), 0, reinterpret_cast< LPWSTR >(&buf), 0, NULL); + MessageBoxW(NULL, buf, NULL, MB_OK | MB_ICONERROR); + LocalFree(buf); + TerminateProcess(GetCurrentProcess(), 255); +} + +static LPVOID getVirtualBaseAddress( wchar_t* pszFilePath ) +{ + HANDLE hFile; + HANDLE hFileMapping; + LPVOID lpFileBase = 0; + PIMAGE_DOS_HEADER lpDosHeader; + PIMAGE_NT_HEADERS lpNTHeader; + + hFile = CreateFile(pszFilePath, + GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, + 0); + + if ( hFile == INVALID_HANDLE_VALUE ) + { + return NULL; + } + + hFileMapping = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL); + if ( hFileMapping == 0 ) + { + CloseHandle(hFile); + return NULL; + } + + lpFileBase = MapViewOfFile(hFileMapping, FILE_MAP_READ, 0, 0, 0); + if ( lpFileBase == 0 ) + { + CloseHandle(hFileMapping); + CloseHandle(hFile); + return NULL; + } + + lpDosHeader = (PIMAGE_DOS_HEADER)lpFileBase; + if ( lpDosHeader->e_magic == IMAGE_DOS_SIGNATURE ) + { + lpNTHeader = (PIMAGE_NT_HEADERS)((char*)lpDosHeader + lpDosHeader->e_lfanew); + if (lpNTHeader->Signature == PE_Signature ) + lpFileBase = reinterpret_cast<LPVOID>( lpNTHeader->OptionalHeader.ImageBase ); + } + + UnmapViewOfFile(lpFileBase); + CloseHandle(hFileMapping); + CloseHandle(hFile); + + return lpFileBase; +} + +static bool checkImageVirtualBaseAddress(wchar_t* pszFilePath, LPVOID lpVBA) +{ + LPVOID lpImageVBA = getVirtualBaseAddress(pszFilePath); + if ( lpImageVBA == lpVBA ) + return true; + else + return false; +} + +static wchar_t* getBrandPath(wchar_t * pszPath) +{ + DWORD n = GetModuleFileNameW(NULL, pszPath, MAX_PATH); + if (n == 0 || n >= MAX_PATH) { + exit(EXIT_FAILURE); + } + return tools::filename(pszPath); +} + +extern "C" int APIENTRY WinMain( HINSTANCE hInst, HINSTANCE, LPSTR, int ) +{ + wchar_t* pAppTitle = new wchar_t[ MAX_STR_CAPTION ]; + pAppTitle[0] = '\0'; + LoadString( hInst, IDS_APP_TITLE, pAppTitle, MAX_STR_CAPTION ); + + wchar_t* pTextServer = new wchar_t[ MAX_TEXT_LENGTH ]; + pTextServer[0] = '\0'; + LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_SERVER, pTextServer, MAX_TEXT_LENGTH ); + + wchar_t* pTextClient = new wchar_t[ MAX_TEXT_LENGTH ]; + pTextClient[0] = '\0'; + LoadString( hInst, IDS_MSG_OPTIMIZED_FOR_CLIENT, pTextClient, MAX_TEXT_LENGTH ); + + wchar_t* pTextNoInstallation = new wchar_t[ MAX_TEXT_LENGTH ]; + pTextNoInstallation[0] = '\0'; + LoadString( hInst, IDS_MSG_NO_INSTALLATION_FOUND, pTextNoInstallation, MAX_TEXT_LENGTH ); + + LPVOID VBA = (void*)0x10000000; + wchar_t path[MAX_PATH]; + + wchar_t * pathEnd = getBrandPath(path); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"libxml2.dll")) == NULL) + fail(); + bool bFast = checkImageVirtualBaseAddress(path, VBA); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) == NULL) + fail(); + pathEnd = tools::resolveLink(path); + + if (pathEnd == NULL) + failPath(pAppTitle, pTextNoInstallation); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\program\\vclmi.dll")) == NULL) + fail(); + bFast &= checkImageVirtualBaseAddress(path, VBA); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) + fail(); + pathEnd = tools::resolveLink(path); + + if (pathEnd == NULL) + failPath(pAppTitle, pTextNoInstallation); + + if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin\\sal3.dll")) == NULL) + fail(); + bFast &= checkImageVirtualBaseAddress(path, VBA); + + const wchar_t* pOutput = pTextClient; + if (!bFast) + pOutput = pTextServer; + + MessageBoxW( NULL, pOutput, pAppTitle, MB_OK ); + + return 0; +} diff --git a/desktop/win32/source/rwrapa.cxx b/desktop/win32/source/rwrapa.cxx index e3000dcbcff7..de57b2b3f2dc 100644 --- a/desktop/win32/source/rwrapa.cxx +++ b/desktop/win32/source/rwrapa.cxx @@ -2,13 +2,10 @@ * * 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: rwrapa.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/rwrapw.cxx b/desktop/win32/source/rwrapw.cxx index bd40fbba03c4..712d2f954efc 100644 --- a/desktop/win32/source/rwrapw.cxx +++ b/desktop/win32/source/rwrapw.cxx @@ -2,13 +2,10 @@ * * 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: rwrapw.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/Resource.h b/desktop/win32/source/setup/Resource.h index 99ef720451f3..a40d72994429 100644 --- a/desktop/win32/source/setup/Resource.h +++ b/desktop/win32/source/setup/Resource.h @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/win32/source/setup/makefile.mk b/desktop/win32/source/setup/makefile.mk index d26c9c953861..d9105724035c 100644 --- a/desktop/win32/source/setup/makefile.mk +++ b/desktop/win32/source/setup/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.12 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/setup.cpp b/desktop/win32/source/setup/setup.cpp index c51dcd105bfd..edc27751b110 100644 --- a/desktop/win32/source/setup/setup.cpp +++ b/desktop/win32/source/setup/setup.cpp @@ -2,13 +2,10 @@ * * 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: setup.cpp,v $ - * $Revision: 1.16 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify @@ -1981,7 +1978,30 @@ boolean SetupAppX::InstallRuntimes() TCHAR *sRuntimePath = 0; SYSTEM_INFO siSysInfo; - GetNativeSystemInfo(&siSysInfo); + HMODULE hKernel32 = ::LoadLibrary(_T("Kernel32.dll")); + if ( hKernel32 != NULL ) + { + typedef void (CALLBACK* pfnGetNativeSystemInfo_t)(LPSYSTEM_INFO); + pfnGetNativeSystemInfo_t pfnGetNativeSystemInfo; + pfnGetNativeSystemInfo = (pfnGetNativeSystemInfo_t)::GetProcAddress(hKernel32, "GetNativeSystemInfo"); + if ( pfnGetNativeSystemInfo != NULL ) + { + pfnGetNativeSystemInfo(&siSysInfo); + } + else + { + // GetNativeSystemInfo does not exist. Maybe the code is running under Windows 2000. + // Use GetSystemInfo instead. + GetSystemInfo(&siSysInfo); + } + FreeLibrary(hKernel32); + } + else + { + // Failed to check Kernel32.dll. There may be something wrong. + // Use GetSystemInfo instead anyway. + GetSystemInfo(&siSysInfo); + } OutputDebugStringFormat( TEXT( "found architecture<%d>\r\n" ), siSysInfo.wProcessorArchitecture ); diff --git a/desktop/win32/source/setup/setup.hxx b/desktop/win32/source/setup/setup.hxx index 169254db87ab..1744b1aa427a 100644 --- a/desktop/win32/source/setup/setup.hxx +++ b/desktop/win32/source/setup/setup.hxx @@ -2,13 +2,10 @@ * * 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: setup.hxx,v $ - * $Revision: 1.12 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/setup_a.cxx b/desktop/win32/source/setup/setup_a.cxx index 91f4fdc9a141..2264e96dd919 100644 --- a/desktop/win32/source/setup/setup_a.cxx +++ b/desktop/win32/source/setup/setup_a.cxx @@ -2,13 +2,10 @@ * * 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: setup_a.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/setup_help.hxx b/desktop/win32/source/setup/setup_help.hxx index c3ccdaf53cbc..2a638ead0811 100644 --- a/desktop/win32/source/setup/setup_help.hxx +++ b/desktop/win32/source/setup/setup_help.hxx @@ -2,13 +2,10 @@ * * 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: setup_help.hxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/setup_main.cxx b/desktop/win32/source/setup/setup_main.cxx index 6c96bde46b12..2750c87ae08a 100644 --- a/desktop/win32/source/setup/setup_main.cxx +++ b/desktop/win32/source/setup/setup_main.cxx @@ -2,7 +2,7 @@ * * 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 * diff --git a/desktop/win32/source/setup/setup_main.hxx b/desktop/win32/source/setup/setup_main.hxx index 28200fcae757..525d5579a256 100644 --- a/desktop/win32/source/setup/setup_main.hxx +++ b/desktop/win32/source/setup/setup_main.hxx @@ -2,13 +2,10 @@ * * 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: setup_main.hxx,v $ - * $Revision: 1.9 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/setup/setup_w.cxx b/desktop/win32/source/setup/setup_w.cxx index 67270cae7c0b..a21dbd685f46 100644 --- a/desktop/win32/source/setup/setup_w.cxx +++ b/desktop/win32/source/setup/setup_w.cxx @@ -2,13 +2,10 @@ * * 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: setup_w.cxx,v $ - * $Revision: 1.5 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/sowrapper.cxx b/desktop/win32/source/sowrapper.cxx index ad13747f51c2..4b0292be41a6 100644 --- a/desktop/win32/source/sowrapper.cxx +++ b/desktop/win32/source/sowrapper.cxx @@ -2,13 +2,10 @@ * * 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: sowrapper.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/unoinfo.cxx b/desktop/win32/source/unoinfo.cxx index d4458212c3c3..c2a98802ccd3 100644 --- a/desktop/win32/source/unoinfo.cxx +++ b/desktop/win32/source/unoinfo.cxx @@ -2,13 +2,10 @@ * * 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: unoinfo.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/wrappera.cxx b/desktop/win32/source/wrappera.cxx index efc3df21d660..e121ce12172a 100644 --- a/desktop/win32/source/wrappera.cxx +++ b/desktop/win32/source/wrappera.cxx @@ -2,13 +2,10 @@ * * 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: wrappera.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/win32/source/wrapperw.cxx b/desktop/win32/source/wrapperw.cxx index 4c7d47e8abf3..700f79f60355 100644 --- a/desktop/win32/source/wrapperw.cxx +++ b/desktop/win32/source/wrapperw.cxx @@ -2,13 +2,10 @@ * * 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: wrapperw.cxx,v $ - * $Revision: 1.4 $ - * * This file is part of OpenOffice.org. * * OpenOffice.org is free software: you can redistribute it and/or modify diff --git a/desktop/zipintro/makefile.mk b/desktop/zipintro/makefile.mk index 70e5c801b9f4..fef106d1e09d 100644 --- a/desktop/zipintro/makefile.mk +++ b/desktop/zipintro/makefile.mk @@ -2,14 +2,10 @@ # # 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: makefile.mk,v $ -# -# $Revision: 1.6 $ -# # This file is part of OpenOffice.org. # # OpenOffice.org is free software: you can redistribute it and/or modify @@ -40,29 +36,29 @@ TARGET=zipintro DEFAULT_FLAVOURS=dev dev_nologo nologo broffice dev_broffice nologo_broffice nologo_dev_broffice intro ZIP1LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP2LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP3LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP4LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/$(RSCDEFIMG)$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP5LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP6LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP7LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/nologo_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP8LIST= \ - $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo_broffice$/introabout$/intro.bmp $(INTRO_BITMAPS)) \ - $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.bmp $(ABOUT_BITMAPS)) + $(null,$(INTRO_BITMAPS) $(MISC)$/ooo_custom_images$/dev_nologo_broffice$/introabout$/intro.png $(INTRO_BITMAPS)) \ + $(null,$(ABOUT_BITMAPS) $(MISC)$/ooo_custom_images$/broffice$/introabout$/about.png $(ABOUT_BITMAPS)) ZIP1TARGET=dev_intro ZIP1DEPS=$(ZIP1LIST) @@ -133,3 +129,6 @@ $(MISC)$/%.bmp : $(SOLARSRC)$/%.bmp @@-$(MKDIRHIER) $(@:d) $(COPY) $< $@ +$(MISC)$/%.png : $(SOLARSRC)$/%.png + @@-$(MKDIRHIER) $(@:d) + $(COPY) $< $@ |