1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __SHUTDOWNICON_HXX__
#define __SHUTDOWNICON_HXX__
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/lang/XEventListener.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <rtl/string.hxx>
#include <rtl/ustring.hxx>
#include <osl/mutex.hxx>
#include <sfx2/sfxuno.hxx>
#include <cppuhelper/compbase4.hxx>
#include <sfx2/dllapi.h>
#include <tools/link.hxx>
class ResMgr;
namespace sfx2
{
class FileDialogHelper;
}
typedef ::cppu::WeakComponentImplHelper4<
::com::sun::star::lang::XInitialization,
::com::sun::star::frame::XTerminateListener,
::com::sun::star::lang::XServiceInfo,
::com::sun::star::beans::XFastPropertySet > ShutdownIconServiceBase;
#if defined(USE_APP_SHORTCUTS)
#define WRITER_URL "private:factory/swriter"
#define CALC_URL "private:factory/scalc"
#define IMPRESS_URL "private:factory/simpress"
#define IMPRESS_WIZARD_URL "private:factory/simpress?slot=6686"
#define DRAW_URL "private:factory/sdraw"
#define MATH_URL "private:factory/smath"
#define BASE_URL "private:factory/sdatabase?Interactive"
#define STARTMODULE_URL ".uno:ShowStartModule"
#endif
class SFX2_DLLPUBLIC ShutdownIcon : public ShutdownIconServiceBase
{
::osl::Mutex m_aMutex;
bool m_bVeto;
bool m_bListenForTermination;
bool m_bSystemDialogs;
ResMgr* m_pResMgr;
sfx2::FileDialogHelper* m_pFileDlg;
::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
static ShutdownIcon *pShutdownIcon; // one instance
bool m_bInitialized;
void initSystray();
void deInitSystray();
static void EnterModalMode();
static void LeaveModalMode();
static OUString getShortcutName();
friend class SfxNotificationListener_Impl;
public:
ShutdownIcon( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & rxContext );
virtual ~ShutdownIcon();
virtual OUString SAL_CALL getImplementationName()
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName)
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames()
throw (css::uno::RuntimeException, std::exception) SAL_OVERRIDE;
static ShutdownIcon* getInstance();
static ShutdownIcon* createInstance();
static void terminateDesktop();
static void addTerminateListener();
static void FileOpen();
static void OpenURL( const OUString& aURL, const OUString& rTarget, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& =
::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >( 0 ) );
static void FromTemplate();
static void SetAutostart( bool bActivate );
static bool GetAutostart();
static bool bModalMode;
void init() throw( ::com::sun::star::uno::Exception );
OUString GetResString( int id );
OUString GetUrlDescription( const OUString& aUrl );
void SetVeto( bool bVeto ) { m_bVeto = bVeto;}
bool GetVeto() { return m_bVeto; }
void StartFileDialog();
sfx2::FileDialogHelper* GetFileDialog() const { return m_pFileDlg; }
DECL_STATIC_LINK(
ShutdownIcon, DialogClosedHdl_Impl, sfx2::FileDialogHelper*);
static bool IsQuickstarterInstalled();
// Component Helper - force override
virtual void SAL_CALL disposing() SAL_OVERRIDE;
// XEventListener
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XTerminateListener
virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& aEvent )
throw(::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& aEvent )
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
// XInitialization
virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
throw( ::com::sun::star::uno::Exception, std::exception ) SAL_OVERRIDE;
// XFastPropertySet
virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle,
const ::com::sun::star::uno::Any& aValue )
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::beans::PropertyVetoException,
::com::sun::star::lang::IllegalArgumentException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle )
throw (::com::sun::star::beans::UnknownPropertyException,
::com::sun::star::lang::WrappedTargetException,
::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
::com::sun::star::uno::Reference< ::com::sun::star::frame::XDesktop2 > m_xDesktop;
#ifdef WNT
static void EnableAutostartW32( const OUString &aShortcutName );
static OUString GetAutostartFolderNameW32();
#endif
};
extern "C" {
# ifdef WNT
// builtin win32 systray
void win32_init_sys_tray();
void win32_shutdown_sys_tray();
# elif defined MACOSX
void aqua_init_systray();
void aqua_shutdown_systray();
# endif
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|