1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_filter.hxx"
26
27 #include "ppttoxml.hxx"
28 #include <sot/storage.hxx>
29
PptToXml()30 PptToXml::PptToXml()
31 {
32 }
33
~PptToXml()34 PptToXml::~PptToXml()
35 {
36 }
37
filter(const SEQ (NMSP_BEANS::PropertyValue)& aDescriptor,REF (NMSP_SAX::XDocumentHandler)xHandler)38 sal_Bool PptToXml::filter( const SEQ( NMSP_BEANS::PropertyValue )& aDescriptor,
39 REF( NMSP_SAX::XDocumentHandler ) xHandler )
40 {
41 xHdl = xHandler;
42
43 sal_Bool bStatus = sal_False;
44 sal_Int32 i;
45 for( i = 0; i < aDescriptor.getLength(); i++ )
46 {
47 NMSP_RTL::OUString strTemp;
48 aDescriptor[ i ].Value >>= strTemp;
49
50 /* we will open the document by url, so the stream is not needed
51 if( aDescriptor[i].Name == B2UCONST( "InputStream" ) )
52 {
53 REF( NMSP_IO::XInputStream ) rInputStream;
54 aDescriptor[ i].Value >>= rInputStream;
55 }
56 else
57 */
58 if ( aDescriptor[ i ].Name == B2UCONST( "URL" ) )
59 {
60 NMSP_RTL::OUString sURL;
61 aDescriptor[ i ].Value >>= sURL;
62 SotStorageRef xStg( new SotStorage( sURL, STREAM_STD_READ, 0 ) );
63 if ( xStg.Is() )
64 {
65 SotStorageStreamRef xDocStream( xStg->OpenSotStream( B2UCONST( "PowerPoint Document" ), STREAM_STD_READ ) );
66 if( xDocStream.Is() )
67 {
68 xDocStream->SetVersion( xStg->GetVersion() );
69 xDocStream->SetKey( xStg->GetKey() );
70
71 // xHdl->unknown( PPT_DTD_STRING );
72 xHdl->startDocument();
73
74
75 xHdl->endDocument();
76 bStatus = sal_True;
77 }
78 }
79 }
80 }
81 return bStatus;
82 }
83
cancel()84 void PptToXml::cancel()
85 {
86
87 }
88