summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sd/source/ui/table/tablefunction.cxx24
1 files changed, 22 insertions, 2 deletions
diff --git a/sd/source/ui/table/tablefunction.cxx b/sd/source/ui/table/tablefunction.cxx
index 0070bee8e0d3..7535798d3b7d 100644
--- a/sd/source/ui/table/tablefunction.cxx
+++ b/sd/source/ui/table/tablefunction.cxx
@@ -146,12 +146,32 @@ void DrawViewShell::FuTable(SfxRequest& rReq)
}
else
{
- Size aSize( 14100, 200 );
+ Size aSize( 14100, 2000 );
Point aPos;
Rectangle aWinRect(aPos, GetActiveWindow()->GetOutputSizePixel() );
+ aWinRect = GetActiveWindow()->PixelToLogic(aWinRect);
+
+ // make sure that the default size of the table fits on the paper and is inside the viewing area.
+ // if zoomed in close, don't make the table bigger than the viewing window.
+ Size aMaxSize = getCurrentPage()->GetSize();
+ if( aMaxSize.Height() > aWinRect.getHeight() )
+ aMaxSize.setHeight( aWinRect.getHeight() );
+ if( aMaxSize.Width() > aWinRect.getWidth() )
+ aMaxSize.setWidth( aWinRect.getWidth() );
+
+ if( aSize.Width() > aMaxSize.getWidth() )
+ aSize.setWidth( aMaxSize.getWidth() );
+
+ // adjust height based on # of rows.
+ if( nRows > 0 )
+ {
+ aSize.setHeight( aSize.Height() * nRows );
+ if( aSize.Height() > aMaxSize.getHeight() )
+ aSize.setHeight( aMaxSize.getHeight() );
+ }
+
aPos = aWinRect.Center();
- aPos = GetActiveWindow()->PixelToLogic(aPos);
aPos.X() -= aSize.Width() / 2;
aPos.Y() -= aSize.Height() / 2;
aRect = Rectangle(aPos, aSize);