summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/viewdata.cxx
diff options
context:
space:
mode:
authorFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-09 22:07:29 +0100
committerFrank Schoenheit [fs] <frank.schoenheit@sun.com>2009-12-09 22:07:29 +0100
commitaf2cdd44357ff8013d0506fb2b38c0dd082fad33 (patch)
tree104028a5afbf3bacbce78916bac7c7efb45a3599 /sc/source/ui/view/viewdata.cxx
parentcc6395630b2203dbf1c8448916fdda610cc8b706 (diff)
parent4d256d26b3d99149c3dafe8b1acbc161c69c171d (diff)
dba33b: merge CWS head with head resulting from pulling DEV300_m67
Diffstat (limited to 'sc/source/ui/view/viewdata.cxx')
-rw-r--r--sc/source/ui/view/viewdata.cxx135
1 files changed, 107 insertions, 28 deletions
diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx
index c3848b76b92b..c23eb73e1f59 100644
--- a/sc/source/ui/view/viewdata.cxx
+++ b/sc/source/ui/view/viewdata.cxx
@@ -597,68 +597,147 @@ void ScViewData::SetViewShell( ScTabViewShell* pViewSh )
pView = NULL;
}
}
+void ScViewData::CreateTabData( std::vector< SCTAB >& rvTabs )
+{
+ std::vector< SCTAB >::iterator it_end = rvTabs.end();
+ for ( std::vector< SCTAB >::iterator it = rvTabs.begin(); it != it_end; ++it )
+ if ( !pTabData[*it] )
+ CreateTabData( *it );
+}
-void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll )
+void ScViewData::SetZoomType( SvxZoomType eNew, std::vector< SCTAB >& tabs )
{
- if ( !bAll )
- CreateSelectedTabData(); // if zoom is set for a table, it must be stored
+ BOOL bAll = ( tabs.size() == 0 );
- for ( SCTAB i = 0; i <= MAXTAB; i++ )
- if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) )
- pTabData[i]->eZoomType = eNew;
+ if ( !bAll ) // create associated table data
+ CreateTabData( tabs );
if ( bAll )
+ {
+ for ( SCTAB i = 0; i <= MAXTAB; ++i )
+ {
+ if ( pTabData[i] )
+ pTabData[i]->eZoomType = eNew;
+ }
eDefZoomType = eNew;
+ }
+ else
+ {
+ std::vector< SCTAB >::iterator it_end = tabs.end();
+ std::vector< SCTAB >::iterator it = tabs.begin();
+ for ( ; it != it_end; ++it )
+ {
+ SCTAB i = *it;
+ if ( pTabData[i] )
+ pTabData[i]->eZoomType = eNew;
+ }
+ }
}
-void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll )
+void ScViewData::SetZoomType( SvxZoomType eNew, BOOL bAll )
{
- if ( !bAll )
- CreateSelectedTabData(); // if zoom is set for a table, it must be stored
+ std::vector< SCTAB > vTabs; // Empty for all tabs
+ if ( !bAll ) // get selected tabs
+ {
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB i=0; i<nTabCount; i++)
+ {
+ if ( aMarkData.GetTableSelect(i) )
+ vTabs.push_back( i );
+ }
+ }
+ SetZoomType( eNew, vTabs );
+}
+void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vector< SCTAB >& tabs )
+{
+ BOOL bAll = ( tabs.size() == 0 );
+ 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;
+ if (aValidX<aFrac20)
+ aValidX = aFrac20;
+ if (aValidX>aFrac400)
+ aValidX = aFrac400;
Fraction aValidY = rNewY;
- if (aValidY<aFrac20) aValidY = aFrac20;
- if (aValidY>aFrac400) aValidY = aFrac400;
+ if (aValidY<aFrac20)
+ aValidY = aFrac20;
+ if (aValidY>aFrac400)
+ aValidY = aFrac400;
- if ( bPagebreak )
+ if ( bAll )
{
- for ( SCTAB i = 0; i <= MAXTAB; i++ )
- if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) )
+ for ( SCTAB i = 0; i <= MAXTAB; ++i )
+ {
+ if ( pTabData[i] )
{
- pTabData[i]->aPageZoomX = aValidX;
- pTabData[i]->aPageZoomY = aValidY;
+ if ( bPagebreak )
+ {
+ pTabData[i]->aPageZoomX = aValidX;
+ pTabData[i]->aPageZoomY = aValidY;
+ }
+ else
+ {
+ pTabData[i]->aZoomX = aValidX;
+ pTabData[i]->aZoomY = aValidY;
+ }
}
- if ( bAll )
+ }
+ if ( bPagebreak )
{
aDefPageZoomX = aValidX;
aDefPageZoomY = aValidY;
}
+ else
+ {
+ aDefZoomX = aValidX;
+ aDefZoomY = aValidY;
+ }
}
else
{
- for ( SCTAB i = 0; i <= MAXTAB; i++ )
- if ( pTabData[i] && ( bAll || aMarkData.GetTableSelect(i) ) )
+ std::vector< SCTAB >::iterator it_end = tabs.end();
+ std::vector< SCTAB >::iterator it = tabs.begin();
+ for ( ; it != it_end; ++it )
+ {
+ SCTAB i = *it;
+ if ( pTabData[i] )
{
- pTabData[i]->aZoomX = aValidX;
- pTabData[i]->aZoomY = aValidY;
+ if ( bPagebreak )
+ {
+ pTabData[i]->aPageZoomX = aValidX;
+ pTabData[i]->aPageZoomY = aValidY;
+ }
+ else
+ {
+ pTabData[i]->aZoomX = aValidX;
+ pTabData[i]->aZoomY = aValidY;
+ }
}
- if ( bAll )
- {
- aDefZoomX = aValidX;
- aDefZoomY = aValidY;
}
}
-
RefreshZoom();
}
+void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, BOOL bAll )
+{
+ std::vector< SCTAB > vTabs;
+ if ( !bAll ) // get selected tabs
+ {
+ SCTAB nTabCount = pDoc->GetTableCount();
+ for (SCTAB i=0; i<nTabCount; i++)
+ {
+ if ( aMarkData.GetTableSelect(i) )
+ vTabs.push_back( i );
+ }
+ }
+ SetZoom( rNewX, rNewY, vTabs );
+}
+
void ScViewData::RefreshZoom()
{
// recalculate zoom-dependent values (only for current sheet)