build fix
[LibreOffice.git] / filter / source / svg / svgdialog.cxx
blob1564a480d24ec00def1ed1742b91e38b0f663219
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "svgdialog.hxx"
21 #include "impsvgdialog.hxx"
23 #include <vcl/svapp.hxx>
24 #include <vcl/dialog.hxx>
25 #include <comphelper/processfactory.hxx>
26 #include <cppuhelper/queryinterface.hxx>
28 #include <com/sun/star/view/XRenderable.hpp>
29 #include <com/sun/star/frame/XController.hpp>
30 #include <com/sun/star/view/XSelectionSupplier.hpp>
32 #define SVG_DIALOG_SERVICE_NAME "com.sun.star.comp.Draw.SVGFilterDialog"
33 #define SVG_DIALOG_IMPLEMENTATION_NAME SVG_DIALOG_SERVICE_NAME
34 #define SVG_FILTER_DATA_NAME "FilterData"
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;
45 OUString SVGDialog_getImplementationName ()
46 throw (RuntimeException)
48 return OUString ( SVG_DIALOG_IMPLEMENTATION_NAME );
52 Sequence< OUString > SAL_CALL SVGDialog_getSupportedServiceNames()
53 throw (RuntimeException)
55 Sequence< OUString > aRet { SVG_DIALOG_SERVICE_NAME };
56 return aRet;
60 Reference< XInterface > SAL_CALL SVGDialog_createInstance( const Reference< XMultiServiceFactory > & rSMgr )
61 throw( Exception )
63 return static_cast< cppu::OWeakObject* >( new SVGDialog( comphelper::getComponentContext(rSMgr) ) );
67 SVGDialog::SVGDialog( const Reference< XComponentContext > &rxContext ) :
68 OGenericUnoDialog( rxContext )
73 SVGDialog::~SVGDialog()
78 Any SAL_CALL SVGDialog::queryInterface( const Type& rType )
79 throw (RuntimeException, std::exception)
81 Any aReturn( OGenericUnoDialog::queryInterface( rType ) );
83 if( !aReturn.hasValue() )
85 aReturn = ::cppu::queryInterface( rType, static_cast< XPropertyAccess* >( this ),
86 static_cast< XExporter* >( this ) );
89 return aReturn;
93 void SAL_CALL SVGDialog::acquire()
94 throw ()
96 OWeakObject::acquire();
100 void SAL_CALL SVGDialog::release()
101 throw ()
103 OWeakObject::release();
107 Sequence< sal_Int8 > SAL_CALL SVGDialog::getImplementationId()
108 throw(RuntimeException, std::exception)
110 return css::uno::Sequence<sal_Int8>();
114 OUString SAL_CALL SVGDialog::getImplementationName()
115 throw (RuntimeException, std::exception)
117 return SVGDialog_getImplementationName();
121 Sequence< OUString > SAL_CALL SVGDialog::getSupportedServiceNames()
122 throw (RuntimeException, std::exception)
124 return SVGDialog_getSupportedServiceNames();
128 VclPtr<Dialog> SVGDialog::createDialog( vcl::Window* pParent )
130 if( mxSrcDoc.is() )
131 return VclPtr<ImpSVGDialog>::Create( pParent, maFilterData );
132 else
133 return VclPtr<Dialog>();
137 void SVGDialog::executedDialog( sal_Int16 nExecutionResult )
139 if( nExecutionResult && m_pDialog )
140 maFilterData = static_cast< ImpSVGDialog* >( m_pDialog.get() )->GetFilterData();
142 destroyDialog();
146 Reference< XPropertySetInfo > SAL_CALL SVGDialog::getPropertySetInfo()
147 throw(RuntimeException, std::exception)
149 return Reference< XPropertySetInfo >( createPropertySetInfo( getInfoHelper() ) );
153 ::cppu::IPropertyArrayHelper& SVGDialog::getInfoHelper()
155 return *getArrayHelper();
159 ::cppu::IPropertyArrayHelper* SVGDialog::createArrayHelper() const
161 Sequence< Property > aProps;
163 describeProperties(aProps);
165 return new ::cppu::OPropertyArrayHelper( aProps );
169 Sequence< PropertyValue > SAL_CALL SVGDialog::getPropertyValues()
170 throw ( RuntimeException, std::exception )
172 sal_Int32 i, nCount;
174 for( i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; ++i )
176 if( maMediaDescriptor[ i ].Name == SVG_FILTER_DATA_NAME )
177 break;
180 if( i == nCount )
182 maMediaDescriptor.realloc( ++nCount );
183 maMediaDescriptor[ i ].Name = SVG_FILTER_DATA_NAME;
186 maMediaDescriptor[ i ].Value <<= maFilterData;
188 return maMediaDescriptor;
192 void SAL_CALL SVGDialog::setPropertyValues( const Sequence< PropertyValue >& rProps )
193 throw ( UnknownPropertyException, PropertyVetoException, IllegalArgumentException, WrappedTargetException, RuntimeException, std::exception )
195 maMediaDescriptor = rProps;
197 for( sal_Int32 i = 0, nCount = maMediaDescriptor.getLength(); i < nCount; i++ )
199 if( maMediaDescriptor[ i ].Name == SVG_FILTER_DATA_NAME )
201 maMediaDescriptor[ i ].Value >>= maFilterData;
202 break;
208 void SAL_CALL SVGDialog::setSourceDocument( const Reference< XComponent >& xDoc )
209 throw(IllegalArgumentException, RuntimeException, std::exception)
211 mxSrcDoc = xDoc;
214 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */