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 :
32 120 : WorkbookFragmentBase::WorkbookFragmentBase(
33 : const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
34 120 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
35 120 : WorkbookHelper( rHelper )
36 : {
37 120 : }
38 :
39 102 : WorksheetFragmentBase::WorksheetFragmentBase(
40 : const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
41 102 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
42 102 : WorksheetHelper( rHelper )
43 : {
44 102 : }
45 :
46 :
47 0 : BiffContextHandler::~BiffContextHandler()
48 : {
49 0 : }
50 :
51 0 : BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) :
52 0 : WorksheetHelper( rHelper )
53 : {
54 0 : }
55 :
56 0 : BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName )
57 : {
58 : // do not automatically close the root stream (indicated by empty stream name)
59 0 : bool bRootStrm = rStrmName.isEmpty();
60 0 : mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) );
61 0 : mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
62 0 : }
63 :
64 0 : BiffFragmentHandler::~BiffFragmentHandler()
65 : {
66 0 : }
67 :
68 0 : bool BiffFragmentHandler::skipFragment()
69 : {
70 0 : while( mxBiffStrm->startNextRecord() && (mxBiffStrm->getRecId() != BIFF_ID_EOF) )
71 0 : if( BiffHelper::isBofRecord( *mxBiffStrm ) )
72 0 : skipFragment();
73 0 : return !mxBiffStrm->isEof() && (mxBiffStrm->getRecId() == BIFF_ID_EOF);
74 : }
75 :
76 0 : BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
77 0 : BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
78 0 : WorkbookHelper( rHelper )
79 : {
80 0 : if( bCloneDecoder )
81 0 : getCodecHelper().cloneDecoder( getInputStream() );
82 0 : }
83 :
84 : } // namespace xls
85 18 : } // namespace oox
86 :
87 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|