xref: /aoo41x/main/sc/inc/rangeseq.hxx (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 #ifndef SC_RANGESEQ_HXX
29 #define SC_RANGESEQ_HXX
30 
31 #include <tools/solar.h>
32 #include <com/sun/star/uno/Any.h>
33 #include "scmatrix.hxx"
34 
35 class SvNumberFormatter;
36 class ScDocument;
37 class ScRange;
38 
39 class ScRangeToSequence
40 {
41 public:
42 	static sal_Bool	FillLongArray( com::sun::star::uno::Any& rAny,
43 								ScDocument* pDoc, const ScRange& rRange );
44 	static sal_Bool	FillLongArray( com::sun::star::uno::Any& rAny,
45 								const ScMatrix* pMatrix );
46 	static sal_Bool	FillDoubleArray( com::sun::star::uno::Any& rAny,
47 								ScDocument* pDoc, const ScRange& rRange );
48 	static sal_Bool	FillDoubleArray( com::sun::star::uno::Any& rAny,
49 								const ScMatrix* pMatrix );
50 	static sal_Bool	FillStringArray( com::sun::star::uno::Any& rAny,
51 								ScDocument* pDoc, const ScRange& rRange );
52 	static sal_Bool	FillStringArray( com::sun::star::uno::Any& rAny,
53 								const ScMatrix* pMatrix, SvNumberFormatter* pFormatter );
54 	static sal_Bool	FillMixedArray( com::sun::star::uno::Any& rAny,
55 								ScDocument* pDoc, const ScRange& rRange,
56 								sal_Bool bAllowNV = sal_False );
57 
58     /** @param bDataTypes
59             Additionally to the differentiation between string and double allow
60             differentiation between other types such as as boolean. Needed for
61             implementation of XFormulaParser. If <FALSE/>, boolean values are
62             treated as ordinary double values 1 (true) and 0 (false).
63      */
64 	static sal_Bool	FillMixedArray( com::sun::star::uno::Any& rAny,
65 								const ScMatrix* pMatrix, bool bDataTypes = false );
66 };
67 
68 
69 class ScApiTypeConversion
70 {
71 public:
72 
73     /** Convert an uno::Any to double if possible, including integer types.
74         @param o_fVal
75             Out: the double value on successful conversion.
76         @param o_eClass
77             Out: the uno::TypeClass of rAny.
78         @returns <TRUE/> if successfully converted.
79      */
80     static  bool        ConvertAnyToDouble(
81                             double & o_fVal,
82                             com::sun::star::uno::TypeClass & o_eClass,
83                             const com::sun::star::uno::Any & rAny );
84 
85 };
86 
87 
88 class ScSequenceToMatrix
89 {
90 public:
91 
92     /** Convert a sequence of mixed elements to ScMatrix.
93 
94         Precondition: rAny.getValueType().equals( getCppuType( (uno::Sequence< uno::Sequence< uno::Any > > *)0))
95 
96         @returns a new'd ScMatrix as ScMatrixRef, NULL if rAny couldn't be read
97         as type Sequence<Sequence<Any>>
98      */
99     static  ScMatrixRef CreateMixedMatrix( const com::sun::star::uno::Any & rAny );
100 
101 };
102 
103 
104 class ScByteSequenceToString
105 {
106 public:
107 	//	rAny must contain Sequence<sal_Int8>,
108 	//	may or may not contain 0-bytes at the end
109 	static sal_Bool GetString( String& rString, const com::sun::star::uno::Any& rAny,
110 							sal_uInt16 nEncoding );
111 };
112 
113 #endif
114 
115