Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "excelhandlers.hxx"
30 : :
31 : : #include "oox/core/filterbase.hxx"
32 : : #include "biffinputstream.hxx"
33 : :
34 : : namespace oox {
35 : : namespace xls {
36 : :
37 : : // ============================================================================
38 : :
39 : : using ::oox::core::FilterBase;
40 : : using ::oox::core::FragmentHandler2;
41 : : using ::rtl::OUString;
42 : :
43 : : // ============================================================================
44 : : // ============================================================================
45 : :
46 : 66 : WorkbookFragmentBase::WorkbookFragmentBase(
47 : : const WorkbookHelper& rHelper, const OUString& rFragmentPath ) :
48 : 66 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
49 : 66 : WorkbookHelper( rHelper )
50 : : {
51 : 66 : }
52 : :
53 : : // ============================================================================
54 : :
55 : 69 : WorksheetFragmentBase::WorksheetFragmentBase(
56 : : const WorksheetHelper& rHelper, const OUString& rFragmentPath ) :
57 : 69 : FragmentHandler2( rHelper.getOoxFilter(), rFragmentPath ),
58 [ + - ]: 69 : WorksheetHelper( rHelper )
59 : : {
60 : 69 : }
61 : :
62 : : // ============================================================================
63 : : // ============================================================================
64 : :
65 : 0 : BiffContextHandler::~BiffContextHandler()
66 : : {
67 [ # # ]: 0 : }
68 : :
69 : : // ----------------------------------------------------------------------------
70 : :
71 : 0 : BiffWorksheetContextBase::BiffWorksheetContextBase( const WorksheetHelper& rHelper ) :
72 [ # # ]: 0 : WorksheetHelper( rHelper )
73 : : {
74 : 0 : }
75 : :
76 : : // ============================================================================
77 : :
78 : : namespace {
79 : :
80 : : const sal_uInt16 BIFF_BOF_GLOBALS = 0x0005; /// BIFF5-BIFF8 workbook globals.
81 : : const sal_uInt16 BIFF_BOF_MODULE = 0x0006; /// BIFF5-BIFF8 Visual Basic module.
82 : : const sal_uInt16 BIFF_BOF_SHEET = 0x0010; /// BIFF2-BIFF8 worksheet/dialog sheet.
83 : : const sal_uInt16 BIFF_BOF_CHART = 0x0020; /// BIFF2-BIFF8 chart sheet.
84 : : const sal_uInt16 BIFF_BOF_MACRO = 0x0040; /// BIFF4-BIFF8 macro sheet.
85 : : const sal_uInt16 BIFF_BOF_WORKSPACE = 0x0100; /// BIFF3-BIFF8 workspace.
86 : :
87 : : } // namespace
88 : :
89 : : // ----------------------------------------------------------------------------
90 : :
91 [ # # ]: 0 : BiffFragmentHandler::BiffFragmentHandler( const FilterBase& rFilter, const OUString& rStrmName )
92 : : {
93 : : // do not automatically close the root stream (indicated by empty stream name)
94 : 0 : bool bRootStrm = rStrmName.isEmpty();
95 [ # # ][ # # ]: 0 : mxXInStrm.reset( new BinaryXInputStream( rFilter.openInputStream( rStrmName ), !bRootStrm ) );
[ # # ][ # # ]
96 [ # # ][ # # ]: 0 : mxBiffStrm.reset( new BiffInputStream( *mxXInStrm ) );
[ # # ]
97 : 0 : }
98 : :
99 [ # # ]: 0 : BiffFragmentHandler::~BiffFragmentHandler()
100 : : {
101 [ # # ]: 0 : }
102 : :
103 : 0 : bool BiffFragmentHandler::skipFragment()
104 : : {
105 [ # # ][ # # ]: 0 : while( mxBiffStrm->startNextRecord() && (mxBiffStrm->getRecId() != BIFF_ID_EOF) )
[ # # ]
106 [ # # ]: 0 : if( BiffHelper::isBofRecord( *mxBiffStrm ) )
107 : 0 : skipFragment();
108 [ # # ][ # # ]: 0 : return !mxBiffStrm->isEof() && (mxBiffStrm->getRecId() == BIFF_ID_EOF);
109 : : }
110 : :
111 : : // ============================================================================
112 : :
113 : 0 : BiffWorkbookFragmentBase::BiffWorkbookFragmentBase( const WorkbookHelper& rHelper, const OUString& rStrmName, bool bCloneDecoder ) :
114 : 0 : BiffFragmentHandler( rHelper.getBaseFilter(), rStrmName ),
115 : 0 : WorkbookHelper( rHelper )
116 : : {
117 [ # # ]: 0 : if( bCloneDecoder )
118 [ # # ][ # # ]: 0 : getCodecHelper().cloneDecoder( getInputStream() );
[ # # ]
119 : 0 : }
120 : :
121 : : // ----------------------------------------------------------------------------
122 : :
123 : : } // namespace xls
124 [ + - ][ + - ]: 24 : } // namespace oox
125 : :
126 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|