Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #include "excelhandlers.hxx"
21 :
22 : #include <oox/core/filterbase.hxx>
23 : #include "biffinputstream.hxx"
24 :
25 : namespace oox {
26 : namespace xls {
27 :
28 : using ::oox::core::FilterBase;
29 : using ::oox::core::FragmentHandler2;
30 :
31 376 : WorkbookFragmentBase::WorkbookFragmentBase(
32 : const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
33 376 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
34 376 : WorkbookHelper( rHelper )
35 : {
36 376 : }
37 :
38 320 : WorksheetFragmentBase::WorksheetFragmentBase(
39 : const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
40 320 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
41 320 : WorksheetHelper( rHelper )
42 : {
43 320 : }
44 :
45 0 : BiffContextHandler::~BiffContextHandler()
46 : {
47 0 : }
48 :
49 0 : BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) :
50 0 : WorksheetHelper( rHelper )
51 : {
52 0 : }
53 :
54 0 : BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName )
55 : {
56 : // do not automatically close the root stream (indicated by empty stream name)
57 0 : bool bRootStrm = rStrmName.isEmpty();
58 0 : mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) );
59 0 : mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
60 0 : }
61 :
62 0 : BiffFragmentHandler::~BiffFragmentHandler()
63 : {
64 0 : }
65 :
66 0 : bool BiffFragmentHandler::skipFragment()
67 : {
68 0 : while( mxBiffStrm->startNextRecord() && (mxBiffStrm->getRecId() != BIFF_ID_EOF) )
69 0 : if( BiffHelper::isBofRecord( *mxBiffStrm ) )
70 0 : skipFragment();
71 0 : return !mxBiffStrm->isEof() && (mxBiffStrm->getRecId() == BIFF_ID_EOF);
72 : }
73 :
74 0 : BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
75 0 : BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
76 0 : WorkbookHelper( rHelper )
77 : {
78 0 : if( bCloneDecoder )
79 0 : getCodecHelper().cloneDecoder( getInputStream() );
80 0 : }
81 :
82 : } // namespace xls
83 48 : } // namespace oox
84 :
85 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|