Update git submodules
[LibreOffice.git] / shell / source / win32 / ooofilereader / basereader.cxx
blob7bf53b2752cdf42c4b6fa828078f61926c52d1ee
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 <basereader.hxx>
22 #include <xml_parser.hxx>
24 #include <assert.h>
25 #include <memory>
27 /** constructor of CBaseReader.
29 CBaseReader::CBaseReader(const Filepath_t& DocumentName):
30 m_ZipFile( DocumentName )
35 CBaseReader::CBaseReader(StreamInterface * sw):
36 m_ZipFile( sw )
41 CBaseReader::~CBaseReader()
46 void CBaseReader::start_document()
51 void CBaseReader::end_document()
55 /** Read interested tag content into respective structure then start parsing process.
56 @param ContentName
57 the xml file name in the zipped document which we interest.
59 void CBaseReader::Initialize( const std::string& ContentName)
61 try
63 if (m_ZipContent.empty())
64 m_ZipFile.GetUncompressedContent( ContentName, m_ZipContent );
66 if (!m_ZipContent.empty())
68 xml_parser parser;
69 parser.set_document_handler(this); // pass current reader as reader to the sax parser
70 parser.parse(m_ZipContent.data(), m_ZipContent.size(), true/*IsFinal*/);
73 catch(std::exception&)
75 // OSL_ENSURE( false, ex.what() );
77 catch(...)
79 // OSL_ENSURE(false, "Unknown error");
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */