LibreOffice Module sfx2 (master) 1
shutdownicon.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef INCLUDED_SFX2_SOURCE_APPL_SHUTDOWNICON_HXX
21#define INCLUDED_SFX2_SOURCE_APPL_SHUTDOWNICON_HXX
22
23#include <com/sun/star/frame/XTerminateListener.hpp>
24#include <com/sun/star/frame/XDesktop2.hpp>
25#include <com/sun/star/lang/XServiceInfo.hpp>
26#include <com/sun/star/lang/XInitialization.hpp>
27#include <com/sun/star/beans/XFastPropertySet.hpp>
28#include <com/sun/star/uno/XComponentContext.hpp>
29#include <rtl/ustring.hxx>
30#include <rtl/ref.hxx>
32#include <tools/link.hxx>
33#include <memory>
34
35extern "C" {
36
37void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray();
38void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray();
39
40}
41
42namespace sfx2
43{
44 class FileDialogHelper;
45}
46
48 css::lang::XInitialization,
49 css::frame::XTerminateListener,
50 css::lang::XServiceInfo,
51 css::beans::XFastPropertySet > ShutdownIconServiceBase;
52
53inline constexpr OUStringLiteral WRITER_URL = u"private:factory/swriter";
54inline constexpr OUStringLiteral CALC_URL = u"private:factory/scalc";
55inline constexpr OUStringLiteral IMPRESS_URL = u"private:factory/simpress";
56inline constexpr OUStringLiteral IMPRESS_WIZARD_URL = u"private:factory/simpress?slot=6686";
57inline constexpr OUStringLiteral DRAW_URL = u"private:factory/sdraw";
58inline constexpr OUStringLiteral MATH_URL = u"private:factory/smath";
59inline constexpr OUStringLiteral BASE_URL = u"private:factory/sdatabase?Interactive";
60inline constexpr OUStringLiteral STARTMODULE_URL = u".uno:ShowStartModule";
61
63{
64 bool m_bVeto;
67 std::unique_ptr<sfx2::FileDialogHelper> m_pFileDlg;
68 css::uno::Reference< css::uno::XComponentContext > m_xContext;
69 css::uno::Reference< css::frame::XDesktop2 > m_xDesktop;
70
72
74 void initSystray();
75 void deInitSystray();
76
77 static void EnterModalMode();
78 static void LeaveModalMode();
79 static OUString getShortcutName();
80
82
83 public:
84 explicit ShutdownIcon( css::uno::Reference< css::uno::XComponentContext > xContext );
85
86 virtual ~ShutdownIcon() override;
87
88 virtual OUString SAL_CALL getImplementationName() override;
89
90 virtual sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
91
92 virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
93
94 static ShutdownIcon* getInstance();
96
97 static void terminateDesktop();
98 static void addTerminateListener();
99
100 static void FileOpen();
101 static void OpenURL( const OUString& aURL, const OUString& rTarget, const css::uno::Sequence< css::beans::PropertyValue >& =
102 css::uno::Sequence< css::beans::PropertyValue >( 0 ) );
103 static void FromTemplate();
104
105 static void SetAutostart( bool bActivate );
106 static bool GetAutostart();
107 static bool bModalMode;
108
110 void init();
111
112 static OUString GetUrlDescription( std::u16string_view aUrl );
113
114 void SetVeto( bool bVeto ) { m_bVeto = bVeto;}
115
116 void StartFileDialog();
117 DECL_LINK(DialogClosedHdl_Impl, sfx2::FileDialogHelper*, void);
118
119 static bool IsQuickstarterInstalled();
120
121 // Component Helper - force override
122 virtual void disposing(std::unique_lock<std::mutex>&) override;
123
124 // XEventListener
125 virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override;
126
127 // XTerminateListener
128 virtual void SAL_CALL queryTermination( const css::lang::EventObject& aEvent ) override;
129 virtual void SAL_CALL notifyTermination( const css::lang::EventObject& aEvent ) override;
130
131 // XInitialization
132 virtual void SAL_CALL initialize( const css::uno::Sequence< css::uno::Any >& aArguments ) override;
133
134 // XFastPropertySet
135 virtual void SAL_CALL setFastPropertyValue( ::sal_Int32 nHandle,
136 const css::uno::Any& aValue ) override;
137 virtual css::uno::Any SAL_CALL getFastPropertyValue( ::sal_Int32 nHandle ) override;
138
139#ifdef _WIN32
140 static void EnableAutostartW32( const OUString &aShortcutName );
141 static OUString GetAutostartFolderNameW32();
142#endif
143};
144
145extern "C" {
146# ifdef _WIN32
147 // builtin win32 systray
148 void win32_init_sys_tray();
150# elif defined MACOSX
151 void aqua_init_systray();
153# endif
154}
155
156#endif
157
158/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void disposing(std::unique_lock< std::mutex > &) override
static bool IsQuickstarterInstalled()
static ShutdownIcon * createInstance()
virtual ~ShutdownIcon() override
static ShutdownIcon * getInstance()
static OUString getShortcutName()
virtual void SAL_CALL setFastPropertyValue(::sal_Int32 nHandle, const css::uno::Any &aValue) override
bool m_bListenForTermination
bool m_bSystemDialogs
void StartFileDialog()
static void terminateDesktop()
static rtl::Reference< ShutdownIcon > pShutdownIcon
css::uno::Reference< css::frame::XDesktop2 > m_xDesktop
css::uno::Reference< css::uno::XComponentContext > m_xContext
static void FromTemplate()
virtual void SAL_CALL queryTermination(const css::lang::EventObject &aEvent) override
std::unique_ptr< sfx2::FileDialogHelper > m_pFileDlg
static void addTerminateListener()
virtual void SAL_CALL notifyTermination(const css::lang::EventObject &aEvent) override
ShutdownIcon(css::uno::Reference< css::uno::XComponentContext > xContext)
virtual sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual css::uno::Any SAL_CALL getFastPropertyValue(::sal_Int32 nHandle) override
static void FileOpen()
static OUString GetUrlDescription(std::u16string_view aUrl)
void deInitSystray()
static void LeaveModalMode()
static bool bModalMode
static bool GetAutostart()
void initSystray()
virtual OUString SAL_CALL getImplementationName() override
static void SetAutostart(bool bActivate)
static void OpenURL(const OUString &aURL, const OUString &rTarget, const css::uno::Sequence< css::beans::PropertyValue > &=css::uno::Sequence< css::beans::PropertyValue >(0))
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
DECL_LINK(DialogClosedHdl_Impl, sfx2::FileDialogHelper *, void)
void SetVeto(bool bVeto)
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &aArguments) override
static void EnterModalMode()
float u
FilterGroup & rTarget
constexpr OUStringLiteral DRAW_URL
constexpr OUStringLiteral IMPRESS_URL
constexpr OUStringLiteral MATH_URL
constexpr OUStringLiteral STARTMODULE_URL
void SAL_DLLPUBLIC_EXPORT plugin_init_sys_tray()
comphelper::WeakComponentImplHelper< css::lang::XInitialization, css::frame::XTerminateListener, css::lang::XServiceInfo, css::beans::XFastPropertySet > ShutdownIconServiceBase
constexpr OUStringLiteral CALC_URL
void SAL_DLLPUBLIC_EXPORT plugin_shutdown_sys_tray()
constexpr OUStringLiteral BASE_URL
constexpr OUStringLiteral WRITER_URL
constexpr OUStringLiteral IMPRESS_WIZARD_URL
void SAL_DLLPUBLIC_EXPORT aqua_shutdown_systray()
void aqua_init_systray()
void win32_init_sys_tray()
void win32_shutdown_sys_tray()
unsigned char sal_Bool