Version 5.2.6.1, tag libreoffice-5.2.6.1
[LibreOffice.git] / sc / source / filter / oox / excelhandlers.cxx
blobb6d0c6e4bcf3796114acfe5cfaab7b5dee25102c
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 "excelhandlers.hxx"
22 #include <oox/core/filterbase.hxx>
23 #include "biffinputstream.hxx"
25 namespace oox {
26 namespace xls {
28 using ::oox::core::FilterBase;
29 using ::oox::core::FragmentHandler2;
31 WorkbookFragmentBase::WorkbookFragmentBase(
32 const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
33 FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
34 WorkbookHelper( rHelper )
38 WorksheetFragmentBase::WorksheetFragmentBase(
39 const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
40 FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
41 WorksheetHelper( rHelper )
45 BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) :
46 WorksheetHelper( rHelper )
50 BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName )
52 // do not automatically close the root stream (indicated by empty stream name)
53 bool bRootStrm = rStrmName.isEmpty();
54 mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) );
55 mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
58 BiffFragmentHandler::~BiffFragmentHandler()
62 bool BiffFragmentHandler::skipFragment()
64 while( mxBiffStrm->startNextRecord() && (mxBiffStrm->getRecId() != BIFF_ID_EOF) )
65 if( BiffHelper::isBofRecord( *mxBiffStrm ) )
66 skipFragment();
67 return !mxBiffStrm->isEof() && (mxBiffStrm->getRecId() == BIFF_ID_EOF);
70 BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
71 BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
72 WorkbookHelper( rHelper )
74 if( bCloneDecoder )
75 getCodecHelper().cloneDecoder( getInputStream() );
78 } // namespace xls
79 } // namespace oox
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */