xref: /aoo41x/main/sc/source/core/data/pivot2.cxx (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 // MARKER(update_precomp.py): autogen include statement, do not remove
29 #include "precompiled_sc.hxx"
30 
31 #ifdef _MSC_VER
32 #pragma optimize("",off)
33 #endif
34 
35 // INCLUDE ---------------------------------------------------------------
36 
37 #include "scitems.hxx"
38 #include <editeng/boxitem.hxx>
39 #include <editeng/wghtitem.hxx>
40 #include <svx/algitem.hxx>
41 #include <unotools/transliterationwrapper.hxx>
42 
43 #include "globstr.hrc"
44 #include "subtotal.hxx"
45 #include "rangeutl.hxx"
46 #include "attrib.hxx"
47 #include "patattr.hxx"
48 #include "docpool.hxx"
49 #include "document.hxx"
50 #include "userlist.hxx"
51 #include "pivot.hxx"
52 #include "rechead.hxx"
53 #include "formula/errorcodes.hxx"							// fuer errNoValue
54 #include "refupdat.hxx"
55 #include "stlpool.hxx"
56 #include "stlsheet.hxx"
57 
58 using ::com::sun::star::sheet::DataPilotFieldReference;
59 using ::rtl::OUString;
60 
61 // ============================================================================
62 
63 ScDPLabelData::Member::Member() :
64     mbVisible(true),
65     mbShowDetails(true)
66 {
67 }
68 
69 OUString ScDPLabelData::Member::getDisplayName() const
70 {
71     if (maLayoutName.getLength())
72         return maLayoutName;
73 
74     return maName;
75 }
76 
77 ScDPLabelData::ScDPLabelData( const String& rName, SCCOL nCol, bool bIsValue ) :
78     maName( rName ),
79     mnCol( nCol ),
80     mnFuncMask( PIVOT_FUNC_NONE ),
81     mnUsedHier( 0 ),
82     mnFlags( 0 ),
83     mbShowAll( false ),
84     mbIsValue( bIsValue )
85 {
86 }
87 
88 OUString ScDPLabelData::getDisplayName() const
89 {
90     if (maLayoutName.getLength())
91         return maLayoutName;
92 
93     return maName;
94 }
95 
96 // ============================================================================
97 
98 ScPivotField::ScPivotField( SCCOL nNewCol, sal_uInt16 nNewFuncMask ) :
99     nCol( nNewCol ),
100     nFuncMask( nNewFuncMask ),
101     nFuncCount( 0 )
102 {
103 }
104 
105 bool ScPivotField::operator==( const ScPivotField& r ) const
106 {
107     return (nCol                            == r.nCol)
108         && (nFuncMask                       == r.nFuncMask)
109         && (nFuncCount                      == r.nFuncCount)
110         && (maFieldRef.ReferenceType        == r.maFieldRef.ReferenceType)
111         && (maFieldRef.ReferenceField       == r.maFieldRef.ReferenceField)
112         && (maFieldRef.ReferenceItemType    == r.maFieldRef.ReferenceItemType)
113         && (maFieldRef.ReferenceItemName    == r.maFieldRef.ReferenceItemName);
114 }
115 
116 // ============================================================================
117 
118 ScPivotParam::ScPivotParam()
119 	:	nCol( 0 ), nRow( 0 ), nTab( 0 ),
120 		bIgnoreEmptyRows( false ), bDetectCategories( false ),
121 		bMakeTotalCol( true ), bMakeTotalRow( true )
122 {
123 }
124 
125 bool ScPivotParam::operator==( const ScPivotParam& r ) const
126 {
127 	return
128         (nCol == r.nCol)
129 	 &&	(nRow == r.nRow)
130 	 && (nTab == r.nTab)
131 	 && (bIgnoreEmptyRows  == r.bIgnoreEmptyRows)
132 	 && (bDetectCategories == r.bDetectCategories)
133 	 && (bMakeTotalCol == r.bMakeTotalCol)
134 	 && (bMakeTotalRow == r.bMakeTotalRow)
135      && (maLabelArray.size() == r.maLabelArray.size())  // ! only size??
136      && (maPageArr == r.maPageArr)
137 	 && (maColArr == r.maColArr)
138 	 && (maRowArr == r.maRowArr)
139 	 && (maDataArr == r.maDataArr);
140 }
141 
142 // ============================================================================
143 
144 ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask ) :
145     mnCol( nCol ),
146     mnFuncMask( nFuncMask )
147 {
148 }
149 
150 ScPivotFuncData::ScPivotFuncData( SCCOL nCol, sal_uInt16 nFuncMask, const DataPilotFieldReference& rFieldRef ) :
151     mnCol( nCol ),
152     mnFuncMask( nFuncMask ),
153     maFieldRef( rFieldRef )
154 {
155 }
156 
157 // ============================================================================
158 
159