summaryrefslogtreecommitdiffstats
path: root/sc/inc/convuno.hxx
diff options
context:
space:
mode:
authorDaniel Rentz <dr@openoffice.org>2000-11-09 08:30:31 +0000
committerDaniel Rentz <dr@openoffice.org>2000-11-09 08:30:31 +0000
commitc07d4c16d30dc5860c79eb0e1f2ce42192addd98 (patch)
tree6e3321957c2f38a40f76eb2c4eb3ee0d42f9246f /sc/inc/convuno.hxx
parentreplaced XOutBitmap::GetBitmapFromGraphic with Graphic::GetBitmap (diff)
downloadcore-c07d4c16d30dc5860c79eb0e1f2ce42192addd98.tar.gz
core-c07d4c16d30dc5860c79eb0e1f2ce42192addd98.zip
add/chg: address/range converter routines
Diffstat (limited to 'sc/inc/convuno.hxx')
-rw-r--r--sc/inc/convuno.hxx142
1 files changed, 137 insertions, 5 deletions
diff --git a/sc/inc/convuno.hxx b/sc/inc/convuno.hxx
index 41423fb7326c..f6f162f320b7 100644
--- a/sc/inc/convuno.hxx
+++ b/sc/inc/convuno.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: convuno.hxx,v $
*
- * $Revision: 1.1.1.1 $
+ * $Revision: 1.2 $
*
- * last change: $Author: hr $ $Date: 2000-09-18 16:44:48 $
+ * last change: $Author: dr $ $Date: 2000-11-09 09:30:31 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -66,6 +66,9 @@
#include <tools/lang.hxx>
#endif
+#ifndef _COM_SUN_STAR_TABLE_CELLADDRESS_HPP_
+#include <com/sun/star/table/CellAddress.hpp>
+#endif
#ifndef _COM_SUN_STAR_TABLE_CELLRANGEADDRESS_HPP_
#include <com/sun/star/table/CellRangeAddress.hpp>
#endif
@@ -74,17 +77,146 @@
#include <com/sun/star/lang/Locale.hpp>
#endif
-class ScRange;
+#ifndef SC_SCGLOB_HXX
+#include "global.hxx"
+#endif
class ScUnoConversion
{
public:
- static void FillRange( ScRange& rDest, const com::sun::star::table::CellRangeAddress& rSource );
- static void FillAddress( com::sun::star::table::CellRangeAddress& rDest, const ScRange& rSource );
static LanguageType GetLanguage( const com::sun::star::lang::Locale& rLocale );
static void FillLocale( com::sun::star::lang::Locale& rLocale, LanguageType eLang );
+
+ // CellAddress -> ScAddress
+ static inline void FillScAddress(
+ ScAddress& rScAddress,
+ const ::com::sun::star::table::CellAddress& rApiAddress );
+ // ScAddress -> CellAddress
+ static inline void FillApiAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ScAddress& rScAddress );
+ // CellRangeAddress -> ScRange
+ static inline void FillScRange(
+ ScRange& rScRange,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange );
+ // ScRange -> CellRangeAddress
+ static inline void FillApiRange(
+ ::com::sun::star::table::CellRangeAddress& rApiRange,
+ const ScRange& rScRange );
+ // CellAddress -> CellRangeAddress
+ static inline void FillApiRange(
+ ::com::sun::star::table::CellRangeAddress& rApiRange,
+ const ::com::sun::star::table::CellAddress& rApiAddress );
+ // CellRangeAddress-Start -> CellAddress
+ static inline void FillApiStartAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange );
+ // CellRangeAddress-End -> CellAddress
+ static inline void FillApiEndAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange );
};
+inline void ScUnoConversion::FillScAddress(
+ ScAddress& rScAddress,
+ const ::com::sun::star::table::CellAddress& rApiAddress )
+{
+ rScAddress.Set( rApiAddress.Column, rApiAddress.Row, rApiAddress.Sheet );
+}
+
+inline void ScUnoConversion::FillApiAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ScAddress& rScAddress )
+{
+ rApiAddress.Column = rScAddress.Col();
+ rApiAddress.Row = rScAddress.Row();
+ rApiAddress.Sheet = rScAddress.Tab();
+}
+
+inline void ScUnoConversion::FillScRange(
+ ScRange& rScRange,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange )
+{
+ rScRange.aStart.Set( rApiRange.StartColumn, rApiRange.StartRow, rApiRange.Sheet );
+ rScRange.aEnd.Set( rApiRange.EndColumn, rApiRange.EndRow, rApiRange.Sheet );
+}
+
+inline void ScUnoConversion::FillApiRange(
+ ::com::sun::star::table::CellRangeAddress& rApiRange,
+ const ScRange& rScRange )
+{
+ rApiRange.StartColumn = rScRange.aStart.Col();
+ rApiRange.StartRow = rScRange.aStart.Row();
+ rApiRange.Sheet = rScRange.aStart.Tab();
+ rApiRange.EndColumn = rScRange.aEnd.Col();
+ rApiRange.EndRow = rScRange.aEnd.Row();
+}
+
+inline void ScUnoConversion::FillApiRange(
+ ::com::sun::star::table::CellRangeAddress& rApiRange,
+ const ::com::sun::star::table::CellAddress& rApiAddress )
+{
+ rApiRange.StartColumn = rApiRange.EndColumn = rApiAddress.Column;
+ rApiRange.StartRow = rApiRange.EndRow = rApiAddress.Row;
+ rApiRange.Sheet = rApiAddress.Sheet;
+}
+
+inline void ScUnoConversion::FillApiStartAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange )
+{
+ rApiAddress.Column = rApiRange.StartColumn;
+ rApiAddress.Row = rApiRange.StartRow;
+ rApiAddress.Sheet = rApiRange.Sheet;
+}
+
+inline void ScUnoConversion::FillApiEndAddress(
+ ::com::sun::star::table::CellAddress& rApiAddress,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange )
+{
+ rApiAddress.Column = rApiRange.EndColumn;
+ rApiAddress.Row = rApiRange.EndRow;
+ rApiAddress.Sheet = rApiRange.Sheet;
+}
+
+//___________________________________________________________________
+
+inline sal_Bool operator==(
+ const ::com::sun::star::table::CellAddress& rApiAddress1,
+ const ::com::sun::star::table::CellAddress& rApiAddress2 )
+{
+ return
+ (rApiAddress1.Column == rApiAddress2.Column) &&
+ (rApiAddress1.Row == rApiAddress2.Row) &&
+ (rApiAddress1.Sheet == rApiAddress2.Sheet);
+}
+
+inline sal_Bool operator!=(
+ const ::com::sun::star::table::CellAddress& rApiAddress1,
+ const ::com::sun::star::table::CellAddress& rApiAddress2 )
+{
+ return !(rApiAddress1 == rApiAddress2);
+}
+
+inline sal_Bool operator==(
+ const ::com::sun::star::table::CellRangeAddress& rApiRange1,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange2 )
+{
+ return
+ (rApiRange1.StartColumn == rApiRange2.StartColumn) &&
+ (rApiRange1.StartRow == rApiRange2.StartRow) &&
+ (rApiRange1.EndColumn == rApiRange2.EndColumn) &&
+ (rApiRange1.EndRow == rApiRange2.EndRow) &&
+ (rApiRange1.Sheet == rApiRange2.Sheet);
+}
+
+inline sal_Bool operator!=(
+ const ::com::sun::star::table::CellRangeAddress& rApiRange1,
+ const ::com::sun::star::table::CellRangeAddress& rApiRange2 )
+{
+ return !(rApiRange1 == rApiRange2);
+}
+
#endif