1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 29 #include <unotools/moduleoptions.hxx> 30 31 #include <unotools/dynamicmenuoptions.hxx> 32 33 #include "shutdownicon.hxx" 34 #include <comphelper/processfactory.hxx> 35 #include <com/sun/star/uno/Reference.h> 36 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 37 #include <com/sun/star/task/XJob.hpp> 38 #include <com/sun/star/beans/NamedValue.hpp> 39 40 41 using namespace ::rtl; 42 using namespace ::com::sun::star::uno; 43 using namespace ::com::sun::star::task; 44 using namespace ::com::sun::star::lang; 45 using namespace ::com::sun::star::beans; 46 using namespace ::osl; 47 48 // 49 // This ObjectID must match the one created in WarpIN scripts!! 50 // 51 #define QUICKSTART_OBJID "OO2_QUICKSTART" 52 53 bool ShutdownIcon::IsQuickstarterInstalled() 54 { 55 HOBJECT hObject; 56 // Check quickstart icon presence 57 hObject = WinQueryObject( "<" QUICKSTART_OBJID ">"); 58 if (hObject) 59 return true; 60 // object not found, quickstart not available 61 return false; 62 } 63 64 void ShutdownIcon::SetAutostartOs2( bool bActivate ) 65 { 66 HOBJECT hObject; 67 68 if( bActivate && IsQuickstarterInstalled() ) 69 { 70 // place quickstart shadow in the startup folder 71 hObject = WinCreateObject( "WPShadow", "dummy", 72 "OBJECTID=<" QUICKSTART_OBJID "_SHW>;SHADOWID=<" QUICKSTART_OBJID ">;", 73 "<WP_START>", 74 CO_UPDATEIFEXISTS); 75 } 76 else 77 { 78 // remove quickstart shadow from the startup folder 79 hObject = WinQueryObject( "<" QUICKSTART_OBJID "_SHW>"); 80 if (hObject) 81 WinDestroyObject( hObject); 82 } 83 } 84 85 bool ShutdownIcon::GetAutostartOs2( ) 86 { 87 // check for quickstart shadow in the startup folder 88 if (WinQueryObject( "<" QUICKSTART_OBJID "_SHW>")) 89 return true; 90 else 91 return false; 92 } 93 94 95