Version 7.6.3.2-android, tag libreoffice-7.6.3.2-android
[LibreOffice.git] / oox / source / dump / pptxdumper.cxx
blobc65b792063b28c48153f2497fe777e09bd8df247
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 <oox/dump/pptxdumper.hxx>
22 #include <com/sun/star/io/XInputStream.hpp>
23 #include <oox/dump/oledumper.hxx>
24 #include <oox/dump/xlsbdumper.hxx>
25 #include <oox/helper/zipstorage.hxx>
26 #include <oox/ole/olestorage.hxx>
27 #include <o3tl/string_view.hxx>
29 #ifdef DBG_UTIL
31 namespace oox::dump::pptx {
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 std::u16string_view aExt( InputOutputHelper::getFileNameExtension( rStrmName ) );
47 if( o3tl::equalsIgnoreAsciiCase(aExt, u"pptx") ||
48 o3tl::equalsIgnoreAsciiCase(aExt, u"potx") )
50 Dumper( getContext(), rxStrm, rSysFileName ).dump();
52 #ifdef FIXME
53 else if(
54 o3tl::equalsIgnoreAsciiCase(aExt, u"xlsb") ||
55 o3tl::equalsIgnoreAsciiCase(aExt, u"xlsm") ||
56 o3tl::equalsIgnoreAsciiCase(aExt, u"xlsx") ||
57 o3tl::equalsIgnoreAsciiCase(aExt, u"xltm") ||
58 o3tl::equalsIgnoreAsciiCase(aExt, u"xltx") )
60 ::oox::dump::xlsb::Dumper( getContext(), rxStrm, rSysFileName ).dump();
62 else if(
63 o3tl::equalsIgnoreAsciiCase(aExt, u"xla") ||
64 o3tl::equalsIgnoreAsciiCase(aExt, u"xlc") ||
65 o3tl::equalsIgnoreAsciiCase(aExt, u"xlm") ||
66 o3tl::equalsIgnoreAsciiCase(aExt, u"xls") ||
67 o3tl::equalsIgnoreAsciiCase(aExt, u"xlt") ||
68 o3tl::equalsIgnoreAsciiCase(aExt, u"xlw") )
70 ::oox::dump::biff::Dumper( getContext(), rxStrm, rSysFileName ).dump();
72 #endif
73 else if(
74 o3tl::equalsIgnoreAsciiCase(aExt, u"xml") ||
75 o3tl::equalsIgnoreAsciiCase(aExt, u"vml") ||
76 o3tl::equalsIgnoreAsciiCase(aExt, u"rels") )
78 XmlStreamObject( *this, rxStrm, rSysFileName ).dump();
80 else if( o3tl::equalsIgnoreAsciiCase(aExt, u"bin") )
82 if( rStrgPath == "ppt" && rStrmName == "vbaProject.bin" )
84 StorageRef xStrg = std::make_shared<::oox::ole::OleStorage>( getContext(), rxStrm, false );
85 VbaProjectStorageObject( *this, xStrg, rSysFileName ).dump();
87 else if ( rStrgPath == "ppt/embeddings" )
89 StorageRef xStrg = std::make_shared<::oox::ole::OleStorage>( getContext(), rxStrm, false );
90 OleStorageObject( *this, xStrg, rSysFileName ).dump();
92 else if ( rStrgPath == "ppt/activeX" )
94 StorageRef xStrg = std::make_shared<::oox::ole::OleStorage>( getContext(), rxStrm, true );
95 ActiveXStorageObject( *this, xStrg, rSysFileName ).dump();
97 else
99 BinaryStreamObject( *this, rxStrm, rSysFileName ).dump();
104 #define DUMP_PPTX_CONFIG_ENVVAR "OOO_PPTXDUMPER"
106 Dumper::Dumper( const FilterBase& rFilter )
108 ConfigRef xCfg = std::make_shared<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 = std::make_shared<ZipStorage>( rxContext, rxInStrm );
117 ConfigRef xCfg = std::make_shared<Config>( DUMP_PPTX_CONFIG_ENVVAR, rxContext, xStrg, rSysFileName );
118 DumperBase::construct( xCfg );
122 void Dumper::implDump()
124 RootStorageObject( *this ).dump();
127 } // namespace oox::dump::pptx
129 #endif
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */