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_PIVOTTABLEFRAGMENT_HXX
25 #define OOX_XLS_PIVOTTABLEFRAGMENT_HXX
26 
27 #include "oox/xls/excelhandlers.hxx"
28 #include "oox/xls/worksheethelper.hxx"
29 
30 namespace oox {
31 namespace xls {
32 
33 class PivotTable;
34 class PivotTableField;
35 class PivotTableFilter;
36 
37 // ============================================================================
38 
39 class PivotTableFieldContext : public WorksheetContextBase
40 {
41 public:
42     explicit            PivotTableFieldContext(
43                             WorksheetFragmentBase& rFragment,
44                             PivotTableField& rTableField );
45 
46 protected:
47     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
48     virtual void        onStartElement( const AttributeList& rAttribs );
49     virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
50     virtual void        onStartRecord( SequenceInputStream& rStrm );
51 
52 private:
53     PivotTableField&    mrTableField;
54 };
55 
56 // ============================================================================
57 
58 class PivotTableFilterContext : public WorksheetContextBase
59 {
60 public:
61     explicit            PivotTableFilterContext(
62                             WorksheetFragmentBase& rFragment,
63                             PivotTableFilter& rTableFilter );
64 
65 protected:
66     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
67     virtual void        onStartElement( const AttributeList& rAttribs );
68     virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
69     virtual void        onStartRecord( SequenceInputStream& rStrm );
70 
71 private:
72     PivotTableFilter&   mrTableFilter;
73 };
74 
75 // ============================================================================
76 
77 class PivotTableFragment : public WorksheetFragmentBase
78 {
79 public:
80     explicit            PivotTableFragment(
81                             const WorksheetHelper& rHelper,
82                             const ::rtl::OUString& rFragmentPath );
83 
84 protected:
85     virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
86     virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
87     virtual const ::oox::core::RecordInfo* getRecordInfos() const;
88 
89 private:
90     PivotTable&         mrPivotTable;
91 };
92 
93 // ============================================================================
94 // ============================================================================
95 
96 class BiffPivotTableContext : public BiffWorksheetContextBase
97 {
98 public:
99     explicit            BiffPivotTableContext( const WorksheetHelper& rHelper );
100 
101     /** Imports all records related to the current pivot table. */
102     virtual void        importRecord( BiffInputStream& rStrm );
103 
104 private:
105     PivotTable&         mrPivotTable;
106 };
107 
108 // ============================================================================
109 
110 } // namespace xls
111 } // namespace oox
112 
113 #endif
114