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 : : #ifndef OOX_XLS_PIVOTCACHEFRAGMENT_HXX
30 : : #define OOX_XLS_PIVOTCACHEFRAGMENT_HXX
31 : :
32 : : #include "excelhandlers.hxx"
33 : :
34 : : namespace oox {
35 : : namespace xls {
36 : :
37 : : class PivotCache;
38 : : class PivotCacheField;
39 : :
40 : : // ============================================================================
41 : :
42 [ # # ]: 0 : class PivotCacheFieldContext : public WorkbookContextBase
43 : : {
44 : : public:
45 : : explicit PivotCacheFieldContext(
46 : : WorkbookFragmentBase& rFragment,
47 : : PivotCacheField& rCacheField );
48 : :
49 : : protected:
50 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
51 : : virtual void onStartElement( const AttributeList& rAttribs );
52 : : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
53 : : virtual void onStartRecord( SequenceInputStream& rStrm );
54 : :
55 : : private:
56 : : PivotCacheField& mrCacheField;
57 : : };
58 : :
59 : : // ============================================================================
60 : :
61 [ # # ]: 0 : class PivotCacheDefinitionFragment : public WorkbookFragmentBase
62 : : {
63 : : public:
64 : : explicit PivotCacheDefinitionFragment(
65 : : const WorkbookHelper& rHelper,
66 : : const ::rtl::OUString& rFragmentPath,
67 : : PivotCache& rPivotCache );
68 : :
69 : : protected:
70 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
71 : : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
72 : : virtual const ::oox::core::RecordInfo* getRecordInfos() const;
73 : : virtual void finalizeImport();
74 : :
75 : : private:
76 : : PivotCache& mrPivotCache;
77 : : };
78 : :
79 : : // ============================================================================
80 : :
81 [ # # ]: 0 : class PivotCacheRecordsFragment : public WorksheetFragmentBase
82 : : {
83 : : public:
84 : : explicit PivotCacheRecordsFragment(
85 : : const WorksheetHelper& rHelper,
86 : : const ::rtl::OUString& rFragmentPath,
87 : : const PivotCache& rPivotCache );
88 : :
89 : : protected:
90 : : virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
91 : : virtual ::oox::core::ContextHandlerRef onCreateRecordContext( sal_Int32 nRecId, SequenceInputStream& rStrm );
92 : : virtual const ::oox::core::RecordInfo* getRecordInfos() const;
93 : :
94 : : private:
95 : : void startCacheRecord();
96 : : void importPCRecord( SequenceInputStream& rStrm );
97 : : void importPCRecordItem( sal_Int32 nRecId, SequenceInputStream& rStrm );
98 : :
99 : : private:
100 : : const PivotCache& mrPivotCache;
101 : : sal_Int32 mnColIdx; /// Relative column index in source data.
102 : : sal_Int32 mnRowIdx; /// Relative row index in source data.
103 : : bool mbInRecord;
104 : : };
105 : :
106 : : // ============================================================================
107 : : // ============================================================================
108 : :
109 [ # # ]: 0 : class BiffPivotCacheFragment : public BiffWorkbookFragmentBase
110 : : {
111 : : public:
112 : : explicit BiffPivotCacheFragment(
113 : : const WorkbookHelper& rHelper,
114 : : const ::rtl::OUString& rStrmName,
115 : : PivotCache& rPivotCache );
116 : :
117 : : /** Imports the entire fragment, returns true, if EOF record has been reached. */
118 : : virtual bool importFragment();
119 : :
120 : : private:
121 : : PivotCache& mrPivotCache;
122 : : };
123 : :
124 : : // ============================================================================
125 : :
126 [ # # ]: 0 : class BiffPivotCacheRecordsContext : public BiffWorksheetContextBase
127 : : {
128 : : public:
129 : : explicit BiffPivotCacheRecordsContext(
130 : : const WorksheetHelper& rHelper,
131 : : const PivotCache& rPivotCache );
132 : :
133 : : /** Reads the current record from stream and tries to insert a cell into
134 : : the source data sheet. */
135 : : virtual void importRecord( BiffInputStream& rStrm );
136 : :
137 : : private:
138 : : void startNextRow();
139 : :
140 : : private:
141 : : typedef ::std::vector< sal_Int32 > ColumnIndexVector;
142 : :
143 : : const PivotCache& mrPivotCache;
144 : : ColumnIndexVector maUnsharedCols; /// Column indexes of all unshared cache fields.
145 : : size_t mnColIdx; /// Current index into maUnsharedCols.
146 : : sal_Int32 mnRowIdx; /// Current row in source data (0-based).
147 : : bool mbHasShared; /// True = pivot cache contains fields with shared items.
148 : : bool mbInRow; /// True = a data row has been started.
149 : : };
150 : :
151 : : // ============================================================================
152 : :
153 : : } // namespace xls
154 : : } // namespace oox
155 : :
156 : : #endif
157 : :
158 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|