summaryrefslogtreecommitdiff
path: root/sc/inc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-02 12:41:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-03 16:04:17 +0100
commite3308af401013713bbfe27b6df9952586c52f4aa (patch)
treed498f4a3bfefef5a4c964986cf76d86201ba58e8 /sc/inc
parenta4fbb496ef001d62fce0ad3cdd7a829f99aa182e (diff)
TypedWhichId in sc
Change-Id: I43558191f65bfb07abfbc92970629d5dd561a04e Reviewed-on: https://gerrit.libreoffice.org/49141 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc/inc')
-rw-r--r--sc/inc/autoform.hxx4
-rw-r--r--sc/inc/column.hxx4
-rw-r--r--sc/inc/document.hxx13
-rw-r--r--sc/inc/table.hxx4
4 files changed, 25 insertions, 0 deletions
diff --git a/sc/inc/autoform.hxx b/sc/inc/autoform.hxx
index bb9b886f3e44..b1559dc264de 100644
--- a/sc/inc/autoform.hxx
+++ b/sc/inc/autoform.hxx
@@ -290,6 +290,10 @@ public:
void SetIncludeWidthHeight( bool bWidthHeight ) { bIncludeWidthHeight = bWidthHeight; }
const SfxPoolItem* GetItem( sal_uInt16 nIndex, sal_uInt16 nWhich ) const;
+ template<class T> const T* GetItem( sal_uInt16 nIndex, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetItem(nIndex, sal_uInt16(nWhich)));
+ }
void PutItem( sal_uInt16 nIndex, const SfxPoolItem& rItem );
void CopyItem( sal_uInt16 nToIndex, sal_uInt16 nFromIndex, sal_uInt16 nWhich );
diff --git a/sc/inc/column.hxx b/sc/inc/column.hxx
index 67dbda8dc8dd..ff22791b6f7c 100644
--- a/sc/inc/column.hxx
+++ b/sc/inc/column.hxx
@@ -447,6 +447,10 @@ public:
sc::EndListeningContext& rEndListenCxt, sc::CompileFormulaContext& rCompileCxt );
const SfxPoolItem& GetAttr( SCROW nRow, sal_uInt16 nWhich ) const;
+ template<class T> const T& GetAttr( SCROW nRow, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T&>(GetAttr(nRow, sal_uInt16(nWhich)));
+ }
const ScPatternAttr* GetPattern( SCROW nRow ) const;
const ScPatternAttr* GetMostUsedPattern( SCROW nStartRow, SCROW nEndRow ) const;
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index 10b2bd45213f..baddf99786c4 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -41,6 +41,7 @@
#include <svl/hint.hxx>
#include <tools/gen.hxx>
#include <svl/zforlist.hxx>
+#include <svl/typedwhich.hxx>
#include <cassert>
#include <memory>
@@ -1618,7 +1619,15 @@ public:
double& rResult );
SC_DLLPUBLIC const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
+ template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetAttr(nCol, nRow, nTab, sal_uInt16(nWhich)));
+ }
SC_DLLPUBLIC const SfxPoolItem* GetAttr( const ScAddress& rPos, sal_uInt16 nWhich ) const;
+ template<class T> const T* GetAttr( const ScAddress& rPos, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetAttr(rPos, sal_uInt16(nWhich)));
+ }
SC_DLLPUBLIC const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow, SCTAB nTab ) const;
SC_DLLPUBLIC const ScPatternAttr* GetPattern( const ScAddress& rPos ) const;
SC_DLLPUBLIC const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow, SCTAB nTab ) const;
@@ -1633,6 +1642,10 @@ public:
const ScConditionalFormatList& rList,
const std::vector<sal_uInt32>& rIndex ) const;
const SfxPoolItem* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, sal_uInt16 nWhich ) const;
+ template<class T> const T* GetEffItem( SCCOL nCol, SCROW nRow, SCTAB nTab, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetEffItem(nCol, nRow, nTab, sal_uInt16(nWhich)));
+ }
SC_DLLPUBLIC const css::uno::Reference< css::i18n::XBreakIterator >& GetBreakIterator();
bool HasStringWeakCharacters( const OUString& rString );
diff --git a/sc/inc/table.hxx b/sc/inc/table.hxx
index 9698b4fbc462..c3c65a0b81d5 100644
--- a/sc/inc/table.hxx
+++ b/sc/inc/table.hxx
@@ -675,6 +675,10 @@ public:
void SetMergedCells( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 );
const SfxPoolItem* GetAttr( SCCOL nCol, SCROW nRow, sal_uInt16 nWhich ) const;
+ template<class T> const T* GetAttr( SCCOL nCol, SCROW nRow, TypedWhichId<T> nWhich ) const
+ {
+ return static_cast<const T*>(GetAttr(nCol, nRow, sal_uInt16(nWhich)));
+ }
const ScPatternAttr* GetPattern( SCCOL nCol, SCROW nRow ) const;
const ScPatternAttr* GetMostUsedPattern( SCCOL nCol, SCROW nStartRow, SCROW nEndRow ) const;