Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include "svgfilter.hxx"
31 : : #include "svgreader.hxx"
32 : :
33 : : #include "rtl/ref.hxx"
34 : :
35 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 : :
37 : : #include <com/sun/star/lang/XComponent.hpp>
38 : :
39 : : #include <com/sun/star/uno/Any.hxx>
40 : : #include <com/sun/star/uno/Type.hxx>
41 : :
42 : : #include <com/sun/star/beans/PropertyValue.hpp>
43 : :
44 : : #include <com/sun/star/xml/sax/XParser.hpp>
45 : : #include <com/sun/star/xml/sax/InputSource.hpp>
46 : : #include <com/sun/star/xml/XImportFilter.hpp>
47 : :
48 : : #include <com/sun/star/io/XActiveDataSource.hpp>
49 : : #include <com/sun/star/task/XStatusIndicator.hpp>
50 : :
51 : : using namespace ::com::sun::star;
52 : : using namespace ::svgi;
53 : :
54 : 0 : sal_Bool SVGFilter::implImport( const Sequence< PropertyValue >& rDescriptor )
55 : : throw (RuntimeException)
56 : : {
57 : 0 : uno::Reference< io::XInputStream > xInputStream;
58 : 0 : uno::Reference< task::XStatusIndicator > xStatus;
59 : 0 : const sal_Int32 nLength = rDescriptor.getLength();
60 : 0 : const beans::PropertyValue* pAttribs = rDescriptor.getConstArray();
61 [ # # ]: 0 : for ( sal_Int32 i=0 ; i<nLength; ++i, ++pAttribs )
62 : : {
63 [ # # ]: 0 : if ( pAttribs->Name == "InputStream" )
64 : : {
65 [ # # ]: 0 : pAttribs->Value >>= xInputStream;
66 : : }
67 [ # # ]: 0 : else if ( pAttribs->Name == "StatusIndicator" )
68 [ # # ]: 0 : pAttribs->Value >>= xStatus;
69 : : }
70 : :
71 : : OSL_ASSERT(xInputStream.is());
72 [ # # ]: 0 : if(!xInputStream.is())
73 : 0 : return sal_False;
74 : :
75 [ # # ]: 0 : rtl::OUString sXMLImportService ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.comp.Draw.XMLOasisImporter" ) );
76 [ # # ][ # # ]: 0 : Reference < XDocumentHandler > xInternalHandler( mxMSF->createInstance( sXMLImportService ), UNO_QUERY );
[ # # ]
77 : :
78 : : // The XImporter sets up an empty target document for XDocumentHandler to write to..
79 [ # # ]: 0 : uno::Reference < XImporter > xImporter(xInternalHandler, UNO_QUERY);
80 [ # # ][ # # ]: 0 : xImporter->setTargetDocument(mxDstDoc);
81 : :
82 [ # # ]: 0 : SVGReader aReader(mxMSF, xInputStream, xInternalHandler);
83 [ # # ][ # # ]: 0 : return aReader.parseAndConvert();
84 [ + - ][ + - ]: 18 : }
85 : :
86 : :
87 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|