1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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"
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 BiffContextHandler::~BiffContextHandler()
49 BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper
& rHelper
) :
50 WorksheetHelper( rHelper
)
54 BiffFragmentHandler::BiffFragmentHandler( const FilterBase
& rFilter
, const OUString
& rStrmName
)
56 // do not automatically close the root stream (indicated by empty stream name)
57 bool bRootStrm
= rStrmName
.isEmpty();
58 mxXInStrm
.reset( new BinaryXInputStream( rFilter
.openInputStream( rStrmName
), !bRootStrm
) );
59 mxBiffStrm
.reset( new BiffInputStream( *mxXInStrm
) );
62 BiffFragmentHandler::~BiffFragmentHandler()
66 bool BiffFragmentHandler::skipFragment()
68 while( mxBiffStrm
->startNextRecord() && (mxBiffStrm
->getRecId() != BIFF_ID_EOF
) )
69 if( BiffHelper::isBofRecord( *mxBiffStrm
) )
71 return !mxBiffStrm
->isEof() && (mxBiffStrm
->getRecId() == BIFF_ID_EOF
);
74 BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper
& rHelper
, const OUString
& rStrmName
, bool bCloneDecoder
) :
75 BiffFragmentHandler( rHelper
.getBaseFilter(), rStrmName
),
76 WorkbookHelper( rHelper
)
79 getCodecHelper().cloneDecoder( getInputStream() );
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */