blob: 51c778e1dd5311e17f6784c1e50ee693db2aa21b (
plain)
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
|
/* -*- 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 INCLUDED_SFX2_SOURCE_APPL_SHUTDOWNICON_HXX
#define INCLUDED_SFX2_SOURCE_APPL_SHUTDOWNICON_HXX
#include <com/sun/star/frame/XTerminateListener.hpp>
#include <com/sun/star/frame/XDesktop2.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <com/sun/star/uno/XComponentContext.hpp>
#include <rtl/ustring.hxx>
#include <rtl/ref.hxx>
#include <comphelper/compbase.hxx>
#include <tools/link.hxx>
#include <memory>
extern "C" {
void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray();
void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray();
}
namespace sfx2
{
class FileDialogHelper;
}
typedef comphelper::WeakComponentImplHelper<
css::lang::XInitialization,
css::frame::XTerminateListener,
css::lang::XServiceInfo,
css::beans::XFastPropertySet > ShutdownIconServiceBase;
inline constexpr OUStringLiteral WRITER_URL = u"private:factory/swriter";
inline constexpr OUStringLiteral CALC_URL = u"private:factory/scalc";
inline constexpr OUStringLiteral IMPRESS_URL = u"private:factory/simpress";
inline constexpr OUStringLiteral IMPRESS_WIZARD_URL = u"private:factory/simpress?slot=6686";
inline constexpr OUStringLiteral DRAW_URL = u"private:factory/sdraw";
inline constexpr OUStringLiteral MATH_URL = u"private:factory/smath";
inline constexpr OUStringLiteral BASE_URL = u"private:factory/sdatabase?Interactive";
inline constexpr OUStringLiteral STARTMODULE_URL = u".uno:ShowStartModule";
class ShutdownIcon : public ShutdownIconServiceBase
{
bool m_bVeto;
bool m_bListenForTermination;
bool m_bSystemDialogs;
std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
css::uno::Reference< css::uno::XComponentContext > m_xContext;
static rtl::Reference<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:
explicit ShutdownIcon( const css::uno::Reference< css::uno::XComponentContext > & rxContext );
virtual ~ShutdownIcon() override;
virtual OUString SAL_CALL getImplementationName() override;
virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() 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 css::uno::Sequence< css::beans::PropertyValue >& =
css::uno::Sequence< css::beans::PropertyValue >( 0 ) );
static void FromTemplate();
static void SetAutostart( bool bActivate );
static bool GetAutostart();
static bool bModalMode;
/// @throws css::uno::Exception
void init();
static OUString GetUrlDescription( std::u16string_view aUrl );
void SetVeto( bool bVeto ) { m_bVeto = bVeto;}
void StartFileDialog();
DECL_LINK(DialogClosedHdl_Impl, sfx2::FileDialogHelper*, void);
static bool IsQuickstarterInstalled();
// Component Helper - force override
virtual void disposing(std::unique_lock<std::mutex>&) override;
// XEventListener
virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
// XTerminateListener
virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override;
virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override;
// XInitialization
virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
// XFastPropertySet
virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle,
const css::uno::Any& aValue ) override;
virtual css::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) override;
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
#ifdef _WIN32
static void EnableAutostartW32( const OUString &aShortcutName );
static OUString GetAutostartFolderNameW32();
#endif
};
extern "C" {
# ifdef _WIN32
// 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: */
|