xref: /aoo41x/main/oox/inc/oox/xls/workbookfragment.hxx (revision e3508121)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef OOX_XLS_WORKBOOKFRAGMENT_HXX
25 #define OOX_XLS_WORKBOOKFRAGMENT_HXX
26 
27 #include "oox/xls/defnamesbuffer.hxx"
28 #include "oox/xls/excelhandlers.hxx"
29 
30 namespace oox {
31 namespace xls {
32 
33 class ExternalLink;
34 
35 // ============================================================================
36 
37 class WorkbookFragment : public WorkbookFragmentBase
38 {
39 public:
40     explicit            WorkbookFragment(
41                             const WorkbookHelper& rHelper,
42                             const ::rtl::OUString& rFragmentPath );
43 
44 protected:
45     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
46     virtual void        onCharacters( const ::rtl::OUString& rChars );
47 
48     virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
49 
50     virtual const ::oox::core::RecordInfo* getRecordInfos() const;
51     virtual void        finalizeImport();
52 
53 private:
54     void                importExternalReference( const AttributeList& rAttribs );
55     void                importDefinedName( const AttributeList& rAttribs );
56     void                importPivotCache( const AttributeList& rAttribs );
57 
58     void                importExternalRef( SequenceInputStream& rStrm );
59     void                importPivotCache( SequenceInputStream& rStrm );
60 
61     void                importExternalLinkFragment( ExternalLink& rExtLink );
62     void                importPivotCacheDefFragment( const ::rtl::OUString& rRelId, sal_Int32 nCacheId );
63 
64 private:
65     DefinedNameRef      mxCurrName;
66 };
67 
68 // ============================================================================
69 
70 class BiffWorkbookFragment : public BiffWorkbookFragmentBase
71 {
72 public:
73     explicit            BiffWorkbookFragment( const WorkbookHelper& rHelper, const ::rtl::OUString& rStrmName );
74 
75     /** Imports the entire workbook stream, including all contained worksheets. */
76     virtual bool        importFragment();
77 
78 private:
79     /** Imports a complete BIFF4 workspace fragment (with embedded sheets). */
80     bool                importWorkspaceFragment();
81     /** Imports the workbook globals fragment from current stream position. */
82     bool                importGlobalsFragment( ISegmentProgressBar& rProgressBar );
83     /** Imports a sheet fragment with passed type from current stream position. */
84     bool                importSheetFragment(
85                             ISegmentProgressBar& rProgressBar,
86                             BiffFragmentType eFragment, sal_Int16 nCalcSheet );
87 };
88 
89 // ============================================================================
90 
91 } // namespace xls
92 } // namespace oox
93 
94 #endif
95