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