tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / odk / examples / cpp / complextoolbarcontrols / MyJob.cxx
blob44201fb3be011eaf284ca14e266631a66abd379a
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 .
21 #include "MyJob.h"
23 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
24 #include <com/sun/star/beans/NamedValue.hpp>
25 #include <com/sun/star/document/XEventBroadcaster.hpp>
26 #include <cppuhelper/supportsservice.hxx>
28 using rtl::OUString;
29 using com::sun::star::uno::Sequence;
30 using com::sun::star::uno::Reference;
31 using com::sun::star::uno::Any;
32 using com::sun::star::uno::UNO_QUERY;
33 using com::sun::star::uno::XInterface;
34 using com::sun::star::lang::XMultiServiceFactory;
35 using com::sun::star::beans::NamedValue;
36 using com::sun::star::document::XEventBroadcaster;
38 Any SAL_CALL MyJob::execute( const Sequence< NamedValue >& aArguments )
40 Reference < XEventBroadcaster > xBrd( mxMSF->createInstance(
41 "com.sun.star.frame.GlobalEventBroadcaster" ), UNO_QUERY );
42 Reference < com::sun::star::document::XEventListener > xLstner( mxMSF->createInstance(
43 "com.sun.star.comp.Office.MyListener" ), UNO_QUERY );
44 if ( xBrd.is() )
45 xBrd->addEventListener( xLstner );
46 return Any();
49 OUString MyJob_getImplementationName ()
51 return OUString( "com.sun.star.comp.Office.MyJob" );
54 #define SERVICE_NAME "com.sun.star.task.Job"
56 Sequence< OUString > SAL_CALL MyJob_getSupportedServiceNames( )
58 Sequence < OUString > aRet(1);
59 OUString* pArray = aRet.getArray();
60 pArray[0] = OUString( SERVICE_NAME );
61 return aRet;
64 #undef SERVICE_NAME
66 Reference< XInterface > SAL_CALL MyJob_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
68 return (cppu::OWeakObject*) new MyJob( rSMgr );
71 // XServiceInfo
72 OUString SAL_CALL MyJob::getImplementationName( )
74 return MyJob_getImplementationName();
77 sal_Bool SAL_CALL MyJob::supportsService( const OUString& rServiceName )
79 return cppu::supportsService(this, rServiceName);
82 Sequence< OUString > SAL_CALL MyJob::getSupportedServiceNames( )
84 return MyJob_getSupportedServiceNames();
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */