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: convuno.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_CONVUNO_HXX
32 #define SC_CONVUNO_HXX
35 #ifndef _COM_SUN_STAR_TABLE_CELLADDRESS_HPP_
36 #include <com/sun/star/table/CellAddress.hpp>
38 #ifndef _COM_SUN_STAR_TABLE_CELLRANGEADDRESS_HPP_
39 #include <com/sun/star/table/CellRangeAddress.hpp>
51 static LanguageType
GetLanguage( const ::com::sun::star::lang::Locale
& rLocale
);
52 static void FillLocale( ::com::sun::star::lang::Locale
& rLocale
, LanguageType eLang
);
54 // CellAddress -> ScAddress
55 static inline void FillScAddress(
56 ScAddress
& rScAddress
,
57 const ::com::sun::star::table::CellAddress
& rApiAddress
);
58 // ScAddress -> CellAddress
59 static inline void FillApiAddress(
60 ::com::sun::star::table::CellAddress
& rApiAddress
,
61 const ScAddress
& rScAddress
);
62 // CellRangeAddress -> ScRange
63 static inline void FillScRange(
65 const ::com::sun::star::table::CellRangeAddress
& rApiRange
);
66 // ScRange -> CellRangeAddress
67 static inline void FillApiRange(
68 ::com::sun::star::table::CellRangeAddress
& rApiRange
,
69 const ScRange
& rScRange
);
70 // CellAddress -> CellRangeAddress
71 static inline void FillApiRange(
72 ::com::sun::star::table::CellRangeAddress
& rApiRange
,
73 const ::com::sun::star::table::CellAddress
& rApiAddress
);
74 // CellRangeAddress-Start -> CellAddress
75 static inline void FillApiStartAddress(
76 ::com::sun::star::table::CellAddress
& rApiAddress
,
77 const ::com::sun::star::table::CellRangeAddress
& rApiRange
);
78 // CellRangeAddress-End -> CellAddress
79 static inline void FillApiEndAddress(
80 ::com::sun::star::table::CellAddress
& rApiAddress
,
81 const ::com::sun::star::table::CellRangeAddress
& rApiRange
);
85 inline void ScUnoConversion::FillScAddress(
86 ScAddress
& rScAddress
,
87 const ::com::sun::star::table::CellAddress
& rApiAddress
)
89 rScAddress
.Set( (USHORT
)rApiAddress
.Column
, (USHORT
)rApiAddress
.Row
, (USHORT
)rApiAddress
.Sheet
);
92 inline void ScUnoConversion::FillApiAddress(
93 ::com::sun::star::table::CellAddress
& rApiAddress
,
94 const ScAddress
& rScAddress
)
96 rApiAddress
.Column
= rScAddress
.Col();
97 rApiAddress
.Row
= rScAddress
.Row();
98 rApiAddress
.Sheet
= rScAddress
.Tab();
101 inline void ScUnoConversion::FillScRange(
103 const ::com::sun::star::table::CellRangeAddress
& rApiRange
)
105 rScRange
.aStart
.Set( (USHORT
)rApiRange
.StartColumn
, (USHORT
)rApiRange
.StartRow
, (USHORT
)rApiRange
.Sheet
);
106 rScRange
.aEnd
.Set( (USHORT
)rApiRange
.EndColumn
, (USHORT
)rApiRange
.EndRow
, (USHORT
)rApiRange
.Sheet
);
109 inline void ScUnoConversion::FillApiRange(
110 ::com::sun::star::table::CellRangeAddress
& rApiRange
,
111 const ScRange
& rScRange
)
113 rApiRange
.StartColumn
= rScRange
.aStart
.Col();
114 rApiRange
.StartRow
= rScRange
.aStart
.Row();
115 rApiRange
.Sheet
= rScRange
.aStart
.Tab();
116 rApiRange
.EndColumn
= rScRange
.aEnd
.Col();
117 rApiRange
.EndRow
= rScRange
.aEnd
.Row();
120 inline void ScUnoConversion::FillApiRange(
121 ::com::sun::star::table::CellRangeAddress
& rApiRange
,
122 const ::com::sun::star::table::CellAddress
& rApiAddress
)
124 rApiRange
.StartColumn
= rApiRange
.EndColumn
= rApiAddress
.Column
;
125 rApiRange
.StartRow
= rApiRange
.EndRow
= rApiAddress
.Row
;
126 rApiRange
.Sheet
= rApiAddress
.Sheet
;
129 inline void ScUnoConversion::FillApiStartAddress(
130 ::com::sun::star::table::CellAddress
& rApiAddress
,
131 const ::com::sun::star::table::CellRangeAddress
& rApiRange
)
133 rApiAddress
.Column
= rApiRange
.StartColumn
;
134 rApiAddress
.Row
= rApiRange
.StartRow
;
135 rApiAddress
.Sheet
= rApiRange
.Sheet
;
138 inline void ScUnoConversion::FillApiEndAddress(
139 ::com::sun::star::table::CellAddress
& rApiAddress
,
140 const ::com::sun::star::table::CellRangeAddress
& rApiRange
)
142 rApiAddress
.Column
= rApiRange
.EndColumn
;
143 rApiAddress
.Row
= rApiRange
.EndRow
;
144 rApiAddress
.Sheet
= rApiRange
.Sheet
;
147 //___________________________________________________________________
149 inline sal_Bool
operator==(
150 const ::com::sun::star::table::CellAddress
& rApiAddress1
,
151 const ::com::sun::star::table::CellAddress
& rApiAddress2
)
154 (rApiAddress1
.Column
== rApiAddress2
.Column
) &&
155 (rApiAddress1
.Row
== rApiAddress2
.Row
) &&
156 (rApiAddress1
.Sheet
== rApiAddress2
.Sheet
);
159 inline sal_Bool
operator!=(
160 const ::com::sun::star::table::CellAddress
& rApiAddress1
,
161 const ::com::sun::star::table::CellAddress
& rApiAddress2
)
163 return !(rApiAddress1
== rApiAddress2
);
166 inline sal_Bool
operator==(
167 const ::com::sun::star::table::CellRangeAddress
& rApiRange1
,
168 const ::com::sun::star::table::CellRangeAddress
& rApiRange2
)
171 (rApiRange1
.StartColumn
== rApiRange2
.StartColumn
) &&
172 (rApiRange1
.StartRow
== rApiRange2
.StartRow
) &&
173 (rApiRange1
.EndColumn
== rApiRange2
.EndColumn
) &&
174 (rApiRange1
.EndRow
== rApiRange2
.EndRow
) &&
175 (rApiRange1
.Sheet
== rApiRange2
.Sheet
);
178 inline sal_Bool
operator!=(
179 const ::com::sun::star::table::CellRangeAddress
& rApiRange1
,
180 const ::com::sun::star::table::CellRangeAddress
& rApiRange2
)
182 return !(rApiRange1
== rApiRange2
);
185 } //namespace binfilter