summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-15 16:48:41 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-30 21:37:09 +0200
commit2ccfad1a23172e3a29185973e9c6ce2f33d5f2d8 (patch)
treefe052448425eaa6f2abb05486ddac08a90f89a78
parent5a8df7cd86cc8c9c70bfec841893b19d45574ecf (diff)
Implement some Logic/Pixel conversion functions for ScViewData.
Change-Id: I54c99d19852be9825f3dbe80fcbfcfa13a79c835
-rw-r--r--sc/source/ui/inc/viewdata.hxx6
-rw-r--r--sc/source/ui/view/viewdata.cxx24
2 files changed, 30 insertions, 0 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index 21232c22a08b..6ab3060692a0 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -482,6 +482,12 @@ public:
static inline long ToPixel( sal_uInt16 nTwips, double nFactor );
+ long LogicToPixelVertical( long nTwips );
+ long LogicToPixelHorizontal( long nTwips );
+
+ long PixelToLogicVertical( long nPix );
+ long PixelToLogicHorizontal( long nPix );
+
/** while (rScrY <= nEndPixels && rPosY <= nEndRow) add pixels of row
heights converted with nPPTY to rScrY, optimized for row height
segments. Upon return rPosY is the last row evaluated <= nEndRow, rScrY
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 55b8c4f07ad3..8ba9b7e95766 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -3099,4 +3099,28 @@ void ScViewData::AddPixelsWhileBackward( long & rScrY, long nEndPixels,
rPosY = nRow;
}
+long ScViewData::LogicToPixelVertical( long nTwips )
+{
+ return GetActiveWin()->LogicToPixel( Point( 0, nTwips ),
+ maPaintMapMode ).getY();
+}
+
+long ScViewData::LogicToPixelHorizontal( long nTwips )
+{
+ return GetActiveWin()->LogicToPixel( Point( nTwips, 0 ),
+ maPaintMapMode ).getX();
+}
+
+long ScViewData::PixelToLogicVertical( long nPix )
+{
+ return GetActiveWin()->PixelToLogic( Point( 0, nPix ),
+ maPaintMapMode ).getY();
+}
+
+long ScViewData::PixelToLogicHorizontal( long nPix )
+{
+ return GetActiveWin()->PixelToLogic( Point( nPix, 0 ),
+ maPaintMapMode ).getX();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */