Update ooo320-m1
[ooovba.git] / sfx2 / source / appl / shutdowniconOs2.cxx
blobae2c80b2a7995ac57b9cbb316bf1bb2b47acdd57
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: shutdowniconOs2.cxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #include <svtools/moduleoptions.hxx>
34 #include <svtools/dynamicmenuoptions.hxx>
36 #include "shutdownicon.hxx"
37 #include <comphelper/processfactory.hxx>
38 #include <com/sun/star/uno/Reference.h>
39 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
40 #include <com/sun/star/task/XJob.hpp>
41 #include <com/sun/star/beans/NamedValue.hpp>
44 using namespace ::rtl;
45 using namespace ::com::sun::star::uno;
46 using namespace ::com::sun::star::task;
47 using namespace ::com::sun::star::lang;
48 using namespace ::com::sun::star::beans;
49 using namespace ::osl;
52 // This ObjectID must match the one created in WarpIN scripts!!
54 #define QUICKSTART_OBJID "OO2_QUICKSTART"
56 bool ShutdownIcon::IsQuickstarterInstalled()
58 HOBJECT hObject;
59 // Check quickstart icon presence
60 hObject = WinQueryObject( "<" QUICKSTART_OBJID ">");
61 if (hObject)
62 return true;
63 // object not found, quickstart not available
64 return false;
67 void ShutdownIcon::SetAutostartOs2( bool bActivate )
69 HOBJECT hObject;
71 if( bActivate && IsQuickstarterInstalled() )
73 // place quickstart shadow in the startup folder
74 hObject = WinCreateObject( "WPShadow", "dummy",
75 "OBJECTID=<" QUICKSTART_OBJID "_SHW>;SHADOWID=<" QUICKSTART_OBJID ">;",
76 "<WP_START>",
77 CO_UPDATEIFEXISTS);
79 else
81 // remove quickstart shadow from the startup folder
82 hObject = WinQueryObject( "<" QUICKSTART_OBJID "_SHW>");
83 if (hObject)
84 WinDestroyObject( hObject);
88 bool ShutdownIcon::GetAutostartOs2( )
90 // check for quickstart shadow in the startup folder
91 if (WinQueryObject( "<" QUICKSTART_OBJID "_SHW>"))
92 return true;
93 else
94 return false;