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 : #include "svgdialog.hxx"
21 : #include "impsvgdialog.hxx"
22 :
23 : #include <vcl/svapp.hxx>
24 : #include <vcl/dialog.hxx>
25 : #include <comphelper/processfactory.hxx>
26 :
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 : #define SVG_DIALOG_SERVICE_NAME "com.sun.star.comp.Draw.SVGFilterDialog"
32 : #define SVG_DIALOG_IMPLEMENTATION_NAME SVG_DIALOG_SERVICE_NAME
33 : #define SVG_FILTER_DATA_NAME "FilterData"
34 :
35 : using namespace ::vcl;
36 : using namespace ::com::sun::star;
37 : using namespace ::com::sun::star::uno;
38 : using namespace ::com::sun::star::lang;
39 : using namespace ::com::sun::star::beans;
40 : using namespace ::com::sun::star::frame;
41 : using namespace ::com::sun::star::view;
42 : using namespace ::com::sun::star::document;
43 :
44 :
45 : // - SVGDialog functions -
46 :
47 :
48 0 : OUString SVGDialog_getImplementationName ()
49 : throw (RuntimeException)
50 : {
51 0 : return OUString ( SVG_DIALOG_IMPLEMENTATION_NAME );
52 : }
53 :
54 0 : Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames()
55 : throw (RuntimeException)
56 : {
57 0 : Sequence< OUString > aRet( 1 );
58 :
59 0 : aRet.getArray()[ 0 ] = OUString ( SVG_DIALOG_SERVICE_NAME );
60 :
61 0 : return aRet;
62 : }
63 :
64 :
65 :
66 0 : Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr )
67 : throw( Exception )
68 : {
69 0 : return( static_cast< cppu::OWeakObject* >( new SVGDialog( comphelper::getComponentContext(rSMgr) ) ) );
70 : }
71 :
72 :
73 : // - SVGDialog -
74 :
75 :
76 0 : SVGDialog::SVGDialog( const Reference< XComponentContext > &rxContext ) :
77 0 : OGenericUnoDialog( rxContext )
78 : {
79 0 : }
80 :
81 :
82 :
83 0 : SVGDialog::~SVGDialog()
84 : {
85 0 : }
86 :
87 :
88 :
89 0 : Any SAL_CALL SVGDialog::queryInterface( const Type& rType )
90 : throw (RuntimeException, std::exception)
91 : {
92 0 : Any aReturn( OGenericUnoDialog::queryInterface( rType ) );
93 :
94 0 : if( !aReturn.hasValue() )
95 : {
96 0 : aReturn = ::cppu::queryInterface( rType, static_cast< XPropertyAccess* >( this ),
97 0 : static_cast< XExporter* >( this ) );
98 : }
99 :
100 0 : return( aReturn );
101 : }
102 :
103 :
104 :
105 0 : void SAL_CALL SVGDialog::acquire()
106 : throw ()
107 : {
108 0 : OWeakObject::acquire();
109 0 : }
110 :
111 :
112 :
113 0 : void SAL_CALL SVGDialog::release()
114 : throw ()
115 : {
116 0 : OWeakObject::release();
117 0 : }
118 :
119 :
120 :
121 0 : Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId()
122 : throw(RuntimeException, std::exception)
123 : {
124 0 : return css::uno::Sequence<sal_Int8>();
125 : }
126 :
127 :
128 :
129 0 : OUString SAL_CALL SVGDialog::getImplementationName()
130 : throw (RuntimeException, std::exception)
131 : {
132 0 : return SVGDialog_getImplementationName();
133 : }
134 :
135 :
136 :
137 0 : Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
138 : throw (RuntimeException, std::exception)
139 : {
140 0 : return SVGDialog_getSupportedServiceNames();
141 : }
142 :
143 :
144 :
145 0 : Dialog* SVGDialog::createDialog( vcl::Window* pParent )
146 : {
147 0 : return( ( /*KA: *mapResMgr.get() &&*/ mxSrcDoc.is() ) ?
148 0 : new ImpSVGDialog( pParent/*KA: , *mapResMgr*/, maFilterData ) :
149 0 : NULL );
150 : }
151 :
152 :
153 :
154 0 : void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
155 : {
156 0 : if( nExecutionResult && m_pDialog )
157 0 : maFilterData = static_cast< ImpSVGDialog* >( m_pDialog )->GetFilterData();
158 :
159 0 : destroyDialog();
160 0 : }
161 :
162 :
163 :
164 0 : Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo()
165 : throw(RuntimeException, std::exception)
166 : {
167 0 : return( Reference< XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) ) );
168 : }
169 :
170 :
171 0 : ::cppu::IPropertyArrayHelper& SVGDialog::getInfoHelper()
172 : {
173 0 : return( *const_cast< SVGDialog *>(this)->getArrayHelper() );
174 : }
175 :
176 :
177 0 : ::cppu::IPropertyArrayHelper* SVGDialog::createArrayHelper() const
178 : {
179 0 : Sequence< Property > aProps;
180 :
181 0 : describeProperties(aProps);
182 :
183 0 : return new ::cppu::OPropertyArrayHelper( aProps );
184 : }
185 :
186 :
187 :
188 0 : Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues()
189 : throw ( RuntimeException, std::exception )
190 : {
191 : sal_Int32 i, nCount;
192 :
193 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; ++i )
194 : {
195 0 : if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
196 0 : break;
197 : }
198 :
199 0 : if( i == nCount )
200 : {
201 0 : maMediaDescriptor.realloc( ++nCount );
202 0 : maMediaDescriptor[ i ].Name = SVG_FILTER_DATA_NAME;
203 : }
204 :
205 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
206 :
207 0 : return( maMediaDescriptor );
208 : }
209 :
210 :
211 :
212 0 : void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
213 : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
214 : {
215 0 : maMediaDescriptor = rProps;
216 :
217 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
218 : {
219 0 : if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
220 : {
221 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
222 0 : break;
223 : }
224 : }
225 0 : }
226 :
227 :
228 :
229 0 : void SAL_CALL SVGDialog::setSourceDocument( const Reference< XComponent >& xDoc )
230 : throw(IllegalArgumentException, RuntimeException, std::exception)
231 : {
232 0 : mxSrcDoc = xDoc;
233 0 : }
234 :
235 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|