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 "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>
30 :
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;
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] = OUString ( 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 (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 : Dialog* SWFDialog::createDialog( Window* pParent )
149 : {
150 0 : Dialog* pRet = NULL;
151 :
152 0 : if (mxSrcDoc.is())
153 : {
154 : /* TODO: From the controler 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 : ImpSWFDialog* pDlg = new ImpSWFDialog( pParent, maFilterData );
175 0 : pRet = pDlg;
176 : }
177 :
178 0 : return pRet;
179 : }
180 :
181 :
182 :
183 0 : void SWFDialog::executedDialog( sal_Int16 nExecutionResult )
184 : {
185 0 : if( nExecutionResult && m_pDialog )
186 0 : maFilterData = static_cast< ImpSWFDialog* >( m_pDialog )->GetFilterData();
187 :
188 0 : destroyDialog();
189 0 : }
190 :
191 :
192 :
193 0 : Reference< XPropertySetInfo > SAL_CALL SWFDialog::getPropertySetInfo()
194 : throw(RuntimeException, std::exception)
195 : {
196 0 : Reference< XPropertySetInfo > xInfo( createPropertySetInfo( getInfoHelper() ) );
197 0 : return xInfo;
198 : }
199 :
200 :
201 0 : ::cppu::IPropertyArrayHelper& SWFDialog::getInfoHelper()
202 : {
203 0 : return *const_cast<SWFDialog*>(this)->getArrayHelper();
204 : }
205 :
206 :
207 0 : ::cppu::IPropertyArrayHelper* SWFDialog::createArrayHelper() const
208 : {
209 0 : Sequence< Property > aProps;
210 0 : describeProperties(aProps);
211 0 : return new ::cppu::OPropertyArrayHelper( aProps );
212 : }
213 :
214 :
215 :
216 0 : Sequence< PropertyValue > SAL_CALL SWFDialog::getPropertyValues()
217 : throw ( RuntimeException, std::exception )
218 : {
219 : sal_Int32 i, nCount;
220 :
221 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
222 : {
223 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
224 0 : break;
225 : }
226 :
227 0 : if( i == nCount )
228 0 : maMediaDescriptor.realloc( ++nCount );
229 :
230 0 : maMediaDescriptor[ i ].Name = "FilterData";
231 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
232 :
233 0 : return maMediaDescriptor;
234 : }
235 :
236 :
237 :
238 0 : void SAL_CALL SWFDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
239 : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
240 : {
241 0 : maMediaDescriptor = rProps;
242 :
243 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
244 : {
245 0 : if ( maMediaDescriptor[ i ].Name == "FilterData" )
246 : {
247 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
248 0 : break;
249 : }
250 : }
251 0 : }
252 :
253 :
254 :
255 0 : void SAL_CALL SWFDialog::setSourceDocument( const Reference< XComponent >& xDoc )
256 : throw(IllegalArgumentException, RuntimeException, std::exception)
257 : {
258 0 : mxSrcDoc = xDoc;
259 0 : }
260 :
261 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|