xref: /aoo41x/main/oox/inc/oox/xls/workbookfragment.hxx (revision cdf0e10c)
1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef OOX_XLS_WORKBOOKFRAGMENT_HXX
29 #define OOX_XLS_WORKBOOKFRAGMENT_HXX
30 
31 #include "oox/xls/defnamesbuffer.hxx"
32 #include "oox/xls/excelhandlers.hxx"
33 
34 namespace oox {
35 namespace xls {
36 
37 class ExternalLink;
38 
39 // ============================================================================
40 
41 class WorkbookFragment : public WorkbookFragmentBase
42 {
43 public:
44     explicit            WorkbookFragment(
45                             const WorkbookHelper& rHelper,
46                             const ::rtl::OUString& rFragmentPath );
47 
48 protected:
49     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
50     virtual void        onCharacters( const ::rtl::OUString& rChars );
51 
52     virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
53 
54     virtual const ::oox::core::RecordInfo* getRecordInfos() const;
55     virtual void        finalizeImport();
56 
57 private:
58     void                importExternalReference( const AttributeList& rAttribs );
59     void                importDefinedName( const AttributeList& rAttribs );
60     void                importPivotCache( const AttributeList& rAttribs );
61 
62     void                importExternalRef( SequenceInputStream& rStrm );
63     void                importPivotCache( SequenceInputStream& rStrm );
64 
65     void                importExternalLinkFragment( ExternalLink& rExtLink );
66     void                importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId );
67 
68 private:
69     DefinedNameRef      mxCurrName;
70 };
71 
72 // ============================================================================
73 
74 class BiffWorkbookFragment : public BiffWorkbookFragmentBase
75 {
76 public:
77     explicit            BiffWorkbookFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName );
78 
79     /** Imports the entire workbook stream, including all contained worksheets. */
80     virtual bool        importFragment();
81 
82 private:
83     /** Imports a complete BIFF4 workspace fragment (with embedded sheets). */
84     bool                importWorkspaceFragment();
85     /** Imports the workbook globals fragment from current stream position. */
86     bool                importGlobalsFragment( ISegmentProgressBar& rProgressBar );
87     /** Imports a sheet fragment with passed type from current stream position. */
88     bool                importSheetFragment(
89                             ISegmentProgressBar& rProgressBar,
90                             BiffFragmentType eFragment, sal_Int16 nCalcSheet );
91 };
92 
93 // ============================================================================
94 
95 } // namespace xls
96 } // namespace oox
97 
98 #endif
99