[Libreoffice-commits] core.git: Branch 'feature/gtkbmptiledviewer2' - 3 commits - sc/inc sc/source
Andrzej Hunt
andrzej.hunt at collabora.com
Mon Jun 16 08:23:20 PDT 2014
sc/inc/docuno.hxx | 13 ++++++++++
sc/source/ui/inc/gridwin.hxx | 8 +++++-
sc/source/ui/unoobj/docuno.cxx | 23 +++++++++++++++++
sc/source/ui/view/gridwin4.cxx | 53 +++++++++++++++++++++++++++++++++++++----
4 files changed, 92 insertions(+), 5 deletions(-)
New commits:
commit 807a3d8b8784a872e77c0d8b5023c2e0b427544a
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Mon Jun 16 16:19:56 2014 +0100
Calc: Add tiled rendering device to the paint view.
This prevents the previous warnings of
SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), \
this should never be needed
Change-Id: I76cb7c9ed4d45bfcbd297f697314309b4e036f80
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index dd2db46..9222e2b 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -34,6 +34,7 @@
#include "gridwin.hxx"
#include "viewdata.hxx"
+#include "drawview.hxx"
#include "output.hxx"
#include "document.hxx"
#include "attrib.hxx"
@@ -903,7 +904,19 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
aMapMode.SetScaleY( scaleY );
rDevice.SetMapMode( aMapMode );
+ ScTabViewShell* pTabViewSh = pViewData->GetViewShell();
+ SdrView* pDrawView = pTabViewSh->GetScDrawView();
+ if ( pDrawView )
+ {
+ pDrawView->AddWindowToPaintView( &rDevice );
+ }
+
Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
+
+ if ( pDrawView )
+ {
+ pDrawView->DeleteWindowFromPaintView( &rDevice );
+ }
}
void ScGridWindow::CheckNeedsRepaint()
commit 7b9904602387cf9fe490a37260612a5cc61411db
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Mon Jun 16 15:00:02 2014 +0100
Render tiles from calc.
Currently the document size and number of cells to be rendered
is hardcoded, this will need some more work to select the correct
cells for a given tile (i.e. cells from location). Also, there
isn't really a "size" for a calc sheet, so presumably we'd need
to instead return the area containing cells that aren't empty,
whilst still being able to render larger tiles? (And in any case
the client will need to be aware of this and provide an appropriate
interface, i.e. the current LO UI simply extends the sheet ad-infinitum.)
We also currently get some warnings most likely related to the way
we push our OutputDevice into the rendering methods:
SdrPageView::DrawLayer: Creating temporary SdrPageWindow (ObjectContact), \
this should never be needed
Change-Id: Ia9d64d7de6c22d5b401350f88497a7ec106f1973
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 085cef9..87072fd 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -360,7 +360,8 @@ public:
using Window::Draw;
void Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
- ScUpdateMode eMode = SC_UPDATE_ALL );
+ ScUpdateMode eMode = SC_UPDATE_ALL,
+ OutputDevice* pOutDev = 0 );
void CreateAnchorHandle(SdrHdlList& rHdl, const ScAddress& rAddress);
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 090f41b..6922e94 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -466,7 +466,7 @@ Size ScModelObj::getDocumentSize()
// TODO: not sure what we want to do here, maybe just return the size for a certain
// default minimum number of cells, e.g. 100x100 and more if more cells have
// content?
- return Size();
+ return Size( 3200, 3200 );
}
uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 67e838c..dd2db46 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -379,8 +379,14 @@ void ScGridWindow::Paint( const Rectangle& rRect )
// Draw ----------------------------------------------------------------
-void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode )
+void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMode eMode,
+ OutputDevice* pOutDev )
{
+ if ( !pOutDev )
+ {
+ pOutDev = this;
+ }
+
ScModule* pScMod = SC_MOD();
bool bTextWysiwyg = pScMod->GetInputOptions().GetTextWysiwyg();
@@ -472,7 +478,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
Fraction aZoomX = pViewData->GetZoomX();
Fraction aZoomY = pViewData->GetZoomY();
- ScOutputData aOutputData( this, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,
+ ScOutputData aOutputData( pOutDev, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab,
nScrX, nScrY, nX1, nY1, nX2, nY2, nPPTX, nPPTY,
&aZoomX, &aZoomY );
@@ -587,7 +593,9 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
aDrawingRectLogic = PixelToLogic(aDrawingRectPixel, aDrawMode);
}
- OutputDevice* pContentDev = this; // device for document content, used by overlay manager
+ // device for document content, used by overlay manager
+ // We usually paint to ourselves, but allow other devices for tiled rendering.
+ OutputDevice* pContentDev = pOutDev;
SdrPaintWindow* pTargetPaintWindow = 0; // #i74769# work with SdrPaintWindow directly
{
@@ -604,7 +612,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
{
// #i74769# Use new BeginDrawLayers() interface
Region aDrawingRegion(aDrawingRectLogic);
- pTargetPaintWindow = pDrawView->BeginDrawLayers(this, aDrawingRegion);
+ pTargetPaintWindow = pDrawView->BeginDrawLayers(pOutDev, aDrawingRegion);
OSL_ENSURE(pTargetPaintWindow, "BeginDrawLayers: Got no SdrPaintWindow (!)");
// #i74769# get target device from SdrPaintWindow, this may be the prerender
@@ -879,13 +887,23 @@ void ScGridWindow::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;
+ rDevice.SetOutputSizePixel( Size( nOutputWidth, nOutputHeight ) );
+ // setup the output device to draw the tile
+ MapMode aMapMode( rDevice.GetMapMode() );
+ aMapMode.SetMapUnit( MAP_TWIP );
+ aMapMode.SetOrigin( Point( -nTilePosX, -nTilePosY ) );
+
+ // Scaling. Must convert from pixels to twips. We know
+ // that VirtualDevises use a DPI of 96.
+ Fraction scaleX = Fraction( nOutputWidth, 96 ) * Fraction(1440L) /
+ Fraction( nTileWidth);
+ Fraction scaleY = Fraction( nOutputHeight, 96 ) * Fraction(1440L) /
+ Fraction( nTileHeight);
+ aMapMode.SetScaleX( scaleX );
+ aMapMode.SetScaleY( scaleY );
+ rDevice.SetMapMode( aMapMode );
+
+ Draw( 0, 0, 3, 3, SC_UPDATE_ALL, &rDevice );
}
void ScGridWindow::CheckNeedsRepaint()
commit 9e23bec50ac3f92ac3163754c1349642c5b7ad04
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date: Mon Jun 16 13:50:49 2014 +0100
Add tiled rendering outline to Calc.
(No real implementation yet.)
Change-Id: I67b84b554dbb29db449d8c190ef816645a8bff07
diff --git a/sc/inc/docuno.hxx b/sc/inc/docuno.hxx
index 61881d4..f39b4ae 100644
--- a/sc/inc/docuno.hxx
+++ b/sc/inc/docuno.hxx
@@ -54,6 +54,7 @@
#include <cppuhelper/implbase5.hxx>
#include <cppuhelper/interfacecontainer.h>
#include <svl/itemprop.hxx>
+#include <vcl/ITiledRenderable.hxx>
#include "drwlayer.hxx"
class ScDocShell;
@@ -69,6 +70,7 @@ class ScPrintUIOptions;
class ScSheetSaveData;
class SC_DLLPUBLIC ScModelObj : public SfxBaseModel,
+ public ::vcl::ITiledRenderable,
public com::sun::star::sheet::XSpreadsheetDocument,
public com::sun::star::document::XActionLockable,
public com::sun::star::sheet::XCalculatable,
@@ -350,6 +352,17 @@ public:
virtual com::sun::star::uno::Sequence< com::sun::star::sheet::opencl::OpenCLPlatform >
SAL_CALL getOpenCLPlatforms()
throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
+
+
+ // ITiledRenderable
+ virtual void paintTile( VirtualDevice& rDevice,
+ int nOutputWidth,
+ int nOutputHeight,
+ int nTilePosX,
+ int nTilePosY,
+ long nTileWidth,
+ long nTileHeight ) SAL_OVERRIDE;
+ virtual Size getDocumentSize() SAL_OVERRIDE;
};
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index 0a01935..085cef9 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -321,6 +321,11 @@ public:
virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE;
virtual void Tracking( const TrackingEvent& rTEvt ) SAL_OVERRIDE;
+ void PaintTile( VirtualDevice& rDevice,
+ int nOutputWidth, int nOutputHeight,
+ int nTilePosX, int nTilePosY,
+ long nTileWidth, long nTileHeight );
+
virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible() SAL_OVERRIDE;
void FakeButtonUp();
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 9aeceb7..090f41b 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -96,6 +96,7 @@
#include "platforminfo.hxx"
#include "interpre.hxx"
#include "formulagroup.hxx"
+#include "gridwin.hxx"
#include <columnspanset.hxx>
using namespace com::sun::star;
@@ -446,6 +447,28 @@ void ScModelObj::RepaintRange( const ScRangeList& rRange )
pDocShell->PostPaint( rRange, PAINT_GRID );
}
+void ScModelObj::paintTile( VirtualDevice& rDevice,
+ int nOutputWidth, int nOutputHeight,
+ int nTilePosX, int nTilePosY,
+ long nTileWidth, long nTileHeight )
+{
+ // There seems to be no clear way of getting the grid window for this
+ // particular document, hence we need to hope we get the right window.
+ ScViewData* pViewData = ScDocShell::GetViewData();
+ ScGridWindow* pGridWindow = pViewData->GetActiveWin();
+
+ pGridWindow->PaintTile( rDevice, nOutputWidth, nOutputHeight,
+ nTilePosX, nTilePosY, nTileWidth, nTileHeight );
+}
+
+Size ScModelObj::getDocumentSize()
+{
+ // TODO: not sure what we want to do here, maybe just return the size for a certain
+ // default minimum number of cells, e.g. 100x100 and more if more cells have
+ // content?
+ return Size();
+}
+
uno::Any SAL_CALL ScModelObj::queryInterface( const uno::Type& rType )
throw(uno::RuntimeException, std::exception)
{
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 69de77b..67e838c 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -874,6 +874,20 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
pDoc->ClearFormulaContext();
}
+void ScGridWindow::PaintTile( VirtualDevice& rDevice,
+ int nOutputWidth, int nOutputHeight,
+ int nTilePosX, int nTilePosY,
+ long nTileWidth, long nTileHeight )
+{
+ (void) rDevice;
+ (void) nOutputWidth;
+ (void) nOutputHeight;
+ (void) nTilePosX;
+ (void) nTilePosY;
+ (void) nTileWidth;
+ (void) nTileHeight;
+}
+
void ScGridWindow::CheckNeedsRepaint()
{
// called at the end of painting, and from timer after background text width calculation
More information about the Libreoffice-commits
mailing list