fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / filter / source / flash / swfdialog.cxx
blob5d3201efdf0b4a419c66e9edd7a797b67a1ab8d1
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 "swfdialog.hxx"
22 #include "impswfdialog.hxx"
23 #include <vcl/svapp.hxx>
24 #include <vcl/dialog.hxx>
25 #include <svl/solar.hrc>
26 #include <comphelper/processfactory.hxx>
27 #include <com/sun/star/view/XRenderable.hpp>
28 #include <com/sun/star/frame/XController.hpp>
29 #include <com/sun/star/view/XSelectionSupplier.hpp>
31 using namespace ::rtl;
32 using namespace ::vcl;
33 using namespace ::com::sun::star;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::lang;
36 using namespace ::com::sun::star::beans;
37 using namespace ::com::sun::star::frame;
38 using namespace ::com::sun::star::view;
39 using namespace ::com::sun::star::document;
41 // -----------------------
42 // - PDFDialog functions -
43 // -----------------------
45 #define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
47 // -----------------------------------------------------------------------------
49 OUString SWFDialog_getImplementationName ()
50 throw (RuntimeException)
52 return OUString ( SERVICE_NAME );
55 // -----------------------------------------------------------------------------
57 Sequence< sal_Int8 > SAL_CALL SWFDialog_getImplementationId()
58 throw(RuntimeException)
60 static ::cppu::OImplementationId aId;
61 return aId.getImplementationId();
64 // -----------------------------------------------------------------------------
66 Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames()
67 throw (RuntimeException)
69 Sequence < OUString > aRet(1);
70 OUString* pArray = aRet.getArray();
71 pArray[0] = OUString ( SERVICE_NAME );
72 return aRet;
75 // -----------------------------------------------------------------------------
77 Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
78 throw( Exception )
80 return (cppu::OWeakObject*) new SWFDialog( comphelper::getComponentContext(rSMgr) );
83 // -----------------------------------------------------------------------------
85 #undef SERVICE_NAME
87 // -------------
88 // - SWFDialog -
89 // -------------
91 SWFDialog::SWFDialog( const Reference< XComponentContext> &rxContext ) :
92 OGenericUnoDialog( rxContext )
94 mpResMgr = ResMgr::CreateResMgr( "flash", Application::GetSettings().GetUILanguageTag() );
97 // -----------------------------------------------------------------------------
99 SWFDialog::~SWFDialog()
101 delete mpResMgr;
104 // -----------------------------------------------------------------------------
106 Any SAL_CALL SWFDialog::queryInterface( const Type& rType )
107 throw (RuntimeException)
109 Any aReturn = OGenericUnoDialog::queryInterface( rType );
111 if( !aReturn.hasValue() )
112 aReturn = ::cppu::queryInterface( rType,
113 static_cast< XPropertyAccess* >( this ),
114 static_cast< XExporter* >( this ) );
116 return aReturn;
119 // -----------------------------------------------------------------------------
121 void SAL_CALL SWFDialog::acquire()
122 throw ()
124 OWeakObject::acquire();
127 // -----------------------------------------------------------------------------
129 void SAL_CALL SWFDialog::release()
130 throw ()
132 OWeakObject::release();
135 // -----------------------------------------------------------------------------
137 Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId()
138 throw(RuntimeException)
140 return SWFDialog_getImplementationId();
143 // -----------------------------------------------------------------------------
145 OUString SAL_CALL SWFDialog::getImplementationName()
146 throw (RuntimeException)
148 return SWFDialog_getImplementationName();
151 // -----------------------------------------------------------------------------
153 Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
154 throw (RuntimeException)
156 return SWFDialog_getSupportedServiceNames();
159 // -----------------------------------------------------------------------------
161 Dialog* SWFDialog::createDialog( Window* pParent )
163 Dialog* pRet = NULL;
165 if( mpResMgr && mxSrcDoc.is() )
167 /* TODO: From the controler we may get information what page is visible and what shapes
168 are selected, if we optionaly want to limit output to that
169 Any aSelection;
173 Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
175 if( xController.is() )
177 Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
179 if( xView.is() )
180 xView->getSelection() >>= aSelection;
183 catch( RuntimeException )
187 ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, *mpResMgr, maFilterData );
188 pRet = pDlg;
191 return pRet;
194 // -----------------------------------------------------------------------------
196 void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
198 if( nExecutionResult && m_pDialog )
199 maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData();
201 destroyDialog();
204 // -----------------------------------------------------------------------------
206 Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
207 throw(RuntimeException)
209 Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
210 return xInfo;
213 //-------------------------------------------------------------------------
214 ::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
216 return *const_cast<SWFDialog*>(this)->getArrayHelper();
219 //------------------------------------------------------------------------------
220 ::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
222 Sequence< Property > aProps;
223 describeProperties(aProps);
224 return new ::cppu::OPropertyArrayHelper( aProps );
227 // -----------------------------------------------------------------------------
229 Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
230 throw ( RuntimeException )
232 sal_Int32 i, nCount;
234 for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
236 if ( maMediaDescriptor[ i ].Name == "FilterData" )
237 break;
240 if( i == nCount )
241 maMediaDescriptor.realloc( ++nCount );
243 maMediaDescriptor[ i ].Name = "FilterData";
244 maMediaDescriptor[ i ].Value <<= maFilterData;
246 return maMediaDescriptor;
249 // -----------------------------------------------------------------------------
251 void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
252 throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
254 maMediaDescriptor = rProps;
256 for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
258 if ( maMediaDescriptor[ i ].Name == "FilterData" )
260 maMediaDescriptor[ i ].Value >>= maFilterData;
261 break;
266 // -----------------------------------------------------------------------------
268 void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
269 throw(IllegalArgumentException, RuntimeException)
271 mxSrcDoc = xDoc;
274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */