Bump version to 5.0-14
[LibreOffice.git] / shell / source / win32 / ooofilereader / basereader.cxx
blob91860d81906e53eff936c0823f36404e2d67a82b
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 #undef OSL_DEBUG_LEVEL
23 #include <osl/diagnose.h>
25 #include "internal/basereader.hxx"
27 #include "internal/xml_parser.hxx"
29 #include "assert.h"
30 #include <memory>
32 /** constructor of CBaseReader.
34 CBaseReader::CBaseReader(const std::string& DocumentName):
35 m_ZipFile( DocumentName )
41 CBaseReader::CBaseReader(StreamInterface * sw):
42 m_ZipFile( sw )
48 CBaseReader::~CBaseReader()
54 void CBaseReader::start_document()
60 void CBaseReader::end_document()
64 /** Read interested tag content into respective structure then start parsing process.
65 @param ContentName
66 the xml file name in the zipped document which we interest.
68 void CBaseReader::Initialize( const std::string& ContentName)
70 try
72 if (m_ZipContent.empty())
73 m_ZipFile.GetUncompressedContent( ContentName, m_ZipContent );
75 if (!m_ZipContent.empty())
77 xml_parser parser;
78 parser.set_document_handler(this); // pass current reader as reader to the sax parser
79 parser.parse(&m_ZipContent[0], m_ZipContent.size());
82 catch(std::exception&
83 #if OSL_DEBUG_LEVEL > 0
85 #endif
88 OSL_ENSURE( false, ex.what() );
90 catch(...)
92 OSL_ENSURE(false, "Unknown error");
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */