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