1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rangeseq.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_RANGESEQ_HXX
32 #define SC_RANGESEQ_HXX
34 #include <tools/solar.h>
35 #include <com/sun/star/uno/Any.h>
36 #include "scmatrix.hxx"
38 class SvNumberFormatter
;
42 class ScRangeToSequence
45 static BOOL
FillLongArray( com::sun::star::uno::Any
& rAny
,
46 ScDocument
* pDoc
, const ScRange
& rRange
);
47 static BOOL
FillLongArray( com::sun::star::uno::Any
& rAny
,
48 const ScMatrix
* pMatrix
);
49 static BOOL
FillDoubleArray( com::sun::star::uno::Any
& rAny
,
50 ScDocument
* pDoc
, const ScRange
& rRange
);
51 static BOOL
FillDoubleArray( com::sun::star::uno::Any
& rAny
,
52 const ScMatrix
* pMatrix
);
53 static BOOL
FillStringArray( com::sun::star::uno::Any
& rAny
,
54 ScDocument
* pDoc
, const ScRange
& rRange
);
55 static BOOL
FillStringArray( com::sun::star::uno::Any
& rAny
,
56 const ScMatrix
* pMatrix
, SvNumberFormatter
* pFormatter
);
57 static BOOL
FillMixedArray( com::sun::star::uno::Any
& rAny
,
58 ScDocument
* pDoc
, const ScRange
& rRange
,
59 BOOL bAllowNV
= FALSE
);
62 Additionally to the differentiation between string and double allow
63 differentiation between other types such as as boolean. Needed for
64 implementation of XFormulaParser. If <FALSE/>, boolean values are
65 treated as ordinary double values 1 (true) and 0 (false).
67 static BOOL
FillMixedArray( com::sun::star::uno::Any
& rAny
,
68 const ScMatrix
* pMatrix
, bool bDataTypes
= false );
72 class ScApiTypeConversion
76 /** Convert an uno::Any to double if possible, including integer types.
78 Out: the double value on successful conversion.
80 Out: the uno::TypeClass of rAny.
81 @returns <TRUE/> if successfully converted.
83 static bool ConvertAnyToDouble(
85 com::sun::star::uno::TypeClass
& o_eClass
,
86 const com::sun::star::uno::Any
& rAny
);
91 class ScSequenceToMatrix
95 /** Convert a sequence of mixed elements to ScMatrix.
97 Precondition: rAny.getValueType().equals( getCppuType( (uno::Sequence< uno::Sequence< uno::Any > > *)0))
99 @returns a new'd ScMatrix as ScMatrixRef, NULL if rAny couldn't be read
100 as type Sequence<Sequence<Any>>
102 static ScMatrixRef
CreateMixedMatrix( const com::sun::star::uno::Any
& rAny
);
107 class ScByteSequenceToString
110 // rAny must contain Sequence<sal_Int8>,
111 // may or may not contain 0-bytes at the end
112 static BOOL
GetString( String
& rString
, const com::sun::star::uno::Any
& rAny
,
113 sal_uInt16 nEncoding
);