1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 "oox/dump/pptxdumper.hxx"
22 #include "oox/dump/oledumper.hxx"
23 #include "oox/dump/xlsbdumper.hxx"
24 #include "oox/helper/zipstorage.hxx"
25 #include "oox/ole/olestorage.hxx"
27 #if OOX_INCLUDE_DUMPER
33 using namespace ::com::sun::star::io
;
34 //using namespace ::com::sun::star::lang;
35 using namespace ::com::sun::star::uno
;
37 using ::oox::core::FilterBase
;
39 RootStorageObject::RootStorageObject( const DumperBase
& rParent
)
41 StorageObjectBase::construct( rParent
);
44 void RootStorageObject::implDumpStream( const Reference
< XInputStream
>& rxStrm
, const OUString
& rStrgPath
, const OUString
& rStrmName
, const OUString
& rSysFileName
)
46 OUString aExt
= InputOutputHelper::getFileNameExtension( rStrmName
);
47 if( aExt
.equalsIgnoreAsciiCase("pptx") ||
48 aExt
.equalsIgnoreAsciiCase("potx") )
50 Dumper( getContext(), rxStrm
, rSysFileName
).dump();
54 aExt
.equalsIgnoreAsciiCase("xlsb") ||
55 aExt
.equalsIgnoreAsciiCase("xlsm") ||
56 aExt
.equalsIgnoreAsciiCase("xlsx") ||
57 aExt
.equalsIgnoreAsciiCase("xltm") ||
58 aExt
.equalsIgnoreAsciiCase("xltx") )
60 ::oox::dump::xlsb::Dumper( getContext(), rxStrm
, rSysFileName
).dump();
63 aExt
.equalsIgnoreAsciiCase("xla") ||
64 aExt
.equalsIgnoreAsciiCase("xlc") ||
65 aExt
.equalsIgnoreAsciiCase("xlm") ||
66 aExt
.equalsIgnoreAsciiCase("xls") ||
67 aExt
.equalsIgnoreAsciiCase("xlt") ||
68 aExt
.equalsIgnoreAsciiCase("xlw") )
70 ::oox::dump::biff::Dumper( getContext(), rxStrm
, rSysFileName
).dump();
74 aExt
.equalsIgnoreAsciiCase("xml") ||
75 aExt
.equalsIgnoreAsciiCase("vml") ||
76 aExt
.equalsIgnoreAsciiCase("rels") )
78 XmlStreamObject( *this, rxStrm
, rSysFileName
).dump();
80 else if( aExt
.equalsIgnoreAsciiCase("bin") )
82 if( rStrgPath
== "ppt" && rStrmName
== "vbaProject.bin" )
84 StorageRef
xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm
, false ) );
85 VbaProjectStorageObject( *this, xStrg
, rSysFileName
).dump();
87 else if ( rStrgPath
== "ppt/embeddings" )
89 StorageRef
xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm
, false ) );
90 OleStorageObject( *this, xStrg
, rSysFileName
).dump();
92 else if ( rStrgPath
== "ppt/activeX" )
94 StorageRef
xStrg( new ::oox::ole::OleStorage( getContext(), rxStrm
, true ) );
95 ActiveXStorageObject( *this, xStrg
, rSysFileName
).dump();
99 BinaryStreamObject( *this, rxStrm
, rSysFileName
).dump();
104 #define DUMP_PPTX_CONFIG_ENVVAR "OOO_PPTXDUMPER"
106 Dumper::Dumper( const FilterBase
& rFilter
)
108 ConfigRef
xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR
, rFilter
) );
109 DumperBase::construct( xCfg
);
112 Dumper::Dumper( const Reference
< XComponentContext
>& rxContext
, const Reference
< XInputStream
>& rxInStrm
, const OUString
& rSysFileName
)
114 if( rxContext
.is() && rxInStrm
.is() )
116 StorageRef
xStrg( new ZipStorage( rxContext
, rxInStrm
) );
117 ConfigRef
xCfg( new Config( DUMP_PPTX_CONFIG_ENVVAR
, rxContext
, xStrg
, rSysFileName
) );
118 DumperBase::construct( xCfg
);
122 void Dumper::implDump()
124 RootStorageObject( *this ).dump();
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */