View | Details | Raw Unified | Return to issue 45843
Collapse All | Expand All

(-)sc/inc/compiler.hrc (-2 / +3 lines)
Lines 363-371 Link Here
363
#define SC_OPCODE_BAHTTEXT          388
363
#define SC_OPCODE_BAHTTEXT          388
364
#define	SC_OPCODE_INDIRECT_XL		389		/* See also INDIRECT for OOO variant */
364
#define	SC_OPCODE_INDIRECT_XL		389		/* See also INDIRECT for OOO variant */
365
#define	SC_OPCODE_ADRESS_XL		    390		/* See also ADRESS for OOO variant */
365
#define	SC_OPCODE_ADRESS_XL		    390		/* See also ADRESS for OOO variant */
366
#define	SC_OPCODE_END_2_PAR			391
366
#define SC_OPCODE_GET_PIVOT_DATA	391
367
#define	SC_OPCODE_END_2_PAR			392
367
368
368
#define SC_OPCODE_LAST_OPCODE_ID    390      /* letzter OpCode */
369
#define SC_OPCODE_LAST_OPCODE_ID    391      /* letzter OpCode */
369
370
370
/*** Interna ***/
371
/*** Interna ***/
371
#define	SC_OPCODE_INTERNAL_BEGIN   9995
372
#define	SC_OPCODE_INTERNAL_BEGIN   9995
(-)sc/inc/document.hxx (+1 lines)
Lines 471-476 SC_DLLPUBLIC ScDBCollection* GetDBCollec Link Here
471
471
472
	ScDPCollection*		GetDPCollection();
472
	ScDPCollection*		GetDPCollection();
473
	ScDPObject*			GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
473
	ScDPObject*			GetDPAtCursor(SCCOL nCol, SCROW nRow, SCTAB nTab) const;
474
	ScDPObject*			GetDPAtBlock( const ScRange & rBlock ) const;
474
475
475
	ScPivotCollection*	GetPivotCollection() const;
476
	ScPivotCollection*	GetPivotCollection() const;
476
	void				SetPivotCollection(ScPivotCollection* pNewPivotCollection);
477
	void				SetPivotCollection(ScPivotCollection* pNewPivotCollection);
(-)sc/inc/dpobject.hxx (-1 / +6 lines)
Lines 52-62 Link Here
52
#include "collect.hxx"
52
#include "collect.hxx"
53
#endif
53
#endif
54
54
55
#ifndef SC_DPOUTPUT_HXX
56
#include "dpoutput.hxx"
57
#endif
58
55
#ifndef _COM_SUN_STAR_SHEET_XDIMENSIONSSUPPLIER_HPP_
59
#ifndef _COM_SUN_STAR_SHEET_XDIMENSIONSSUPPLIER_HPP_
56
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
60
#include <com/sun/star/sheet/XDimensionsSupplier.hpp>
57
#endif
61
#endif
58
62
59
60
//------------------------------------------------------------------
63
//------------------------------------------------------------------
61
64
62
65
Lines 173-178 public: Link Here
173
    BOOL                IsDuplicated( long nDim );
176
    BOOL                IsDuplicated( long nDim );
174
    long                GetDimCount();
177
    long                GetDimCount();
175
	void				GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
178
	void				GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
179
	BOOL				GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */
180
									  const std::vector< ScDPGetPivotDataField >& rFilters );
176
	long				GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
181
	long				GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
177
	BOOL				GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
182
	BOOL				GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
178
										long nDragDim,
183
										long nDragDim,
(-)sc/inc/dpoutput.hxx (+15 lines)
Lines 56-61 Link Here
56
#include "address.hxx"
56
#include "address.hxx"
57
#endif
57
#endif
58
58
59
#ifndef __SGI_STL_VECTOR
60
#include <vector>
61
#endif
62
59
class Rectangle;
63
class Rectangle;
60
class SvStream;
64
class SvStream;
61
class ScDocument;
65
class ScDocument;
Lines 77-82 struct ScDPPositionData Link Here
77
	ScDPPositionData() { nDimension = nHierarchy = nLevel = -1; nFlags = 0; }	// invalid
81
	ScDPPositionData() { nDimension = nHierarchy = nLevel = -1; nFlags = 0; }	// invalid
78
};
82
};
79
83
84
struct ScDPGetPivotDataField
85
{
86
	String maFieldName;
87
88
	bool   mbValIsStr;
89
	String maValStr;
90
	double mnValNum;
91
};
92
80
93
81
94
82
class ScDPOutput			//! name???
95
class ScDPOutput			//! name???
Lines 143-148 public: Link Here
143
	BOOL			HasError();			// range overflow or exception from source
156
	BOOL			HasError();			// range overflow or exception from source
144
157
145
	void			GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
158
	void			GetPositionData( ScDPPositionData& rData, const ScAddress& rPos );
159
	BOOL			GetPivotData( ScDPGetPivotDataField& rTarget, /* returns result */
160
								  const std::vector< ScDPGetPivotDataField >& rFilters );
146
	long			GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
161
	long			GetHeaderDim( const ScAddress& rPos, USHORT& rOrient );
147
	BOOL			GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
162
	BOOL			GetHeaderDrag( const ScAddress& rPos, BOOL bMouseLeft, BOOL bMouseTop,
148
									long nDragDim,
163
									long nDragDim,
(-)sc/inc/opcode.hxx (+1 lines)
Lines 377-382 enum OpCodeEnum Link Here
377
		ocDecimal			= SC_OPCODE_DECIMAL,
377
		ocDecimal			= SC_OPCODE_DECIMAL,
378
		ocConvert			= SC_OPCODE_CONVERT,
378
		ocConvert			= SC_OPCODE_CONVERT,
379
		ocRoman				= SC_OPCODE_ROMAN,
379
		ocRoman				= SC_OPCODE_ROMAN,
380
        ocGetPivotData      = SC_OPCODE_GET_PIVOT_DATA,
380
        ocHyperLink         = SC_OPCODE_HYPERLINK,
381
        ocHyperLink         = SC_OPCODE_HYPERLINK,
381
        ocBahtText          = SC_OPCODE_BAHTTEXT,
382
        ocBahtText          = SC_OPCODE_BAHTTEXT,
382
		ocEnd2Par			= SC_OPCODE_END_2_PAR,
383
		ocEnd2Par			= SC_OPCODE_END_2_PAR,
(-)sc/inc/scfuncs.hrc (+1 lines)
Lines 299-304 Link Here
299
#define HID_FUNC_HYPERLINK			(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+20)
299
#define HID_FUNC_HYPERLINK			(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+20)
300
#define HID_FUNC_INDIREKT_XL		(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+21)
300
#define HID_FUNC_INDIREKT_XL		(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+21)
301
#define HID_FUNC_ADRESSE_XL			(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+22)
301
#define HID_FUNC_ADRESSE_XL			(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+22)
302
#define HID_FUNC_GETPIVOTDATA		(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TABLE*ID_FUNCTION_OFFSET)+23)
302
303
303
#define HID_FUNC_CODE				(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TEXT*ID_FUNCTION_OFFSET)+1)
304
#define HID_FUNC_CODE				(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TEXT*ID_FUNCTION_OFFSET)+1)
304
#define HID_FUNC_DM					(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TEXT*ID_FUNCTION_OFFSET)+2)
305
#define HID_FUNC_DM					(HID_SC_FUNC_DUMMY+(ID_FUNCTION_GRP_TEXT*ID_FUNCTION_OFFSET)+2)
(-)sc/source/core/data/documen3.cxx (+15 lines)
Lines 271-276 ScDPObject* ScDocument::GetDPAtCursor(SC Link Here
271
	return NULL;
271
	return NULL;
272
}
272
}
273
273
274
ScDPObject*	ScDocument::GetDPAtBlock( const ScRange & rBlock ) const
275
{
276
	if (!pDPCollection)
277
		return NULL;
278
279
	/* Walk the collection in reverse order to get something of an
280
	 * approximation of MS Excels 'most recent' effect. */
281
	USHORT i = pDPCollection->GetCount();
282
	while ( i-- > 0 )
283
		if ( (*pDPCollection)[i]->GetOutRange().In( rBlock ) )
284
			return (*pDPCollection)[i];
285
286
	return NULL;
287
}
288
274
ScPivotCollection* ScDocument::GetPivotCollection() const
289
ScPivotCollection* ScDocument::GetPivotCollection() const
275
{
290
{
276
	return pPivotCollection;
291
	return pPivotCollection;
(-)sc/source/core/data/dpobject.cxx (+9 lines)
Lines 800-805 void ScDPObject::GetPositionData( ScDPPo Link Here
800
	pOutput->GetPositionData( rData, rPos );
800
	pOutput->GetPositionData( rData, rPos );
801
}
801
}
802
802
803
// Returns TRUE on success and stores the result in rTarget
804
BOOL ScDPObject::GetPivotData( ScDPGetPivotDataField& rTarget,
805
							   const std::vector< ScDPGetPivotDataField >& rFilters )
806
{
807
	CreateOutput();				// create xSource and pOutput if not already done
808
809
	return pOutput->GetPivotData( rTarget, rFilters );
810
}
811
803
BOOL ScDPObject::IsFilterButton( const ScAddress& rPos )
812
BOOL ScDPObject::IsFilterButton( const ScAddress& rPos )
804
{
813
{
805
	CreateOutput();				// create xSource and pOutput if not already done
814
	CreateOutput();				// create xSource and pOutput if not already done
(-)sc/source/core/data/dpoutput.cxx (+215 lines)
Lines 986-991 void ScDPOutput::GetPositionData( ScDPPo Link Here
986
	}
986
	}
987
}
987
}
988
988
989
#undef DEBUG_GETPIVOTTABLE
990
#ifdef DEBUG_GETPIVOTTABLE
991
#include <stdio.h>
992
static const sal_Char* dbg_dump( const ByteString& rStr)
993
{
994
	static ByteString aStr;
995
	aStr = rStr;
996
	aStr.Append(static_cast< char >(0));
997
	return aStr.GetBuffer();
998
}
999
static const sal_Char* dbg_dump( const UniString& rStr)
1000
{
1001
	return dbg_dump(ByteString(rStr, RTL_TEXTENCODING_UTF8));
1002
}
1003
1004
static void lcl_dumpOutputLevel( const char* name, char id_char,
1005
								 long n, const ScDPOutLevelData* pFields )
1006
{
1007
	fprintf(stderr, "=================================\n");
1008
	fprintf(stderr, "#%s = %03ld\n", name, n);
1009
	for (long i=0; i<n; i++)
1010
	{
1011
		fprintf(stderr, "\t%c%03ld) : %s\n", id_char, i,
1012
				dbg_dump( pFields[i].aCaption ));
1013
1014
		const uno::Sequence<sheet::MemberResult> rSequence = pFields[i].aResult;
1015
		const sheet::MemberResult* pArray = rSequence.getConstArray();
1016
		for (long j = 0 ; j < rSequence.getLength(); j++)
1017
		{
1018
			fprintf(stderr, "\t\t%3ld) : \'%s\' %lx\n", j,
1019
					dbg_dump( pArray[j].Name ), rSequence[j].Flags );
1020
		}
1021
	}
1022
}
1023
#endif
1024
1025
// Returns TRUE if the filter matched
1026
static BOOL lcl_getPivotDataApplyFilter( const ScDPGetPivotDataField & rFilter,
1027
										 long n, const ScDPOutLevelData* pFields,
1028
										 std::vector< BOOL >& rResult )
1029
{
1030
	for( long int i=0 ; i < n ; i++ )
1031
	{
1032
		// WORRY : Can Caption be different from Name ?
1033
		if( rFilter.maFieldName == pFields[i].aCaption)
1034
		{
1035
			BOOL	bPrev = FALSE;
1036
1037
			const uno::Sequence<sheet::MemberResult> rSequence = pFields[i].aResult;
1038
			const sheet::MemberResult* pArray = rSequence.getConstArray();
1039
1040
			DBG_ASSERT( rResult.size() == rSequence.getLength(),
1041
						"Number of fields do not match result count" );
1042
1043
			for( signed long int j=0 ; j < rResult.size(); j++ )
1044
			{
1045
				if( rResult[j] )
1046
				{
1047
					if( rSequence[j].Flags & sheet::MemberResultFlags::SUBTOTAL )
1048
						rResult[j] = FALSE;
1049
					else if( rSequence[j].Flags & sheet::MemberResultFlags::CONTINUE )
1050
						rResult[j] = bPrev;
1051
					else if( rSequence[j].Flags & sheet::MemberResultFlags::HASMEMBER )
1052
						rResult[j] = bPrev =
1053
							( String( pArray[j].Name ) == rFilter.maValStr );
1054
				}
1055
			}
1056
			return TRUE;
1057
		}
1058
	}
1059
1060
	return FALSE;
1061
}
1062
1063
// Returns TRUE on success and stores the result in rTarget
1064
// Returns FALSE if rFilters or rTarget describes something that is not visible
1065
BOOL ScDPOutput::GetPivotData( ScDPGetPivotDataField& rTarget,
1066
							   const std::vector< ScDPGetPivotDataField >& rFilters )
1067
{
1068
	CalcSizes();
1069
1070
#ifdef DEBUG_GETPIVOTTABLE
1071
	{
1072
		lcl_dumpOutputLevel ("PageHeaders", 'P', nPageFieldCount, pPageFields);
1073
		lcl_dumpOutputLevel ("ColHeaders", 'C', nColFieldCount, pColFields);
1074
		lcl_dumpOutputLevel ("RowHeaders", 'R', nRowFieldCount, pRowFields);
1075
1076
		fprintf(stderr, "=================================\n");
1077
		fprintf(stderr, "#Rows = %03ld\n", nRowCount);
1078
		const uno::Sequence<sheet::DataResult>* pRowAry = aData.getConstArray();
1079
		for (long nRow=0; nRow<nRowCount; nRow++)
1080
		{
1081
			const sheet::DataResult* pColAry = pRowAry[nRow].getConstArray();
1082
			long nThisColCount = pRowAry[nRow].getLength();
1083
			fprintf(stderr, "R %03ld\n", nRow);
1084
			for (long nCol=0; nCol<nThisColCount; nCol++)
1085
			{
1086
				const sheet::DataResult& rData = pColAry[nCol];
1087
				const long nFlags = rData.Flags;
1088
1089
				fprintf(stderr, "\tC%03ld) %4lx ->", nCol, nFlags);
1090
1091
				if ( nFlags & sheet::DataResultFlags::ERROR )
1092
				{
1093
					fprintf(stderr, "ERR" );
1094
				}
1095
				else if ( nFlags & (sheet::DataResultFlags::HASDATA |
1096
									sheet::DataResultFlags::SUBTOTAL ))
1097
				{
1098
					fprintf(stderr, "%g", rData.Value );
1099
				}
1100
				fprintf(stderr, "\n" );
1101
			}
1102
		}
1103
	}
1104
#endif
1105
1106
	std::vector< BOOL >	aIncludeCol( nColCount, TRUE );
1107
	std::vector< BOOL >	aIncludeRow( nRowCount, TRUE );
1108
	BOOL aFilterApplied;
1109
	signed long int i;
1110
1111
	for( long int nFilter=0 ; nFilter < rFilters.size() ; nFilter++ )
1112
	{
1113
		aFilterApplied = FALSE;
1114
		for( long int i=0 ; i < nPageFieldCount ; i++ )
1115
		{
1116
			// WORRY : Can Caption be different from Name ?
1117
			if( rFilters[nFilter].maFieldName == pPageFields[i].aCaption )
1118
			{
1119
				signed long int j;
1120
1121
				DBG_ASSERT( aFilters[i].mbValIsStr , "Numeric Page filter ?" );
1122
1123
				const uno::Sequence<sheet::MemberResult> rSequence = pPageFields[i].aResult;
1124
				const sheet::MemberResult* pArray = rSequence.getConstArray();
1125
				for( j = rSequence.getLength(); j-- > 0 ; )
1126
				{
1127
					if( String( pArray[j].Name) == rFilters[nFilter].maValStr )
1128
						break;
1129
				}
1130
1131
				// We operate on VISIBLE data only.
1132
				// Selecting a hidden page is an error
1133
				if( j < 0 )
1134
					return FALSE;
1135
				aFilterApplied = TRUE;
1136
				break;
1137
			}
1138
		}
1139
		if( aFilterApplied )
1140
			continue;
1141
1142
		if( !lcl_getPivotDataApplyFilter( rFilters[nFilter], nColFieldCount,
1143
										 pColFields, aIncludeCol ) &&
1144
			!lcl_getPivotDataApplyFilter( rFilters[nFilter], nRowFieldCount,
1145
										 pRowFields, aIncludeRow ) )
1146
		{
1147
			// All filter fields must be used
1148
			return FALSE;
1149
		}
1150
	}
1151
1152
	// ensure that at least 1 col is visible
1153
	for( i = aIncludeCol.size() ; i-- > 0 ; )
1154
	{
1155
		if( aIncludeCol[i] )
1156
			break;
1157
	}
1158
	if( i < 0 )
1159
		return FALSE;
1160
1161
	// ensure that at least 1 row is visible
1162
	for( i = aIncludeRow.size() ; i-- > 0 ; )
1163
	{
1164
		if( aIncludeRow[i] )
1165
			break;
1166
	}
1167
	if( i < 0 )
1168
		return FALSE;
1169
1170
	double accum = 0.;
1171
	std::vector< BOOL >	aRowPrev( nRowFieldCount, TRUE );
1172
1173
	const uno::Sequence<sheet::DataResult>* pRowAry = aData.getConstArray();
1174
	for (long nRow=0; nRow<nRowCount; nRow++)
1175
	{
1176
		if( aIncludeRow[nRow] )
1177
		{
1178
			const sheet::DataResult* pColAry = pRowAry[nRow].getConstArray();
1179
			long nThisColCount = pRowAry[nRow].getLength();
1180
			for (long nCol=0; nCol<nThisColCount; nCol++)
1181
			{
1182
				if( aIncludeCol[nCol] )
1183
				{
1184
					const sheet::DataResult& rData = pColAry[nCol];
1185
1186
					// If there are no filters for cols or no filters for rows
1187
					// then subtotals still appear
1188
					if( (rData.Flags & (sheet::DataResultFlags::HASDATA|
1189
										sheet::DataResultFlags::SUBTOTAL|
1190
										sheet::DataResultFlags::ERROR)) == sheet::DataResultFlags::HASDATA )
1191
					{
1192
						accum += rData.Value;
1193
					}
1194
				}
1195
			}
1196
		}
1197
	}
1198
1199
	rTarget.mbValIsStr = FALSE;
1200
	rTarget.mnValNum = accum;
1201
	return TRUE;
1202
}
1203
989
BOOL ScDPOutput::IsFilterButton( const ScAddress& rPos )
1204
BOOL ScDPOutput::IsFilterButton( const ScAddress& rPos )
990
{
1205
{
991
	SCCOL nCol = rPos.Col();
1206
	SCCOL nCol = rPos.Col();
(-)sc/source/core/inc/interpre.hxx (+1 lines)
Lines 452-457 BOOL SetSbxVariable( SbxVariable* pVar, Link Here
452
void ScErrorType();
452
void ScErrorType();
453
void ScDBArea();
453
void ScDBArea();
454
void ScColRowNameAuto();
454
void ScColRowNameAuto();
455
void ScGetPivotData();
455
void ScHyperLink();
456
void ScHyperLink();
456
void ScBahtText();
457
void ScBahtText();
457
void ScCalcTeam();
458
void ScCalcTeam();
(-)sc/source/core/src/compiler.src (+6 lines)
Lines 1673-1678 Resource RID_SC_FUNCTION_NAMES Link Here
1673
		Text [ de ] = "RĂ–MISCH";
1673
		Text [ de ] = "RĂ–MISCH";
1674
		Text [ en-US ] = "ROMAN";
1674
		Text [ en-US ] = "ROMAN";
1675
	};
1675
	};
1676
	String SC_OPCODE_GET_PIVOT_DATA
1677
	{
1678
		Text [ de ] = "GETPIVOTDATA";
1679
		Text [ en-US ] = "GETPIVOTDATA" ;
1680
	};
1676
	String SC_OPCODE_HYPERLINK
1681
	String SC_OPCODE_HYPERLINK
1677
	{
1682
	{
1678
		Text [ de ] = "HYPERLINK";
1683
		Text [ de ] = "HYPERLINK";
Lines 1979-1984 Resource RID_SC_FUNCTION_NAMES_ENGLISH Link Here
1979
	String SC_OPCODE_CONVERT { Text = "CONVERT" ; };
1984
	String SC_OPCODE_CONVERT { Text = "CONVERT" ; };
1980
	String SC_OPCODE_ROMAN { Text = "ROMAN" ; };
1985
	String SC_OPCODE_ROMAN { Text = "ROMAN" ; };
1981
	String SC_OPCODE_ARABIC { Text = "ARABIC" ; };
1986
	String SC_OPCODE_ARABIC { Text = "ARABIC" ; };
1987
	String SC_OPCODE_GET_PIVOT_DATA { Text = "GETPIVOTDATA" ; };
1982
	String SC_OPCODE_HYPERLINK { Text = "HYPERLINK" ; };
1988
	String SC_OPCODE_HYPERLINK { Text = "HYPERLINK" ; };
1983
    String SC_OPCODE_BAHTTEXT { Text = "BAHTTEXT" ; };
1989
    String SC_OPCODE_BAHTTEXT { Text = "BAHTTEXT" ; };
1984
};
1990
};
(-)sc/source/core/tool/interpr2.cxx (+104 lines)
Lines 62-67 Link Here
62
#include "unitconv.hxx"
62
#include "unitconv.hxx"
63
#include "globstr.hrc"
63
#include "globstr.hrc"
64
#include "hints.hxx"
64
#include "hints.hxx"
65
#include "dpobject.hxx"
65
66
66
// STATIC DATA -----------------------------------------------------------
67
// STATIC DATA -----------------------------------------------------------
67
68
Lines 2282-2287 void ScInterpreter::ScArabic() Link Here
2282
	}
2283
	}
2283
}
2284
}
2284
2285
2286
// TODO
2287
// 	1) check need for array iteration in filter name/values
2288
// 	2) check error when passing double as target field (GetString converts double -> str
2289
// 	3) check handling of names as src pivot range
2290
void ScInterpreter::ScGetPivotData()
2291
{
2292
	BYTE nParamCount = GetByte();
2293
2294
    if ( MustHaveParamCount( nParamCount, 2, 30 ) )
2295
	{
2296
		// there must be an even number of args
2297
		// 		target, ref, then field/item pairs
2298
		if( (nParamCount % 2) == 1)
2299
			goto failed;
2300
2301
		unsigned int i = nParamCount / 2 - 1;
2302
		std::vector< ScDPGetPivotDataField > aFilters( i );
2303
2304
		while( i-- > 0 )
2305
		{
2306
			switch (GetStackType())
2307
			{
2308
			case svDouble :
2309
#if 0
2310
				// Force everything to strings for now because the DPOutput
2311
				// uses pure strings
2312
				aFilters[i].mbValIsStr = FALSE;
2313
				aFilters[i].mnValNum = GetDouble();
2314
				break;
2315
#endif
2316
				// FALL THROUGH
2317
2318
			case svString:
2319
				aFilters[i].mbValIsStr = TRUE;
2320
				aFilters[i].maValStr = GetString();
2321
				break;
2322
2323
			case svSingleRef :
2324
				{
2325
					ScAddress aAddr;
2326
					PopSingleRef( aAddr );
2327
					const ScBaseCell* pCell = GetCell( aAddr );
2328
#if 0
2329
					if ( (aFilters[i].mbValIsStr = !HasCellValueData(pCell)) )
2330
						GetCellString(aFilters[i].maValStr, pCell);
2331
					else
2332
						aFilters[i].mnValNum = GetCellValue( aAddr, pCell );
2333
#else
2334
					aFilters[i].mbValIsStr = TRUE;
2335
					GetCellString(aFilters[i].maValStr, pCell);
2336
#endif
2337
				}
2338
				break;
2339
2340
			// case svDoubleRef : TODO ?? Do we need implicit iteration support ?
2341
			default :
2342
				SetError( errIllegalParameter );
2343
				return;
2344
			}
2345
			aFilters[i].maFieldName = GetString();
2346
		}
2347
2348
		ScDPGetPivotDataField aTarget; /* returns result */
2349
		ScRange aBlock;
2350
2351
		switch ( GetStackType() )
2352
		{
2353
		case svDoubleRef :
2354
			PopDoubleRef( aBlock );
2355
			break;
2356
2357
		case svSingleRef :
2358
			{
2359
				ScAddress aAddr;
2360
				PopSingleRef( aAddr );
2361
				aBlock = aAddr;
2362
				break;
2363
			}
2364
		default:
2365
			goto failed;
2366
		}
2367
		// NOTE : MS Excel docs claim to use the 'most recent' which is not
2368
		// exactly the same as what we do in ScDocument::GetDPAtBlock
2369
		// However we do need to use GetDPABlock
2370
		ScDPObject *pSource = pDok->GetDPAtBlock ( aBlock );
2371
		if( NULL == pSource)
2372
			goto failed;
2373
 
2374
        aTarget.maFieldName = GetString();
2375
2376
		if(	pSource->GetPivotData( aTarget, aFilters ) )
2377
		{
2378
			if( aTarget.mbValIsStr )
2379
				PushString( aTarget.maValStr );
2380
			else
2381
				PushDouble( aTarget.mnValNum );
2382
			return;
2383
		}
2384
	}
2385
2386
failed :
2387
	SetError( errNoRef );
2388
}
2285
2389
2286
void ScInterpreter::ScHyperLink()
2390
void ScInterpreter::ScHyperLink()
2287
{
2391
{
(-)sc/source/core/tool/interpr4.cxx (+1 lines)
Lines 3510-3515 StackVar ScInterpreter::Interpret() Link Here
3510
                case ocRoman            : ScRoman();                    break;
3510
                case ocRoman            : ScRoman();                    break;
3511
                case ocArabic           : ScArabic();                   break;
3511
                case ocArabic           : ScArabic();                   break;
3512
                case ocInfo             : ScInfo();                     break;
3512
                case ocInfo             : ScInfo();                     break;
3513
                case ocGetPivotData     : ScGetPivotData();             break;
3513
                case ocHyperLink        : ScHyperLink();                break;
3514
                case ocHyperLink        : ScHyperLink();                break;
3514
                case ocBahtText         : ScBahtText();                 break;
3515
                case ocBahtText         : ScBahtText();                 break;
3515
                case ocAnswer           : ScAnswer();                   break;
3516
                case ocAnswer           : ScAnswer();                   break;
(-)sc/source/filter/excel/xlformula.cxx (-1 / +2 lines)
Lines 318-324 static const XclFunctionInfo saFuncTable Link Here
318
    { ocCountIf,            346,    2,  2,  V, { R, V } },
318
    { ocCountIf,            346,    2,  2,  V, { R, V } },
319
    { ocCountEmptyCells,    347,    1,  1,  V, { R } },
319
    { ocCountEmptyCells,    347,    1,  1,  V, { R } },
320
    { ocISPMT,              350,    4,  4,  V, { V } },
320
    { ocISPMT,              350,    4,  4,  V, { V } },
321
    { ocRoman,              354,    1,  2,  V, { V } }
321
    { ocRoman,              354,    1,  2,  V, { V } },
322
    { ocGetPivotData,       358,    2,  30, V, { V, R, V } }
322
};
323
};
323
324
324
#define EXC_FUNCNAME_PREFIX "_xlfn."
325
#define EXC_FUNCNAME_PREFIX "_xlfn."
(-)sc/source/ui/src/scfuncs.src (+45 lines)
Lines 9957-9962 Resource RID_SC_FUNCTION_DESCRIPTIONS2 Link Here
9957
			Text [ x-comment ] = " ";
9957
			Text [ x-comment ] = " ";
9958
		};
9958
		};
9959
	};
9959
	};
9960
    Resource SC_OPCODE_GET_PIVOT_DATA
9961
	{
9962
		String 1 // Description
9963
		{
9964
			Text [ de ] = "" ;
9965
			Text [ en-US ] = "Extracts value(s) from a DataPilot.";
9966
		};
9967
		ExtraData =
9968
		{
9969
			ID_FUNCTION_GRP_TABLE;
9970
			U2S( HID_FUNC_GETPIVOTDATA );
9971
			VAR_ARGS+2;      0;	0;	1;
9972
		};
9973
		String 2 // Name of Parameter 1
9974
		{
9975
			Text [ de ] = "" ;
9976
			Text [ en-US ] = "Target Field";
9977
		};
9978
		String 3 // Description of Parameter 1
9979
		{
9980
			Text [ de ] = "" ;
9981
			Text [ en-US ] = "The name of the data pilot field to extract.";
9982
		};
9983
		String 4 // Name of Parameter 2
9984
		{
9985
			Text [ de ] = "" ;
9986
			Text [ en-US ] = "Data Pilot";
9987
		};
9988
		String 5 // Description of Parameter 2
9989
		{
9990
			Text [ de ] = "" ;
9991
			Text [ en-US ] = "a reference to a cell or range in Data Pilot with the source data.";
9992
		};
9993
		String 6 // Name of Parameter 3
9994
		{
9995
			Text [ de ] = "" ;
9996
			Text [ en-US ] = "Field Name / Item";
9997
		};
9998
		String 7 // Description of Parameter 3
9999
		{
10000
			Text [ de ] = "" ;
10001
			Text [ en-US ] = "Field name/value pair to filter the target data.";
10002
		};
10003
	};
10004
9960
	 // -=*# Resource for function HYPERLINK #*=-
10005
	 // -=*# Resource for function HYPERLINK #*=-
9961
	Resource SC_OPCODE_HYPERLINK
10006
	Resource SC_OPCODE_HYPERLINK
9962
	{
10007
	{
(-)sc/source/filter/excel/xipivot.cxx (+8 lines)
Lines 1225-1230 void XclImpPivotTable::Apply() const Link Here
1225
    pDPObj->SetOutRange( aOutRange );
1225
    pDPObj->SetOutRange( aOutRange );
1226
    pDPObj->SetAlive( TRUE );
1226
    pDPObj->SetAlive( TRUE );
1227
    GetDoc().GetDPCollection()->Insert( pDPObj );
1227
    GetDoc().GetDPCollection()->Insert( pDPObj );
1228
    if( pDPObj )
1229
    {
1230
	// THINK ABOUT THIS
1231
	// ScDPObject::Output is quite heavy.  The xml importer uses
1232
	// RefreshAfterLoad instead but that does not generate the in sheet
1233
	// controls.
1234
	pDPObj->Output(); // force the creation of the sheet controls
1235
    }
1228
}
1236
}
1229
1237
1230
// ============================================================================
1238
// ============================================================================

Return to issue 45843