summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-11 16:21:15 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-07-11 16:21:15 +0200
commit9d749da778b98fe76d49300c2c001cbd9fa29941 (patch)
treea33b625118dc4841ca95e30689d7143aa17c71d8
parent0ff0b9c0310d1541d1a7d02c2cc222da9191479b (diff)
Impress: implement tiled rendering.feature/calctiledrendering3
However we cannot as of yet select between rendering just the slide, just the notes, or both combined -- this simply defaults to whatever mode the document was last opened in for now. Change-Id: Ia8ec0280aab75a36e430aa04c47cee4fea2db974
-rw-r--r--sd/source/ui/unoidl/unomodel.cxx66
1 files changed, 56 insertions, 10 deletions
diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx
index 74133b895988..f86e9cbbaf89 100644
--- a/sd/source/ui/unoidl/unomodel.cxx
+++ b/sd/source/ui/unoidl/unomodel.cxx
@@ -87,6 +87,7 @@
#include <unokywds.hxx>
#include "FrameView.hxx"
#include "ClientView.hxx"
+#include "DrawViewShell.hxx"
#include "ViewShell.hxx"
#include "app.hrc"
#include <vcl/pdfextoutdevdata.hxx>
@@ -108,6 +109,7 @@
using namespace ::osl;
using namespace ::cppu;
using namespace ::com::sun::star;
+using namespace ::sd;
class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable,
public SfxListener
@@ -2190,33 +2192,77 @@ void SdXImpressDocument::paintTile( VirtualDevice& rDevice,
int nTilePosX, int nTilePosY,
long nTileWidth, long nTileHeight )
{
- (void) rDevice;
- (void) nOutputWidth;
- (void) nOutputHeight;
- (void) nTilePosX;
- (void) nTilePosY;
- (void) nTileWidth;
- (void) nTileHeight;
+ // Scaling. Must convert from pixels to twips. We know
+ // that VirtualDevices use a DPI of 96.
+ // We specifically calculate these scales first as we're still
+ // in TWIPs, and might as well minimise the number of conversions.
+ Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
+ Fraction( nTileWidth);
+ Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
+ Fraction( nTileHeight);
+
+ // svx seems to be the only component that works natively in
+ // 100th mm rather than TWIP. It makes most sense just to
+ // convert here and in getDocumentSize, and leave the tiled
+ // rendering API working in TWIPs.
+ nTileWidth = convertTwipToMm100( nTileWidth );
+ nTileHeight = convertTwipToMm100( nTileHeight );
+ nTilePosX = convertTwipToMm100( nTilePosX );
+ nTilePosY = convertTwipToMm100( nTilePosY );
+
+ MapMode aMapMode = rDevice.GetMapMode();
+ aMapMode.SetMapUnit( MAP_100TH_MM );
+ aMapMode.SetOrigin( Point( -nTilePosX,
+ -nTilePosY) );
+ aMapMode.SetScaleX( scaleX );
+ aMapMode.SetScaleY( scaleY );
+
+ rDevice.SetMapMode( aMapMode );
+
+ rDevice.SetOutputSizePixel( Size(nOutputWidth, nOutputHeight) );
+ mpDoc->GetDocSh()->GetViewShell()->GetView()->CompleteRedraw(
+ &rDevice,
+ Region(
+ Rectangle( Point( nTilePosX, nTilePosY ),
+ Size( nTileWidth, nTileHeight ) ) ) );
+
+ // TODO: Set page kind in frameview?
}
void SdXImpressDocument::setPart( int nPart )
{
- (void) nPart;
+ DrawViewShell* pViewSh = dynamic_cast< DrawViewShell* >( mpDoc->GetDocSh()->GetViewShell() );
+ if (pViewSh)
+ {
+ pViewSh->SwitchPage( nPart );
+ }
}
int SdXImpressDocument::getParts()
{
- return mpDoc->GetPageCount();
+ // TODO: master pages?
+ // Read: drviews1.cxx
+ return mpDoc->GetSdPageCount(PK_STANDARD);
}
int SdXImpressDocument::getPart()
{
+ DrawViewShell* pViewSh = dynamic_cast< DrawViewShell* >( mpDoc->GetDocSh()->GetViewShell() );
+ if (pViewSh)
+ {
+ return pViewSh->GetCurPageId();
+ }
return 0;
}
Size SdXImpressDocument::getDocumentSize()
{
- return Size( 100, 100 );
+ SdrPageView* pCurPageView = mpDoc->GetDocSh()->GetViewShell()->GetView()->GetSdrPageView();
+ Size aSize = pCurPageView->GetPageRect().GetSize();
+ // Convert the size in 100th mm to TWIP
+ // See paintTile above for further info.
+ return Size( convertMm100ToTwip( aSize.getWidth() ),
+ convertMm100ToTwip( aSize.getHeight() ) );
}