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