1*38d50f7bSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*38d50f7bSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*38d50f7bSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*38d50f7bSAndrew Rist * distributed with this work for additional information 6*38d50f7bSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*38d50f7bSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*38d50f7bSAndrew Rist * "License"); you may not use this file except in compliance 9*38d50f7bSAndrew Rist * with the License. You may obtain a copy of the License at 10*38d50f7bSAndrew Rist * 11*38d50f7bSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*38d50f7bSAndrew Rist * 13*38d50f7bSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*38d50f7bSAndrew Rist * software distributed under the License is distributed on an 15*38d50f7bSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*38d50f7bSAndrew Rist * KIND, either express or implied. See the License for the 17*38d50f7bSAndrew Rist * specific language governing permissions and limitations 18*38d50f7bSAndrew Rist * under the License. 19*38d50f7bSAndrew Rist * 20*38d50f7bSAndrew Rist *************************************************************/ 21*38d50f7bSAndrew Rist 22*38d50f7bSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef SC_RANGESEQ_HXX 25cdf0e10cSrcweir #define SC_RANGESEQ_HXX 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include <tools/solar.h> 28cdf0e10cSrcweir #include <com/sun/star/uno/Any.h> 29cdf0e10cSrcweir #include "scmatrix.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir class SvNumberFormatter; 32cdf0e10cSrcweir class ScDocument; 33cdf0e10cSrcweir class ScRange; 34cdf0e10cSrcweir 35cdf0e10cSrcweir class ScRangeToSequence 36cdf0e10cSrcweir { 37cdf0e10cSrcweir public: 38cdf0e10cSrcweir static sal_Bool FillLongArray( com::sun::star::uno::Any& rAny, 39cdf0e10cSrcweir ScDocument* pDoc, const ScRange& rRange ); 40cdf0e10cSrcweir static sal_Bool FillLongArray( com::sun::star::uno::Any& rAny, 41cdf0e10cSrcweir const ScMatrix* pMatrix ); 42cdf0e10cSrcweir static sal_Bool FillDoubleArray( com::sun::star::uno::Any& rAny, 43cdf0e10cSrcweir ScDocument* pDoc, const ScRange& rRange ); 44cdf0e10cSrcweir static sal_Bool FillDoubleArray( com::sun::star::uno::Any& rAny, 45cdf0e10cSrcweir const ScMatrix* pMatrix ); 46cdf0e10cSrcweir static sal_Bool FillStringArray( com::sun::star::uno::Any& rAny, 47cdf0e10cSrcweir ScDocument* pDoc, const ScRange& rRange ); 48cdf0e10cSrcweir static sal_Bool FillStringArray( com::sun::star::uno::Any& rAny, 49cdf0e10cSrcweir const ScMatrix* pMatrix, SvNumberFormatter* pFormatter ); 50cdf0e10cSrcweir static sal_Bool FillMixedArray( com::sun::star::uno::Any& rAny, 51cdf0e10cSrcweir ScDocument* pDoc, const ScRange& rRange, 52cdf0e10cSrcweir sal_Bool bAllowNV = sal_False ); 53cdf0e10cSrcweir 54cdf0e10cSrcweir /** @param bDataTypes 55cdf0e10cSrcweir Additionally to the differentiation between string and double allow 56cdf0e10cSrcweir differentiation between other types such as as boolean. Needed for 57cdf0e10cSrcweir implementation of XFormulaParser. If <FALSE/>, boolean values are 58cdf0e10cSrcweir treated as ordinary double values 1 (true) and 0 (false). 59cdf0e10cSrcweir */ 60cdf0e10cSrcweir static sal_Bool FillMixedArray( com::sun::star::uno::Any& rAny, 61cdf0e10cSrcweir const ScMatrix* pMatrix, bool bDataTypes = false ); 62cdf0e10cSrcweir }; 63cdf0e10cSrcweir 64cdf0e10cSrcweir 65cdf0e10cSrcweir class ScApiTypeConversion 66cdf0e10cSrcweir { 67cdf0e10cSrcweir public: 68cdf0e10cSrcweir 69cdf0e10cSrcweir /** Convert an uno::Any to double if possible, including integer types. 70cdf0e10cSrcweir @param o_fVal 71cdf0e10cSrcweir Out: the double value on successful conversion. 72cdf0e10cSrcweir @param o_eClass 73cdf0e10cSrcweir Out: the uno::TypeClass of rAny. 74cdf0e10cSrcweir @returns <TRUE/> if successfully converted. 75cdf0e10cSrcweir */ 76cdf0e10cSrcweir static bool ConvertAnyToDouble( 77cdf0e10cSrcweir double & o_fVal, 78cdf0e10cSrcweir com::sun::star::uno::TypeClass & o_eClass, 79cdf0e10cSrcweir const com::sun::star::uno::Any & rAny ); 80cdf0e10cSrcweir 81cdf0e10cSrcweir }; 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir class ScSequenceToMatrix 85cdf0e10cSrcweir { 86cdf0e10cSrcweir public: 87cdf0e10cSrcweir 88cdf0e10cSrcweir /** Convert a sequence of mixed elements to ScMatrix. 89cdf0e10cSrcweir 90cdf0e10cSrcweir Precondition: rAny.getValueType().equals( getCppuType( (uno::Sequence< uno::Sequence< uno::Any > > *)0)) 91cdf0e10cSrcweir 92cdf0e10cSrcweir @returns a new'd ScMatrix as ScMatrixRef, NULL if rAny couldn't be read 93cdf0e10cSrcweir as type Sequence<Sequence<Any>> 94cdf0e10cSrcweir */ 95cdf0e10cSrcweir static ScMatrixRef CreateMixedMatrix( const com::sun::star::uno::Any & rAny ); 96cdf0e10cSrcweir 97cdf0e10cSrcweir }; 98cdf0e10cSrcweir 99cdf0e10cSrcweir 100cdf0e10cSrcweir class ScByteSequenceToString 101cdf0e10cSrcweir { 102cdf0e10cSrcweir public: 103cdf0e10cSrcweir // rAny must contain Sequence<sal_Int8>, 104cdf0e10cSrcweir // may or may not contain 0-bytes at the end 105cdf0e10cSrcweir static sal_Bool GetString( String& rString, const com::sun::star::uno::Any& rAny, 106cdf0e10cSrcweir sal_uInt16 nEncoding ); 107cdf0e10cSrcweir }; 108cdf0e10cSrcweir 109cdf0e10cSrcweir #endif 110cdf0e10cSrcweir 111