nss: upgrade to release 3.73
[LibreOffice.git] / desktop / source / splash / unxsplash.cxx
blob0396a5bf5cbfb9fc0ce3f5cd2b7c17bad2112056
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "unxsplash.hxx"
21 #include <stdio.h>
22 #include <osl/process.h>
23 #include <cppuhelper/supportsservice.hxx>
24 #include <sal/log.hxx>
25 #include <com/sun/star/uno/XComponentContext.hpp>
27 using namespace com::sun::star;
29 namespace desktop
31 UnxSplashScreen::UnxSplashScreen()
32 : m_pOutFd( nullptr )
36 UnxSplashScreen::~UnxSplashScreen()
38 SAL_INFO("desktop.splash", "UnxSplashScreen::~UnxSplashScreen()");
39 if ( m_pOutFd )
41 fclose( m_pOutFd );
42 m_pOutFd = nullptr;
46 void SAL_CALL UnxSplashScreen::start( const OUString& /*aText*/, sal_Int32 /*nRange*/ )
50 void SAL_CALL UnxSplashScreen::end()
52 SAL_INFO("desktop.splash", "UnxSplashScreen::end()");
53 if( !m_pOutFd )
54 return;
56 fprintf( m_pOutFd, "end\n" );
57 fflush( m_pOutFd );
60 void SAL_CALL UnxSplashScreen::reset()
62 SAL_INFO("desktop.splash", "UNXSplashScreen::reset()");
63 if( !m_pOutFd )
64 return;
66 fprintf( m_pOutFd, "restart\n" );
67 fflush( m_pOutFd );
70 void SAL_CALL UnxSplashScreen::setText( const OUString& /*aText*/ )
72 // TODO?
75 void SAL_CALL UnxSplashScreen::setValue( sal_Int32 nValue )
77 if ( m_pOutFd )
79 fprintf( m_pOutFd, "%" SAL_PRIdINT32 "%%\n", nValue );
80 fflush( m_pOutFd );
84 // XInitialize
85 void SAL_CALL
86 UnxSplashScreen::initialize( const css::uno::Sequence< css::uno::Any>& )
88 for ( sal_uInt32 i = 0; i < osl_getCommandArgCount(); i++ )
90 OUString aArg;
91 osl_getCommandArg( i, &aArg.pData );
92 OUString aNum;
93 if ( aArg.startsWithIgnoreAsciiCase("--splash-pipe=", &aNum) )
95 auto fd = aNum.toUInt32();
96 m_pOutFd = fdopen( fd, "w" );
97 SAL_INFO("desktop.splash", "Got argument '--splash-pipe=" << fd << " ('"
98 << aNum << "') ("
99 << static_cast<void *>(m_pOutFd) << ")");
104 OUString UnxSplashScreen::getImplementationName()
106 return "com.sun.star.office.comp.PipeSplashScreen";
109 sal_Bool UnxSplashScreen::supportsService(OUString const & ServiceName)
111 return cppu::supportsService(this, ServiceName);
114 css::uno::Sequence<OUString> UnxSplashScreen::getSupportedServiceNames()
116 return { "com.sun.star.office.PipeSplashScreen" };
121 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
122 desktop_UnxSplash_get_implementation(
123 css::uno::XComponentContext* , css::uno::Sequence<css::uno::Any> const&)
125 return cppu::acquire(static_cast<cppu::OWeakObject*>(new desktop::UnxSplashScreen()));
128 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */