1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
23 #include "impswfdialog.hxx"
24 #include <svl/solar.hrc>
25 #include <comphelper/processfactory.hxx>
26 #include <cppuhelper/queryinterface.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>
30 #include <vcl/svapp.hxx>
32 using namespace ::com::sun::star
;
33 using namespace ::com::sun::star::uno
;
34 using namespace ::com::sun::star::lang
;
35 using namespace ::com::sun::star::beans
;
36 using namespace ::com::sun::star::frame
;
37 using namespace ::com::sun::star::view
;
38 using namespace ::com::sun::star::document
;
40 #define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
43 OUString
SWFDialog_getImplementationName ()
49 Sequence
< OUString
> SWFDialog_getSupportedServiceNames()
51 Sequence
<OUString
> aRet
{ SERVICE_NAME
};
56 Reference
< XInterface
> SWFDialog_createInstance( const Reference
< XMultiServiceFactory
> & rSMgr
)
58 return static_cast<cppu::OWeakObject
*>(new SWFDialog( comphelper::getComponentContext(rSMgr
) ));
63 SWFDialog::SWFDialog( const Reference
< XComponentContext
> &rxContext
) :
64 OGenericUnoDialog( rxContext
)
69 SWFDialog::~SWFDialog()
74 Any SAL_CALL
SWFDialog::queryInterface( const Type
& rType
)
76 Any aReturn
= OGenericUnoDialog::queryInterface( rType
);
78 if( !aReturn
.hasValue() )
79 aReturn
= ::cppu::queryInterface( rType
,
80 static_cast< XPropertyAccess
* >( this ),
81 static_cast< XExporter
* >( this ) );
87 void SAL_CALL
SWFDialog::acquire()
90 OWeakObject::acquire();
94 void SAL_CALL
SWFDialog::release()
97 OWeakObject::release();
101 Sequence
< sal_Int8
> SAL_CALL
SWFDialog::getImplementationId()
103 return css::uno::Sequence
<sal_Int8
>();
107 OUString SAL_CALL
SWFDialog::getImplementationName()
109 return SWFDialog_getImplementationName();
112 Sequence
< OUString
> SAL_CALL
SWFDialog::getSupportedServiceNames()
114 return SWFDialog_getSupportedServiceNames();
117 std::unique_ptr
<weld::DialogController
> SWFDialog::createDialog(const css::uno::Reference
<css::awt::XWindow
>& rParent
)
119 std::unique_ptr
<weld::DialogController
> xRet
;
123 /* TODO: From the controller we may get information what page is visible and what shapes
124 are selected, if we optionally want to limit output to that
129 Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
131 if( xController.is() )
133 Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
136 xView->getSelection() >>= aSelection;
139 catch( RuntimeException )
143 xRet
.reset(new ImpSWFDialog(Application::GetFrameWeld(rParent
), maFilterData
));
149 void SWFDialog::executedDialog( sal_Int16 nExecutionResult
)
151 if (nExecutionResult
&& m_xDialog
)
152 maFilterData
= static_cast<ImpSWFDialog
*>(m_xDialog
.get())->GetFilterData();
157 Reference
< XPropertySetInfo
> SAL_CALL
SWFDialog::getPropertySetInfo()
159 Reference
< XPropertySetInfo
> xInfo( createPropertySetInfo( getInfoHelper() ) );
163 ::cppu::IPropertyArrayHelper
& SWFDialog::getInfoHelper()
165 return *getArrayHelper();
168 ::cppu::IPropertyArrayHelper
* SWFDialog::createArrayHelper() const
170 Sequence
< Property
> aProps
;
171 describeProperties(aProps
);
172 return new ::cppu::OPropertyArrayHelper( aProps
);
175 Sequence
< PropertyValue
> SAL_CALL
SWFDialog::getPropertyValues()
179 for( i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
181 if ( maMediaDescriptor
[ i
].Name
== "FilterData" )
186 maMediaDescriptor
.realloc( ++nCount
);
188 maMediaDescriptor
[ i
].Name
= "FilterData";
189 maMediaDescriptor
[ i
].Value
<<= maFilterData
;
191 return maMediaDescriptor
;
195 void SAL_CALL
SWFDialog::setPropertyValues( const Sequence
< PropertyValue
>& rProps
)
197 maMediaDescriptor
= rProps
;
199 for( sal_Int32 i
= 0, nCount
= maMediaDescriptor
.getLength(); i
< nCount
; i
++ )
201 if ( maMediaDescriptor
[ i
].Name
== "FilterData" )
203 maMediaDescriptor
[ i
].Value
>>= maFilterData
;
210 void SAL_CALL
SWFDialog::setSourceDocument( const Reference
< XComponent
>& xDoc
)
215 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */