Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * OpenOffice.org - a multi-platform office productivity suite
5 : : *
6 : : * The Contents of this file are made available subject to
7 : : * the terms of GNU Lesser General Public License Version 2.1.
8 : : *
9 : : *
10 : : * GNU Lesser General Public License Version 2.1
11 : : * =============================================
12 : : * Copyright 2005 by Sun Microsystems, Inc.
13 : : * 901 San Antonio Road, Palo Alto, CA 94303, USA
14 : : *
15 : : * This library is free software; you can redistribute it and/or
16 : : * modify it under the terms of the GNU Lesser General Public
17 : : * License version 2.1, as published by the Free Software Foundation.
18 : : *
19 : : * This library is distributed in the hope that it will be useful,
20 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 : : * Lesser General Public License for more details.
23 : : *
24 : : * You should have received a copy of the GNU Lesser General Public
25 : : * License along with this library; if not, write to the Free Software
26 : : * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 : : * MA 02111-1307 USA
28 : : *
29 : : ************************************************************************/
30 : :
31 : : #include "svgdialog.hxx"
32 : : #include "impsvgdialog.hxx"
33 : :
34 : : #include <vcl/svapp.hxx>
35 : : #include <vcl/dialog.hxx>
36 : :
37 : : #include <com/sun/star/view/XRenderable.hpp>
38 : : #include <com/sun/star/frame/XController.hpp>
39 : : #include <com/sun/star/view/XSelectionSupplier.hpp>
40 : :
41 : : #define SVG_DIALOG_SERVICE_NAME "com.sun.star.comp.Draw.SVGFilterDialog"
42 : : #define SVG_DIALOG_IMPLEMENTATION_NAME SVG_DIALOG_SERVICE_NAME
43 : : #define SVG_FILTER_DATA_NAME "FilterData"
44 : :
45 : : using namespace ::rtl;
46 : : using namespace ::vcl;
47 : : using namespace ::com::sun::star;
48 : : using namespace ::com::sun::star::uno;
49 : : using namespace ::com::sun::star::lang;
50 : : using namespace ::com::sun::star::beans;
51 : : using namespace ::com::sun::star::frame;
52 : : using namespace ::com::sun::star::view;
53 : : using namespace ::com::sun::star::document;
54 : :
55 : : // -----------------------
56 : : // - SVGDialog functions -
57 : : // -----------------------
58 : :
59 : 0 : OUString SVGDialog_getImplementationName ()
60 : : throw (RuntimeException)
61 : : {
62 : 0 : return OUString ( RTL_CONSTASCII_USTRINGPARAM ( SVG_DIALOG_IMPLEMENTATION_NAME ) );
63 : : }
64 : :
65 : : // -----------------------------------------------------------------------------
66 : :
67 : 0 : Sequence< sal_Int8 > SAL_CALL SVGDialog_getImplementationId()
68 : : throw(RuntimeException)
69 : : {
70 [ # # ][ # # ]: 0 : static const ::cppu::OImplementationId aId;
71 : :
72 : 0 : return( aId.getImplementationId() );
73 : : }
74 : :
75 : : // -----------------------------------------------------------------------------
76 : :
77 : 0 : Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames()
78 : : throw (RuntimeException)
79 : : {
80 : 0 : Sequence< OUString > aRet( 1 );
81 : :
82 [ # # ][ # # ]: 0 : aRet.getArray()[ 0 ] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SVG_DIALOG_SERVICE_NAME ) );
83 : :
84 : 0 : return aRet;
85 : : }
86 : :
87 : : // -----------------------------------------------------------------------------
88 : :
89 : 0 : Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr )
90 : : throw( Exception )
91 : : {
92 [ # # ]: 0 : return( static_cast< cppu::OWeakObject* >( new SVGDialog( rSMgr ) ) );
93 : : }
94 : :
95 : : // -------------
96 : : // - SVGDialog -
97 : : // -------------
98 : :
99 : 0 : SVGDialog::SVGDialog( const Reference< XMultiServiceFactory > &rxMSF ) :
100 [ # # ][ # # ]: 0 : OGenericUnoDialog( rxMSF )
[ # # ]
101 : : {
102 : 0 : }
103 : :
104 : : // -----------------------------------------------------------------------------
105 : :
106 [ # # ][ # # ]: 0 : SVGDialog::~SVGDialog()
[ # # ][ # # ]
107 : : {
108 [ # # ]: 0 : }
109 : :
110 : : // -----------------------------------------------------------------------------
111 : :
112 : 0 : Any SAL_CALL SVGDialog::queryInterface( const Type& rType )
113 : : throw (RuntimeException)
114 : : {
115 : 0 : Any aReturn( OGenericUnoDialog::queryInterface( rType ) );
116 : :
117 [ # # ]: 0 : if( !aReturn.hasValue() )
118 : : {
119 : : aReturn = ::cppu::queryInterface( rType, static_cast< XPropertyAccess* >( this ),
120 [ # # ]: 0 : static_cast< XExporter* >( this ) );
121 : : }
122 : :
123 : 0 : return( aReturn );
124 : : }
125 : :
126 : : // -----------------------------------------------------------------------------
127 : :
128 : 0 : void SAL_CALL SVGDialog::acquire()
129 : : throw ()
130 : : {
131 : 0 : OWeakObject::acquire();
132 : 0 : }
133 : :
134 : : // -----------------------------------------------------------------------------
135 : :
136 : 0 : void SAL_CALL SVGDialog::release()
137 : : throw ()
138 : : {
139 : 0 : OWeakObject::release();
140 : 0 : }
141 : :
142 : : // -----------------------------------------------------------------------------
143 : :
144 : 0 : Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId()
145 : : throw(RuntimeException)
146 : : {
147 : 0 : return SVGDialog_getImplementationId();
148 : : }
149 : :
150 : : // -----------------------------------------------------------------------------
151 : :
152 : 0 : OUString SAL_CALL SVGDialog::getImplementationName()
153 : : throw (RuntimeException)
154 : : {
155 : 0 : return SVGDialog_getImplementationName();
156 : : }
157 : :
158 : : // -----------------------------------------------------------------------------
159 : :
160 : 0 : Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
161 : : throw (RuntimeException)
162 : : {
163 : 0 : return SVGDialog_getSupportedServiceNames();
164 : : }
165 : :
166 : : // -----------------------------------------------------------------------------
167 : :
168 : 0 : Dialog* SVGDialog::createDialog( Window* pParent )
169 : : {
170 : 0 : return( ( /*KA: *mapResMgr.get() &&*/ mxSrcDoc.is() ) ?
171 [ # # ]: 0 : new ImpSVGDialog( pParent/*KA: , *mapResMgr*/, maFilterData ) :
172 [ # # ]: 0 : NULL );
173 : : }
174 : :
175 : : // -----------------------------------------------------------------------------
176 : :
177 : 0 : void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
178 : : {
179 [ # # ][ # # ]: 0 : if( nExecutionResult && m_pDialog )
180 [ # # ]: 0 : maFilterData = static_cast< ImpSVGDialog* >( m_pDialog )->GetFilterData();
181 : :
182 : 0 : destroyDialog();
183 : 0 : }
184 : :
185 : : // -----------------------------------------------------------------------------
186 : :
187 : 0 : Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo()
188 : : throw(RuntimeException)
189 : : {
190 : 0 : return( Reference< XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) ) );
191 : : }
192 : :
193 : : //-------------------------------------------------------------------------
194 : 0 : ::cppu::IPropertyArrayHelper& SVGDialog::getInfoHelper()
195 : : {
196 : 0 : return( *const_cast< SVGDialog *>(this)->getArrayHelper() );
197 : : }
198 : :
199 : : //------------------------------------------------------------------------------
200 : 0 : ::cppu::IPropertyArrayHelper* SVGDialog::createArrayHelper() const
201 : : {
202 [ # # ]: 0 : Sequence< Property > aProps;
203 : :
204 [ # # ]: 0 : describeProperties(aProps);
205 : :
206 [ # # ][ # # ]: 0 : return new ::cppu::OPropertyArrayHelper( aProps );
207 : : }
208 : :
209 : : // -----------------------------------------------------------------------------
210 : :
211 : 0 : Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues()
212 : : throw ( RuntimeException )
213 : : {
214 : : sal_Int32 i, nCount;
215 : :
216 [ # # ]: 0 : for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; ++i )
217 : : {
218 [ # # ]: 0 : if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
219 : 0 : break;
220 : : }
221 : :
222 [ # # ]: 0 : if( i == nCount )
223 : : {
224 : 0 : maMediaDescriptor.realloc( ++nCount );
225 [ # # ][ # # ]: 0 : maMediaDescriptor[ i ].Name = String( RTL_CONSTASCII_USTRINGPARAM( SVG_FILTER_DATA_NAME ) );
226 : : }
227 : :
228 : 0 : maMediaDescriptor[ i ].Value <<= maFilterData;
229 : :
230 : 0 : return( maMediaDescriptor );
231 : : }
232 : :
233 : : // -----------------------------------------------------------------------------
234 : :
235 : 0 : void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
236 : : throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException )
237 : : {
238 : 0 : maMediaDescriptor = rProps;
239 : :
240 [ # # ]: 0 : for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
241 : : {
242 [ # # ]: 0 : if( maMediaDescriptor[ i ].Name.equalsAscii( SVG_FILTER_DATA_NAME ) )
243 : : {
244 : 0 : maMediaDescriptor[ i ].Value >>= maFilterData;
245 : 0 : break;
246 : : }
247 : : }
248 : 0 : }
249 : :
250 : : // -----------------------------------------------------------------------------
251 : :
252 : 0 : void SAL_CALL SVGDialog::setSourceDocument( const Reference< XComponent >& xDoc )
253 : : throw(IllegalArgumentException, RuntimeException)
254 : : {
255 : 0 : mxSrcDoc = xDoc;
256 : 0 : }
257 : :
258 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|