summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-15 09:53:56 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-09-29 06:29:42 +0100
commit79b1d94c66dd5166276e88a7625c6ee5ea03cfdf (patch)
tree35c6331503289e28639b12c28f4ad461be44d996
parent86e7595b39914fd5b0809bee4d9eccac6e2ae594 (diff)
Allow overriding limits for SetZoom for Tiled Rendering.
Change-Id: Ic656012921408ce5c8dc691933a71a9e0ac78e5d
-rw-r--r--sc/source/ui/inc/viewdata.hxx9
-rw-r--r--sc/source/ui/view/viewdata.cxx38
2 files changed, 31 insertions, 16 deletions
diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx
index e187ec085a5b..fff44d99fbfe 100644
--- a/sc/source/ui/inc/viewdata.hxx
+++ b/sc/source/ui/inc/viewdata.hxx
@@ -305,8 +305,13 @@ public:
void SetZoomType( SvxZoomType eNew, bool bAll );
void SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs );
- void SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs );
- void SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll );
+ // bIgnoreLimits in this context disables checking that our zoom is within the
+ // range of 20%-400% -- i.e. should be used for tiled rendering where such checks
+ // should be done by the client.
+ void SetZoom( const Fraction& rNewX, const Fraction& rNewY,
+ std::vector< SCTAB >& tabs, const bool bIgnoreLimits = false );
+ void SetZoom( const Fraction& rNewX, const Fraction& rNewY,
+ bool bAll, const bool bIgnoreLimits = false );
void RefreshZoom();
void SetSelCtrlMouseClick( bool bTmp ) { bSelCtrlMouseClick = bTmp; }
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index 0940d611bd16..27029663cfd1 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -616,25 +616,34 @@ void ScViewData::SetZoomType( SvxZoomType eNew, bool bAll )
SetZoomType( eNew, vTabs );
}
-void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs )
+void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY,
+ std::vector< SCTAB >& tabs,
+ const bool bIgnoreLimits )
{
bool bAll = ( tabs.empty() );
if ( !bAll ) // create associated table data
CreateTabData( tabs );
- Fraction aFrac20( 1,5 );
- Fraction aFrac400( 4,1 );
Fraction aValidX = rNewX;
- if (aValidX<aFrac20)
- aValidX = aFrac20;
- if (aValidX>aFrac400)
- aValidX = aFrac400;
-
Fraction aValidY = rNewY;
- if (aValidY<aFrac20)
- aValidY = aFrac20;
- if (aValidY>aFrac400)
- aValidY = aFrac400;
+
+ // We probably don't want these limits for tiled rendering, hence
+ // we make them optional.
+ if ( !bIgnoreLimits )
+ {
+ const Fraction aFrac20( 1, 5 );
+ const Fraction aFrac400( 4, 1 );
+
+ if ( aValidX < aFrac20 )
+ aValidX = aFrac20;
+ else if ( aValidX > aFrac400 )
+ aValidX = aFrac400;
+
+ if ( aValidY < aFrac20 )
+ aValidY = aFrac20;
+ else if ( aValidY > aFrac400 )
+ aValidY = aFrac400;
+ }
if ( bAll )
{
@@ -690,7 +699,8 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec
RefreshZoom();
}
-void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAll )
+void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY,
+ bool bAll, const bool bIgnoreLimits )
{
std::vector< SCTAB > vTabs;
if ( !bAll ) // get selected tabs
@@ -698,7 +708,7 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, bool bAl
ScMarkData::iterator itr = mpMarkData->begin(), itrEnd = mpMarkData->end();
vTabs.insert(vTabs.begin(), itr, itrEnd);
}
- SetZoom( rNewX, rNewY, vTabs );
+ SetZoom( rNewX, rNewY, vTabs, bIgnoreLimits );
}
void ScViewData::SetShowGrid( bool bShow )