summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 )