Line data Source code
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 :
21 : #include "swfdialog.hxx"
22 : #include "swfuno.hxx"
23 : #include "impswfdialog.hxx"
24 : #include <vcl/svapp.hxx>
25 : #include <vcl/dialog.hxx>
26 : #include <svl/solar.hrc>
27 : #include <comphelper/processfactory.hxx>
28 : #include <cppuhelper/queryinterface.hxx>
29 : #include <com/sun/star/view/XRenderable.hpp>
30 : #include <com/sun/star/frame/XController.hpp>
31 : #include <com/sun/star/view/XSelectionSupplier.hpp>
32 :
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;
40 :
41 :
42 : // - PDFDialog functions -
43 :
44 :
45 : #define SERVICE_NAME "com.sun.star.Impress.FlashExportDialog"
46 :
47 :
48 :
49 0 : OUString SWFDialog_getImplementationName ()
50 : throw (RuntimeException)
51 : {
52 0 : return OUString ( SERVICE_NAME );
53 : }
54 :
55 0 : Sequence< OUString > SAL_CALL SWFDialog_getSupportedServiceNames()
56 : throw (RuntimeException)
57 : {
58 0 : Sequence < OUString > aRet(1);
59 0 : OUString* pArray = aRet.getArray();
60 0 : pArray[0] = SERVICE_NAME;
61 0 : return aRet;
62 : }
63 :
64 :
65 :
66 0 : Reference< XInterface > SAL_CALL SWFDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr)
67 : throw( Exception )
68 : {
69 0 : return static_cast<cppu::OWeakObject*>(new SWFDialog( comphelper::getComponentContext(rSMgr) ));
70 : }
71 :
72 :
73 :
74 : #undef SERVICE_NAME
75 :
76 :
77 : // - SWFDialog -
78 :
79 :
80 0 : SWFDialog::SWFDialog( const Reference< XComponentContext> &rxContext ) :
81 0 : OGenericUnoDialog( rxContext )
82 : {
83 0 : }
84 :
85 :
86 :
87 0 : SWFDialog::~SWFDialog()
88 : {
89 0 : }
90 :
91 :
92 :
93 0 : Any SAL_CALL SWFDialog::queryInterface( const Type& rType )
94 : throw (RuntimeException, std::exception)
95 : {
96 0 : Any aReturn = OGenericUnoDialog::queryInterface( rType );
97 :
98 0 : if( !aReturn.hasValue() )
99 0 : aReturn = ::cppu::queryInterface( rType,
100 : static_cast< XPropertyAccess* >( this ),
101 0 : static_cast< XExporter* >( this ) );
102 :
103 0 : return aReturn;
104 : }
105 :
106 :
107 :
108 0 : void SAL_CALL SWFDialog::acquire()
109 : throw ()
110 : {
111 0 : OWeakObject::acquire();
112 0 : }
113 :
114 :
115 :
116 0 : void SAL_CALL SWFDialog::release()
117 : throw ()
118 : {
119 0 : OWeakObject::release();
120 0 : }
121 :
122 :
123 :
124 0 : Sequence< sal_Int8 > SAL_CALL SWFDialog::getImplementationId()
125 : throw(RuntimeException, std::exception)
126 : {
127 0 : return css::uno::Sequence<sal_Int8>();
128 : }
129 :
130 :
131 :
132 0 : OUString SAL_CALL SWFDialog::getImplementationName()
133 : throw (RuntimeException, std::exception)
134 : {
135 0 : return SWFDialog_getImplementationName();
136 : }
137 :
138 :
139 :
140 0 : Sequence< OUString > SAL_CALL SWFDialog::getSupportedServiceNames()
141 : throw (RuntimeException, std::exception)
142 : {
143 0 : return SWFDialog_getSupportedServiceNames();
144 : }
145 :
146 :
147 :
148 0 : VclPtr<Dialog> SWFDialog::createDialog( vcl::Window* pParent )
149 : {
150 0 : VclPtr<Dialog> pRet;
151 :
152 0 : if (mxSrcDoc.is())
153 : {
154 : /* TODO: From the controller we may get information what page is visible and what shapes
155 : are selected, if we optionaly want to limit output to that
156 : Any aSelection;
157 :
158 : try
159 : {
160 : Reference< XController > xController( Reference< XModel >( mxSrcDoc, UNO_QUERY )->getCurrentController() );
161 :
162 : if( xController.is() )
163 : {
164 : Reference< XSelectionSupplier > xView( xController, UNO_QUERY );
165 :
166 : if( xView.is() )
167 : xView->getSelection() >>= aSelection;
168 : }
169 : }
170 : catch( RuntimeException )
171 : {
172 : }
173 : */
174 0 : pRet.reset( VclPtr<ImpSWFDialog>::Create( pParent, maFilterData ) );
175 : }
176 :
177 0 : return pRet;
178 : }
179 :
180 :
181 :
182 0 : void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
183 : {
184 0 : if( nExecutionResult && m_pDialog )
185 0 : maFilterData = static_cast< ImpSWFDialog* >( m_pDialog.get() )->GetFilterData();
186 :
187 0 : destroyDialog();
188 0 : }
189 :
190 :
191 :
192 0 : Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
193 : throw(RuntimeException, std::exception)
194 : {
195 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
196 0 : return xInfo;
197 : }
198 :
199 :
200 0 : ::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
201 : {
202 0 : return *getArrayHelper();
203 : }
204 :
205 :
206 0 : ::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
207 : {
208 0 : Sequence< Property > aProps;
209 0 : describeProperties(aProps);
210 0 : return new ::cppu::OPropertyArrayHelper( aProps );
211 : }
212 :
213 :
214 :
215 0 : Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
216 : throw ( RuntimeException, std::exception )
217 : {
218 : sal_Int32 i, nCount;
219 :
220 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
221 : {
222 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
223 0 : break;
224 : }
225 :
226 0 : if( i == nCount )
227 0 : maMediaDescriptor.realloc( ++nCount );
228 :
229 0 : maMediaDescriptor[ i ].Name = "FilterData";
230 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
231 :
232 0 : return maMediaDescriptor;
233 : }
234 :
235 :
236 :
237 0 : void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
238 : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
239 : {
240 0 : maMediaDescriptor = rProps;
241 :
242 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
243 : {
244 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
245 : {
246 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
247 0 : break;
248 : }
249 : }
250 0 : }
251 :
252 :
253 :
254 0 : void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
255 : throw(IllegalArgumentException, RuntimeException, std::exception)
256 : {
257 0 : mxSrcDoc = xDoc;
258 3 : }
259 :
260 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|